diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-10-02 23:19:53 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-10-02 23:19:53 +0200 |
commit | 910a1eb17c10443d50a6c3d2ac86bcfc7d970612 (patch) | |
tree | 7d1a19d9f473239aa30dbf225352968177fa54f6 /libmessaging-menu | |
parent | 213c3d37aee885e6767d800f66b0d55b39801c3c (diff) | |
parent | 78f8f75ee73478ecb704aecc467c861fa4558b52 (diff) | |
download | ayatana-indicator-messages-910a1eb17c10443d50a6c3d2ac86bcfc7d970612.tar.gz ayatana-indicator-messages-910a1eb17c10443d50a6c3d2ac86bcfc7d970612.tar.bz2 ayatana-indicator-messages-910a1eb17c10443d50a6c3d2ac86bcfc7d970612.zip |
* New upstream release:
- don't segfault if .desktop file is not installed (lp: #1058386)
- Use fallback icon names (without status emblems).
(lp: #1056595)
Diffstat (limited to 'libmessaging-menu')
-rw-r--r-- | libmessaging-menu/Makefile.am | 2 | ||||
-rw-r--r-- | libmessaging-menu/Makefile.in | 4 | ||||
-rw-r--r-- | libmessaging-menu/indicator-messages-service.c | 29 | ||||
-rw-r--r-- | libmessaging-menu/indicator-messages-service.h | 5 | ||||
-rw-r--r-- | libmessaging-menu/messaging-menu.c | 53 |
5 files changed, 69 insertions, 24 deletions
diff --git a/libmessaging-menu/Makefile.am b/libmessaging-menu/Makefile.am index ef37700..7a6ee31 100644 --- a/libmessaging-menu/Makefile.am +++ b/libmessaging-menu/Makefile.am @@ -50,8 +50,10 @@ MessagingMenu-1.0.gir: libmessaging-menu.la MessagingMenu_1_0_gir_NAMESPACE = MessagingMenu MessagingMenu_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 MessagingMenu_1_0_gir_CFLAGS = $(INCLUDES) $(GIO_CFLAGS) +MessagingMenu_1_0_gir_SCANNERFLAGS = --c-include="messaging-menu.h" MessagingMenu_1_0_gir_LIBS = libmessaging-menu.la MessagingMenu_1_0_gir_FILES = messaging-menu.c messaging-menu.h +MessagingMenu_1_0_gir_EXPORT_PACKAGES = messaging-menu INTROSPECTION_GIRS += MessagingMenu-1.0.gir girdir = $(datadir)/gir-1.0 diff --git a/libmessaging-menu/Makefile.in b/libmessaging-menu/Makefile.in index 29215c2..f1d3cab 100644 --- a/libmessaging-menu/Makefile.in +++ b/libmessaging-menu/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.5 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -365,8 +365,10 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) @HAVE_INTROSPECTION_TRUE@MessagingMenu_1_0_gir_NAMESPACE = MessagingMenu @HAVE_INTROSPECTION_TRUE@MessagingMenu_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 @HAVE_INTROSPECTION_TRUE@MessagingMenu_1_0_gir_CFLAGS = $(INCLUDES) $(GIO_CFLAGS) +@HAVE_INTROSPECTION_TRUE@MessagingMenu_1_0_gir_SCANNERFLAGS = --c-include="messaging-menu.h" @HAVE_INTROSPECTION_TRUE@MessagingMenu_1_0_gir_LIBS = libmessaging-menu.la @HAVE_INTROSPECTION_TRUE@MessagingMenu_1_0_gir_FILES = messaging-menu.c messaging-menu.h +@HAVE_INTROSPECTION_TRUE@MessagingMenu_1_0_gir_EXPORT_PACKAGES = messaging-menu @HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0 @HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS) @HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0 diff --git a/libmessaging-menu/indicator-messages-service.c b/libmessaging-menu/indicator-messages-service.c index a42a534..7f2ab87 100644 --- a/libmessaging-menu/indicator-messages-service.c +++ b/libmessaging-menu/indicator-messages-service.c @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.33.10. DO NOT EDIT. + * Generated by gdbus-codegen 2.33.12. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ @@ -235,6 +235,17 @@ static const _ExtendedGDBusMethodInfo _indicator_messages_service_method_info_un FALSE }; +static const _ExtendedGDBusArgInfo _indicator_messages_service_method_info_set_status_IN_ARG_desktop_id = +{ + { + -1, + (gchar *) "desktop_id", + (gchar *) "s", + NULL + }, + FALSE +}; + static const _ExtendedGDBusArgInfo _indicator_messages_service_method_info_set_status_IN_ARG_status = { { @@ -248,6 +259,7 @@ static const _ExtendedGDBusArgInfo _indicator_messages_service_method_info_set_s static const _ExtendedGDBusArgInfo * const _indicator_messages_service_method_info_set_status_IN_ARG_pointers[] = { + &_indicator_messages_service_method_info_set_status_IN_ARG_desktop_id, &_indicator_messages_service_method_info_set_status_IN_ARG_status, NULL }; @@ -424,6 +436,7 @@ indicator_messages_service_default_init (IndicatorMessagesServiceIface *iface) * IndicatorMessagesService::handle-set-status: * @object: A #IndicatorMessagesService. * @invocation: A #GDBusMethodInvocation. + * @arg_desktop_id: Argument passed by remote caller. * @arg_status: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-indicator-messages-service.SetStatus">SetStatus()</link> D-Bus method. @@ -440,8 +453,8 @@ indicator_messages_service_default_init (IndicatorMessagesServiceIface *iface) NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, - 2, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); /* GObject signals for received D-Bus signals: */ /** @@ -688,6 +701,7 @@ _out: /** * indicator_messages_service_call_set_status: * @proxy: A #IndicatorMessagesServiceProxy. + * @arg_desktop_id: Argument to pass with the method invocation. * @arg_status: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. @@ -702,6 +716,7 @@ _out: void indicator_messages_service_call_set_status ( IndicatorMessagesService *proxy, + const gchar *arg_desktop_id, const gchar *arg_status, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -709,7 +724,8 @@ indicator_messages_service_call_set_status ( { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "SetStatus", - g_variant_new ("(s)", + g_variant_new ("(ss)", + arg_desktop_id, arg_status), G_DBUS_CALL_FLAGS_NONE, -1, @@ -748,6 +764,7 @@ _out: /** * indicator_messages_service_call_set_status_sync: * @proxy: A #IndicatorMessagesServiceProxy. + * @arg_desktop_id: Argument to pass with the method invocation. * @arg_status: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. @@ -761,6 +778,7 @@ _out: gboolean indicator_messages_service_call_set_status_sync ( IndicatorMessagesService *proxy, + const gchar *arg_desktop_id, const gchar *arg_status, GCancellable *cancellable, GError **error) @@ -768,7 +786,8 @@ indicator_messages_service_call_set_status_sync ( GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "SetStatus", - g_variant_new ("(s)", + g_variant_new ("(ss)", + arg_desktop_id, arg_status), G_DBUS_CALL_FLAGS_NONE, -1, diff --git a/libmessaging-menu/indicator-messages-service.h b/libmessaging-menu/indicator-messages-service.h index 2adaaf3..2401d0e 100644 --- a/libmessaging-menu/indicator-messages-service.h +++ b/libmessaging-menu/indicator-messages-service.h @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.33.10. DO NOT EDIT. + * Generated by gdbus-codegen 2.33.12. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ @@ -38,6 +38,7 @@ struct _IndicatorMessagesServiceIface gboolean (*handle_set_status) ( IndicatorMessagesService *object, GDBusMethodInvocation *invocation, + const gchar *arg_desktop_id, const gchar *arg_status); gboolean (*handle_unregister_application) ( @@ -120,6 +121,7 @@ gboolean indicator_messages_service_call_unregister_application_sync ( void indicator_messages_service_call_set_status ( IndicatorMessagesService *proxy, + const gchar *arg_desktop_id, const gchar *arg_status, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -132,6 +134,7 @@ gboolean indicator_messages_service_call_set_status_finish ( gboolean indicator_messages_service_call_set_status_sync ( IndicatorMessagesService *proxy, + const gchar *arg_desktop_id, const gchar *arg_status, GCancellable *cancellable, GError **error); diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index 93727fc..3c5c6d4 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -27,6 +27,7 @@ * SECTION:messaging-menu * @title: MessagingMenuApp * @short_description: An application section in the messaging menu + * @include: messaging-menu.h * * A #MessagingMenuApp represents an application section in the * Messaging Menu. An application section is tied to an installed @@ -42,12 +43,13 @@ * desktop file. Activating this item starts the application. * * Following the application item, the Messaging Menu inserts all - * shortcuts actions found in the desktop file which are marked as - * appearing in the Messaging Menu (the TargetEnvironment or OnlyShowIn - * keywords contains "Messaging Menu"). The <ulink + * shortcut actions found in the desktop file. Actions whose + * <code>NotShowIn</code> keyword contains "Messaging Menu" or whose + * <code>OnlyShowIn</code> keyword does not contain "Messaging Menu" + * will not appear (the <ulink * url="http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html#extra-actions"> * desktop file specification</ulink> contains a detailed explanation of - * shortcut actions [1]. An application cannot add, remove, or change + * shortcut actions.) An application cannot add, remove, or change * these shortcut items while it is running. * * Next, an application section contains menu items for message sources. @@ -100,6 +102,7 @@ struct _MessagingMenuApp GDesktopAppInfo *appinfo; int registered; /* -1 for unknown */ MessagingMenuStatus status; + gboolean status_set; GSimpleActionGroup *source_actions; GMenu *menu; @@ -145,7 +148,8 @@ messaging_menu_app_get_dbus_object_path (MessagingMenuApp *app) { gchar *path; - g_return_val_if_fail (app->appinfo != NULL, NULL); + if (!app->appinfo) + return NULL; path = g_strconcat ("/com/canonical/indicator/messages/", g_app_info_get_id (G_APP_INFO (app->appinfo)), @@ -167,6 +171,10 @@ export_menus_and_actions (GObject *source, guint id; gchar *object_path; + object_path = messaging_menu_app_get_dbus_object_path (app); + if (!object_path) + return; + bus = g_bus_get_finish (res, &error); if (bus == NULL) { @@ -175,8 +183,6 @@ export_menus_and_actions (GObject *source, return; } - object_path = messaging_menu_app_get_dbus_object_path (app); - id = g_dbus_connection_export_action_group (bus, object_path, G_ACTION_GROUP (app->source_actions), @@ -368,7 +374,8 @@ created_messages_service (GObject *source_object, messaging_menu_app_register (app); else if (app->registered == FALSE) messaging_menu_app_unregister (app); - messaging_menu_app_set_status (app, app->status); + if (app->status_set) + messaging_menu_app_set_status (app, app->status); } static void @@ -408,7 +415,7 @@ static void messaging_menu_app_init (MessagingMenuApp *app) { app->registered = -1; - app->status = MESSAGING_MENU_STATUS_OFFLINE; + app->status_set = FALSE; app->cancellable = g_cancellable_new (); @@ -475,6 +482,8 @@ messaging_menu_app_register (MessagingMenuApp *app) return; object_path = messaging_menu_app_get_dbus_object_path (app); + if (!object_path) + return; indicator_messages_service_call_register_application (app->messages_service, g_app_info_get_id (G_APP_INFO (app->appinfo)), @@ -506,6 +515,9 @@ messaging_menu_app_unregister (MessagingMenuApp *app) if (!app->messages_service) return; + if (!app->appinfo) + return; + indicator_messages_service_call_unregister_application (app->messages_service, g_app_info_get_id (G_APP_INFO (app->appinfo)), app->cancellable, @@ -536,12 +548,17 @@ messaging_menu_app_set_status (MessagingMenuApp *app, status <= MESSAGING_MENU_STATUS_OFFLINE); app->status = status; + app->status_set = TRUE; /* state will be synced right after connecting to the service */ if (!app->messages_service) return; + if (!app->appinfo) + return; + indicator_messages_service_call_set_status (app->messages_service, + g_app_info_get_id (G_APP_INFO (app->appinfo)), status_ids [status], app->cancellable, NULL, NULL); @@ -575,8 +592,7 @@ global_status_changed (IndicatorMessagesService *service, status = status_from_string (status_str); g_return_if_fail (status >= 0); - app->status = (MessagingMenuStatus)status; - g_signal_emit (app, signals[STATUS_CHANGED], 0, app->status); + g_signal_emit (app, signals[STATUS_CHANGED], 0, status); } static void @@ -762,10 +778,11 @@ void messaging_menu_app_append_source_with_count (MessagingMenuApp *app, * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source - * @time: the time when the source was created + * @time: the time when the source was created, in microseconds * * Inserts a new message source into the section representing @app and - * initializes it with @time. + * initializes it with @time. Use messaging_menu_app_insert_source() to + * insert a source with the current time. * * To change the time, use messaging_menu_app_set_source_time(). * @@ -790,10 +807,12 @@ messaging_menu_app_insert_source_with_time (MessagingMenuApp *app, * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source - * @time: the time when the source was created + * @time: the time when the source was created, in microseconds * - * Appends a new message source to the end of the section representing @app and - * initializes it with @time. + * Appends a new message source to the end of the section representing + * @app and initializes it with @time. Use + * messaging_menu_app_append_source() to append a source with the + * current time. * * To change the time, use messaging_menu_app_set_source_time(). * @@ -1044,7 +1063,7 @@ void messaging_menu_app_set_source_count (MessagingMenuApp *app, * messaging_menu_app_set_source_time: * @app: a #MessagingMenuApp * @source_id: a source id - * @time: the new time for the source + * @time: the new time for the source, in microseconds * * Updates the time of @source_id to @time. * |