Mercurial > pidgin.yaz
comparison src/gtkaccount.c @ 5651:20ce7928c0b9
[gaim-migrate @ 6065]
The account dialog now pulls in some of the options from the account.
Lookie, ma, real work been done!
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 02 Jun 2003 05:33:06 +0000 |
parents | 0cc2d99b7c44 |
children | 2216abc2d421 |
comparison
equal
deleted
inserted
replaced
5650:80682ac367fa | 5651:20ce7928c0b9 |
---|---|
56 } AccountPrefsDialogType; | 56 } AccountPrefsDialogType; |
57 | 57 |
58 typedef struct | 58 typedef struct |
59 { | 59 { |
60 GtkWidget *window; | 60 GtkWidget *window; |
61 GtkWidget *treeview; | |
61 | 62 |
62 GtkListStore *model; | 63 GtkListStore *model; |
64 GtkTreeIter drag_iter; | |
63 | 65 |
64 GtkTreeViewColumn *screenname_col; | 66 GtkTreeViewColumn *screenname_col; |
65 | 67 |
66 GtkTreeIter drag_iter; | |
67 | |
68 } AccountsDialog; | 68 } AccountsDialog; |
69 | 69 |
70 typedef struct | 70 typedef struct |
71 { | 71 { |
72 AccountPrefsDialogType type; | 72 AccountPrefsDialogType type; |
73 | 73 |
74 GaimAccount *account; | |
75 | |
74 GtkWidget *window; | 76 GtkWidget *window; |
75 | |
76 GtkWidget *login_frame; | 77 GtkWidget *login_frame; |
77 | |
78 GtkWidget *protocol_menu; | 78 GtkWidget *protocol_menu; |
79 GtkWidget *screenname_entry; | 79 GtkWidget *screenname_entry; |
80 | 80 |
81 GtkSizeGroup *sg; | 81 GtkSizeGroup *sg; |
82 | 82 |
129 static void | 129 static void |
130 __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) | 130 __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) |
131 { | 131 { |
132 GtkWidget *frame; | 132 GtkWidget *frame; |
133 GtkWidget *vbox; | 133 GtkWidget *vbox; |
134 GaimProtocol protocol; | |
134 | 135 |
135 if (dialog->login_frame != NULL) | 136 if (dialog->login_frame != NULL) |
136 gtk_widget_destroy(dialog->login_frame); | 137 gtk_widget_destroy(dialog->login_frame); |
138 | |
139 if (dialog->account == NULL) | |
140 protocol = GAIM_PROTO_OSCAR; | |
141 else | |
142 protocol = gaim_account_get_protocol(dialog->account); | |
137 | 143 |
138 frame = gaim_gtk_make_frame(parent, _("Login Options")); | 144 frame = gaim_gtk_make_frame(parent, _("Login Options")); |
139 | 145 |
140 /* cringe */ | 146 /* cringe */ |
141 dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); | 147 dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
146 vbox = gtk_vbox_new(FALSE, 6); | 152 vbox = gtk_vbox_new(FALSE, 6); |
147 gtk_container_add(GTK_CONTAINER(frame), vbox); | 153 gtk_container_add(GTK_CONTAINER(frame), vbox); |
148 gtk_widget_show(vbox); | 154 gtk_widget_show(vbox); |
149 | 155 |
150 /* Protocol */ | 156 /* Protocol */ |
151 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new(-1, | 157 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new( |
152 G_CALLBACK(__set_account_protocol), dialog); | 158 protocol, G_CALLBACK(__set_account_protocol), dialog); |
153 | 159 |
154 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); | 160 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); |
155 | 161 |
156 /* Screen Name */ | 162 /* Screen Name */ |
157 dialog->screenname_entry = gtk_entry_new(); | 163 dialog->screenname_entry = gtk_entry_new(); |
164 | |
165 if (dialog->account != NULL) | |
166 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), | |
167 gaim_account_get_username(dialog->account)); | |
168 | |
158 __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry); | 169 __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry); |
159 } | 170 |
160 | 171 #if 0 |
161 static void | 172 if (dialog->user_splits != NULL) { |
162 __show_account_prefs(AccountPrefsDialogType type) | 173 g_list_free(dialog->user_splits); |
174 dialog->user_splits = NULL; | |
175 } | |
176 #endif | |
177 } | |
178 | |
179 static void | |
180 __show_account_prefs(AccountPrefsDialogType type, GaimAccount *account) | |
163 { | 181 { |
164 AccountPrefsDialog *dialog; | 182 AccountPrefsDialog *dialog; |
165 GtkWidget *win; | 183 GtkWidget *win; |
166 GtkWidget *vbox; | 184 GtkWidget *vbox; |
167 GtkWidget *bbox; | 185 GtkWidget *bbox; |
168 GtkWidget *sep; | 186 GtkWidget *sep; |
169 GtkWidget *disclosure; | 187 GtkWidget *disclosure; |
170 | 188 |
171 dialog = g_new0(AccountPrefsDialog, 1); | 189 dialog = g_new0(AccountPrefsDialog, 1); |
172 | 190 |
173 dialog->type = type; | 191 dialog->account = account; |
174 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | 192 dialog->type = type; |
193 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
175 | 194 |
176 GAIM_DIALOG(win); | 195 GAIM_DIALOG(win); |
177 dialog->window = win; | 196 dialog->window = win; |
178 | 197 |
179 gtk_window_set_role(GTK_WINDOW(win), "account"); | 198 gtk_window_set_role(GTK_WINDOW(win), "account"); |
383 } | 402 } |
384 | 403 |
385 static void | 404 static void |
386 __add_account_cb(GtkWidget *w, AccountsDialog *dialog) | 405 __add_account_cb(GtkWidget *w, AccountsDialog *dialog) |
387 { | 406 { |
388 __show_account_prefs(ADD_ACCOUNT_DIALOG); | 407 __show_account_prefs(ADD_ACCOUNT_DIALOG, NULL); |
408 } | |
409 | |
410 static void | |
411 __modify_account_sel(GtkTreeModel *model, GtkTreePath *path, | |
412 GtkTreeIter *iter, gpointer data) | |
413 { | |
414 GaimAccount *account; | |
415 | |
416 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); | |
417 | |
418 if (account != NULL) | |
419 __show_account_prefs(MODIFY_ACCOUNT_DIALOG, account); | |
389 } | 420 } |
390 | 421 |
391 static void | 422 static void |
392 __modify_account_cb(GtkWidget *w, AccountsDialog *dialog) | 423 __modify_account_cb(GtkWidget *w, AccountsDialog *dialog) |
393 { | 424 { |
394 __show_account_prefs(MODIFY_ACCOUNT_DIALOG); | 425 GtkTreeSelection *selection; |
426 | |
427 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | |
428 | |
429 gtk_tree_selection_selected_foreach(selection, __modify_account_sel, NULL); | |
395 } | 430 } |
396 | 431 |
397 static void | 432 static void |
398 __delete_account_cb(GtkWidget *w, AccountsDialog *dialog) | 433 __delete_account_cb(GtkWidget *w, AccountsDialog *dialog) |
399 { | 434 { |
557 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | 592 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, |
558 G_TYPE_BOOLEAN, G_TYPE_POINTER); | 593 G_TYPE_BOOLEAN, G_TYPE_POINTER); |
559 | 594 |
560 /* And now the actual treeview */ | 595 /* And now the actual treeview */ |
561 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); | 596 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); |
597 dialog->treeview = treeview; | |
562 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | 598 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
563 gtk_tree_selection_set_mode( | 599 gtk_tree_selection_set_mode( |
564 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), | 600 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
565 GTK_SELECTION_MULTIPLE); | 601 GTK_SELECTION_MULTIPLE); |
566 | 602 |