aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/com.canonical.indicator.messages.application.xml4
-rw-r--r--libmessaging-menu/messaging-menu-app.c21
-rw-r--r--src/im-application-list.c266
-rw-r--r--src/im-phone-menu.c79
-rw-r--r--src/im-phone-menu.h14
5 files changed, 302 insertions, 82 deletions
diff --git a/common/com.canonical.indicator.messages.application.xml b/common/com.canonical.indicator.messages.application.xml
index fb9f079..552b6a4 100644
--- a/common/com.canonical.indicator.messages.application.xml
+++ b/common/com.canonical.indicator.messages.application.xml
@@ -13,6 +13,10 @@
<method name="ActivateMessage">
<arg type="s" name="message_id" direction="in" />
</method>
+ <method name="Dismiss">
+ <arg type="as" name="sources" direction="in" />
+ <arg type="as" name="messages" direction="in" />
+ </method>
<signal name="SourceAdded">
<arg type="u" name="position" direction="in" />
<arg type="(sssuxsb)" name="source" direction="in" />
diff --git a/libmessaging-menu/messaging-menu-app.c b/libmessaging-menu/messaging-menu-app.c
index 61547c5..d037da9 100644
--- a/libmessaging-menu/messaging-menu-app.c
+++ b/libmessaging-menu/messaging-menu-app.c
@@ -607,6 +607,25 @@ messaging_menu_app_activate_message (IndicatorMessagesApplication *app_interface
return TRUE;
}
+static gboolean
+messaging_menu_app_dismiss (IndicatorMessagesApplication *app_interface,
+ GDBusMethodInvocation *invocation,
+ const gchar * const *sources,
+ const gchar * const *messages,
+ gpointer user_data)
+{
+ MessagingMenuApp *app = user_data;
+ const gchar * const *it;
+
+ for (it = sources; *it; it++)
+ messaging_menu_app_remove_source_internal (app, *it);
+
+ for (it = messages; *it; it++)
+ messaging_menu_app_remove_message_internal (app, *it);
+
+ return TRUE;
+}
+
static void
messaging_menu_app_init (MessagingMenuApp *app)
{
@@ -625,6 +644,8 @@ messaging_menu_app_init (MessagingMenuApp *app)
G_CALLBACK (messaging_menu_app_list_messages), app);
g_signal_connect (app->app_interface, "handle-activate-message",
G_CALLBACK (messaging_menu_app_activate_message), app);
+ g_signal_connect (app->app_interface, "handle-dismiss",
+ G_CALLBACK (messaging_menu_app_dismiss), app);
app->messages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
diff --git a/src/im-application-list.c b/src/im-application-list.c
index 732a117..d766f24 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -23,6 +23,7 @@
#include "gactionmuxer.h"
#include <gio/gdesktopappinfo.h>
+#include <string.h>
typedef GObjectClass ImApplicationListClass;
@@ -53,8 +54,11 @@ typedef struct
{
ImApplicationList *list;
GDesktopAppInfo *info;
+ gchar *id;
IndicatorMessagesApplication *proxy;
- GSimpleActionGroup *actions;
+ GActionMuxer *actions;
+ GSimpleActionGroup *source_actions;
+ GSimpleActionGroup *message_actions;
GCancellable *cancellable;
} Application;
@@ -66,7 +70,8 @@ application_free (gpointer data)
if (!app)
return;
- g_clear_object (&app->info);
+ g_object_unref (app->info);
+ g_free (app->id);
if (app->cancellable)
{
@@ -78,12 +83,124 @@ application_free (gpointer data)
g_object_unref (app->proxy);
if (app->actions)
- g_object_unref (app->actions);
+ {
+ g_object_unref (app->actions);
+ g_object_unref (app->source_actions);
+ g_object_unref (app->message_actions);
+ }
g_slice_free (Application, app);
}
static void
+im_application_list_source_removed (Application *app,
+ const gchar *id)
+{
+ g_simple_action_group_remove (app->source_actions, id);
+
+ g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, id);
+}
+
+static void
+im_application_list_source_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ Application *app = user_data;
+ const gchar *source_id;
+
+ source_id = g_action_get_name (G_ACTION (action));
+
+ if (g_variant_get_boolean (parameter))
+ {
+ indicator_messages_application_call_activate_source (app->proxy,
+ source_id,
+ app->cancellable,
+ NULL, NULL);
+ }
+ else
+ {
+ const gchar *sources[] = { source_id, NULL };
+ const gchar *messages[] = { NULL };
+ indicator_messages_application_call_dismiss (app->proxy, sources, messages,
+ app->cancellable, NULL, NULL);
+ }
+
+ im_application_list_source_removed (app, source_id);
+}
+
+static void
+im_application_list_message_removed (Application *app,
+ const gchar *id)
+{
+ g_simple_action_group_remove (app->message_actions, id);
+
+ g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->id, id);
+}
+
+static void
+im_application_list_message_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ Application *app = user_data;
+ const gchar *message_id;
+
+ message_id = g_action_get_name (G_ACTION (action));
+
+ if (g_variant_get_boolean (parameter))
+ {
+ indicator_messages_application_call_activate_message (app->proxy,
+ message_id,
+ app->cancellable,
+ NULL, NULL);
+ }
+ else
+ {
+ const gchar *sources[] = { NULL };
+ const gchar *messages[] = { message_id, NULL };
+ indicator_messages_application_call_dismiss (app->proxy, sources, messages,
+ app->cancellable, NULL, NULL);
+ }
+
+ im_application_list_message_removed (app, message_id);
+}
+
+static void
+im_application_list_remove_all (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ ImApplicationList *list = user_data;
+ GHashTableIter iter;
+ Application *app;
+
+ g_hash_table_iter_init (&iter, list->applications);
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &app))
+ {
+ gchar **source_actions;
+ gchar **message_actions;
+ gchar **it;
+
+ source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions));
+ for (it = source_actions; *it; it++)
+ im_application_list_source_removed (app, *it);
+
+ message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions));
+ for (it = message_actions; *it; it++)
+ im_application_list_message_removed (app, *it);
+
+ indicator_messages_application_call_dismiss (app->proxy,
+ (const gchar * const *) source_actions,
+ (const gchar * const *) message_actions,
+ app->cancellable, NULL, NULL);
+
+ g_strfreev (source_actions);
+ g_strfreev (message_actions);
+ }
+}
+
+static void
im_application_list_dispose (GObject *object)
{
ImApplicationList *list = IM_APPLICATION_LIST (object);
@@ -116,7 +233,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
g_cclosure_marshal_generic,
G_TYPE_NONE,
4,
- G_TYPE_DESKTOP_APP_INFO,
+ G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
@@ -129,7 +246,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
g_cclosure_marshal_generic,
G_TYPE_NONE,
4,
- G_TYPE_DESKTOP_APP_INFO,
+ G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
@@ -142,7 +259,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
g_cclosure_marshal_generic,
G_TYPE_NONE,
2,
- G_TYPE_DESKTOP_APP_INFO,
+ G_TYPE_STRING,
G_TYPE_STRING);
signals[MESSAGE_ADDED] = g_signal_new ("message-added",
@@ -153,7 +270,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
g_cclosure_marshal_generic,
G_TYPE_NONE,
8,
- G_TYPE_DESKTOP_APP_INFO,
+ G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -170,7 +287,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
g_cclosure_marshal_generic,
G_TYPE_NONE,
2,
- G_TYPE_DESKTOP_APP_INFO,
+ G_TYPE_STRING,
G_TYPE_STRING);
signals[APP_STOPPED] = g_signal_new ("app-stopped",
@@ -181,14 +298,29 @@ im_application_list_class_init (ImApplicationListClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_DESKTOP_APP_INFO);
+ G_TYPE_STRING);
}
static void
im_application_list_init (ImApplicationList *list)
{
+ GSimpleActionGroup *actions;
+ GSimpleAction *remove_all_action;
+
list->applications = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, application_free);
list->muxer = g_action_muxer_new ();
+
+ actions = g_simple_action_group_new ();
+
+ remove_all_action = g_simple_action_new ("remove-all", NULL);
+ g_signal_connect (remove_all_action, "activate", G_CALLBACK (im_application_list_remove_all), list);
+
+ g_simple_action_group_insert (actions, G_ACTION (remove_all_action));
+
+ g_action_muxer_insert (list->muxer, NULL, G_ACTION_GROUP (actions));
+
+ g_object_unref (remove_all_action);
+ g_object_unref (actions);
}
ImApplicationList *
@@ -197,6 +329,37 @@ im_application_list_new (void)
return g_object_new (IM_TYPE_APPLICATION_LIST, NULL);
}
+static gchar *
+im_application_list_canonical_id (const gchar *id)
+{
+ gchar *str;
+ gchar *p;
+
+ str = g_strndup (id, strlen (id) - g_str_has_suffix (id, ".desktop") ? 7 : 0);
+
+ for (p = str; *p; p++)
+ {
+ if (*p == '.')
+ *p = '_';
+ }
+
+ return str;
+}
+
+static Application *
+im_application_list_lookup (ImApplicationList *list,
+ const gchar *desktop_id)
+{
+ gchar *id;
+ Application *app;
+
+ id = im_application_list_canonical_id (desktop_id);
+ app = g_hash_table_lookup (list->applications, id);
+
+ g_free (id);
+ return app;
+}
+
void
im_application_list_add (ImApplicationList *list,
const gchar *desktop_id)
@@ -208,8 +371,7 @@ im_application_list_add (ImApplicationList *list,
g_return_if_fail (IM_IS_APPLICATION_LIST (list));
g_return_if_fail (desktop_id != NULL);
- app = g_hash_table_lookup (list->applications, desktop_id);
- if (app)
+ if (im_application_list_lookup (list, desktop_id))
return;
info = g_desktop_app_info_new (desktop_id);
@@ -220,14 +382,21 @@ im_application_list_add (ImApplicationList *list,
}
id = g_app_info_get_id (G_APP_INFO (info));
+ g_return_if_fail (id != NULL);
app = g_slice_new0 (Application);
- app->list = list;
app->info = info;
- app->actions = g_simple_action_group_new ();
+ app->id = im_application_list_canonical_id (id);
+ app->list = list;
+ app->actions = g_action_muxer_new ();
+ app->source_actions = g_simple_action_group_new ();
+ app->message_actions = g_simple_action_group_new ();
+
+ g_action_muxer_insert (app->actions, "src", G_ACTION_GROUP (app->source_actions));
+ g_action_muxer_insert (app->actions, "msg", G_ACTION_GROUP (app->message_actions));
- g_hash_table_insert (list->applications, (gpointer) id, app);
- g_action_muxer_insert (list->muxer, id, G_ACTION_GROUP (app->actions));
+ g_hash_table_insert (list->applications, (gpointer) app->id, app);
+ g_action_muxer_insert (list->muxer, app->id, G_ACTION_GROUP (app->actions));
}
void
@@ -238,11 +407,11 @@ im_application_list_remove (ImApplicationList *list,
g_return_if_fail (IM_IS_APPLICATION_LIST (list));
- app = g_hash_table_lookup (list->applications, id);
+ app = im_application_list_lookup (list, id);
if (app)
{
if (app->proxy || app->cancellable)
- g_signal_emit (app->list, signals[APP_STOPPED], 0, app->info);
+ g_signal_emit (app->list, signals[APP_STOPPED], 0, app->id);
g_hash_table_remove (list->applications, id);
g_action_muxer_remove (list->muxer, id);
@@ -261,15 +430,19 @@ im_application_list_source_added (Application *app,
gint64 time;
const gchar *string;
gboolean draws_attention;
+ GVariant *state;
GSimpleAction *action;
g_variant_get (source, "(&s&s&sux&sb)",
&id, &label, &iconstr, &count, &time, &string, &draws_attention);
- action = g_simple_action_new_stateful (id, NULL, g_variant_new_uint32 (count));
- g_simple_action_group_insert (app->actions, G_ACTION (action));
+ state = g_variant_new ("(uxsb)", count, time, string, draws_attention);
+ action = g_simple_action_new_stateful (id, G_VARIANT_TYPE_BOOLEAN, state);
+ g_signal_connect (action, "activate", G_CALLBACK (im_application_list_source_activated), app);
+
+ g_simple_action_group_insert (app->source_actions, G_ACTION (action));
- g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->info, id, label, iconstr);
+ g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, iconstr);
g_object_unref (action);
}
@@ -289,19 +462,10 @@ im_application_list_source_changed (Application *app,
g_variant_get (source, "(&s&s&sux&sb)",
&id, &label, &iconstr, &count, &time, &string, &draws_attention);
- g_action_group_change_action_state (G_ACTION_GROUP (app->actions), id,
- g_variant_new_uint32 (count));
-
- g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->info, id, label, iconstr);
-}
-
-static void
-im_application_list_source_removed (Application *app,
- const gchar *id)
-{
- g_simple_action_group_remove (app->actions, id);
+ g_action_group_change_action_state (G_ACTION_GROUP (app->source_actions), id,
+ g_variant_new ("(uxsb)", count, time, string, draws_attention));
- g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->info, id);
+ g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->id, id, label, iconstr);
}
static void
@@ -347,26 +511,25 @@ im_application_list_message_added (Application *app,
gint64 time;
gboolean draws_attention;
GSimpleAction *action;
+ GIcon *app_icon;
+ gchar *app_iconstr;
g_variant_get (message, "(&s&s&s&s&sxb)",
&id, &iconstr, &title, &subtitle, &body, &time, &draws_attention);
- action = g_simple_action_new (id, NULL);
- g_simple_action_group_insert (G_SIMPLE_ACTION_GROUP (app->actions), G_ACTION (action));
+ app_icon = g_app_info_get_icon (G_APP_INFO (app->info));
+ app_iconstr = app_icon ? g_icon_to_string (app_icon) : NULL;
- g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
- app->info, id, iconstr, title, subtitle, body, time, draws_attention);
+ action = g_simple_action_new (id, G_VARIANT_TYPE_BOOLEAN);
+ g_signal_connect (action, "activate", G_CALLBACK (im_application_list_message_activated), app);
- g_object_unref (action);
-}
+ g_simple_action_group_insert (app->message_actions, G_ACTION (action));
-static void
-im_application_list_message_removed (Application *app,
- const gchar *id)
-{
- g_simple_action_group_remove (app->actions, id);
+ g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
+ app->id, app_iconstr, id, iconstr, title, subtitle, body, time, draws_attention);
- g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->info, id);
+ g_free (app_iconstr);
+ g_object_unref (action);
}
static void
@@ -415,14 +578,15 @@ im_application_list_unset_remote (Application *app)
/* clear actions by creating a new action group and overriding it in
* the muxer */
- g_object_unref (app->actions);
- app->actions = g_simple_action_group_new ();
- g_action_muxer_insert (app->list->muxer,
- g_app_info_get_id (G_APP_INFO (app->info)),
- G_ACTION_GROUP (app->actions));
+ g_object_unref (app->source_actions);
+ g_object_unref (app->message_actions);
+ app->source_actions = g_simple_action_group_new ();
+ app->message_actions = g_simple_action_group_new ();
+ g_action_muxer_insert (app->actions, "src", G_ACTION_GROUP (app->source_actions));
+ g_action_muxer_insert (app->actions, "msg", G_ACTION_GROUP (app->message_actions));
if (was_running)
- g_signal_emit (app->list, signals[APP_STOPPED], 0, app->info);
+ g_signal_emit (app->list, signals[APP_STOPPED], 0, app->id);
}
static void
@@ -480,7 +644,7 @@ im_application_list_set_remote (ImApplicationList *list,
g_return_if_fail (IM_IS_APPLICATION_LIST (list));
- app = g_hash_table_lookup (list->applications, id);
+ app = im_application_list_lookup (list, id);
if (!app)
{
g_warning ("'%s' is not a registered application", id);
diff --git a/src/im-phone-menu.c b/src/im-phone-menu.c
index 0ba41c4..728c08b 100644
--- a/src/im-phone-menu.c
+++ b/src/im-phone-menu.c
@@ -60,6 +60,33 @@ im_phone_menu_foreach_item_with_action (GMenuModel *menu,
}
static void
+im_phone_menu_update_toplevel (ImPhoneMenu *menu)
+{
+ if (g_menu_model_get_n_items (G_MENU_MODEL (menu->message_section)) ||
+ g_menu_model_get_n_items (G_MENU_MODEL (menu->source_section)))
+ {
+ if (g_menu_model_get_n_items (G_MENU_MODEL (menu->toplevel_menu)) == 0)
+ {
+ GMenuItem *item;
+
+ g_menu_append_section (menu->toplevel_menu, NULL, G_MENU_MODEL (menu->message_section));
+ g_menu_append_section (menu->toplevel_menu, NULL, G_MENU_MODEL (menu->source_section));
+
+ item = g_menu_item_new ("Clear All", "remove-all");
+ g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.button");
+ g_menu_append_item (menu->toplevel_menu, item);
+
+ g_object_unref (item);
+ }
+ }
+ else
+ {
+ while (g_menu_model_get_n_items (G_MENU_MODEL (menu->toplevel_menu)))
+ g_menu_remove (menu->toplevel_menu, 0);
+ }
+}
+
+static void
im_phone_menu_dispose (GObject *object)
{
ImPhoneMenu *menu = IM_PHONE_MENU (object);
@@ -89,12 +116,16 @@ im_phone_menu_class_init (ImPhoneMenuClass *klass)
static void
im_phone_menu_init (ImPhoneMenu *menu)
{
+ menu->toplevel_menu = g_menu_new ();
menu->message_section = g_menu_new ();
menu->source_section = g_menu_new ();
- menu->toplevel_menu = g_menu_new ();
- g_menu_append_section (menu->toplevel_menu, NULL, G_MENU_MODEL (menu->message_section));
- g_menu_append_section (menu->toplevel_menu, NULL, G_MENU_MODEL (menu->source_section));
+ g_signal_connect_swapped (menu->message_section, "items-changed",
+ G_CALLBACK (im_phone_menu_update_toplevel), menu);
+ g_signal_connect_swapped (menu->source_section, "items-changed",
+ G_CALLBACK (im_phone_menu_update_toplevel), menu);
+
+ im_phone_menu_update_toplevel (menu);
}
ImPhoneMenu *
@@ -113,7 +144,8 @@ im_phone_menu_get_model (ImPhoneMenu *menu)
void
im_phone_menu_add_message (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
+ const gchar *app_icon,
const gchar *id,
const gchar *iconstr,
const gchar *title,
@@ -121,17 +153,13 @@ im_phone_menu_add_message (ImPhoneMenu *menu,
const gchar *body,
gint64 time)
{
- const gchar *app_id;
GMenuItem *item;
gchar *action_name;
g_return_if_fail (IM_IS_PHONE_MENU (menu));
- g_return_if_fail (G_IS_DESKTOP_APP_INFO (app));
-
- app_id = g_app_info_get_id (G_APP_INFO (app));
g_return_if_fail (app_id);
- action_name = g_strconcat (app_id, ".", id, NULL);
+ action_name = g_strconcat (app_id, ".msg.", id, NULL);
item = g_menu_item_new (title, action_name);
g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.messageitem");
@@ -143,6 +171,9 @@ im_phone_menu_add_message (ImPhoneMenu *menu,
if (iconstr)
g_menu_item_set_attribute (item, "x-canonical-icon", "s", iconstr);
+ if (app_icon)
+ g_menu_item_set_attribute (item, "x-canonical-app-icon", "s", app_icon);
+
g_menu_append_item (menu->message_section, item);
g_free (action_name);
@@ -151,15 +182,15 @@ im_phone_menu_add_message (ImPhoneMenu *menu,
void
im_phone_menu_remove_message (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
const gchar *id)
{
gchar *action_name;
g_return_if_fail (IM_IS_PHONE_MENU (menu));
- g_return_if_fail (G_IS_DESKTOP_APP_INFO (app));
+ g_return_if_fail (app_id != NULL);
- action_name = g_strconcat (g_app_info_get_id (G_APP_INFO (app)), ".", id, NULL);
+ action_name = g_strconcat (app_id, ".msg.", id, NULL);
im_phone_menu_foreach_item_with_action (G_MENU_MODEL (menu->message_section),
action_name,
(ImMenuForeachFunc) g_menu_remove);
@@ -169,7 +200,7 @@ im_phone_menu_remove_message (ImPhoneMenu *menu,
void
im_phone_menu_add_source (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
const gchar *id,
const gchar *label,
const gchar *iconstr)
@@ -178,9 +209,9 @@ im_phone_menu_add_source (ImPhoneMenu *menu,
gchar *action_name;
g_return_if_fail (IM_IS_PHONE_MENU (menu));
- g_return_if_fail (G_IS_DESKTOP_APP_INFO (app));
+ g_return_if_fail (app_id != NULL);
- action_name = g_strconcat (g_app_info_get_id (G_APP_INFO (app)), ".", id, NULL);
+ action_name = g_strconcat (app_id, ".src.", id, NULL);
item = g_menu_item_new (label, action_name);
g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.sourceitem");
@@ -196,15 +227,15 @@ im_phone_menu_add_source (ImPhoneMenu *menu,
void
im_phone_menu_remove_source (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
const gchar *id)
{
gchar *action_name;
g_return_if_fail (IM_IS_PHONE_MENU (menu));
- g_return_if_fail (G_IS_DESKTOP_APP_INFO (app));
+ g_return_if_fail (app_id != NULL);
- action_name = g_strconcat (g_app_info_get_id (G_APP_INFO (app)), ".", id, NULL);
+ action_name = g_strconcat (app_id, ".src.", id, NULL);
im_phone_menu_foreach_item_with_action (G_MENU_MODEL (menu->source_section),
action_name,
(ImMenuForeachFunc) g_menu_remove);
@@ -214,13 +245,13 @@ im_phone_menu_remove_source (ImPhoneMenu *menu,
static void
im_phone_menu_remove_all_for_app (GMenu *menu,
- GDesktopAppInfo *app)
+ const gchar *app_id)
{
gchar *prefix;
gint n_items;
gint i = 0;
- prefix = g_strconcat (g_app_info_get_id (G_APP_INFO (app)), ".", NULL);
+ prefix = g_strconcat (app_id, ".", NULL);
n_items = g_menu_model_get_n_items (G_MENU_MODEL (menu));
while (i < n_items)
@@ -246,11 +277,11 @@ im_phone_menu_remove_all_for_app (GMenu *menu,
void
im_phone_menu_remove_application (ImPhoneMenu *menu,
- GDesktopAppInfo *app)
+ const gchar *app_id)
{
g_return_if_fail (IM_IS_PHONE_MENU (menu));
- g_return_if_fail (G_IS_DESKTOP_APP_INFO (app));
+ g_return_if_fail (app_id != NULL);
- im_phone_menu_remove_all_for_app (menu->source_section, app);
- im_phone_menu_remove_all_for_app (menu->message_section, app);
+ im_phone_menu_remove_all_for_app (menu->source_section, app_id);
+ im_phone_menu_remove_all_for_app (menu->message_section, app_id);
}
diff --git a/src/im-phone-menu.h b/src/im-phone-menu.h
index b0b6b4f..f6a6118 100644
--- a/src/im-phone-menu.h
+++ b/src/im-phone-menu.h
@@ -21,7 +21,6 @@
#define __IM_PHONE_MENU_H__
#include <gio/gio.h>
-#include <gio/gdesktopappinfo.h>
#define IM_TYPE_PHONE_MENU (im_phone_menu_get_type ())
#define IM_PHONE_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IM_TYPE_PHONE_MENU, ImPhoneMenu))
@@ -39,7 +38,8 @@ ImPhoneMenu * im_phone_menu_new (void);
GMenuModel * im_phone_menu_get_model (ImPhoneMenu *menu);
void im_phone_menu_add_message (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
+ const gchar *app_icon,
const gchar *id,
const gchar *iconstr,
const gchar *title,
@@ -48,20 +48,20 @@ void im_phone_menu_add_message (ImPhoneMenu *men
gint64 time);
void im_phone_menu_remove_message (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
const gchar *id);
void im_phone_menu_add_source (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
const gchar *id,
const gchar *label,
const gchar *iconstr);
void im_phone_menu_remove_source (ImPhoneMenu *menu,
- GDesktopAppInfo *app,
+ const gchar *app_id,
const gchar *id);
-void im_phone_menu_remove_application (ImPhoneMenu *menu,
- GDesktopAppInfo *app);
+void im_phone_menu_remove_application (ImPhoneMenu *menu,
+ const gchar *app_id);
#endif