Put a frame around user management window (and the other popups) and
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 20 Apr 2008 09:34:52 +0000 (10:34 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 20 Apr 2008 09:34:52 +0000 (10:34 +0100)
improve internal spacing a bit.

disobedience/disobedience.h
disobedience/login.c
disobedience/misc.c
disobedience/properties.c
disobedience/settings.c
disobedience/users.c

index 4885c8e..ccb9acc 100644 (file)
@@ -143,6 +143,8 @@ void properties_reset(void);
 GtkWidget *scroll_widget(GtkWidget *child);
 /* Wrap a widget up for scrolling */
 
+GtkWidget *frame_widget(GtkWidget *w, const char *title);
+
 GdkPixbuf *find_image(const char *name);
 /* Get the pixbuf for an image.  Returns a null pointer if it cannot be
  * found. */
index f5ef053..18afce4 100644 (file)
@@ -234,7 +234,7 @@ void login_box(void) {
                      TRUE/*expand*/, TRUE/*fill*/, 1/*padding*/);
   gtk_box_pack_start(GTK_BOX(vbox), buttonbox,
                      FALSE/*expand*/, FALSE/*fill*/, 1/*padding*/);
-  gtk_container_add(GTK_CONTAINER(login_window), vbox);
+  gtk_container_add(GTK_CONTAINER(login_window), frame_widget(vbox, NULL));
   gtk_window_set_transient_for(GTK_WINDOW(login_window),
                                GTK_WINDOW(toplevel));
   gtk_widget_show_all(login_window);
index ce58ab4..1e5ee22 100644 (file)
@@ -73,6 +73,24 @@ GtkWidget *scroll_widget(GtkWidget *child) {
   return scroller;
 }
 
+/** @brief Put a frame round a widget
+ * @param w Widget
+ * @param label Label or NULL
+ * @return Frame widget
+ */
+GtkWidget *frame_widget(GtkWidget *w, const char *label) {
+  GtkWidget *const frame = gtk_frame_new(label);
+  GtkWidget *const hbox = gtk_hbox_new(FALSE, 0);
+  GtkWidget *const vbox = gtk_vbox_new(FALSE, 0);
+  /* We want 4 pixels outside the frame boundary... */
+  gtk_container_set_border_width(GTK_CONTAINER(frame), 4);
+  /* ...and 4 pixels inside */
+  gtk_box_pack_start(GTK_BOX(hbox), w, TRUE/*expand*/, TRUE/*fill*/, 4);
+  gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE/*expand*/, TRUE/*fill*/, 4);
+  gtk_container_add(GTK_CONTAINER(frame), vbox);
+  return frame;
+}
+
 /** @brief Find an image
  * @param name Relative path to image
  * @return pixbuf containing image
index 24612c7..96d5c48 100644 (file)
@@ -271,7 +271,7 @@ void properties(int ntracks, const char **tracks) {
                      scroll_widget(properties_table),
                      TRUE, TRUE, 1);
   gtk_box_pack_start(GTK_BOX(vbox), buttonbox, FALSE, FALSE, 1);
-  gtk_container_add(GTK_CONTAINER(properties_window), vbox);
+  gtk_container_add(GTK_CONTAINER(properties_window), frame_widget(vbox, NULL));
   /* The table only really wants to be vertically scrollable */
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(GTK_WIDGET(properties_table)->parent->parent),
                                  GTK_POLICY_NEVER,
index ae8990e..3cc4180 100644 (file)
@@ -338,7 +338,7 @@ void popup_settings(void) {
                        1, 1);
     }
   }
-  gtk_container_add(GTK_CONTAINER(settings_window), table);
+  gtk_container_add(GTK_CONTAINER(settings_window), frame_widget(table, NULL));
   gtk_widget_show_all(settings_window);
   /* TODO: save settings
      TODO: web browser
index f4a0fbe..d162e14 100644 (file)
@@ -641,7 +641,7 @@ void manage_users(void) {
   users_delete_button = users_buttons[1].widget;
 
   /* Buttons live below the list */
-  vbox = gtk_vbox_new(FALSE, 2);
+  vbox = gtk_vbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), scroll_widget(tree), TRUE/*expand*/, TRUE/*fill*/, 0);
   gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE/*expand*/, FALSE, 0);
 
@@ -662,11 +662,14 @@ void manage_users(void) {
   gtk_box_pack_start(GTK_BOX(vbox2), hbox2,
                      FALSE/*expand*/, FALSE, 0);
   
-  /* User details are to the right of the list */
-  hbox = gtk_hbox_new(FALSE, 2);
-  gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE/*expand*/, FALSE, 2);
-  gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE/*expand*/, TRUE/*fill*/, 2);
-  gtk_container_add(GTK_CONTAINER(users_window), hbox);
+  /* User details are to the right of the list.  We put in a pointless event
+   * box as as spacer, so that the longest label in the user details isn't
+   * cuddled up to the user list. */
+  hbox = gtk_hbox_new(FALSE, 0);
+  gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE/*expand*/, FALSE, 0);
+  gtk_box_pack_start(GTK_BOX(hbox), gtk_event_box_new(), FALSE/*expand*/, FALSE, 2);
+  gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE/*expand*/, TRUE/*fill*/, 0);
+  gtk_container_add(GTK_CONTAINER(users_window), frame_widget(hbox, NULL));
 }
 
 /*