changeset 103916:9653887b5cd0

* xterm.c (Qx_gtk_map_stock): New var. * gtkutil.c (update_frame_tool_bar): Use Qx_gtk_map_stock instead of calling intern each time.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 16 Jul 2009 01:24:00 +0000
parents b22ca6941b7b
children aa5e8ff5a9c4
files src/ChangeLog src/gtkutil.c src/xterm.c
diffstat 3 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Jul 15 15:07:39 2009 +0000
+++ b/src/ChangeLog	Thu Jul 16 01:24:00 2009 +0000
@@ -1,3 +1,10 @@
+2009-07-16  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xterm.c (Qx_gtk_map_stock): New var.
+
+	* gtkutil.c (update_frame_tool_bar): Use Qx_gtk_map_stock instead
+	of calling intern each time.
+
 2009-07-15  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* nsfont.m (nsfont_draw): Remove code for stippling, which actually
--- a/src/gtkutil.c	Wed Jul 15 15:07:39 2009 +0000
+++ b/src/gtkutil.c	Thu Jul 16 01:24:00 2009 +0000
@@ -3827,6 +3827,8 @@
 
 /* Update the tool bar for frame F.  Add new buttons and remove old.  */
 
+extern Lisp_Object Qx_gtk_map_stock;
+
 void
 update_frame_tool_bar (f)
      FRAME_PTR f;
@@ -3878,7 +3880,6 @@
 
   for (i = 0; i < f->n_tool_bar_items; ++i)
     {
-
       int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
       int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
       int idx;
@@ -3893,7 +3894,6 @@
       Lisp_Object rtl;
       GtkWidget *wbutton = NULL;
       GtkWidget *weventbox;
-      Lisp_Object func = intern ("x-gtk-map-stock");
       Lisp_Object specified_file;
 
       ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i);
@@ -3914,10 +3914,10 @@
         }
 
       specified_file = file_for_image (image);
-      if (!NILP (specified_file) && EQ (Qt, Ffboundp (func)))
-        stock = call1 (func, specified_file);
-
-      if (! NILP (stock) && STRINGP (stock))
+      if (!NILP (specified_file) && !NILP (Ffboundp (Qx_gtk_map_stock)))
+        stock = call1 (Qx_gtk_map_stock, specified_file);
+
+      if (STRINGP (stock))
         {
           stock_name = SSDATA (stock);
           if (stock_name[0] == 'n' && stock_name[1] == ':')
--- a/src/xterm.c	Wed Jul 15 15:07:39 2009 +0000
+++ b/src/xterm.c	Thu Jul 16 01:24:00 2009 +0000
@@ -323,6 +323,9 @@
 #ifdef USE_GTK
 /* The name of the Emacs icon file.  */
 static Lisp_Object xg_default_icon_file;
+
+/* Used in gtkutil.c.  */
+Lisp_Object Qx_gtk_map_stock;
 #endif
 
 /* Used in x_flush.  */
@@ -10788,6 +10791,9 @@
 #ifdef USE_GTK
   xg_default_icon_file = build_string ("icons/hicolor/scalable/apps/emacs.svg");
   staticpro (&xg_default_icon_file);
+
+  Qx_gtk_map_stock = intern ("x-gtk-map-stock");
+  staticpro (&Qx_gtk_map_stock);
 #endif
 
   DEFVAR_BOOL ("x-use-underline-position-properties",