Mercurial > pidgin
comparison gtk/gtkaccount.c @ 14991:5906e055bce4
[gaim-migrate @ 17770]
gaim-devel suggested a 'wizard' of sorts for first-time users. This is as wizardish as I'm willing to get :)
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 17 Nov 2006 21:03:44 +0000 |
parents | c157efddc62a |
children | f92232fcde41 |
comparison
equal
deleted
inserted
replaced
14990:633d4c25e82c | 14991:5906e055bce4 |
---|---|
70 GtkWidget *window; | 70 GtkWidget *window; |
71 GtkWidget *treeview; | 71 GtkWidget *treeview; |
72 | 72 |
73 GtkWidget *modify_button; | 73 GtkWidget *modify_button; |
74 GtkWidget *delete_button; | 74 GtkWidget *delete_button; |
75 GtkWidget *notebook; | |
75 | 76 |
76 GtkListStore *model; | 77 GtkListStore *model; |
77 GtkTreeIter drag_iter; | 78 GtkTreeIter drag_iter; |
78 | 79 |
79 GtkTreeViewColumn *screenname_col; | 80 GtkTreeViewColumn *screenname_col; |
1599 return; | 1600 return; |
1600 | 1601 |
1601 /* Remove the account from the GtkListStore */ | 1602 /* Remove the account from the GtkListStore */ |
1602 if (accounts_window_find_account_in_treemodel(&iter, account)) | 1603 if (accounts_window_find_account_in_treemodel(&iter, account)) |
1603 gtk_list_store_remove(accounts_window->model, &iter); | 1604 gtk_list_store_remove(accounts_window->model, &iter); |
1605 | |
1606 if (gaim_accounts_get_all() == NULL) | |
1607 gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 0); | |
1604 } | 1608 } |
1605 | 1609 |
1606 static void | 1610 static void |
1607 account_abled_cb(GaimAccount *account, gpointer user_data) | 1611 account_abled_cb(GaimAccount *account, gpointer user_data) |
1608 { | 1612 { |
1967 | 1971 |
1968 if (accounts_window == NULL) | 1972 if (accounts_window == NULL) |
1969 return; | 1973 return; |
1970 | 1974 |
1971 gtk_list_store_append(accounts_window->model, &iter); | 1975 gtk_list_store_append(accounts_window->model, &iter); |
1976 gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook),1); | |
1972 | 1977 |
1973 set_account(accounts_window->model, &iter, account); | 1978 set_account(accounts_window->model, &iter, account); |
1974 } | 1979 } |
1975 | 1980 |
1976 static void | 1981 static gboolean |
1977 populate_accounts_list(AccountsWindow *dialog) | 1982 populate_accounts_list(AccountsWindow *dialog) |
1978 { | 1983 { |
1979 GList *l; | 1984 GList *l; |
1980 | 1985 gboolean ret = FALSE; |
1986 | |
1981 gtk_list_store_clear(dialog->model); | 1987 gtk_list_store_clear(dialog->model); |
1982 | 1988 |
1983 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) | 1989 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
1990 ret = TRUE; | |
1984 add_account_to_liststore((GaimAccount *)l->data, NULL); | 1991 add_account_to_liststore((GaimAccount *)l->data, NULL); |
1992 } | |
1993 | |
1994 return ret; | |
1985 } | 1995 } |
1986 | 1996 |
1987 #if !GTK_CHECK_VERSION(2,2,0) | 1997 #if !GTK_CHECK_VERSION(2,2,0) |
1988 static void | 1998 static void |
1989 get_selected_helper(GtkTreeModel *model, GtkTreePath *path, | 1999 get_selected_helper(GtkTreeModel *model, GtkTreePath *path, |
2043 } | 2053 } |
2044 | 2054 |
2045 static GtkWidget * | 2055 static GtkWidget * |
2046 create_accounts_list(AccountsWindow *dialog) | 2056 create_accounts_list(AccountsWindow *dialog) |
2047 { | 2057 { |
2058 GtkWidget *frame; | |
2048 GtkWidget *sw; | 2059 GtkWidget *sw; |
2060 GtkWidget *label; | |
2049 GtkWidget *treeview; | 2061 GtkWidget *treeview; |
2062 GdkColor color; | |
2050 GtkTreeSelection *sel; | 2063 GtkTreeSelection *sel; |
2051 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; | 2064 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; |
2065 | |
2066 frame = gtk_frame_new(NULL); | |
2067 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
2068 | |
2069 accounts_window->notebook = gtk_notebook_new(); | |
2070 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(accounts_window->notebook), FALSE); | |
2071 gtk_notebook_set_show_border(GTK_NOTEBOOK(accounts_window->notebook), FALSE); | |
2072 gtk_container_add(GTK_CONTAINER(frame), accounts_window->notebook); | |
2073 | |
2074 | |
2075 /* Create a helpful first-time-use label */ | |
2076 label = gtk_label_new(NULL); | |
2077 gtk_label_set_markup(GTK_LABEL(label), _( | |
2078 "<span size='larger' weight='bold'>Welcome to Gaim!</span>\n\n" | |
2079 | |
2080 "You have no IM accounts configured. To start connecting with Gaim " | |
2081 "press the <b>Add</b> button below and configure your first " | |
2082 "account. If you want Gaim to connect to multiple IM accounts, " | |
2083 "press <b>Add</b> again to configure them all.\n\n" | |
2084 | |
2085 "You can come back to this window to add, edit, or remove " | |
2086 "accounts from <b>Accounts \342\207\250 Add/Edit</b> in the Buddy " | |
2087 "List window")); | |
2088 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
2089 gtk_widget_show(label); | |
2090 | |
2091 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5); | |
2092 gtk_notebook_append_page(GTK_NOTEBOOK(accounts_window->notebook), label, NULL); | |
2052 | 2093 |
2053 /* Create the scrolled window. */ | 2094 /* Create the scrolled window. */ |
2054 sw = gtk_scrolled_window_new(0, 0); | 2095 sw = gtk_scrolled_window_new(0, 0); |
2055 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | 2096 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
2056 GTK_POLICY_AUTOMATIC, | 2097 GTK_POLICY_AUTOMATIC, |
2057 GTK_POLICY_AUTOMATIC); | 2098 GTK_POLICY_AUTOMATIC); |
2058 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | 2099 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
2059 GTK_SHADOW_IN); | 2100 GTK_SHADOW_NONE); |
2101 gtk_notebook_append_page(GTK_NOTEBOOK(accounts_window->notebook), sw, NULL); | |
2060 gtk_widget_show(sw); | 2102 gtk_widget_show(sw); |
2061 | 2103 |
2062 /* Create the list model. */ | 2104 /* Create the list model. */ |
2063 dialog->model = gtk_list_store_new(NUM_COLUMNS, | 2105 dialog->model = gtk_list_store_new(NUM_COLUMNS, |
2064 GDK_TYPE_PIXBUF, /* COLUMN_ICON */ | 2106 GDK_TYPE_PIXBUF, /* COLUMN_ICON */ |
2082 /* Handle double-clicking */ | 2124 /* Handle double-clicking */ |
2083 g_signal_connect(G_OBJECT(treeview), "button_press_event", | 2125 g_signal_connect(G_OBJECT(treeview), "button_press_event", |
2084 G_CALLBACK(account_treeview_double_click_cb), dialog); | 2126 G_CALLBACK(account_treeview_double_click_cb), dialog); |
2085 | 2127 |
2086 gtk_container_add(GTK_CONTAINER(sw), treeview); | 2128 gtk_container_add(GTK_CONTAINER(sw), treeview); |
2087 gtk_widget_show(treeview); | |
2088 | 2129 |
2089 add_columns(treeview, dialog); | 2130 add_columns(treeview, dialog); |
2090 | 2131 |
2091 populate_accounts_list(dialog); | 2132 if (populate_accounts_list(dialog)) |
2133 gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 1); | |
2134 else | |
2135 gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 0); | |
2092 | 2136 |
2093 /* Setup DND. I wanna be an orc! */ | 2137 /* Setup DND. I wanna be an orc! */ |
2094 gtk_tree_view_enable_model_drag_source( | 2138 gtk_tree_view_enable_model_drag_source( |
2095 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, | 2139 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, |
2096 1, GDK_ACTION_COPY); | 2140 1, GDK_ACTION_COPY); |
2100 | 2144 |
2101 g_signal_connect(G_OBJECT(treeview), "drag-data-received", | 2145 g_signal_connect(G_OBJECT(treeview), "drag-data-received", |
2102 G_CALLBACK(drag_data_received_cb), dialog); | 2146 G_CALLBACK(drag_data_received_cb), dialog); |
2103 g_signal_connect(G_OBJECT(treeview), "drag-data-get", | 2147 g_signal_connect(G_OBJECT(treeview), "drag-data-get", |
2104 G_CALLBACK(drag_data_get_cb), dialog); | 2148 G_CALLBACK(drag_data_get_cb), dialog); |
2105 | 2149 |
2106 return sw; | 2150 gtk_widget_show_all(frame); |
2151 return frame; | |
2107 } | 2152 } |
2108 | 2153 |
2109 static void | 2154 static void |
2110 account_modified_cb(GaimAccount *account, AccountsWindow *window) | 2155 account_modified_cb(GaimAccount *account, AccountsWindow *window) |
2111 { | 2156 { |