grim/guifications1

Parents 1117989f9301
Children 6e057f10a213
Finally added "smart" notifications.. If someone's away and signs off.. you won't see the "so and so is back" notification. All I did was if a notification exists with the same buddy, remove it. This works because of the order of gaim signals, which is exactly why we were seeing it before :)
--- a/src/guifications.c Sat Apr 24 08:32:34 2004 +0000
+++ b/src/guifications.c Sat Apr 24 09:04:59 2004 +0000
@@ -163,6 +163,29 @@
return TRUE;
}
+static void
+gf_remove_old_notification(GaimBuddy *buddy) {
+ GaimBuddy *old_buddy;
+ GtkWidget *gf;
+ GList *l, *ll;
+ gint timeout_id;
+
+ for(l = gtk_container_get_children(GTK_CONTAINER(gf_box)); l; l = ll) {
+ ll = l->next;
+
+ gf = l->data;
+
+ old_buddy = g_object_get_data(G_OBJECT(gf), "buddy");
+ if(old_buddy == buddy) {
+ timeout_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gf), "timeout"));
+
+ g_source_remove(timeout_id);
+ gtk_widget_destroy(gf);
+ return;
+ }
+ }
+}
+
static gboolean
gf_event_cb2(GaimAccount *account, char **sender,
char **message, int *flags, void *data) {
@@ -170,6 +193,7 @@
return FALSE;
}
+
static void
gf_event_cb(GaimBuddy *buddy, gpointer data) {
gf_event gf_new_event = (gf_event)data;
@@ -223,7 +247,10 @@
if (gf_window == NULL)
make_gf_window();
-
+
+ /* kill old guifications.. like back when they've really signed off */
+ gf_remove_old_notification(buddy);
+
get_image_size(&img_size);
pm_guification = make_guification(buddy, gf_new_event);