[balsa/gtk4: 236/286] mailbox-node: Build with gtk4




commit 4d14bb1ed603d1646b002e3d0e0dec900eeccd90
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Oct 27 16:43:56 2020 -0400

    mailbox-node: Build with gtk4
    
    gtk_widget_get_action_group has been removed, so we pass it in the
    BalsaMailboxNode object.

 src/mailbox-node.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/mailbox-node.c b/src/mailbox-node.c
index 9f429f00d..bec22d10e 100644
--- a/src/mailbox-node.c
+++ b/src/mailbox-node.c
@@ -104,6 +104,7 @@ struct _BalsaMailboxNode {
 
     GtkWidget *context_menu;
     GtkWidget *relative_to;
+    GActionMap *action_map;
 
     unsigned subscribed:1;     /* Used only by remote */
     unsigned list_inbox:1;     /* Used only by remote */
@@ -167,6 +168,8 @@ balsa_mailbox_node_dispose(GObject * object)
        mn->mailbox = NULL;
     }
 
+    g_clear_object(&mn->action_map);
+
     G_OBJECT_CLASS(balsa_mailbox_node_parent_class)->dispose(object);
 }
 
@@ -961,19 +964,14 @@ static void
 context_menu_set_enabled(BalsaMailboxNode *mbnode)
 {
     gboolean is_open;
-    GActionGroup *action_group;
-    GActionMap *action_map;
     GAction *action;
 
-    action_group = gtk_widget_get_action_group(mbnode->relative_to, "mbnode");
-    action_map = G_ACTION_MAP(action_group);
-
     is_open = MAILBOX_OPEN(mbnode->mailbox);
 
-    action = g_action_map_lookup_action(action_map, "open");
+    action = g_action_map_lookup_action(mbnode->action_map, "open");
     g_simple_action_set_enabled(G_SIMPLE_ACTION(action), !is_open);
 
-    action = g_action_map_lookup_action(action_map, "close");
+    action = g_action_map_lookup_action(mbnode->action_map, "close");
     g_simple_action_set_enabled(G_SIMPLE_ACTION(action), is_open);
 }
 
@@ -1105,7 +1103,7 @@ create_context_menu(BalsaMailboxNode *mbnode,
     gtk_widget_insert_action_group(GTK_WIDGET(relative_to),
                                    "mbnode",
                                    G_ACTION_GROUP(simple));
-    g_object_unref(simple);
+    mbnode->action_map = G_ACTION_MAP(simple);
 
     menu = g_menu_new();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]