Mercurial > pidgin
comparison src/gtkconv.c @ 12867:cf3540702d21
[gaim-migrate @ 15218]
A patch from Ranma42 in SF Bug #1220557, with lots of changes by me.
This merges gaim_conv_chat_remove_users and gaim_conv_chat_remove_user.
As I did with gaim_conv_chat_add_user and gaim_conv_chat_add_users,
gaim_conv_chat_remove_user is just a simple wrapper. The conversation UI op
chat_remove_user has similarly been removed, in favor of UIs only having to
implement one function to remove users.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sat, 14 Jan 2006 00:06:24 +0000 |
parents | 1096bdfef887 |
children | e9b0c90ce58a |
comparison
equal
deleted
inserted
replaced
12866:43d8af815a9d | 12867:cf3540702d21 |
---|---|
4890 | 4890 |
4891 add_chat_buddy_common(conv, new_name, flags, new_alias, old_name); | 4891 add_chat_buddy_common(conv, new_name, flags, new_alias, old_name); |
4892 } | 4892 } |
4893 | 4893 |
4894 static void | 4894 static void |
4895 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) | |
4896 { | |
4897 GaimConvChat *chat; | |
4898 GaimGtkConversation *gtkconv; | |
4899 GaimGtkChatPane *gtkchat; | |
4900 GtkTreeIter iter; | |
4901 GtkTreeModel *model; | |
4902 char tmp[BUF_LONG]; | |
4903 int num_users; | |
4904 int f = 1; | |
4905 | |
4906 chat = GAIM_CONV_CHAT(conv); | |
4907 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4908 gtkchat = gtkconv->u.chat; | |
4909 | |
4910 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - 1; | |
4911 | |
4912 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
4913 | |
4914 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4915 return; | |
4916 | |
4917 while (f != 0) { | |
4918 char *val; | |
4919 | |
4920 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
4921 | |
4922 if (!gaim_utf8_strcasecmp(user, val)) { | |
4923 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
4924 g_free(val); | |
4925 break; | |
4926 } | |
4927 | |
4928 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4929 | |
4930 g_free(val); | |
4931 } | |
4932 | |
4933 if (!gaim_conv_chat_find_user(chat, user)) | |
4934 return; | |
4935 | |
4936 g_snprintf(tmp, sizeof(tmp), | |
4937 ngettext("%d person in room", "%d people in room", | |
4938 num_users), num_users); | |
4939 | |
4940 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4941 | |
4942 } | |
4943 | |
4944 static void | |
4945 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) | 4895 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
4946 { | 4896 { |
4947 GaimConvChat *chat; | 4897 GaimConvChat *chat; |
4948 GaimGtkConversation *gtkconv; | 4898 GaimGtkConversation *gtkconv; |
4949 GaimGtkChatPane *gtkchat; | 4899 GaimGtkChatPane *gtkchat; |
5637 gaim_gtkconv_write_chat, /* write_chat */ | 5587 gaim_gtkconv_write_chat, /* write_chat */ |
5638 gaim_gtkconv_write_im, /* write_im */ | 5588 gaim_gtkconv_write_im, /* write_im */ |
5639 gaim_gtkconv_write_conv, /* write_conv */ | 5589 gaim_gtkconv_write_conv, /* write_conv */ |
5640 gaim_gtkconv_chat_add_users, /* chat_add_users */ | 5590 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
5641 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ | 5591 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5642 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
5643 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ | 5592 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
5644 gaim_gtkconv_chat_update_user, /* chat_update_user */ | 5593 gaim_gtkconv_chat_update_user, /* chat_update_user */ |
5645 gaim_gtkconv_present_conversation, /* present */ | 5594 gaim_gtkconv_present_conversation, /* present */ |
5646 gaim_gtkconv_has_focus, /* has_focus */ | 5595 gaim_gtkconv_has_focus, /* has_focus */ |
5647 gaim_gtkconv_custom_smiley_add, /* custom_smiley_add */ | 5596 gaim_gtkconv_custom_smiley_add, /* custom_smiley_add */ |