| 1034 1, PURPLE_PROXY_NONE, |
1035 1, PURPLE_PROXY_NONE, |
| 1035 -1); |
1036 -1); |
| 1036 |
1037 |
| 1037 gtk_list_store_append(model, &iter); |
1038 gtk_list_store_append(model, &iter); |
| 1038 gtk_list_store_set(model, &iter, |
1039 gtk_list_store_set(model, &iter, |
| 1039 0, _("HTTP"), |
|
| 1040 1, PURPLE_PROXY_HTTP, |
|
| 1041 -1); |
|
| 1042 |
|
| 1043 gtk_list_store_append(model, &iter); |
|
| 1044 gtk_list_store_set(model, &iter, |
|
| 1045 0, _("SOCKS 4"), |
1040 0, _("SOCKS 4"), |
| 1046 1, PURPLE_PROXY_SOCKS4, |
1041 1, PURPLE_PROXY_SOCKS4, |
| 1047 -1); |
1042 -1); |
| 1048 |
1043 |
| 1049 gtk_list_store_append(model, &iter); |
1044 gtk_list_store_append(model, &iter); |
| 1052 1, PURPLE_PROXY_SOCKS5, |
1047 1, PURPLE_PROXY_SOCKS5, |
| 1053 -1); |
1048 -1); |
| 1054 |
1049 |
| 1055 gtk_list_store_append(model, &iter); |
1050 gtk_list_store_append(model, &iter); |
| 1056 gtk_list_store_set(model, &iter, |
1051 gtk_list_store_set(model, &iter, |
| |
1052 0, _("Tor/Privacy (SOCKS5)"), |
| |
1053 1, PURPLE_PROXY_TOR, |
| |
1054 -1); |
| |
1055 |
| |
1056 gtk_list_store_append(model, &iter); |
| |
1057 gtk_list_store_set(model, &iter, |
| |
1058 0, _("HTTP"), |
| |
1059 1, PURPLE_PROXY_HTTP, |
| |
1060 -1); |
| |
1061 |
| |
1062 gtk_list_store_append(model, &iter); |
| |
1063 gtk_list_store_set(model, &iter, |
| 1057 0, _("Use Environmental Settings"), |
1064 0, _("Use Environmental Settings"), |
| 1058 1, PURPLE_PROXY_USE_ENVVAR, |
1065 1, PURPLE_PROXY_USE_ENVVAR, |
| 1059 -1); |
1066 -1); |
| 1060 |
1067 |
| 1061 renderer = gtk_cell_renderer_text_new(); |
1068 renderer = gtk_cell_renderer_text_new(); |
| 1067 } |
1074 } |
| 1068 |
1075 |
| 1069 static void |
1076 static void |
| 1070 proxy_type_changed_cb(GtkWidget *menu, AccountPrefsDialog *dialog) |
1077 proxy_type_changed_cb(GtkWidget *menu, AccountPrefsDialog *dialog) |
| 1071 { |
1078 { |
| 1072 dialog->new_proxy_type = |
1079 GtkTreeIter iter; |
| 1073 gtk_combo_box_get_active(GTK_COMBO_BOX(menu)) - 1; |
1080 |
| |
1081 if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(menu), &iter)) { |
| |
1082 int int_value; |
| |
1083 gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(menu)), &iter, |
| |
1084 1, &int_value, -1); |
| |
1085 dialog->new_proxy_type = int_value; |
| |
1086 } |
| 1074 |
1087 |
| 1075 if (dialog->new_proxy_type == PURPLE_PROXY_USE_GLOBAL || |
1088 if (dialog->new_proxy_type == PURPLE_PROXY_USE_GLOBAL || |
| 1076 dialog->new_proxy_type == PURPLE_PROXY_NONE || |
1089 dialog->new_proxy_type == PURPLE_PROXY_NONE || |
| 1077 dialog->new_proxy_type == PURPLE_PROXY_USE_ENVVAR) { |
1090 dialog->new_proxy_type == PURPLE_PROXY_USE_ENVVAR) { |
| 1078 |
1091 |
| 1156 #endif /* Less than GTK+ 2.16 */ |
1171 #endif /* Less than GTK+ 2.16 */ |
| 1157 add_pref_box(dialog, vbox2, _("Pa_ssword:"), dialog->proxy_pass_entry); |
1172 add_pref_box(dialog, vbox2, _("Pa_ssword:"), dialog->proxy_pass_entry); |
| 1158 |
1173 |
| 1159 if (dialog->account != NULL && |
1174 if (dialog->account != NULL && |
| 1160 (proxy_info = purple_account_get_proxy_info(dialog->account)) != NULL) { |
1175 (proxy_info = purple_account_get_proxy_info(dialog->account)) != NULL) { |
| 1161 |
|
| 1162 PurpleProxyType type = purple_proxy_info_get_type(proxy_info); |
|
| 1163 const char *value; |
1176 const char *value; |
| 1164 int int_val; |
1177 int int_val; |
| 1165 |
1178 |
| 1166 /* Hah! */ |
1179 dialog->new_proxy_type = purple_proxy_info_get_type(proxy_info); |
| 1167 /* I dunno what you're laughing about, fuzz ball. */ |
|
| 1168 dialog->new_proxy_type = type; |
|
| 1169 gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->proxy_dropdown), |
|
| 1170 type + 1); |
|
| 1171 |
|
| 1172 if (type == PURPLE_PROXY_USE_GLOBAL || type == PURPLE_PROXY_NONE || |
|
| 1173 type == PURPLE_PROXY_USE_ENVVAR) |
|
| 1174 gtk_widget_hide(vbox2); |
|
| 1175 |
|
| 1176 |
1180 |
| 1177 if ((value = purple_proxy_info_get_host(proxy_info)) != NULL) |
1181 if ((value = purple_proxy_info_get_host(proxy_info)) != NULL) |
| 1178 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), value); |
1182 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), value); |
| 1179 |
1183 |
| 1180 if ((int_val = purple_proxy_info_get_port(proxy_info)) != 0) { |
1184 if ((int_val = purple_proxy_info_get_port(proxy_info)) != 0) { |
| 1188 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL) |
1192 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL) |
| 1189 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_user_entry), value); |
1193 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_user_entry), value); |
| 1190 |
1194 |
| 1191 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL) |
1195 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL) |
| 1192 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_pass_entry), value); |
1196 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_pass_entry), value); |
| 1193 } |
1197 |
| 1194 else { |
1198 } else |
| 1195 dialog->new_proxy_type = PURPLE_PROXY_USE_GLOBAL; |
1199 dialog->new_proxy_type = PURPLE_PROXY_USE_GLOBAL; |
| 1196 gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->proxy_dropdown), |
1200 |
| 1197 dialog->new_proxy_type + 1); |
1201 proxy_model = gtk_combo_box_get_model( |
| 1198 gtk_widget_hide(vbox2); |
1202 GTK_COMBO_BOX(dialog->proxy_dropdown)); |
| 1199 } |
1203 if (gtk_tree_model_get_iter_first(proxy_model, &iter)) { |
| |
1204 int int_val; |
| |
1205 do { |
| |
1206 gtk_tree_model_get(proxy_model, &iter, 1, &int_val, -1); |
| |
1207 if (int_val == dialog->new_proxy_type) { |
| |
1208 gtk_combo_box_set_active_iter( |
| |
1209 GTK_COMBO_BOX(dialog->proxy_dropdown), &iter); |
| |
1210 break; |
| |
1211 } |
| |
1212 } while(gtk_tree_model_iter_next(proxy_model, &iter)); |
| |
1213 } |
| |
1214 |
| |
1215 proxy_type_changed_cb(dialog->proxy_dropdown, dialog); |
| 1200 |
1216 |
| 1201 /* Connect signals. */ |
1217 /* Connect signals. */ |
| 1202 g_signal_connect(G_OBJECT(dialog->proxy_dropdown), "changed", |
1218 g_signal_connect(G_OBJECT(dialog->proxy_dropdown), "changed", |
| 1203 G_CALLBACK(proxy_type_changed_cb), dialog); |
1219 G_CALLBACK(proxy_type_changed_cb), dialog); |
| 1204 } |
1220 } |
| 2156 const char *path; |
2172 const char *path; |
| 2157 |
2173 |
| 2158 gtk_list_store_clear(dialog->model); |
2174 gtk_list_store_clear(dialog->model); |
| 2159 |
2175 |
| 2160 if ((path = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon")) != NULL) { |
2176 if ((path = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon")) != NULL) { |
| 2161 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, NULL); |
2177 GdkPixbuf *pixbuf = pidgin_pixbuf_new_from_file(path); |
| 2162 if (pixbuf != NULL) { |
2178 if (pixbuf != NULL) { |
| 2163 global_buddyicon = gdk_pixbuf_scale_simple(pixbuf, 22, 22, GDK_INTERP_HYPER); |
2179 global_buddyicon = gdk_pixbuf_scale_simple(pixbuf, 22, 22, GDK_INTERP_HYPER); |
| 2164 g_object_unref(G_OBJECT(pixbuf)); |
2180 g_object_unref(G_OBJECT(pixbuf)); |
| 2165 } |
2181 } |
| 2166 } |
2182 } |
| 2290 /* Handle double-clicking */ |
2306 /* Handle double-clicking */ |
| 2291 g_signal_connect(G_OBJECT(treeview), "button_press_event", |
2307 g_signal_connect(G_OBJECT(treeview), "button_press_event", |
| 2292 G_CALLBACK(account_treeview_double_click_cb), dialog); |
2308 G_CALLBACK(account_treeview_double_click_cb), dialog); |
| 2293 |
2309 |
| 2294 gtk_notebook_append_page(GTK_NOTEBOOK(accounts_window->notebook), |
2310 gtk_notebook_append_page(GTK_NOTEBOOK(accounts_window->notebook), |
| 2295 pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1), |
2311 pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1), |
| 2296 NULL); |
2312 NULL); |
| 2297 |
2313 |
| 2298 add_columns(treeview, dialog); |
2314 add_columns(treeview, dialog); |
| 2299 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(treeview)); |
2315 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(treeview)); |
| 2300 |
2316 |
| 2538 deny_no_add_cb(struct auth_request *ar) |
2554 deny_no_add_cb(struct auth_request *ar) |
| 2539 { |
2555 { |
| 2540 ar->deny_cb(ar->data); |
2556 ar->deny_cb(ar->data); |
| 2541 } |
2557 } |
| 2542 |
2558 |
| |
2559 static gboolean |
| |
2560 get_user_info_cb(GtkWidget *label, |
| |
2561 const gchar *uri, |
| |
2562 gpointer data) |
| |
2563 { |
| |
2564 struct auth_request *ar = data; |
| |
2565 if (!strcmp(uri, "viewinfo")) { |
| |
2566 pidgin_retrieve_user_info(purple_account_get_connection(ar->account), ar->username); |
| |
2567 return TRUE; |
| |
2568 } |
| |
2569 return FALSE; |
| |
2570 } |
| |
2571 |
| |
2572 static void |
| |
2573 send_im_cb(PidginMiniDialog *mini_dialog, |
| |
2574 GtkButton *button, |
| |
2575 gpointer data) |
| |
2576 { |
| |
2577 struct auth_request *ar = data; |
| |
2578 pidgin_dialogs_im_with_user(ar->account, ar->username); |
| |
2579 } |
| |
2580 |
| 2543 static void * |
2581 static void * |
| 2544 pidgin_accounts_request_authorization(PurpleAccount *account, |
2582 pidgin_accounts_request_authorization(PurpleAccount *account, |
| 2545 const char *remote_user, |
2583 const char *remote_user, |
| 2546 const char *id, |
2584 const char *id, |
| 2547 const char *alias, |
2585 const char *alias, |
| 2552 void *user_data) |
2590 void *user_data) |
| 2553 { |
2591 { |
| 2554 char *buffer; |
2592 char *buffer; |
| 2555 PurpleConnection *gc; |
2593 PurpleConnection *gc; |
| 2556 GtkWidget *alert; |
2594 GtkWidget *alert; |
| |
2595 PidginMiniDialog *dialog; |
| 2557 GdkPixbuf *prpl_icon; |
2596 GdkPixbuf *prpl_icon; |
| 2558 struct auth_request *aa; |
2597 struct auth_request *aa; |
| |
2598 const char *our_name; |
| 2559 gboolean have_valid_alias = alias && *alias; |
2599 gboolean have_valid_alias = alias && *alias; |
| 2560 |
2600 |
| 2561 gc = purple_account_get_connection(account); |
2601 gc = purple_account_get_connection(account); |
| 2562 if (message != NULL && *message == '\0') |
2602 if (message != NULL && *message == '\0') |
| 2563 message = NULL; |
2603 message = NULL; |
| 2564 |
2604 |
| 2565 buffer = g_strdup_printf(_("%s%s%s%s wants to add you (%s) to his or her buddy list%s%s"), |
2605 our_name = (id != NULL) ? id : |
| 2566 remote_user, |
2606 (purple_connection_get_display_name(gc) != NULL) ? purple_connection_get_display_name(gc) : |
| 2567 (have_valid_alias ? " (" : ""), |
2607 purple_account_get_username(account); |
| 2568 (have_valid_alias ? alias : ""), |
2608 |
| 2569 (have_valid_alias ? ")" : ""), |
2609 if (pidgin_mini_dialog_links_supported()) { |
| 2570 (id != NULL |
2610 char *escaped_remote_user = g_markup_escape_text(remote_user, -1); |
| 2571 ? id |
2611 char *escaped_alias = alias != NULL ? g_markup_escape_text(alias, -1) : g_strdup(""); |
| 2572 : (purple_connection_get_display_name(gc) != NULL |
2612 char *escaped_our_name = g_markup_escape_text(our_name, -1); |
| 2573 ? purple_connection_get_display_name(gc) |
2613 char *escaped_message = message != NULL ? g_markup_escape_text(message, -1) : g_strdup(""); |
| 2574 : purple_account_get_username(account))), |
2614 buffer = g_strdup_printf(_("<a href=\"viewinfo\">%s</a>%s%s%s wants to add you (%s) to his or her buddy list%s%s"), |
| 2575 (message != NULL ? ": " : "."), |
2615 escaped_remote_user, |
| 2576 (message != NULL ? message : "")); |
2616 (have_valid_alias ? " (" : ""), |
| 2577 |
2617 escaped_alias, |
| |
2618 (have_valid_alias ? ")" : ""), |
| |
2619 escaped_our_name, |
| |
2620 (have_valid_alias ? ": " : "."), |
| |
2621 escaped_message); |
| |
2622 g_free(escaped_remote_user); |
| |
2623 g_free(escaped_alias); |
| |
2624 g_free(escaped_our_name); |
| |
2625 g_free(escaped_message); |
| |
2626 } else { |
| |
2627 buffer = g_strdup_printf(_("%s%s%s%s wants to add you (%s) to his or her buddy list%s%s"), |
| |
2628 remote_user, |
| |
2629 (have_valid_alias ? " (" : ""), |
| |
2630 (have_valid_alias ? alias : ""), |
| |
2631 (have_valid_alias ? ")" : ""), |
| |
2632 our_name, |
| |
2633 (message != NULL ? ": " : "."), |
| |
2634 (message != NULL ? message : "")); |
| |
2635 } |
| 2578 |
2636 |
| 2579 prpl_icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); |
2637 prpl_icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); |
| 2580 |
2638 |
| 2581 aa = g_new0(struct auth_request, 1); |
2639 aa = g_new0(struct auth_request, 1); |
| 2582 aa->auth_cb = auth_cb; |
2640 aa->auth_cb = auth_cb; |
| 2587 aa->account = account; |
2645 aa->account = account; |
| 2588 aa->add_buddy_after_auth = !on_list; |
2646 aa->add_buddy_after_auth = !on_list; |
| 2589 |
2647 |
| 2590 alert = pidgin_make_mini_dialog_with_custom_icon( |
2648 alert = pidgin_make_mini_dialog_with_custom_icon( |
| 2591 gc, prpl_icon, |
2649 gc, prpl_icon, |
| 2592 _("Authorize buddy?"), buffer, aa, |
2650 _("Authorize buddy?"), NULL, aa, |
| 2593 _("Authorize"), authorize_and_add_cb, |
2651 _("Authorize"), authorize_and_add_cb, |
| 2594 _("Deny"), deny_no_add_cb, |
2652 _("Deny"), deny_no_add_cb, |
| 2595 NULL); |
2653 NULL); |
| |
2654 |
| |
2655 dialog = PIDGIN_MINI_DIALOG(alert); |
| |
2656 if (pidgin_mini_dialog_links_supported()) { |
| |
2657 pidgin_mini_dialog_enable_description_markup(dialog); |
| |
2658 pidgin_mini_dialog_set_link_callback(dialog, G_CALLBACK(get_user_info_cb), aa); |
| |
2659 } |
| |
2660 pidgin_mini_dialog_set_description(dialog, buffer); |
| |
2661 pidgin_mini_dialog_add_non_closing_button(dialog, _("Send Instant Message"), send_im_cb, aa); |
| 2596 |
2662 |
| 2597 g_signal_connect_swapped(G_OBJECT(alert), "destroy", G_CALLBACK(free_auth_request), aa); |
2663 g_signal_connect_swapped(G_OBJECT(alert), "destroy", G_CALLBACK(free_auth_request), aa); |
| 2598 g_signal_connect(G_OBJECT(alert), "destroy", G_CALLBACK(purple_account_request_close), NULL); |
2664 g_signal_connect(G_OBJECT(alert), "destroy", G_CALLBACK(purple_account_request_close), NULL); |
| 2599 pidgin_blist_add_alert(alert); |
2665 pidgin_blist_add_alert(alert); |
| 2600 |
2666 |