[nautilus/wip/antoniof/extension-properties: 18/21] menu-provider: Don't pass GtkWindow




commit c2900c43262e1d1bd566237cb25026b3f9b6c6bf
Author: António Fernandes <antoniof gnome org>
Date:   Sat Aug 6 17:11:03 2022 +0100

    menu-provider: Don't pass GtkWindow
    
    We don't want menu items to create their own windows in our process.
    
    This helps with the effort to de-GTK-ize libnautilus-extensions API.

 libnautilus-extension/nautilus-menu-provider.c | 8 ++------
 libnautilus-extension/nautilus-menu-provider.h | 7 -------
 src/nautilus-files-view.c                      | 6 ------
 3 files changed, 2 insertions(+), 19 deletions(-)
---
diff --git a/libnautilus-extension/nautilus-menu-provider.c b/libnautilus-extension/nautilus-menu-provider.c
index a6b86a86f..a5c468272 100644
--- a/libnautilus-extension/nautilus-menu-provider.c
+++ b/libnautilus-extension/nautilus-menu-provider.c
@@ -50,7 +50,6 @@ nautilus_menu_provider_default_init (NautilusMenuProviderInterface *klass)
 
 GList *
 nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
-                                       GtkWidget            *window,
                                        GList                *files)
 {
     NautilusMenuProviderInterface *iface;
@@ -58,11 +57,10 @@ nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
     iface = NAUTILUS_MENU_PROVIDER_GET_IFACE (provider);
 
     g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
-    g_return_val_if_fail (GTK_IS_WIDGET (window), NULL);
 
     if (iface->get_file_items != NULL)
     {
-        return iface->get_file_items (provider, window, files);
+        return iface->get_file_items (provider, files);
     }
 
     return NULL;
@@ -70,7 +68,6 @@ nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
 
 GList *
 nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
-                                             GtkWidget            *window,
                                              NautilusFileInfo     *current_folder)
 {
     NautilusMenuProviderInterface *iface;
@@ -78,12 +75,11 @@ nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
     iface = NAUTILUS_MENU_PROVIDER_GET_IFACE (provider);
 
     g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
-    g_return_val_if_fail (GTK_IS_WIDGET (window), NULL);
     g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder), NULL);
 
     if (iface->get_background_items != NULL)
     {
-        return iface->get_background_items (provider, window, current_folder);
+        return iface->get_background_items (provider, current_folder);
     }
 
     return NULL;
diff --git a/libnautilus-extension/nautilus-menu-provider.h b/libnautilus-extension/nautilus-menu-provider.h
index ed257c4f7..7939f1439 100644
--- a/libnautilus-extension/nautilus-menu-provider.h
+++ b/libnautilus-extension/nautilus-menu-provider.h
@@ -33,7 +33,6 @@
 #endif
 
 #include <glib-object.h>
-#include <gtk/gtk.h>
 #include "nautilus-file-info.h"
 
 G_BEGIN_DECLS
@@ -68,34 +67,28 @@ struct _NautilusMenuProviderInterface
     GTypeInterface g_iface;
 
     GList *(*get_file_items)       (NautilusMenuProvider *provider,
-                                    GtkWidget            *window,
                                     GList                *files);
     GList *(*get_background_items) (NautilusMenuProvider *provider,
-                                    GtkWidget            *window,
                                     NautilusFileInfo     *current_folder);
 };
 
 /**
  * nautilus_menu_provider_get_file_items:
  * @provider: a #NautilusMenuProvider
- * @window: the parent #GtkWidget window
  * @files: (element-type NautilusFileInfo): a list of #NautilusFileInfo
  *
  * Returns: (nullable) (element-type NautilusMenuItem) (transfer full): the provided list of 
#NautilusMenuItem.
  */
 GList  *nautilus_menu_provider_get_file_items           (NautilusMenuProvider *provider,
-                                                         GtkWidget            *window,
                                                          GList                *files);
 /**
  * nautilus_menu_provider_get_background_items:
  * @provider: a #NautilusMenuProvider
- * @window: the parent #GtkWidget window
  * @current_folder: the folder for which background items are requested
  *
  * Returns: (nullable) (element-type NautilusMenuItem) (transfer full): the provided list of 
#NautilusMenuItem.
  */
 GList *nautilus_menu_provider_get_background_items      (NautilusMenuProvider *provider,
-                                                         GtkWidget            *window,
                                                          NautilusFileInfo     *current_folder);
 
 /**
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 3d644da3f..bc0c61a09 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -4968,13 +4968,11 @@ get_menu_icon_for_file (NautilusFile *file,
 static GList *
 get_extension_selection_menu_items (NautilusFilesView *view)
 {
-    NautilusWindow *window;
     GList *items;
     GList *providers;
     GList *l;
     g_autolist (NautilusFile) selection = NULL;
 
-    window = nautilus_files_view_get_window (view);
     selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
     providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
     items = NULL;
@@ -4986,7 +4984,6 @@ get_extension_selection_menu_items (NautilusFilesView *view)
 
         provider = NAUTILUS_MENU_PROVIDER (l->data);
         file_items = nautilus_menu_provider_get_file_items (provider,
-                                                            GTK_WIDGET (window),
                                                             selection);
         items = g_list_concat (items, file_items);
     }
@@ -5000,13 +4997,11 @@ static GList *
 get_extension_background_menu_items (NautilusFilesView *view)
 {
     NautilusFilesViewPrivate *priv;
-    NautilusWindow *window;
     GList *items;
     GList *providers;
     GList *l;
 
     priv = nautilus_files_view_get_instance_private (view);
-    window = nautilus_files_view_get_window (view);
     providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
     items = NULL;
 
@@ -5019,7 +5014,6 @@ get_extension_background_menu_items (NautilusFilesView *view)
         provider = NAUTILUS_MENU_PROVIDER (l->data);
         file_info = NAUTILUS_FILE_INFO (priv->directory_as_file);
         file_items = nautilus_menu_provider_get_background_items (provider,
-                                                                  GTK_WIDGET (window),
                                                                   file_info);
         items = g_list_concat (items, file_items);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]