Small right-click-menus patch



Hello,

here's a patch that makes the Cut/Copy/Paste of the right-click menus in
GtkEntry, GtkLabel and GtkTextView stock items so that they'll have
pretty icons.

It also seems like #56221 has been fixed and should be closed, right?

//andersca
andersca gnu org

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.2437
diff -u -r1.2437 ChangeLog
--- ChangeLog	2001/10/23 20:13:42	1.2437
+++ ChangeLog	2001/10/23 22:07:29
@@ -1,3 +1,14 @@
+2001-10-24  Anders Carlsson  <andersca gnu org>
+
+	* gtk/gtkentry.c: (append_action_signal): Use an image menu item here
+	(popup_targets_received): Call append_action_signal with stock items
+	
+	* gtk/gtklabel.c: (append_action_signal): Use an image menu item here
+	(gtk_label_do_popup): Call append_action_signal with stock items
+	
+	* gtk/gtktextview.c: (append_action_signal): Use an image menu item here
+	(popup_targets_received): Call append_action_signal with stock items
+
 2001-10-23  Havoc Pennington  <hp redhat com>
 
 	* gtk/gtktextview.c (changed_handler): queue a resize here; will
Index: gtk/gtkentry.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
retrieving revision 1.160
diff -u -r1.160 gtkentry.c
--- gtk/gtkentry.c	2001/10/22 21:01:47	1.160
+++ gtk/gtkentry.c	2001/10/23 22:07:30
@@ -34,6 +34,7 @@
 #include "gtkclipboard.h"
 #include "gtkdnd.h"
 #include "gtkentry.h"
+#include "gtkimagemenuitem.h"
 #include "gtkimmulticontext.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
@@ -42,6 +43,7 @@
 #include "gtkseparatormenuitem.h"
 #include "gtkselection.h"
 #include "gtksettings.h"
+#include "gtkstock.h"
 #include "gtksignal.h"
 #include "gtkwindow.h"
 
@@ -3701,11 +3703,11 @@
 static void
 append_action_signal (GtkEntry     *entry,
 		      GtkWidget    *menu,
-		      const gchar  *label,
+		      const gchar  *stock_id,
 		      const gchar  *signal,
                       gboolean      sensitive)
 {
-  GtkWidget *menuitem = gtk_menu_item_new_with_label (label);
+  GtkWidget *menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
 
   gtk_object_set_data (GTK_OBJECT (menuitem), "gtk-signal", (char *)signal);
   gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
@@ -3781,11 +3783,11 @@
 				 GTK_WIDGET (entry),
 				 popup_menu_detach);
       
-      append_action_signal (entry, entry->popup_menu, _("Cut"), "cut_clipboard",
+      append_action_signal (entry, entry->popup_menu, GTK_STOCK_CUT, "cut_clipboard",
 			    entry->editable && entry->current_pos != entry->selection_bound);
-      append_action_signal (entry, entry->popup_menu, _("Copy"), "copy_clipboard",
+      append_action_signal (entry, entry->popup_menu, GTK_STOCK_COPY, "copy_clipboard",
 			    entry->current_pos != entry->selection_bound);
-      append_action_signal (entry, entry->popup_menu, _("Paste"), "paste_clipboard",
+      append_action_signal (entry, entry->popup_menu, GTK_STOCK_PASTE, "paste_clipboard",
 			    entry->editable && clipboard_contains_text);
       
       menuitem = gtk_menu_item_new_with_label (_("Select All"));
Index: gtk/gtklabel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.c,v
retrieving revision 1.103
diff -u -r1.103 gtklabel.c
--- gtk/gtklabel.c	2001/10/22 21:01:47	1.103
+++ gtk/gtklabel.c	2001/10/23 22:07:30
@@ -33,10 +33,12 @@
 #include "gtkclipboard.h"
 #include "gdk/gdki18n.h"
 #include <pango/pango.h>
+#include "gtkimagemenuitem.h"
 #include "gtkintl.h"
 #include "gtkseparatormenuitem.h"
 #include "gtkmenuitem.h"
 #include "gtknotebook.h"
+#include "gtkstock.h"
 #include "gtkbindings.h"
 
 struct _GtkLabelSelectionInfo
@@ -3087,11 +3089,11 @@
 static void
 append_action_signal (GtkLabel     *label,
 		      GtkWidget    *menu,
-		      const gchar  *label_text,
+		      const gchar  *stock_id,
 		      const gchar  *signal,
                       gboolean      sensitive)
 {
-  GtkWidget *menuitem = gtk_menu_item_new_with_label (label_text);
+  GtkWidget *menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
 
   gtk_object_set_data (GTK_OBJECT (menuitem), "gtk-signal", (char *)signal);
   gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
@@ -3168,11 +3170,11 @@
     label->select_info->selection_anchor != label->select_info->selection_end;
 
 
-  append_action_signal (label, label->select_info->popup_menu, _("Cut"), "cut_clipboard",
+  append_action_signal (label, label->select_info->popup_menu, GTK_STOCK_CUT, "cut_clipboard",
                         FALSE);
-  append_action_signal (label, label->select_info->popup_menu, _("Copy"), "copy_clipboard",
+  append_action_signal (label, label->select_info->popup_menu, GTK_STOCK_COPY, "copy_clipboard",
                         have_selection);
-  append_action_signal (label, label->select_info->popup_menu, _("Paste"), "paste_clipboard",
+  append_action_signal (label, label->select_info->popup_menu, GTK_STOCK_PASTE, "paste_clipboard",
                         FALSE);
   
   menuitem = gtk_menu_item_new_with_label (_("Select All"));
Index: gtk/gtktextview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
retrieving revision 1.128
diff -u -r1.128 gtktextview.c
--- gtk/gtktextview.c	2001/10/23 20:13:44	1.128
+++ gtk/gtktextview.c	2001/10/23 22:07:30
@@ -29,6 +29,7 @@
 #define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
 #include "gtkbindings.h"
 #include "gtkdnd.h"
+#include "gtkimagemenuitem.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
 #include "gtkmenu.h"
@@ -36,6 +37,7 @@
 #include "gtkseparatormenuitem.h"
 #include "gtksettings.h"
 #include "gtksignal.h"
+#include "gtkstock.h"
 #include "gtktextdisplay.h"
 #include "gtktextview.h"
 #include "gtkimmulticontext.h"
@@ -5354,11 +5356,11 @@
 static void
 append_action_signal (GtkTextView  *text_view,
 		      GtkWidget    *menu,
-		      const gchar  *label,
+		      const gchar  *stock_id,
 		      const gchar  *signal,
                       gboolean      sensitive)
 {
-  GtkWidget *menuitem = gtk_menu_item_new_with_label (label);
+  GtkWidget *menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
 
   g_object_set_data (G_OBJECT (menuitem), "gtk-signal", (char *)signal);
   gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
@@ -5485,11 +5487,11 @@
       
       can_insert = gtk_text_iter_can_insert (&iter, text_view->editable);
       
-      append_action_signal (text_view, text_view->popup_menu, _("Cut"), "cut_clipboard",
+      append_action_signal (text_view, text_view->popup_menu, GTK_STOCK_CUT, "cut_clipboard",
 			    have_selection);
-      append_action_signal (text_view, text_view->popup_menu, _("Copy"), "copy_clipboard",
+      append_action_signal (text_view, text_view->popup_menu, GTK_STOCK_COPY, "copy_clipboard",
 			    have_selection);
-      append_action_signal (text_view, text_view->popup_menu, _("Paste"), "paste_clipboard",
+      append_action_signal (text_view, text_view->popup_menu, GTK_STOCK_PASTE, "paste_clipboard",
 			    can_insert && clipboard_contains_text);
       
       menuitem = gtk_separator_menu_item_new ();


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