[Epiphany] Toolbar editor redux



Was thinking about this today, and decided that really I had no
overriding reasons why toolbars in an application should be different to
one another, so I redid the patch so there's a single global option to
set how the toolbars look.

I do still think that applications need to be able to override the
default GTK toolbar style, but billh wants toolbar icon size to be set
in the Gtk theme, so now you can only set the toolbar style.

I've left all my changes to the libegg stuff, so that you can set the
size/style in the libegg XML files, but in the epiphany XML files all
you can do is set the toolbar style by adding the style property to the
toplevel <default> item in the xml file.

Daveb wanted me to add a "Gnome Default" option so you could reset it to
match the gnome setting, but I've not done this yet because it adds a
GConf dependancy to the code, and as we're thinking of trying to get
this into GTK, we can't have this dependancy. My proposed solution is
that the default GTK toolbar style should become a XSetting so it will
be shared over all the applications, GTK and GNOME (and maybe things
like KDE as well, although I don't know if they use XSettings)

Thoughts?

Screenshot at: http://www.prettypeople.org/~iain/tbe-iain-4.png

iain
-- 
Index: data/ui/epiphany-toolbar.xml.in
===================================================================
RCS file: /cvs/gnome/epiphany/data/ui/epiphany-toolbar.xml.in,v
retrieving revision 1.9
diff -u -p -r1.9 epiphany-toolbar.xml.in
--- data/ui/epiphany-toolbar.xml.in	7 Mar 2003 12:37:46 -0000	1.9
+++ data/ui/epiphany-toolbar.xml.in	12 Mar 2003 00:41:30 -0000
@@ -21,7 +21,7 @@
 	<toolitem verb="Spinner"/>
 	<toolitem verb="ToolbarGo"/>
 </available>
-<default>
+<default style="both">
 <toolbar>
 	<toolitem verb="NavigationBack"/>
 	<toolitem verb="NavigationForward"/>
Index: lib/egg/egg-menu-merge.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/egg/egg-menu-merge.c,v
retrieving revision 1.7
diff -u -p -r1.7 egg-menu-merge.c
--- lib/egg/egg-menu-merge.c	8 Feb 2003 19:38:36 -0000	1.7
+++ lib/egg/egg-menu-merge.c	12 Mar 2003 00:41:30 -0000
@@ -235,6 +235,8 @@ get_child_node(EggMenuMerge *self, GNode
 	  mnode = g_chunk_new0(EggMenuMergeNode, merge_node_chunk);
 	  mnode->type = node_type;
 	  mnode->name = g_strndup(childname, childname_length);
+	  mnode->icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
+	  mnode->style = GTK_TOOLBAR_BOTH;
 	  mnode->dirty = TRUE;
 
 	  if (top)
@@ -377,6 +379,62 @@ struct _ParseContext
   guint merge_id;
 };
 
+static GtkToolbarStyle
+toolbar_style_from_string (const char *str)
+{
+  if (strcmp (str, "icons") == 0)
+  {
+    return GTK_TOOLBAR_ICONS;
+  }
+  else if (strcmp (str, "text") == 0)
+  {
+    return GTK_TOOLBAR_TEXT;
+  }
+  else if (strcmp (str, "both") == 0)
+  {
+    return GTK_TOOLBAR_BOTH;
+  }
+  else if (strcmp (str, "both_horiz") == 0)
+  {
+    return GTK_TOOLBAR_BOTH_HORIZ;
+  }
+  
+  g_warning ("Unknown GtkToolbarStyle: %s", str);
+  return GTK_TOOLBAR_BOTH;
+}
+
+static GtkIconSize
+icon_size_from_string (const char *str)
+{
+  if (strcmp (str, "menu") == 0)
+  {
+    return GTK_ICON_SIZE_MENU;
+  }
+  else if (strcmp (str, "small-toolbar") == 0)
+  {
+    return GTK_ICON_SIZE_SMALL_TOOLBAR;
+  }
+  else if (strcmp (str, "large-toolbar") == 0)
+  {
+    return GTK_ICON_SIZE_LARGE_TOOLBAR;
+  }
+  else if (strcmp (str, "button") == 0)
+  {
+    return GTK_ICON_SIZE_BUTTON;
+  }
+  else if (strcmp (str, "dnd") == 0)
+  {
+    return GTK_ICON_SIZE_DND;
+  }
+  else if (strcmp (str, "dialog") == 0)
+  {
+    return GTK_ICON_SIZE_DIALOG;
+  }
+  
+  g_warning ("Unknown GtkIconSize: %s", str);
+  return GTK_ICON_SIZE_LARGE_TOOLBAR;
+}
+
 static void
 start_element_handler (GMarkupParseContext *context,
 		       const gchar *element_name,
@@ -392,7 +450,9 @@ start_element_handler (GMarkupParseConte
   const gchar *node_name;
   GQuark verb_quark;
   gboolean top;
-
+  GtkIconSize icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
+  GtkToolbarStyle style = GTK_TOOLBAR_BOTH;
+  
   gboolean raise_error = TRUE;
   gchar *error_attr = NULL;
 
@@ -417,6 +477,14 @@ start_element_handler (GMarkupParseConte
 	{
 	  top = !strcmp(attribute_values[i], "top");
 	}
+      else if (!strcmp (attribute_names[i], "look"))
+        {
+	  style = toolbar_style_from_string (attribute_values[i]);
+	}
+      else if (!strcmp (attribute_names[i], "size"))
+        {
+	  icon_size = icon_size_from_string (attribute_values[i]);
+	}
     }
   /* if no verb, then set it to the node's name */
   if (verb_quark == 0)
@@ -484,6 +552,8 @@ start_element_handler (GMarkupParseConte
 
 	  egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current),
 						    ctx->merge_id, verb_quark);
+	  NODE_INFO(ctx->current)->icon_size = icon_size;
+	  NODE_INFO(ctx->current)->style = style;
 	  NODE_INFO(ctx->current)->dirty = TRUE;
 
 	  raise_error = FALSE;
@@ -987,7 +1057,8 @@ update_node (EggMenuMerge *self, GNode *
        * we don't have to do anything.
        */
       if (info->proxy != NULL &&
-	  action == info->action)
+	  action == info->action &&
+	  info->type != EGG_MENU_MERGE_TOOLBAR)
 	{
 	  goto recurse_children;
 	}
@@ -1073,6 +1144,9 @@ update_node (EggMenuMerge *self, GNode *
 	      gtk_widget_show (info->proxy);
 	      g_signal_emit (self, merge_signals[ADD_WIDGET], 0, info->proxy);
 	    }
+
+	  egg_toolbar_set_style (EGG_TOOLBAR (info->proxy), info->style);
+	  egg_toolbar_set_icon_size (EGG_TOOLBAR (info->proxy), info->icon_size);
 	  break;
 	case EGG_MENU_MERGE_MENU_PLACEHOLDER:
 	  /* create menu items for placeholders if necessary ... */
Index: lib/egg/egg-menu-merge.h
===================================================================
RCS file: /cvs/gnome/epiphany/lib/egg/egg-menu-merge.h,v
retrieving revision 1.2
diff -u -p -r1.2 egg-menu-merge.h
--- lib/egg/egg-menu-merge.h	20 Jan 2003 18:57:16 -0000	1.2
+++ lib/egg/egg-menu-merge.h	12 Mar 2003 00:41:30 -0000
@@ -64,6 +64,9 @@ struct _EggMenuMergeNode {
 
   GList *uifiles;
 
+  GtkIconSize icon_size;
+  GtkToolbarStyle style;
+  
   guint dirty : 1;
 };
 
Index: lib/egg/eggtoolbar.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/egg/eggtoolbar.c,v
retrieving revision 1.7
diff -u -p -r1.7 eggtoolbar.c
--- lib/egg/eggtoolbar.c	7 Mar 2003 01:20:45 -0000	1.7
+++ lib/egg/eggtoolbar.c	12 Mar 2003 00:41:31 -0000
@@ -1508,6 +1508,7 @@ egg_toolbar_insert_tool_item (EggToolbar
   egg_tool_item_set_orientation (item, toolbar->orientation);
   egg_tool_item_set_toolbar_style (item, toolbar->style);
   egg_tool_item_set_relief_style (item, get_button_relief (toolbar));
+  egg_tool_item_set_icon_size (item, toolbar->icon_size);
   
   gtk_widget_set_parent (GTK_WIDGET (item), GTK_WIDGET (toolbar));
   GTK_WIDGET_UNSET_FLAGS (item, GTK_CAN_FOCUS);  
Index: lib/widgets/ephy-editable-toolbar.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/widgets/ephy-editable-toolbar.c,v
retrieving revision 1.23
diff -u -p -r1.23 ephy-editable-toolbar.c
--- lib/widgets/ephy-editable-toolbar.c	8 Mar 2003 12:44:34 -0000	1.23
+++ lib/widgets/ephy-editable-toolbar.c	12 Mar 2003 00:41:31 -0000
@@ -93,7 +93,9 @@ struct EphyEditableToolbarPrivate
 	GtkWidget *editor;
 	GtkWidget *table;
 	GtkWidget *scrolled_window;
-
+	GtkWidget *option_menu;
+	GtkWidget *menu;
+	
 	GtkWidget *last_toolbar;
 
 	guint ui_id;
@@ -103,7 +105,7 @@ struct EphyEditableToolbarPrivate
 	gboolean edit_mode;
 
 	EphyToolbarsGroup *group;
-
+	
 	EggMenuMerge *popup_merge;
 	EggActionGroup *popup_action_group;
 
@@ -946,54 +948,145 @@ dialog_response_cb (GtkDialog *dialog, g
 	}
 }
 
+static GtkWidget *
+make_title_label (const char *text,
+		  double x_align)
+{
+	char *full_text;
+	GtkWidget *label;
+
+	full_text = g_strdup_printf ("<span weight=\"bold\">%s</span>", text);
+	label = gtk_label_new (full_text);
+	g_free (full_text);
+
+	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+	gtk_misc_set_alignment (GTK_MISC (label), x_align, 0.5);
+	
+	return label;
+}
+
+static const char *style[4] = {
+	N_("Icons Only"),
+	N_("Text Only"),
+	N_("Both Icons and Text Vertically"),
+	N_("Both Icons and Text Horizontally")
+};
+
+static void
+item_activated (GtkWidget *item,
+		gpointer style)
+{
+	EphyEditableToolbar *etoolbar;
+
+	etoolbar = g_object_get_data (G_OBJECT (item), "etoolbar");
+	ephy_toolbars_group_set_style (etoolbar->priv->group, GPOINTER_TO_INT (style));
+}
+
+static GtkWidget *
+make_style_menu (EphyEditableToolbar *etoolbar)
+{
+	int i;
+	GtkWidget *menu;
+
+	menu = gtk_menu_new ();
+	
+	for (i = 0; i < 4; i++) {
+		GtkWidget *item;
+
+		item = gtk_menu_item_new_with_label (_(style[i]));
+		g_object_set_data (G_OBJECT (item), "etoolbar", etoolbar);
+		
+		g_signal_connect (G_OBJECT (item), "activate",
+				  G_CALLBACK (item_activated), GINT_TO_POINTER (i));
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+		gtk_widget_show (item);
+	}
+
+	gtk_widget_show (menu);
+	return menu;
+}
+
 static void
 setup_editor (EphyEditableToolbar *etoolbar, GtkWidget *window)
 {
 	GtkWidget *editor;
 	GtkWidget *scrolled_window;
 	GtkWidget *vbox;
-	GtkWidget *label_hbox;
-	GtkWidget *image;
 	GtkWidget *label;
-
+	GtkWidget *inner_vbox;
+	GtkWidget *spacer_hbox;
+	GtkWidget *inner_hbox;
+	GtkWidget *menu;
+	GtkWidget *spacer;
+	GtkWidget *style;
+	
 	g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (etoolbar));
 
-	editor = gtk_dialog_new (),
+	editor = gtk_dialog_new ();
 	gtk_dialog_set_has_separator (GTK_DIALOG (editor), FALSE);
-	gtk_widget_set_size_request (GTK_WIDGET (editor), 500, 330);
+	gtk_window_set_default_size (GTK_WINDOW (editor), 500, 425);
 	gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (window));
-	gtk_window_set_title (GTK_WINDOW (editor), "Toolbar editor");
+	gtk_window_set_title (GTK_WINDOW (editor), _("Toolbar editor"));
 	etoolbar->priv->editor = editor;
 
 	vbox = gtk_vbox_new (FALSE, 12);
 	gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
 	gtk_widget_show (vbox);
 	gtk_container_add (GTK_CONTAINER (GTK_DIALOG (editor)->vbox), vbox);
+
+	inner_vbox = gtk_vbox_new (FALSE, 6);
+	gtk_box_pack_start (GTK_BOX (vbox), inner_vbox, TRUE, TRUE, 0);
+	gtk_widget_show (inner_vbox);
+
+	label = make_title_label (_("Drag Tools In and Out of the Toolbars:"), 0.0);
+	gtk_box_pack_start (GTK_BOX (inner_vbox), label, FALSE, FALSE, 0);
+	gtk_widget_show (label);
+
+	spacer_hbox = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (inner_vbox), spacer_hbox, TRUE, TRUE, 0);
+	gtk_widget_show (spacer_hbox);
+
+	spacer = gtk_label_new ("    ");
+	gtk_box_pack_start (GTK_BOX (spacer_hbox), spacer, FALSE, FALSE, 0);
+	gtk_widget_show (spacer);
+
 	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
 	etoolbar->priv->scrolled_window = scrolled_window;
 	gtk_widget_show (scrolled_window);
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
 					GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-	gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
-	label_hbox = gtk_hbox_new (FALSE, 6);
-	gtk_widget_show (label_hbox);
-	gtk_box_pack_start (GTK_BOX (vbox), label_hbox, FALSE, FALSE, 0);
-	image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
-	gtk_widget_show (image);
-	gtk_box_pack_start (GTK_BOX (label_hbox), image, FALSE, FALSE, 0);
-	label = gtk_label_new (_("Drag an item onto the toolbars above to add it, "
-				 "from the toolbars in the items table to remove it."));
-	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+	gtk_box_pack_start (GTK_BOX (spacer_hbox), scrolled_window, TRUE, TRUE, 0);
+
+	inner_vbox = gtk_vbox_new (FALSE, 6);
+	gtk_box_pack_start (GTK_BOX (vbox), inner_vbox, FALSE, FALSE, 0);
+	gtk_widget_show (inner_vbox);
+
+	inner_hbox = gtk_hbox_new (FALSE, 6);
+	gtk_box_pack_start (GTK_BOX (inner_vbox), inner_hbox, FALSE, FALSE, 0);
+	gtk_widget_show (inner_hbox);
+
+	label = make_title_label (_("Toolbar Style:"), 0.0);
+	gtk_box_pack_start (GTK_BOX (inner_hbox), label, FALSE, FALSE, 0);
 	gtk_widget_show (label);
-	gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, TRUE, 0);
+	
+	style = gtk_option_menu_new ();
+	gtk_box_pack_start (GTK_BOX (inner_hbox), style, TRUE, TRUE, 0);
+	gtk_widget_show (style);
+	
+	menu = make_style_menu (etoolbar);
+	gtk_option_menu_set_menu (GTK_OPTION_MENU (style), menu);
+ 	gtk_option_menu_set_history (GTK_OPTION_MENU (style), ephy_toolbars_group_get_style (etoolbar->priv->group));
 
 	gtk_dialog_add_button (GTK_DIALOG (editor),
-			       _("Add Toolbar"),
+			       _("Add a New Toolbar..."),
 			       RESPONSE_ADD_TOOLBAR);
 	gtk_dialog_add_button (GTK_DIALOG (editor),
 			       GTK_STOCK_CLOSE,
 			       GTK_RESPONSE_CLOSE);
-
+	gtk_dialog_add_button (GTK_DIALOG (editor),
+			       GTK_STOCK_HELP,
+			       GTK_RESPONSE_HELP);
+	
 	g_signal_connect (editor, "response",
 			  G_CALLBACK (dialog_response_cb),
 			  etoolbar);
Index: lib/widgets/ephy-toolbars-group.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/widgets/ephy-toolbars-group.c,v
retrieving revision 1.9
diff -u -p -r1.9 ephy-toolbars-group.c
--- lib/widgets/ephy-toolbars-group.c	27 Feb 2003 13:11:49 -0000	1.9
+++ lib/widgets/ephy-toolbars-group.c	12 Mar 2003 00:41:31 -0000
@@ -42,6 +42,26 @@ struct EphyToolbarsGroupPrivate
 	GNode *toolbars;
 	char *defaults;
 	char *user;
+
+	GtkToolbarStyle style;
+	GtkIconSize icon_size;
+};
+
+static const char *toolbar_style[4] = {
+	"icons",
+	"text",
+	"both",
+	"both_horiz"
+};
+
+static const char *toolbar_icon_size[7] = {
+	"Unknown", /* Shouldn't occur but we need it to match the rest up */
+	"menu",
+	"small-toolbar",
+	"large-toolbar",
+	"button",
+	"dnd",
+	"dialog"
 };
 
 GType
@@ -87,10 +107,12 @@ ephy_toolbars_group_to_xml (EphyToolbars
 	doc = xmlNewDoc ("1.0");
 	doc->children = xmlNewDocNode (doc, NULL, "toolbars", NULL);
 
+	xmlSetProp (doc->children, "style", toolbar_style[t->priv->style]);
+	
 	for (l1 = tl->children; l1 != NULL; l1 = l1->next)
 	{
 		xmlNodePtr tnode;
-
+		
 		tnode = xmlNewChild (doc->children, NULL, "toolbar", NULL);
 
 		for (l2 = l1->children; l2 != NULL; l2 = l2->next)
@@ -133,7 +155,7 @@ toolbars_toolbar_new (void)
 
 	toolbar = g_new0 (EphyToolbarsToolbar, 1);
 	toolbar->id = g_strdup_printf ("Toolbar%d", id);
-
+		
 	id++;
 
 	return toolbar;
@@ -250,13 +272,72 @@ parse_item_list (EphyToolbarsGroup *t,
 	}
 }
 
+static GtkToolbarStyle
+toolbar_style_from_string (const char *str)
+{
+	if (strcmp (str, "icons") == 0)
+	{
+		return GTK_TOOLBAR_ICONS;
+	}
+	else if (strcmp (str, "text") == 0)
+	{
+		return GTK_TOOLBAR_TEXT;
+	}
+	else if (strcmp (str, "both") == 0)
+	{
+		return GTK_TOOLBAR_BOTH;
+	}
+	else if (strcmp (str, "horizontal") == 0)
+	{
+		return GTK_TOOLBAR_BOTH_HORIZ;
+	}
+
+	g_warning ("Unknown GtkToolbarStyle: %s", str);
+	return GTK_TOOLBAR_BOTH;
+}
+
+#if 0
+static GtkIconSize
+icon_size_from_string (const char *str)
+{
+	if (strcmp (str, "menu") == 0)
+	{
+		return GTK_ICON_SIZE_MENU;
+	}
+	else if (strcmp (str, "small-toolbar") == 0)
+	{
+		return GTK_ICON_SIZE_SMALL_TOOLBAR;
+	}
+	else if (strcmp (str, "large-toolbar") == 0)
+	{
+		return GTK_ICON_SIZE_LARGE_TOOLBAR;
+	}
+	else if (strcmp (str, "button") == 0)
+	{
+		return GTK_ICON_SIZE_BUTTON;
+	}
+	else if (strcmp (str, "dnd") == 0)
+	{
+		return GTK_ICON_SIZE_DND;
+	}
+	else if (strcmp (str, "dialog") == 0)
+	{
+		return GTK_ICON_SIZE_DIALOG;
+	}
+
+	g_warning ("Unknown GtkIconSize: %s", str);
+	return GTK_ICON_SIZE_LARGE_TOOLBAR;
+}
+#endif
 static GNode *
-add_toolbar (EphyToolbarsGroup *t)
+add_toolbar (EphyToolbarsGroup *t,
+	     xmlNodePtr child)
 {
 	EphyToolbarsToolbar *toolbar;
 	GNode *node;
 
 	toolbar = toolbars_toolbar_new ();
+
 	node = g_node_new (toolbar);
 	g_node_append (t->priv->toolbars, node);
 
@@ -267,12 +348,15 @@ EphyToolbarsToolbar *
 ephy_toolbars_group_add_toolbar (EphyToolbarsGroup *t)
 {
 	GNode *node;
-
+	EphyToolbarsToolbar *toolbar;
+	
 	g_return_val_if_fail (IS_EPHY_TOOLBARS_GROUP (t), NULL);
 
-	node = add_toolbar (t);
+	node = add_toolbar (t, NULL);
 	g_return_val_if_fail (node != NULL, NULL);
 
+	toolbar = node->data;
+	
 	toolbars_group_save (t);
 
 	g_signal_emit (G_OBJECT (t), ephy_toolbars_group_signals[CHANGED], 0);
@@ -290,8 +374,10 @@ parse_toolbars (EphyToolbarsGroup *t,
 		{
 			GNode *node;
 
-			node = add_toolbar (t);
+			node = add_toolbar (t, child);
+			
 			parse_item_list (t, child->children, node);
+
 		}
 
 		child = child->next;
@@ -305,7 +391,7 @@ load_defaults (EphyToolbarsGroup *t)
         xmlNodePtr child;
 	xmlNodePtr root;
 	const char *xml_filepath;
-
+	
 	g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t));
 
 	LOG ("Load default toolbar info")
@@ -314,7 +400,7 @@ load_defaults (EphyToolbarsGroup *t)
 
 	doc = xmlParseFile (xml_filepath);
 	root = xmlDocGetRootElement (doc);
-
+	
 	child = root->children;
 	while (child)
 	{
@@ -327,6 +413,14 @@ load_defaults (EphyToolbarsGroup *t)
 		else if (xmlStrEqual (child->name, "default") &&
 			 t->priv->toolbars == NULL)
 		{
+			char *style;
+			
+			style = xmlGetProp (child, "style");
+			if (style != NULL) {
+				t->priv->style = toolbar_style_from_string (style);
+				xmlFree (style);
+			}
+
 			t->priv->toolbars = g_node_new (NULL);
 			parse_toolbars (t, child->children);
 		}
@@ -343,7 +437,8 @@ load_toolbar (EphyToolbarsGroup *t)
 	xmlDocPtr doc;
 	xmlNodePtr root;
 	const char *xml_filepath = t->priv->user;
-
+	char *style;
+	
 	g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t));
 
 	LOG ("Load custom toolbar")
@@ -353,6 +448,12 @@ load_toolbar (EphyToolbarsGroup *t)
 	doc = xmlParseFile (xml_filepath);
 	root = xmlDocGetRootElement (doc);
 
+	style = xmlGetProp (root, "style");
+	if (style != NULL) {
+		t->priv->style = toolbar_style_from_string (style);
+		xmlFree (style);
+	}
+	
 	t->priv->toolbars = g_node_new (NULL);
 	parse_toolbars (t, root->children);
 
@@ -381,7 +482,9 @@ ephy_toolbars_group_to_string (EphyToolb
 		EphyToolbarsToolbar *toolbar = l1->data;
 
 		g_string_append_printf
-			(s, "<dockitem name=\"%s\">\n", toolbar->id);
+			(s, "<dockitem name=\"%s\" look=\"%s\" size=\"%s\">\n",
+			 toolbar->id, toolbar_style[t->priv->style],
+			 toolbar_icon_size[t->priv->icon_size]);
 
 		for (l2 = l1->children; l2 != NULL; l2 = l2->next)
 		{
@@ -446,6 +549,10 @@ ephy_toolbars_group_init (EphyToolbarsGr
 	t->priv->toolbars = NULL;
 	t->priv->user = NULL;
 	t->priv->defaults = NULL;
+
+	t->priv->style = GTK_TOOLBAR_BOTH;
+	/* Take this from the GTK theme */
+	t->priv->icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
 }
 
 static void
@@ -532,6 +639,22 @@ ephy_toolbars_group_remove_item	(EphyToo
 	toolbars_group_save (t);
 
 	g_signal_emit (G_OBJECT (t), ephy_toolbars_group_signals[CHANGED], 0);
+}
+
+void
+ephy_toolbars_group_set_style (EphyToolbarsGroup *t,
+			       GtkToolbarStyle style)
+{
+	t->priv->style = style;
+	toolbars_group_save (t);
+
+	g_signal_emit (G_OBJECT (t), ephy_toolbars_group_signals[CHANGED], 0);
+}
+
+GtkToolbarStyle
+ephy_toolbars_group_get_style (EphyToolbarsGroup *t)
+{
+	return t->priv->style;
 }
 
 void
Index: lib/widgets/ephy-toolbars-group.h
===================================================================
RCS file: /cvs/gnome/epiphany/lib/widgets/ephy-toolbars-group.h,v
retrieving revision 1.3
diff -u -p -r1.3 ephy-toolbars-group.h
--- lib/widgets/ephy-toolbars-group.h	21 Feb 2003 16:40:34 -0000	1.3
+++ lib/widgets/ephy-toolbars-group.h	12 Mar 2003 00:41:31 -0000
@@ -106,6 +106,10 @@ char		       *ephy_toolbars_group_to_str
 char		       *ephy_toolbars_group_get_path		(EphyToolbarsGroup *t,
 								 gpointer item);
 
+void			ephy_toolbars_group_set_style		(EphyToolbarsGroup *t,
+								 GtkToolbarStyle style);
+
+GtkToolbarStyle         ephy_toolbars_group_get_style           (EphyToolbarsGroup *t);
 G_END_DECLS
 
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]