comparison plugins/notify.c @ 11606:243dd81341a7

[gaim-migrate @ 13877] Fix 2 things with notify.c, one was causing warnings about signal instances, and the other a crash only sometimes on closing a tab. Also randomly removed redundent if !NULL free() in conversation.c committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 04 Oct 2005 02:48:25 +0000
parents 9b3833da6840
children 872932089400
comparison
equal deleted inserted replaced
11605:f36471a3c258 11606:243dd81341a7
308 * focus-in-event on the g(d|t)kwindow */ 308 * focus-in-event on the g(d|t)kwindow */
309 /* try setting the signal on the focus-in-event for 309 /* try setting the signal on the focus-in-event for
310 * gtkwin->notebook->container? */ 310 * gtkwin->notebook->container? */
311 id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", 311 id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event",
312 G_CALLBACK(unnotify_cb), conv); 312 G_CALLBACK(unnotify_cb), conv);
313 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); 313 entry_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id));
314 314
315 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event", 315 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event",
316 G_CALLBACK(unnotify_cb), conv); 316 G_CALLBACK(unnotify_cb), conv);
317 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); 317 imhtml_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id));
318 } 318 }
319 319
320 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { 320 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) {
321 /* TODO similarly should really find a way to allow for clicking in other 321 /* TODO similarly should really find a way to allow for clicking in other
322 * places of the window */ 322 * places of the window */
345 static void 345 static void
346 detach_signals(GaimConversation *conv) 346 detach_signals(GaimConversation *conv)
347 { 347 {
348 GaimGtkConversation *gtkconv = NULL; 348 GaimGtkConversation *gtkconv = NULL;
349 GaimGtkWindow *gtkwin = NULL; 349 GaimGtkWindow *gtkwin = NULL;
350 GSList *ids = NULL; 350 GSList *ids = NULL, *l;
351 351
352 gtkconv = GAIM_GTK_CONVERSATION(conv); 352 gtkconv = GAIM_GTK_CONVERSATION(conv);
353 if (!gtkconv) 353 if (!gtkconv)
354 return; 354 return;
355 gtkwin = gtkconv->win; 355 gtkwin = gtkconv->win;
356 356
357 ids = gaim_conversation_get_data(conv, "notify-window-signals"); 357 ids = gaim_conversation_get_data(conv, "notify-window-signals");
358 for (; ids != NULL; ids = ids->next) 358 for (l = ids; l != NULL; l = l->next)
359 g_signal_handler_disconnect(gtkwin->window, GPOINTER_TO_INT(ids->data)); 359 g_signal_handler_disconnect(gtkwin->window, GPOINTER_TO_INT(l->data));
360 g_slist_free(ids);
360 361
361 ids = gaim_conversation_get_data(conv, "notify-imhtml-signals"); 362 ids = gaim_conversation_get_data(conv, "notify-imhtml-signals");
362 for (; ids != NULL; ids = ids->next) 363 for (l = ids; l != NULL; l = l->next)
363 g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(ids->data)); 364 g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(l->data));
365 g_slist_free(ids);
364 366
365 ids = gaim_conversation_get_data(conv, "notify-entry-signals"); 367 ids = gaim_conversation_get_data(conv, "notify-entry-signals");
366 for (; ids != NULL; ids = ids->next) 368 for (l = ids; l != NULL; l = l->next)
367 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(ids->data)); 369 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(l->data));
370 g_slist_free(ids);
368 371
369 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); 372 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0));
370 373
371 gaim_conversation_set_data(conv, "notify-window-signals", NULL); 374 gaim_conversation_set_data(conv, "notify-window-signals", NULL);
372 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL); 375 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL);
415 { 418 {
416 GaimGtkWindow *gaimwin = NULL; 419 GaimGtkWindow *gaimwin = NULL;
417 420
418 detach_signals(conv); 421 detach_signals(conv);
419 422
420 unnotify(conv, TRUE);
421
422 gaimwin = GAIM_GTK_CONVERSATION(conv)->win; 423 gaimwin = GAIM_GTK_CONVERSATION(conv)->win;
424
425
426 handle_urgent(gaimwin, FALSE);
427 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0));
428
429
430 return;
431
423 #if 0 432 #if 0
424 /* i think this line crashes */ 433 /* i think this line crashes */
425 if (count_messages(gaimwin)) 434 if (count_messages(gaimwin))
426 notify_win(gaimwin); 435 notify_win(gaimwin);
427 #endif 436 #endif