comparison src/gtkaccount.c @ 5563:9eb5b13fd412

[gaim-migrate @ 5965] Just a taste of what's coming. Standard "This won't compile" thing. Plugin authors, you're going to hate me, but that's okay, because I have friends too! It's really late. My brain resembles that of fish swimming in jello pudding with neon lights flying around chanting musicals. I'm not on drugs. I'm just that tired. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 30 May 2003 09:38:29 +0000
parents
children cc9ddec20010
comparison
equal deleted inserted replaced
5562:3c8d34574601 5563:9eb5b13fd412
1 /**
2 * @file gtkaccount.c Account Editor dialog
3 * @ingroup gtkui
4 *
5 * gaim
6 *
7 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23 #include "gtkaccount.h"
24 #include "account.h"
25 #include "prefs.h"
26 #include "stock.h"
27
28 typedef struct
29 {
30 GtkWidget *window;
31
32 } AccountsDialog;
33
34 static AccountsDialog *accounts_dialog = NULL;
35
36 static gint
37 __window_destroy_cb(GtkWidget *w, GdkEvent *event, void *unused)
38 {
39 g_free(accounts_dialog);
40 accounts_dialog = NULL;
41
42 return FALSE;
43 }
44
45 static gboolean
46 __configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog)
47 {
48 if (GTK_WIDGET_VISIBLE(w)) {
49 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width);
50 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/height", event->height);
51 }
52
53 return FALSE;
54 }
55
56 static GtkWidget *
57 __create_accounts_list(void)
58 {
59 return NULL;
60 }
61
62 void
63 gaim_gtk_account_dialog_show(void)
64 {
65 AccountsDialog *dialog;
66 GtkWidget *win;
67 GtkWidget *vbox;
68 GtkWidget *bbox;
69 GtkWidget *sw;
70 GtkWidget *sep;
71 GtkWidget *button;
72 int width, height;
73
74 if (accounts_dialog != NULL)
75 return;
76
77 dialog = g_new0(AccountsDialog, 1);
78
79 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width");
80 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height");
81
82 win = accounts_dialog->window;
83
84 GAIM_DIALOG(win);
85 gtk_window_set_default_size(GTK_WINDOW(win), width, height);
86 gtk_window_set_role(GTK_WINDOW(win), "accounts");
87 gtk_window_set_title(GTK_WINDOW(win), "Accounts");
88 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
89
90 g_signal_connect(G_OBJECT(win), "delete_event",
91 G_CALLBACK(__window_destroy_cb), accounts_dialog);
92 g_signal_connect(G_OBJECT(win), "configure_event",
93 G_CALLBACK(__configure_cb), accounts_dialog);
94
95 /* Setup the vbox */
96 vbox = gtk_vbox_new(FALSE, 12);
97 gtk_container_add(GTK_CONTAINER(win), vbox);
98 gtk_widget_show(vbox);
99
100 /* Setup the scrolled window that will contain the list of accounts. */
101 sw = __create_accounts_list();
102 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
103 gtk_widget_show(sw);
104
105 /* Separator... */
106 sep = gtk_hseparator_new();
107 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
108 gtk_widget_show(sep);
109
110 /* Button box. */
111 bbox = gtk_hbutton_box_new();
112 gtk_box_set_spacing(GTK_BOX(bbox), 6);
113 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
114 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
115 gtk_widget_show(vbox);
116
117 /* Add button */
118 button = gtk_button_new_from_stock(GTK_STOCK_ADD);
119 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
120 gtk_widget_show(button);
121
122 /* Modify button */
123 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY);
124 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
125 gtk_widget_show(button);
126
127 /* Delete button */
128 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
129 gtk_box_pack_start(GTK_BOX(button), button, FALSE, FALSE, 0);
130 gtk_widget_show(button);
131
132 /* Close button */
133 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
134 gtk_box_pack_start(GTK_BOX(button), button, FALSE, FALSE, 0);
135 gtk_widget_show(button);
136
137 gtk_widget_show(win);
138 }
139