[gtk+/wip/baedert/drawing: 356/371] modelmenuitem: Set label on menu items
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 356/371] modelmenuitem: Set label on menu items
- Date: Sun, 16 Jul 2017 15:51:45 +0000 (UTC)
commit 50f31b1c7e062118b1dd51d26c5ddbf7ffccdb8b
Author: Timm Bäder <mail baedert org>
Date: Wed Jul 12 08:09:04 2017 +0200
modelmenuitem: Set label on menu items
We have to add a check for GTK_IS_ACCEL_LABEL too now...
gtk/gtkaccellabel.c | 2 +-
gtk/gtkmenuitem.c | 3 +++
gtk/gtkmenushell.c | 4 ----
gtk/gtkmodelmenuitem.c | 5 +++++
4 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 8eac6d5..520c2a5 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -995,7 +995,7 @@ gtk_accel_label_set_label (GtkAccelLabel *accel_label,
g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label));
- gtk_label_set_label (GTK_LABEL (priv->text_label), text);
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->text_label), text);
}
const char *
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 1dfdef0..5680bc8 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1923,6 +1923,9 @@ gtk_menu_item_get_use_underline (GtkMenuItem *menu_item)
child = gtk_bin_get_child (GTK_BIN (menu_item));
if (GTK_IS_LABEL (child))
return gtk_label_get_use_underline (GTK_LABEL (child));
+ else if (GTK_IS_ACCEL_LABEL (child))
+ return gtk_accel_label_get_use_underline (GTK_ACCEL_LABEL (child));
+
return FALSE;
}
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index f49bb44..c99c470 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -1813,8 +1813,6 @@ gtk_menu_shell_tracker_insert_func (GtkMenuTrackerItem *item,
label = gtk_menu_tracker_item_get_label (item);
if (label)
gtk_menu_item_set_label (GTK_MENU_ITEM (widget), label);
-
- gtk_widget_show (widget);
}
else if (gtk_menu_tracker_item_get_has_link (item, G_MENU_LINK_SUBMENU))
{
@@ -1852,8 +1850,6 @@ gtk_menu_shell_tracker_insert_func (GtkMenuTrackerItem *item,
g_signal_connect (submenu, "hide", G_CALLBACK (gtk_menu_shell_submenu_hidden), item);
g_signal_connect (submenu, "selection-done", G_CALLBACK (gtk_menu_shell_submenu_selection_done),
item);
}
-
- gtk_widget_show (widget);
}
else
{
diff --git a/gtk/gtkmodelmenuitem.c b/gtk/gtkmodelmenuitem.c
index 0083452..1d4a5d4 100644
--- a/gtk/gtkmodelmenuitem.c
+++ b/gtk/gtkmodelmenuitem.c
@@ -252,6 +252,11 @@ gtk_model_menu_item_set_text (GtkModelMenuItem *item,
gtk_label_set_text_with_mnemonic (GTK_LABEL (child), text);
return;
}
+ else if (GTK_IS_ACCEL_LABEL (child))
+ {
+ gtk_accel_label_set_label (GTK_ACCEL_LABEL (child), text);
+ return;
+ }
if (!GTK_IS_CONTAINER (child))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]