diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus-shared.h | 2 | ||||
-rw-r--r-- | src/indicator-notifications.c | 17 | ||||
-rw-r--r-- | src/notifications-service.c | 1 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/dbus-shared.h b/src/dbus-shared.h index 7b689ae..6e8cd65 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -23,3 +23,5 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define SERVICE_VERSION 1 #define MENU_OBJ "/com/launchpad/RecentNotifications/indicator/menu" + +#define DBUSMENU_NOTIFICATION_MENUITEM_TYPE "x-launchpad-recent-notifications-item" diff --git a/src/indicator-notifications.c b/src/indicator-notifications.c index 01bddb7..f66f4c6 100644 --- a/src/indicator-notifications.c +++ b/src/indicator-notifications.c @@ -96,8 +96,9 @@ static void indicator_notifications_finalize(GObject *object); static GtkImage *get_image(IndicatorObject *io); static GtkMenu *get_menu(IndicatorObject *io); static const gchar *get_accessible_desc(IndicatorObject *io); -static GdkPixbuf *load_icon(const gchar *, guint); -static void menu_visible_notify_cb(GtkWidget *, GParamSpec *, gpointer); +static GdkPixbuf *load_icon(const gchar *name, guint size) +static void menu_visible_notify_cb(GtkWidget *menu, G_GNUC_UNUSED GParamSpec *pspec, gpointer user_data) +static boolean new_notification_menuitem(DbusmenuMenuitem *new_item, DbusmenuMenuitem *parent, DbusmenuClient *client, gpointer user_data); static void receive_signal(GDBusProxy *proxy, gchar *sender_name, gchar *signal_name, GVariant *parameters, gpointer user_data); static void service_proxy_cb(GObject *object, GAsyncResult *res, gpointer user_data); @@ -162,6 +163,10 @@ indicator_notifications_init(IndicatorNotifications *self) g_signal_connect(self->priv->menu, "notify::visible", G_CALLBACK(menu_visible_notify_cb), self); + DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(self->priv->menu); + + dbusmenu_client_add_type_handler_full(DBUSMENU_CLIENT(client), DBUSMENU_NOTIFICATION_MENUITEM_TYPE, new_notification_menuitem, self, NULL); + self->priv->service_proxy_cancel = g_cancellable_new(); g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION, @@ -277,6 +282,14 @@ receive_signal(GDBusProxy *proxy, gchar *sender_name, gchar *signal_name, return; } +static boolean +new_notification_menuitem(DbusmenuMenuitem *new_item, DbusmenuMenuitem *parent, + DbusmenuClient *client, gpointer user_data) +{ + g_debug("New notification item"); + return TRUE; +} + static GdkPixbuf * load_icon(const gchar *name, guint size) { diff --git a/src/notifications-service.c b/src/notifications-service.c index f0e82bf..2c07c57 100644 --- a/src/notifications-service.c +++ b/src/notifications-service.c @@ -69,6 +69,7 @@ add_notification_item(gpointer user_data) DbusmenuMenuitem *item; item = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_NOTIFICATION_MENUITEM_TYPE); dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, notification_get_summary(note)); dbusmenu_menuitem_child_add_position(root, item, 1); g_queue_push_head(notification_items, item); |