[balsa/popover: 28/28] Various: Be more systematic when making GMenu s
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/popover: 28/28] Various: Be more systematic when making GMenu s
- Date: Thu, 21 May 2020 01:45:57 +0000 (UTC)
commit e4d5a07cf6a6605e4d97098bfbd68ecdafbf2839
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue May 19 14:43:42 2020 -0400
Various: Be more systematic when making GMenu s
Put all items in sections when there are any sections.
libbalsa/libbalsa-vfs.c | 1 +
src/ab-main.c | 7 +++----
src/balsa-index.c | 19 ++++++++++++-------
src/balsa-mblist.c | 28 +++++++++++++++++-----------
4 files changed, 33 insertions(+), 22 deletions(-)
---
diff --git a/libbalsa/libbalsa-vfs.c b/libbalsa/libbalsa-vfs.c
index ddcb74be7..06dd87e58 100644
--- a/libbalsa/libbalsa-vfs.c
+++ b/libbalsa/libbalsa-vfs.c
@@ -636,6 +636,7 @@ gio_add_vfs_menu_item(GMenu *menu,
g_menu_item_set_action_and_target(menu_item, action, "s", name);
g_menu_append_item(menu, menu_item);
+ g_object_unref(menu_item);
}
diff --git a/src/ab-main.c b/src/ab-main.c
index a74b2929a..515a3c4fa 100644
--- a/src/ab-main.c
+++ b/src/ab-main.c
@@ -274,7 +274,6 @@ set_address_book_menu_items(void)
LibBalsaAddressBook *address_book = l->data;
const gchar *name;
gchar *label;
- gchar *detailed_action;
gchar *accel;
GMenuItem *item;
@@ -284,11 +283,11 @@ set_address_book_menu_items(void)
name = libbalsa_address_book_get_name(address_book);
label = g_strdup_printf("_%d:%s", ++pos, name);
- detailed_action = g_strdup_printf("win.address-book::%s", name);
- item = g_menu_item_new(label, detailed_action);
- g_free(detailed_action);
+ item = g_menu_item_new(label, NULL);
g_free(label);
+ g_menu_item_set_action_and_target(item, "win.address-book", "s", name);
+
accel = g_strdup_printf("<Primary>%d", pos);
g_menu_item_set_attribute(item, "accel", "s", accel);
g_free(accel);
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 1f83da40f..6c329d1ce 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -1954,13 +1954,18 @@ bndx_popup_menu_create(BalsaIndex * bindex)
menu = g_menu_new();
/* this is an invariable part of the context message menu. */
- g_menu_append(menu, _("_Reply…"), "popup.reply");
- g_menu_append(menu, _("Reply To _All…"), "popup.reply-to-all");
- g_menu_append(menu, _("Reply To _Group…"), "popup.reply-to-group");
- g_menu_append(menu, _("_Forward Attached…"), "popup.forward-attached");
- g_menu_append(menu, _("Forward _Inline…"), "popup.forward-inline");
- g_menu_append(menu, _("_Pipe through…"), "popup.pipe");
- g_menu_append(menu, _("_Store Address…"), "popup.store-address");
+ section = g_menu_new();
+
+ g_menu_append(section, _("_Reply…"), "popup.reply");
+ g_menu_append(section, _("Reply To _All…"), "popup.reply-to-all");
+ g_menu_append(section, _("Reply To _Group…"), "popup.reply-to-group");
+ g_menu_append(section, _("_Forward Attached…"), "popup.forward-attached");
+ g_menu_append(section, _("Forward _Inline…"), "popup.forward-inline");
+ g_menu_append(section, _("_Pipe through…"), "popup.pipe");
+ g_menu_append(section, _("_Store Address…"), "popup.store-address");
+
+ g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
+ g_object_unref(section);
/* items that are insensitive for a read-only mailbox */
section = g_menu_new();
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index d3d446435..8a295fb31 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -1681,37 +1681,43 @@ balsa_mblist_mru_menu(GList ** url_list,
const gchar *action)
{
GMenu *menu;
- GMenu *other_menu;
+ GMenu *section;
GList *list;
- GMenuItem *other_item;
+ GMenuItem *item;
g_return_val_if_fail(url_list != NULL, NULL);
g_return_val_if_fail(action != NULL, NULL);
menu = g_menu_new();
+
+ section = g_menu_new();
+
for (list = *url_list; list != NULL; list = list->next) {
gchar *url = list->data;
LibBalsaMailbox *mailbox = balsa_find_mailbox_by_url(url);
if (mailbox != NULL) {
const gchar *name = libbalsa_mailbox_get_name(mailbox);
- GMenuItem *item;
item = g_menu_item_new(name, NULL);
g_menu_item_set_action_and_target(item, action, "s", url);
- g_menu_append_item(menu, item);
+ g_menu_append_item(section, item);
g_object_unref(item);
}
}
- other_item = g_menu_item_new(_("_Other…"), NULL);
- g_menu_item_set_action_and_target(other_item, action, "s", "");
- other_menu = g_menu_new();
- g_menu_append_item(other_menu, other_item);
- g_object_unref(other_item);
+ g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
+ g_object_unref(section);
+
+ section = g_menu_new();
+
+ item = g_menu_item_new(_("_Other…"), NULL);
+ g_menu_item_set_action_and_target(item, action, "s", "");
+ g_menu_append_item(section, item);
+ g_object_unref(item);
- g_menu_append_section(menu, NULL, G_MENU_MODEL(other_menu));
- g_object_unref(other_menu);
+ g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
+ g_object_unref(section);
return menu;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]