Re: Comments on toolbar



Owen Taylor <otaylor redhat com> writes:

I'm attaching a patch that fixes the things below plus a bug pointed
out by Morten Welinder on IRC.

> > There is a fairly extensive ChangeLog in libegg. Do we want that
> > somewhere in gtk+?
> 
> What I've done on other large merges is to write a fairly elaborate
> ChangeLog entry for GTK+ describing what is new *for GTK+*, but
> not try to go into the details of the a=>b=>c work that happened
> in the extra module. If someone wants that, they can go look
> in libegg CVS.

The attached patch changes the ChangeLog entry from the merge to be
more elaborate. Is it bad form to change an existing ChangeLog entry?

> > > - Would gtk_tool_item_unset_proxy_menu_item(ID) be useful?

[...]

> In the end, probably not worth the extra bloat in the API.

Probably not, no.

> The question to me is whether anybody would actually go through
> the effort to create an IconSet to do this. GtkIconSet is 
> not a particularly convenient API to use.
> 
> (One thing which we need to sort out once it lands is the
> interaction of this with named icons)

So it's probably best to just leave it out until someone asks for
it. That also takes care of it being mutually-exclusive with
icon_widget. The property is removed in the attached patch.

> > Also using the "label" property for two conceptually
> > different things sounds dubious to me.
> 
> Don't quite understand what you mean here. Are you saying
> that you don't think it would be broken if the
> "label" property affected the icon as well as the label?

No, just that in the GtkButton case

   - when use_underline is TRUE label is an identier that is used as
     a key in an internal table of stock items.

   - when use_underline is FALSE label is text that is actually shown
     to the user.

That's conceptually two different things.

> Maybe we should just make the no argument constructor be
> 
>  gtk_tool_button_new (const char *label
>                       GdkPixbuf  *icon);
> 
> and allow NULL for both? The empty constructor for GtkButton has
> to do with the original "a button is just a container" philosophy
> which doesn't hold for GtkToolButton.

Good idea. Attached patch has this.

> > > - Maybe combine focus_home/focus_end into a signal boolean-parametered
> > >   (or enum parametered? Do we have a suitable enumeration) signal.
> > 
> > I combined them into gtk_toolbar_focus_ends () with a boolean
> > parameter "home". I don't like the name focus_ends(), but I can't
> > think of a better one.
> 
> focus_start_end (gboolean focus_start)? hmm. Maybe we should just
> go back to the separate signals.

In the patch I changed it to focus_home_or_end (gboolean focus_home). 

The code for the two separate signals would be pretty much the same,
so I'd prefer to leave it as one signal.

> > > - I don't see any reaosn to propagate "empty item is a separator
> > >   into GtkToolbar" - I'd just draw GtkSeparatorToolbarItem as
> > >   a separator ... could you then move the expose code for separators
> > >   into the GtkSeparatorToolbarItem?

Ok, I'll look at this later (I'll add a comment to 116299 pointing to
your mail).

> I think TAB_FORWARD definitely should have a reversed since for
> RTL. That it doesn't for gtkcontainer is very much a bug,.

I have done this for gtktoolbar in the attached patch. If the patch
is applied, I'll close 116301 and open a new one about RTL focusing
in gtkcontainer.c and elsewhere.

> > > - gtk_toolbar_move_focus()/gtk_toolbar_focus() don't properly 
> > >   handle internal focus states? You need to first try moving the 
> > >   focus on the current widget before going to the next
> > 
> > Well, move_focus() shouldn't handle internal focus states, because at
> > the time it is called the keystroke will have propagated up through
> > all the child widgets.
> 
[...]
> So, Control-Tab needs to cycle internal focus states before going
> to the next widget on the toolbar.

You're right. The arrow keys should also cycle internal focus before
going on to the next widget. I have done this in the attached patch
(but I haven't tested it).

> > > - What is the difference bewteen move_focus() and focus()
> > >   [ comments distinctly useful if there is a reason ]

[...]

> The comments you added our quite helpful. Might not hurt
> to have a comment for move_focus() as well as one for focus()
> to allow compare-and-contrast.

I added a comment for the move_focus handler

> Is there any reason to have this property at all, since the only
> conceivable us case would be for stock ID's, and you have a separate
> stock-id property?

If we removed it, the toolbar would have to act like use_underline was
always TRUE, because of the overflow menu which needs the
mnemonics. That might be confusing, but on the other hand, with it
defaulting to FALSE, we might see applications that do not have
mnemonics on the overflow menu items.

> > > - Should make the elide_underscores() function a private function
> > >   somewhere that is shared between the two source files that use it.
> > 
> > Filed as 116307 because I'm not sure what the function should be called
> 
> Doesn't matter much ... _gtk_tool_button_elide_underscores() or
> something would be fine.

Ok, _gtk_tool_bar_elide_underscores() is in patch.


Søren

? asdf
? toolbar.patch
? toolbar.tar.gz
? tooldiff
? tooldiff1
? tooldiff1.patch
? demos/gtk-demo/geninclude.pl
? gdk/gdkmarshalers.c
? gtk/hatch.sh
? gtk/tarb
? gtk/toolfiles
? gtk/toolhfiles
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.4261
diff -u -p -u -r1.4261 ChangeLog
--- ChangeLog	1 Jul 2003 11:14:45 -0000	1.4261
+++ ChangeLog	1 Jul 2003 20:35:31 -0000
@@ -1,3 +1,32 @@
+Tue Jul  1 22:49:25 2003  Soeren Sandmann  <sandmann daimi au dk>
+
+	* gtk/gtktoolbar.c (gtk_toolbar_remove_tool_item): Fix bug where
+	list is changed inside a for loop (pointed out by Morten
+	Welinder).
+
+	* gtk/gtktoolbutton.c: remove copy of elide_underscores(). Use
+	gtk_toolbar_elide_underscores instead.
+
+	* gtk/gtktoolbar.c (_gtk_toolbar_elide_underscores): export this
+	as an internal function.
+
+	* gtk/gtktoolbar.c (gtk_toolbar_move_focus): add comment
+	explaining difference to gtk_toolbar_focus();
+
+	* gtk/gtktoolbar.c (gtk_toolbar_focus_home_or_end): Minor
+	formatting change	
+
+	* gtk/gtktoolbar.c (gtk_toolbar_list_children_in_focus_order):
+	Make TAB_FORWARD focus the right widget in RTL mode
+
+	* gtk/gtktoolbar.c: rename signal from focus_ends to
+	focus_home_or_end.
+
+	* gtk/gtktoolbutton.c (gtk_tool_button_new): Change to take
+	"label" and "icon" parameters
+
+	* gtk/gtktoolbutton.[ch]: remove icon_set property.
+
 2003-07-01  Tor Lillqvist  <tml iki fi>
 
 	* gdk/win32/gdkwindow-win32.c (_gdk_windowing_window_get_pointer):
@@ -46,20 +75,35 @@
 
 Mon Jun 30 01:20:19 2003  Soeren Sandmann  <sandmann daimi au dk>
 
-	* gtkradiotoolbutton.c
-	* gtkradiotoolbutton.h
-	* gtktoggletoolbutton.c
-	* gtktoggletoolbutton.h
-	* gtktoolbutton.c
-	* gtktoolbutton.h
-	* gtktoolitem.c
-	* gtktoolitem.h
-	* gtktoolbar.c
-	* gtktoolbar.h
-	* gtkseparatortoolitem.c
-	* gtkseparatortoolitem.h
+	* gtkradiotoolbutton.c:		new file
+	* gtkradiotoolbutton.h:		   "
+	* gtktoggletoolbutton.c:	   "
+	* gtktoggletoolbutton.h:	   "
+	* gtktoolbutton.c:		   "
+	* gtktoolbutton.h:		   "
+	* gtktoolitem.c:		   "
+	* gtktoolitem.h:		   "
+	* gtktoolbar.c: many changes
+	* gtktoolbar.h: many changes
+	* gtkseparatortoolitem.c:	new file
+	* gtkseparatortoolitem.h	   "
 
 	New toolbar.
+	
+	- Items on a toolbar are now separate widgets, instances of a
+	  subclasses of GtkToolItem.
+
+	- Items there aren't room for on the toolbar are unmapped, and an
+	  overflow menu with a proxy menu item is added instead.
+
+	- The toolbar is keyboard navigatable. Press TAB to focus the
+	  first item, then use arrow keys and Ctrl TAB to move around the
+	  toolbar. TAB moves focus out of the toolbar.
+
+	- Bascially all of the old toolbar API is deprecated in favor of
+	  new API in gtktoolbar.h. 
+
+	- The toolbar is backwards compatible with the old toolbar.
 
 2003-06-29  Matthias Clasen  <maclas gmx de>
 
Index: gtk/gtktoolbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.c,v
retrieving revision 1.88
diff -u -p -u -r1.88 gtktoolbar.c
--- gtk/gtktoolbar.c	29 Jun 2003 23:34:19 -0000	1.88
+++ gtk/gtktoolbar.c	1 Jul 2003 20:35:33 -0000
@@ -78,7 +78,7 @@ enum {
   STYLE_CHANGED,
   POPUP_CONTEXT_MENU,
   MOVE_FOCUS,
-  FOCUS_ENDS,
+  FOCUS_HOME_OR_END,
   LAST_SIGNAL
 };
 
@@ -147,10 +147,10 @@ static void gtk_toolbar_real_orientation
 static void gtk_toolbar_real_style_changed       (GtkToolbar      *toolbar,
 						  GtkToolbarStyle  style);
 
-static gboolean gtk_toolbar_move_focus     (GtkToolbar       *toolbar,
-					    GtkDirectionType  dir);
-static gboolean gtk_toolbar_focus_ends     (GtkToolbar       *toolbar,
-					    gboolean	       home);
+static gboolean gtk_toolbar_move_focus        (GtkToolbar       *toolbar,
+					       GtkDirectionType  dir);
+static gboolean gtk_toolbar_focus_home_or_end (GtkToolbar       *toolbar,
+					       gboolean          focus_home);
 
 static gboolean             gtk_toolbar_button_press         (GtkWidget      *toolbar,
 							      GdkEventButton *event);
@@ -343,11 +343,11 @@ gtk_toolbar_class_init (GtkToolbarClass 
 			     _gtk_marshal_BOOLEAN__ENUM,
 			     G_TYPE_BOOLEAN, 1,
 			     GTK_TYPE_DIRECTION_TYPE);
-  toolbar_signals[FOCUS_ENDS] =
-    _gtk_binding_signal_new ("focus_ends",
+  toolbar_signals[FOCUS_HOME_OR_END] =
+    _gtk_binding_signal_new ("focus_home_or_end",
 			     G_OBJECT_CLASS_TYPE (klass),
 			     G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-			     G_CALLBACK (gtk_toolbar_focus_ends),
+			     G_CALLBACK (gtk_toolbar_focus_home_or_end),
 			     NULL, NULL,
 			     _gtk_marshal_BOOLEAN__BOOLEAN,
 			     G_TYPE_BOOLEAN, 1,
@@ -468,16 +468,16 @@ gtk_toolbar_class_init (GtkToolbarClass 
   add_arrow_bindings (binding_set, GDK_Down, GTK_DIR_DOWN);
 
   gtk_binding_entry_add_signal (binding_set, GDK_KP_Home, 0,
-                                "focus_ends", 1,
+                                "focus_home_or_end", 1,
 				G_TYPE_BOOLEAN, TRUE);
   gtk_binding_entry_add_signal (binding_set, GDK_Home, 0,
-                                "focus_ends", 1,
+                                "focus_home_or_end", 1,
 				G_TYPE_BOOLEAN, TRUE);
   gtk_binding_entry_add_signal (binding_set, GDK_KP_End, 0,
-                                "focus_ends", 1,
+                                "focus_home_or_end", 1,
 				G_TYPE_BOOLEAN, FALSE);
   gtk_binding_entry_add_signal (binding_set, GDK_End, 0,
-                                "focus_ends", 1,
+                                "focus_home_or_end", 1,
 				G_TYPE_BOOLEAN, FALSE);
 
   add_ctrl_tab_bindings (binding_set, 0, GTK_DIR_RIGHT);
@@ -1292,28 +1292,29 @@ gtk_toolbar_list_children_in_focus_order
   if (dir == GTK_DIR_RIGHT || dir == GTK_DIR_DOWN || dir == GTK_DIR_TAB_FORWARD)
     result = g_list_reverse (result);
 
-  if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL)
-    result = g_list_reverse (result);
+  if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL &&
+      dir != GTK_DIR_TAB_FORWARD)
+    {
+      result = g_list_reverse (result);
+    }
 
   return result;
 }
 
 static gboolean
-gtk_toolbar_focus_ends (GtkToolbar *toolbar,
-			gboolean    home)
+gtk_toolbar_focus_home_or_end (GtkToolbar *toolbar,
+			       gboolean    focus_home)
 {
   GList *children, *list;
-  GtkDirectionType dir = home? GTK_DIR_RIGHT : GTK_DIR_LEFT;
+  GtkDirectionType dir = focus_home? GTK_DIR_RIGHT : GTK_DIR_LEFT;
 
   children = gtk_toolbar_list_children_in_focus_order (toolbar, dir);
 
   if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL)
     {
       children = g_list_reverse (children);
-      if (dir == GTK_DIR_RIGHT)
-	dir = GTK_DIR_LEFT;
-      else
-	dir = GTK_DIR_RIGHT;
+      
+      dir = (dir == GTK_DIR_RIGHT)? GTK_DIR_LEFT : GTK_DIR_RIGHT;
     }
 
   for (list = children; list != NULL; list = list->next)
@@ -1332,13 +1333,22 @@ gtk_toolbar_focus_ends (GtkToolbar *tool
   return TRUE;
 }   
 
+/* Keybinding handler. This function is called when the user presses
+ * Ctrl TAB or an arrow key.
+ */
 static gboolean
 gtk_toolbar_move_focus (GtkToolbar       *toolbar,
 			GtkDirectionType  dir)
 {
   GList *list;
   gboolean try_focus = FALSE;
-  GList *children = gtk_toolbar_list_children_in_focus_order (toolbar, dir);
+  GList *children;
+  GtkContainer *container = GTK_CONTAINER (toolbar);
+
+  if (container->focus_child && gtk_widget_child_focus (container->focus_child, dir))
+    return TRUE;
+  
+  children = gtk_toolbar_list_children_in_focus_order (toolbar, dir);
 
   for (list = children; list != NULL; list = list->next)
     {
@@ -1356,8 +1366,8 @@ gtk_toolbar_move_focus (GtkToolbar      
   return TRUE;
 }
 
-/* The focus handler for the toolbar. It called when the user presses TAB or otherwise
- * tries to focus the toolbar.
+/* The focus handler for the toolbar. It called when the user presses
+ * TAB or otherwise tries to focus the toolbar.
  */
 static gboolean
 gtk_toolbar_focus (GtkWidget        *widget,
@@ -2078,9 +2088,11 @@ gtk_toolbar_remove_tool_item (GtkToolbar
   g_return_if_fail (GTK_IS_TOOL_ITEM (item));
   
   priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
-  
-  for (tmp = priv->items; tmp != NULL; tmp = tmp->next)
+
+  tmp = priv->items;
+  while (tmp)
     {
+      GList *next = tmp->next;
       GtkWidget *child = tmp->data;
       
       if (child == GTK_WIDGET (item))
@@ -2098,6 +2110,8 @@ gtk_toolbar_remove_tool_item (GtkToolbar
 
 	  break;
 	}
+      
+      tmp = next;
     }
 }
 
@@ -2588,8 +2602,8 @@ gtk_toolbar_insert_element (GtkToolbar  
 					      icon, callback, user_data, position, FALSE);
 }
 
-static gchar *
-elide_underscores (const gchar *original)
+gchar *
+_gtk_toolbar_elide_underscores (const gchar *original)
 {
   gchar *q, *result;
   const gchar *p;
@@ -2660,7 +2674,7 @@ gtk_toolbar_internal_insert_element (Gtk
       break;
 
     case GTK_TOOLBAR_CHILD_BUTTON:
-      item = gtk_tool_button_new ();
+      item = gtk_tool_button_new (NULL, NULL);
       child->widget = GTK_TOOL_BUTTON (item)->button;
       break;
       
@@ -2693,7 +2707,7 @@ gtk_toolbar_internal_insert_element (Gtk
 	      gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (item), text);
 
 	      gtk_stock_lookup (text, &stock_item);
-	      label_text = elide_underscores (stock_item.label);
+	      label_text = _gtk_toolbar_elide_underscores (stock_item.label);
 	      child->label = GTK_WIDGET (gtk_label_new (label_text));
 	      g_free (label_text);
 	    }
Index: gtk/gtktoolbar.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.h,v
retrieving revision 1.32
diff -u -p -u -r1.32 gtktoolbar.h
--- gtk/gtktoolbar.h	29 Jun 2003 23:34:19 -0000	1.32
+++ gtk/gtktoolbar.h	1 Jul 2003 20:35:33 -0000
@@ -157,6 +157,9 @@ GtkIconSize     gtk_toolbar_get_icon_siz
 gboolean        gtk_toolbar_get_tooltips     (GtkToolbar      *toolbar);
 GtkReliefStyle  gtk_toolbar_get_relief_style (GtkToolbar      *toolbar);
 
+/* internal function */
+gchar *	_gtk_toolbar_elide_underscores (const gchar *original);
+
 #ifndef GTK_DISABLE_DEPRECATED
 /* Simple button items */
 void       gtk_toolbar_set_style     (GtkToolbar      *toolbar,
Index: gtk/gtktoolbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbutton.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 gtktoolbutton.c
--- gtk/gtktoolbutton.c	29 Jun 2003 23:34:19 -0000	1.1
+++ gtk/gtktoolbutton.c	1 Jul 2003 20:35:34 -0000
@@ -30,6 +30,7 @@
 #include "gtkstock.h"
 #include "gtkvbox.h"
 #include "gtkintl.h"
+#include "gtktoolbar.h"
 
 #include <string.h>
 
@@ -46,7 +47,6 @@ enum {
   PROP_USE_UNDERLINE,
   PROP_LABEL_WIDGET,
   PROP_STOCK_ID,
-  PROP_ICON_SET,
   PROP_ICON_WIDGET,
 };
 
@@ -158,13 +158,6 @@ gtk_tool_button_class_init (GtkToolButto
 							NULL,
 							G_PARAM_READWRITE));
   g_object_class_install_property (object_class,
-				   PROP_ICON_SET,
-				   g_param_spec_boxed ("icon_set",
-						       _("Icon set"),
-						       _("Icon set to use to draw the item's icon"),
-						       GTK_TYPE_ICON_SET,
-						       G_PARAM_READWRITE));
-  g_object_class_install_property (object_class,
 				   PROP_ICON_WIDGET,
 				   g_param_spec_object ("icon_widget",
 							_("Icon widget"),
@@ -192,7 +185,7 @@ gtk_tool_button_init (GtkToolButton     
 
   /* create button */
   button->button = g_object_new (klass->button_type, NULL);
-  gtk_button_set_focus_on_click (button->button, FALSE);
+  gtk_button_set_focus_on_click (GTK_BUTTON (button->button), FALSE);
   g_signal_connect_object (button->button, "clicked",
 			   G_CALLBACK (button_clicked), button, 0);
 
@@ -250,32 +243,6 @@ gtk_tool_button_size_allocate (GtkWidget
     }
 }
 
-static gchar *
-elide_underscores (const gchar *original)
-{
-  gchar *q, *result;
-  const gchar *p;
-  gboolean last_underscore;
-
-  q = result = g_malloc (strlen (original) + 1);
-  last_underscore = FALSE;
-  
-  for (p = original; *p; p++)
-    {
-      if (!last_underscore && *p == '_')
-	last_underscore = TRUE;
-      else
-	{
-	  last_underscore = FALSE;
-	  *q++ = *p;
-	}
-    }
-  
-  *q = '\0';
-  
-  return result;
-}
-
 static void
 gtk_tool_button_construct_contents (GtkToolItem *tool_item)
 {
@@ -345,7 +312,7 @@ gtk_tool_button_construct_contents (GtkT
 	    label_text = "";
 
 	  if (elide)
-	    label_text = elide_underscores (label_text);
+	    label_text = _gtk_toolbar_elide_underscores (label_text);
 	  else
 	    label_text = g_strdup (label_text);
 
@@ -360,12 +327,7 @@ gtk_tool_button_construct_contents (GtkT
   icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
   if (need_icon)
     {
-      if (button->icon_set)
-	{
-	  icon = gtk_image_new_from_icon_set (button->icon_set, icon_size);
-	  gtk_widget_show (icon);
-	}
-      else if (button->icon_widget)
+      if (button->icon_widget)
 	{
 	  icon = button->icon_widget;
 	  
@@ -456,9 +418,6 @@ gtk_tool_button_set_property (GObject   
     case PROP_STOCK_ID:
       gtk_tool_button_set_stock_id (button, g_value_get_string (value));
       break;
-    case PROP_ICON_SET:
-      gtk_tool_button_set_icon_set (button, g_value_get_boxed (value));
-      break;
     case PROP_ICON_WIDGET:
       gtk_tool_button_set_icon_widget (button, g_value_get_object (value));
       break;
@@ -489,9 +448,6 @@ gtk_tool_button_get_property (GObject   
     case PROP_STOCK_ID:
       g_value_set_string (value, button->stock_id);
       break;
-    case PROP_ICON_SET:
-      g_value_set_boxed (value, gtk_tool_button_get_icon_set (button));
-      break;
     case PROP_ICON_WIDGET:
       g_value_set_object (value, button->icon_widget);
       break;
@@ -536,11 +492,7 @@ gtk_tool_button_create_menu_proxy (GtkTo
   else
     menu_item = gtk_image_menu_item_new_with_label (label);
 
-  if (button->icon_set)
-    {
-      menu_image = gtk_image_new_from_icon_set (button->icon_set, GTK_ICON_SIZE_MENU);
-    }
-  else if (button->icon_widget && GTK_IS_IMAGE (button->icon_widget))
+  if (button->icon_widget && GTK_IS_IMAGE (button->icon_widget))
     {
       GtkImage *image = GTK_IMAGE (button->icon_widget);
       GtkImageType storage_type = gtk_image_get_storage_type (image);
@@ -605,12 +557,29 @@ gtk_tool_button_new_from_stock (const gc
 }
 
 GtkToolItem *
-gtk_tool_button_new (void)
+gtk_tool_button_new (const gchar *label,
+		     GdkPixbuf   *icon)
 {
   GtkToolButton *button;
-  
+
   button = g_object_new (GTK_TYPE_TOOL_BUTTON,
 			 NULL);
+  
+  if (label)
+    gtk_tool_button_set_label (button, label);
+
+  if (icon)
+    {
+      GtkWidget *image;
+
+      g_return_val_if_fail (GDK_IS_PIXBUF (icon), NULL);
+      
+      image = gtk_image_new_from_pixbuf (icon);
+
+      gtk_tool_button_set_icon_widget (button, image);
+
+      g_object_unref (G_OBJECT (image));
+    }
 
   return GTK_TOOL_ITEM (button);  
 }
@@ -703,8 +672,6 @@ gtk_tool_button_set_icon_widget (GtkTool
 
   if (icon != button->icon_widget)
     {
-      g_object_freeze_notify (G_OBJECT (button));
-      
       if (button->icon_widget)
 	g_object_unref (G_OBJECT (button->icon_widget));
 
@@ -715,19 +682,10 @@ gtk_tool_button_set_icon_widget (GtkTool
 	}
 
       button->icon_widget = icon;
-	
-      if (button->icon_widget && button->icon_set)
-	{
-	  gtk_icon_set_unref (button->icon_set);
-	  button->icon_set = NULL;
-	  
-	  g_object_notify (G_OBJECT (button), "icon_set");
-	}
 
       gtk_tool_button_construct_contents (GTK_TOOL_ITEM (button));
       
       g_object_notify (G_OBJECT (button), "icon_widget");
-      g_object_thaw_notify (G_OBJECT (button));
     }
 }
 
@@ -771,42 +729,4 @@ gtk_tool_button_get_icon_widget (GtkTool
   g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
 
   return button->icon_widget;
-}
-
-void
-gtk_tool_button_set_icon_set (GtkToolButton *button,
-			      GtkIconSet    *icon_set)
-{
-  g_return_if_fail (GTK_IS_TOOL_BUTTON (button));
-
-  if (icon_set != button->icon_set)
-    {
-      g_object_freeze_notify (G_OBJECT (button));
-
-      if (button->icon_set)
-	gtk_icon_set_unref (button->icon_set);
-
-      button->icon_set = icon_set;
-
-      if (button->icon_set && button->icon_widget)
-	{
-	  g_object_unref (button->icon_widget);
-	  button->icon_widget = NULL;
-
-	  g_object_notify (G_OBJECT (button->icon_widget), "icon_widget");
-	}
-
-      gtk_tool_button_construct_contents (GTK_TOOL_ITEM (button));
-      
-      g_object_notify (G_OBJECT (button), "icon_set");
-      g_object_thaw_notify (G_OBJECT (button));
-    }
-}
-
-GtkIconSet *
-gtk_tool_button_get_icon_set (GtkToolButton *button)
-{
-  g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), NULL);
-  
-  return button->icon_set;
 }
Index: gtk/gtktoolbutton.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbutton.h,v
retrieving revision 1.1
diff -u -p -u -r1.1 gtktoolbutton.h
--- gtk/gtktoolbutton.h	29 Jun 2003 23:34:20 -0000	1.1
+++ gtk/gtktoolbutton.h	1 Jul 2003 20:35:34 -0000
@@ -48,7 +48,6 @@ struct _GtkToolButton
   gchar *label_text;
   GtkWidget *label_widget;
   GtkWidget *icon_widget;
-  GtkIconSet *icon_set;
   
   guint use_underline : 1;
 };
@@ -64,7 +63,8 @@ struct _GtkToolButtonClass
 };
 
 GType        gtk_tool_button_get_type       (void);
-GtkToolItem *gtk_tool_button_new            (void);
+GtkToolItem *gtk_tool_button_new            (const gchar *label,
+					     GdkPixbuf   *icon);
 GtkToolItem *gtk_tool_button_new_from_stock (const gchar *stock_id);
 
 void                  gtk_tool_button_set_label       (GtkToolButton *button,
@@ -76,9 +76,6 @@ gboolean              gtk_tool_button_ge
 void		      gtk_tool_button_set_stock_id      (GtkToolButton *button,
 							 const gchar   *stock_id);
 G_CONST_RETURN gchar *gtk_tool_button_get_stock_id      (GtkToolButton *button);
-void		      gtk_tool_button_set_icon_set      (GtkToolButton *button,
-							 GtkIconSet    *icon_set);
-GtkIconSet *          gtk_tool_button_get_icon_set      (GtkToolButton *button);
 void                  gtk_tool_button_set_icon_widget (GtkToolButton *button,
 						       GtkWidget     *icon);
 GtkWidget *           gtk_tool_button_get_icon_widget (GtkToolButton *button);


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