]> Pileus Git - ~andy/gtk/commitdiff
Fix handling of getting the default style/icon size from the correct
authorOwen Taylor <otaylor@redhat.com>
Tue, 22 Oct 2002 20:00:31 +0000 (20:00 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 22 Oct 2002 20:00:31 +0000 (20:00 +0000)
Tue Oct 22 15:55:08 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtktoolbar.c: Fix handling of getting the
        default style/icon size from the correct
        GtkSettings. (#82184, reported by Vitaly Tishkov,
        help from Soeren Sandmann)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktoolbar.c

index 7e92326f59afe5abe653e4f403070f0834f96877..3f04a4cdb4db3eb2a3b7719a6f83fa8f8efa78af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Oct 22 15:55:08 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix handling of getting the 
+       default style/icon size from the correct 
+       GtkSettings. (#82184, reported by Vitaly Tishkov,
+       help from Soeren Sandmann)
+
 Tue Oct 22 15:32:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwindow.c: Actively monitor the screen of the
index 7e92326f59afe5abe653e4f403070f0834f96877..3f04a4cdb4db3eb2a3b7719a6f83fa8f8efa78af 100644 (file)
@@ -1,3 +1,10 @@
+Tue Oct 22 15:55:08 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix handling of getting the 
+       default style/icon size from the correct 
+       GtkSettings. (#82184, reported by Vitaly Tishkov,
+       help from Soeren Sandmann)
+
 Tue Oct 22 15:32:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwindow.c: Actively monitor the screen of the
index 7e92326f59afe5abe653e4f403070f0834f96877..3f04a4cdb4db3eb2a3b7719a6f83fa8f8efa78af 100644 (file)
@@ -1,3 +1,10 @@
+Tue Oct 22 15:55:08 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix handling of getting the 
+       default style/icon size from the correct 
+       GtkSettings. (#82184, reported by Vitaly Tishkov,
+       help from Soeren Sandmann)
+
 Tue Oct 22 15:32:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwindow.c: Actively monitor the screen of the
index 7e92326f59afe5abe653e4f403070f0834f96877..3f04a4cdb4db3eb2a3b7719a6f83fa8f8efa78af 100644 (file)
@@ -1,3 +1,10 @@
+Tue Oct 22 15:55:08 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix handling of getting the 
+       default style/icon size from the correct 
+       GtkSettings. (#82184, reported by Vitaly Tishkov,
+       help from Soeren Sandmann)
+
 Tue Oct 22 15:32:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwindow.c: Actively monitor the screen of the
index 7e92326f59afe5abe653e4f403070f0834f96877..3f04a4cdb4db3eb2a3b7719a6f83fa8f8efa78af 100644 (file)
@@ -1,3 +1,10 @@
+Tue Oct 22 15:55:08 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix handling of getting the 
+       default style/icon size from the correct 
+       GtkSettings. (#82184, reported by Vitaly Tishkov,
+       help from Soeren Sandmann)
+
 Tue Oct 22 15:32:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwindow.c: Actively monitor the screen of the
index 7e92326f59afe5abe653e4f403070f0834f96877..3f04a4cdb4db3eb2a3b7719a6f83fa8f8efa78af 100644 (file)
@@ -1,3 +1,10 @@
+Tue Oct 22 15:55:08 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix handling of getting the 
+       default style/icon size from the correct 
+       GtkSettings. (#82184, reported by Vitaly Tishkov,
+       help from Soeren Sandmann)
+
 Tue Oct 22 15:32:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwindow.c: Actively monitor the screen of the
index 1da59fc186e6d93552c84d8a4185332d25438fed..4dac3af169d9eba939f4c870fa768cf9df902b5c 100644 (file)
@@ -45,6 +45,7 @@
 #define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
 
 #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
+#define DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_BOTH
 
 #define SPACE_LINE_DIVISION 10
 #define SPACE_LINE_START    3
@@ -288,14 +289,14 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
                                                     _("Toolbar style"),
                                                     _("Whether default toolbars have text only, text and icons, icons only, etc."),
                                                     GTK_TYPE_TOOLBAR_STYLE,
-                                                    GTK_TOOLBAR_BOTH,
+                                                    DEFAULT_TOOLBAR_STYLE,
                                                     G_PARAM_READWRITE));
 
   gtk_settings_install_property (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,
+                                                    DEFAULT_ICON_SIZE,
                                                     G_PARAM_READWRITE));  
 }
 
@@ -321,10 +322,16 @@ icon_size_change_notify (GtkToolbar *toolbar)
     }
 }
 
+static GtkSettings *
+toolbar_get_settings (GtkToolbar *toolbar)
+{
+  return g_object_get_data (G_OBJECT (toolbar), "gtk-toolbar-settings");
+}
+
 static void
 toolbar_screen_changed (GtkToolbar *toolbar)
 {
-  GtkSettings *old_settings = g_object_get_data (G_OBJECT (toolbar), "gtk-toolbar-settings");
+  GtkSettings *old_settings = toolbar_get_settings (toolbar);
   GtkSettings *settings;
 
   if (gtk_widget_has_screen (GTK_WIDGET (toolbar)))
@@ -360,12 +367,12 @@ toolbar_screen_changed (GtkToolbar *toolbar)
 
       g_object_ref (settings);
       g_object_set_data (G_OBJECT (toolbar), "gtk-toolbar-settings", settings);
-
-      style_change_notify (toolbar);
-      icon_size_change_notify (toolbar);
     }
   else
     g_object_set_data (G_OBJECT (toolbar), "gtk-toolbar-settings", NULL);
+
+  style_change_notify (toolbar);
+  icon_size_change_notify (toolbar);
 }
 
 static void
@@ -399,6 +406,7 @@ gtk_toolbar_init (GtkToolbar *toolbar)
   toolbar->children     = NULL;
   toolbar->orientation  = GTK_ORIENTATION_HORIZONTAL;
   toolbar->icon_size    = DEFAULT_ICON_SIZE;
+  toolbar->style        = DEFAUL_TOOLBAR_STYLE;
   toolbar->tooltips     = gtk_tooltips_new ();
   g_object_ref (toolbar->tooltips);
   gtk_object_sink (GTK_OBJECT (toolbar->tooltips));
@@ -1040,7 +1048,7 @@ gtk_toolbar_set_icon_size (GtkToolbar  *toolbar,
 GtkIconSize
 gtk_toolbar_get_icon_size (GtkToolbar *toolbar)
 {
-  g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_ICON_SIZE_LARGE_TOOLBAR);
+  g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), DEFAULT_ICON_SIZE);
 
   return toolbar->icon_size;
 }
@@ -1059,9 +1067,14 @@ gtk_toolbar_unset_icon_size (GtkToolbar  *toolbar)
 
   if (toolbar->icon_size_set)
     {
-      g_object_get (gtk_widget_get_settings (GTK_WIDGET (toolbar)),
-                    "gtk-toolbar-icon-size", &size,
-                   NULL);
+      GtkSettings *settings = toolbar_get_settings (toolbar);
+
+      if (settings)
+       g_object_get (settings,
+                     "gtk-toolbar-icon-size", &size,
+                     NULL);
+      else
+       size = DEFAULT_ICON_SIZE;
 
       if (size != toolbar->icon_size)
         gtk_toolbar_set_icon_size (toolbar, size);
@@ -1534,7 +1547,7 @@ gtk_toolbar_set_style (GtkToolbar      *toolbar,
 GtkToolbarStyle
 gtk_toolbar_get_style (GtkToolbar *toolbar)
 {
-  g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH);
+  g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), DEFAULT_TOOLBAR_STYLE);
 
   return toolbar->style;
 }
@@ -1555,9 +1568,14 @@ gtk_toolbar_unset_style (GtkToolbar *toolbar)
 
   if (toolbar->style_set)
     {
-      g_object_get (gtk_widget_get_settings (GTK_WIDGET (toolbar)),
-                    "gtk-toolbar-style", &style,
-                    NULL);
+      GtkSettings *settings = toolbar_get_settings (toolbar);
+
+      if (settings)
+       g_object_get (settings,
+                     "gtk-toolbar-style", &style,
+                     NULL);
+      else
+       style = DEFAULT_TOOLBAR_STYLE;
 
       if (style != toolbar->style)
         g_signal_emit (toolbar, toolbar_signals[STYLE_CHANGED], 0, style);