- /* Create the window */
- users_details_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_style(users_details_window, tool_style);
- g_signal_connect(users_details_window, "destroy",
- G_CALLBACK(gtk_widget_destroyed), &users_details_window);
- gtk_window_set_title(GTK_WINDOW(users_details_window), title);
- gtk_window_set_transient_for(GTK_WINDOW(users_details_window),
- GTK_WINDOW(users_window));
- table = gtk_table_new(4, 2, FALSE/*!homogeneous*/);
-
- users_details_name = users_add_detail(table, &row, "Username", name,
- (name ? 0 : DETAIL_EDITABLE)
- |DETAIL_VISIBLE);
-
- users_details_email = users_add_detail(table, &row, "Email", email,
- DETAIL_EDITABLE|DETAIL_VISIBLE);
-
- users_details_password = users_add_detail(table, &row, "Password",
- password,
- DETAIL_EDITABLE);
- users_details_password2 = users_add_detail(table, &row, "Password",
- password,
- DETAIL_EDITABLE);
-
- parse_rights(rights, &r, 1);
- users_add_right(table, &row, "Read operations", r & RIGHT_READ);
- users_add_right(table, &row, "Play track", r & RIGHT_PLAY);
- users_add_right_group(table, &row, "Move", r, RIGHT_MOVE__MASK, NULL);
- users_add_right_group(table, &row, "Remove", r, RIGHT_REMOVE__MASK, NULL);
- users_add_right_group(table, &row, "Scratch", r, RIGHT_SCRATCH__MASK, NULL);
- users_add_right(table, &row, "Set volume", r & RIGHT_VOLUME);
- users_add_right(table, &row, "Admin operations", r & RIGHT_ADMIN);
- users_add_right(table, &row, "Rescan", r & RIGHT_RESCAN);
- users_add_right(table, &row, "Register new users", r & RIGHT_REGISTER);
- users_add_right(table, &row, "Modify own userinfo", r & RIGHT_USERINFO);
- users_add_right(table, &row, "Modify track preferences", r & RIGHT_PREFS);
- users_add_right(table, &row, "Modify global preferences", r & RIGHT_GLOBAL_PREFS);
- users_add_right(table, &row, "Pause/resume tracks", r & RIGHT_PAUSE);
-
- gtk_container_add(GTK_CONTAINER(users_details_window), table);
- gtk_widget_show_all(users_details_window);
+ /* Create the table if it doesn't already exist */
+ if(!users_details_table) {
+ users_details_table = gtk_table_new(4, 2, FALSE/*!homogeneous*/);
+ g_signal_connect(users_details_table, "destroy",
+ G_CALLBACK(users_details_destroyed), 0);
+ }
+
+ /* Create or update the widgets */
+ users_add_detail(&users_details_name, "Username", name,
+ (DETAIL_EDITABLE|DETAIL_VISIBLE) & nameflags);
+
+ users_add_detail(&users_details_email, "Email", email,
+ (DETAIL_EDITABLE|DETAIL_VISIBLE) & flags);
+
+ users_add_detail(&users_details_password, "Password", password,
+ DETAIL_EDITABLE & flags);
+ users_add_detail(&users_details_password2, "Password", password,
+ DETAIL_EDITABLE & flags);
+
+ parse_rights(rights, &r, 0);
+ users_add_right("Read operations", r, RIGHT_READ);
+ users_add_right("Play track", r, RIGHT_PLAY);
+ users_add_right_group("Move", r, RIGHT_MOVE__MASK);
+ users_add_right_group("Remove", r, RIGHT_REMOVE__MASK);
+ users_add_right_group("Scratch", r, RIGHT_SCRATCH__MASK);
+ users_add_right("Set volume", r, RIGHT_VOLUME);
+ users_add_right("Admin operations", r, RIGHT_ADMIN);
+ users_add_right("Rescan", r, RIGHT_RESCAN);
+ users_add_right("Register new users", r, RIGHT_REGISTER);
+ users_add_right("Modify own userinfo", r, RIGHT_USERINFO);
+ users_add_right("Modify track preferences", r, RIGHT_PREFS);
+ users_add_right("Modify global preferences", r, RIGHT_GLOBAL_PREFS);
+ users_add_right("Pause/resume tracks", r, RIGHT_PAUSE);
+ users_details_sensitize_all();