]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkstock.c
Practically everything changed.
[~andy/gtk] / gtk / gtkstock.c
index 93b3934483765eaa3674d2b849c786f886f2a3c3..ab8a9ca5ddef9d9119b561a4473b81bbc7348a4a 100644 (file)
@@ -1,4 +1,4 @@
-/* GTK - The GIMP Toolkit
+/* GTK - The GTK+ Toolkit
  * Copyright (C) 2000 Red Hat, Inc. 
  *
  * This library is free software; you can redistribute it and/or
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include <config.h>
+#include "config.h"
 #include <string.h>
 
-#include "gtkalias.h"
 #include "gtkstock.h"
 #include "gtkiconfactory.h"
 #include "gtkintl.h"
 #include <gdk/gdkkeysyms.h>
+#include "gtkalias.h"
 
 static GHashTable *translate_hash = NULL;
 static GHashTable *stock_hash = NULL;
@@ -47,7 +47,7 @@ struct _GtkStockTranslateFunc
 {
   GtkTranslateFunc func;
   gpointer data;
-  GtkDestroyNotify notify;
+  GDestroyNotify notify;
 };
 
 static void
@@ -176,31 +176,13 @@ gtk_stock_lookup (const gchar  *stock_id,
          if (translate != NULL && translate->func != NULL)
            item->label = (* translate->func) (item->label, translate->data);
          else
-           item->label = dgettext (item->translation_domain, item->label);
+           item->label = g_dgettext (item->translation_domain, item->label);
        }
     }
 
   return found != NULL;
 }
 
-static void
-listify_foreach (gpointer key, gpointer value, gpointer data)
-{
-  GSList **list = data;
-
-  *list = g_slist_prepend (*list, key);
-}
-
-static GSList *
-g_hash_table_get_keys (GHashTable *table)
-{
-  GSList *list = NULL;
-
-  g_hash_table_foreach (table, listify_foreach, &list);
-
-  return list;
-}
-
 /**
  * gtk_stock_list_ids:
  * 
@@ -213,42 +195,40 @@ g_hash_table_get_keys (GHashTable *table)
 GSList*
 gtk_stock_list_ids (void)
 {
-  GSList *ids;
-  GSList *icon_ids;
+  GList *ids;
+  GList *icon_ids;
   GSList *retval;
-  GSList *tmp_list;
   const gchar *last_id;
   
   init_stock_hash ();
 
   ids = g_hash_table_get_keys (stock_hash);
   icon_ids = _gtk_icon_factory_list_ids ();
-  ids = g_slist_concat (ids, icon_ids);
+  ids = g_list_concat (ids, icon_ids);
 
-  ids = g_slist_sort (ids, (GCompareFunc)strcmp);
+  ids = g_list_sort (ids, (GCompareFunc)strcmp);
 
   last_id = NULL;
   retval = NULL;
-  tmp_list = ids;
-  while (tmp_list != NULL)
+  while (ids != NULL)
     {
-      GSList *next;
+      GList *next;
 
-      next = g_slist_next (tmp_list);
+      next = g_list_next (ids);
 
-      if (last_id && strcmp (tmp_list->data, last_id) == 0)
+      if (last_id && strcmp (ids->data, last_id) == 0)
         {
           /* duplicate, ignore */
         }
       else
         {
-          retval = g_slist_prepend (retval, g_strdup (tmp_list->data));
-          last_id = tmp_list->data;
+          retval = g_slist_prepend (retval, g_strdup (ids->data));
+          last_id = ids->data;
         }
 
-      g_slist_free_1 (tmp_list);
+      g_list_free_1 (ids);
       
-      tmp_list = next;
+      ids = next;
     }
 
   return retval;
@@ -321,15 +301,20 @@ static const GtkStockItem builtin_items [] =
   { GTK_STOCK_CDROM, N_("_CD-Rom"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_CLEAR, N_("_Clear"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_CLOSE, N_("_Close"), GDK_CONTROL_MASK, 'w', GETTEXT_PACKAGE },
+  { GTK_STOCK_CONNECT, N_("C_onnect"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_CONVERT, N_("_Convert"), 0, 0, GETTEXT_PACKAGE },
-  { GTK_STOCK_COPY, N_("_Copy"), GDK_CONTROL_MASK, 'c', GETTEXT_PACKAGE },
+   { GTK_STOCK_COPY, N_("_Copy"), GDK_CONTROL_MASK, 'c', GETTEXT_PACKAGE },
   { GTK_STOCK_CUT, N_("Cu_t"), GDK_CONTROL_MASK, 'x', GETTEXT_PACKAGE },
   { GTK_STOCK_DELETE, N_("_Delete"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_DISCARD, N_("_Discard"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_DISCONNECT, N_("_Disconnect"), 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 },
+  { GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_LEAVE_FULLSCREEN, N_("_Leave Fullscreen"), 0, 0, GETTEXT_PACKAGE },
   /* translators, strip the prefix up to and including the first | */
   { GTK_STOCK_GOTO_BOTTOM, N_("Navigation|_Bottom"), 0, 0, GETTEXT_PACKAGE },
   /* translators, strip the prefix up to and including the first | */
@@ -352,6 +337,7 @@ static const GtkStockItem builtin_items [] =
   { GTK_STOCK_INDENT, N_("Increase Indent"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_UNINDENT, N_("Decrease Indent"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_INDEX, N_("_Index"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_INFO, N_("_Information"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_ITALIC, N_("_Italic"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_JUMP_TO, N_("_Jump to"), 0, 0, GETTEXT_PACKAGE },
   /* translators, strip the prefix up to and including the first | */
@@ -384,6 +370,11 @@ static const GtkStockItem builtin_items [] =
   { GTK_STOCK_NO, N_("_No"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_OK, N_("_OK"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_OPEN, N_("_Open"), GDK_CONTROL_MASK, 'o', GETTEXT_PACKAGE },
+  { GTK_STOCK_ORIENTATION_LANDSCAPE, N_("Landscape"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_ORIENTATION_PORTRAIT, N_("Portrait"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE, N_("Reverse landscape"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT, N_("Reverse portrait"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_PAGE_SETUP, N_("Page Set_up"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_PASTE, N_("_Paste"), GDK_CONTROL_MASK, 'v', GETTEXT_PACKAGE },
   { GTK_STOCK_PREFERENCES, N_("_Preferences"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_PRINT, N_("_Print"), 0, 0, GETTEXT_PACKAGE },
@@ -396,6 +387,7 @@ static const GtkStockItem builtin_items [] =
   { GTK_STOCK_REVERT_TO_SAVED, N_("_Revert"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_SAVE, N_("_Save"), GDK_CONTROL_MASK, 's', GETTEXT_PACKAGE },
   { GTK_STOCK_SAVE_AS, N_("Save _As"), 0, 0, GETTEXT_PACKAGE },
+  { GTK_STOCK_SELECT_ALL, N_("Select _All"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_SELECT_COLOR, N_("_Color"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_SELECT_FONT, N_("_Font"), 0, 0, GETTEXT_PACKAGE },
   { GTK_STOCK_SORT_ASCENDING, N_("_Ascending"), 0, 0, GETTEXT_PACKAGE },
@@ -415,16 +407,17 @@ static const GtkStockItem builtin_items [] =
 
 /**
  * gtk_stock_set_translate_func: 
+ * @domain: the translation domain for which @func shall be used
  * @func: a #GtkTranslateFunc 
  * @data: data to pass to @func
- * @notify: a #GtkDestroyNotify that is called when @data is 
+ * @notify: a #GDestroyNotify that is called when @data is
  *   no longer needed
  *
  * Sets a function to be used for translating the @label of 
  * a stock item.
  *
  * If no function is registered for a translation domain,
- * dgettext() is used.
+ * g_dgettext() is used.
  *
  * Since: 2.8
  * 
@@ -433,7 +426,7 @@ void
 gtk_stock_set_translate_func (const gchar      *domain,
                              GtkTranslateFunc  func,
                              gpointer          data,
-                             GtkDestroyNotify  notify)
+                             GDestroyNotify    notify)
 {
   GtkStockTranslateFunc *translate;
   gchar *domainname;
@@ -464,7 +457,7 @@ sgettext_swapped (const gchar *msgid,
 {
   gchar *domainname = data;
 
-  return (gchar *)g_strip_context (msgid, dgettext (domainname, msgid));
+  return (gchar *)g_strip_context (msgid, g_dgettext (domainname, msgid));
 }
 
 
@@ -489,3 +482,6 @@ init_stock_hash (void)
                                    NULL);
     }
 }
+
+#define __GTK_STOCK_C__
+#include "gtkaliasdef.c"