Mercurial > pidgin
comparison src/gtkconv.c @ 14035:8bda65b88e49
[gaim-migrate @ 16638]
A bunch of small changes. Mostly remove "if not null" checks before
calling g_free, g_list_free, g_slist_free and g_strdup. Also use
g_list_foreach() to call g_free to free strings in an array. And
some whitespace changes here and there.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 05 Aug 2006 08:27:39 +0000 |
parents | d856c2ec93ca |
children | 7f276f375789 |
comparison
equal
deleted
inserted
replaced
14034:0839a7b71325 | 14035:8bda65b88e49 |
---|---|
191 **************************************************************************/ | 191 **************************************************************************/ |
192 | 192 |
193 static gint | 193 static gint |
194 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) | 194 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
195 { | 195 { |
196 GList *list = g_list_copy(gtkconv->convs), *l; | 196 GList *list = g_list_copy(gtkconv->convs); |
197 | 197 |
198 l = list; | 198 g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL); |
199 while (l) { | |
200 GaimConversation *conv = l->data; | |
201 gaim_conversation_destroy(conv); | |
202 l = l->next; | |
203 } | |
204 | |
205 g_list_free(list); | 199 g_list_free(list); |
206 | 200 |
207 return TRUE; | 201 return TRUE; |
208 } | 202 } |
209 | 203 |
487 GAIM_MESSAGE_NO_LOG, time(NULL)); | 481 GAIM_MESSAGE_NO_LOG, time(NULL)); |
488 return TRUE; | 482 return TRUE; |
489 case GAIM_CMD_STATUS_FAILED: | 483 case GAIM_CMD_STATUS_FAILED: |
490 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), | 484 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
491 GAIM_MESSAGE_NO_LOG, time(NULL)); | 485 GAIM_MESSAGE_NO_LOG, time(NULL)); |
492 if(error) | 486 g_free(error); |
493 g_free(error); | |
494 return TRUE; | 487 return TRUE; |
495 case GAIM_CMD_STATUS_WRONG_TYPE: | 488 case GAIM_CMD_STATUS_WRONG_TYPE: |
496 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 489 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
497 gaim_conversation_write(conv, "", _("That command only works in chats, not IMs."), | 490 gaim_conversation_write(conv, "", _("That command only works in chats, not IMs."), |
498 GAIM_MESSAGE_NO_LOG, time(NULL)); | 491 GAIM_MESSAGE_NO_LOG, time(NULL)); |
769 { | 762 { |
770 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username); | 763 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username); |
771 } | 764 } |
772 } | 765 } |
773 | 766 |
774 if (username != NULL) g_free(username); | 767 g_free(username); |
775 if (protocol != NULL) g_free(protocol); | 768 g_free(protocol); |
776 | 769 |
777 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | 770 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
778 } | 771 } |
779 } | 772 } |
780 | 773 |
1424 gaim_conv_chat_unignore(chat, name); | 1417 gaim_conv_chat_unignore(chat, name); |
1425 else | 1418 else |
1426 gaim_conv_chat_ignore(chat, name); | 1419 gaim_conv_chat_ignore(chat, name); |
1427 | 1420 |
1428 cbuddy = gaim_conv_chat_cb_new(name, alias, flags); | 1421 cbuddy = gaim_conv_chat_cb_new(name, alias, flags); |
1429 | 1422 |
1430 add_chat_buddy_common(conv, cbuddy, NULL); | 1423 add_chat_buddy_common(conv, cbuddy, NULL); |
1431 g_free(name); | 1424 g_free(name); |
1432 g_free(alias); | 1425 g_free(alias); |
1433 } | 1426 } |
1434 | 1427 |
1523 GtkTextMark *mark; | 1516 GtkTextMark *mark; |
1524 const char *who; | 1517 const char *who; |
1525 | 1518 |
1526 who = g_object_get_data(G_OBJECT(w), "user_data"); | 1519 who = g_object_get_data(G_OBJECT(w), "user_data"); |
1527 mark = get_mark_for_user(gtkconv, who); | 1520 mark = get_mark_for_user(gtkconv, who); |
1528 | 1521 |
1529 if (mark != NULL) | 1522 if (mark != NULL) |
1530 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); | 1523 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); |
1531 else | 1524 else |
1532 g_return_if_reached(); | 1525 g_return_if_reached(); |
1533 } | 1526 } |
3212 generate_invite_user_names(GaimConnection *gc) | 3205 generate_invite_user_names(GaimConnection *gc) |
3213 { | 3206 { |
3214 GaimBlistNode *gnode,*cnode,*bnode; | 3207 GaimBlistNode *gnode,*cnode,*bnode; |
3215 static GList *tmp = NULL; | 3208 static GList *tmp = NULL; |
3216 | 3209 |
3217 if (tmp) | 3210 g_list_free(tmp); |
3218 g_list_free(tmp); | |
3219 | 3211 |
3220 tmp = g_list_append(NULL, ""); | 3212 tmp = g_list_append(NULL, ""); |
3221 | 3213 |
3222 if (gc != NULL) { | 3214 if (gc != NULL) { |
3223 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { | 3215 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
4259 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); | 4251 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); |
4260 } | 4252 } |
4261 } | 4253 } |
4262 } | 4254 } |
4263 | 4255 |
4264 if (username != NULL) g_free(username); | 4256 g_free(username); |
4265 if (protocol != NULL) g_free(protocol); | 4257 g_free(protocol); |
4266 | 4258 |
4267 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | 4259 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4268 } | 4260 } |
4269 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { | 4261 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
4270 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 4262 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
4866 strcpy(color, "#000000"); | 4858 strcpy(color, "#000000"); |
4867 } | 4859 } |
4868 } | 4860 } |
4869 } | 4861 } |
4870 | 4862 |
4871 if(alias_escaped) | 4863 g_free(alias_escaped); |
4872 g_free(alias_escaped); | |
4873 | 4864 |
4874 /* Are we in a chat where we can tell which users are buddies? */ | 4865 /* Are we in a chat where we can tell which users are buddies? */ |
4875 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && | 4866 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && |
4876 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 4867 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { |
4877 | 4868 |
5068 return; | 5059 return; |
5069 | 5060 |
5070 g_return_if_fail(new_alias != NULL); | 5061 g_return_if_fail(new_alias != NULL); |
5071 | 5062 |
5072 cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags); | 5063 cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags); |
5073 | 5064 |
5074 add_chat_buddy_common(conv, cbuddy, old_name); | 5065 add_chat_buddy_common(conv, cbuddy, old_name); |
5075 } | 5066 } |
5076 | 5067 |
5077 static void | 5068 static void |
5078 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) | 5069 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
5175 g_return_if_fail(alias != NULL); | 5166 g_return_if_fail(alias != NULL); |
5176 | 5167 |
5177 flags = gaim_conv_chat_user_get_flags(chat, user); | 5168 flags = gaim_conv_chat_user_get_flags(chat, user); |
5178 | 5169 |
5179 cbuddy = gaim_conv_chat_cb_new(user, alias, flags); | 5170 cbuddy = gaim_conv_chat_cb_new(user, alias, flags); |
5180 | 5171 |
5181 add_chat_buddy_common(conv, cbuddy, NULL); | 5172 add_chat_buddy_common(conv, cbuddy, NULL); |
5182 g_free(alias); | 5173 g_free(alias); |
5183 } | 5174 } |
5184 | 5175 |
5185 gboolean | 5176 gboolean |