]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkstock.c
Make it possible to specify additional modules to load via a setting.
[~andy/gtk] / gtk / gtkstock.c
index 7b00641f67e9b801032cdd04652eea3a4d17a805..247ac94b15fcdbd83c41c68c1586c87f9c7b5318 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <config.h>
 #include <string.h>
 
+#include "gtkalias.h"
 #include "gtkstock.h"
 #include "gtkiconfactory.h"
 #include "gtkintl.h"
 static GHashTable *stock_hash = NULL;
 static void init_stock_hash (void);
 
+/* We use an unused modifier bit to mark stock items which
+ * must be freed when they are removed from the hash table.
+ */
+#define NON_STATIC_MASK (1 << 29)
+
 static void
 real_add (const GtkStockItem *items,
           guint               n_items,
@@ -51,14 +58,25 @@ real_add (const GtkStockItem *items,
     {
       gpointer old_key, old_value;
       const GtkStockItem *item = &items[i];
+
+      if (item->modifier & NON_STATIC_MASK)
+       {
+         g_warning ("Bit 29 set in stock accelerator.\n");
+         copy = TRUE;
+       }
+
       if (copy)
-        item = gtk_stock_item_copy (item);
+       {
+         item = gtk_stock_item_copy (item);
+         ((GtkStockItem *)item)->modifier |= NON_STATIC_MASK;
+       }
 
       if (g_hash_table_lookup_extended (stock_hash, item->stock_id,
                                         &old_key, &old_value))
         {
           g_hash_table_remove (stock_hash, old_key);
-          gtk_stock_item_free (old_value);
+         if (((GtkStockItem *)old_value)->modifier & NON_STATIC_MASK)
+           gtk_stock_item_free (old_value);
         }
       
       g_hash_table_insert (stock_hash,
@@ -135,6 +153,7 @@ gtk_stock_lookup (const gchar  *stock_id,
   if (found)
     {
       *item = *found;
+      item->modifier &= ~NON_STATIC_MASK;
       if (item->label)
         item->label = dgettext (item->translation_domain, item->label);
     }
@@ -272,6 +291,7 @@ static const GtkStockItem builtin_items [] =
   /*  FIXME these need accelerators when appropriate, and
    * need the mnemonics to be rationalized
    */
+  { GTK_STOCK_ABOUT, N_("_About"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_ADD, N_("_Add"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_APPLY, N_("_Apply"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_BOLD, N_("_Bold"), 0, 0, GETTEXT_PACKAGE },
@@ -284,6 +304,7 @@ static const GtkStockItem builtin_items [] =
   { GTK_STOCK_CUT, N_("Cu_t"), GDK_CONTROL_MASK, 'x', GETTEXT_PACKAGE },
   { GTK_STOCK_DELETE, N_("_Delete"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_EXECUTE, N_("_Execute"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_EDIT, N_("_Edit"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_FIND, N_("_Find"), GDK_CONTROL_MASK, 'f', GETTEXT_PACKAGE },
   { GTK_STOCK_FIND_AND_REPLACE, N_("Find and _Replace"), GDK_CONTROL_MASK, 'r', GETTEXT_PACKAGE },
   { GTK_STOCK_FLOPPY, N_("_Floppy"), 0, 0, GETTEXT_PACKAGE },
@@ -307,6 +328,15 @@ static const GtkStockItem builtin_items [] =
   { GTK_STOCK_JUSTIFY_FILL, N_("_Fill"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_JUSTIFY_LEFT, N_("_Left"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_JUSTIFY_RIGHT, N_("_Right"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_FORWARD, N_("_Forward"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_NEXT, N_("_Next"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_PAUSE, N_("P_ause"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_PLAY, N_("_Play"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_PREVIOUS, N_("Pre_vious"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_RECORD, N_("_Record"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_REWIND, N_("R_ewind"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_MEDIA_STOP, N_("_Stop"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_NETWORK, N_("_Network"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_NEW, N_("_New"), GDK_CONTROL_MASK, 'n', GETTEXT_PACKAGE },
   { GTK_STOCK_NO, N_("_No"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_OK, N_("_OK"), 0, 0, GETTEXT_PACKAGE },
@@ -334,8 +364,8 @@ static const GtkStockItem builtin_items [] =
   { GTK_STOCK_UNDERLINE, N_("_Underline"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_UNDO, N_("_Undo"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_YES, N_("_Yes"), 0, 0, GETTEXT_PACKAGE },
-  { GTK_STOCK_ZOOM_100, N_("Zoom _100%"), 0, 0, GETTEXT_PACKAGE },
-  { GTK_STOCK_ZOOM_FIT, N_("Zoom to _Fit"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_ZOOM_100, N_("_Normal Size"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_ZOOM_FIT, N_("Best _Fit"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_ZOOM_IN, N_("Zoom _In"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), 0, 0, GETTEXT_PACKAGE }
 };