From 4f9bcaf3c6c5a7d6226362d2baabac5ecb0fd8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 11 Oct 2016 09:44:36 +0200 Subject: [PATCH] toolbar: Remove button-relief style property And in turn also public API to set the button relief on the toolbar as well as the vfunc from GtkToolShell. --- docs/reference/gtk/gtk4-sections.txt | 3 -- gtk/gtkmenutoolbutton.c | 3 -- gtk/gtktoolbar.c | 71 ---------------------------- gtk/gtktoolbar.h | 2 - gtk/gtktoolbutton.c | 3 -- gtk/gtktoolitem.c | 29 ------------ gtk/gtktoolitem.h | 2 - gtk/gtktoolshell.c | 27 ----------- gtk/gtktoolshell.h | 4 -- 9 files changed, 144 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 04ee86730c..3aafca518e 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -3769,7 +3769,6 @@ GtkToolShellIface gtk_tool_shell_get_ellipsize_mode gtk_tool_shell_get_icon_size gtk_tool_shell_get_orientation -gtk_tool_shell_get_relief_style gtk_tool_shell_get_style gtk_tool_shell_get_text_alignment gtk_tool_shell_get_text_orientation @@ -3803,7 +3802,6 @@ gtk_toolbar_unset_icon_size gtk_toolbar_get_show_arrow gtk_toolbar_get_style gtk_toolbar_get_icon_size -gtk_toolbar_get_relief_style gtk_toolbar_set_style gtk_toolbar_set_icon_size @@ -3845,7 +3843,6 @@ gtk_tool_item_get_ellipsize_mode gtk_tool_item_get_icon_size gtk_tool_item_get_orientation gtk_tool_item_get_toolbar_style -gtk_tool_item_get_relief_style gtk_tool_item_get_text_alignment gtk_tool_item_get_text_orientation gtk_tool_item_retrieve_proxy_menu_item diff --git a/gtk/gtkmenutoolbutton.c b/gtk/gtkmenutoolbutton.c index b9f40b8b8e..23aedb081a 100644 --- a/gtk/gtkmenutoolbutton.c +++ b/gtk/gtkmenutoolbutton.c @@ -169,9 +169,6 @@ gtk_menu_tool_button_construct_contents (GtkMenuToolButton *button) gtk_container_add (GTK_CONTAINER (button), priv->box); gtk_widget_show_all (priv->box); - gtk_button_set_relief (GTK_BUTTON (priv->arrow_button), - gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (button))); - gtk_widget_queue_resize (GTK_WIDGET (button)); } diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index bff0abe41d..1e7c5506e9 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -252,7 +252,6 @@ static gboolean gtk_toolbar_arrow_button_press (GtkWidget *button, GtkToolbar *toolbar); static void gtk_toolbar_arrow_button_clicked (GtkWidget *button, GtkToolbar *toolbar); -static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar); static gboolean gtk_toolbar_popup_menu (GtkWidget *toolbar); static void gtk_toolbar_reconfigured (GtkToolbar *toolbar); @@ -277,7 +276,6 @@ static gboolean gtk_toolbar_render (GtkCssGadget *gadget, int height, gpointer data); -static GtkReliefStyle get_button_relief (GtkToolbar *toolbar); static gint get_max_child_expand (GtkToolbar *toolbar); /* methods on ToolbarContent 'class' */ @@ -339,7 +337,6 @@ static void toolbar_tool_shell_iface_init (GtkToolShellIface static GtkIconSize toolbar_get_icon_size (GtkToolShell *shell); static GtkOrientation toolbar_get_orientation (GtkToolShell *shell); static GtkToolbarStyle toolbar_get_style (GtkToolShell *shell); -static GtkReliefStyle toolbar_get_relief_style (GtkToolShell *shell); static void toolbar_rebuild_menu (GtkToolShell *shell); @@ -601,14 +598,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass) G_MAXINT, GTK_PARAM_READABLE)); - gtk_widget_class_install_style_property (widget_class, - g_param_spec_enum ("button-relief", - P_("Button relief"), - P_("Type of bevel around toolbar buttons"), - GTK_TYPE_RELIEF_STYLE, - GTK_RELIEF_NONE, - GTK_PARAM_READABLE)); - binding_set = gtk_binding_set_by_class (klass); add_arrow_bindings (binding_set, GDK_KEY_Left, GTK_DIR_LEFT); @@ -641,7 +630,6 @@ 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; } @@ -679,8 +667,6 @@ gtk_toolbar_init (GtkToolbar *toolbar) G_CALLBACK (gtk_toolbar_arrow_button_press), toolbar); g_signal_connect (priv->arrow_button, "clicked", G_CALLBACK (gtk_toolbar_arrow_button_clicked), toolbar); - gtk_button_set_relief (GTK_BUTTON (priv->arrow_button), - get_button_relief (toolbar)); gtk_widget_set_focus_on_click (priv->arrow_button, FALSE); @@ -1801,22 +1787,6 @@ gtk_toolbar_size_allocate (GtkWidget *widget, gtk_widget_set_clip (widget, &clip); } -static void -gtk_toolbar_update_button_relief (GtkToolbar *toolbar) -{ - GtkToolbarPrivate *priv = toolbar->priv; - GtkReliefStyle relief; - - relief = get_button_relief (toolbar); - - if (relief != gtk_button_get_relief (GTK_BUTTON (priv->arrow_button))) - { - gtk_toolbar_reconfigured (toolbar); - - gtk_button_set_relief (GTK_BUTTON (priv->arrow_button), relief); - } -} - static void gtk_toolbar_style_updated (GtkWidget *widget) { @@ -1826,7 +1796,6 @@ gtk_toolbar_style_updated (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->style_updated (widget); priv->max_homogeneous_pixels = -1; - gtk_toolbar_update_button_relief (GTK_TOOLBAR (widget)); } static GList * @@ -2876,25 +2845,6 @@ gtk_toolbar_get_icon_size (GtkToolbar *toolbar) return toolbar->priv->icon_size; } -/** - * gtk_toolbar_get_relief_style: - * @toolbar: a #GtkToolbar - * - * Returns the relief style of buttons on @toolbar. See - * gtk_button_set_relief(). - * - * Returns: The relief style of buttons on @toolbar. - * - * Since: 2.4 - **/ -GtkReliefStyle -gtk_toolbar_get_relief_style (GtkToolbar *toolbar) -{ - g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_RELIEF_NONE); - - return get_button_relief (toolbar); -} - /** * gtk_toolbar_set_show_arrow: * @toolbar: a #GtkToolbar @@ -3473,21 +3423,6 @@ toolbar_content_show_all (ToolbarContent *content) gtk_widget_show_all (widget); } -/* - * Getters - */ -static GtkReliefStyle -get_button_relief (GtkToolbar *toolbar) -{ - GtkReliefStyle button_relief = GTK_RELIEF_NORMAL; - - gtk_widget_style_get (GTK_WIDGET (toolbar), - "button-relief", &button_relief, - NULL); - - return button_relief; -} - static gint get_max_child_expand (GtkToolbar *toolbar) { @@ -3570,12 +3505,6 @@ toolbar_get_style (GtkToolShell *shell) return priv->style; } -static GtkReliefStyle -toolbar_get_relief_style (GtkToolShell *shell) -{ - return get_button_relief (GTK_TOOLBAR (shell)); -} - static void toolbar_rebuild_menu (GtkToolShell *shell) { diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h index 9937579297..73174f2dba 100644 --- a/gtk/gtktoolbar.h +++ b/gtk/gtktoolbar.h @@ -136,8 +136,6 @@ void gtk_toolbar_set_icon_size (GtkToolbar *toolbar, GDK_AVAILABLE_IN_ALL void gtk_toolbar_unset_icon_size (GtkToolbar *toolbar); -GDK_AVAILABLE_IN_ALL -GtkReliefStyle gtk_toolbar_get_relief_style (GtkToolbar *toolbar); GDK_AVAILABLE_IN_ALL gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar, gint x, diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c index 019a8e3889..22eec7ec68 100644 --- a/gtk/gtktoolbutton.c +++ b/gtk/gtktoolbutton.c @@ -584,9 +584,6 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item) if (box) gtk_widget_show (box); - gtk_button_set_relief (GTK_BUTTON (button->priv->button), - gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (button))); - gtk_tool_item_rebuild_menu (tool_item); gtk_widget_queue_resize (GTK_WIDGET (button)); diff --git a/gtk/gtktoolitem.c b/gtk/gtktoolitem.c index f963553e65..5569553851 100644 --- a/gtk/gtktoolitem.c +++ b/gtk/gtktoolitem.c @@ -242,7 +242,6 @@ gtk_tool_item_class_init (GtkToolItemClass *klass) * - gtk_tool_shell_get_orientation() * - gtk_tool_shell_get_style() * - gtk_tool_shell_get_icon_size() - * - gtk_tool_shell_get_relief_style() * to find out what the toolbar should look like and change * themselves accordingly. **/ @@ -792,34 +791,6 @@ gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item) return gtk_tool_shell_get_style (GTK_TOOL_SHELL (parent)); } -/** - * gtk_tool_item_get_relief_style: - * @tool_item: a #GtkToolItem - * - * Returns the relief style of @tool_item. See gtk_button_set_relief(). - * Custom subclasses of #GtkToolItem should call this function in the handler - * of the #GtkToolItem::toolbar_reconfigured signal to find out the - * relief style of buttons. - * - * Returns: a #GtkReliefStyle indicating the relief style used - * for @tool_item. - * - * Since: 2.4 - **/ -GtkReliefStyle -gtk_tool_item_get_relief_style (GtkToolItem *tool_item) -{ - GtkWidget *parent; - - g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_RELIEF_NONE); - - parent = gtk_widget_get_parent (GTK_WIDGET (tool_item)); - if (!parent || !GTK_IS_TOOL_SHELL (parent)) - return GTK_RELIEF_NONE; - - return gtk_tool_shell_get_relief_style (GTK_TOOL_SHELL (parent)); -} - /** * gtk_tool_item_get_text_alignment: * @tool_item: a #GtkToolItem: diff --git a/gtk/gtktoolitem.h b/gtk/gtktoolitem.h index 4f2436472e..9a24c8813e 100644 --- a/gtk/gtktoolitem.h +++ b/gtk/gtktoolitem.h @@ -133,8 +133,6 @@ GtkOrientation gtk_tool_item_get_orientation (GtkToolItem *tool_item); GDK_AVAILABLE_IN_ALL GtkToolbarStyle gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item); GDK_AVAILABLE_IN_ALL -GtkReliefStyle gtk_tool_item_get_relief_style (GtkToolItem *tool_item); -GDK_AVAILABLE_IN_ALL gfloat gtk_tool_item_get_text_alignment (GtkToolItem *tool_item); GDK_AVAILABLE_IN_ALL GtkOrientation gtk_tool_item_get_text_orientation (GtkToolItem *tool_item); diff --git a/gtk/gtktoolshell.c b/gtk/gtktoolshell.c index 7dae16e7cd..104aa6c339 100644 --- a/gtk/gtktoolshell.c +++ b/gtk/gtktoolshell.c @@ -44,7 +44,6 @@ typedef GtkToolShellIface GtkToolShellInterface; G_DEFINE_INTERFACE (GtkToolShell, gtk_tool_shell, GTK_TYPE_WIDGET); -static GtkReliefStyle gtk_tool_shell_real_get_relief_style (GtkToolShell *shell); static GtkOrientation gtk_tool_shell_real_get_text_orientation (GtkToolShell *shell); static gfloat gtk_tool_shell_real_get_text_alignment (GtkToolShell *shell); static PangoEllipsizeMode gtk_tool_shell_real_get_ellipsize_mode (GtkToolShell *shell); @@ -52,18 +51,11 @@ static PangoEllipsizeMode gtk_tool_shell_real_get_ellipsize_mode (GtkToolShell * static void gtk_tool_shell_default_init (GtkToolShellInterface *iface) { - iface->get_relief_style = gtk_tool_shell_real_get_relief_style; iface->get_text_orientation = gtk_tool_shell_real_get_text_orientation; iface->get_text_alignment = gtk_tool_shell_real_get_text_alignment; iface->get_ellipsize_mode = gtk_tool_shell_real_get_ellipsize_mode; } -static GtkReliefStyle -gtk_tool_shell_real_get_relief_style (GtkToolShell *shell) -{ - return GTK_RELIEF_NONE; -} - static GtkOrientation gtk_tool_shell_real_get_text_orientation (GtkToolShell *shell) { @@ -136,25 +128,6 @@ gtk_tool_shell_get_style (GtkToolShell *shell) return GTK_TOOL_SHELL_GET_IFACE (shell)->get_style (shell); } -/** - * gtk_tool_shell_get_relief_style: - * @shell: a #GtkToolShell - * - * Returns the relief style of buttons on @shell. Tool items must not call this - * function directly, but rely on gtk_tool_item_get_relief_style() instead. - * - * Returns: The relief style of buttons on @shell. - * - * Since: 2.14 - **/ -GtkReliefStyle -gtk_tool_shell_get_relief_style (GtkToolShell *shell) -{ - GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell); - - return iface->get_relief_style (shell); -} - /** * gtk_tool_shell_rebuild_menu: * @shell: a #GtkToolShell diff --git a/gtk/gtktoolshell.h b/gtk/gtktoolshell.h index c57699a403..561a77a360 100644 --- a/gtk/gtktoolshell.h +++ b/gtk/gtktoolshell.h @@ -46,7 +46,6 @@ typedef struct _GtkToolShellIface GtkToolShellIface; * @get_icon_size: mandatory implementation of gtk_tool_shell_get_icon_size(). * @get_orientation: mandatory implementation of gtk_tool_shell_get_orientation(). * @get_style: mandatory implementation of gtk_tool_shell_get_style(). - * @get_relief_style: optional implementation of gtk_tool_shell_get_relief_style(). * @rebuild_menu: optional implementation of gtk_tool_shell_rebuild_menu(). * @get_text_orientation: optional implementation of gtk_tool_shell_get_text_orientation(). * @get_text_alignment: optional implementation of gtk_tool_shell_get_text_alignment(). @@ -64,7 +63,6 @@ struct _GtkToolShellIface GtkIconSize (*get_icon_size) (GtkToolShell *shell); GtkOrientation (*get_orientation) (GtkToolShell *shell); GtkToolbarStyle (*get_style) (GtkToolShell *shell); - GtkReliefStyle (*get_relief_style) (GtkToolShell *shell); void (*rebuild_menu) (GtkToolShell *shell); GtkOrientation (*get_text_orientation) (GtkToolShell *shell); gfloat (*get_text_alignment) (GtkToolShell *shell); @@ -82,8 +80,6 @@ GtkOrientation gtk_tool_shell_get_orientation (GtkToolShell *shell); GDK_AVAILABLE_IN_ALL GtkToolbarStyle gtk_tool_shell_get_style (GtkToolShell *shell); GDK_AVAILABLE_IN_ALL -GtkReliefStyle gtk_tool_shell_get_relief_style (GtkToolShell *shell); -GDK_AVAILABLE_IN_ALL void gtk_tool_shell_rebuild_menu (GtkToolShell *shell); GDK_AVAILABLE_IN_ALL GtkOrientation gtk_tool_shell_get_text_orientation (GtkToolShell *shell);