[PATCH] Add icon to "New Document->Empty File" action



I don't remember where it was requested, but somebody asked for an icon
for the "New Empty File" action in the New Document menu. The attached
patch adds it.

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.696
diff -u -p -r1.696 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	20 Jun 2005 14:36:19 -0000	1.696
+++ src/file-manager/fm-directory-view.c	28 Jun 2005 10:19:55 -0000
@@ -50,6 +49,8 @@
 #include <eel/eel-marshal.h>
 #include <gtk/gtkcheckmenuitem.h>
 #include <gtk/gtkclipboard.h>
+#include <gtk/gtkiconfactory.h>
+#include <gtk/gtkimagemenuitem.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkmenu.h>
 #include <gtk/gtkselection.h>
@@ -6225,6 +6261,31 @@ static const GtkToggleActionEntry direct
 };
 
 static void
+connect_proxy (FMDirectoryView *view,
+	       GtkAction *action,
+	       GtkWidget *proxy,
+	       GtkActionGroup *action_group)
+{
+	GdkPixbuf *pixbuf;
+	GtkWidget *image;
+
+	if (strcmp (gtk_action_get_name (action), FM_ACTION_NEW_EMPTY_FILE) != 0 ||
+	    !GTK_IS_IMAGE_MENU_ITEM (proxy)) {
+		return;
+	}
+
+	pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+					   "gnome-fs-regular",
+					   NAUTILUS_ICON_SIZE_FOR_MENUS,
+					   0, NULL);
+
+	image = gtk_image_new_from_pixbuf (pixbuf);
+	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), image);
+
+	gdk_pixbuf_unref (pixbuf);
+}
+
+static void
 real_merge_menus (FMDirectoryView *view)
 {
 	GtkActionGroup *action_group;
@@ -6255,6 +6316,10 @@ real_merge_menus (FMDirectoryView *view)
 	action = gtk_action_group_get_action (action_group, FM_ACTION_NO_TEMPLATES);
 	gtk_action_set_sensitive (action, FALSE);
 
+	g_signal_connect_object (action_group, "connect-proxy",
+				 G_CALLBACK (connect_proxy), G_OBJECT (view),
+				 G_CONNECT_SWAPPED);
+
 	/* Insert action group at end so clipboard action group ends up before it */
 	gtk_ui_manager_insert_action_group (ui_manager, action_group, -1);
 	g_object_unref (action_group); /* owned by ui manager */
Index: src/file-manager/fm-actions.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-actions.h,v
retrieving revision 1.7
diff -u -p -r1.7 fm-actions.h
--- src/file-manager/fm-actions.h	17 May 2005 13:27:36 -0000	1.7
+++ src/file-manager/fm-actions.h	28 Jun 2005 10:19:56 -0000
@@ -59,6 +59,7 @@
 #define FM_ACTION_EJECT_VOLUME "Eject Volume"
 #define FM_ACTION_SCRIPTS "Scripts"
 #define FM_ACTION_NEW_DOCUMENTS "New Documents"
+#define FM_ACTION_NEW_EMPTY_FILE "New Empty File"
 #define FM_ACTION_EMPTY_TRASH_CONDITIONAL "Empty Trash Conditional"
 #define FM_ACTION_MANUAL_LAYOUT "Manual Layout"
 #define FM_ACTION_TIGHTER_LAYOUT "Tighter Layout"


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