From b22c707741f2e5e82e4e2c4c839023fb43d1a5e7 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Wed, 7 Dec 2005 17:14:07 +0000 Subject: [PATCH] If the toolbar mode is ICONS and there is no icon set then show the label, and vice versa (#322019) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ docs/reference/gtk/tmpl/gtkenums.sgml | 4 +++- gtk/gtktoolbutton.c | 16 ++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 587c4ea867..218b8bd00b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-12-07 Ross Burton + + * docs/reference/gtk/tmpl/gtkenums.sgml: + * gtk/gtktoolbutton.c: + If the toolbar mode is ICONS and there is no icon set then show + the label, and vice versa (#322019) + 2005-12-07 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_key_press): Use the correct diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 587c4ea867..218b8bd00b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2005-12-07 Ross Burton + + * docs/reference/gtk/tmpl/gtkenums.sgml: + * gtk/gtktoolbutton.c: + If the toolbar mode is ICONS and there is no icon set then show + the label, and vice versa (#322019) + 2005-12-07 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_key_press): Use the correct diff --git a/docs/reference/gtk/tmpl/gtkenums.sgml b/docs/reference/gtk/tmpl/gtkenums.sgml index 334fa5812d..5d95c5eee3 100644 --- a/docs/reference/gtk/tmpl/gtkenums.sgml +++ b/docs/reference/gtk/tmpl/gtkenums.sgml @@ -410,7 +410,9 @@ Indicates the direction a sub-menu will appear. Used to customize the appearance of a #GtkToolbar. Note that setting the toolbar style overrides the user's preferences -for the default toolbar style. +for the default toolbar style. Note that if the button has only +a label set and GTK_TOOLBAR_ICONS is used, the label will be +visible, and vice versa. @GTK_TOOLBAR_ICONS: Buttons display only icons in the toolbar. diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c index c7c075110b..7c06409f35 100644 --- a/gtk/gtktoolbutton.c +++ b/gtk/gtktoolbutton.c @@ -317,6 +317,22 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item) { need_label = TRUE; } + + if (style == GTK_TOOLBAR_ICONS && button->priv->icon_widget == NULL && + button->priv->stock_id == NULL && button->priv->icon_name == NULL) + { + need_label = TRUE; + need_icon = FALSE; + style = GTK_TOOLBAR_TEXT; + } + + if (style == GTK_TOOLBAR_TEXT && button->priv->label_widget == NULL && + button->priv->stock_id == NULL && button->priv->label_text == NULL) + { + need_label = FALSE; + need_icon = TRUE; + style = GTK_TOOLBAR_ICONS; + } if (need_label) {