[devhelp] Window: use a GPropertyAction for win.gear-menu
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] Window: use a GPropertyAction for win.gear-menu
- Date: Sun, 28 Jan 2018 19:46:56 +0000 (UTC)
commit 50c8b35e93e7105138f1e9ee0f42dabe78e8797e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Jan 28 20:38:13 2018 +0100
Window: use a GPropertyAction for win.gear-menu
The previous implementation was strange, I think it relied on an
undocumented feature of GtkMenuButton (how it implements the
GtkActionable interface).
By creating a GPropertyAction on the GtkToggleButton:active property,
it's self-documented, there is less magic going on.
src/dh-window.c | 9 ++++++---
src/dh-window.ui | 1 -
2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index ef292e7..2cb7e3c 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -444,9 +444,6 @@ add_action_entries (DhWindow *window)
/* Go */
{ "go-back", go_back_cb },
{ "go-forward", go_forward_cb },
-
- /* Menu */
- { "gear-menu", NULL, NULL, "false" },
};
g_action_map_add_action_entries (G_ACTION_MAP (window),
@@ -459,6 +456,12 @@ add_action_entries (DhWindow *window)
"visible");
g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (property_action));
g_object_unref (property_action);
+
+ property_action = g_property_action_new ("gear-menu",
+ priv->gear_menu_button,
+ "active");
+ g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (property_action));
+ g_object_unref (property_action);
}
static void
diff --git a/src/dh-window.ui b/src/dh-window.ui
index b2ca2f7..c2635b5 100644
--- a/src/dh-window.ui
+++ b/src/dh-window.ui
@@ -162,7 +162,6 @@
<property name="visible">True</property>
<property name="valign">center</property>
<property name="can_focus">False</property>
- <property name="action_name">win.gear-menu</property>
<property name="menu_model">gear_menu</property>
<property name="use_popover">True</property>
<style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]