[gtk/wip/exalm/buttons: 29/32] menubutton: Reset label when setting icon name and vice versa
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/exalm/buttons: 29/32] menubutton: Reset label when setting icon name and vice versa
- Date: Thu, 24 Jun 2021 18:14:03 +0000 (UTC)
commit 76df60db2bb8e817aced4876b0d2786c4dea3cce
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Jun 21 14:08:14 2021 +0500
menubutton: Reset label when setting icon name and vice versa
Match GtkButton.
gtk/gtkmenubutton.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 6c9a624831..d27bb4f393 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -843,8 +843,16 @@ gtk_menu_button_set_icon_name (GtkMenuButton *menu_button,
{
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
+ g_object_freeze_notify (G_OBJECT (menu_button));
+
+ if (gtk_menu_button_get_label (menu_button))
+ g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_LABEL]);
+
gtk_button_set_icon_name (GTK_BUTTON (menu_button->button), icon_name);
+
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_ICON_NAME]);
+
+ g_object_thaw_notify (G_OBJECT (menu_button));
}
/**
@@ -880,6 +888,11 @@ gtk_menu_button_set_label (GtkMenuButton *menu_button,
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
+ g_object_freeze_notify (G_OBJECT (menu_button));
+
+ if (gtk_menu_button_get_icon_name (menu_button))
+ g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_ICON_NAME]);
+
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
label_widget = gtk_label_new (label);
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
@@ -897,6 +910,8 @@ gtk_menu_button_set_label (GtkMenuButton *menu_button,
menu_button->label_widget = label_widget;
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_LABEL]);
+
+ g_object_thaw_notify (G_OBJECT (menu_button));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]