From 9114911ff3350c7e11fe44ef52c36b095dacd5b5 Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Fri, 19 Jul 2019 21:37:30 +0800 Subject: add new extension for widget view --- libcaja-extension/Makefile.am | 2 ++ src/file-manager/fm-widget-view.c | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/libcaja-extension/Makefile.am b/libcaja-extension/Makefile.am index ef5cc10e..540afbc1 100644 --- a/libcaja-extension/Makefile.am +++ b/libcaja-extension/Makefile.am @@ -26,6 +26,7 @@ libcaja_extension_include_HEADERS = \ caja-column-provider.h \ caja-column.h \ caja-extension-types.h \ + caja-widget-view-provider.h \ caja-file-info.h \ caja-info-provider.h \ caja-location-widget-provider.h \ @@ -40,6 +41,7 @@ libcaja_extension_include_HEADERS = \ libcaja_extension_la_SOURCES = \ caja-column-provider.c \ caja-column.c \ + caja-widget-view-provider.c \ caja-extension-i18n.h \ caja-extension-types.c \ caja-extension-private.h \ diff --git a/src/file-manager/fm-widget-view.c b/src/file-manager/fm-widget-view.c index 9d2aeff1..c22643a8 100644 --- a/src/file-manager/fm-widget-view.c +++ b/src/file-manager/fm-widget-view.c @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include "fm-widget-view.h" @@ -344,13 +347,14 @@ fm_widget_view_iface_init (CajaViewIface *iface) static void fm_widget_view_init (FMWidgetView *widget_view) { + GtkWindow *window; + window = fm_directory_view_get_containing_window (FM_DIRECTORY_VIEW(widget_view)); } static CajaView * fm_widget_view_create (CajaWindowSlotInfo *slot) { FMWidgetView *view; - g_assert (CAJA_IS_WINDOW_SLOT_INFO (slot)); view = g_object_new (FM_TYPE_WIDGET_VIEW, @@ -365,11 +369,22 @@ fm_widget_view_supports_uri (const char *uri, GFileType file_type, const char *mime_type) { - if (g_str_has_prefix (uri, "computer://")) + GList *providers, *l; + gboolean result = FALSE; + + providers = caja_extensions_get_for_type (CAJA_TYPE_WIDGET_VIEW_PROVIDER); + + for (l = providers; l != NULL; l = l->next) { - return TRUE; + CajaWidgetViewProvider *provider; + + provider = CAJA_WIDGET_VIEW_PROVIDER (l->data); + if (caja_widget_view_supports_uri (provider, uri, file_type, mime_type)) { + result = TRUE; + } } - return FALSE; + caja_module_extension_list_free (providers); + return result; } static CajaViewInfo fm_widget_view = -- cgit v1.2.1