[balsa/gtk4: 54/105] address-book-config: Add action-entries in helper
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4: 54/105] address-book-config: Add action-entries in helper
- Date: Thu, 24 Sep 2020 19:49:47 +0000 (UTC)
commit 4ba4bbac6e8bb6eee121abce28c48773cdea2441
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Jun 24 16:45:06 2020 -0400
address-book-config: Add action-entries in helper
src/address-book-config.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/src/address-book-config.c b/src/address-book-config.c
index 832cf7a8b..685fee9f0 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -945,14 +945,13 @@ add_osmo_cb(GSimpleAction *action,
}
#endif /* HAVE_OSMO */
-GMenuModel *
-balsa_address_book_add_menu(BalsaAddressBookCallback callback,
- GtkWindow *parent)
+static void
+add_actions(GtkWidget *widget,
+ const gchar *action_namespace,
+ gpointer user_data)
{
- AddressBookConfig *abc;
GSimpleActionGroup *simple;
- GMenu *menu;
- static const GActionEntry address_book_entries[] = {
+ static const GActionEntry entries[] = {
{"add-vcard", add_vcard_cb},
{"add-externq", add_externq_cb},
{"add-ldif", add_ldif_cb},
@@ -970,20 +969,30 @@ balsa_address_book_add_menu(BalsaAddressBookCallback callback,
#endif /* HAVE_OSMO */
};
+ simple = g_simple_action_group_new();
+ g_action_map_add_action_entries(G_ACTION_MAP(simple),
+ entries,
+ G_N_ELEMENTS(entries),
+ user_data);
+ gtk_widget_insert_action_group(widget,
+ action_namespace,
+ G_ACTION_GROUP(simple));
+ g_object_unref(simple);
+}
+
+GMenuModel *
+balsa_address_book_add_menu(BalsaAddressBookCallback callback,
+ GtkWindow *parent)
+{
+ AddressBookConfig *abc;
+ GMenu *menu;
+
abc = g_new0(AddressBookConfig, 1);
abc->callback = callback;
abc->parent = parent;
g_object_weak_ref(G_OBJECT(parent), (GWeakNotify) g_free, abc);
- simple = g_simple_action_group_new();
- g_action_map_add_action_entries(G_ACTION_MAP(simple),
- address_book_entries,
- G_N_ELEMENTS(address_book_entries),
- abc);
- gtk_widget_insert_action_group(GTK_WIDGET(parent),
- "address-book",
- G_ACTION_GROUP(simple));
- g_object_unref(simple);
+ add_actions(GTK_WIDGET(parent), "address-book", abc);
menu = g_menu_new();
g_menu_append(menu, _("vCard Address Book (GnomeCard)"), "address-book.add-vcard");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]