From 8004fcbfc11c6fff1d65eff7d103a00e18ee6438 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 11 Nov 2008 15:28:07 +0000 Subject: [PATCH] implement the GtkOrientable interface and deprecate 2008-11-11 Michael Natterer * gtk/gtktoolbar.[ch]: implement the GtkOrientable interface and deprecate gtk_toolbar_get,set_orientation(). * gtk/gtk.symbols: changed accordingly. svn path=/trunk/; revision=21777 --- ChangeLog | 7 ++++ gtk/gtk.symbols | 4 ++ gtk/gtktoolbar.c | 95 ++++++++++++++++++++++++++---------------------- gtk/gtktoolbar.h | 4 +- 4 files changed, 66 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d02722f05..65bb97f01f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-11 Michael Natterer + + * gtk/gtktoolbar.[ch]: implement the GtkOrientable interface + and deprecate gtk_toolbar_get,set_orientation(). + + * gtk/gtk.symbols: changed accordingly. + 2008-11-10 Marek Kasik Bug 560135 - Print when the user double clicks a printer diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index b8f51a55dd..1908cd3f76 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -4158,7 +4158,9 @@ gtk_toolbar_get_icon_size gtk_toolbar_get_item_index gtk_toolbar_get_n_items gtk_toolbar_get_nth_item +#ifndef GTK_DISABLE_DEPRECATED gtk_toolbar_get_orientation +#endif gtk_toolbar_get_relief_style gtk_toolbar_get_show_arrow gtk_toolbar_get_style @@ -4169,7 +4171,9 @@ gtk_toolbar_get_type G_GNUC_CONST gtk_toolbar_insert gtk_toolbar_new gtk_toolbar_set_drop_highlight_item +#ifndef GTK_DISABLE_DEPRECATED gtk_toolbar_set_orientation +#endif gtk_toolbar_set_show_arrow gtk_toolbar_set_style #ifndef GTK_DISABLE_DEPRECATED diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 5844e47a61..fe104b0f02 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -5,7 +5,7 @@ * Copyright (C) 2002 Anders Carlsson * Copyright (C) 2002 James Henstridge * Copyright (C) 2003, 2004 Soeren Sandmann - * + * * 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 @@ -26,35 +26,39 @@ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #undef GTK_DISABLE_DEPRECATED #include "config.h" + +#include +#include + +#include + #include "gtkarrow.h" +#include "gtkbindings.h" +#include "gtkhbox.h" +#include "gtkimage.h" +#include "gtklabel.h" +#include "gtkmain.h" +#include "gtkmarshalers.h" +#include "gtkmenu.h" +#include "gtkorientable.h" +#include "gtkradiobutton.h" +#include "gtkradiotoolbutton.h" +#include "gtkseparatormenuitem.h" +#include "gtkseparatortoolitem.h" +#include "gtkstock.h" +#include "gtktoolbar.h" #include "gtktoolbar.h" #include "gtktoolshell.h" -#include "gtkradiotoolbutton.h" -#include "gtkseparatortoolitem.h" -#include "gtkmenu.h" -#include "gtkradiobutton.h" -#include "gtktoolbar.h" -#include "gtkbindings.h" -#include -#include "gtkmarshalers.h" -#include "gtkmain.h" -#include "gtkstock.h" -#include "gtklabel.h" +#include "gtkvbox.h" #include "gtkprivate.h" #include "gtkintl.h" -#include -#include "gtkhbox.h" -#include "gtkvbox.h" -#include "gtkimage.h" -#include "gtkseparatormenuitem.h" #include "gtkalias.h" -#include typedef struct _ToolbarContent ToolbarContent; @@ -310,10 +314,15 @@ static void toolbar_rebuild_menu (GtkToolShell #define GTK_TOOLBAR_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_TOOLBAR, GtkToolbarPrivate)) -static guint toolbar_signals [LAST_SIGNAL] = { 0 }; G_DEFINE_TYPE_WITH_CODE (GtkToolbar, gtk_toolbar, GTK_TYPE_CONTAINER, - G_IMPLEMENT_INTERFACE (GTK_TYPE_TOOL_SHELL, toolbar_tool_shell_iface_init)) + G_IMPLEMENT_INTERFACE (GTK_TYPE_TOOL_SHELL, + toolbar_tool_shell_iface_init) + G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, + NULL)) + +static guint toolbar_signals[LAST_SIGNAL] = { 0 }; + static void add_arrow_bindings (GtkBindingSet *binding_set, @@ -345,16 +354,6 @@ add_ctrl_tab_bindings (GtkBindingSet *binding_set, GTK_TYPE_DIRECTION_TYPE, direction); } -static void -toolbar_tool_shell_iface_init (GtkToolShellIface *iface) -{ - iface->get_icon_size = toolbar_get_icon_size; - iface->get_orientation = toolbar_get_orientation; - iface->get_style = toolbar_get_style; - iface->get_relief_style = toolbar_get_relief_style; - iface->rebuild_menu = toolbar_rebuild_menu; -} - static void gtk_toolbar_class_init (GtkToolbarClass *klass) { @@ -486,15 +485,10 @@ gtk_toolbar_class_init (GtkToolbarClass *klass) G_TYPE_BOOLEAN); /* properties */ - g_object_class_install_property (gobject_class, - PROP_ORIENTATION, - g_param_spec_enum ("orientation", - P_("Orientation"), - P_("The orientation of the toolbar"), - GTK_TYPE_ORIENTATION, - GTK_ORIENTATION_HORIZONTAL, - GTK_PARAM_READWRITE)); - + g_object_class_override_property (gobject_class, + PROP_ORIENTATION, + "orientation"); + g_object_class_install_property (gobject_class, PROP_TOOLBAR_STYLE, g_param_spec_enum ("toolbar-style", @@ -673,6 +667,16 @@ gtk_toolbar_class_init (GtkToolbarClass *klass) g_type_class_add_private (gobject_class, sizeof (GtkToolbarPrivate)); } +static void +toolbar_tool_shell_iface_init (GtkToolShellIface *iface) +{ + iface->get_icon_size = toolbar_get_icon_size; + iface->get_orientation = toolbar_get_orientation; + iface->get_style = toolbar_get_style; + iface->get_relief_style = toolbar_get_relief_style; + iface->rebuild_menu = toolbar_rebuild_menu; +} + static void gtk_toolbar_init (GtkToolbar *toolbar) { @@ -730,7 +734,8 @@ gtk_toolbar_set_property (GObject *object, switch (prop_id) { case PROP_ORIENTATION: - gtk_toolbar_set_orientation (toolbar, g_value_get_enum (value)); + g_signal_emit (toolbar, toolbar_signals[ORIENTATION_CHANGED], 0, + g_value_get_enum (value)); break; case PROP_TOOLBAR_STYLE: gtk_toolbar_set_style (toolbar, g_value_get_enum (value)); @@ -2830,8 +2835,10 @@ gtk_toolbar_get_item_index (GtkToolbar *toolbar, * gtk_toolbar_set_orientation: * @toolbar: a #GtkToolbar. * @orientation: a new #GtkOrientation. - * + * * Sets whether a toolbar should appear horizontally or vertically. + * + * Deprecated: 2.16: Use gtk_orientable_set_orientation() instead. **/ void gtk_toolbar_set_orientation (GtkToolbar *toolbar, @@ -2845,11 +2852,13 @@ gtk_toolbar_set_orientation (GtkToolbar *toolbar, /** * gtk_toolbar_get_orientation: * @toolbar: a #GtkToolbar - * + * * Retrieves the current orientation of the toolbar. See * gtk_toolbar_set_orientation(). * * Return value: the orientation + * + * Deprecated: 2.16: Use gtk_orientable_get_orientation() instead. **/ GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar) diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h index f6bcc1ec8d..fb78095ccd 100644 --- a/gtk/gtktoolbar.h +++ b/gtk/gtktoolbar.h @@ -151,14 +151,16 @@ GtkToolItem * gtk_toolbar_get_nth_item (GtkToolbar *toolbar, gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar); void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar, gboolean show_arrow); + +#ifndef GTK_DISABLE_DEPRECATED GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar); void gtk_toolbar_set_orientation (GtkToolbar *toolbar, GtkOrientation orientation); -#ifndef GTK_DISABLE_DEPRECATED gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar); void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gboolean enable); #endif /* GTK_DISABLE_DEPRECATED */ + GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar); void gtk_toolbar_set_style (GtkToolbar *toolbar, GtkToolbarStyle style);