Commit 1a7f1da1 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Add items_updated signal

2006-06-16  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-extension/nautilus-menu-provider.[ch]:
	Add items_updated signal

	* libnautilus-private/Makefile.am:
	* libnautilus-private/nautilus-signaller.[ch]:
	* src/nautilus-signaller.[ch]:
	* src/Makefile.am:
	Move NautilusSignaller to libnautilus-private.
	Add popup_menu_changed signal.

	* src/nautilus-application.c:
	Signal popup_menu_changed when a menu provider emits items_updated.

	* src/file-manager/fm-directory-view.c:
	* src/nautilus-window.c:
	Handle popup_menu_changed.

	* src/nautilus-emblem-sidebar.c:
	* src/nautilus-history-sidebar.c:
	* src/nautilus-navigation-window-menus.c:
	* src/nautilus-navigation-window.c:
	* src/nautilus-property-browser.c:
	* src/nautilus-spatial-window.c:
	* src/nautilus-window-menus.c:
	Update includes.

	Patch from RUAUDEL Frédéric <ruaudel@embl.fr>
parent 2f6ea575
2006-06-16 Alexander Larsson <alexl@redhat.com>
* libnautilus-extension/nautilus-menu-provider.[ch]:
Add items_updated signal
* libnautilus-private/Makefile.am:
* libnautilus-private/nautilus-signaller.[ch]:
* src/nautilus-signaller.[ch]:
* src/Makefile.am:
Move NautilusSignaller to libnautilus-private.
Add popup_menu_changed signal.
* src/nautilus-application.c:
Signal popup_menu_changed when a menu provider emits items_updated.
* src/file-manager/fm-directory-view.c:
* src/nautilus-window.c:
Handle popup_menu_changed.
* src/nautilus-emblem-sidebar.c:
* src/nautilus-history-sidebar.c:
* src/nautilus-navigation-window-menus.c:
* src/nautilus-navigation-window.c:
* src/nautilus-property-browser.c:
* src/nautilus-spatial-window.c:
* src/nautilus-window-menus.c:
Update includes.
Patch from RUAUDEL Frédéric <ruaudel@embl.fr>
2006-06-16 Alexander Larsson <alexl@redhat.com> 2006-06-16 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-column-utilities.c: * libnautilus-private/nautilus-column-utilities.c:
......
...@@ -31,6 +31,20 @@ ...@@ -31,6 +31,20 @@
static void static void
nautilus_menu_provider_base_init (gpointer g_class) nautilus_menu_provider_base_init (gpointer g_class)
{ {
static gboolean initialized = FALSE;
if (!initialized)
{
/* This signal should be emited each time the extension modify the list of menu items */
g_signal_new ("items_updated",
NAUTILUS_TYPE_MENU_PROVIDER,
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
initialized = TRUE;
}
} }
GType GType
...@@ -107,4 +121,12 @@ nautilus_menu_provider_get_toolbar_items (NautilusMenuProvider *provider, ...@@ -107,4 +121,12 @@ nautilus_menu_provider_get_toolbar_items (NautilusMenuProvider *provider,
} }
} }
/* This function emit a signal to inform nautilus that its item list has changed */
void
nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider* provider)
{
g_return_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider));
g_signal_emit_by_name (provider, "items_updated");
}
...@@ -72,6 +72,9 @@ GList *nautilus_menu_provider_get_toolbar_items (NautilusMen ...@@ -72,6 +72,9 @@ GList *nautilus_menu_provider_get_toolbar_items (NautilusMen
GtkWidget *window, GtkWidget *window,
NautilusFileInfo *current_folder); NautilusFileInfo *current_folder);
/* This function emit a signal to inform nautilus that its item list has changed. */
void nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider *provider);
G_END_DECLS G_END_DECLS
#endif #endif
...@@ -170,6 +170,8 @@ libnautilus_private_la_SOURCES = \ ...@@ -170,6 +170,8 @@ libnautilus_private_la_SOURCES = \
nautilus-sidebar-provider.h \ nautilus-sidebar-provider.h \
nautilus-sidebar.c \ nautilus-sidebar.c \
nautilus-sidebar.h \ nautilus-sidebar.h \
nautilus-signaller.h \
nautilus-signaller.c \
nautilus-query.c \ nautilus-query.c \
nautilus-query.h \ nautilus-query.h \
nautilus-thumbnails.c \ nautilus-thumbnails.c \
......
...@@ -38,6 +38,7 @@ typedef GObjectClass NautilusSignallerClass; ...@@ -38,6 +38,7 @@ typedef GObjectClass NautilusSignallerClass;
enum { enum {
HISTORY_LIST_CHANGED, HISTORY_LIST_CHANGED,
EMBLEMS_CHANGED, EMBLEMS_CHANGED,
POPUP_MENU_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
...@@ -85,4 +86,12 @@ nautilus_signaller_class_init (NautilusSignallerClass *class) ...@@ -85,4 +86,12 @@ nautilus_signaller_class_init (NautilusSignallerClass *class)
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
signals[POPUP_MENU_CHANGED] =
g_signal_new ("popup_menu_changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
} }
...@@ -111,8 +111,6 @@ nautilus_SOURCES = \ ...@@ -111,8 +111,6 @@ nautilus_SOURCES = \
nautilus-side-pane.h \ nautilus-side-pane.h \
nautilus-sidebar-title.c \ nautilus-sidebar-title.c \
nautilus-sidebar-title.h \ nautilus-sidebar-title.h \
nautilus-signaller.c \
nautilus-signaller.h \
nautilus-spatial-window.c \ nautilus-spatial-window.c \
nautilus-spatial-window.h \ nautilus-spatial-window.h \
nautilus-throbber.c \ nautilus-throbber.c \
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
#include <libnautilus-private/nautilus-trash-directory.h> #include <libnautilus-private/nautilus-trash-directory.h>
#include <libnautilus-private/nautilus-trash-monitor.h> #include <libnautilus-private/nautilus-trash-monitor.h>
#include <libnautilus-private/nautilus-ui-utilities.h> #include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-signaller.h>
#include <unistd.h> #include <unistd.h>
/* Number of seconds until cancel dialog shows up */ /* Number of seconds until cancel dialog shows up */
...@@ -1957,6 +1958,10 @@ fm_directory_view_init (FMDirectoryView *view) ...@@ -1957,6 +1958,10 @@ fm_directory_view_init (FMDirectoryView *view)
/* React to clipboard changes */ /* React to clipboard changes */
g_signal_connect_object (nautilus_clipboard_monitor_get (), "clipboard_changed", g_signal_connect_object (nautilus_clipboard_monitor_get (), "clipboard_changed",
G_CALLBACK (clipboard_changed_callback), view, 0); G_CALLBACK (clipboard_changed_callback), view, 0);
/* Register to menu provider extension signal managing menu updates */
g_signal_connect_object (nautilus_signaller_get_current (), "popup_menu_changed",
G_CALLBACK (fm_directory_view_update_menus), view, G_CONNECT_SWAPPED);
gtk_widget_show (GTK_WIDGET (view)); gtk_widget_show (GTK_WIDGET (view));
......
...@@ -81,6 +81,8 @@ ...@@ -81,6 +81,8 @@
#include <libnautilus-private/nautilus-undo-manager.h> #include <libnautilus-private/nautilus-undo-manager.h>
#include <libnautilus-private/nautilus-desktop-link-monitor.h> #include <libnautilus-private/nautilus-desktop-link-monitor.h>
#include <libnautilus-private/nautilus-directory-private.h> #include <libnautilus-private/nautilus-directory-private.h>
#include <libnautilus-private/nautilus-signaller.h>
#include <libnautilus-extension/nautilus-menu-provider.h>
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
#define SN_API_NOT_YET_FROZEN Yes_i_know_DO_IT #define SN_API_NOT_YET_FROZEN Yes_i_know_DO_IT
...@@ -348,6 +350,35 @@ migrate_old_nautilus_files (void) ...@@ -348,6 +350,35 @@ migrate_old_nautilus_files (void)
g_free (migrated_file); g_free (migrated_file);
} }
static void
menu_provider_items_updated_handler (NautilusMenuProvider *provider, GtkWidget* parent_window, gpointer data)
{
g_signal_emit_by_name (nautilus_signaller_get_current (),
"popup_menu_changed");
}
static void
menu_provider_init_callback (void)
{
GList *items;
GList *providers;
GList *l;
providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
items = NULL;
for (l = providers; l != NULL; l = l->next) {
NautilusMenuProvider *provider = NAUTILUS_MENU_PROVIDER (l->data);
g_signal_connect_after (G_OBJECT (provider), "items_updated",
(GCallback)menu_provider_items_updated_handler,
NULL);
}
nautilus_module_extension_list_free (providers);
}
static void static void
finish_startup (NautilusApplication *application) finish_startup (NautilusApplication *application)
{ {
...@@ -355,6 +386,9 @@ finish_startup (NautilusApplication *application) ...@@ -355,6 +386,9 @@ finish_startup (NautilusApplication *application)
nautilus_module_init (); nautilus_module_init ();
nautilus_module_add_type (FM_TYPE_DITEM_PAGE); nautilus_module_add_type (FM_TYPE_DITEM_PAGE);
/* attach menu-provider module callback */
menu_provider_init_callback ();
/* initialize URI authentication manager */ /* initialize URI authentication manager */
gnome_authentication_manager_init (); gnome_authentication_manager_init ();
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <config.h> #include <config.h>
#include "nautilus-emblem-sidebar.h" #include "nautilus-emblem-sidebar.h"
#include "nautilus-signaller.h"
#include <stdio.h> #include <stdio.h>
#include <eel/eel-gtk-macros.h> #include <eel/eel-gtk-macros.h>
...@@ -68,6 +67,7 @@ ...@@ -68,6 +67,7 @@
#include <libnautilus-private/nautilus-file-utilities.h> #include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-sidebar-provider.h> #include <libnautilus-private/nautilus-sidebar-provider.h>
#include <libnautilus-private/nautilus-module.h> #include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-signaller.h>
struct NautilusEmblemSidebarDetails { struct NautilusEmblemSidebarDetails {
NautilusWindowInfo *window; NautilusWindowInfo *window;
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
#include <libnautilus-private/nautilus-global-preferences.h> #include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-sidebar-provider.h> #include <libnautilus-private/nautilus-sidebar-provider.h>
#include <libnautilus-private/nautilus-module.h> #include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-signaller.h>
#include "nautilus-signaller.h"
#include "nautilus-history-sidebar.h" #include "nautilus-history-sidebar.h"
#define NAUTILUS_HISTORY_SIDEBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_HISTORY_SIDEBAR, NautilusHistorySidebarClass)) #define NAUTILUS_HISTORY_SIDEBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_HISTORY_SIDEBAR, NautilusHistorySidebarClass))
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "nautilus-bookmarks-window.h" #include "nautilus-bookmarks-window.h"
#include "nautilus-file-management-properties.h" #include "nautilus-file-management-properties.h"
#include "nautilus-property-browser.h" #include "nautilus-property-browser.h"
#include "nautilus-signaller.h"
#include "nautilus-window-manage-views.h" #include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h" #include "nautilus-window-private.h"
#include "nautilus-window-bookmarks.h" #include "nautilus-window-bookmarks.h"
...@@ -61,6 +60,7 @@ ...@@ -61,6 +60,7 @@
#include <libnautilus-private/nautilus-icon-factory.h> #include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-undo-manager.h> #include <libnautilus-private/nautilus-undo-manager.h>
#include <libnautilus-private/nautilus-search-engine.h> #include <libnautilus-private/nautilus-search-engine.h>
#include <libnautilus-private/nautilus-signaller.h>
#define MENU_PATH_HISTORY_PLACEHOLDER "/MenuBar/Other Menus/Go/History Placeholder" #define MENU_PATH_HISTORY_PLACEHOLDER "/MenuBar/Other Menus/Go/History Placeholder"
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "nautilus-application.h" #include "nautilus-application.h"
#include "nautilus-bookmarks-window.h" #include "nautilus-bookmarks-window.h"
#include "nautilus-main.h" #include "nautilus-main.h"
#include "nautilus-signaller.h"
#include "nautilus-location-bar.h" #include "nautilus-location-bar.h"
#include "nautilus-pathbar.h" #include "nautilus-pathbar.h"
#include "nautilus-query-editor.h" #include "nautilus-query-editor.h"
...@@ -85,6 +84,7 @@ ...@@ -85,6 +84,7 @@
#include <libnautilus-private/nautilus-module.h> #include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-sidebar-provider.h> #include <libnautilus-private/nautilus-sidebar-provider.h>
#include <libnautilus-private/nautilus-search-directory.h> #include <libnautilus-private/nautilus-search-directory.h>
#include <libnautilus-private/nautilus-signaller.h>
#include <math.h> #include <math.h>
#include <sys/time.h> #include <sys/time.h>
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <math.h> #include <math.h>
#include "nautilus-property-browser.h" #include "nautilus-property-browser.h"
#include "nautilus-signaller.h"
#include <eel/eel-gdk-extensions.h> #include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h> #include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-glib-extensions.h> #include <eel/eel-glib-extensions.h>
...@@ -84,6 +83,7 @@ ...@@ -84,6 +83,7 @@
#include <libnautilus-private/nautilus-file.h> #include <libnautilus-private/nautilus-file.h>
#include <libnautilus-private/nautilus-global-preferences.h> #include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-metadata.h> #include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-signaller.h>
#include <atk/atkrelationset.h> #include <atk/atkrelationset.h>
/* property types */ /* property types */
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include "nautilus-main.h" #include "nautilus-main.h"
#include "nautilus-query-editor.h" #include "nautilus-query-editor.h"
#include "nautilus-search-bar.h" #include "nautilus-search-bar.h"
#include "nautilus-signaller.h"
#include "nautilus-window-manage-views.h" #include "nautilus-window-manage-views.h"
#include "nautilus-zoom-control.h" #include "nautilus-zoom-control.h"
#include <eel/eel-debug.h> #include <eel/eel-debug.h>
...@@ -81,6 +80,7 @@ ...@@ -81,6 +80,7 @@
#include <libnautilus-private/nautilus-undo.h> #include <libnautilus-private/nautilus-undo.h>
#include <libnautilus-private/nautilus-search-directory.h> #include <libnautilus-private/nautilus-search-directory.h>
#include <libnautilus-private/nautilus-search-engine.h> #include <libnautilus-private/nautilus-search-engine.h>
#include <libnautilus-private/nautilus-signaller.h>
#include <math.h> #include <math.h>
#include <sys/time.h> #include <sys/time.h>
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "nautilus-connect-server-dialog.h" #include "nautilus-connect-server-dialog.h"
#include "nautilus-file-management-properties.h" #include "nautilus-file-management-properties.h"
#include "nautilus-property-browser.h" #include "nautilus-property-browser.h"
#include "nautilus-signaller.h"
#include "nautilus-window-manage-views.h" #include "nautilus-window-manage-views.h"
#include "nautilus-window-bookmarks.h" #include "nautilus-window-bookmarks.h"
#include "nautilus-window-private.h" #include "nautilus-window-private.h"
...@@ -68,6 +67,7 @@ ...@@ -68,6 +67,7 @@
#include <libnautilus-private/nautilus-undo-manager.h> #include <libnautilus-private/nautilus-undo-manager.h>
#include <libnautilus-private/nautilus-search-directory.h> #include <libnautilus-private/nautilus-search-directory.h>
#include <libnautilus-private/nautilus-search-engine.h> #include <libnautilus-private/nautilus-search-engine.h>
#include <libnautilus-private/nautilus-signaller.h>
#define MENU_PATH_EXTENSION_ACTIONS "/MenuBar/File/Extension Actions" #define MENU_PATH_EXTENSION_ACTIONS "/MenuBar/File/Extension Actions"
#define POPUP_PATH_EXTENSION_ACTIONS "/background/Before Zoom Items/Extension Actions" #define POPUP_PATH_EXTENSION_ACTIONS "/background/Before Zoom Items/Extension Actions"
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "nautilus-bookmarks-window.h" #include "nautilus-bookmarks-window.h"
#include "nautilus-information-panel.h" #include "nautilus-information-panel.h"
#include "nautilus-main.h" #include "nautilus-main.h"
#include "nautilus-signaller.h"
#include "nautilus-window-manage-views.h" #include "nautilus-window-manage-views.h"
#include "nautilus-window-bookmarks.h" #include "nautilus-window-bookmarks.h"
#include "nautilus-zoom-control.h" #include "nautilus-zoom-control.h"
...@@ -79,6 +78,7 @@ ...@@ -79,6 +78,7 @@
#include <libnautilus-private/nautilus-clipboard.h> #include <libnautilus-private/nautilus-clipboard.h>
#include <libnautilus-private/nautilus-undo.h> #include <libnautilus-private/nautilus-undo.h>
#include <libnautilus-private/nautilus-search-directory.h> #include <libnautilus-private/nautilus-search-directory.h>
#include <libnautilus-private/nautilus-signaller.h>
#include <math.h> #include <math.h>
#include <sys/time.h> #include <sys/time.h>
...@@ -190,6 +190,10 @@ nautilus_window_init (NautilusWindow *window) ...@@ -190,6 +190,10 @@ nautilus_window_init (NautilusWindow *window)
G_CALLBACK (icons_changed_callback), window, G_CALLBACK (icons_changed_callback), window,
0); 0);
/* Register to menu provider extension signal managing menu updates */
g_signal_connect_object (nautilus_signaller_get_current (), "popup_menu_changed",
G_CALLBACK (nautilus_window_load_extension_menus), window, G_CONNECT_SWAPPED);
gtk_quit_add_destroy (1, GTK_OBJECT (window)); gtk_quit_add_destroy (1, GTK_OBJECT (window));
/* Keep the main event loop alive as long as the window exists */ /* Keep the main event loop alive as long as the window exists */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment