nautilus r15142 - in trunk: . src



Author: cosimoc
Date: Thu Mar 19 17:25:48 2009
New Revision: 15142
URL: http://svn.gnome.org/viewvc/nautilus?rev=15142&view=rev

Log:
2009-03-19  Cosimo Cecchi  <cosimoc gnome org>

	* configure.in: bump required GTK+ version to 2.16.0.
	* src/nautilus-window-menus.c: (trash_state_changed_cb),
	(nautilus_window_initialize_trash_icon_monitor),
	(nautilus_window_initialize_menus):
	Update the trash icon in the "Go" menu according to the
	trash state (#575282).


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/nautilus-window-menus.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Thu Mar 19 17:25:48 2009
@@ -5,7 +5,7 @@
 m4_define(glib_minver,                 2.19.0)
 m4_define(gnome_desktop_minver,        2.25.5)
 m4_define(pango_minver,                1.1.2)
-m4_define(gtk_minver,                  2.13.0)
+m4_define(gtk_minver,                  2.16.0)
 m4_define(xml_minver,                  2.4.7)
 m4_define(exif_minver,                 0.5.12)
 m4_define(beagle_minver,               0.2.4)

Modified: trunk/src/nautilus-window-menus.c
==============================================================================
--- trunk/src/nautilus-window-menus.c	(original)
+++ trunk/src/nautilus-window-menus.c	Thu Mar 19 17:25:48 2009
@@ -54,6 +54,7 @@
 #include <libnautilus-private/nautilus-search-directory.h>
 #include <libnautilus-private/nautilus-search-engine.h>
 #include <libnautilus-private/nautilus-signaller.h>
+#include <libnautilus-private/nautilus-trash-monitor.h>
 #include <string.h>
 
 #define MENU_PATH_EXTENSION_ACTIONS                     "/MenuBar/File/Extension Actions"
@@ -732,6 +733,39 @@
 	}
 }
 
+static void
+trash_state_changed_cb (NautilusTrashMonitor *monitor,
+			gboolean state,
+			NautilusWindow *window)
+{
+	GtkActionGroup *action_group;
+	GtkAction *action;
+	GIcon *gicon;
+
+	action_group = window->details->main_action_group;
+	action = gtk_action_group_get_action (action_group, "Go to Trash");
+
+	gicon = nautilus_trash_monitor_get_icon ();
+
+	if (gicon) {
+		g_object_set (action, "gicon", gicon, NULL);
+		g_object_unref (gicon);
+	}
+}
+
+static void
+nautilus_window_initialize_trash_icon_monitor (NautilusWindow *window)
+{
+	NautilusTrashMonitor *monitor;
+
+	monitor = nautilus_trash_monitor_get ();
+
+	trash_state_changed_cb (monitor, TRUE, window);
+
+	g_signal_connect (monitor, "trash_state_changed",
+			  G_CALLBACK (trash_state_changed_cb), window);
+}
+
 static const GtkActionEntry main_entries[] = {
   /* name, stock id, label */  { "File", NULL, N_("_File") },
   /* name, stock id, label */  { "Edit", NULL, N_("_Edit") },
@@ -889,6 +923,7 @@
 	ui = nautilus_ui_string_get ("nautilus-shell-ui.xml");
 	gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
 
+	nautilus_window_initialize_trash_icon_monitor (window);
 	nautilus_window_initialize_bookmarks_menu (window);
 }
 



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