[gtk+/toolpalette] ToolPalette: Implement GtkOrientable.



commit ac7b0c91ae8394b869c00ece5ccadcb433aaecd6
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Jul 14 19:11:20 2009 +0200

    ToolPalette: Implement GtkOrientable.
    
    * 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        |    2 +-
 docs/reference/ChangeLog            |    6 ++++
 docs/reference/gtk/gtk-sections.txt |    2 -
 gtk/gtktoolitemgroup.c              |    4 +-
 gtk/gtktoolpalette.c                |   51 ++++------------------------------
 gtk/gtktoolpalette.h                |    3 --
 6 files changed, 15 insertions(+), 53 deletions(-)
---
diff --git a/demos/gtk-demo/toolpalette.c b/demos/gtk-demo/toolpalette.c
index fb933de..671aa77 100644
--- a/demos/gtk-demo/toolpalette.c
+++ b/demos/gtk-demo/toolpalette.c
@@ -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)
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog
index 0a6b97f..5cc66e0 100644
--- a/docs/reference/ChangeLog
+++ b/docs/reference/ChangeLog
@@ -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>
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 901f014..00e82de 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -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
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index f2718dd..58312de 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -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)*/))
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index d20fde4..363ee3e 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -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",
@@ -970,25 +965,6 @@ gtk_tool_palette_set_icon_size (GtkToolPalette *palette,
 }
 
 /**
- * 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.
  * @style: the #GtkToolbarStyle that items in the tool palette shall have.
@@ -1025,21 +1001,6 @@ gtk_tool_palette_get_icon_size (GtkToolPalette *palette)
 }
 
 /**
- * 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.
  *
diff --git a/gtk/gtktoolpalette.h b/gtk/gtktoolpalette.h
index 64c4f09..1d4d249 100644
--- a/gtk/gtktoolpalette.h
+++ b/gtk/gtktoolpalette.h
@@ -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,



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