Mercurial > pidgin
changeset 4274:906f61f27479
[gaim-migrate @ 4525]
(01:26:02) Robot101: guess which bugs I fixed
(01:26:14) Me: i can't
(01:26:26) Robot101: really common crash...
(01:26:35) Robot101: I fixed the return from away crash! =)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 10 Jan 2003 06:32:14 +0000 |
parents | a345395c8794 |
children | 5ce5b252cdb1 |
files | plugins/docklet/docklet.c src/away.c src/ui.h |
diffstat | 3 files changed, 44 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/docklet/docklet.c Fri Jan 10 01:33:09 2003 +0000 +++ b/plugins/docklet/docklet.c Fri Jan 10 06:32:14 2003 +0000 @@ -58,7 +58,6 @@ static GtkIconFactory *icon_factory = NULL; static enum docklet_status status; static enum docklet_status icon; -static guint blinker = 0; static void docklet_toggle_mute(GtkWidget *toggle, void *data) { mute_sounds = GTK_CHECK_MENU_ITEM(toggle)->active; @@ -76,8 +75,7 @@ static void docklet_flush_queue() { if (unread_message_queue) { - purge_away_queue(unread_message_queue); - unread_message_queue = NULL; + purge_away_queue(&unread_message_queue); } } @@ -279,7 +277,7 @@ /* and schedule the blinker function if messages are pending */ if (status == online_pending || status == away_pending) { - blinker = g_timeout_add(500, docklet_blink_icon, NULL); + g_timeout_add(500, docklet_blink_icon, &docklet); } } @@ -291,6 +289,16 @@ docklet_add(); } +static void docklet_remove_callbacks() { + debug_printf("Tray Icon: removing callbacks"); + + while (g_source_remove_by_user_data(&docklet)) { + debug_printf("."); + } + + debug_printf("\n"); +} + static void docklet_destroyed(GtkWidget *widget, void *data) { debug_printf("Tray Icon: destroyed\n"); @@ -298,18 +306,15 @@ docklet_flush_queue(); - if (blinker) { - g_source_remove(blinker); - blinker = 0; - } + docklet_remove_callbacks(); g_object_unref(G_OBJECT(docklet)); docklet = NULL; - g_idle_add(docklet_create, NULL); + g_idle_add(docklet_create, &docklet); } -static gboolean docklet_create(void *data) { +static gboolean docklet_create() { GtkWidget *box; if (docklet) { @@ -350,7 +355,7 @@ /* do this when idle so that if the prpl was connecting and was cancelled, we register that connecting_count has returned to 0 */ - g_idle_add(docklet_update_status, NULL); + g_idle_add(docklet_update_status, &docklet); } static void gaim_connecting(struct aim_user *user, void *data) { @@ -362,10 +367,12 @@ docklet_update_status(); } -static void gaim_im_displayed_recv(struct gaim_connection *gc, char **who, char **what, void *data) { +static void gaim_im_recv(struct gaim_connection *gc, char **who, char **what, void *data) { /* if message queuing while away is enabled, this event could be the first - message so we need to see if the status (and hence icon) needs changing */ - docklet_update_status(); + message so we need to see if the status (and hence icon) needs changing. + do this when idle so that all message processing is completed, queuing + etc, before we run. */ + g_idle_add(docklet_update_status, &docklet); } /* static void gaim_buddy_signon(struct gaim_connection *gc, char *who, void *data) { @@ -418,7 +425,7 @@ gaim_signal_connect(handle, event_signoff, gaim_signoff, NULL); gaim_signal_connect(handle, event_connecting, gaim_connecting, NULL); gaim_signal_connect(handle, event_away, gaim_away, NULL); - gaim_signal_connect(handle, event_im_displayed_rcvd, gaim_im_displayed_recv, NULL); + gaim_signal_connect(handle, event_im_recv, gaim_im_recv, NULL); /* gaim_signal_connect(handle, event_buddy_signon, gaim_buddy_signon, NULL); gaim_signal_connect(handle, event_buddy_signoff, gaim_buddy_signoff, NULL); gaim_signal_connect(handle, event_buddy_away, gaim_buddy_away, NULL); @@ -435,10 +442,7 @@ docklet_flush_queue(); - if (blinker) { - g_source_remove(blinker); - blinker = 0; - } + docklet_remove_callbacks(); g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_destroyed), NULL); gtk_widget_destroy(GTK_WIDGET(docklet));
--- a/src/away.c Fri Jan 10 01:33:09 2003 +0000 +++ b/src/away.c Fri Jan 10 06:32:14 2003 +0000 @@ -53,30 +53,33 @@ imaway = NULL; } -void purge_away_queue(GSList *queue) +void purge_away_queue(GSList **queue) { + GSList *q = *queue; + struct queued_message *qm; struct conversation *cnv; - gtk_clist_freeze(GTK_CLIST(clistqueue)); - gtk_clist_clear(GTK_CLIST(clistqueue)); - - while (queue) { - struct queued_message *qm = queue->data; + while (q) { + qm = q->data; cnv = find_conversation(qm->name); if (!cnv) cnv = new_conversation(qm->name); + if (g_slist_index(connections, qm->gc) >= 0) set_convo_gc(cnv, qm->gc); + write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm, qm->len); - queue = g_slist_remove(queue, qm); - g_free(qm->message); g_free(qm); + + q->data = NULL; + q = q->next; } - gtk_clist_thaw(GTK_CLIST(clistqueue)); + g_slist_free(*queue); + *queue = NULL; } void dequeue_by_buddy(GtkWidget *clist, gint row, gint column, GdkEventButton *event, gpointer data) { @@ -134,7 +137,8 @@ } else { gtk_widget_hide(clistqueue); gtk_widget_hide(clistqueuesw); - purge_away_queue(message_queue); + gtk_clist_clear(GTK_CLIST(clistqueue)); + purge_away_queue(&message_queue); } } @@ -143,7 +147,12 @@ if (imaway) { GtkWidget *tmp = imaway; - purge_away_queue(message_queue); + gtk_clist_freeze(GTK_CLIST(clistqueue)); + gtk_clist_clear(GTK_CLIST(clistqueue)); + + purge_away_queue(&message_queue); + + gtk_clist_thaw(GTK_CLIST(clistqueue)); imaway = NULL; gtk_widget_destroy(tmp);
--- a/src/ui.h Fri Jan 10 01:33:09 2003 +0000 +++ b/src/ui.h Fri Jan 10 06:32:14 2003 +0000 @@ -335,7 +335,7 @@ extern void away_list_unclicked(GtkWidget *, struct away_message *); extern void away_list_clicked(GtkWidget *, struct away_message *); extern void toggle_away_queue(); -extern void purge_away_queue(GSList*); +extern void purge_away_queue(GSList**); /* Functions in browser.c */ extern void open_url(GtkWidget *, char *);