aboutsummaryrefslogtreecommitdiff
path: root/src/dbus-spy.c
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2011-08-29 11:11:43 -0400
committerJason Conti <jason.conti@gmail.com>2011-08-29 11:11:43 -0400
commitcb1da8552b56959f8f1c59a17fd4341f2aee611f (patch)
treeffe7c115e93253976ca04e2cf6743fe0d49c3088 /src/dbus-spy.c
parent467b817e26d75b156aacdaadc446de1a69b1a3fb (diff)
downloadayatana-indicator-notifications-cb1da8552b56959f8f1c59a17fd4341f2aee611f.tar.gz
ayatana-indicator-notifications-cb1da8552b56959f8f1c59a17fd4341f2aee611f.tar.bz2
ayatana-indicator-notifications-cb1da8552b56959f8f1c59a17fd4341f2aee611f.zip
* Simplified the indicator by removing the dbus service. Still needs:
- Clear button - Message limit * GTK3 is having issues with the multi-line menu items. Adding a bit of a hack to calculate the size of the menu and resize it when an item is added. Still has some problems, but better than before. Will probably cause other issues that will need to be addressed later.
Diffstat (limited to 'src/dbus-spy.c')
-rw-r--r--src/dbus-spy.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/dbus-spy.c b/src/dbus-spy.c
index 4fe5141..e63a5ee 100644
--- a/src/dbus-spy.c
+++ b/src/dbus-spy.c
@@ -9,6 +9,13 @@ enum {
LAST_SIGNAL
};
+typedef struct _IdleMessage IdleMessage;
+struct _IdleMessage
+{
+ DBusSpy *spy;
+ Notification *note;
+};
+
static guint signals[LAST_SIGNAL];
static void dbus_spy_class_init(DBusSpyClass *klass);
@@ -22,6 +29,8 @@ static void bus_get_cb(GObject *source_object, GAsyncResult *res, gpointer user_
static GDBusMessage *message_filter(GDBusConnection *connection, GDBusMessage *message,
gboolean incoming, gpointer user_data);
+static gboolean idle_message_emit(gpointer user_data);
+
#define MATCH_STRING "type='method_call',interface='org.freedesktop.Notifications',member='Notify'"
G_DEFINE_TYPE (DBusSpy, dbus_spy, G_TYPE_OBJECT);
@@ -115,8 +124,10 @@ message_filter(GDBusConnection *connection, GDBusMessage *message, gboolean inco
{
DBusSpy *spy = DBUS_SPY(user_data);
Notification *note = notification_new_from_dbus_message(message);
- g_signal_emit(spy, signals[MESSAGE_RECEIVED], 0, note);
- g_object_unref(note);
+ IdleMessage *im = g_new0(IdleMessage, 1);
+ im->spy = spy;
+ im->note = note;
+ g_idle_add(idle_message_emit, im);
g_object_unref(message);
message = NULL;
}
@@ -124,6 +135,18 @@ message_filter(GDBusConnection *connection, GDBusMessage *message, gboolean inco
return message;
}
+static gboolean
+idle_message_emit(gpointer user_data)
+{
+ IdleMessage *message = (IdleMessage *)user_data;
+
+ g_signal_emit(message->spy, signals[MESSAGE_RECEIVED], 0, message->note);
+
+ g_free(message);
+
+ return FALSE;
+}
+
static void
dbus_spy_init(DBusSpy *self)
{