assorted goo + X settings



Hi,

Owen posted the X settings spec to xdg-list a while back:
  https://listman.redhat.com/pipermail/xdg-list/2001-March/000063.html

Briefly, X settings are just small chunks of config data stored as X
properties. Some of these are shared between GTK and Qt, others are
GTK-specific. gtksettings.[hc] and some code in GDK contain the GTK
implementation of this.

The X properties are on an offscreen X window. There's a thing called
the X settings manager that owns that window. The ID of the window is
stored as a selection (clipboard) owned by the X settings manager.
The settings manager sets the X settings values.

The X settings spec isn't about persistent storage. It's about
advertising already-stored settings to all clients.  I just checked in
the gconf-xsettings-manager module. This is an X settings manager
(mostly written by Owen) which derives the values of the various
settings from the GConf database. i.e. it propagates a GConf setting
to xsettings.

So if you start up gconf-settings-manager, start up GTK with appended
patches I haven't committed yet, and then set the GConf key
/desktop/gtk/gtk-toolbar-icon-size for example, all your GTK 2 apps
will dynamically change toolbar icon size. Yay!

The control center in GNOME 2 just sets GConf keys and things will
magically work, propagating to all apps.

Is this an egregious unscalable hack? Yes. But no one has any better
ideas, so, here we are. Read Owen's proposed spec for details.

Appended patch is an evolution of previously-posted "assorted goo"
patch, adding the xsettings stuff. Toolbars are the testbed; I added a
concept of set/unset for toolbar style (icons, text) and toolbar icon
size, so if a program explicitly sets these values they are forced,
otherwise the user setting from GConf will be used. Updates are
dynamic, unlike the equivalent libgnomeui settings, you don't have to
restart apps.

Havoc

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1947
diff -u -u -r1.1947 ChangeLog
--- ChangeLog	2001/05/09 22:23:11	1.1947
+++ ChangeLog	2001/05/11 04:47:06
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp redhat com>
+
+	* gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+	we need to parse the xsetting as if it were an RC file string.
+
+	* gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+	value of palette from settings, not from static variable
+
+	* gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+	xsettings translation table
+
+	* gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+	hardcoding the toolbar style conflicts with new customizable 
+	toolbar style philosophy
+	(gtk_toolbar_class_init): add settings for default toolbar style;
+	these are used unless the app specifically forces a toolbar style
+
+	* gtk/gtksettings.c (settings_install_property_parser): only
+	return at the start if we warn and parser == NULL
+
+	* gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+	palette changed handler so we don't notify dead color selections
+
+	* gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+	xthickness/ythickness of 0 or 1 properly 
+	(gtk_default_draw_resize_grip): clear the background behind the
+	resize grips, and align to bottom right if we square the 
+	area to be drawn.
+
+	* gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+	statusbar label to 1, so it doesn't make toplevels resize oddly
+	(gtk_statusbar_size_request): add grip size to request
+	(gtk_statusbar_size_allocate): hack so the hbox still works with 
+	the grip size in the request
+
+	* gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+	bug where showing all on a toplevel makes the toolbar 
+	button text appear despite the toolbar mode
+
+	* gtk/gtkmenubar.c: add internal padding style property
+
+	* gtk/gtktoolbar.c: Add internal padding style property; add
+	shadow type style property
+
+	* gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+	state; and put Container::border_width outside the frame
+
+	* gtk/gtktextview.c: don't draw focus rectangle if we're in
+	interior focus mode, we just use blinking cursor
+
 Wed May  9 15:27:22 2001  Jonathan Blandford  <jrb redhat com>
 
 	* gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New
Index: demos/gtk-demo/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/demos/gtk-demo/Makefile.am,v
retrieving revision 1.12
diff -u -u -r1.12 Makefile.am
--- demos/gtk-demo/Makefile.am	2001/05/07 15:58:31	1.12
+++ demos/gtk-demo/Makefile.am	2001/05/11 04:47:06
@@ -5,6 +5,7 @@
 ## These should be in the order you want them to appear in the 
 ## demo app, which means alphabetized by demo title, not filename
 demos = @STRIP_BEGIN@	\
+	appwindow.c	\
 	button_box.c	\
 	colorsel.c	\
 	dialog.c	\
Index: demos/gtk-demo/appwindow.c
===================================================================
RCS file: appwindow.c
diff -N appwindow.c
--- /dev/null	Tue May  5 16:32:27 1998
+++ appwindow.c	Fri May 11 00:47:06 2001
@@ -0,0 +1,350 @@
+/* Application main window
+ *
+ * Demonstrates a typical application window, with menubar, toolbar, statusbar.
+ */
+
+#include <gtk/gtk.h>
+
+static GtkWidget *window = NULL;
+
+
+static void
+menuitem_cb (gpointer             callback_data,
+             guint                callback_action,
+             GtkWidget           *widget)
+{
+  GtkWidget *dialog;
+  
+  dialog = gtk_message_dialog_new (GTK_WINDOW (callback_data),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_INFO,
+                                   GTK_BUTTONS_CLOSE,
+                                   "You selected or toggled the menu item: \"%s\"",
+                                    gtk_item_factory_path_from_widget (widget));
+
+  /* Close dialog on user response */
+  g_signal_connectc (G_OBJECT (dialog),
+                     "response",
+                     G_CALLBACK (gtk_widget_destroy),
+                     NULL,
+                     FALSE);
+  
+  gtk_widget_show (dialog);
+}
+
+
+static GtkItemFactoryEntry menu_items[] =
+{
+  { "/_File",            NULL,         0,                     0, "<Branch>" },
+  { "/File/tearoff1",    NULL,         menuitem_cb,       0, "<Tearoff>" },
+  { "/File/_New",        "<control>N", menuitem_cb,       0, "<StockItem>", GTK_STOCK_NEW },
+  { "/File/_Open",       "<control>O", menuitem_cb,       0, "<StockItem>", GTK_STOCK_OPEN },
+  { "/File/_Save",       "<control>S", menuitem_cb,       0, "<StockItem>", GTK_STOCK_SAVE },
+  { "/File/Save _As...", NULL,         menuitem_cb,       0, "<StockItem>", GTK_STOCK_SAVE },
+  { "/File/sep1",        NULL,         menuitem_cb,       0, "<Separator>" },
+  { "/File/_Quit",       "<control>Q", menuitem_cb,       0, "<StockItem>", GTK_STOCK_QUIT },
+
+  { "/_Preferences",     		NULL, 0,               0, "<Branch>" },
+  { "/_Preferences/_Color", 		NULL, 0,               0, "<Branch>" },
+  { "/_Preferences/Color/_Red",      	NULL, menuitem_cb, 0, "<RadioItem>" },
+  { "/_Preferences/Color/_Green",   	NULL, menuitem_cb, 0, "/Preferences/Color/Red" },
+  { "/_Preferences/Color/_Blue",        NULL, menuitem_cb, 0, "/Preferences/Color/Red" },
+  { "/_Preferences/_Shape", 		NULL, 0,               0, "<Branch>" },
+  { "/_Preferences/Shape/_Square",      NULL, menuitem_cb, 0, "<RadioItem>" },
+  { "/_Preferences/Shape/_Rectangle",   NULL, menuitem_cb, 0, "/Preferences/Shape/Square" },
+  { "/_Preferences/Shape/_Oval",        NULL, menuitem_cb, 0, "/Preferences/Shape/Rectangle" },
+
+  { "/_Help",            NULL,         0,                     0, "<LastBranch>" },
+  { "/Help/_About",      NULL,         menuitem_cb,       0 },
+};
+
+static void
+toolbar_cb (GtkWidget *button,
+            gpointer   data)
+{
+  GtkWidget *dialog;
+  
+  dialog = gtk_message_dialog_new (GTK_WINDOW (data),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_INFO,
+                                   GTK_BUTTONS_CLOSE,
+                                   "You selected a toolbar button");
+
+  /* Close dialog on user response */
+  g_signal_connectc (G_OBJECT (dialog),
+                     "response",
+                     G_CALLBACK (gtk_widget_destroy),
+                     NULL,
+                     FALSE);
+  
+  gtk_widget_show (dialog);
+}
+
+/* This function registers our custom toolbar icons, so they can be themed.
+ */
+static void
+register_stock_icons (void)
+{
+  static gboolean registered = FALSE;
+  
+  if (!registered)
+    {
+      GdkPixbuf *pixbuf;
+      GtkIconFactory *factory;
+
+      static GtkStockItem items[] = {
+        { "demo-gtk-logo",
+          "_GTK!",
+          0, 0, NULL }
+      };
+      
+      registered = TRUE;
+
+      /* Register our stock items */
+      gtk_stock_add (items, G_N_ELEMENTS (items));
+      
+      /* Add our custom icon factory to the list of defaults */
+      factory = gtk_icon_factory_new ();
+      gtk_icon_factory_add_default (factory);
+
+      /* Try current directory */
+      pixbuf = gdk_pixbuf_new_from_file ("./gtk-logo-rgb.gif", NULL);
+
+      /* Try install directory */
+      if (pixbuf == NULL)
+        pixbuf = gdk_pixbuf_new_from_file (DEMOCODEDIR"/gtk-logo-rgb.gif", NULL);
+
+      /* Register icon to accompany stock item */
+      if (pixbuf != NULL)
+        {
+          GtkIconSet *icon_set;
+          GdkPixbuf *transparent;
+
+          /* The gtk-logo-rgb icon has a white background, make it transparent */
+          transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);          
+          
+          icon_set = gtk_icon_set_new_from_pixbuf (transparent);
+          gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
+          gtk_icon_set_unref (icon_set);
+          g_object_unref (G_OBJECT (pixbuf));
+          g_object_unref (G_OBJECT (transparent));
+        }
+      else
+        g_warning ("failed to load GTK logo for toolbar");
+      
+      /* Drop our reference to the factory, GTK will hold a reference. */
+      g_object_unref (G_OBJECT (factory));
+    }
+}
+
+static void
+update_statusbar (GtkTextBuffer *buffer,
+                  GtkStatusbar  *statusbar)
+{
+  gchar *msg;
+  gint row, col;
+  gint count;
+  GtkTextIter iter;
+  
+  gtk_statusbar_pop (statusbar, 0); /* clear any previous message, underflow is allowed */
+
+  count = gtk_text_buffer_get_char_count (buffer);
+
+  gtk_text_buffer_get_iter_at_mark (buffer,
+                                    &iter,
+                                    gtk_text_buffer_get_insert (buffer));
+
+  row = gtk_text_iter_get_line (&iter);
+  col = gtk_text_iter_get_line_offset (&iter);
+
+  msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
+                         row, col, count);
+
+  gtk_statusbar_push (statusbar, 0, msg);
+
+  g_free (msg);
+}
+
+static void
+mark_set_callback (GtkTextBuffer     *buffer,
+                   const GtkTextIter *new_location,
+                   GtkTextMark       *mark,
+                   gpointer           data)
+{
+  update_statusbar (buffer, GTK_STATUSBAR (data));
+}
+
+GtkWidget *
+do_appwindow (void)
+{  
+  if (!window)
+    {
+      GtkWidget *table;
+      GtkWidget *toolbar;
+      GtkWidget *statusbar;
+      GtkWidget *contents;
+      GtkWidget *sw;
+      GtkTextBuffer *buffer;
+      GtkAccelGroup *accel_group;      
+      GtkItemFactory *item_factory;
+
+      register_stock_icons ();
+      
+      /* Create the toplevel window
+       */
+      
+      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+      gtk_window_set_title (GTK_WINDOW (window), "Application Window");
+
+      /* NULL window variable when window is closed */
+      g_signal_connectc (G_OBJECT (window), "destroy",
+                         G_CALLBACK (gtk_widget_destroyed),
+                         &window, TRUE);
+
+      table = gtk_table_new (1, 4, FALSE);
+      
+      gtk_container_add (GTK_CONTAINER (window), table);
+      
+      /* Create the menubar
+       */
+      
+      accel_group = gtk_accel_group_new ();
+      gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
+      gtk_accel_group_unref (accel_group);
+      
+      item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
+
+      /* Set up item factory to go away with the window */
+      gtk_object_ref (GTK_OBJECT (item_factory));
+      gtk_object_sink (GTK_OBJECT (item_factory));
+      g_object_set_data_full (G_OBJECT (window),
+                              "<main>",
+                              item_factory,
+                              (GDestroyNotify) g_object_unref);
+
+      /* create menu items */
+      gtk_item_factory_create_items (item_factory, G_N_ELEMENTS (menu_items),
+                                     menu_items, window);
+
+      gtk_table_attach (GTK_TABLE (table),
+                        gtk_item_factory_get_widget (item_factory, "<main>"),
+                        0, 1,
+                        0, 1,
+                        GTK_EXPAND | GTK_FILL,
+                        0,
+                        0, 0);
+
+      /* Create the toolbar
+       */
+      toolbar = gtk_toolbar_new ();
+
+      gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+                                GTK_STOCK_OPEN,
+                                "This is a demo button with an 'open' icon",
+                                NULL,
+                                G_CALLBACK (toolbar_cb),
+                                window, /* user data for callback */
+                                -1);  /* -1 means "append" */
+
+      gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+                                GTK_STOCK_QUIT,
+                                "This is a demo button with a 'quit' icon",
+                                NULL,
+                                G_CALLBACK (toolbar_cb),
+                                window, /* user data for callback */
+                                -1);  /* -1 means "append" */
+
+      gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
+
+      gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+                                "demo-gtk-logo",
+                                "This is a demo button with a 'gtk' icon",
+                                NULL,
+                                G_CALLBACK (toolbar_cb),
+                                window, /* user data for callback */
+                                -1);  /* -1 means "append" */
+
+      gtk_table_attach (GTK_TABLE (table),
+                        toolbar,
+                        0, 1,
+                        1, 2,
+                        GTK_EXPAND | GTK_FILL,
+                        0,
+                        0, 0);
+
+      /* Create document
+       */
+
+      sw = gtk_scrolled_window_new (NULL, NULL);
+
+      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_AUTOMATIC);
+
+      gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
+                                           GTK_SHADOW_IN);
+      
+      gtk_table_attach (GTK_TABLE (table),
+                        sw,
+                        0, 1,
+                        2, 3,
+                        GTK_EXPAND | GTK_FILL,
+                        GTK_EXPAND | GTK_FILL,
+                        0, 0);
+
+      /* Set the scrolled window as geometry widget, so that
+       * when we set the default window size, the size will
+       * be the size of the scrolled window rather than the
+       * whole window.
+       */
+      gtk_window_set_geometry_hints (GTK_WINDOW (window),
+                                     sw, NULL, 0);
+
+      gtk_window_set_default_size (GTK_WINDOW (window),
+                                   200, 200);
+      
+      contents = gtk_text_view_new ();
+
+      gtk_container_add (GTK_CONTAINER (sw),
+                         contents);
+
+      /* Create statusbar */
+
+      statusbar = gtk_statusbar_new ();
+      gtk_table_attach (GTK_TABLE (table),
+                        statusbar,
+                        0, 1,
+                        3, 4,
+                        GTK_EXPAND | GTK_FILL,
+                        0,
+                        0, 0);
+
+      /* Show text widget info in the statusbar */
+      buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
+      
+      g_signal_connectc (G_OBJECT (buffer),
+                         "changed",
+                         G_CALLBACK (update_statusbar),
+                         statusbar, FALSE);
+
+      g_signal_connectc (G_OBJECT (buffer),
+                         "mark_set", /* cursor moved */
+                         G_CALLBACK (mark_set_callback),
+                         statusbar, FALSE);
+      
+      update_statusbar (buffer, GTK_STATUSBAR (statusbar));
+    }
+
+  if (!GTK_WIDGET_VISIBLE (window))
+    {
+      gtk_widget_show_all (window);
+    }
+  else
+    {    
+      gtk_widget_destroy (window);
+      window = NULL;
+    }
+
+  return window;
+}
+
Index: demos/gtk-demo/gtk-logo-rgb.gif
===================================================================
RCS file: /cvs/gnome/gtk+/demos/gtk-demo/gtk-logo-rgb.gif,v
retrieving revision 1.1
diff -u -u -r1.1 gtk-logo-rgb.gif
Binary files /tmp/cvs4AjEdc and gtk-logo-rgb.gif differ
Index: docs/Changes-2.0.txt
===================================================================
RCS file: /cvs/gnome/gtk+/docs/Changes-2.0.txt,v
retrieving revision 1.17
diff -u -u -r1.17 Changes-2.0.txt
--- docs/Changes-2.0.txt	2001/04/29 03:08:31	1.17
+++ docs/Changes-2.0.txt	2001/05/11 04:47:06
@@ -322,3 +322,27 @@
 
 * GdkColorContext is gone; you probably weren't using it anyway.
   Use GdkColormap and the gdk_rgb_* functions instead.
+
+* GtkMenuBar now draws the GtkContainer::border_width space outside
+  the frame, not inside the frame
+
+* In GTK 1.2, if an event handler returned TRUE it prevented
+  propagation of that event to parent widgets. That is, the 
+  event signal would not be emitted on parent widgets. In 
+  GTK 2.0, if an event handler returns TRUE, the current signal 
+  emission on the current widget is immediately stopped. That is,
+  other callbacks connected to the signal will not be invoked.
+
+* gtk_toolbar_new() no longer has arguments. This function 
+  was broken because the default GtkToolbarStyle (icons, text, both)
+  is now a user preference, which is overridden when you call
+  gtk_toolbar_set_style(). The constructor forced everyone to 
+  override the preference, which was undesirable. So to port
+  your app, decide if you want to force the toolbar style 
+  or conform to the user's global defaults; if you want to force
+  it, call gtk_toolbar_set_style().
+
+  The orientation arg was removed from toolbar_new() as well, just
+  because it wasn't very useful and we were breaking the function
+  anyway so had an opportunity to lose it. Call
+  gtk_toolbar_set_orientation() to set toolbar orientation.
Index: docs/reference/gdk-pixbuf/tmpl/animation.sgml
===================================================================
RCS file: /cvs/gnome/gtk+/docs/reference/gdk-pixbuf/tmpl/animation.sgml,v
retrieving revision 1.18
diff -u -u -r1.18 animation.sgml
--- docs/reference/gdk-pixbuf/tmpl/animation.sgml	2001/05/07 15:58:35	1.18
+++ docs/reference/gdk-pixbuf/tmpl/animation.sgml	2001/05/11 04:47:06
@@ -20,6 +20,31 @@
     #GdkPixbufLoader
   </para>
 
+<!-- ##### ENUM GdkPixbufFrameAction ##### -->
+<para>
+
+</para>
+
+ GDK_PIXBUF_FRAME_RETAIN: 
+ GDK_PIXBUF_FRAME_DISPOSE: 
+ GDK_PIXBUF_FRAME_REVERT: 
+
+<!-- ##### STRUCT GdkPixbufFrame ##### -->
+<para>
+
+</para>
+
+ pixbuf: 
+ x_offset: 
+ y_offset: 
+ delay_time: 
+ elapsed: 
+ action: 
+ need_recomposite: 
+ bg_transparent: 
+ composited: 
+ revert: 
+
 <!-- ##### STRUCT GdkPixbufAnimation ##### -->
   <para>
     This object describes an animation.
Index: docs/reference/gtk/tmpl/gtk-unused.sgml
===================================================================
RCS file: /cvs/gnome/gtk+/docs/reference/gtk/tmpl/gtk-unused.sgml,v
retrieving revision 1.38
diff -u -u -r1.38 gtk-unused.sgml
--- docs/reference/gtk/tmpl/gtk-unused.sgml	2001/05/07 15:58:38	1.38
+++ docs/reference/gtk/tmpl/gtk-unused.sgml	2001/05/11 04:47:07
@@ -1621,3 +1621,19 @@
 @window: 
 @Returns: 
 
+<!-- ##### FUNCTION gtk_window_set_decorations_hint ##### -->
+<para>
+
+</para>
+
+ window: 
+ decorations: 
+
+<!-- ##### FUNCTION gtk_window_set_functions_hint ##### -->
+<para>
+
+</para>
+
+ window: 
+ functions: 
+
Index: docs/reference/gtk/tmpl/gtktoolbar.sgml
===================================================================
RCS file: /cvs/gnome/gtk+/docs/reference/gtk/tmpl/gtktoolbar.sgml,v
retrieving revision 1.6
diff -u -u -r1.6 gtktoolbar.sgml
--- docs/reference/gtk/tmpl/gtktoolbar.sgml	2001/04/28 00:12:42	1.6
+++ docs/reference/gtk/tmpl/gtktoolbar.sgml	2001/05/11 04:47:07
@@ -78,9 +78,10 @@
 creates a new toolbar. 
 </para>
 
+ Returns: the newly created toolbar.
+<!-- # Unused Parameters # -->
 @orientation: a #GtkOrientation. It determines whether the toolbar appears horizontally or vertically.
 @style: a #GtkToolbarStyle. It determines if the toolbar will contain buttons with just labels, just images, or both.
- Returns: the newly created toolbar.
 
 
 <!-- ##### FUNCTION gtk_toolbar_append_item ##### -->
Index: docs/reference/gtk/tmpl/gtkwindow.sgml
===================================================================
RCS file: /cvs/gnome/gtk+/docs/reference/gtk/tmpl/gtkwindow.sgml,v
retrieving revision 1.15
diff -u -u -r1.15 gtkwindow.sgml
--- docs/reference/gtk/tmpl/gtkwindow.sgml	2001/05/07 15:58:39	1.15
+++ docs/reference/gtk/tmpl/gtkwindow.sgml	2001/05/11 04:47:07
@@ -393,15 +393,6 @@
 @setting: 
 
 
-<!-- ##### FUNCTION gtk_window_set_decorations_hint ##### -->
-<para>
-
-</para>
-
- window: 
- decorations: 
-
-
 <!-- ##### FUNCTION gtk_window_set_frame_dimensions ##### -->
 <para>
 
@@ -412,15 +403,6 @@
 @top: 
 @right: 
 @bottom: 
-
-
-<!-- ##### FUNCTION gtk_window_set_functions_hint ##### -->
-<para>
-
-</para>
-
- window: 
- functions: 
 
 
 <!-- ##### FUNCTION gtk_window_set_has_frame ##### -->
Index: gdk/x11/gdkevents-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkevents-x11.c,v
retrieving revision 1.49
diff -u -u -r1.49 gdkevents-x11.c
--- gdk/x11/gdkevents-x11.c	2001/05/02 21:31:52	1.49
+++ gdk/x11/gdkevents-x11.c	2001/05/11 04:47:07
@@ -1912,7 +1912,10 @@
   const char *gdk_name;
 } settings_map[] = {
   { "Net/DoubleClickTime", "gtk-double-click-timeout" },
-  { "Net/DragThreshold", "gtk-drag-threshold" }
+  { "Net/DragThreshold", "gtk-drag-threshold" },
+  { "Gtk/ColorPalette", "gtk-color-palette" },
+  { "Gtk/ToolbarStyle", "gtk-toolbar-style" },
+  { "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" }
 };
 
 static void
Index: gdk-pixbuf/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/ChangeLog,v
retrieving revision 1.288
diff -u -u -r1.288 ChangeLog
--- gdk-pixbuf/ChangeLog	2001/05/07 15:58:40	1.288
+++ gdk-pixbuf/ChangeLog	2001/05/11 04:47:07
@@ -1,3 +1,9 @@
+2001-05-08  Havoc Pennington  <hp redhat com>
+
+	* gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): docs fixup, 
+	and fix behavior to still subst color if the original image 
+	had alpha
+
 2001-05-04  Havoc Pennington  <hp redhat com>
 
 	* pixops/pixops.c (pixops_process): merge fix from stable: Patch
Index: gdk-pixbuf/gdk-pixbuf-util.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-util.c,v
retrieving revision 1.11
diff -u -u -r1.11 gdk-pixbuf-util.c
--- gdk-pixbuf/gdk-pixbuf-util.c	2001/05/07 15:58:41	1.11
+++ gdk-pixbuf/gdk-pixbuf-util.c	2001/05/11 04:47:07
@@ -30,18 +30,20 @@
 /**
  * gdk_pixbuf_add_alpha:
  * @pixbuf: A pixbuf.
- * @substitute_color: Whether to substitute a color for zero opacity.  If this
+ * @substitute_color: Whether to set a color to zero opacity.  If this
  * is #FALSE, then the (@r, @g, @b) arguments will be ignored.
  * @r: Red value to substitute.
  * @g: Green value to substitute.
  * @b: Blue value to substitute.
  *
- * Takes an existing pixbuf and adds an alpha channel to it.  If the original
- * pixbuf already had alpha information, then the contents of the new pixbuf are
- * exactly the same as the original's.  Otherwise, the new pixbuf will have all
- * pixels with full opacity if @substitute_color is #FALSE.  If
- * @substitute_color is #TRUE, then the color specified by (@r, @g, @b) will be
- * substituted for zero opacity.
+ * Takes an existing pixbuf and adds an alpha channel to it.
+ * If the existing pixbuf already had an alpha channel, the channel
+ * values are copied from the original; otherwise, the alpha channel
+ * is initialized to 255 (full opacity).
+ * 
+ * If @substitute_color is #TRUE, then the color specified by (@r, @g, @b) will be
+ * assigned zero opacity. That is, if you pass (255, 255, 255) for the
+ * substitute color, all white pixels will become fully transparent.
  *
  * Return value: A newly-created pixbuf with a reference count of 1.
  **/
@@ -62,10 +64,12 @@
 		if (!new_pixbuf)
 			return NULL;
 
-		return new_pixbuf;
-	}
-
-	new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
+                if (!substitute_color)
+                        return new_pixbuf;
+	} else {
+                new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
+        }
+        
 	if (!new_pixbuf)
 		return NULL;
 
@@ -75,16 +79,26 @@
 
 		src = pixbuf->pixels + y * pixbuf->rowstride;
 		dest = new_pixbuf->pixels + y * new_pixbuf->rowstride;
-
-		for (x = 0; x < pixbuf->width; x++) {
-			tr = *dest++ = *src++;
-			tg = *dest++ = *src++;
-			tb = *dest++ = *src++;
-
-			if (substitute_color && tr == r && tg == g && tb == b)
-				*dest++ = 0;
-			else
-				*dest++ = 255;
+                
+                if (pixbuf->has_alpha) {
+                        /* Just subst color, we already copied everything else */
+                        for (x = 0; x < pixbuf->width; x++) {
+                                if (src[0] == r && src[1] == g && src[2] == b)
+                                        dest[3] = 0;
+                                src += 4;
+                                dest += 4;
+                        }
+                } else {                        
+                        for (x = 0; x < pixbuf->width; x++) {
+                                tr = *dest++ = *src++;
+                                tg = *dest++ = *src++;
+                                tb = *dest++ = *src++;
+                                
+                                if (substitute_color && tr == r && tg == g && tb == b)
+                                        *dest++ = 0;
+                                else
+                                        *dest++ = 255;
+                        }
 		}
 	}
 
Index: gtk/gtkcolorsel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcolorsel.c,v
retrieving revision 1.67
diff -u -u -r1.67 gtkcolorsel.c
--- gtk/gtkcolorsel.c	2001/05/07 15:58:44	1.67
+++ gtk/gtkcolorsel.c	2001/05/11 04:47:07
@@ -126,6 +126,9 @@
 
   /* Window for grabbing on */
   GtkWidget *dropper_grab_widget;
+
+  /* Connection to settings */
+  guint settings_connection;
 };
 
 
@@ -1621,6 +1624,7 @@
 {
   GtkObjectClass *object_class;
   GObjectClass *gobject_class;
+  gchar *palette;
   
   object_class = GTK_OBJECT_CLASS (klass);
   gobject_class = G_OBJECT_CLASS (klass);
@@ -1644,8 +1648,14 @@
                                                       _("Palette to use in the color selector"),
                                                       default_colors,
                                                       G_PARAM_READWRITE));
+
+  g_object_get (G_OBJECT (gtk_settings_get_global ()),
+                "gtk-color-palette",
+                &palette,
+                NULL);
   
-  fill_palette_from_string (default_colors);
+  fill_palette_from_string (palette);
+  g_free (palette);
 
   change_palette_hook = default_change_palette_func;
   
@@ -1813,11 +1823,12 @@
   /* Set default colors */
 
   update_palette (colorsel);
-  
-  g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
-                         "notify::gtk-color-palette",
-                         G_CALLBACK (palette_change_notify_instance),
-                         colorsel, NULL, FALSE, FALSE);
+
+  priv->settings_connection = 
+    g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
+                           "notify::gtk-color-palette",
+                           G_CALLBACK (palette_change_notify_instance),
+                           colorsel, NULL, FALSE, FALSE);
   
   /* hide unused stuff */
   
@@ -1862,6 +1873,13 @@
   
   if (cselection->private_data)
     {
+      ColorSelectionPrivate *priv;
+
+      priv = cselection->private_data;
+
+      g_signal_handler_disconnect (gtk_settings_get_global (),
+                                   priv->settings_connection);
+      
       g_free (cselection->private_data);
       cselection->private_data = NULL;
     }
Index: gtk/gtkiconfactory.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkiconfactory.c,v
retrieving revision 1.11
diff -u -u -r1.11 gtkiconfactory.c
--- gtk/gtkiconfactory.c	2001/03/19 22:40:35	1.11
+++ gtk/gtkiconfactory.c	2001/05/11 04:47:07
@@ -297,7 +297,7 @@
 
       if (icon_set)
         return icon_set;
-
+      
       tmp_list = g_slist_next (tmp_list);
     }
 
Index: gtk/gtkmenubar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenubar.c,v
retrieving revision 1.24
diff -u -u -r1.24 gtkmenubar.c
--- gtk/gtkmenubar.c	2001/04/28 00:12:44	1.24
+++ gtk/gtkmenubar.c	2001/05/11 04:47:07
@@ -42,8 +42,8 @@
 
 #define BORDER_SPACING  0
 #define CHILD_SPACING   3
+#define DEFAULT_IPADDING 1
 
-
 static void gtk_menu_bar_class_init    (GtkMenuBarClass *klass);
 static void gtk_menu_bar_size_request  (GtkWidget       *widget,
 					GtkRequisition  *requisition);
@@ -141,6 +141,16 @@
                                                               GTK_TYPE_SHADOW_TYPE,
                                                               GTK_SHADOW_OUT,
                                                               G_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+					   g_param_spec_int ("internal_padding",
+							     _("Internal padding"),
+							     _("Amount of border space between the menubar shadow and the menu items"),
+							     0,
+							     G_MAXINT,
+                                                             DEFAULT_IPADDING,
+                                                             G_PARAM_READABLE));
+
 }
  
 GtkWidget*
@@ -182,6 +192,7 @@
   GList *children;
   gint nchildren;
   GtkRequisition child_requisition;
+  gint ipadding;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -189,7 +200,7 @@
 
   requisition->width = 0;
   requisition->height = 0;
-
+  
   if (GTK_WIDGET_VISIBLE (widget))
     {
       menu_bar = GTK_MENU_BAR (widget);
@@ -227,11 +238,15 @@
 	    }
 	}
 
+      gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+      
       requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
 			     widget->style->xthickness +
+                             ipadding + 
 			     BORDER_SPACING) * 2;
       requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
 			      widget->style->ythickness +
+                              ipadding +
 			      BORDER_SPACING) * 2;
 
       if (nchildren > 0)
@@ -250,6 +265,7 @@
   GtkAllocation child_allocation;
   GtkRequisition child_requisition;
   guint offset;
+  gint ipadding;
   
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -264,15 +280,19 @@
 			    allocation->x, allocation->y,
 			    allocation->width, allocation->height);
 
+  gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+  
   if (menu_shell->children)
     {
       child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
 			    widget->style->xthickness +
+                            ipadding + 
 			    BORDER_SPACING);
       offset = child_allocation.x; 	/* Window edge to menubar start */
 
       child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
 			    widget->style->ythickness +
+                            ipadding +
 			    BORDER_SPACING);
       child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
 
@@ -319,13 +339,18 @@
 
   if (GTK_WIDGET_DRAWABLE (widget))
     {
+      gint border;
+
+      border = GTK_CONTAINER (widget)->border_width;
+      
       gtk_paint_box (widget->style,
 		     widget->window,
-		     GTK_STATE_NORMAL,
+                     GTK_WIDGET_STATE (widget),
                      get_shadow_type (GTK_MENU_BAR (widget)),
 		     area, widget, "menubar",
-		     0, 0,
-		     -1,-1);
+		     border, border,
+		     widget->allocation.width - border,
+                     widget->allocation.height - border);
     }
 }
 
Index: gtk/gtksettings.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksettings.c,v
retrieving revision 1.9
diff -u -u -r1.9 gtksettings.c
--- gtk/gtksettings.c	2001/05/03 11:15:25	1.9
+++ gtk/gtksettings.c	2001/05/11 04:47:07
@@ -201,8 +201,57 @@
 {
   GtkSettings *settings = GTK_SETTINGS (object);
 
-  if (!gdk_setting_get (pspec->name, value))
-    g_value_copy (settings->property_values + property_id - 1, value);
+  if (G_VALUE_HOLDS_STRING (value) ||
+      G_VALUE_HOLDS_INT (value) ||
+      G_VALUE_HOLDS (value, GDK_TYPE_COLOR))
+    {
+      if (!gdk_setting_get (pspec->name, value))
+        {
+          g_value_copy (settings->property_values + property_id - 1, value);
+        }
+    }
+  else
+    {
+      GValue val = { 0, };
+
+      /* Try to get xsetting as a string and parse it. */
+      
+      g_value_init (&val, G_TYPE_STRING);
+
+      if (!gdk_setting_get (pspec->name, &val))
+        {
+          g_value_copy (settings->property_values + property_id - 1, value);
+        }
+      else
+        {
+          GValue tmp_value = { 0, };
+          GValue gstring_value = { 0, };
+          GtkRcPropertyParser parser = g_param_spec_get_qdata (pspec,
+                                                               quark_property_parser);
+
+          g_value_init (&gstring_value, G_TYPE_GSTRING);
+
+          g_value_set_boxed (&gstring_value,
+                             g_string_new (g_value_get_string (&val)));
+
+          g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+
+          if (parser && _gtk_settings_parse_convert (parser, &gstring_value,
+                                                     pspec, &tmp_value))
+            {
+              g_value_copy (&tmp_value, value);
+            }
+          else
+            {
+              g_value_copy (settings->property_values + property_id - 1, value);
+            }
+
+          g_value_unset (&gstring_value);
+          g_value_unset (&tmp_value);
+        }
+
+      g_value_unset (&val);
+    }
 }
 
 static void
@@ -339,9 +388,11 @@
       break;
     default:
       if (!parser)
-	g_warning (G_STRLOC ": parser needs to be specified for property \"%s\" of type `%s'",
-		   pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
-      return 0;
+        {
+          g_warning (G_STRLOC ": parser needs to be specified for property \"%s\" of type `%s'",
+                     pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
+          return 0;
+        }
     }
   if (g_object_class_find_property (G_OBJECT_CLASS (class), pspec->name))
     {
@@ -597,7 +648,7 @@
   if (scanner->token == G_TOKEN_IDENTIFIER)
     {
       GEnumClass *class = G_PARAM_SPEC_ENUM (pspec)->enum_class;
-
+      
       enum_value = g_enum_get_value_by_name (class, scanner->value.v_identifier);
       if (!enum_value)
 	enum_value = g_enum_get_value_by_nick (class, scanner->value.v_identifier);
@@ -800,7 +851,7 @@
 _gtk_settings_handle_event (GdkEventSetting *event)
 {
   GtkSettings *settings = gtk_settings_get_global ();
-
+  
   if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name))
     g_object_notify (G_OBJECT (settings), event->name);
 }
Index: gtk/gtkstatusbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstatusbar.c,v
retrieving revision 1.27
diff -u -u -r1.27 gtkstatusbar.c
--- gtk/gtkstatusbar.c	2001/03/29 21:17:44	1.27
+++ gtk/gtkstatusbar.c	2001/05/11 04:47:07
@@ -30,6 +30,7 @@
 #include "gtksignal.h"
 #include "gtkstatusbar.h"
 #include "gtkwindow.h"
+#include "gtkintl.h"
 
 typedef struct _GtkStatusbarMsg GtkStatusbarMsg;
 
@@ -63,6 +64,10 @@
 					      GdkEventButton    *event);
 static gboolean gtk_statusbar_expose_event   (GtkWidget         *widget,
 					      GdkEventExpose    *event);
+static void     gtk_statusbar_size_request   (GtkWidget         *widget,
+                                              GtkRequisition    *requisition);
+static void     gtk_statusbar_size_allocate  (GtkWidget         *widget,
+                                              GtkAllocation     *allocation);
 static void     gtk_statusbar_create_window  (GtkStatusbar      *statusbar);
 static void     gtk_statusbar_destroy_window (GtkStatusbar      *statusbar);
 
@@ -109,8 +114,6 @@
   
   object_class->destroy = gtk_statusbar_destroy;
 
-  widget_class->size_allocate = gtk_statusbar_size_allocate;
-  
   widget_class->realize = gtk_statusbar_realize;
   widget_class->unrealize = gtk_statusbar_unrealize;
   widget_class->map = gtk_statusbar_map;
@@ -118,6 +121,9 @@
   
   widget_class->button_press_event = gtk_statusbar_button_press;
   widget_class->expose_event = gtk_statusbar_expose_event;
+
+  widget_class->size_request = gtk_statusbar_size_request;
+  widget_class->size_allocate = gtk_statusbar_size_allocate;
   
   class->messages_mem_chunk = g_mem_chunk_new ("GtkStatusBar messages mem chunk",
 					       sizeof (GtkStatusbarMsg),
@@ -145,27 +151,42 @@
 		    GTK_TYPE_NONE, 2,
 		    GTK_TYPE_UINT,
 		    GTK_TYPE_STRING);
+
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_enum ("shadow_type",
+                                                              _("Shadow type"),
+                                                              _("Style of bevel around the statusbar text"),
+                                                              GTK_TYPE_SHADOW_TYPE,
+                                                              GTK_SHADOW_IN,
+                                                              G_PARAM_READABLE));
 }
 
 static void
 gtk_statusbar_init (GtkStatusbar *statusbar)
 {
   GtkBox *box;
-
+  GtkShadowType shadow_type;
+  
   box = GTK_BOX (statusbar);
 
   box->spacing = 2;
   box->homogeneous = FALSE;
 
   statusbar->has_resize_grip = TRUE;
+
+  gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow_type", &shadow_type, NULL);
   
   statusbar->frame = gtk_frame_new (NULL);
-  gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), GTK_SHADOW_IN);
+  gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type);
   gtk_box_pack_start (box, statusbar->frame, TRUE, TRUE, 0);
   gtk_widget_show (statusbar->frame);
 
   statusbar->label = gtk_label_new ("");
   gtk_misc_set_alignment (GTK_MISC (statusbar->label), 0.0, 0.0);
+  /* don't expand the size request for the label; if we
+   * do that then toplevels weirdly resize
+   */
+  gtk_widget_set_usize (statusbar->label, 1, -1);
   gtk_container_add (GTK_CONTAINER (statusbar->frame), statusbar->label);
   gtk_widget_show (statusbar->label);
 
@@ -426,25 +447,6 @@
 }
 
 static void
-gtk_statusbar_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
-{
-  GtkStatusbar *statusbar;
-  GdkRectangle rect;
-  
-  statusbar = GTK_STATUSBAR (widget);
-  
-  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
-
-  get_grip_rect (statusbar, &rect);
-  
-  if (statusbar->grip_window)
-    gdk_window_move_resize (statusbar->grip_window,
-                            rect.x, rect.y,
-                            rect.width, rect.height);
-}
-
-static void
 gtk_statusbar_create_window (GtkStatusbar *statusbar)
 {
   GtkWidget *widget;
@@ -583,7 +585,7 @@
   if (statusbar->has_resize_grip)
     {
       get_grip_rect (statusbar, &rect);
-      
+
       gtk_paint_resize_grip (widget->style,
                              widget->window,
                              GTK_WIDGET_STATE (widget),
@@ -600,4 +602,69 @@
     }
 
   return FALSE;
+}
+
+static void
+gtk_statusbar_size_request   (GtkWidget      *widget,
+                              GtkRequisition *requisition)
+{
+  GtkStatusbar *statusbar;
+  GtkShadowType shadow_type;
+  
+  statusbar = GTK_STATUSBAR (widget);
+
+  gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow_type", &shadow_type, NULL);  
+  gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type);
+  
+  GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+
+  if (statusbar->has_resize_grip)
+    {
+      GdkRectangle rect;
+
+      /* x, y in the grip rect depend on size allocation, but
+       * w, h do not so this is OK
+       */
+      get_grip_rect (statusbar, &rect);
+      
+      requisition->width += rect.width;
+      requisition->height = MAX (requisition->height, rect.height);
+    }
+}
+
+static void
+gtk_statusbar_size_allocate  (GtkWidget     *widget,
+                              GtkAllocation *allocation)
+{
+  GtkStatusbar *statusbar;
+  
+  statusbar = GTK_STATUSBAR (widget);
+
+  if (statusbar->has_resize_grip)
+    {
+      GdkRectangle rect;
+      GtkAllocation hbox_allocation;
+      GtkRequisition saved_req;
+      
+      widget->allocation = *allocation; /* get_grip_rect needs this info */
+      get_grip_rect (statusbar, &rect);
+  
+      if (statusbar->grip_window)
+        gdk_window_move_resize (statusbar->grip_window,
+                                rect.x, rect.y,
+                                rect.width, rect.height);
+      
+      /* enter the bad hack zone */      
+      saved_req = widget->requisition;
+      widget->requisition.width -= rect.width; /* HBox::size_allocate needs this */
+      if (widget->requisition.width < 0)
+        widget->requisition.width = 0;
+      GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+      widget->requisition = saved_req;
+    }
+  else
+    {
+      /* chain up normally */
+      GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+    }
 }
Index: gtk/gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.64
diff -u -u -r1.64 gtkstyle.c
--- gtk/gtkstyle.c	2001/05/01 01:36:33	1.64
+++ gtk/gtkstyle.c	2001/05/11 04:47:07
@@ -2116,103 +2116,188 @@
       break;
       
     case GTK_SHADOW_IN:
-      gdk_draw_line (window, gc1,
-                     x, y + height - 1, x + width - 1, y + height - 1);
-      gdk_draw_line (window, gc1,
-                     x + width - 1, y, x + width - 1, y + height - 1);
-      
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + 1, y + height - 2, x + width - 2, y + height - 2);
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + width - 2, y + 1, x + width - 2, y + height - 2);
-      
-      gdk_draw_line (window, style->black_gc,
-                     x + 1, y + 1, x + width - 2, y + 1);
-      gdk_draw_line (window, style->black_gc,
-                     x + 1, y + 1, x + 1, y + height - 2);
-      
-      gdk_draw_line (window, gc2,
-                     x, y, x + width - 1, y);
-      gdk_draw_line (window, gc2,
-                     x, y, x, y + height - 1);
+      /* Light around right and bottom edge */
+
+      if (style->ythickness > 0)
+        gdk_draw_line (window, gc1,
+                       x, y + height - 1, x + width - 1, y + height - 1);
+      if (style->xthickness > 0)
+        gdk_draw_line (window, gc1,
+                       x + width - 1, y, x + width - 1, y + height - 1);
+
+      if (style->ythickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + 1, y + height - 2, x + width - 2, y + height - 2);
+      if (style->xthickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + width - 2, y + 1, x + width - 2, y + height - 2);
+
+      /* Dark around left and top */
+
+      if (style->ythickness > 1)
+        gdk_draw_line (window, style->black_gc,
+                       x + 1, y + 1, x + width - 2, y + 1);
+      if (style->xthickness > 1)
+        gdk_draw_line (window, style->black_gc,
+                       x + 1, y + 1, x + 1, y + height - 2);
+
+      if (style->ythickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x + width - 1, y);
+      if (style->xthickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x, y + height - 1);
       break;
       
     case GTK_SHADOW_OUT:
-      gdk_draw_line (window, gc1,
-                     x + 1, y + height - 2, x + width - 2, y + height - 2);
-      gdk_draw_line (window, gc1,
-                     x + width - 2, y + 1, x + width - 2, y + height - 2);
-      
-      gdk_draw_line (window, gc2,
-                     x, y, x + width - 1, y);
-      gdk_draw_line (window, gc2,
-                     x, y, x, y + height - 1);
-      
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + 1, y + 1, x + width - 2, y + 1);
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + 1, y + 1, x + 1, y + height - 2);
-      
-      gdk_draw_line (window, style->black_gc,
-                     x, y + height - 1, x + width - 1, y + height - 1);
-      gdk_draw_line (window, style->black_gc,
-                     x + width - 1, y, x + width - 1, y + height - 1);
+      /* Dark around right and bottom edge */
+
+      if (style->ythickness > 0)
+        {
+          if (style->ythickness > 1)
+            {
+              gdk_draw_line (window, gc1,
+                             x + 1, y + height - 2, x + width - 2, y + height - 2);
+              gdk_draw_line (window, style->black_gc,
+                             x, y + height - 1, x + width - 1, y + height - 1);
+            }
+          else
+            {
+              gdk_draw_line (window, gc1,
+                             x + 1, y + height - 1, x + width - 1, y + height - 1);
+            }
+        }
+
+      if (style->xthickness > 0)
+        {
+          if (style->xthickness > 1)
+            {
+              gdk_draw_line (window, gc1,
+                             x + width - 2, y + 1, x + width - 2, y + height - 2);
+              
+              gdk_draw_line (window, style->black_gc,
+                             x + width - 1, y, x + width - 1, y + height - 1);
+            }
+          else
+            {
+              gdk_draw_line (window, gc1,
+                             x + width - 1, y + 1, x + width - 1, y + height - 1);
+            }
+        }
+      
+      /* Light around top and left */
+
+      if (style->ythickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x + width - 1, y);
+      if (style->xthickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x, y + height - 1);
+
+      if (style->ythickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + 1, y + 1, x + width - 2, y + 1);
+      if (style->xthickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + 1, y + 1, x + 1, y + height - 2);
       break;
       
     case GTK_SHADOW_ETCHED_IN:
     case GTK_SHADOW_ETCHED_OUT:
-      thickness_light = 1;
-      thickness_dark = 1;
+      if (style->xthickness > 0)
+        {
+          if (style->xthickness > 1)
+            {
+              thickness_light = 1;
+              thickness_dark = 1;
+      
+              for (i = 0; i < thickness_dark; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + width - i - 1,
+                                 y + i,
+                                 x + width - i - 1,
+                                 y + height - i - 1);
+                  gdk_draw_line (window, gc2,
+                                 x + i,
+                                 y + i,
+                                 x + i,
+                                 y + height - i - 2);
+                }
       
-      for (i = 0; i < thickness_dark; i++)
+              for (i = 0; i < thickness_light; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + thickness_dark + i,
+                                 y + thickness_dark + i,
+                                 x + thickness_dark + i,
+                                 y + height - thickness_dark - i - 1);
+                  gdk_draw_line (window, gc2,
+                                 x + width - thickness_light - i - 1,
+                                 y + thickness_dark + i,
+                                 x + width - thickness_light - i - 1,
+                                 y + height - thickness_light - 1);
+                }
+            }
+          else
+            {
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x, y, x, y + height);                         
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x + width, y, x + width, y + height);
+            }
+        }
+
+      if (style->ythickness > 0)
         {
-          gdk_draw_line (window, gc1,
-                         x + i,
-                         y + height - i - 1,
-                         x + width - i - 1,
-                         y + height - i - 1);
-          gdk_draw_line (window, gc1,
-                         x + width - i - 1,
-                         y + i,
-                         x + width - i - 1,
-                         y + height - i - 1);
+          if (style->ythickness > 1)
+            {
+              thickness_light = 1;
+              thickness_dark = 1;
+      
+              for (i = 0; i < thickness_dark; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + i,
+                                 y + height - i - 1,
+                                 x + width - i - 1,
+                                 y + height - i - 1);
           
-          gdk_draw_line (window, gc2,
-                         x + i,
-                         y + i,
-                         x + width - i - 2,
-                         y + i);
-          gdk_draw_line (window, gc2,
-                         x + i,
-                         y + i,
-                         x + i,
-                         y + height - i - 2);
-        }
+                  gdk_draw_line (window, gc2,
+                                 x + i,
+                                 y + i,
+                                 x + width - i - 2,
+                                 y + i);
+                }
       
-      for (i = 0; i < thickness_light; i++)
-        {
-          gdk_draw_line (window, gc1,
-                         x + thickness_dark + i,
-                         y + thickness_dark + i,
-                         x + width - thickness_dark - i - 1,
-                         y + thickness_dark + i);
-          gdk_draw_line (window, gc1,
-                         x + thickness_dark + i,
-                         y + thickness_dark + i,
-                         x + thickness_dark + i,
-                         y + height - thickness_dark - i - 1);
+              for (i = 0; i < thickness_light; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + thickness_dark + i,
+                                 y + thickness_dark + i,
+                                 x + width - thickness_dark - i - 1,
+                                 y + thickness_dark + i);
           
-          gdk_draw_line (window, gc2,
-                         x + thickness_dark + i,
-                         y + height - thickness_light - i - 1,
-                         x + width - thickness_light - 1,
-                         y + height - thickness_light - i - 1);
-          gdk_draw_line (window, gc2,
-                         x + width - thickness_light - i - 1,
-                         y + thickness_dark + i,
-                         x + width - thickness_light - i - 1,
-                         y + height - thickness_light - 1);
+                  gdk_draw_line (window, gc2,
+                                 x + thickness_dark + i,
+                                 y + height - thickness_light - i - 1,
+                                 x + width - thickness_light - 1,
+                                 y + height - thickness_light - i - 1);
+                }
+            }
+          else
+            {
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x, y, x + width, y);
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x, y + height, x + width, y + height);
+            }
         }
+      
       break;
     }
   if (area)
@@ -4152,11 +4237,26 @@
     {
       gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
       gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
+      gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
+    }
+
+  /* make it square, aligning to bottom right */
+  if (width < height)
+    {
+      y += (height - width);
+      height = width;
+    }
+  else if (height < width)
+    {
+      x += (width - height);
+      width = height;
     }
 
-  /* make it square */
-  if (width != height)
-    width = height = MIN (width, height);
+  /* Clear background */
+  gdk_draw_rectangle (window,
+                      style->bg_gc[state_type],
+                      TRUE,
+                      x, y, width, height);
   
   switch (edge)
     {
@@ -4204,6 +4304,7 @@
     {
       gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
       gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
+      gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
     }
 }
 
Index: gtk/gtktextview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
retrieving revision 1.83
diff -u -u -r1.83 gtktextview.c
--- gtk/gtktextview.c	2001/05/07 15:58:46	1.83
+++ gtk/gtktextview.c	2001/05/11 04:47:07
@@ -75,8 +75,6 @@
  *
  */
 
-#define FOCUS_EDGE_WIDTH 1
-
 #define SCREEN_WIDTH(widget) text_window_get_width (GTK_TEXT_VIEW (widget)->text_window)
 #define SCREEN_HEIGHT(widget) text_window_get_height (GTK_TEXT_VIEW (widget)->text_window)
 
@@ -2146,11 +2144,20 @@
 {
   GtkTextView *text_view;
   GSList *tmp_list;
-
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
   text_view = GTK_TEXT_VIEW (widget);
 
-  requisition->width = text_view->text_window->requisition.width + FOCUS_EDGE_WIDTH * 2;
-  requisition->height = text_view->text_window->requisition.height + FOCUS_EDGE_WIDTH * 2;
+  gtk_widget_style_get (widget, "interior_focus", &interior_focus, NULL);
+
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
+  requisition->width = text_view->text_window->requisition.width + focus_edge_width * 2;
+  requisition->height = text_view->text_window->requisition.height + focus_edge_width * 2;
 
   if (text_view->left_window)
     requisition->width += text_view->left_window->requisition.width;
@@ -2296,7 +2303,9 @@
   GdkRectangle right_rect;
   GdkRectangle top_rect;
   GdkRectangle bottom_rect;
-
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
   text_view = GTK_TEXT_VIEW (widget);
 
   DV(g_print(G_STRLOC"\n"));
@@ -2313,8 +2322,15 @@
   /* distribute width/height among child windows. Ensure all
    * windows get at least a 1x1 allocation.
    */
+
+  gtk_widget_style_get (widget, "interior_focus", &interior_focus, NULL);
 
-  width = allocation->width - FOCUS_EDGE_WIDTH * 2;
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
+  width = allocation->width - focus_edge_width * 2;
 
   if (text_view->left_window)
     left_rect.width = text_view->left_window->requisition.width;
@@ -2336,7 +2352,7 @@
   bottom_rect.width = text_rect.width;
 
 
-  height = allocation->height - FOCUS_EDGE_WIDTH * 2;
+  height = allocation->height - focus_edge_width * 2;
 
   if (text_view->top_window)
     top_rect.height = text_view->top_window->requisition.height;
@@ -2358,8 +2374,8 @@
   right_rect.height = text_rect.height;
 
   /* Origins */
-  left_rect.x = FOCUS_EDGE_WIDTH;
-  top_rect.y = FOCUS_EDGE_WIDTH;
+  left_rect.x = focus_edge_width;
+  top_rect.y = focus_edge_width;
 
   text_rect.x = left_rect.x + left_rect.width;
   text_rect.y = top_rect.y + top_rect.height;
@@ -3328,10 +3344,15 @@
 static void
 gtk_text_view_draw_focus (GtkWidget *widget)
 {
+  gboolean interior_focus;
+
+  /* We clear the focus if we are in interior focus mode. */
+  gtk_widget_style_get (widget, "interior_focus", &interior_focus, NULL);
+  
   if (GTK_WIDGET_DRAWABLE (widget))
     {
-      if (GTK_WIDGET_HAS_FOCUS (widget))
-        {
+      if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus)
+        {          
           gtk_paint_focus (widget->style, widget->window,
                            NULL, widget, "textview",
                            0, 0,
@@ -5394,16 +5415,26 @@
                   gint             *window_x,
                   gint             *window_y)
 {
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
+  gtk_widget_style_get (GTK_WIDGET (text_view), "interior_focus", &interior_focus, NULL);
+
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
   if (window_x)
     {
-      *window_x = buffer_x - text_view->xoffset + FOCUS_EDGE_WIDTH;
+      *window_x = buffer_x - text_view->xoffset + focus_edge_width;
       if (text_view->left_window)
         *window_x += text_view->left_window->allocation.width;
     }
 
   if (window_y)
     {
-      *window_y = buffer_y - text_view->yoffset + FOCUS_EDGE_WIDTH;
+      *window_y = buffer_y - text_view->yoffset + focus_edge_width;
       if (text_view->top_window)
         *window_y += text_view->top_window->allocation.height;
     }
@@ -5531,16 +5562,26 @@
                   gint        *buffer_x,
                   gint        *buffer_y)
 {
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
+  gtk_widget_style_get (GTK_WIDGET (text_view), "interior_focus", &interior_focus, NULL);
+
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
   if (buffer_x)
     {
-      *buffer_x = widget_x - FOCUS_EDGE_WIDTH + text_view->xoffset;
+      *buffer_x = widget_x - focus_edge_width + text_view->xoffset;
       if (text_view->left_window)
         *buffer_x -= text_view->left_window->allocation.width;
     }
 
   if (buffer_y)
     {
-      *buffer_y = widget_y - FOCUS_EDGE_WIDTH + text_view->yoffset;
+      *buffer_y = widget_y - focus_edge_width + text_view->yoffset;
       if (text_view->top_window)
         *buffer_y -= text_view->top_window->allocation.height;
     }
Index: gtk/gtktoolbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.c,v
retrieving revision 1.52
diff -u -u -r1.52 gtktoolbar.c
--- gtk/gtktoolbar.c	2001/04/28 00:12:44	1.52
+++ gtk/gtktoolbar.c	2001/05/11 04:47:07
@@ -35,11 +35,13 @@
 #include "gtkstock.h"
 #include "gtkiconfactory.h"
 #include "gtkimage.h"
+#include "gtksettings.h"
 #include "gtkintl.h"
 
 
+#define DEFAULT_IPADDING 0
 #define DEFAULT_SPACE_SIZE  5
-#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_EMPTY
+#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
 
 #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
 
@@ -78,6 +80,7 @@
 static void gtk_toolbar_get_arg                  (GtkObject       *object,
 						  GtkArg          *arg,
 						  guint            arg_id);
+static void gtk_toolbar_finalize                 (GObject         *object);
 static void gtk_toolbar_destroy                  (GtkObject       *object);
 static void gtk_toolbar_map                      (GtkWidget       *widget);
 static void gtk_toolbar_unmap                    (GtkWidget       *widget);
@@ -89,6 +92,7 @@
 				                  GtkAllocation   *allocation);
 static void gtk_toolbar_style_set                (GtkWidget       *widget,
                                                   GtkStyle        *prev_style);
+static void gtk_toolbar_show_all                 (GtkWidget       *widget);
 static void gtk_toolbar_add                      (GtkContainer    *container,
 				                  GtkWidget       *widget);
 static void gtk_toolbar_remove                   (GtkContainer    *container,
@@ -164,15 +168,19 @@
 static void
 gtk_toolbar_class_init (GtkToolbarClass *class)
 {
+  GObjectClass *gobject_class;
   GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;
   GtkContainerClass *container_class;
 
+  gobject_class = G_OBJECT_CLASS (class);
   object_class = (GtkObjectClass *) class;
   widget_class = (GtkWidgetClass *) class;
   container_class = (GtkContainerClass *) class;
 
   parent_class = gtk_type_class (gtk_container_get_type ());
+
+  gobject_class->finalize = gtk_toolbar_finalize;
   
   object_class->destroy = gtk_toolbar_destroy;
   object_class->set_arg = gtk_toolbar_set_arg;
@@ -184,6 +192,7 @@
   widget_class->size_request = gtk_toolbar_size_request;
   widget_class->size_allocate = gtk_toolbar_size_allocate;
   widget_class->style_set = gtk_toolbar_style_set;
+  widget_class->show_all = gtk_toolbar_show_all;
   
   container_class->add = gtk_toolbar_add;
   container_class->remove = gtk_toolbar_remove;
@@ -223,6 +232,16 @@
 							     G_MAXINT,
                                                              DEFAULT_SPACE_SIZE,
 							     G_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+					   g_param_spec_int ("internal_padding",
+							     _("Internal padding"),
+							     _("Amount of border space between the toolbar shadow and the buttons"),
+							     0,
+							     G_MAXINT,
+                                                             DEFAULT_IPADDING,
+                                                             G_PARAM_READABLE));
+  
   gtk_widget_class_install_style_property (widget_class,
 					   g_param_spec_enum ("space_style",
 							     _("Space style"),
@@ -237,8 +256,66 @@
 							     _("Button relief"),
 							     _("Type of bevel around toolbar buttons"),
                                                               GTK_TYPE_RELIEF_STYLE,
-                                                              GTK_RELIEF_NORMAL,
+                                                              GTK_RELIEF_NONE,
                                                               G_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_enum ("shadow_type",
+                                                              _("Shadow type"),
+                                                              _("Style of bevel around the toolbar"),
+                                                              GTK_TYPE_SHADOW_TYPE,
+                                                              GTK_SHADOW_OUT,
+                                                              G_PARAM_READABLE));
+
+  gtk_settings_install_property (gtk_settings_get_global (),
+                                 g_param_spec_enum ("gtk-toolbar-style",
+                                                    _("Toolbar style"),
+                                                    _("Whether default toolbars have text only, text and icons, icons only, etc."),
+                                                    GTK_TYPE_TOOLBAR_STYLE,
+                                                    GTK_TOOLBAR_BOTH,
+                                                    G_PARAM_READWRITE));
+
+  gtk_settings_install_property (gtk_settings_get_global (),
+                                 g_param_spec_enum ("gtk-toolbar-icon-size",
+                                                    _("Toolbar icon size"),
+                                                    _("Size of icons in default toolbars"),
+                                                    GTK_TYPE_ICON_SIZE,
+                                                    GTK_ICON_SIZE_LARGE_TOOLBAR,
+                                                    G_PARAM_READWRITE));  
+}
+
+static void
+style_change_notify (GObject    *object,
+                     GParamSpec *pspec,
+                     gpointer    data)
+{
+  GtkToolbar *toolbar;
+
+  toolbar = GTK_TOOLBAR (data);
+
+  if (!toolbar->style_set)
+    {
+      /* pretend it was set, then unset, thus reverting to new default */
+      toolbar->style_set = TRUE; 
+      gtk_toolbar_unset_style (toolbar);
+    }
+}
+
+static void
+icon_size_change_notify (GObject    *object,
+                         GParamSpec *pspec,
+                         gpointer    data)
+{
+  GtkToolbar *toolbar;
+
+  toolbar = GTK_TOOLBAR (data);
+
+  if (!toolbar->icon_size_set)
+    {
+      /* pretend it was set, then unset, thus reverting to new default */
+      toolbar->icon_size_set = TRUE; 
+      gtk_toolbar_unset_icon_size (toolbar);
+    }
 }
 
 static void
@@ -250,11 +327,46 @@
   toolbar->num_children = 0;
   toolbar->children     = NULL;
   toolbar->orientation  = GTK_ORIENTATION_HORIZONTAL;
-  toolbar->style        = GTK_TOOLBAR_ICONS;
   toolbar->icon_size    = DEFAULT_ICON_SIZE;
   toolbar->tooltips     = gtk_tooltips_new ();
   toolbar->button_maxw  = 0;
   toolbar->button_maxh  = 0;
+
+  toolbar->style_set = FALSE;
+  toolbar->icon_size_set = FALSE;
+  g_object_get (gtk_settings_get_global (),
+                "gtk-toolbar-icon-size",
+                &toolbar->icon_size,
+                "gtk-toolbar-style",
+                &toolbar->style,
+                NULL);
+  
+  toolbar->style_set_connection =
+    g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
+                           "notify::gtk-toolbar-style",
+                           G_CALLBACK (style_change_notify),
+                           toolbar, NULL, FALSE, FALSE);
+
+  toolbar->icon_size_connection =
+    g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
+                           "notify::gtk-toolbar-icon-size",
+                           G_CALLBACK (icon_size_change_notify),
+                           toolbar, NULL, FALSE, FALSE);  
+}
+
+static void
+gtk_toolbar_finalize (GObject *object)
+{
+  GtkToolbar *toolbar;
+
+  toolbar = GTK_TOOLBAR (object);
+
+  g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_global ()),
+                               toolbar->style_set_connection);
+  g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_global ()),
+                               toolbar->icon_size_connection);
+  
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
@@ -297,16 +409,12 @@
 }
 
 GtkWidget*
-gtk_toolbar_new (GtkOrientation  orientation,
-		 GtkToolbarStyle style)
+gtk_toolbar_new (void)
 {
   GtkToolbar *toolbar;
 
   toolbar = gtk_type_new (gtk_toolbar_get_type ());
 
-  toolbar->orientation = orientation;
-  toolbar->style = style;
-
   return GTK_WIDGET (toolbar);
 }
 
@@ -445,15 +553,32 @@
   GtkToolbar *toolbar;
   GList *children;
   GtkToolbarChild *child;
+  gint border_width;
   
   g_return_val_if_fail (widget != NULL, FALSE);
   g_return_val_if_fail (GTK_IS_TOOLBAR (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
 
+  border_width = GTK_CONTAINER (widget)->border_width;
+  
   if (GTK_WIDGET_DRAWABLE (widget))
     {
+      GtkShadowType shadow_type;
+
       toolbar = GTK_TOOLBAR (widget);
 
+      gtk_widget_style_get (widget, "shadow_type", &shadow_type, NULL);
+      
+      gtk_paint_box (widget->style,
+		     widget->window,
+                     GTK_WIDGET_STATE (widget),
+                     shadow_type,
+		     &event->area, widget, "toolbar",
+		     widget->allocation.x + border_width,
+                     widget->allocation.y + border_width,
+		     widget->allocation.width - border_width,
+                     widget->allocation.height - border_width);
+      
       for (children = toolbar->children; children; children = children->next)
 	{
 	  child = children->data;
@@ -485,6 +610,7 @@
   gint widget_maxw, widget_maxh;
   GtkRequisition child_requisition;
   gint space_size;
+  gint ipadding;
   
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (widget));
@@ -562,6 +688,12 @@
       requisition->height += nbuttons * button_maxh;
     }
 
+  /* Extra spacing */
+  gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+  
+  requisition->width += 2 * (widget->style->xthickness + ipadding);
+  requisition->height += 2 * (widget->style->ythickness + ipadding);
+  
   toolbar->button_maxw = button_maxw;
   toolbar->button_maxh = button_maxh;
 }
@@ -576,22 +708,29 @@
   GtkToolbarChildSpace *child_space;
   GtkAllocation alloc;
   GtkRequisition child_requisition;
-  gint border_width;
+  gint x_border_width, y_border_width;
   gint space_size;
-
+  gint ipadding;
+  
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (widget));
   g_return_if_fail (allocation != NULL);
 
   toolbar = GTK_TOOLBAR (widget);
   widget->allocation = *allocation;
-
-  border_width = GTK_CONTAINER (toolbar)->border_width;
+  
+  x_border_width = GTK_CONTAINER (toolbar)->border_width;
+  y_border_width = GTK_CONTAINER (toolbar)->border_width;
 
+  gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+  
+  x_border_width += 2 * (widget->style->xthickness + ipadding);
+  y_border_width += 2 * (widget->style->ythickness + ipadding);
+  
   if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
-    alloc.x = allocation->x + border_width;
+    alloc.x = allocation->x + x_border_width;
   else
-    alloc.y = allocation->y + border_width;
+    alloc.y = allocation->y + y_border_width;
 
   space_size = get_space_size (toolbar);
   
@@ -681,6 +820,26 @@
 }
 
 static void
+child_show_all (GtkWidget *widget)
+{
+  /* Don't show our own children, since that would
+   * show labels we may intend to hide in icons-only mode
+   */
+  if (!g_object_get_data (G_OBJECT (widget),
+                          "gtk-toolbar-is-child"))
+    gtk_widget_show_all (widget);
+}
+
+static void
+gtk_toolbar_show_all (GtkWidget *widget)
+{
+  gtk_container_foreach (GTK_CONTAINER (widget),
+			 (GtkCallback) child_show_all,
+			 NULL);
+  gtk_widget_show (widget);
+}
+
+static void
 gtk_toolbar_add (GtkContainer *container,
 		 GtkWidget    *widget)
 {
@@ -827,7 +986,8 @@
  *
  * This function sets the size of stock icons in the toolbar. You
  * can call it both before you add the icons and after they've been
- * added.
+ * added. The size you set will override user preferences for the default
+ * icon size.
  **/
 void
 gtk_toolbar_set_icon_size (GtkToolbar  *toolbar,
@@ -841,6 +1001,8 @@
   g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
+  toolbar->icon_size_set = TRUE;
+  
   if (toolbar->icon_size == icon_size)
     return;
   
@@ -869,6 +1031,31 @@
 }
 
 /**
+ * gtk_toolbar_unset_icon_size:
+ * @toolbar: a #GtkToolbar
+ * 
+ * Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that
+ * user preferences will be used to determine the icon size.
+ **/
+void
+gtk_toolbar_unset_icon_size (GtkToolbar  *toolbar)
+{
+  GtkIconSize size;
+
+  if (toolbar->icon_size_set)
+    {
+      g_object_get (gtk_settings_get_global (),
+                    "gtk-toolbar-icon-size",
+                    &size, NULL);
+
+      if (size != toolbar->icon_size)
+        gtk_toolbar_set_icon_size (toolbar, size);
+
+      toolbar->icon_size_set = FALSE;
+    }
+}
+
+/**
  * gtk_toolbar_insert_stock:
  * @toolbar: A #GtkToolbar
  * @stock_id: The id of the stock item you want to insert
@@ -1161,6 +1348,13 @@
 	    gtk_widget_show (child->icon);
 	}
 
+      if (type != GTK_TOOLBAR_CHILD_WIDGET)
+        {
+          /* Mark child as ours */
+          g_object_set_data (G_OBJECT (child->widget),
+                             "gtk-toolbar-is-child",
+                             GINT_TO_POINTER (TRUE));
+        }
       gtk_widget_show (child->widget);
       break;
 
@@ -1200,7 +1394,6 @@
 gtk_toolbar_set_orientation (GtkToolbar     *toolbar,
 			     GtkOrientation  orientation)
 {
-  g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
   gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
@@ -1210,13 +1403,41 @@
 gtk_toolbar_set_style (GtkToolbar      *toolbar,
 		       GtkToolbarStyle  style)
 {
-  g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
+  toolbar->style_set = TRUE;
   gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
 }
 
+/**
+ * gtk_toolbar_unset_style:
+ * @toolbar: a #GtkToolbar
+ * 
+ * Unsets a toolbar style set with gtk_toolbar_set_style(), so that
+ * user preferences will be used to determine the toolbar style.
+ **/
 void
+gtk_toolbar_unset_style (GtkToolbar *toolbar)
+{
+  GtkToolbarStyle style;
+  
+  g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
+
+  if (toolbar->style_set)
+    {
+      g_object_get (gtk_settings_get_global (),
+                    "gtk-toolbar-style",
+                    &style,
+                    NULL);
+
+      if (style != toolbar->style)
+        gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
+      
+      toolbar->style_set = FALSE;
+    }
+}
+
+void
 gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
 			  gboolean    enable)
 {
@@ -1272,7 +1493,7 @@
   GList *children;
   GtkToolbarChild *child;
   GtkWidget* box = NULL;
-
+  
   g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
Index: gtk/gtktoolbar.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.h,v
retrieving revision 1.26
diff -u -u -r1.26 gtktoolbar.h
--- gtk/gtktoolbar.h	2001/04/28 00:12:44	1.26
+++ gtk/gtktoolbar.h	2001/05/11 04:47:07
@@ -91,6 +91,12 @@
 
   gint             button_maxw;
   gint             button_maxh;
+
+  guint            style_set_connection;
+  guint            icon_size_connection;
+  
+  guint            style_set : 1;
+  guint            icon_size_set : 1;
 };
 
 struct _GtkToolbarClass
@@ -105,8 +111,7 @@
 
 
 GtkType    gtk_toolbar_get_type        (void) G_GNUC_CONST;
-GtkWidget* gtk_toolbar_new             (GtkOrientation   orientation,
-					GtkToolbarStyle  style);
+GtkWidget* gtk_toolbar_new             (void);
 
 /* Simple button items */
 GtkWidget* gtk_toolbar_append_item     (GtkToolbar      *toolbar,
@@ -133,8 +138,6 @@
 					gint             position);
 
 /* Stock Items */
-void       gtk_toolbar_set_icon_size   (GtkToolbar      *toolbar,
-					GtkIconSize      icon_size);
 GtkWidget* gtk_toolbar_insert_stock    (GtkToolbar      *toolbar,
 					const gchar     *stock_id,
 					const char      *tooltip_text,
@@ -203,8 +206,12 @@
 					      GtkOrientation        orientation);
 void       gtk_toolbar_set_style             (GtkToolbar           *toolbar,
 					      GtkToolbarStyle       style);
+void       gtk_toolbar_set_icon_size         (GtkToolbar           *toolbar,
+                                              GtkIconSize           icon_size);
 void       gtk_toolbar_set_tooltips          (GtkToolbar           *toolbar,
 					      gboolean		    enable);
+void       gtk_toolbar_unset_style           (GtkToolbar           *toolbar);
+void       gtk_toolbar_unset_icon_size       (GtkToolbar           *toolbar);
 
 #ifdef __cplusplus
 }
Index: tests/testgtk.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/testgtk.c,v
retrieving revision 1.249
diff -u -u -r1.249 testgtk.c
--- tests/testgtk.c	2001/05/07 15:58:47	1.249
+++ tests/testgtk.c	2001/05/11 04:47:07
@@ -724,7 +724,7 @@
       gtk_container_set_border_width (GTK_CONTAINER (window), 0);
       gtk_widget_realize (window);
 
-      toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
+      toolbar = gtk_toolbar_new ();
 
       gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
 				GTK_STOCK_NEW,
@@ -825,7 +825,7 @@
   if (!GTK_WIDGET_REALIZED (window))
     gtk_widget_realize (window);
 
-  toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
+  toolbar = gtk_toolbar_new ();
 
   gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
 			   "Horizontal", "Horizontal toolbar layout", NULL,




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