2 Unix SMB/CIFS implementation.
5 Copyright (C) Jelmer Vernooij 2004
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "gtk/common/gtk-smb.h"
27 create_user_edit_dialog (void)
29 GtkWidget *user_edit_dialog;
30 GtkWidget *dialog_vbox1;
39 GtkWidget *chk_mustchange;
40 GtkWidget *entry_fullname;
41 GtkWidget *entry_description;
42 GtkWidget *lbl_username;
43 GtkWidget *entry_password;
44 GtkWidget *entry_confirm_password;
45 GtkWidget *chk_cannotchange;
46 GtkWidget *chk_cannotexpire;
47 GtkWidget *chk_disabled;
48 GtkWidget *chk_lockedout;
51 GtkWidget *scrolledwindow3;
54 GtkWidget *btn_groupadd;
55 GtkWidget *btn_groupdel;
56 GtkWidget *scrolledwindow4;
64 GtkWidget *entry_profilepath;
65 GtkWidget *entry_scriptname;
70 GtkWidget *entry_homedir;
71 GtkWidget *chk_mapdrive;
72 GtkWidget *combo_homedrive;
75 GtkWidget *dialog_action_area1;
76 GtkWidget *cancelbutton1;
77 GtkWidget *applybutton1;
80 user_edit_dialog = gtk_dialog_new ();
81 gtk_window_set_title (GTK_WINDOW (user_edit_dialog), "Edit User");
83 dialog_vbox1 = GTK_DIALOG (user_edit_dialog)->vbox;
85 notebook = gtk_notebook_new ();
86 gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook, TRUE, TRUE, 0);
88 table1 = gtk_table_new (10, 2, FALSE);
89 gtk_container_add (GTK_CONTAINER (notebook), table1);
91 label4 = gtk_label_new ("Username");
92 gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 0, 1,
93 (GtkAttachOptions) (GTK_FILL),
94 (GtkAttachOptions) (0), 0, 0);
95 gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
97 label5 = gtk_label_new ("Full name");
98 gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 1, 2,
99 (GtkAttachOptions) (GTK_FILL),
100 (GtkAttachOptions) (0), 0, 0);
101 gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
103 label6 = gtk_label_new ("Description");
104 gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 2, 3,
105 (GtkAttachOptions) (GTK_FILL),
106 (GtkAttachOptions) (0), 0, 0);
107 gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
109 label7 = gtk_label_new ("Password");
110 gtk_table_attach (GTK_TABLE (table1), label7, 0, 1, 3, 4,
111 (GtkAttachOptions) (GTK_FILL),
112 (GtkAttachOptions) (0), 0, 0);
113 gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
115 label8 = gtk_label_new ("Confirm password");
116 gtk_table_attach (GTK_TABLE (table1), label8, 0, 1, 4, 5,
117 (GtkAttachOptions) (GTK_FILL),
118 (GtkAttachOptions) (0), 0, 0);
119 gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
121 chk_mustchange = gtk_check_button_new_with_mnemonic ("_User Must Change Password at Next Logon");
122 gtk_table_attach (GTK_TABLE (table1), chk_mustchange, 1, 2, 5, 6,
123 (GtkAttachOptions) (GTK_FILL),
124 (GtkAttachOptions) (0), 0, 0);
126 entry_fullname = gtk_entry_new ();
127 gtk_table_attach (GTK_TABLE (table1), entry_fullname, 1, 2, 1, 2,
128 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
129 (GtkAttachOptions) (0), 0, 0);
131 entry_description = gtk_entry_new ();
132 gtk_table_attach (GTK_TABLE (table1), entry_description, 1, 2, 2, 3,
133 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
134 (GtkAttachOptions) (0), 0, 0);
136 lbl_username = gtk_label_new ("");
137 gtk_table_attach (GTK_TABLE (table1), lbl_username, 1, 2, 0, 1,
138 (GtkAttachOptions) (GTK_FILL),
139 (GtkAttachOptions) (0), 0, 0);
140 gtk_misc_set_alignment (GTK_MISC (lbl_username), 0, 0.5);
142 entry_password = gtk_entry_new ();
143 gtk_table_attach (GTK_TABLE (table1), entry_password, 1, 2, 3, 4,
144 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
145 (GtkAttachOptions) (0), 0, 0);
147 entry_confirm_password = gtk_entry_new ();
148 gtk_table_attach (GTK_TABLE (table1), entry_confirm_password, 1, 2, 4, 5,
149 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
150 (GtkAttachOptions) (0), 0, 0);
152 chk_cannotchange = gtk_check_button_new_with_mnemonic ("User Cannot Change Password");
153 gtk_table_attach (GTK_TABLE (table1), chk_cannotchange, 1, 2, 6, 7,
154 (GtkAttachOptions) (GTK_FILL),
155 (GtkAttachOptions) (0), 0, 0);
157 chk_cannotexpire = gtk_check_button_new_with_mnemonic ("Password Never Expires");
158 gtk_table_attach (GTK_TABLE (table1), chk_cannotexpire, 1, 2, 7, 8,
159 (GtkAttachOptions) (GTK_FILL),
160 (GtkAttachOptions) (0), 0, 0);
162 chk_disabled = gtk_check_button_new_with_mnemonic ("Account Disabled");
163 gtk_table_attach (GTK_TABLE (table1), chk_disabled, 1, 2, 8, 9,
164 (GtkAttachOptions) (GTK_FILL),
165 (GtkAttachOptions) (0), 0, 0);
167 chk_lockedout = gtk_check_button_new_with_mnemonic ("Account Locked Out");
168 gtk_table_attach (GTK_TABLE (table1), chk_lockedout, 1, 2, 9, 10,
169 (GtkAttachOptions) (GTK_FILL),
170 (GtkAttachOptions) (0), 0, 0);
172 label1 = gtk_label_new ("Main");
173 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), label1);
175 hbox1 = gtk_hbox_new (FALSE, 0);
176 gtk_container_add (GTK_CONTAINER (notebook), hbox1);
178 scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
179 gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow3, TRUE, TRUE, 0);
181 treeview3 = gtk_tree_view_new ();
182 gtk_container_add (GTK_CONTAINER (scrolledwindow3), treeview3);
184 vbox2 = gtk_vbox_new (TRUE, 0);
185 gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0);
187 btn_groupadd = gtk_button_new_from_stock ("gtk-add");
188 gtk_box_pack_start (GTK_BOX (vbox2), btn_groupadd, FALSE, FALSE, 0);
190 btn_groupdel = gtk_button_new_from_stock ("gtk-remove");
191 gtk_box_pack_start (GTK_BOX (vbox2), btn_groupdel, FALSE, FALSE, 0);
193 scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
194 gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow4, TRUE, TRUE, 0);
196 treeview4 = gtk_tree_view_new ();
197 gtk_container_add (GTK_CONTAINER (scrolledwindow4), treeview4);
199 label2 = gtk_label_new ("Groups");
200 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label2);
202 vbox3 = gtk_vbox_new (FALSE, 0);
203 gtk_container_add (GTK_CONTAINER (notebook), vbox3);
205 frame1 = gtk_frame_new (NULL);
206 gtk_box_pack_start (GTK_BOX (vbox3), frame1, TRUE, TRUE, 0);
208 table2 = gtk_table_new (2, 2, FALSE);
209 gtk_container_add (GTK_CONTAINER (frame1), table2);
211 label12 = gtk_label_new ("User Profile Path:");
212 gtk_table_attach (GTK_TABLE (table2), label12, 0, 1, 0, 1,
213 (GtkAttachOptions) (GTK_FILL),
214 (GtkAttachOptions) (0), 0, 0);
215 gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
217 label13 = gtk_label_new ("Logon Script Name:");
218 gtk_table_attach (GTK_TABLE (table2), label13, 0, 1, 1, 2,
219 (GtkAttachOptions) (GTK_FILL),
220 (GtkAttachOptions) (0), 0, 0);
221 gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);
223 entry_profilepath = gtk_entry_new ();
224 gtk_table_attach (GTK_TABLE (table2), entry_profilepath, 1, 2, 0, 1,
225 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
226 (GtkAttachOptions) (0), 0, 0);
228 entry_scriptname = gtk_entry_new ();
229 gtk_table_attach (GTK_TABLE (table2), entry_scriptname, 1, 2, 1, 2,
230 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
231 (GtkAttachOptions) (0), 0, 0);
233 label10 = gtk_label_new ("User Profiles");
234 gtk_frame_set_label_widget (GTK_FRAME (frame1), label10);
236 frame2 = gtk_frame_new (NULL);
237 gtk_box_pack_start (GTK_BOX (vbox3), frame2, TRUE, TRUE, 0);
239 table3 = gtk_table_new (2, 2, FALSE);
240 gtk_container_add (GTK_CONTAINER (frame2), table3);
242 label14 = gtk_label_new ("Path");
243 gtk_table_attach (GTK_TABLE (table3), label14, 0, 1, 0, 1,
244 (GtkAttachOptions) (GTK_FILL),
245 (GtkAttachOptions) (0), 0, 0);
246 gtk_misc_set_alignment (GTK_MISC (label14), 0, 0.5);
248 entry_homedir = gtk_entry_new ();
249 gtk_table_attach (GTK_TABLE (table3), entry_homedir, 1, 2, 0, 1,
250 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
251 (GtkAttachOptions) (0), 0, 0);
253 chk_mapdrive = gtk_check_button_new_with_mnemonic ("Map homedir to drive");
254 gtk_table_attach (GTK_TABLE (table3), chk_mapdrive, 0, 1, 1, 2,
255 (GtkAttachOptions) (GTK_FILL),
256 (GtkAttachOptions) (0), 0, 0);
258 combo_homedrive = gtk_combo_box_new();
259 gtk_table_attach (GTK_TABLE (table3), combo_homedrive, 1, 2, 1, 2,
260 (GtkAttachOptions) (GTK_FILL),
261 (GtkAttachOptions) (GTK_FILL), 0, 0);
262 for(i = 'C'; i <= 'Z'; i++)
265 snprintf(drive, 3, "%c:", i);
266 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_homedrive), drive);
269 label11 = gtk_label_new ("Home Directory");
270 gtk_frame_set_label_widget (GTK_FRAME (frame2), label11);
272 label3 = gtk_label_new ("Profile");
273 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2), label3);
275 dialog_action_area1 = GTK_DIALOG (user_edit_dialog)->action_area;
276 gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
278 cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
279 gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
280 GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
282 applybutton1 = gtk_button_new_from_stock ("gtk-apply");
283 gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), applybutton1, GTK_RESPONSE_APPLY);
284 GTK_WIDGET_SET_FLAGS (applybutton1, GTK_CAN_DEFAULT);
286 okbutton1 = gtk_button_new_from_stock ("gtk-ok");
287 gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), okbutton1, GTK_RESPONSE_OK);
288 GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
290 gtk_widget_show_all(dialog_vbox1);
292 return user_edit_dialog;