ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00285
[Merge] lp:~macslow/notify-osd/fix-427924 into lp:notify-osd
Mirco Müller has proposed merging lp:~macslow/notify-osd/fix-427924 into lp:notify-osd.
Requested reviews:
Notify OSD Developers (notify-osd-developers)
After lots of work this seems to fix LP: #427924 for good. Major difference to trunk is bubble-disposal happens in a GWeakNotify callback now and stack_purge_old_bubbles() has been decommissioned.
--
https://code.launchpad.net/~macslow/notify-osd/fix-427924/+merge/12281
Your team ayatana-commits is subscribed to branch lp:notify-osd.
=== modified file 'src/display.c'
--- src/display.c 2009-09-10 13:11:32 +0000
+++ src/display.c 2009-09-23 13:14:20 +0000
@@ -286,8 +286,6 @@
g_return_if_fail (self != NULL);
- stack_purge_old_bubbles (self);
-
bubble = stack_select_next_to_display (self);
if (bubble == NULL)
/* this actually happens when we're called for a synchronous
=== modified file 'src/stack.c'
--- src/stack.c 2009-09-10 13:11:32 +0000
+++ src/stack.c 2009-09-23 13:14:20 +0000
@@ -245,34 +245,13 @@
return (Bubble*) entry->data;
}
-
static void
-stack_purge_old_bubbles (Stack* self)
+_weak_notify_cb (gpointer data,
+ GObject* former_object)
{
- Bubble* bubble = NULL;
- GList* list = NULL;
-
- g_return_if_fail (self != NULL);
-
- for (list = g_list_first (self->list);
- list != NULL;)
- {
- bubble = (Bubble*) list->data;
-
- if (! IS_BUBBLE (bubble))
- {
- self->list = g_list_delete_link (self->list, list);
- list = self->list;
- } else if (! bubble_is_visible (bubble) &&
- (bubble_get_timeout (bubble) == 0))
- {
- self->list = g_list_delete_link (self->list, list);
- list = self->list;
- g_object_unref (bubble);
- } else {
- list = g_list_next (list);
- }
- }
+ Stack* stack = STACK (data);
+
+ stack->list = g_list_remove (stack->list, former_object);
}
static void
@@ -618,6 +597,10 @@
gchar *sender;
new_bubble = TRUE;
bubble = bubble_new (self->defaults);
+ g_object_weak_ref (G_OBJECT (bubble),
+ _weak_notify_cb,
+ (gpointer) self);
+
sender = dbus_g_method_get_sender (context);
bubble_set_sender (bubble, sender);
g_free (sender);
@@ -627,7 +610,12 @@
{
data = (GValue*) g_hash_table_lookup (hints, "x-canonical-append");
compat = (GValue*) g_hash_table_lookup (hints, "append");
- if (G_VALUE_HOLDS_STRING (data) || G_VALUE_HOLDS_STRING (compat))
+ g_print ("--- %s(): data = %p, compat = %p ---\n",
+ G_STRFUNC,
+ data,
+ compat);
+ if ((data && G_VALUE_HOLDS_STRING (data)) ||
+ (compat && G_VALUE_HOLDS_STRING (compat)))
bubble_set_append (bubble, TRUE);
else
bubble_set_append (bubble, FALSE);
@@ -656,7 +644,7 @@
{
data = (GValue*) g_hash_table_lookup (hints, "x-canonical-private-synchronous");
compat = (GValue*) g_hash_table_lookup (hints, "synchronous");
- if (G_VALUE_HOLDS_STRING (data) || G_VALUE_HOLDS_STRING (compat))
+ if ((data && G_VALUE_HOLDS_STRING (data)) || (compat && G_VALUE_HOLDS_STRING (compat)))
{
if (sync_bubble != NULL
&& IS_BUBBLE (sync_bubble))
@@ -665,10 +653,10 @@
bubble = sync_bubble;
}
- if (G_VALUE_HOLDS_STRING (data))
+ if (data && G_VALUE_HOLDS_STRING (data))
bubble_set_synchronous (bubble, g_value_get_string (data));
- if (G_VALUE_HOLDS_STRING (compat))
+ if (compat && G_VALUE_HOLDS_STRING (compat))
bubble_set_synchronous (bubble, g_value_get_string (compat));
}
}
@@ -676,14 +664,14 @@
if (hints)
{
data = (GValue*) g_hash_table_lookup (hints, "value");
- if (G_VALUE_HOLDS_INT (data))
+ if (data && G_VALUE_HOLDS_INT (data))
bubble_set_value (bubble, g_value_get_int (data));
}
if (hints)
{
data = (GValue*) g_hash_table_lookup (hints, "urgency");
- if (G_VALUE_HOLDS_UCHAR (data))
+ if (data && G_VALUE_HOLDS_UCHAR (data))
bubble_set_urgency (bubble,
g_value_get_uchar (data));
/* Note: urgency was defined as an enum: LOW, NORMAL, CRITICAL
@@ -695,7 +683,7 @@
{
data = (GValue*) g_hash_table_lookup (hints, "x-canonical-private-icon-only");
compat = (GValue*) g_hash_table_lookup (hints, "icon-only");
- if (G_VALUE_HOLDS_STRING (data) || G_VALUE_HOLDS_STRING (compat))
+ if ((data && G_VALUE_HOLDS_STRING (data)) || (compat && G_VALUE_HOLDS_STRING (compat)))
bubble_set_icon_only (bubble, TRUE);
else
bubble_set_icon_only (bubble, FALSE);
@@ -764,7 +752,8 @@
stack_layout (self);
}
- dbus_g_method_return (context, bubble_get_id (bubble));
+ if (bubble)
+ dbus_g_method_return (context, bubble_get_id (bubble));
return TRUE;
}
@@ -774,20 +763,20 @@
guint id,
GError** error)
{
- Bubble *bubble = find_bubble_by_id (self, id);
-
- /* exit but pretend it's ok, for applications
- that call us after an action button was clicked */
- if (bubble == NULL)
- return TRUE;
-
- dbus_send_close_signal (bubble_get_sender (bubble),
- bubble_get_id (bubble),
- 3);
- bubble_hide (bubble);
- g_object_unref (bubble);
-
- stack_layout (self);
+ //Bubble *bubble = find_bubble_by_id (self, id);
+
+ // exit but pretend it's ok, for applications
+ // that call us after an action button was clicked
+ //if (bubble == NULL)
+ // return TRUE;
+
+ //dbus_send_close_signal (bubble_get_sender (bubble),
+ // bubble_get_id (bubble),
+ // 3);
+ //bubble_hide (bubble);
+ //g_object_unref (bubble);
+
+ //stack_layout (self);
return TRUE;
}
Follow ups