From 8c307acb3c043645580c7a613c85fd0a5f019d49 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Fri, 24 Aug 2012 18:49:03 +0200 Subject: Don't spam debug messages --- src/messages-service.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/messages-service.c') diff --git a/src/messages-service.c b/src/messages-service.c index 407b8ba..db7a8d7 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -313,7 +313,6 @@ change_status_action (GSimpleAction *action, g_str_equal (status, "offline")); if (!g_action_state_equal (G_ACTION (action), value)) { - g_message ("%s", status); g_simple_action_set_state (action, value); indicator_messages_service_emit_status_changed (messages_service, status); } -- cgit v1.2.3 From ca5c4991f7815f9b5190b370bfa70c651facaf72 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Sat, 25 Aug 2012 16:38:19 +0200 Subject: Plug memory leaks: return value of g_menu_model_get_item_link is transfer full --- src/messages-service.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/messages-service.c') diff --git a/src/messages-service.c b/src/messages-service.c index db7a8d7..31d2a5b 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -134,6 +134,8 @@ uses_chat_status_changed (GObject *object, if (show_chat) g_menu_insert_section (menu, 0, NULL, chat_section); } + + g_object_unref (first_section); } static AppSection * -- cgit v1.2.3 From fab67a704ed6f189014a1988e641194e0f4babb1 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Mon, 27 Aug 2012 15:38:04 +0200 Subject: Show icons on status menu items This introduces IdoMenuItem, a GtkCheckMenuItem that can also show icons. This should go into libido at some point. Also, Im{App,Source}MenuItem could derive from it so that the GMenuItem-setting logic is only in one place. --- src/messages-service.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/messages-service.c') diff --git a/src/messages-service.c b/src/messages-service.c index 31d2a5b..15c5123 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -406,14 +406,33 @@ static GMenuModel * create_status_section (void) { GMenu *menu; + GMenuItem *item; + struct status_item { + gchar *label; + gchar *action; + gchar *icon_name; + } status_items[] = { + { _("Available"), "status::available", "user-available" }, + { _("Away"), "status::away", "user-away" }, + { _("Busy"), "status::busy", "user-busy" }, + { _("Invisible"), "status::invisible", "user-invisible" }, + { _("Offline"), "status::offline", "user-offline" } + }; + int i; menu = g_menu_new (); - g_menu_append_with_icon_name (menu, _("Available"), "user-available", "status::available"); - g_menu_append_with_icon_name (menu, _("Away"), "user-away", "status::away"); - g_menu_append_with_icon_name (menu, _("Busy"), "user-busy", "status::busy"); - g_menu_append_with_icon_name (menu, _("Invisible"), "user-invisible", "status::invisible"); - g_menu_append_with_icon_name (menu, _("Offline"), "user-offline", "status::offline"); + item = g_menu_item_new (NULL, NULL); + g_menu_item_set_attribute (item, "x-canonical-type", "s", "IdoMenuItem"); + + for (i = 0; i < G_N_ELEMENTS (status_items); i++) { + g_menu_item_set_label (item, status_items[i].label); + g_menu_item_set_detailed_action (item, status_items[i].action); + g_menu_item_set_attribute (item, "x-canonical-icon", "s", status_items[i].icon_name); + g_menu_append_item (menu, item); + } + + g_object_unref (item); return G_MENU_MODEL (menu); } -- cgit v1.2.3