Mercurial > pidgin.yaz
comparison src/gtkaccount.c @ 6119:0d2bd49c611e
[gaim-migrate @ 6588]
Changed the API a bit for the Accounts window, and exposed the API to
display an account editor dialog from outside gtkaccount.c.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 14 Jul 2003 10:04:27 +0000 |
parents | 35560e017fa1 |
children | 914f2d5da21c |
comparison
equal
deleted
inserted
replaced
6118:ed983e8a1851 | 6119:0d2bd49c611e |
---|---|
51 COLUMN_PROTOCOL, | 51 COLUMN_PROTOCOL, |
52 COLUMN_DATA, | 52 COLUMN_DATA, |
53 NUM_COLUMNS | 53 NUM_COLUMNS |
54 }; | 54 }; |
55 | 55 |
56 typedef enum | |
57 { | |
58 ADD_ACCOUNT_DIALOG, | |
59 MODIFY_ACCOUNT_DIALOG | |
60 | |
61 } AccountPrefsDialogType; | |
62 | |
63 typedef struct | 56 typedef struct |
64 { | 57 { |
65 GtkWidget *window; | 58 GtkWidget *window; |
66 GtkWidget *treeview; | 59 GtkWidget *treeview; |
67 | 60 |
71 GtkListStore *model; | 64 GtkListStore *model; |
72 GtkTreeIter drag_iter; | 65 GtkTreeIter drag_iter; |
73 | 66 |
74 GtkTreeViewColumn *screenname_col; | 67 GtkTreeViewColumn *screenname_col; |
75 | 68 |
76 } AccountsDialog; | 69 } AccountsWindow; |
77 | 70 |
78 typedef struct | 71 typedef struct |
79 { | 72 { |
80 AccountPrefsDialogType type; | 73 GaimGtkAccountDialogType type; |
81 | 74 |
82 AccountsDialog *accounts_dialog; | 75 AccountsWindow *accounts_window; |
83 | 76 |
84 GaimAccount *account; | 77 GaimAccount *account; |
85 GaimProtocol protocol; | 78 GaimProtocol protocol; |
86 char *protocol_id; | 79 char *protocol_id; |
87 GaimPlugin *plugin; | 80 GaimPlugin *plugin; |
132 GtkWidget *proxy_pass_entry; | 125 GtkWidget *proxy_pass_entry; |
133 | 126 |
134 } AccountPrefsDialog; | 127 } AccountPrefsDialog; |
135 | 128 |
136 | 129 |
137 static AccountsDialog *accounts_dialog = NULL; | 130 static AccountsWindow *accounts_window = NULL; |
138 | 131 |
139 static void add_account(AccountsDialog *dialog, GaimAccount *account); | 132 static void add_account(AccountsWindow *dialog, GaimAccount *account); |
140 static void set_account(GtkListStore *store, GtkTreeIter *iter, | 133 static void set_account(GtkListStore *store, GtkTreeIter *iter, |
141 GaimAccount *account); | 134 GaimAccount *account); |
142 | 135 |
143 static char * | 136 static char * |
144 proto_name(int proto) | 137 proto_name(int proto) |
1064 gaim_proxy_info_set_password(proxy_info, | 1057 gaim_proxy_info_set_password(proxy_info, |
1065 gtk_entry_get_text(GTK_ENTRY(dialog->proxy_pass_entry))); | 1058 gtk_entry_get_text(GTK_ENTRY(dialog->proxy_pass_entry))); |
1066 } | 1059 } |
1067 | 1060 |
1068 /* Adds the account to the list, or modify the existing entry. */ | 1061 /* Adds the account to the list, or modify the existing entry. */ |
1069 index = g_list_index(gaim_accounts_get_all(), dialog->account); | 1062 if (dialog->accounts_window != NULL) { |
1070 | 1063 index = g_list_index(gaim_accounts_get_all(), dialog->account); |
1071 if (index != -1 && | 1064 |
1072 (gtk_tree_model_iter_nth_child( | 1065 if (index != -1 && |
1073 GTK_TREE_MODEL(dialog->accounts_dialog->model), &iter, | 1066 (gtk_tree_model_iter_nth_child( |
1074 NULL, index))) { | 1067 GTK_TREE_MODEL(dialog->accounts_window->model), &iter, |
1075 | 1068 NULL, index))) { |
1076 set_account(dialog->accounts_dialog->model, &iter, dialog->account); | 1069 |
1077 } | 1070 set_account(dialog->accounts_window->model, &iter, |
1078 else { | 1071 dialog->account); |
1079 add_account(dialog->accounts_dialog, dialog->account); | 1072 } |
1080 gaim_accounts_add(dialog->account); | 1073 else { |
1074 add_account(dialog->accounts_window, dialog->account); | |
1075 gaim_accounts_add(dialog->account); | |
1076 } | |
1081 } | 1077 } |
1082 | 1078 |
1083 gtk_widget_destroy(dialog->window); | 1079 gtk_widget_destroy(dialog->window); |
1084 | 1080 |
1085 account_win_destroy_cb(NULL, NULL, dialog); | 1081 account_win_destroy_cb(NULL, NULL, dialog); |
1096 ok_account_prefs_cb(NULL, dialog); | 1092 ok_account_prefs_cb(NULL, dialog); |
1097 | 1093 |
1098 prpl_info->register_user(account); | 1094 prpl_info->register_user(account); |
1099 } | 1095 } |
1100 | 1096 |
1101 static void | 1097 void |
1102 show_account_prefs(AccountPrefsDialogType type, | 1098 gaim_gtk_account_dialog_show(GaimGtkAccountDialogType type, |
1103 AccountsDialog *accounts_dialog, | 1099 GaimAccount *account) |
1104 GaimAccount *account) | |
1105 { | 1100 { |
1106 AccountPrefsDialog *dialog; | 1101 AccountPrefsDialog *dialog; |
1107 GtkWidget *win; | 1102 GtkWidget *win; |
1108 GtkWidget *main_vbox; | 1103 GtkWidget *main_vbox; |
1109 GtkWidget *vbox; | 1104 GtkWidget *vbox; |
1113 GtkWidget *sep; | 1108 GtkWidget *sep; |
1114 GtkWidget *button; | 1109 GtkWidget *button; |
1115 | 1110 |
1116 dialog = g_new0(AccountPrefsDialog, 1); | 1111 dialog = g_new0(AccountPrefsDialog, 1); |
1117 | 1112 |
1118 dialog->accounts_dialog = accounts_dialog; | 1113 dialog->accounts_window = accounts_window; |
1119 dialog->account = account; | 1114 dialog->account = account; |
1120 dialog->type = type; | 1115 dialog->type = type; |
1121 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | 1116 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1122 | 1117 |
1123 if (dialog->account == NULL) { | 1118 if (dialog->account == NULL) { |
1135 | 1130 |
1136 | 1131 |
1137 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 1132 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
1138 gtk_window_set_role(GTK_WINDOW(win), "account"); | 1133 gtk_window_set_role(GTK_WINDOW(win), "account"); |
1139 | 1134 |
1140 if (type == ADD_ACCOUNT_DIALOG) | 1135 if (type == GAIM_GTK_ADD_ACCOUNT_DIALOG) |
1141 gtk_window_set_title(GTK_WINDOW(win), _("Add Account")); | 1136 gtk_window_set_title(GTK_WINDOW(win), _("Add Account")); |
1142 else | 1137 else |
1143 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account")); | 1138 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account")); |
1144 | 1139 |
1145 gtk_window_set_resizable(GTK_WINDOW(win), FALSE); | 1140 gtk_window_set_resizable(GTK_WINDOW(win), FALSE); |
1230 /************************************************************************** | 1225 /************************************************************************** |
1231 * Accounts Dialog | 1226 * Accounts Dialog |
1232 **************************************************************************/ | 1227 **************************************************************************/ |
1233 | 1228 |
1234 static void | 1229 static void |
1235 signed_on_off_cb(GaimConnection *gc, AccountsDialog *dialog) | 1230 signed_on_off_cb(GaimConnection *gc, AccountsWindow *dialog) |
1236 { | 1231 { |
1237 GaimAccount *account = gaim_connection_get_account(gc); | 1232 GaimAccount *account = gaim_connection_get_account(gc); |
1238 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); | 1233 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
1239 GtkTreeIter iter; | 1234 GtkTreeIter iter; |
1240 size_t index = g_list_index(gaim_accounts_get_all(), account); | 1235 size_t index = g_list_index(gaim_accounts_get_all(), account); |
1247 } | 1242 } |
1248 | 1243 |
1249 static void | 1244 static void |
1250 drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, | 1245 drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, |
1251 GtkSelectionData *data, guint info, guint time, | 1246 GtkSelectionData *data, guint info, guint time, |
1252 AccountsDialog *dialog) | 1247 AccountsWindow *dialog) |
1253 { | 1248 { |
1254 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) { | 1249 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) { |
1255 GtkTreeRowReference *ref; | 1250 GtkTreeRowReference *ref; |
1256 GtkTreePath *source_row; | 1251 GtkTreePath *source_row; |
1257 GtkTreeIter iter; | 1252 GtkTreeIter iter; |
1317 } | 1312 } |
1318 | 1313 |
1319 static void | 1314 static void |
1320 drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, | 1315 drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, |
1321 guint x, guint y, GtkSelectionData *sd, | 1316 guint x, guint y, GtkSelectionData *sd, |
1322 guint info, guint t, AccountsDialog *dialog) | 1317 guint info, guint t, AccountsWindow *dialog) |
1323 { | 1318 { |
1324 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) { | 1319 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) { |
1325 size_t dest_index; | 1320 size_t dest_index; |
1326 GaimAccount *a = NULL; | 1321 GaimAccount *a = NULL; |
1327 GtkTreePath *path = NULL; | 1322 GtkTreePath *path = NULL; |
1368 } | 1363 } |
1369 } | 1364 } |
1370 } | 1365 } |
1371 | 1366 |
1372 static gint | 1367 static gint |
1373 accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsDialog *dialog) | 1368 accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsWindow *dialog) |
1374 { | 1369 { |
1375 gaim_signals_disconnect_by_handle(dialog); | 1370 gaim_gtk_accounts_window_hide(); |
1376 | |
1377 g_free(accounts_dialog); | |
1378 accounts_dialog = NULL; | |
1379 | |
1380 | |
1381 /* See if we're the main window here. */ | |
1382 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL && | |
1383 mainwindow == NULL && gaim_connections_get_all() == NULL) { | |
1384 | |
1385 do_quit(); | |
1386 } | |
1387 | |
1388 return FALSE; | |
1389 } | 1371 } |
1390 | 1372 |
1391 static gboolean | 1373 static gboolean |
1392 configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog) | 1374 configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsWindow *dialog) |
1393 { | 1375 { |
1394 if (GTK_WIDGET_VISIBLE(w)) { | 1376 if (GTK_WIDGET_VISIBLE(w)) { |
1395 int old_width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); | 1377 int old_width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); |
1396 int col_width; | 1378 int col_width; |
1397 int difference; | 1379 int difference; |
1420 | 1402 |
1421 return FALSE; | 1403 return FALSE; |
1422 } | 1404 } |
1423 | 1405 |
1424 static void | 1406 static void |
1425 add_account_cb(GtkWidget *w, AccountsDialog *dialog) | 1407 add_account_cb(GtkWidget *w, AccountsWindow *dialog) |
1426 { | 1408 { |
1427 show_account_prefs(ADD_ACCOUNT_DIALOG, dialog, NULL); | 1409 gaim_gtk_account_dialog_show(GAIM_GTK_ADD_ACCOUNT_DIALOG, NULL); |
1428 } | 1410 } |
1429 | 1411 |
1430 static void | 1412 static void |
1431 modify_account_sel(GtkTreeModel *model, GtkTreePath *path, | 1413 modify_account_sel(GtkTreeModel *model, GtkTreePath *path, |
1432 GtkTreeIter *iter, gpointer data) | 1414 GtkTreeIter *iter, gpointer data) |
1434 GaimAccount *account; | 1416 GaimAccount *account; |
1435 | 1417 |
1436 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); | 1418 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); |
1437 | 1419 |
1438 if (account != NULL) | 1420 if (account != NULL) |
1439 show_account_prefs(MODIFY_ACCOUNT_DIALOG, data, account); | 1421 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account); |
1440 } | 1422 } |
1441 | 1423 |
1442 static void | 1424 static void |
1443 modify_account_cb(GtkWidget *w, AccountsDialog *dialog) | 1425 modify_account_cb(GtkWidget *w, AccountsWindow *dialog) |
1444 { | 1426 { |
1445 GtkTreeSelection *selection; | 1427 GtkTreeSelection *selection; |
1446 | 1428 |
1447 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | 1429 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
1448 | 1430 |
1456 size_t index; | 1438 size_t index; |
1457 GtkTreeIter iter; | 1439 GtkTreeIter iter; |
1458 | 1440 |
1459 index = g_list_index(gaim_accounts_get_all(), account); | 1441 index = g_list_index(gaim_accounts_get_all(), account); |
1460 | 1442 |
1461 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(accounts_dialog->model), | 1443 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(accounts_window->model), |
1462 &iter, NULL, index)) { | 1444 &iter, NULL, index)) { |
1463 | 1445 |
1464 gtk_list_store_remove(accounts_dialog->model, &iter); | 1446 gtk_list_store_remove(accounts_window->model, &iter); |
1465 } | 1447 } |
1466 | 1448 |
1467 gaim_accounts_remove(account); | 1449 gaim_accounts_remove(account); |
1468 gaim_account_destroy(account); | 1450 gaim_account_destroy(account); |
1469 } | 1451 } |
1488 _("Cancel"), NULL); | 1470 _("Cancel"), NULL); |
1489 } | 1471 } |
1490 } | 1472 } |
1491 | 1473 |
1492 static void | 1474 static void |
1493 ask_delete_account_cb(GtkWidget *w, AccountsDialog *dialog) | 1475 ask_delete_account_cb(GtkWidget *w, AccountsWindow *dialog) |
1494 { | 1476 { |
1495 GtkTreeSelection *selection; | 1477 GtkTreeSelection *selection; |
1496 | 1478 |
1497 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | 1479 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
1498 | 1480 |
1499 gtk_tree_selection_selected_foreach(selection, ask_delete_account_sel, | 1481 gtk_tree_selection_selected_foreach(selection, ask_delete_account_sel, |
1500 dialog); | 1482 dialog); |
1501 } | 1483 } |
1502 | 1484 |
1503 static void | 1485 static void |
1504 close_accounts_cb(GtkWidget *w, AccountsDialog *dialog) | 1486 close_accounts_cb(GtkWidget *w, AccountsWindow *dialog) |
1505 { | 1487 { |
1506 gtk_widget_destroy(dialog->window); | 1488 gtk_widget_destroy(dialog->window); |
1507 | 1489 |
1508 accedit_win_destroy_cb(NULL, NULL, dialog); | 1490 accedit_win_destroy_cb(NULL, NULL, dialog); |
1509 } | 1491 } |
1510 | 1492 |
1511 static void | 1493 static void |
1512 online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) | 1494 online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) |
1513 { | 1495 { |
1514 AccountsDialog *dialog = (AccountsDialog *)data; | 1496 AccountsWindow *dialog = (AccountsWindow *)data; |
1515 GaimAccount *account; | 1497 GaimAccount *account; |
1516 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); | 1498 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
1517 GtkTreeIter iter; | 1499 GtkTreeIter iter; |
1518 gboolean online; | 1500 gboolean online; |
1519 | 1501 |
1533 | 1515 |
1534 static void | 1516 static void |
1535 autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str, | 1517 autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str, |
1536 gpointer data) | 1518 gpointer data) |
1537 { | 1519 { |
1538 AccountsDialog *dialog = (AccountsDialog *)data; | 1520 AccountsWindow *dialog = (AccountsWindow *)data; |
1539 GaimAccount *account; | 1521 GaimAccount *account; |
1540 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); | 1522 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
1541 GtkTreeIter iter; | 1523 GtkTreeIter iter; |
1542 gboolean autologin; | 1524 gboolean autologin; |
1543 | 1525 |
1553 COLUMN_AUTOLOGIN, !autologin, | 1535 COLUMN_AUTOLOGIN, !autologin, |
1554 -1); | 1536 -1); |
1555 } | 1537 } |
1556 | 1538 |
1557 static void | 1539 static void |
1558 add_columns(GtkWidget *treeview, AccountsDialog *dialog) | 1540 add_columns(GtkWidget *treeview, AccountsWindow *dialog) |
1559 { | 1541 { |
1560 GtkCellRenderer *renderer; | 1542 GtkCellRenderer *renderer; |
1561 GtkTreeViewColumn *column; | 1543 GtkTreeViewColumn *column; |
1562 | 1544 |
1563 /* Screen name column */ | 1545 /* Screen name column */ |
1637 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); | 1619 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); |
1638 if (scale != NULL) g_object_unref(G_OBJECT(scale)); | 1620 if (scale != NULL) g_object_unref(G_OBJECT(scale)); |
1639 } | 1621 } |
1640 | 1622 |
1641 static void | 1623 static void |
1642 add_account(AccountsDialog *dialog, GaimAccount *account) | 1624 add_account(AccountsWindow *dialog, GaimAccount *account) |
1643 { | 1625 { |
1644 GtkTreeIter iter; | 1626 GtkTreeIter iter; |
1645 | 1627 |
1646 gtk_list_store_append(dialog->model, &iter); | 1628 gtk_list_store_append(dialog->model, &iter); |
1647 | 1629 |
1648 set_account(dialog->model, &iter, account); | 1630 set_account(dialog->model, &iter, account); |
1649 } | 1631 } |
1650 | 1632 |
1651 static void | 1633 static void |
1652 populate_accounts_list(AccountsDialog *dialog) | 1634 populate_accounts_list(AccountsWindow *dialog) |
1653 { | 1635 { |
1654 GList *l; | 1636 GList *l; |
1655 | 1637 |
1656 gtk_list_store_clear(dialog->model); | 1638 gtk_list_store_clear(dialog->model); |
1657 | 1639 |
1658 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) | 1640 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) |
1659 add_account(dialog, (GaimAccount *)l->data); | 1641 add_account(dialog, (GaimAccount *)l->data); |
1660 } | 1642 } |
1661 | 1643 |
1662 static void | 1644 static void |
1663 account_selected_cb(GtkTreeSelection *sel, AccountsDialog *dialog) | 1645 account_selected_cb(GtkTreeSelection *sel, AccountsWindow *dialog) |
1664 { | 1646 { |
1665 gtk_widget_set_sensitive(dialog->modify_button, TRUE); | 1647 gtk_widget_set_sensitive(dialog->modify_button, TRUE); |
1666 gtk_widget_set_sensitive(dialog->delete_button, TRUE); | 1648 gtk_widget_set_sensitive(dialog->delete_button, TRUE); |
1667 } | 1649 } |
1668 | 1650 |
1669 static GtkWidget * | 1651 static GtkWidget * |
1670 create_accounts_list(AccountsDialog *dialog) | 1652 create_accounts_list(AccountsWindow *dialog) |
1671 { | 1653 { |
1672 GtkWidget *sw; | 1654 GtkWidget *sw; |
1673 GtkWidget *treeview; | 1655 GtkWidget *treeview; |
1674 GtkTreeSelection *sel; | 1656 GtkTreeSelection *sel; |
1675 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; | 1657 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; |
1723 | 1705 |
1724 return sw; | 1706 return sw; |
1725 } | 1707 } |
1726 | 1708 |
1727 void | 1709 void |
1728 gaim_gtk_account_dialog_show(void) | 1710 gaim_gtk_accounts_window_show(void) |
1729 { | 1711 { |
1730 AccountsDialog *dialog; | 1712 AccountsWindow *dialog; |
1731 GtkWidget *win; | 1713 GtkWidget *win; |
1732 GtkWidget *vbox; | 1714 GtkWidget *vbox; |
1733 GtkWidget *bbox; | 1715 GtkWidget *bbox; |
1734 GtkWidget *sw; | 1716 GtkWidget *sw; |
1735 GtkWidget *sep; | 1717 GtkWidget *sep; |
1736 GtkWidget *button; | 1718 GtkWidget *button; |
1737 int width, height; | 1719 int width, height; |
1738 | 1720 |
1739 if (accounts_dialog != NULL) | 1721 if (accounts_window != NULL) |
1740 return; | 1722 return; |
1741 | 1723 |
1742 accounts_dialog = dialog = g_new0(AccountsDialog, 1); | 1724 accounts_window = dialog = g_new0(AccountsWindow, 1); |
1743 | 1725 |
1744 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); | 1726 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); |
1745 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height"); | 1727 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height"); |
1746 | 1728 |
1747 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 1729 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
1749 gtk_window_set_role(GTK_WINDOW(win), "accounts"); | 1731 gtk_window_set_role(GTK_WINDOW(win), "accounts"); |
1750 gtk_window_set_title(GTK_WINDOW(win), _("Accounts")); | 1732 gtk_window_set_title(GTK_WINDOW(win), _("Accounts")); |
1751 gtk_container_set_border_width(GTK_CONTAINER(win), 12); | 1733 gtk_container_set_border_width(GTK_CONTAINER(win), 12); |
1752 | 1734 |
1753 g_signal_connect(G_OBJECT(win), "delete_event", | 1735 g_signal_connect(G_OBJECT(win), "delete_event", |
1754 G_CALLBACK(accedit_win_destroy_cb), accounts_dialog); | 1736 G_CALLBACK(accedit_win_destroy_cb), accounts_window); |
1755 g_signal_connect(G_OBJECT(win), "configure_event", | 1737 g_signal_connect(G_OBJECT(win), "configure_event", |
1756 G_CALLBACK(configure_cb), accounts_dialog); | 1738 G_CALLBACK(configure_cb), accounts_window); |
1757 | 1739 |
1758 /* Setup the vbox */ | 1740 /* Setup the vbox */ |
1759 vbox = gtk_vbox_new(FALSE, 12); | 1741 vbox = gtk_vbox_new(FALSE, 12); |
1760 gtk_container_add(GTK_CONTAINER(win), vbox); | 1742 gtk_container_add(GTK_CONTAINER(win), vbox); |
1761 gtk_widget_show(vbox); | 1743 gtk_widget_show(vbox); |
1818 gaim_signal_connect(dialog, event_signoff, signed_on_off_cb, dialog); | 1800 gaim_signal_connect(dialog, event_signoff, signed_on_off_cb, dialog); |
1819 | 1801 |
1820 gtk_widget_show(win); | 1802 gtk_widget_show(win); |
1821 } | 1803 } |
1822 | 1804 |
1805 void | |
1806 gaim_gtk_accounts_window_hide(void) | |
1807 { | |
1808 if (accounts_window == NULL) | |
1809 return; | |
1810 | |
1811 gaim_signals_disconnect_by_handle(accounts_window); | |
1812 | |
1813 g_free(accounts_window); | |
1814 accounts_window = NULL; | |
1815 | |
1816 /* See if we're the main window here. */ | |
1817 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL && | |
1818 mainwindow == NULL && gaim_connections_get_all() == NULL) { | |
1819 | |
1820 do_quit(); | |
1821 } | |
1822 } |