Mercurial > pidgin.yaz
comparison pidgin/gtkblist.c @ 27996:b29eac4769e9
merge of '16bc7e72b5dd239ce65c63a388c2d39efc5b7c32'
and '31cfeb857db37f5ed2d12cf084073349436c89e5'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 22 Jul 2009 04:15:02 +0000 |
parents | 429fce11f244 |
children | 0754698c49f4 deecc1d663c4 3a45ecbe4821 |
comparison
equal
deleted
inserted
replaced
27992:151ec92db74c | 27996:b29eac4769e9 |
---|---|
6978 } | 6978 } |
6979 | 6979 |
6980 static void | 6980 static void |
6981 add_chat_cb(GtkWidget *w, PidginAddChatData *data) | 6981 add_chat_cb(GtkWidget *w, PidginAddChatData *data) |
6982 { | 6982 { |
6983 GHashTable *components; | |
6984 GList *tmp; | 6983 GList *tmp; |
6985 PurpleChat *chat; | 6984 PurpleChat *chat; |
6986 PurpleGroup *group; | 6985 GHashTable *components; |
6987 const char *group_name; | |
6988 const char *value; | |
6989 | 6986 |
6990 components = g_hash_table_new_full(g_str_hash, g_str_equal, | 6987 components = g_hash_table_new_full(g_str_hash, g_str_equal, |
6991 g_free, g_free); | 6988 g_free, g_free); |
6992 | 6989 |
6993 for (tmp = data->chat_data.entries; tmp; tmp = tmp->next) | 6990 for (tmp = data->chat_data.entries; tmp; tmp = tmp->next) |
6999 g_strdup_printf("%d", | 6996 g_strdup_printf("%d", |
7000 gtk_spin_button_get_value_as_int(tmp->data))); | 6997 gtk_spin_button_get_value_as_int(tmp->data))); |
7001 } | 6998 } |
7002 else | 6999 else |
7003 { | 7000 { |
7004 value = gtk_entry_get_text(tmp->data); | 7001 const char *value = gtk_entry_get_text(tmp->data); |
7002 | |
7005 if (*value != '\0') | 7003 if (*value != '\0') |
7006 g_hash_table_replace(components, | 7004 g_hash_table_replace(components, |
7007 g_strdup(g_object_get_data(tmp->data, "identifier")), | 7005 g_strdup(g_object_get_data(tmp->data, "identifier")), |
7008 g_strdup(value)); | 7006 g_strdup(value)); |
7009 } | 7007 } |
7010 } | 7008 } |
7011 | 7009 |
7012 chat = purple_chat_new(data->chat_data.rq_data.account, | 7010 chat = purple_chat_new(data->chat_data.rq_data.account, |
7013 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)), | 7011 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)), |
7014 components); | 7012 components); |
7015 | 7013 |
7016 group_name = pidgin_text_combo_box_entry_get_text(data->group_combo); | 7014 if (chat != NULL) { |
7017 | 7015 PurpleGroup *group; |
7018 group = NULL; | 7016 const char *group_name; |
7019 if ((group_name != NULL) && (*group_name != '\0') && ((group = purple_find_group(group_name)) == NULL)) | 7017 |
7020 { | 7018 group_name = pidgin_text_combo_box_entry_get_text(data->group_combo); |
7021 group = purple_group_new(group_name); | 7019 |
7022 purple_blist_add_group(group, NULL); | 7020 group = NULL; |
7023 } | 7021 if ((group_name != NULL) && (*group_name != '\0') && |
7024 | 7022 ((group = purple_find_group(group_name)) == NULL)) |
7025 if (chat != NULL) | 7023 { |
7026 { | 7024 group = purple_group_new(group_name); |
7025 purple_blist_add_group(group, NULL); | |
7026 } | |
7027 | |
7027 purple_blist_add_chat(chat, group, NULL); | 7028 purple_blist_add_chat(chat, group, NULL); |
7028 } | 7029 |
7029 | 7030 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->autojoin))) |
7030 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->autojoin))) | 7031 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", TRUE); |
7031 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", TRUE); | 7032 |
7032 | 7033 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->persistent))) |
7033 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->persistent))) | 7034 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", TRUE); |
7034 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", TRUE); | 7035 } |
7035 | 7036 |
7036 gtk_widget_destroy(data->chat_data.rq_data.window); | 7037 gtk_widget_destroy(data->chat_data.rq_data.window); |
7037 g_free(data->chat_data.default_chat_name); | 7038 g_free(data->chat_data.default_chat_name); |
7038 g_list_free(data->chat_data.entries); | 7039 g_list_free(data->chat_data.entries); |
7039 g_free(data); | 7040 g_free(data); |