comparison pidgin/gtkaccount.c @ 15500:d75099d2567e

gaim_gtk to pidgin. I hope
author Sean Egan <seanegan@gmail.com>
date Sat, 03 Feb 2007 07:23:11 +0000
parents cb3800fabd76
children 311315e979f7
comparison
equal deleted inserted replaced
15499:45ecefd0ce3a 15500:d75099d2567e
62 { 62 {
63 GaimAccount *account; 63 GaimAccount *account;
64 char *username; 64 char *username;
65 char *alias; 65 char *alias;
66 66
67 } GaimGtkAccountAddUserData; 67 } PidginAccountAddUserData;
68 68
69 typedef struct 69 typedef struct
70 { 70 {
71 GtkWidget *window; 71 GtkWidget *window;
72 GtkWidget *treeview; 72 GtkWidget *treeview;
82 82
83 } AccountsWindow; 83 } AccountsWindow;
84 84
85 typedef struct 85 typedef struct
86 { 86 {
87 GaimGtkAccountDialogType type; 87 PidginAccountDialogType type;
88 88
89 GaimAccount *account; 89 GaimAccount *account;
90 char *protocol_id; 90 char *protocol_id;
91 GaimPlugin *plugin; 91 GaimPlugin *plugin;
92 GaimPluginProtocolInfo *prpl_info; 92 GaimPluginProtocolInfo *prpl_info;
149 float pulse_value; 149 float pulse_value;
150 int timeout; 150 int timeout;
151 GaimAccount *account; 151 GaimAccount *account;
152 GtkTreeModel *model; 152 GtkTreeModel *model;
153 153
154 } GaimGtkPulseData; 154 } PidginPulseData;
155 155
156 156
157 static AccountsWindow *accounts_window = NULL; 157 static AccountsWindow *accounts_window = NULL;
158 static GHashTable *account_pref_wins; 158 static GHashTable *account_pref_wins;
159 159
216 { 216 {
217 /* Scale the icon to something reasonable */ 217 /* Scale the icon to something reasonable */
218 int width, height; 218 int width, height;
219 GdkPixbuf *scale; 219 GdkPixbuf *scale;
220 220
221 gaim_gtk_buddy_icon_get_scale_size(pixbuf, &dialog->prpl_info->icon_spec, 221 pidgin_buddy_icon_get_scale_size(pixbuf, &dialog->prpl_info->icon_spec,
222 GAIM_ICON_SCALE_DISPLAY, &width, &height); 222 GAIM_ICON_SCALE_DISPLAY, &width, &height);
223 scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR); 223 scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR);
224 224
225 g_object_unref(G_OBJECT(pixbuf)); 225 g_object_unref(G_OBJECT(pixbuf));
226 pixbuf = scale; 226 pixbuf = scale;
303 AccountPrefsDialog *dialog; 303 AccountPrefsDialog *dialog;
304 304
305 dialog = data; 305 dialog = data;
306 306
307 if (filename != NULL) 307 if (filename != NULL)
308 set_dialog_icon(dialog, gaim_gtk_convert_buddy_icon(dialog->plugin, filename), g_strdup(filename)); 308 set_dialog_icon(dialog, pidgin_convert_buddy_icon(dialog->plugin, filename), g_strdup(filename));
309 309
310 dialog->icon_filesel = NULL; 310 dialog->icon_filesel = NULL;
311 } 311 }
312 312
313 static void 313 static void
314 icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog) 314 icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog)
315 { 315 {
316 dialog->icon_filesel = gaim_gtk_buddy_icon_chooser_new(GTK_WINDOW(dialog->window), icon_filesel_choose_cb, dialog); 316 dialog->icon_filesel = pidgin_buddy_icon_chooser_new(GTK_WINDOW(dialog->window), icon_filesel_choose_cb, dialog);
317 gtk_widget_show_all(dialog->icon_filesel); 317 gtk_widget_show_all(dialog->icon_filesel);
318 } 318 }
319 319
320 static void 320 static void
321 icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog) 321 icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog)
343 "g_filename_from_uri error")); 343 "g_filename_from_uri error"));
344 return; 344 return;
345 } 345 }
346 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) 346 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
347 *rtmp = '\0'; 347 *rtmp = '\0';
348 set_dialog_icon(dialog, gaim_gtk_convert_buddy_icon(dialog->plugin, tmp), g_strdup(tmp)); 348 set_dialog_icon(dialog, pidgin_convert_buddy_icon(dialog->plugin, tmp), g_strdup(tmp));
349 g_free(tmp); 349 g_free(tmp);
350 } 350 }
351 gtk_drag_finish(dc, TRUE, FALSE, t); 351 gtk_drag_finish(dc, TRUE, FALSE, t);
352 } 352 }
353 gtk_drag_finish(dc, FALSE, FALSE, t); 353 gtk_drag_finish(dc, FALSE, FALSE, t);
385 385
386 if (dialog->login_frame != NULL) 386 if (dialog->login_frame != NULL)
387 gtk_widget_destroy(dialog->login_frame); 387 gtk_widget_destroy(dialog->login_frame);
388 388
389 /* Build the login options frame. */ 389 /* Build the login options frame. */
390 frame = gaim_gtk_make_frame(parent, _("Login Options")); 390 frame = pidgin_make_frame(parent, _("Login Options"));
391 391
392 /* cringe */ 392 /* cringe */
393 dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); 393 dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
394 394
395 gtk_box_reorder_child(GTK_BOX(parent), dialog->login_frame, 0); 395 gtk_box_reorder_child(GTK_BOX(parent), dialog->login_frame, 0);
399 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); 399 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
400 gtk_container_add(GTK_CONTAINER(frame), vbox); 400 gtk_container_add(GTK_CONTAINER(frame), vbox);
401 gtk_widget_show(vbox); 401 gtk_widget_show(vbox);
402 402
403 /* Protocol */ 403 /* Protocol */
404 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new( 404 dialog->protocol_menu = pidgin_protocol_option_menu_new(
405 dialog->protocol_id, G_CALLBACK(set_account_protocol_cb), dialog); 405 dialog->protocol_id, G_CALLBACK(set_account_protocol_cb), dialog);
406 406
407 add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); 407 add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu);
408 408
409 /* Screen name */ 409 /* Screen name */
549 549
550 if (dialog->user_frame != NULL) 550 if (dialog->user_frame != NULL)
551 gtk_widget_destroy(dialog->user_frame); 551 gtk_widget_destroy(dialog->user_frame);
552 552
553 /* Build the user options frame. */ 553 /* Build the user options frame. */
554 frame = gaim_gtk_make_frame(parent, _("User Options")); 554 frame = pidgin_make_frame(parent, _("User Options"));
555 dialog->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); 555 dialog->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
556 556
557 gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1); 557 gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1);
558 gtk_widget_show(dialog->user_frame); 558 gtk_widget_show(dialog->user_frame);
559 559
626 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->icon_check), 626 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->icon_check),
627 !gaim_account_get_bool(dialog->account, "use-global-buddyicon", 627 !gaim_account_get_bool(dialog->account, "use-global-buddyicon",
628 TRUE)); 628 TRUE));
629 set_dialog_icon(dialog, 629 set_dialog_icon(dialog,
630 g_strdup(gaim_account_get_ui_string(dialog->account, 630 g_strdup(gaim_account_get_ui_string(dialog->account,
631 GAIM_GTK_UI, "non-global-buddyicon-cached-path", NULL)), 631 PIDGIN_UI, "non-global-buddyicon-cached-path", NULL)),
632 g_strdup(gaim_account_get_ui_string(dialog->account, 632 g_strdup(gaim_account_get_ui_string(dialog->account,
633 GAIM_GTK_UI, "non-global-buddyicon-path", NULL))); 633 PIDGIN_UI, "non-global-buddyicon-path", NULL)));
634 } else { 634 } else {
635 set_dialog_icon(dialog, NULL, NULL); 635 set_dialog_icon(dialog, NULL, NULL);
636 } 636 }
637 637
638 if (!dialog->prpl_info || 638 if (!dialog->prpl_info ||
681 account = dialog->account; 681 account = dialog->account;
682 682
683 /* Build the protocol options frame. */ 683 /* Build the protocol options frame. */
684 g_snprintf(buf, sizeof(buf), _("%s Options"), dialog->plugin->info->name); 684 g_snprintf(buf, sizeof(buf), _("%s Options"), dialog->plugin->info->name);
685 685
686 frame = gaim_gtk_make_frame(parent, buf); 686 frame = pidgin_make_frame(parent, buf);
687 dialog->protocol_frame = 687 dialog->protocol_frame =
688 gtk_widget_get_parent(gtk_widget_get_parent(frame)); 688 gtk_widget_get_parent(gtk_widget_get_parent(frame));
689 689
690 gtk_box_reorder_child(GTK_BOX(parent), dialog->protocol_frame, 0); 690 gtk_box_reorder_child(GTK_BOX(parent), dialog->protocol_frame, 0);
691 gtk_widget_show(dialog->protocol_frame); 691 gtk_widget_show(dialog->protocol_frame);
970 GtkWidget *vbox2; 970 GtkWidget *vbox2;
971 971
972 if (dialog->proxy_frame != NULL) 972 if (dialog->proxy_frame != NULL)
973 gtk_widget_destroy(dialog->proxy_frame); 973 gtk_widget_destroy(dialog->proxy_frame);
974 974
975 frame = gaim_gtk_make_frame(parent, _("Proxy Options")); 975 frame = pidgin_make_frame(parent, _("Proxy Options"));
976 dialog->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); 976 dialog->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
977 977
978 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1); 978 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1);
979 gtk_widget_show(dialog->proxy_frame); 979 gtk_widget_show(dialog->proxy_frame);
980 980
1075 g_list_free(dialog->protocol_opt_entries); 1075 g_list_free(dialog->protocol_opt_entries);
1076 g_free(dialog->protocol_id); 1076 g_free(dialog->protocol_id);
1077 1077
1078 if (dialog->cached_icon_path != NULL) 1078 if (dialog->cached_icon_path != NULL)
1079 { 1079 {
1080 const char *icon = gaim_account_get_ui_string(dialog->account, GAIM_GTK_UI, "non-global-buddyicon-cached-path", NULL); 1080 const char *icon = gaim_account_get_ui_string(dialog->account, PIDGIN_UI, "non-global-buddyicon-cached-path", NULL);
1081 if (dialog->cached_icon_path != NULL && (icon == NULL || strcmp(dialog->cached_icon_path, icon))) 1081 if (dialog->cached_icon_path != NULL && (icon == NULL || strcmp(dialog->cached_icon_path, icon)))
1082 { 1082 {
1083 /* The user set an icon, which would've been cached by convert_buddy_icon, 1083 /* The user set an icon, which would've been cached by convert_buddy_icon,
1084 * but didn't save the changes. Delete the cache file. */ 1084 * but didn't save the changes. Delete the cache file. */
1085 char *filename = g_build_filename(gaim_buddy_icons_get_cache_dir(), dialog->cached_icon_path, NULL); 1085 char *filename = g_build_filename(gaim_buddy_icons_get_cache_dir(), dialog->cached_icon_path, NULL);
1150 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) 1150 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)))
1151 { 1151 {
1152 icon_change = TRUE; 1152 icon_change = TRUE;
1153 } 1153 }
1154 gaim_account_set_bool(account, "use-global-buddyicon", !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))); 1154 gaim_account_set_bool(account, "use-global-buddyicon", !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)));
1155 gaim_account_set_ui_string(account, GAIM_GTK_UI, "non-global-buddyicon-cached-path", dialog->cached_icon_path); 1155 gaim_account_set_ui_string(account, PIDGIN_UI, "non-global-buddyicon-cached-path", dialog->cached_icon_path);
1156 gaim_account_set_ui_string(account, GAIM_GTK_UI, "non-global-buddyicon-path", dialog->icon_path); 1156 gaim_account_set_ui_string(account, PIDGIN_UI, "non-global-buddyicon-path", dialog->icon_path);
1157 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) 1157 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)))
1158 { 1158 {
1159 gaim_account_set_buddy_icon_path(account, dialog->icon_path); 1159 gaim_account_set_buddy_icon_path(account, dialog->icon_path);
1160 gaim_account_set_buddy_icon(account, dialog->cached_icon_path); 1160 gaim_account_set_buddy_icon(account, dialog->cached_icon_path);
1161 } 1161 }
1162 else if (gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon") && icon_change) 1162 else if (gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon") && icon_change)
1163 { 1163 {
1164 const char *filename = gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon"); 1164 const char *filename = gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon");
1165 char *icon = gaim_gtk_convert_buddy_icon(dialog->plugin, filename); 1165 char *icon = pidgin_convert_buddy_icon(dialog->plugin, filename);
1166 gaim_account_set_buddy_icon_path(account, filename); 1166 gaim_account_set_buddy_icon_path(account, filename);
1167 gaim_account_set_buddy_icon(account, icon); 1167 gaim_account_set_buddy_icon(account, icon);
1168 g_free(icon); 1168 g_free(icon);
1169 } 1169 }
1170 } 1170 }
1337 1337
1338 /* If this is a new account, add it to our list */ 1338 /* If this is a new account, add it to our list */
1339 if (new) 1339 if (new)
1340 gaim_accounts_add(account); 1340 gaim_accounts_add(account);
1341 else 1341 else
1342 gaim_signal_emit(gaim_gtk_account_get_handle(), "account-modified", account); 1342 gaim_signal_emit(pidgin_account_get_handle(), "account-modified", account);
1343 1343
1344 /* If this is a new account, then sign on! */ 1344 /* If this is a new account, then sign on! */
1345 if (new && !dialog->registering) { 1345 if (new && !dialog->registering) {
1346 const GaimSavedStatus *saved_status; 1346 const GaimSavedStatus *saved_status;
1347 1347
1348 saved_status = gaim_savedstatus_get_current(); 1348 saved_status = gaim_savedstatus_get_current();
1349 if (saved_status != NULL) { 1349 if (saved_status != NULL) {
1350 gaim_savedstatus_activate_for_account(saved_status, account); 1350 gaim_savedstatus_activate_for_account(saved_status, account);
1351 gaim_account_set_enabled(account, GAIM_GTK_UI, TRUE); 1351 gaim_account_set_enabled(account, PIDGIN_UI, TRUE);
1352 } 1352 }
1353 } 1353 }
1354 1354
1355 return account; 1355 return account;
1356 } 1356 }
1373 {"text/uri-list", 0, 1}, 1373 {"text/uri-list", 0, 1},
1374 {"STRING", 0, 2} 1374 {"STRING", 0, 2}
1375 }; 1375 };
1376 1376
1377 void 1377 void
1378 gaim_gtk_account_dialog_show(GaimGtkAccountDialogType type, 1378 pidgin_account_dialog_show(PidginAccountDialogType type,
1379 GaimAccount *account) 1379 GaimAccount *account)
1380 { 1380 {
1381 AccountPrefsDialog *dialog; 1381 AccountPrefsDialog *dialog;
1382 GtkWidget *win; 1382 GtkWidget *win;
1383 GtkWidget *main_vbox; 1383 GtkWidget *main_vbox;
1422 1422
1423 1423
1424 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); 1424 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1425 gtk_window_set_role(GTK_WINDOW(win), "account"); 1425 gtk_window_set_role(GTK_WINDOW(win), "account");
1426 1426
1427 if (type == GAIM_GTK_ADD_ACCOUNT_DIALOG) 1427 if (type == PIDGIN_ADD_ACCOUNT_DIALOG)
1428 gtk_window_set_title(GTK_WINDOW(win), _("Add Account")); 1428 gtk_window_set_title(GTK_WINDOW(win), _("Add Account"));
1429 else 1429 else
1430 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account")); 1430 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account"));
1431 1431
1432 gtk_window_set_resizable(GTK_WINDOW(win), FALSE); 1432 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
1532 **************************************************************************/ 1532 **************************************************************************/
1533 static void 1533 static void
1534 signed_on_off_cb(GaimConnection *gc, gpointer user_data) 1534 signed_on_off_cb(GaimConnection *gc, gpointer user_data)
1535 { 1535 {
1536 GaimAccount *account; 1536 GaimAccount *account;
1537 GaimGtkPulseData *pulse_data; 1537 PidginPulseData *pulse_data;
1538 GtkTreeModel *model; 1538 GtkTreeModel *model;
1539 GtkTreeIter iter; 1539 GtkTreeIter iter;
1540 GdkPixbuf *pixbuf; 1540 GdkPixbuf *pixbuf;
1541 size_t index; 1541 size_t index;
1542 1542
1561 g_object_unref(G_OBJECT(pulse_data->online_pixbuf)); 1561 g_object_unref(G_OBJECT(pulse_data->online_pixbuf));
1562 1562
1563 g_free(pulse_data); 1563 g_free(pulse_data);
1564 } 1564 }
1565 1565
1566 pixbuf = gaim_gtk_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); 1566 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM);
1567 if ((pixbuf != NULL) && gaim_account_is_disconnected(account)) 1567 if ((pixbuf != NULL) && gaim_account_is_disconnected(account))
1568 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); 1568 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
1569 1569
1570 gtk_list_store_set(accounts_window->model, &iter, 1570 gtk_list_store_set(accounts_window->model, &iter,
1571 COLUMN_ICON, pixbuf, 1571 COLUMN_ICON, pixbuf,
1772 } 1772 }
1773 1773
1774 static gint 1774 static gint
1775 accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsWindow *dialog) 1775 accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsWindow *dialog)
1776 { 1776 {
1777 gaim_gtk_accounts_window_hide(); 1777 pidgin_accounts_window_hide();
1778 1778
1779 return 0; 1779 return 0;
1780 } 1780 }
1781 1781
1782 static gboolean 1782 static gboolean
1813 } 1813 }
1814 1814
1815 static void 1815 static void
1816 add_account_cb(GtkWidget *w, AccountsWindow *dialog) 1816 add_account_cb(GtkWidget *w, AccountsWindow *dialog)
1817 { 1817 {
1818 gaim_gtk_account_dialog_show(GAIM_GTK_ADD_ACCOUNT_DIALOG, NULL); 1818 pidgin_account_dialog_show(PIDGIN_ADD_ACCOUNT_DIALOG, NULL);
1819 } 1819 }
1820 1820
1821 static void 1821 static void
1822 modify_account_sel(GtkTreeModel *model, GtkTreePath *path, 1822 modify_account_sel(GtkTreeModel *model, GtkTreePath *path,
1823 GtkTreeIter *iter, gpointer data) 1823 GtkTreeIter *iter, gpointer data)
1825 GaimAccount *account; 1825 GaimAccount *account;
1826 1826
1827 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); 1827 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
1828 1828
1829 if (account != NULL) 1829 if (account != NULL)
1830 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account); 1830 pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, account);
1831 } 1831 }
1832 1832
1833 static void 1833 static void
1834 modify_account_cb(GtkWidget *w, AccountsWindow *dialog) 1834 modify_account_cb(GtkWidget *w, AccountsWindow *dialog)
1835 { 1835 {
1882 static void 1882 static void
1883 close_accounts_cb(GtkWidget *w, AccountsWindow *dialog) 1883 close_accounts_cb(GtkWidget *w, AccountsWindow *dialog)
1884 { 1884 {
1885 gtk_widget_destroy(dialog->window); 1885 gtk_widget_destroy(dialog->window);
1886 1886
1887 gaim_gtk_accounts_window_hide(); 1887 pidgin_accounts_window_hide();
1888 } 1888 }
1889 1889
1890 1890
1891 static void 1891 static void
1892 enabled_cb(GtkCellRendererToggle *renderer, gchar *path_str, 1892 enabled_cb(GtkCellRendererToggle *renderer, gchar *path_str,
1913 { 1913 {
1914 saved_status = gaim_savedstatus_get_current(); 1914 saved_status = gaim_savedstatus_get_current();
1915 gaim_savedstatus_activate_for_account(saved_status, account); 1915 gaim_savedstatus_activate_for_account(saved_status, account);
1916 } 1916 }
1917 1917
1918 gaim_account_set_enabled(account, GAIM_GTK_UI, !enabled); 1918 gaim_account_set_enabled(account, PIDGIN_UI, !enabled);
1919 } 1919 }
1920 1920
1921 static void 1921 static void
1922 add_columns(GtkWidget *treeview, AccountsWindow *dialog) 1922 add_columns(GtkWidget *treeview, AccountsWindow *dialog)
1923 { 1923 {
1978 set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account, GdkPixbuf *global_buddyicon) 1978 set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account, GdkPixbuf *global_buddyicon)
1979 { 1979 {
1980 GdkPixbuf *pixbuf, *buddyicon = NULL; 1980 GdkPixbuf *pixbuf, *buddyicon = NULL;
1981 const char *path = NULL; 1981 const char *path = NULL;
1982 1982
1983 pixbuf = gaim_gtk_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); 1983 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM);
1984 if ((pixbuf != NULL) && gaim_account_is_disconnected(account)) 1984 if ((pixbuf != NULL) && gaim_account_is_disconnected(account))
1985 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); 1985 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
1986 1986
1987 if (gaim_account_get_bool(account, "use-global-buddyicon", TRUE)) { 1987 if (gaim_account_get_bool(account, "use-global-buddyicon", TRUE)) {
1988 if (global_buddyicon != NULL) 1988 if (global_buddyicon != NULL)
1989 buddyicon = g_object_ref(G_OBJECT(global_buddyicon)); 1989 buddyicon = g_object_ref(G_OBJECT(global_buddyicon));
1990 /* This is for when set_account() is called for a single account */ 1990 /* This is for when set_account() is called for a single account */
1991 else 1991 else
1992 path = gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon"); 1992 path = gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon");
1993 } else 1993 } else
1994 path = gaim_account_get_ui_string(account, GAIM_GTK_UI, "non-global-buddyicon-path", NULL); 1994 path = gaim_account_get_ui_string(account, PIDGIN_UI, "non-global-buddyicon-path", NULL);
1995 1995
1996 if (path != NULL) { 1996 if (path != NULL) {
1997 GdkPixbuf *buddyicon_pixbuf = gdk_pixbuf_new_from_file(path, NULL); 1997 GdkPixbuf *buddyicon_pixbuf = gdk_pixbuf_new_from_file(path, NULL);
1998 if (buddyicon_pixbuf != NULL) { 1998 if (buddyicon_pixbuf != NULL) {
1999 buddyicon = gdk_pixbuf_scale_simple(buddyicon_pixbuf, 22, 22, GDK_INTERP_HYPER); 1999 buddyicon = gdk_pixbuf_scale_simple(buddyicon_pixbuf, 22, 22, GDK_INTERP_HYPER);
2003 2003
2004 gtk_list_store_set(store, iter, 2004 gtk_list_store_set(store, iter,
2005 COLUMN_ICON, pixbuf, 2005 COLUMN_ICON, pixbuf,
2006 COLUMN_BUDDYICON, buddyicon, 2006 COLUMN_BUDDYICON, buddyicon,
2007 COLUMN_SCREENNAME, gaim_account_get_username(account), 2007 COLUMN_SCREENNAME, gaim_account_get_username(account),
2008 COLUMN_ENABLED, gaim_account_get_enabled(account, GAIM_GTK_UI), 2008 COLUMN_ENABLED, gaim_account_get_enabled(account, PIDGIN_UI),
2009 COLUMN_PROTOCOL, gaim_account_get_protocol_name(account), 2009 COLUMN_PROTOCOL, gaim_account_get_protocol_name(account),
2010 COLUMN_DATA, account, 2010 COLUMN_DATA, account,
2011 -1); 2011 -1);
2012 2012
2013 if (pixbuf != NULL) 2013 if (pixbuf != NULL)
2109 2109
2110 if ((account != NULL) && (event->button == 1) && 2110 if ((account != NULL) && (event->button == 1) &&
2111 (event->type == GDK_2BUTTON_PRESS) && 2111 (event->type == GDK_2BUTTON_PRESS) &&
2112 (strcmp(gtk_tree_view_column_get_title(column), title))) 2112 (strcmp(gtk_tree_view_column_get_title(column), title)))
2113 { 2113 {
2114 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account); 2114 pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, account);
2115 return TRUE; 2115 return TRUE;
2116 } 2116 }
2117 2117
2118 return FALSE; 2118 return FALSE;
2119 } 2119 }
2138 gtk_container_add(GTK_CONTAINER(frame), accounts_window->notebook); 2138 gtk_container_add(GTK_CONTAINER(frame), accounts_window->notebook);
2139 2139
2140 /* Create a helpful first-time-use label */ 2140 /* Create a helpful first-time-use label */
2141 label = gtk_label_new(NULL); 2141 label = gtk_label_new(NULL);
2142 /* Translators: Please maintain the use of -> or <- to represent the menu heirarchy */ 2142 /* Translators: Please maintain the use of -> or <- to represent the menu heirarchy */
2143 pretty = gaim_gtk_make_pretty_arrows(_( 2143 pretty = pidgin_make_pretty_arrows(_(
2144 "<span size='larger' weight='bold'>Welcome to " PIDGIN_NAME "!</span>\n\n" 2144 "<span size='larger' weight='bold'>Welcome to " PIDGIN_NAME "!</span>\n\n"
2145 2145
2146 "You have no IM accounts configured. To start connecting with " PIDGIN_NAME " " 2146 "You have no IM accounts configured. To start connecting with " PIDGIN_NAME " "
2147 "press the <b>Add</b> button below and configure your first " 2147 "press the <b>Add</b> button below and configure your first "
2148 "account. If you want " PIDGIN_NAME " to connect to multiple IM accounts, " 2148 "account. If you want " PIDGIN_NAME " to connect to multiple IM accounts, "
2241 account_modified_cb(list->data, window); 2241 account_modified_cb(list->data, window);
2242 } 2242 }
2243 } 2243 }
2244 2244
2245 void 2245 void
2246 gaim_gtk_accounts_window_show(void) 2246 pidgin_accounts_window_show(void)
2247 { 2247 {
2248 AccountsWindow *dialog; 2248 AccountsWindow *dialog;
2249 GtkWidget *win; 2249 GtkWidget *win;
2250 GtkWidget *vbox; 2250 GtkWidget *vbox;
2251 GtkWidget *bbox; 2251 GtkWidget *bbox;
2326 gtk_widget_show(button); 2326 gtk_widget_show(button);
2327 2327
2328 g_signal_connect(G_OBJECT(button), "clicked", 2328 g_signal_connect(G_OBJECT(button), "clicked",
2329 G_CALLBACK(close_accounts_cb), dialog); 2329 G_CALLBACK(close_accounts_cb), dialog);
2330 2330
2331 gaim_signal_connect(gaim_gtk_account_get_handle(), "account-modified", 2331 gaim_signal_connect(pidgin_account_get_handle(), "account-modified",
2332 accounts_window, 2332 accounts_window,
2333 GAIM_CALLBACK(account_modified_cb), accounts_window); 2333 GAIM_CALLBACK(account_modified_cb), accounts_window);
2334 gaim_prefs_connect_callback(accounts_window, 2334 gaim_prefs_connect_callback(accounts_window,
2335 "/gaim/gtk/accounts/buddyicon", 2335 "/gaim/gtk/accounts/buddyicon",
2336 global_buddyicon_changed, accounts_window); 2336 global_buddyicon_changed, accounts_window);
2337 2337
2338 gtk_widget_show(win); 2338 gtk_widget_show(win);
2339 } 2339 }
2340 2340
2341 void 2341 void
2342 gaim_gtk_accounts_window_hide(void) 2342 pidgin_accounts_window_hide(void)
2343 { 2343 {
2344 if (accounts_window == NULL) 2344 if (accounts_window == NULL)
2345 return; 2345 return;
2346 2346
2347 gaim_signals_disconnect_by_handle(accounts_window); 2347 gaim_signals_disconnect_by_handle(accounts_window);
2349 2349
2350 g_free(accounts_window); 2350 g_free(accounts_window);
2351 accounts_window = NULL; 2351 accounts_window = NULL;
2352 2352
2353 /* See if we're the main window here. */ 2353 /* See if we're the main window here. */
2354 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL && 2354 if (PIDGIN_BLIST(gaim_get_blist())->window == NULL &&
2355 gaim_connections_get_all() == NULL) { 2355 gaim_connections_get_all() == NULL) {
2356 2356
2357 gaim_core_quit(); 2357 gaim_core_quit();
2358 } 2358 }
2359 } 2359 }
2360 2360
2361 static void 2361 static void
2362 free_add_user_data(GaimGtkAccountAddUserData *data) 2362 free_add_user_data(PidginAccountAddUserData *data)
2363 { 2363 {
2364 g_free(data->username); 2364 g_free(data->username);
2365 g_free(data->alias); 2365 g_free(data->alias);
2366 g_free(data); 2366 g_free(data);
2367 } 2367 }
2368 2368
2369 static void 2369 static void
2370 add_user_cb(GaimGtkAccountAddUserData *data) 2370 add_user_cb(PidginAccountAddUserData *data)
2371 { 2371 {
2372 GaimConnection *gc = gaim_account_get_connection(data->account); 2372 GaimConnection *gc = gaim_account_get_connection(data->account);
2373 2373
2374 if (g_list_find(gaim_connections_get_all(), gc)) 2374 if (g_list_find(gaim_connections_get_all(), gc))
2375 { 2375 {
2400 (msg != NULL ? ": " : "."), 2400 (msg != NULL ? ": " : "."),
2401 (msg != NULL ? msg : "")); 2401 (msg != NULL ? msg : ""));
2402 } 2402 }
2403 2403
2404 static void 2404 static void
2405 gaim_gtk_accounts_notify_added(GaimAccount *account, const char *remote_user, 2405 pidgin_accounts_notify_added(GaimAccount *account, const char *remote_user,
2406 const char *id, const char *alias, 2406 const char *id, const char *alias,
2407 const char *msg) 2407 const char *msg)
2408 { 2408 {
2409 char *buffer; 2409 char *buffer;
2410 GaimConnection *gc; 2410 GaimConnection *gc;
2411 GtkWidget *alert; 2411 GtkWidget *alert;
2412 2412
2413 gc = gaim_account_get_connection(account); 2413 gc = gaim_account_get_connection(account);
2414 2414
2415 buffer = make_info(account, gc, remote_user, id, alias, msg); 2415 buffer = make_info(account, gc, remote_user, id, alias, msg);
2416 alert = gaim_gtk_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_INFO, buffer, 2416 alert = pidgin_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_INFO, buffer,
2417 NULL, NULL, _("Close"), NULL, NULL); 2417 NULL, NULL, _("Close"), NULL, NULL);
2418 gaim_gtk_blist_add_alert(alert); 2418 pidgin_blist_add_alert(alert);
2419 2419
2420 g_free(buffer); 2420 g_free(buffer);
2421 } 2421 }
2422 2422
2423 static void 2423 static void
2424 gaim_gtk_accounts_request_add(GaimAccount *account, const char *remote_user, 2424 pidgin_accounts_request_add(GaimAccount *account, const char *remote_user,
2425 const char *id, const char *alias, 2425 const char *id, const char *alias,
2426 const char *msg) 2426 const char *msg)
2427 { 2427 {
2428 char *buffer; 2428 char *buffer;
2429 GaimConnection *gc; 2429 GaimConnection *gc;
2430 GaimGtkAccountAddUserData *data; 2430 PidginAccountAddUserData *data;
2431 GtkWidget *alert; 2431 GtkWidget *alert;
2432 2432
2433 gc = gaim_account_get_connection(account); 2433 gc = gaim_account_get_connection(account);
2434 2434
2435 data = g_new0(GaimGtkAccountAddUserData, 1); 2435 data = g_new0(PidginAccountAddUserData, 1);
2436 data->account = account; 2436 data->account = account;
2437 data->username = g_strdup(remote_user); 2437 data->username = g_strdup(remote_user);
2438 data->alias = g_strdup(alias); 2438 data->alias = g_strdup(alias);
2439 2439
2440 buffer = make_info(account, gc, remote_user, id, alias, msg); 2440 buffer = make_info(account, gc, remote_user, id, alias, msg);
2441 alert = gaim_gtk_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION, 2441 alert = pidgin_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION,
2442 _("Add buddy to your list?"), buffer, data, 2442 _("Add buddy to your list?"), buffer, data,
2443 _("Add"), G_CALLBACK(add_user_cb), 2443 _("Add"), G_CALLBACK(add_user_cb),
2444 _("Cancel"), G_CALLBACK(free_add_user_data), NULL); 2444 _("Cancel"), G_CALLBACK(free_add_user_data), NULL);
2445 gaim_gtk_blist_add_alert(alert); 2445 pidgin_blist_add_alert(alert);
2446 2446
2447 g_free(buffer); 2447 g_free(buffer);
2448 } 2448 }
2449 2449
2450 struct auth_and_add { 2450 struct auth_and_add {
2477 g_free(aa->alias); 2477 g_free(aa->alias);
2478 g_free(aa); 2478 g_free(aa);
2479 } 2479 }
2480 2480
2481 static void * 2481 static void *
2482 gaim_gtk_accounts_request_authorization(GaimAccount *account, const char *remote_user, 2482 pidgin_accounts_request_authorization(GaimAccount *account, const char *remote_user,
2483 const char *id, const char *alias, const char *message, gboolean on_list, 2483 const char *id, const char *alias, const char *message, gboolean on_list,
2484 GCallback auth_cb, GCallback deny_cb, void *user_data) 2484 GCallback auth_cb, GCallback deny_cb, void *user_data)
2485 { 2485 {
2486 char *buffer; 2486 char *buffer;
2487 GaimConnection *gc; 2487 GaimConnection *gc;
2511 aa->deny_cb = (GaimAccountRequestAuthorizationCb)deny_cb; 2511 aa->deny_cb = (GaimAccountRequestAuthorizationCb)deny_cb;
2512 aa->data = user_data; 2512 aa->data = user_data;
2513 aa->username = g_strdup(remote_user); 2513 aa->username = g_strdup(remote_user);
2514 aa->alias = g_strdup(alias); 2514 aa->alias = g_strdup(alias);
2515 aa->account = account; 2515 aa->account = account;
2516 alert = gaim_gtk_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION, 2516 alert = pidgin_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION,
2517 _("Authorize buddy?"), buffer, aa, 2517 _("Authorize buddy?"), buffer, aa,
2518 _("Authorize"), authorize_and_add_cb, 2518 _("Authorize"), authorize_and_add_cb,
2519 _("Deny"), deny_no_add_cb, 2519 _("Deny"), deny_no_add_cb,
2520 NULL); 2520 NULL);
2521 } else { 2521 } else {
2522 alert = gaim_gtk_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION, 2522 alert = pidgin_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION,
2523 _("Authorize buddy?"), buffer, user_data, 2523 _("Authorize buddy?"), buffer, user_data,
2524 _("Authorize"), auth_cb, 2524 _("Authorize"), auth_cb,
2525 _("Deny"), deny_cb, 2525 _("Deny"), deny_cb,
2526 NULL); 2526 NULL);
2527 } 2527 }
2528 gaim_gtk_blist_add_alert(alert); 2528 pidgin_blist_add_alert(alert);
2529 2529
2530 g_free(buffer); 2530 g_free(buffer);
2531 2531
2532 return NULL; 2532 return NULL;
2533 } 2533 }
2534 2534
2535 static void 2535 static void
2536 gaim_gtk_accounts_request_close(void *ui_handle) 2536 pidgin_accounts_request_close(void *ui_handle)
2537 { 2537 {
2538 2538
2539 } 2539 }
2540 2540
2541 static GaimAccountUiOps ui_ops = 2541 static GaimAccountUiOps ui_ops =
2542 { 2542 {
2543 gaim_gtk_accounts_notify_added, 2543 pidgin_accounts_notify_added,
2544 NULL, 2544 NULL,
2545 gaim_gtk_accounts_request_add, 2545 pidgin_accounts_request_add,
2546 gaim_gtk_accounts_request_authorization, 2546 pidgin_accounts_request_authorization,
2547 gaim_gtk_accounts_request_close 2547 pidgin_accounts_request_close
2548 }; 2548 };
2549 2549
2550 GaimAccountUiOps * 2550 GaimAccountUiOps *
2551 gaim_gtk_accounts_get_ui_ops(void) 2551 pidgin_accounts_get_ui_ops(void)
2552 { 2552 {
2553 return &ui_ops; 2553 return &ui_ops;
2554 } 2554 }
2555 2555
2556 void * 2556 void *
2557 gaim_gtk_account_get_handle(void) { 2557 pidgin_account_get_handle(void) {
2558 static int handle; 2558 static int handle;
2559 2559
2560 return &handle; 2560 return &handle;
2561 } 2561 }
2562 2562
2563 void 2563 void
2564 gaim_gtk_account_init(void) 2564 pidgin_account_init(void)
2565 { 2565 {
2566 gaim_prefs_add_none("/gaim/gtk/accounts"); 2566 gaim_prefs_add_none("/gaim/gtk/accounts");
2567 gaim_prefs_add_none("/gaim/gtk/accounts/dialog"); 2567 gaim_prefs_add_none("/gaim/gtk/accounts/dialog");
2568 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/width", 520); 2568 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/width", 520);
2569 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/height", 321); 2569 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/height", 321);
2570 gaim_prefs_add_path("/gaim/gtk/accounts/buddyicon", NULL); 2570 gaim_prefs_add_path("/gaim/gtk/accounts/buddyicon", NULL);
2571 2571
2572 gaim_signal_register(gaim_gtk_account_get_handle(), "account-modified", 2572 gaim_signal_register(pidgin_account_get_handle(), "account-modified",
2573 gaim_marshal_VOID__POINTER, NULL, 1, 2573 gaim_marshal_VOID__POINTER, NULL, 1,
2574 gaim_value_new(GAIM_TYPE_SUBTYPE, 2574 gaim_value_new(GAIM_TYPE_SUBTYPE,
2575 GAIM_SUBTYPE_ACCOUNT)); 2575 GAIM_SUBTYPE_ACCOUNT));
2576 2576
2577 /* Setup some gaim signal handlers. */ 2577 /* Setup some gaim signal handlers. */
2578 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", 2578 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
2579 gaim_gtk_account_get_handle(), 2579 pidgin_account_get_handle(),
2580 GAIM_CALLBACK(signed_on_off_cb), NULL); 2580 GAIM_CALLBACK(signed_on_off_cb), NULL);
2581 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", 2581 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
2582 gaim_gtk_account_get_handle(), 2582 pidgin_account_get_handle(),
2583 GAIM_CALLBACK(signed_on_off_cb), NULL); 2583 GAIM_CALLBACK(signed_on_off_cb), NULL);
2584 gaim_signal_connect(gaim_accounts_get_handle(), "account-added", 2584 gaim_signal_connect(gaim_accounts_get_handle(), "account-added",
2585 gaim_gtk_account_get_handle(), 2585 pidgin_account_get_handle(),
2586 GAIM_CALLBACK(add_account_to_liststore), NULL); 2586 GAIM_CALLBACK(add_account_to_liststore), NULL);
2587 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed", 2587 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed",
2588 gaim_gtk_account_get_handle(), 2588 pidgin_account_get_handle(),
2589 GAIM_CALLBACK(account_removed_cb), NULL); 2589 GAIM_CALLBACK(account_removed_cb), NULL);
2590 gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled", 2590 gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled",
2591 gaim_gtk_account_get_handle(), 2591 pidgin_account_get_handle(),
2592 GAIM_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE)); 2592 GAIM_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE));
2593 gaim_signal_connect(gaim_accounts_get_handle(), "account-enabled", 2593 gaim_signal_connect(gaim_accounts_get_handle(), "account-enabled",
2594 gaim_gtk_account_get_handle(), 2594 pidgin_account_get_handle(),
2595 GAIM_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE)); 2595 GAIM_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE));
2596 2596
2597 account_pref_wins = 2597 account_pref_wins =
2598 g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); 2598 g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
2599 } 2599 }
2600 2600
2601 void 2601 void
2602 gaim_gtk_account_uninit(void) 2602 pidgin_account_uninit(void)
2603 { 2603 {
2604 /* 2604 /*
2605 * TODO: Need to free all the dialogs in here. Could probably create 2605 * TODO: Need to free all the dialogs in here. Could probably create
2606 * a callback function to use for the free-some-data-function 2606 * a callback function to use for the free-some-data-function
2607 * parameter of g_hash_table_new_full, above. 2607 * parameter of g_hash_table_new_full, above.
2608 */ 2608 */
2609 g_hash_table_destroy(account_pref_wins); 2609 g_hash_table_destroy(account_pref_wins);
2610 2610
2611 gaim_signals_disconnect_by_handle(gaim_gtk_account_get_handle()); 2611 gaim_signals_disconnect_by_handle(pidgin_account_get_handle());
2612 gaim_signals_unregister_by_instance(gaim_gtk_account_get_handle()); 2612 gaim_signals_unregister_by_instance(pidgin_account_get_handle());
2613 } 2613 }
2614 2614