2 * This file is part of DisOrder
3 * Copyright (C) 2008 Richard Kettlewell
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 /** @file disobedience/users.c
19 * @brief User management for Disobedience
21 * The user management window contains:
22 * - a list of all the users
25 * - a user details panel
28 * When you select a user that user's details are displayed to the right of the
29 * list. Hit the Apply button and any changes are applied.
31 * When you select 'add' a new empty set of details are displayed to be edited.
32 * Again Apply will commit them.
35 * - enter new username in the GtkTreeView
36 * - should have a cancel or close button, consistent with properties and login
39 #include "disobedience.h"
43 static void users_details_sensitize_all(void);
44 static void users_set_report(const char *msg);
46 static GtkWidget *users_window;
47 static GtkListStore *users_list;
48 static GtkTreeSelection *users_selection;
50 static GtkWidget *users_details_table;
51 static GtkWidget *users_apply_button;
52 static GtkWidget *users_delete_button;
53 static GtkWidget *users_details_name;
54 static GtkWidget *users_details_email;
55 static GtkWidget *users_details_password;
56 static GtkWidget *users_details_password2;
57 static GtkWidget *users_details_rights[32];
58 static GtkWidget *users_reporter;
59 static int users_details_row;
60 static const char *users_selected;
61 static const char *users_deferred_select;
63 static int users_mode;
68 #define mode(X) do { \
69 users_mode = MODE_##X; \
70 if(0) fprintf(stderr, "%s:%d: %s(): mode -> %s\n", \
71 __FILE__, __LINE__, __FUNCTION__, #X); \
72 users_details_sensitize_all(); \
75 static const char *users_email, *users_rights, *users_password;
77 /** @brief qsort() callback for username comparison */
78 static int usercmp(const void *a, const void *b) {
79 return strcmp(*(char **)a, *(char **)b);
82 /** @brief Find a user
83 * @param user User to find
84 * @param iter Iterator to point at user
85 * @return 0 on success, -1 if not found
87 static int users_find_user(const char *user,
92 if(!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(users_list), iter))
95 gtk_tree_model_get(GTK_TREE_MODEL(users_list), iter,
97 if(!strcmp(who, user)) {
102 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(users_list), iter));
106 /** @brief Called with the list of users
109 * - at startup to populate the initial list
110 * - when we add a user
111 * - maybe in the future when we delete a user
113 * If users_deferred_select is set then that user is selected.
115 static void users_got_list(void attribute((unused)) *v,
117 int nvec, char **vec) {
122 popup_protocol_error(0, err);
125 /* Present users in alphabetical order */
126 qsort(vec, nvec, sizeof (char *), usercmp);
127 /* Set the list contents */
128 gtk_list_store_clear(users_list);
129 for(n = 0; n < nvec; ++n)
130 gtk_list_store_insert_with_values(users_list, &iter, n/*position*/,
131 0, vec[n], /* column 0 */
132 -1); /* no more columns */
133 /* Only show the window when the list is populated */
134 gtk_widget_show_all(users_window);
135 if(users_deferred_select) {
136 if(!users_find_user(users_deferred_select, &iter))
137 gtk_tree_selection_select_iter(users_selection, &iter);
138 users_deferred_select = 0;
142 /** @brief Text should be visible */
143 #define DETAIL_VISIBLE 1
145 /** @brief Text should be editable */
146 #define DETAIL_EDITABLE 2
148 /** @brief Add a row to the user detail table */
149 static void users_detail_generic(const char *title,
150 GtkWidget *selector) {
151 const int row = users_details_row++;
152 GtkWidget *const label = gtk_label_new(title);
153 gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
154 gtk_table_attach(GTK_TABLE(users_details_table),
156 0, 1, /* left/right_attach */
157 row, row+1, /* top/bottom_attach */
158 GTK_FILL, /* xoptions */
160 1, 1); /* x/ypadding */
161 gtk_table_attach(GTK_TABLE(users_details_table),
163 1, 2, /* left/right_attach */
164 row, row + 1, /* top/bottom_attach */
165 GTK_EXPAND|GTK_FILL, /* xoptions */
166 GTK_FILL, /* yoptions */
167 1, 1); /* x/ypadding */
170 static void users_entry_changed(GtkEditable attribute((unused)) *editable,
171 gpointer attribute((unused)) user_data) {
172 users_details_sensitize_all();
175 /** @brief Add a row to the user details table
176 * @param entryp Where to put GtkEntry
177 * @param title Label for this row
178 * @param value Initial value or NULL
179 * @param flags Flags word
181 static void users_add_detail(GtkWidget **entryp,
187 if(!(entry = *entryp)) {
188 *entryp = entry = gtk_entry_new();
189 g_signal_connect(entry, "changed",
190 G_CALLBACK(users_entry_changed), 0);
191 users_detail_generic(title, entry);
193 gtk_entry_set_visibility(GTK_ENTRY(entry),
194 !!(flags & DETAIL_VISIBLE));
195 gtk_editable_set_editable(GTK_EDITABLE(entry),
196 !!(flags & DETAIL_EDITABLE));
197 gtk_entry_set_text(GTK_ENTRY(entry), value ? value : "");
200 /** @brief Add a checkbox for a right
201 * @param title Label for this row
202 * @param value Current value
203 * @param right Right bit
205 static void users_add_right(const char *title,
209 GtkWidget **checkp = &users_details_rights[leftmost_bit(right)];
211 if(!(check = *checkp)) {
212 *checkp = check = gtk_check_button_new_with_label("");
213 users_detail_generic(title, check);
215 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), !!(value & right));
218 /** @brief Set sensitivity of particular mine/random rights bits */
219 static void users_details_sensitize(rights_type r) {
220 const int bit = leftmost_bit(r);
221 const GtkWidget *all = users_details_rights[bit];
222 const int sensitive = (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(all))
223 && users_mode != MODE_NONE);
225 gtk_widget_set_sensitive(users_details_rights[bit + 1], sensitive);
226 gtk_widget_set_sensitive(users_details_rights[bit + 2], sensitive);
229 /** @brief Set sensitivity of everything in sight */
230 static void users_details_sensitize_all(void) {
232 const char *report = 0;
234 for(n = 0; n < 32; ++n)
235 if(users_details_rights[n])
236 gtk_widget_set_sensitive(users_details_rights[n], users_mode != MODE_NONE);
237 gtk_widget_set_sensitive(users_details_name, users_mode != MODE_NONE);
238 gtk_widget_set_sensitive(users_details_email, users_mode != MODE_NONE);
239 gtk_widget_set_sensitive(users_details_password, users_mode != MODE_NONE);
240 gtk_widget_set_sensitive(users_details_password2, users_mode != MODE_NONE);
241 users_details_sensitize(RIGHT_MOVE_ANY);
242 users_details_sensitize(RIGHT_REMOVE_ANY);
243 users_details_sensitize(RIGHT_SCRATCH_ANY);
244 int apply_sensitive = 1;
245 if(users_mode == MODE_NONE)
248 const char *name = gtk_entry_get_text(GTK_ENTRY(users_details_name));
249 const char *email = gtk_entry_get_text(GTK_ENTRY(users_details_email));
250 const char *pw = gtk_entry_get_text(GTK_ENTRY(users_details_password));
251 const char *pw2 = gtk_entry_get_text(GTK_ENTRY(users_details_password2));
252 /* Username must be filled in */
256 report = "Must fill in username";
258 /* Passwords must be nontrivial and match */
262 report = "Must fill in password";
264 if(strcmp(pw, pw2)) {
267 report = "Passwords must match";
269 /* Email address must be somewhat valid */
271 if(!email_valid(email)) {
273 report = "Invalid email address";
277 gtk_widget_set_sensitive(users_apply_button, apply_sensitive);
278 gtk_widget_set_sensitive(users_delete_button, !!users_selected);
279 users_set_report(report);
282 /** @brief Called when an _ALL widget is toggled
284 * Modifies sensitivity of the corresponding _MINE and _RANDOM widgets. We
285 * just do the lot rather than trying to figure out which one changed,
287 static void users_any_toggled(GtkToggleButton attribute((unused)) *togglebutton,
288 gpointer attribute((unused)) user_data) {
289 users_details_sensitize_all();
292 /** @brief Add a checkbox for a three-right group
293 * @param title Label for this row
294 * @param bits Rights bits (not masked or normalized)
295 * @param mask Mask for this group (must be 7*2^n)
297 static void users_add_right_group(const char *title,
300 const uint32_t first = mask / 7;
301 const int bit = leftmost_bit(first);
302 GtkWidget **widgets = &users_details_rights[bit], *any, *mine, *rnd;
305 GtkWidget *hbox = gtk_hbox_new(FALSE, 2);
307 any = widgets[0] = gtk_check_button_new_with_label("Any");
308 mine = widgets[1] = gtk_check_button_new_with_label("Own");
309 rnd = widgets[2] = gtk_check_button_new_with_label("Random");
310 gtk_box_pack_start(GTK_BOX(hbox), any, FALSE, FALSE, 0);
311 gtk_box_pack_start(GTK_BOX(hbox), mine, FALSE, FALSE, 0);
312 gtk_box_pack_start(GTK_BOX(hbox), rnd, FALSE, FALSE, 0);
313 users_detail_generic(title, hbox);
314 g_signal_connect(any, "toggled", G_CALLBACK(users_any_toggled), NULL);
315 users_details_rights[bit] = any;
316 users_details_rights[bit + 1] = mine;
317 users_details_rights[bit + 2] = rnd;
323 /* Discard irrelevant bits */
325 /* Shift down to bits 0-2; the mask is always 3 contiguous bits */
327 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(any), !!(bits & 1));
328 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mine), !!(bits & 2));
329 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rnd), !!(bits & 4));
332 /** @brief Called when the details table is destroyed */
333 static void users_details_destroyed(GtkWidget attribute((unused)) *widget,
334 GtkWidget attribute((unused)) **wp) {
335 users_details_table = 0;
336 g_object_unref(users_list);
338 users_details_name = 0;
339 users_details_email = 0;
340 users_details_password = 0;
341 users_details_password2 = 0;
342 memset(users_details_rights, 0, sizeof users_details_rights);
343 /* also users_selection? Not AFAICT; _get_selection does upref */
346 /** @brief Create or modify the user details table
347 * @param name User name (users_edit()) or NULL (users_add())
348 * @param email Email address
349 * @param rights User rights string
350 * @param password Password
351 * @param nameflags Visibility/editability for username
352 * @param flags Visibility/editability for other fields
354 static void users_makedetails(const char *name,
357 const char *password,
362 /* Create the table if it doesn't already exist */
363 if(!users_details_table) {
364 users_details_table = gtk_table_new(4, 2, FALSE/*!homogeneous*/);
365 g_signal_connect(users_details_table, "destroy",
366 G_CALLBACK(users_details_destroyed), 0);
369 /* Create or update the widgets */
370 users_add_detail(&users_details_name, "Username", name,
371 (DETAIL_EDITABLE|DETAIL_VISIBLE) & nameflags);
373 users_add_detail(&users_details_email, "Email", email,
374 (DETAIL_EDITABLE|DETAIL_VISIBLE) & flags);
376 users_add_detail(&users_details_password, "Password", password,
377 DETAIL_EDITABLE & flags);
378 users_add_detail(&users_details_password2, "Password", password,
379 DETAIL_EDITABLE & flags);
381 parse_rights(rights, &r, 0);
382 users_add_right("Read operations", r, RIGHT_READ);
383 users_add_right("Play track", r, RIGHT_PLAY);
384 users_add_right_group("Move", r, RIGHT_MOVE__MASK);
385 users_add_right_group("Remove", r, RIGHT_REMOVE__MASK);
386 users_add_right_group("Scratch", r, RIGHT_SCRATCH__MASK);
387 users_add_right("Set volume", r, RIGHT_VOLUME);
388 users_add_right("Admin operations", r, RIGHT_ADMIN);
389 users_add_right("Rescan", r, RIGHT_RESCAN);
390 users_add_right("Register new users", r, RIGHT_REGISTER);
391 users_add_right("Modify own userinfo", r, RIGHT_USERINFO);
392 users_add_right("Modify track preferences", r, RIGHT_PREFS);
393 users_add_right("Modify global preferences", r, RIGHT_GLOBAL_PREFS);
394 users_add_right("Pause/resume tracks", r, RIGHT_PAUSE);
395 users_details_sensitize_all();
398 /** @brief Called when the 'add' button is pressed */
399 static void users_add(GtkButton attribute((unused)) *button,
400 gpointer attribute((unused)) userdata) {
401 /* Unselect whatever is selected */
402 gtk_tree_selection_unselect_all(users_selection);
404 /* TODO it would be better to use the server default_rights if there's no
406 users_makedetails("",
408 config->default_rights,
410 DETAIL_EDITABLE|DETAIL_VISIBLE,
411 DETAIL_EDITABLE|DETAIL_VISIBLE);
412 /* Remember we're adding a user */
416 static rights_type users_get_rights(void) {
420 /* Extract the rights value */
421 for(n = 0; n < 32; ++n) {
422 if(users_details_rights[n])
423 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(users_details_rights[n])))
426 /* Throw out redundant bits */
427 if(r & RIGHT_REMOVE_ANY)
428 r &= ~(rights_type)(RIGHT_REMOVE_MINE|RIGHT_REMOVE_RANDOM);
429 if(r & RIGHT_MOVE_ANY)
430 r &= ~(rights_type)(RIGHT_MOVE_MINE|RIGHT_MOVE_RANDOM);
431 if(r & RIGHT_SCRATCH_ANY)
432 r &= ~(rights_type)(RIGHT_SCRATCH_MINE|RIGHT_SCRATCH_RANDOM);
436 /** @brief Called when a user setting has been edited */
437 static void users_edituser_completed(void attribute((unused)) *v,
440 popup_submsg(users_window, GTK_MESSAGE_ERROR, err);
443 /** @brief Called when a new user has been created */
444 static void users_adduser_completed(void *v,
447 popup_submsg(users_window, GTK_MESSAGE_ERROR, err);
448 mode(ADD); /* Let the user try again */
450 const struct kvp *const kvp = v;
451 const char *user = kvp_get(kvp, "user");
452 const char *email = kvp_get(kvp, "email"); /* maybe NULL */
454 /* Now the user is created we can go ahead and set the email address */
456 disorder_eclient_edituser(client, users_edituser_completed, user,
457 "email", email, NULL);
458 /* Refresh the list of users */
459 disorder_eclient_users(client, users_got_list, 0);
460 /* We'll select the newly created user */
461 users_deferred_select = user;
465 /** @brief Called when the 'Apply' button is pressed */
466 static void users_apply(GtkButton attribute((unused)) *button,
467 gpointer attribute((unused)) userdata) {
468 const char *password;
469 const char *password2;
477 name = xstrdup(gtk_entry_get_text(GTK_ENTRY(users_details_name)));
478 email = xstrdup(gtk_entry_get_text(GTK_ENTRY(users_details_email)));
479 password = xstrdup(gtk_entry_get_text(GTK_ENTRY(users_details_password)));
480 password2 = xstrdup(gtk_entry_get_text(GTK_ENTRY(users_details_password2)));
482 /* No username. Really we wanted to desensitize the Apply button when
483 * there's no userame but there doesn't seem to be a signal to detect
484 * changes to the entry text. Consequently we have error messages
486 popup_submsg(users_window, GTK_MESSAGE_ERROR, "Must enter a username");
489 if(strcmp(password, password2)) {
490 popup_submsg(users_window, GTK_MESSAGE_ERROR, "Passwords do not match");
493 if(*email && !strchr(email, '@')) {
494 /* The server will complain about this but we can give a better error
495 * message this way */
496 popup_submsg(users_window, GTK_MESSAGE_ERROR, "Invalid email address");
499 disorder_eclient_adduser(client,
500 users_adduser_completed,
503 rights_string(users_get_rights()),
504 kvp_make("user", name,
507 /* We switch to no-op mode while creating the user */
511 /* Ugh, can we de-dupe with above? */
512 email = xstrdup(gtk_entry_get_text(GTK_ENTRY(users_details_email)));
513 password = xstrdup(gtk_entry_get_text(GTK_ENTRY(users_details_password)));
514 password2 = xstrdup(gtk_entry_get_text(GTK_ENTRY(users_details_password2)));
515 if(strcmp(password, password2)) {
516 popup_submsg(users_window, GTK_MESSAGE_ERROR, "Passwords do not match");
519 if(*email && !strchr(email, '@')) {
520 popup_submsg(users_window, GTK_MESSAGE_ERROR, "Invalid email address");
523 disorder_eclient_edituser(client, users_edituser_completed, users_selected,
524 "email", email, NULL);
525 disorder_eclient_edituser(client, users_edituser_completed, users_selected,
526 "password", password, NULL);
527 disorder_eclient_edituser(client, users_edituser_completed, users_selected,
528 "rights", rights_string(users_get_rights()), NULL);
529 /* We remain in edit mode */
534 /** @brief Called when a user has been deleted */
535 static void users_delete_completed(void *v,
538 popup_submsg(users_window, GTK_MESSAGE_ERROR, err);
540 const struct kvp *const kvp = v;
541 const char *const user = kvp_get(kvp, "user");
544 if(!users_find_user(user, iter)) /* Find the user... */
545 gtk_list_store_remove(users_list, iter); /* ...and remove them */
549 /** @brief Called when the 'Delete' button is pressed */
550 static void users_delete(GtkButton attribute((unused)) *button,
551 gpointer attribute((unused)) userdata) {
557 yesno = gtk_message_dialog_new(GTK_WINDOW(users_window),
559 GTK_MESSAGE_QUESTION,
561 "Do you really want to delete user %s?"
562 " This action cannot be undone.",
564 res = gtk_dialog_run(GTK_DIALOG(yesno));
565 gtk_widget_destroy(yesno);
566 if(res == GTK_RESPONSE_YES) {
567 disorder_eclient_deluser(client, users_delete_completed, users_selected,
568 kvp_make("user", users_selected,
573 static void users_got_email(void attribute((unused)) *v,
577 popup_protocol_error(0, err);
581 static void users_got_rights(void attribute((unused)) *v,
585 popup_protocol_error(0, err);
586 users_rights = value;
589 static void users_got_password(void attribute((unused)) *v,
593 popup_protocol_error(0, err);
594 /* TODO if an error occurred gathering user info, we should react in some
596 users_password = value;
597 users_makedetails(users_selected,
602 DETAIL_EDITABLE|DETAIL_VISIBLE);
606 /** @brief Called when the selection MIGHT have changed */
607 static void users_selection_changed(GtkTreeSelection attribute((unused)) *treeselection,
608 gpointer attribute((unused)) user_data) {
610 char *gselected, *selected;
612 /* Identify the current selection */
613 if(gtk_tree_selection_get_selected(users_selection, 0, &iter)) {
614 gtk_tree_model_get(GTK_TREE_MODEL(users_list), &iter,
616 selected = xstrdup(gselected);
620 /* Eliminate no-change cases */
621 if(!selected && !users_selected)
623 if(selected && users_selected && !strcmp(selected, users_selected))
625 /* There's been a change; junk the old data and fetch new data in
627 users_selected = selected;
628 users_makedetails("", "", "", "",
632 disorder_eclient_userinfo(client, users_got_email, users_selected,
634 disorder_eclient_userinfo(client, users_got_rights, users_selected,
636 disorder_eclient_userinfo(client, users_got_password, users_selected,
639 mode(NONE); /* not editing *yet* */
642 static GtkWidget *users_make_reporter() {
643 if(!users_reporter) {
644 users_reporter = gtk_label_new("");
645 gtk_label_set_ellipsize(GTK_LABEL(users_reporter), PANGO_ELLIPSIZE_END);
646 gtk_misc_set_alignment(GTK_MISC(users_reporter), 0.99, 0);
647 g_signal_connect(users_reporter, "destroy",
648 G_CALLBACK(gtk_widget_destroyed), &users_reporter);
650 return users_reporter;
653 static void users_set_report(const char *msg) {
654 gtk_label_set_text(GTK_LABEL(users_make_reporter()), msg ? msg : "");
657 /** @brief Table of buttons below the user list */
658 static struct button users_buttons[] = {
672 #define NUSERS_BUTTONS (sizeof users_buttons / sizeof *users_buttons)
674 /** @brief Keypress handler */
675 static gboolean users_keypress(GtkWidget attribute((unused)) *widget,
677 gpointer attribute((unused)) user_data) {
680 switch(event->keyval) {
682 gtk_widget_destroy(users_window);
689 /** @brief Pop up the user management window */
690 void manage_users(void) {
691 GtkWidget *tree, *buttons, *hbox, *hbox2, *vbox, *vbox2;
693 GtkTreeViewColumn *col;
695 /* If the window already exists just raise it */
697 gtk_window_present(GTK_WINDOW(users_window));
700 /* Destroy old widgets */
702 gtk_widget_destroy(users_reporter);
703 /* Create the window */
704 users_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
705 gtk_widget_set_style(users_window, tool_style);
706 g_signal_connect(users_window, "destroy",
707 G_CALLBACK(gtk_widget_destroyed), &users_window);
708 gtk_window_set_title(GTK_WINDOW(users_window), "User Management");
709 /* Keyboard shortcuts */
710 g_signal_connect(users_window, "key-press-event",
711 G_CALLBACK(users_keypress), 0);
712 /* default size is too small */
713 gtk_window_set_default_size(GTK_WINDOW(users_window), 240, 240);
715 /* Create the list of users and populate it asynchronously */
716 users_list = gtk_list_store_new(1, G_TYPE_STRING);
717 disorder_eclient_users(client, users_got_list, 0);
718 /* Create the view */
719 tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(users_list));
720 /* ...and the renderers for it */
721 cr = gtk_cell_renderer_text_new();
722 col = gtk_tree_view_column_new_with_attributes("Username",
726 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), col);
727 /* Get the selection for the view; set its mode; arrange for a callback when
729 users_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
730 gtk_tree_selection_set_mode(users_selection, GTK_SELECTION_BROWSE);
731 g_signal_connect(users_selection, "changed",
732 G_CALLBACK(users_selection_changed), NULL);
734 /* Create the control buttons */
735 buttons = create_buttons_box(users_buttons,
737 gtk_hbox_new(FALSE, 1));
738 users_delete_button = users_buttons[1].widget;
740 /* Buttons live below the list */
741 vbox = gtk_vbox_new(FALSE, 0);
742 gtk_box_pack_start(GTK_BOX(vbox), scroll_widget(tree), TRUE/*expand*/, TRUE/*fill*/, 0);
743 gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE/*expand*/, FALSE, 0);
745 /* Create an empty user details table, and put an apply button below it */
746 users_apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
747 users_makedetails("", "", "", "",
750 g_signal_connect(users_apply_button, "clicked",
751 G_CALLBACK(users_apply), NULL);
752 hbox2 = gtk_hbox_new(FALSE, 0);
753 gtk_box_pack_end(GTK_BOX(hbox2), users_apply_button,
754 FALSE/*expand*/, FALSE, 0);
756 vbox2 = gtk_vbox_new(FALSE, 0);
757 gtk_box_pack_start(GTK_BOX(vbox2), users_details_table,
758 TRUE/*expand*/, TRUE/*fill*/, 0);
759 gtk_box_pack_start(GTK_BOX(vbox2), gtk_hseparator_new(),
760 FALSE/*expand*/, FALSE, 0);
761 gtk_box_pack_start(GTK_BOX(vbox2), users_make_reporter(),
762 FALSE/*expand*/, FALSE, 0);
763 gtk_box_pack_start(GTK_BOX(vbox2), hbox2,
764 FALSE/*expand*/, FALSE, 0);
766 /* User details are to the right of the list. We put in a pointless event
767 * box as as spacer, so that the longest label in the user details isn't
768 * cuddled up to the user list. */
769 hbox = gtk_hbox_new(FALSE, 0);
770 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE/*expand*/, FALSE, 0);
771 gtk_box_pack_start(GTK_BOX(hbox), gtk_event_box_new(), FALSE/*expand*/, FALSE, 2);
772 gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE/*expand*/, TRUE/*fill*/, 0);
773 gtk_container_add(GTK_CONTAINER(users_window), frame_widget(hbox, NULL));