]> Pileus Git - ~andy/gtk/commitdiff
ToolPalette: Implement GtkOrientable.
authorMurray Cumming <murrayc@murrayc.com>
Tue, 14 Jul 2009 17:11:20 +0000 (19:11 +0200)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 14 Jul 2009 17:11:20 +0000 (19:11 +0200)
* gtk/gtktoolpalette.[h|c]: Remove gtk_tool_palette_get/set_property(),
implementing GtkOrientable instead.
* gtk/gtktoolitemgroup.c:
* demos/gtk-demo/toolpalette.c: Use gtk_orientable_* instead.

demos/gtk-demo/toolpalette.c
docs/reference/ChangeLog
docs/reference/gtk/gtk-sections.txt
gtk/gtktoolitemgroup.c
gtk/gtktoolpalette.c
gtk/gtktoolpalette.h

index fb933de97e57aca2e7eca331dbdeb713333135db..671aa77cd11fe52e14f039d183ac4c1d8968f4d5 100644 (file)
@@ -25,7 +25,7 @@ static void on_combo_orientation_changed(GtkComboBox *combo_box, gpointer user_d
   gint val = 0;
   gtk_tree_model_get (model, &iter, 1, &val, -1);
   
-  gtk_tool_palette_set_orientation (palette, val);
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (palette), val);
 }
 
 static void on_combo_style_changed(GtkComboBox *combo_box, gpointer user_data)
index 0a6b97fddc0e4a8239cc2991d2bc83415707ded5..5cc66e0d93d120895daf5f6d9ae18efcdea03804 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-14  Murray Cumming  <murrayc@murrayc.com>
+
+       reviewed by: <delete if not using a buddy>
+
+       * gtk/gtk-sections.txt:
+
 2009-07-13  Murray Cumming  <murrayc@murrayc.com>
 
        reviewed by: <delete if not using a buddy>
index 901f014f6726910b3c911f47687a07907e84371f..00e82de4974d218990d08caf105401601b6e98e2 100644 (file)
@@ -4449,8 +4449,6 @@ gtk_tool_palette_get_group_position
 gtk_tool_palette_set_group_position
 gtk_tool_palette_get_icon_size
 gtk_tool_palette_set_icon_size
-gtk_tool_palette_get_orientation
-gtk_tool_palette_set_orientation
 gtk_tool_palette_get_style
 gtk_tool_palette_set_style
 gtk_tool_palette_add_drag_dest
index f2718ddb331e80cbc2c7f6490b505c0c572c6502..58312de7cf1ce340269a11368eab52e511ec5fdf 100644 (file)
@@ -127,7 +127,7 @@ gtk_tool_item_group_get_orientation (GtkToolShell *shell)
   GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
 
   if (GTK_IS_TOOL_PALETTE (parent))
-    return gtk_tool_palette_get_orientation (GTK_TOOL_PALETTE (parent));
+    return gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
 
   return GTK_ORIENTATION_VERTICAL;
 }
@@ -177,7 +177,7 @@ gtk_tool_item_group_get_text_orientation (GtkToolShell *shell)
 
   if (GTK_IS_TOOL_PALETTE (parent))
     {
-      GtkOrientation orientation = gtk_tool_palette_get_orientation (GTK_TOOL_PALETTE (parent));
+      GtkOrientation orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
       if (GTK_ORIENTATION_HORIZONTAL == orientation &&
           (GTK_TOOLBAR_TEXT == gtk_tool_item_group_get_style (shell)/* ||
            GTK_TOOLBAR_BOTH_HORIZ == gtk_tool_item_group_get_style (shell)*/))
index d20fde4c287a584833698c3ccdf057aee9d361f9..363ee3e11015c0ee5bd74fcfba6e01670cd81842 100644 (file)
@@ -165,9 +165,10 @@ static const GtkTargetEntry dnd_targets[] =
   { "application/x-GTK-tool-palette-group", GTK_TARGET_SAME_APP, 0 },
 };
 
-G_DEFINE_TYPE (GtkToolPalette,
+G_DEFINE_TYPE_WITH_CODE (GtkToolPalette,
                gtk_tool_palette,
-               GTK_TYPE_CONTAINER);
+               GTK_TYPE_CONTAINER,
+               G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL));
 
 static void
 gtk_tool_palette_init (GtkToolPalette *palette)
@@ -256,7 +257,7 @@ gtk_tool_palette_get_property (GObject    *object,
         break;
 
       case PROP_ORIENTATION:
-        g_value_set_enum (value, gtk_tool_palette_get_orientation (palette));
+        g_value_set_enum (value, palette->priv->orientation);
         break;
 
       case PROP_TOOLBAR_STYLE:
@@ -895,14 +896,8 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
                                                       G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
                                                       G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 
-  g_object_class_install_property (oclass, PROP_ORIENTATION,
-                                   g_param_spec_enum ("orientation",
-                                                      P_("Orientation"),
-                                                      P_("Orientation of the tool palette"),
-                                                      GTK_TYPE_ORIENTATION,
-                                                      DEFAULT_ORIENTATION,
-                                                      G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
-                                                      G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+  g_object_class_override_property (oclass, PROP_ORIENTATION,
+                                    "orientation");
 
   g_object_class_install_property (oclass, PROP_TOOLBAR_STYLE,
                                    g_param_spec_enum ("toolbar-style",
@@ -969,25 +964,6 @@ gtk_tool_palette_set_icon_size (GtkToolPalette *palette,
     g_object_set (palette, "icon-size", icon_size, NULL);
 }
 
-/**
- * gtk_tool_palette_set_orientation:
- * @palette: an #GtkToolPalette.
- * @orientation: the #GtkOrientation that the tool palette shall have.
- *
- * Sets the orientation (horizontal or vertical) of the tool palette.
- *
- * Since: 2.18
- */
-void
-gtk_tool_palette_set_orientation (GtkToolPalette *palette,
-                                  GtkOrientation  orientation)
-{
-  g_return_if_fail (GTK_IS_TOOL_PALETTE (palette));
-
-  if (orientation != palette->priv->orientation)
-    g_object_set (palette, "orientation", orientation, NULL);
-}
-
 /**
  * gtk_tool_palette_set_style:
  * @palette: an #GtkToolPalette.
@@ -1024,21 +1000,6 @@ gtk_tool_palette_get_icon_size (GtkToolPalette *palette)
   return palette->priv->icon_size;
 }
 
-/**
- * gtk_tool_palette_get_orientation:
- * @palette: an #GtkToolPalette.
- *
- * Gets the orientation (horizontal or vertical) of the tool palette. See gtk_tool_palette_set_orientation().
- *
- * Returns the #GtkOrientation of the tool palette.
- */
-GtkOrientation
-gtk_tool_palette_get_orientation (GtkToolPalette *palette)
-{
-  g_return_val_if_fail (GTK_IS_TOOL_PALETTE (palette), DEFAULT_ORIENTATION);
-  return palette->priv->orientation;
-}
-
 /**
  * gtk_tool_palette_get_style:
  * @palette: an #GtkToolPalette.
index 64c4f095ec3b2ce0c3c312015b6d57c0cbf01988..1d4d2494a7539495251bb0e9509ad78f00b9e53d 100644 (file)
@@ -95,13 +95,10 @@ gboolean                       gtk_tool_palette_get_expand            (GtkToolPa
 
 void                           gtk_tool_palette_set_icon_size         (GtkToolPalette            *palette,
                                                                        GtkIconSize                icon_size);
-void                           gtk_tool_palette_set_orientation       (GtkToolPalette            *palette,
-                                                                       GtkOrientation             orientation);
 void                           gtk_tool_palette_set_style             (GtkToolPalette            *palette,
                                                                        GtkToolbarStyle            style);
 
 GtkIconSize                    gtk_tool_palette_get_icon_size         (GtkToolPalette            *palette);
-GtkOrientation                 gtk_tool_palette_get_orientation       (GtkToolPalette            *palette);
 GtkToolbarStyle                gtk_tool_palette_get_style             (GtkToolPalette            *palette);
 
 GtkToolItem*                   gtk_tool_palette_get_drop_item         (GtkToolPalette            *palette,