Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 11854:4ab3ce602932
[gaim-migrate @ 14145]
I think this is a slightly better way of updating conversations, though at
some point the strange mix of calls to gaim_conversation_update,
gaim_gtkconv_updated, gray_stuff_out and update_send_to_selection could
probably be cleaned up a bit.
now instead of iterating through all windows N times when we have N
conversations, we just ensure that the signals fire once for each window
(and disconnect the signals when the window is destroyed)
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 27 Oct 2005 18:47:19 +0000 |
parents | 3bfb2cffcef2 |
children | dba7bf61e64c |
comparison
equal
deleted
inserted
replaced
11853:65b6f52c2696 | 11854:4ab3ce602932 |
---|---|
3802 } | 3802 } |
3803 | 3803 |
3804 return NULL; | 3804 return NULL; |
3805 } | 3805 } |
3806 | 3806 |
3807 static void | |
3808 buddy_update_cb(GaimBlistNode *bnode) | |
3809 { | |
3810 GList *list; | |
3811 | |
3812 g_return_if_fail(bnode); | |
3813 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode)); | |
3814 | |
3815 for (list = gaim_gtk_conv_windows_get_list(); list; list = list->next) | |
3816 { | |
3817 GaimGtkWindow *win = list->data; | |
3818 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); | |
3819 | |
3820 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) | |
3821 continue; | |
3822 | |
3823 gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_ONLINE); | |
3824 } | |
3825 } | |
3826 | |
3827 /************************************************************************** | 3807 /************************************************************************** |
3828 * Conversation UI operations | 3808 * Conversation UI operations |
3829 **************************************************************************/ | 3809 **************************************************************************/ |
3830 void | 3810 void |
3831 gaim_gtkconv_new(GaimConversation *conv) | 3811 gaim_gtkconv_new(GaimConversation *conv) |
3918 gaim_account_get_protocol_name(conv->account)); | 3898 gaim_account_get_protocol_name(conv->account)); |
3919 | 3899 |
3920 g_signal_connect_swapped(G_OBJECT(pane), "focus", | 3900 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
3921 G_CALLBACK(gtk_widget_grab_focus), | 3901 G_CALLBACK(gtk_widget_grab_focus), |
3922 gtkconv->entry); | 3902 gtkconv->entry); |
3923 | |
3924 if (conv_type == GAIM_CONV_TYPE_IM) | |
3925 { | |
3926 gaim_signal_connect(gaim_blist_get_handle(), "buddy-added", gtkconv, | |
3927 G_CALLBACK(buddy_update_cb), conv); | |
3928 gaim_signal_connect(gaim_blist_get_handle(), "buddy-removed", gtkconv, | |
3929 G_CALLBACK(buddy_update_cb), conv); | |
3930 } | |
3931 | 3903 |
3932 gaim_gtkconv_placement_place(gtkconv); | 3904 gaim_gtkconv_placement_place(gtkconv); |
3933 } | 3905 } |
3934 | 3906 |
3935 static void | 3907 static void |
6208 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && | 6180 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && |
6209 (gtkconv->u.im->animate)) | 6181 (gtkconv->u.im->animate)) |
6210 start_anim(NULL, gtkconv); | 6182 start_anim(NULL, gtkconv); |
6211 } | 6183 } |
6212 | 6184 |
6185 static void | |
6186 buddy_update_cb(GaimBlistNode *bnode, void *data) | |
6187 { | |
6188 GaimGtkWindow *win = (GaimGtkWindow *)data; | |
6189 GaimConversation *conv; | |
6190 | |
6191 g_return_if_fail(bnode); | |
6192 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode)); | |
6193 | |
6194 conv = gaim_gtk_conv_window_get_active_conversation(win); | |
6195 | |
6196 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) | |
6197 return; | |
6198 | |
6199 gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_ONLINE); | |
6200 } | |
6201 | |
6202 | |
6213 /************************************************************************** | 6203 /************************************************************************** |
6214 * GTK+ window ops | 6204 * GTK+ window ops |
6215 **************************************************************************/ | 6205 **************************************************************************/ |
6216 | 6206 |
6217 static GList *window_list = NULL; | 6207 static GList *window_list = NULL; |
6274 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | 6264 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); |
6275 g_signal_connect(G_OBJECT(win->notebook), "button_press_event", | 6265 g_signal_connect(G_OBJECT(win->notebook), "button_press_event", |
6276 G_CALLBACK(notebook_press_cb), win); | 6266 G_CALLBACK(notebook_press_cb), win); |
6277 g_signal_connect(G_OBJECT(win->notebook), "button_release_event", | 6267 g_signal_connect(G_OBJECT(win->notebook), "button_release_event", |
6278 G_CALLBACK(notebook_release_cb), win); | 6268 G_CALLBACK(notebook_release_cb), win); |
6269 | |
6270 gaim_signal_connect(gaim_blist_get_handle(), "buddy-added", win, | |
6271 G_CALLBACK(buddy_update_cb), win); | |
6272 gaim_signal_connect(gaim_blist_get_handle(), "buddy-removed", win, | |
6273 G_CALLBACK(buddy_update_cb), win); | |
6279 | 6274 |
6280 testidea = gtk_vbox_new(FALSE, 0); | 6275 testidea = gtk_vbox_new(FALSE, 0); |
6281 | 6276 |
6282 /* Setup the menubar. */ | 6277 /* Setup the menubar. */ |
6283 menubar = setup_menubar(win); | 6278 menubar = setup_menubar(win); |
6309 /* so don't destroy ourselves right now */ | 6304 /* so don't destroy ourselves right now */ |
6310 return; | 6305 return; |
6311 } | 6306 } |
6312 return; | 6307 return; |
6313 } | 6308 } |
6309 gaim_signals_disconnect_by_handle(win); | |
6314 gtk_widget_destroy(win->window); | 6310 gtk_widget_destroy(win->window); |
6315 | 6311 |
6316 g_object_unref(G_OBJECT(win->menu.item_factory)); | 6312 g_object_unref(G_OBJECT(win->menu.item_factory)); |
6317 | 6313 |
6318 g_free(win); | 6314 g_free(win); |