improve internal spacing a bit.
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. */
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);
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
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,
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
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);
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));
}
/*