]> git.sur5r.net Git - glabels/blobdiff - glabels2/src/stock.c
2007-09-14 Jim Evins <evins@snaught.com>
[glabels] / glabels2 / src / stock.c
index a03f7d4be541aaab71a19b1f336744f1c83b0ed6..72f1c25c7e08b59452dcc75a0aa97092af1fcd37 100644 (file)
@@ -1,3 +1,5 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  */
 
 #include <config.h>
-#include <gnome.h>
-#include <gdk-pixbuf/gdk-pixdata.h>
+
 #include "stock.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtkiconfactory.h>
+#include <gtk/gtkstock.h>
+#include <gdk-pixbuf/gdk-pixdata.h>
+
 #include "stock-pixmaps/stockpixbufs.h"
 
 
 /* Local function prototypes                 */
 /*===========================================*/
 
-static add_icons (GtkIconFactory *factory,
-                 const gchar    *stock_id,
-                 const guchar   *inline_24,
-                 const guchar   *inline_16);
+static void add_icons (GtkIconFactory *factory,
+                       const gchar    *stock_id,
+                       const guchar   *inline_24,
+                       const guchar   *inline_16);
+
+static void add_button_icon (GtkIconFactory *factory,
+                             const gchar    *stock_id,
+                             const guchar   *inline_24);
 
 \f
 /****************************************************************************/
@@ -58,28 +69,35 @@ gl_stock_init (void)
        GtkIconFactory *factory;
 
        static GtkStockItem items[] = {
-               { GL_STOCK_ARROW,         "Arrow",          0, 0, NULL },
-               { GL_STOCK_TEXT,          "Text",           0, 0, NULL },
-               { GL_STOCK_LINE,          "Line",           0, 0, NULL },
-               { GL_STOCK_BOX,           "Box",            0, 0, NULL },
-               { GL_STOCK_ELLIPSE,       "Ellipse",        0, 0, NULL },
-               { GL_STOCK_IMAGE,         "Image",          0, 0, NULL },
-               { GL_STOCK_BARCODE,       "Barcode",        0, 0, NULL },
-               { GL_STOCK_MERGE,         "Merge",          0, 0, NULL },
-               { GL_STOCK_ORDER_TOP,     "OrderTop",       0, 0, NULL },
-               { GL_STOCK_ORDER_BOTTOM,  "OrderBottom",    0, 0, NULL },
-               { GL_STOCK_ROTATE_LEFT,   "RotateLeft",     0, 0, NULL },
-               { GL_STOCK_ROTATE_RIGHT,  "RotateRight",    0, 0, NULL },
-               { GL_STOCK_FLIP_HORIZ,    "FlipHoriz",      0, 0, NULL },
-               { GL_STOCK_FLIP_VERT,     "FlipVert",       0, 0, NULL },
-               { GL_STOCK_ALIGN_LEFT,    "AlignLeft",      0, 0, NULL },
-               { GL_STOCK_ALIGN_RIGHT,   "AlignRight",     0, 0, NULL },
-               { GL_STOCK_ALIGN_HCENTER, "AlignHCenter",   0, 0, NULL },
-               { GL_STOCK_ALIGN_TOP,     "AlignTop",       0, 0, NULL },
-               { GL_STOCK_ALIGN_BOTTOM,  "AlignBottom",    0, 0, NULL },
-               { GL_STOCK_ALIGN_VCENTER, "AlignVCenter",   0, 0, NULL },
-               { GL_STOCK_CENTER_HORIZ,  "CenterHoriz",    0, 0, NULL },
-               { GL_STOCK_CENTER_VERT,   "CenterVert",     0, 0, NULL },
+               { GL_STOCK_ARROW,         N_("_Select Mode"),          0, 0, NULL },
+               { GL_STOCK_TEXT,          N_("_Text"),                 0, 0, NULL },
+               { GL_STOCK_LINE,          N_("_Line"),                 0, 0, NULL },
+               { GL_STOCK_BOX,           N_("_Box"),                  0, 0, NULL },
+               { GL_STOCK_ELLIPSE,       N_("_Ellipse"),              0, 0, NULL },
+               { GL_STOCK_IMAGE,         N_("_Image"),                0, 0, NULL },
+               { GL_STOCK_BARCODE,       N_("Bar_code"),              0, 0, NULL },
+               { GL_STOCK_MERGE,         N_("_Merge Properties"),     0, 0, NULL },
+               { GL_STOCK_PROPERTIES,    N_("Object _Properties"),    0, 0, NULL },
+               { GL_STOCK_ORDER_TOP,     N_("Bring to _Front"),       0, 0, NULL },
+               { GL_STOCK_ORDER_BOTTOM,  N_("Send to _Back"),         0, 0, NULL },
+               { GL_STOCK_ROTATE_LEFT,   N_("Rotate _Left"),          0, 0, NULL },
+               { GL_STOCK_ROTATE_RIGHT,  N_("Rotate _Right"),         0, 0, NULL },
+               { GL_STOCK_FLIP_HORIZ,    N_("Flip _Horizontally"),    0, 0, NULL },
+               { GL_STOCK_FLIP_VERT,     N_("Flip _Vertically"),      0, 0, NULL },
+               { GL_STOCK_ALIGN_LEFT,    N_("_Lefts"),                0, 0, NULL },
+               { GL_STOCK_ALIGN_RIGHT,   N_("_Rights"),               0, 0, NULL },
+               { GL_STOCK_ALIGN_HCENTER, N_("_Centers"),              0, 0, NULL },
+               { GL_STOCK_ALIGN_TOP,     N_("_Tops"),                 0, 0, NULL },
+               { GL_STOCK_ALIGN_BOTTOM,  N_("Bottoms"),               0, 0, NULL },
+               { GL_STOCK_ALIGN_VCENTER, N_("Centers"),               0, 0, NULL },
+               { GL_STOCK_CENTER_HORIZ,  N_("Label Ce_nter"),         0, 0, NULL },
+               { GL_STOCK_CENTER_VERT,   N_("Label Ce_nter"),         0, 0, NULL },
+               { GL_STOCK_BUCKET_FILL,   N_("Fill color"),            0, 0, NULL },
+               { GL_STOCK_PENCIL,        N_("Line color"),            0, 0, NULL },
+               { GL_STOCK_HCHAIN,        N_("Linked"),                0, 0, NULL },
+               { GL_STOCK_HCHAIN_BROKEN, N_("Not Linked"),            0, 0, NULL },
+               { GL_STOCK_VCHAIN,        N_("Linked"),                0, 0, NULL },
+               { GL_STOCK_VCHAIN_BROKEN, N_("Not Linked"),            0, 0, NULL },
        };
 
        gtk_stock_add (items, G_N_ELEMENTS (items));
@@ -96,6 +114,10 @@ gl_stock_init (void)
        add_icons (factory, GL_STOCK_BARCODE,       stock_barcode_24, stock_barcode_16);
        add_icons (factory, GL_STOCK_MERGE,         stock_merge_24,   stock_merge_16);
 
+       add_icons (factory, GL_STOCK_PROPERTIES,
+                  stock_properties_24,
+                  stock_properties_16);
+
        add_icons (factory, GL_STOCK_ORDER_TOP,     NULL, stock_order_top_16);
        add_icons (factory, GL_STOCK_ORDER_BOTTOM,  NULL, stock_order_bottom_16);
        add_icons (factory, GL_STOCK_ROTATE_LEFT,   NULL, stock_rotate_left_16);
@@ -111,16 +133,25 @@ gl_stock_init (void)
        add_icons (factory, GL_STOCK_CENTER_HORIZ,  NULL, stock_center_horiz_16);
        add_icons (factory, GL_STOCK_CENTER_VERT,   NULL, stock_center_vert_16);
 
+       add_icons (factory, GL_STOCK_BUCKET_FILL,   stock_bucket_fill_24, stock_bucket_fill_16);
+       add_icons (factory, GL_STOCK_PENCIL,        stock_pencil_24,      stock_pencil_16);
+
+       add_button_icon (factory, GL_STOCK_HCHAIN,        stock_hchain_24);
+       add_button_icon (factory, GL_STOCK_HCHAIN_BROKEN, stock_hchain_broken_24);
+       add_button_icon (factory, GL_STOCK_VCHAIN,        stock_vchain_24);
+       add_button_icon (factory, GL_STOCK_VCHAIN_BROKEN, stock_vchain_broken_24);
+
        g_object_unref (G_OBJECT(factory));
 }
 
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  Unpack and associate given icons with stock_id.                */
 /*--------------------------------------------------------------------------*/
-static add_icons (GtkIconFactory *factory,
-                 const gchar    *stock_id,
-                 const guchar   *inline_24,
-                 const guchar   *inline_16)
+static void
+add_icons (GtkIconFactory *factory,
+           const gchar    *stock_id,
+           const guchar   *inline_24,
+           const guchar   *inline_16)
 {
        GdkPixbuf      *pixbuf;
        GtkIconSet     *icon_set;
@@ -154,6 +185,34 @@ static add_icons (GtkIconFactory *factory,
        gtk_icon_set_unref (icon_set);
 }
 
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Unpack and associate given button icon with stock_id.          */
+/*--------------------------------------------------------------------------*/
+static void
+add_button_icon (GtkIconFactory *factory,
+                 const gchar    *stock_id,
+                 const guchar   *inline_24)
+{
+       GtkIconSet     *icon_set;
+       GdkPixbuf      *pixbuf;
+       GtkIconSource  *icon_source;
+
+       icon_set = gtk_icon_set_new ();
+
+       icon_source = gtk_icon_source_new ();
+       pixbuf = gdk_pixbuf_new_from_inline (-1, inline_24, FALSE, NULL);
+       gtk_icon_source_set_pixbuf (icon_source, pixbuf);
+       g_object_unref (G_OBJECT(pixbuf));
+       gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
+       gtk_icon_source_set_size (icon_source, GTK_ICON_SIZE_BUTTON);
+       gtk_icon_set_add_source (icon_set, icon_source);
+       g_free (icon_source);
+
+       /* Now associate icon set with stock id */
+       gtk_icon_factory_add (factory, stock_id, icon_set);
+       gtk_icon_set_unref (icon_set);
+}
+