=== modified file 'ChangeLog'
--- ChangeLog	2006-09-13 09:00:32 +0000
+++ ChangeLog	2006-09-13 09:00:35 +0000
@@ -196,6 +196,13 @@
 
 2006-07-25  Patrick Bernaud  <b-patrick@wanadoo.fr>
 
+	* include/x_window.h: Added icon ids for toolbar.
+
+	* noweb/x_window.nw (window_register_toolbar_icons): Added new
+	function to add custom toolbar icons from bitmap/.
+	(window_create_toolbar): Modified to register and use new icons
+	for mode buttons of toolbar.
+
 	* noweb/i_callbacks.nw, noweb/i_basic.nw: Switched reference on
 	GtkToggleButtons to GtkToogleToolButtons for items of the new
 	toolbar.

=== modified file 'include/x_window.h'
--- include/x_window.h	2006-09-13 09:00:30 +0000
+++ include/x_window.h	2006-09-13 09:00:35 +0000
@@ -21,6 +21,16 @@
 #ifndef __X_WINDOW_H__
 #define __X_WINDOW_H__
 
+/*
+ * Stock Icon Ids
+ */
+
+#define GSCHEM_STOCK_ADD_BUS       "gschem-add-bus"
+#define GSCHEM_STOCK_ADD_COMPONENT "gschem-add-component"
+#define GSCHEM_STOCK_ADD_NET       "gschem-add-net"
+#define GSCHEM_STOCK_ADD_TEXT      "gschem-add-text"
+#define GSCHEM_STOCK_SELECT_MODE   "gschem-select-mode"
+
 
 /*
  * Window

=== modified file 'src/x_window.c'
--- src/x_window.c	2006-09-13 09:00:32 +0000
+++ src/x_window.c	2006-09-13 09:00:35 +0000
@@ -749,6 +749,47 @@
   
 }
 
+void
+window_register_toolbar_icons (Window *window)
+{
+  TOPLEVEL *toplevel = window->toplevel;
+  GtkIconFactory *icon_factory;
+  struct icons_t {
+    gchar *filename;
+    gchar *stock_id;
+  } icons[] = {
+    { "gschem-bus.xpm",    GSCHEM_STOCK_ADD_BUS       },
+    { "gschem-net.xpm",    GSCHEM_STOCK_ADD_NET       },
+    { "gschem-comp.xpm",   GSCHEM_STOCK_ADD_COMPONENT },
+    { "gschem-text.xpm",   GSCHEM_STOCK_ADD_TEXT      },
+    { "gschem-select.xpm", GSCHEM_STOCK_SELECT_MODE   },
+  };
+  gint i;
+
+  icon_factory = gtk_icon_factory_new ();
+  gtk_icon_factory_add_default (icon_factory);
+
+  for (i = 0; i < G_N_ELEMENTS (icons); i++) {
+    GtkIconSource *icon_source;
+    GtkIconSet *icon_set;
+    gchar *filename;
+
+    icon_source = gtk_icon_source_new ();
+    filename = g_build_filename (toplevel->bitmap_directory, 
+                                 icons[i].filename,
+                                 NULL);
+    gtk_icon_source_set_filename (icon_source, filename);
+    g_free (filename);
+    gtk_icon_source_set_size (icon_source, GTK_ICON_SIZE_SMALL_TOOLBAR);
+    
+    icon_set = gtk_icon_set_new ();
+    gtk_icon_set_add_source (icon_set, icon_source);
+    
+    gtk_icon_factory_add (icon_factory, icons[i].stock_id, icon_set);
+  }
+
+}
+
 static GtkWidget*
 window_create_menubar (Window *window)
 {
@@ -777,6 +818,7 @@
 window_create_toolbar (Window *window)
 {
   TOPLEVEL *toplevel = window->toplevel;
+  GtkStockItem stock_item;  
   GtkUIManager *ui;
   GtkActionGroup *actions;
   GError *error = NULL;  
@@ -819,14 +861,18 @@
     MODE_SELECT,
   };
   static GtkRadioActionEntry radio_entries[] = {
-    { "Component", GTK_STOCK_MISSING_IMAGE, N_("Component"), "", N_("Add component..."), MODE_COMPONENT },
-    { "Net",       GTK_STOCK_MISSING_IMAGE, N_("Net"),       "", N_("Add nets mode"),    MODE_NET       },
-    { "Bus",       GTK_STOCK_MISSING_IMAGE, N_("Bus"),       "", N_("Add buses mode"),   MODE_BUS       },
-    { "Text",      GTK_STOCK_MISSING_IMAGE, N_("Text"),      "", N_("Add text..."),      MODE_TEXT      },
-    { "Select",    GTK_STOCK_MISSING_IMAGE, N_("Select"),    "", N_("Select mode"),      MODE_SELECT    },
+    { "Component", GSCHEM_STOCK_ADD_COMPONENT, N_("Component"), "", N_("Add component..."), MODE_COMPONENT },
+    { "Net",       GSCHEM_STOCK_ADD_NET,       N_("Net"),       "", N_("Add nets mode"),    MODE_NET       },
+    { "Bus",       GSCHEM_STOCK_ADD_BUS,       N_("Bus"),       "", N_("Add buses mode"),   MODE_BUS       },
+    { "Text",      GSCHEM_STOCK_ADD_TEXT,      N_("Text"),      "", N_("Add text..."),      MODE_TEXT      },
+    { "Select",    GSCHEM_STOCK_SELECT_MODE,   N_("Select"),    "", N_("Select mode"),      MODE_SELECT    },
   };
   static guint n_radio_entries = G_N_ELEMENTS (entries);
 
+  /* register icons if it is not alreay done */
+  if (!gtk_stock_lookup (GSCHEM_STOCK_SELECT_MODE, &stock_item)) {
+    window_register_toolbar_icons (window);
+  }
 
   actions = gtk_action_group_new ("ToolbarActions");
   gtk_action_group_set_translate_func (actions,

