Mercurial > pidgin
comparison src/gtkconv.c @ 5678:619bca773b2e
[gaim-migrate @ 6096]
And now we have better sanity checks in the GTK+ conversation code.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Mon, 02 Jun 2003 22:17:30 +0000 |
| parents | dae79aefac8d |
| children | 71cc0d5376c2 |
comparison
equal
deleted
inserted
replaced
| 5677:0adfd56b46b5 | 5678:619bca773b2e |
|---|---|
| 1283 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | 1283 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, |
| 1284 gchar *new_text, gint new_text_length, gpointer user_data) | 1284 gchar *new_text, gint new_text_length, gpointer user_data) |
| 1285 { | 1285 { |
| 1286 GaimConversation *conv = (GaimConversation *)user_data; | 1286 GaimConversation *conv = (GaimConversation *)user_data; |
| 1287 | 1287 |
| 1288 if (conv == NULL) | 1288 g_return_if_fail(conv != NULL); |
| 1289 return; | |
| 1290 | 1289 |
| 1291 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) | 1290 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
| 1292 return; | 1291 return; |
| 1293 | 1292 |
| 1294 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | 1293 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && |
| 1300 GtkTextIter *end_pos, gpointer user_data) | 1299 GtkTextIter *end_pos, gpointer user_data) |
| 1301 { | 1300 { |
| 1302 GaimConversation *conv = (GaimConversation *)user_data; | 1301 GaimConversation *conv = (GaimConversation *)user_data; |
| 1303 GaimIm *im; | 1302 GaimIm *im; |
| 1304 | 1303 |
| 1305 if (conv == NULL) | 1304 g_return_if_fail(conv != NULL); |
| 1306 return; | |
| 1307 | 1305 |
| 1308 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) | 1306 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
| 1309 return; | 1307 return; |
| 1310 | 1308 |
| 1311 im = GAIM_IM(conv); | 1309 im = GAIM_IM(conv); |
| 1741 | 1739 |
| 1742 win = (GaimWindow *)user_data; | 1740 win = (GaimWindow *)user_data; |
| 1743 | 1741 |
| 1744 conv = gaim_window_get_conversation_at(win, page_num); | 1742 conv = gaim_window_get_conversation_at(win, page_num); |
| 1745 | 1743 |
| 1746 if (conv == NULL) | 1744 g_return_if_fail(conv != NULL); |
| 1747 return; | |
| 1748 | 1745 |
| 1749 gc = gaim_conversation_get_gc(conv); | 1746 gc = gaim_conversation_get_gc(conv); |
| 1750 gtkwin = GAIM_GTK_WINDOW(win); | 1747 gtkwin = GAIM_GTK_WINDOW(win); |
| 1751 gtkconv = GAIM_GTK_CONVERSATION(conv); | 1748 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 1752 | 1749 |
| 1909 GaimGtkConversation *gtkconv; | 1906 GaimGtkConversation *gtkconv; |
| 1910 | 1907 |
| 1911 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), | 1908 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), |
| 1912 "user_data"); | 1909 "user_data"); |
| 1913 | 1910 |
| 1914 if (conv == NULL) | 1911 g_return_if_fail(conv != NULL); |
| 1915 return; | |
| 1916 | 1912 |
| 1917 gtkconv = GAIM_GTK_CONVERSATION(conv); | 1913 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 1918 | 1914 |
| 1919 /* CONV TODO */ | 1915 /* CONV TODO */ |
| 1920 } | 1916 } |
| 2006 GaimConversation *conv; | 2002 GaimConversation *conv; |
| 2007 GaimGtkWindow *gtkwin; | 2003 GaimGtkWindow *gtkwin; |
| 2008 GtkWidget *menu; | 2004 GtkWidget *menu; |
| 2009 GList *child; | 2005 GList *child; |
| 2010 | 2006 |
| 2011 if (g_list_find(gaim_get_windows(), win) == NULL) | 2007 g_return_val_if_fail(g_list_find(gaim_get_windows(), win) != NULL, FALSE); |
| 2012 return FALSE; | |
| 2013 | 2008 |
| 2014 conv = gaim_window_get_active_conversation(win); | 2009 conv = gaim_window_get_active_conversation(win); |
| 2015 | 2010 |
| 2016 | 2011 g_return_val_if_fail(conv != NULL, FALSE); |
| 2017 if (conv == NULL) | 2012 |
| 2018 return FALSE; | 2013 account = gaim_conversation_get_account(conv); |
| 2019 | 2014 gtkwin = GAIM_GTK_WINDOW(win); |
| 2020 account = gaim_conversation_get_account(conv); | 2015 |
| 2021 gtkwin = GAIM_GTK_WINDOW(win); | 2016 g_return_val_if_fail(account != NULL, FALSE); |
| 2022 | |
| 2023 if (account == NULL) | |
| 2024 return FALSE; | |
| 2025 | 2017 |
| 2026 if (gtkwin->menu.send_as == NULL) | 2018 if (gtkwin->menu.send_as == NULL) |
| 2027 return FALSE; | 2019 return FALSE; |
| 2028 | 2020 |
| 2029 gtk_widget_show(gtkwin->menu.send_as); | 2021 gtk_widget_show(gtkwin->menu.send_as); |
| 2513 * remove the "/me " part of it (including that space) and return TRUE. | 2505 * remove the "/me " part of it (including that space) and return TRUE. |
| 2514 */ | 2506 */ |
| 2515 char *c; | 2507 char *c; |
| 2516 gboolean inside_html = 0; | 2508 gboolean inside_html = 0; |
| 2517 | 2509 |
| 2518 if (message == NULL) | 2510 /* Umm.. this would be very bad if this happens. */ |
| 2519 return FALSE; /* Umm.. this would be very bad if this happens. */ | 2511 g_return_val_if_fail(message != NULL, FALSE); |
| 2520 | 2512 |
| 2521 if (len == -1) | 2513 if (len == -1) |
| 2522 len = strlen(message); | 2514 len = strlen(message); |
| 2523 | 2515 |
| 2524 for (c = message; *c != '\0'; c++, len--) { | 2516 for (c = message; *c != '\0'; c++, len--) { |
| 4525 * Public conversation utility functions | 4517 * Public conversation utility functions |
| 4526 **************************************************************************/ | 4518 **************************************************************************/ |
| 4527 static void | 4519 static void |
| 4528 remove_icon(GaimGtkConversation *gtkconv) | 4520 remove_icon(GaimGtkConversation *gtkconv) |
| 4529 { | 4521 { |
| 4530 if (gtkconv == NULL) | 4522 g_return_if_fail(gtkconv != NULL); |
| 4531 return; | |
| 4532 | 4523 |
| 4533 if (gtkconv->u.im->icon != NULL) | 4524 if (gtkconv->u.im->icon != NULL) |
| 4534 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | 4525 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), |
| 4535 gtkconv->u.im->icon->parent->parent); | 4526 gtkconv->u.im->icon->parent->parent); |
| 4536 | 4527 |
| 4707 GdkPixbuf *scale; | 4698 GdkPixbuf *scale; |
| 4708 GdkPixmap *pm; | 4699 GdkPixmap *pm; |
| 4709 GdkBitmap *bm; | 4700 GdkBitmap *bm; |
| 4710 int sf = 0; | 4701 int sf = 0; |
| 4711 | 4702 |
| 4712 if (conv == NULL || !GAIM_IS_GTK_CONVERSATION(conv) || | 4703 g_return_if_fail(conv != NULL); |
| 4713 gaim_conversation_get_type(conv) != GAIM_CONV_IM) { | 4704 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
| 4714 | 4705 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
| 4715 return; | |
| 4716 } | |
| 4717 | 4706 |
| 4718 gtkconv = GAIM_GTK_CONVERSATION(conv); | 4707 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 4719 | 4708 |
| 4720 if (gtkconv->u.im->icon_timer == 0 && gtkconv->u.im->icon != NULL) | 4709 if (gtkconv->u.im->icon_timer == 0 && gtkconv->u.im->icon != NULL) |
| 4721 animate = FALSE; | 4710 animate = FALSE; |
