[gdl] Replace gdl_dock_back_[set|get]_orientation by gtk_orientable_[set|get]_orientation



commit baef095258a5e2b26867376d11eed8869d48a207
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun May 27 12:29:05 2012 +0200

    Replace gdl_dock_back_[set|get]_orientation by gtk_orientable_[set|get]_orientation

 gdl/Makefile.am      |    3 +-
 gdl/gdl-deprecated.c |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++
 gdl/gdl-dock-bar.c   |   44 ++++---------------------------------
 gdl/gdl-dock-bar.h   |   11 ++++++--
 gdl/test-dock.c      |   10 +------
 5 files changed, 76 insertions(+), 51 deletions(-)
---
diff --git a/gdl/Makefile.am b/gdl/Makefile.am
index 7441141..ff7c218 100644
--- a/gdl/Makefile.am
+++ b/gdl/Makefile.am
@@ -60,7 +60,8 @@ libgdl_3_la_SOURCES = \
 	libgdlmarshal.h \
 	libgdlmarshal.c \
 	gdl-preview-window.h \
-	gdl-preview-window.c
+	gdl-preview-window.c \
+	gdl-deprecated.c
 
 libgdl_3_la_LIBADD = \
 	$(GDL_DEPENDENCIES_LIBS) \
diff --git a/gdl/gdl-deprecated.c b/gdl/gdl-deprecated.c
new file mode 100644
index 0000000..a82ee39
--- /dev/null
+++ b/gdl/gdl-deprecated.c
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the GNOME Devtools Libraries.
+ *
+ * Copyright (C) 2012 SÃbastien Granjoux <seb sfo free fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gdl.h"
+
+#ifndef GDL_DISABLE_DEPRECATED
+
+/**
+ * gdl_dock_bar_get_orientation:
+ * @dockbar: a #GdlDockBar
+ *
+ * Retrieves the orientation of the @dockbar.
+ *
+ * Returns: the orientation of the @docbar
+ *
+ * Deprecated: 3.6: Use gtk_orientable_get_orientation() instead.
+ */
+GtkOrientation gdl_dock_bar_get_orientation (GdlDockBar *dockbar)
+{
+    return gtk_orientable_get_orientation (GTK_ORIENTABLE (dockbar));
+}
+
+/**
+ * gdl_dock_bar_set_orientation:
+ * @dockbar: a #GdlDockBar
+ * @orientation: the new orientation
+ *
+ * Set the orientation of the @dockbar.
+ *
+ * Deprecated: 3.6: Use gtk_orientable_set_orientation() instead.
+ */
+void gdl_dock_bar_set_orientation (GdlDockBar *dockbar,
+	                             GtkOrientation orientation)
+{
+    gtk_orientable_set_orientation (GTK_ORIENTABLE (dockbar), orientation);
+}
+#endif
diff --git a/gdl/gdl-dock-bar.c b/gdl/gdl-dock-bar.c
index b82310e..0a22d07 100644
--- a/gdl/gdl-dock-bar.c
+++ b/gdl/gdl-dock-bar.c
@@ -75,7 +75,6 @@ static void gdl_dock_bar_remove_item      (GdlDockBar      *dockbar,
 struct _GdlDockBarPrivate {
     GdlDockMaster   *master;
     GSList          *items;
-    GtkOrientation   orientation;
     GdlDockBarStyle  dockbar_style;
 
     glong layout_changed_id;
@@ -158,8 +157,8 @@ gdl_dock_bar_init (GdlDockBar *dockbar)
 
     dockbar->priv->master = NULL;
     dockbar->priv->items = NULL;
-    dockbar->priv->orientation = GTK_ORIENTATION_VERTICAL;
     dockbar->priv->dockbar_style = GDL_DOCK_BAR_BOTH;
+    gtk_orientable_set_orientation (GTK_ORIENTABLE (dockbar), GTK_ORIENTATION_VERTICAL);
 }
 
 static void
@@ -307,7 +306,7 @@ gdl_dock_bar_add_item (GdlDockBar  *dockbar,
     button = gtk_button_new ();
     gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
 
-    box = gtk_box_new (dockbar->priv->orientation, 0);
+    box = gtk_box_new (gtk_orientable_get_orientation (GTK_ORIENTABLE (dockbar)), 0);
 
     g_object_get (item, "stock-id", &stock_id, "pixbuf-icon", &pixbuf_icon,
                   "long-name", &name, NULL);
@@ -315,7 +314,7 @@ gdl_dock_bar_add_item (GdlDockBar  *dockbar,
     if (dockbar->priv->dockbar_style == GDL_DOCK_BAR_TEXT ||
         dockbar->priv->dockbar_style == GDL_DOCK_BAR_BOTH) {
         label = gtk_label_new (name);
-        if (dockbar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+        if (gtk_orientable_get_orientation (GTK_ORIENTABLE (dockbar)) == GTK_ORIENTATION_VERTICAL)
             gtk_label_set_angle (GTK_LABEL (label), 90);
         gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
     }
@@ -446,7 +445,7 @@ static void gdl_dock_bar_size_request (GtkWidget *widget,
     dockbar = GDL_DOCK_BAR (widget);
 
     /* default to vertical for unknown values */
-    switch (dockbar->priv->orientation) {
+    switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (dockbar))) {
 	case GTK_ORIENTATION_HORIZONTAL:
 		gdl_dock_bar_size_hrequest (widget, requisition);
 		break;
@@ -487,7 +486,7 @@ static void gdl_dock_bar_size_allocate (GtkWidget *widget,
     dockbar = GDL_DOCK_BAR (widget);
 
     /* default to vertical for unknown values */
-    switch (dockbar->priv->orientation) {
+    switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (dockbar))) {
 	case GTK_ORIENTATION_HORIZONTAL:
 		gdl_dock_bar_size_hallocate (widget, allocation);
 		break;
@@ -1066,39 +1065,6 @@ gdl_dock_bar_new (GdlDock *dock)
 }
 
 /**
- * gdl_dock_bar_get_orientation:
- * @dockbar: a #GdlDockBar
- *
- * Retrieves the orientation of the @dockbar.
- *
- * Returns: the orientation of the @docbar
- */
-GtkOrientation gdl_dock_bar_get_orientation (GdlDockBar *dockbar)
-{
-    g_return_val_if_fail (GDL_IS_DOCK_BAR (dockbar),
-                          GTK_ORIENTATION_VERTICAL);
-
-    return dockbar->priv->orientation;
-}
-
-/**
- * gdl_dock_bar_set_orientation:
- * @dockbar: a #GdlDockBar
- * @orientation: the new orientation
- *
- * Set the orientation of the @dockbar.
- */
-void gdl_dock_bar_set_orientation (GdlDockBar *dockbar,
-	                             GtkOrientation orientation)
-{
-    g_return_if_fail (GDL_IS_DOCK_BAR (dockbar));
-
-    dockbar->priv->orientation = orientation;
-
-    gtk_widget_queue_resize (GTK_WIDGET (dockbar));
-}
-
-/**
  * gdl_dock_bar_set_style:
  * @dockbar: a #GdlDockBar
  * @style: the new style
diff --git a/gdl/gdl-dock-bar.h b/gdl/gdl-dock-bar.h
index 6762c52..d73d453 100644
--- a/gdl/gdl-dock-bar.h
+++ b/gdl/gdl-dock-bar.h
@@ -24,6 +24,9 @@
 
 #include <gtk/gtk.h>
 
+#include <gdl/gdl-dock.h>
+
+
 G_BEGIN_DECLS
 
 /* standard macros */
@@ -59,6 +62,7 @@ typedef enum {
 struct _GdlDockBar {
     GtkBox parent;
 
+    /*< private >*/
     GdlDock *dock;
 
     GdlDockBarPrivate *priv;
@@ -72,13 +76,14 @@ GType      gdl_dock_bar_get_type            (void);
 
 GtkWidget *gdl_dock_bar_new                 (GdlDock     *dock);
 
-GtkOrientation gdl_dock_bar_get_orientation (GdlDockBar *dockbar);
-void           gdl_dock_bar_set_orientation (GdlDockBar *dockbar,
-                                             GtkOrientation orientation);
 void           gdl_dock_bar_set_style       (GdlDockBar *dockbar,
                                              GdlDockBarStyle style);
 GdlDockBarStyle gdl_dock_bar_get_style      (GdlDockBar *dockbar);
 
+GtkOrientation gdl_dock_bar_get_orientation (GdlDockBar *dockbar) G_GNUC_DEPRECATED_FOR(gtk_orientable_get_orientation);
+void           gdl_dock_bar_set_orientation (GdlDockBar *dockbar,
+                                             GtkOrientation orientation) G_GNUC_DEPRECATED_FOR(gtk_orientable_set_orientation);
+
 G_END_DECLS
 
 #endif /* __GDL_DOCK_BAR_H__ */
diff --git a/gdl/test-dock.c b/gdl/test-dock.c
index d58a2c0..953f563 100644
--- a/gdl/test-dock.c
+++ b/gdl/test-dock.c
@@ -7,13 +7,7 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
-#include "gdl-dock.h"
-#include "gdl-dock-item.h"
-#include "gdl-dock-notebook.h"
-#include "gdl-dock-layout.h"
-#include "gdl-dock-placeholder.h"
-#include "gdl-dock-bar.h"
-#include "gdl-switcher.h"
+#include "gdl/gdl.h"
 
 #include <glib.h>
 
@@ -212,7 +206,7 @@ main (int argc, char **argv)
 
 	/* create the dockbar */
 	dockbar = gdl_dock_bar_new (GDL_DOCK (dock));
-  gdl_dock_bar_set_style(GDL_DOCK_BAR(dockbar), GDL_DOCK_BAR_TEXT);
+    gdl_dock_bar_set_style(GDL_DOCK_BAR(dockbar), GDL_DOCK_BAR_TEXT);
 
 	box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
 	gtk_box_pack_start (GTK_BOX (table), box, TRUE, TRUE, 0);



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