Set the HIG spacings directly instead of using style-set handlers. Fix the

2006-12-25  Christian Persch  <chpe@cvs.gnome.org>

	* gtk/gtkaboutdialog.c: (gtk_about_dialog_class_init),
	(gtk_about_dialog_init), (display_credits_dialog),
	(display_license_dialog):
	* gtk/gtkfilechooserdialog.c: (gtk_file_chooser_dialog_class_init),
	(gtk_file_chooser_dialog_init),
	(gtk_file_chooser_dialog_constructor),
	(gtk_file_chooser_dialog_unmap):
	* gtk/gtkrecentchooserdefault.c:
	(_gtk_recent_chooser_default_init):
	* gtk/gtkrecentchooserdialog.c:
	(gtk_recent_chooser_dialog_class_init),
	(gtk_recent_chooser_dialog_init),
	(gtk_recent_chooser_dialog_constructor),
	(gtk_recent_chooser_dialog_unmap): Set the HIG spacings directly
	instead of using style-set handlers. Fix the filechooser's spacing
	between content and action area to 12px. Bug #372447.
This commit is contained in:
Christian Persch 2006-12-25 12:21:16 +00:00 committed by Christian Persch
parent a20da20873
commit bcab1eb30b
5 changed files with 63 additions and 110 deletions

View File

@ -1,3 +1,22 @@
2006-12-25 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkaboutdialog.c: (gtk_about_dialog_class_init),
(gtk_about_dialog_init), (display_credits_dialog),
(display_license_dialog):
* gtk/gtkfilechooserdialog.c: (gtk_file_chooser_dialog_class_init),
(gtk_file_chooser_dialog_init),
(gtk_file_chooser_dialog_constructor),
(gtk_file_chooser_dialog_unmap):
* gtk/gtkrecentchooserdefault.c:
(_gtk_recent_chooser_default_init):
* gtk/gtkrecentchooserdialog.c:
(gtk_recent_chooser_dialog_class_init),
(gtk_recent_chooser_dialog_init),
(gtk_recent_chooser_dialog_constructor),
(gtk_recent_chooser_dialog_unmap): Set the HIG spacings directly
instead of using style-set handlers. Fix the filechooser's spacing
between content and action area to 12px. Bug #372447.
2006-12-25 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkstatusbar.c: (gtk_statusbar_size_allocate):

View File

@ -124,11 +124,6 @@ static void gtk_about_dialog_set_property (GObject
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_about_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style,
gpointer data);
static void update_name_version (GtkAboutDialog *about);
static GtkIconSet * icon_set_new_from_pixbufs (GList *pixbufs);
static void activate_url (GtkWidget *widget,
@ -187,8 +182,6 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
object_class->finalize = gtk_about_dialog_finalize;
widget_class->style_set = gtk_about_dialog_style_set;
/**
* GtkAboutDialog:name:
@ -428,6 +421,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
static void
gtk_about_dialog_init (GtkAboutDialog *about)
{
GtkDialog *dialog = GTK_DIALOG (about);
GtkAboutDialogPrivate *priv;
GtkWidget *vbox, *hbox, *button, *close_button, *image;
@ -452,13 +446,17 @@ gtk_about_dialog_init (GtkAboutDialog *about)
priv->hovering_over_link = FALSE;
priv->wrap_license = FALSE;
gtk_dialog_set_has_separator (GTK_DIALOG (about), FALSE);
gtk_dialog_set_has_separator (dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
/* Widgets */
gtk_widget_push_composite_child ();
vbox = gtk_vbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0);
vbox = gtk_vbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_box_pack_start (GTK_BOX (dialog->vbox), vbox, TRUE, TRUE, 0);
priv->logo_image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (vbox), priv->logo_image, FALSE, FALSE, 0);
@ -691,37 +689,6 @@ gtk_about_dialog_get_property (GObject *object,
}
}
static void
dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style,
gpointer data)
{
GtkDialog *dialog;
dialog = GTK_DIALOG (widget);
/* Override the style properties with HIG-compliant spacings. Ugh.
* http://developer.gnome.org/projects/gup/hig/1.0/layout.html#layout-dialogs
* http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-spacing
*/
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12);
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 12);
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 0);
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
}
static void
gtk_about_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
if (GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->style_set)
GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->style_set (widget, previous_style);
dialog_style_set (widget, previous_style, NULL);
}
/**
* gtk_about_dialog_get_name:
* @about: a #GtkAboutDialog
@ -1993,6 +1960,7 @@ display_credits_dialog (GtkWidget *button,
GtkAboutDialog *about = (GtkAboutDialog *)data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkWidget *dialog, *notebook;
GtkDialog *credits_dialog;
if (priv->credits_dialog != NULL)
{
@ -2005,11 +1973,15 @@ display_credits_dialog (GtkWidget *button,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
credits_dialog = GTK_DIALOG (dialog);
gtk_dialog_set_has_separator (credits_dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog), 5);
gtk_box_set_spacing (GTK_BOX (credits_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog->action_area), 5);
priv->credits_dialog = dialog;
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
gtk_dialog_set_default_response (credits_dialog, GTK_RESPONSE_CANCEL);
gtk_window_set_modal (GTK_WINDOW (dialog),
gtk_window_get_modal (GTK_WINDOW (about)));
@ -2019,10 +1991,9 @@ display_credits_dialog (GtkWidget *button,
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&(priv->credits_dialog));
g_signal_connect (dialog, "style_set",
G_CALLBACK (dialog_style_set), NULL);
notebook = gtk_notebook_new ();
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0);
if (priv->authors != NULL)
@ -2065,6 +2036,7 @@ display_license_dialog (GtkWidget *button,
GtkAboutDialog *about = (GtkAboutDialog *)data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkWidget *dialog, *view, *sw;
GtkDialog *licence_dialog;
if (priv->license_dialog != NULL)
{
@ -2077,10 +2049,15 @@ display_license_dialog (GtkWidget *button,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
licence_dialog = GTK_DIALOG (dialog);
gtk_dialog_set_has_separator (licence_dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog), 5);
gtk_box_set_spacing (GTK_BOX (licence_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog->action_area), 5);
priv->license_dialog = dialog;
gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 320);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
gtk_dialog_set_default_response (licence_dialog, GTK_RESPONSE_CANCEL);
gtk_window_set_modal (GTK_WINDOW (dialog),
gtk_window_get_modal (GTK_WINDOW (about)));
@ -2090,10 +2067,9 @@ display_license_dialog (GtkWidget *button,
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&(priv->license_dialog));
g_signal_connect (dialog, "style_set",
G_CALLBACK (dialog_style_set), NULL);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_set_border_width (GTK_CONTAINER (sw), 5);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),

View File

@ -49,8 +49,6 @@ static void gtk_file_chooser_dialog_get_property (GObject *obj
static void gtk_file_chooser_dialog_map (GtkWidget *widget);
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
static void gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void response_cb (GtkDialog *dialog,
gint response_id);
@ -72,7 +70,6 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class)
widget_class->map = gtk_file_chooser_dialog_map;
widget_class->unmap = gtk_file_chooser_dialog_unmap;
widget_class->style_set = gtk_file_chooser_dialog_style_set;
_gtk_file_chooser_install_properties (gobject_class);
@ -85,6 +82,8 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
GtkFileChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
GTK_TYPE_FILE_CHOOSER_DIALOG,
GtkFileChooserDialogPrivate);
GtkDialog *fc_dialog = GTK_DIALOG (dialog);
dialog->priv = priv;
dialog->priv->default_width = -1;
dialog->priv->default_height = -1;
@ -92,7 +91,10 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
dialog->priv->resize_vertically = TRUE;
dialog->priv->response_requested = FALSE;
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_dialog_set_has_separator (fc_dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5);
gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5);
/* We do a signal connection here rather than overriding the method in
* class_init because GtkDialog::response is a RUN_LAST signal. We want *our*
@ -380,6 +382,7 @@ gtk_file_chooser_dialog_constructor (GType type,
g_signal_connect (priv->widget, "response-requested",
G_CALLBACK (file_chooser_widget_response_requested), object);
gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
gtk_widget_show (priv->widget);
@ -508,29 +511,6 @@ gtk_file_chooser_dialog_unmap (GtkWidget *widget)
gtk_widget_unmap (priv->widget);
}
static void
gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
GtkDialog *dialog;
if (GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->style_set)
GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->style_set (widget, previous_style);
dialog = GTK_DIALOG (widget);
/* Override the style properties with HIG-compliant spacings. Ugh.
* http://developer.gnome.org/projects/gup/hig/1.0/layout.html#layout-dialogs
* http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-spacing
*/
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12);
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 24);
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 0);
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
}
/* GtkDialog::response handler */
static void
response_cb (GtkDialog *dialog,

View File

@ -327,7 +327,7 @@ _gtk_recent_chooser_default_class_init (GtkRecentChooserDefaultClass *klass)
static void
_gtk_recent_chooser_default_init (GtkRecentChooserDefault *impl)
{
gtk_box_set_spacing (GTK_BOX (impl), 12);
gtk_box_set_spacing (GTK_BOX (impl), 6);
/* by default, we use the global manager */
impl->local_manager = FALSE;

View File

@ -57,9 +57,6 @@ static void gtk_recent_chooser_dialog_get_property (GObject *object,
static void gtk_recent_chooser_dialog_map (GtkWidget *widget);
static void gtk_recent_chooser_dialog_unmap (GtkWidget *widget);
static void gtk_recent_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *old_style);
G_DEFINE_TYPE_WITH_CODE (GtkRecentChooserDialog,
gtk_recent_chooser_dialog,
@ -80,7 +77,6 @@ gtk_recent_chooser_dialog_class_init (GtkRecentChooserDialogClass *klass)
widget_class->map = gtk_recent_chooser_dialog_map;
widget_class->unmap = gtk_recent_chooser_dialog_unmap;
widget_class->style_set = gtk_recent_chooser_dialog_style_set;
_gtk_recent_chooser_install_properties (gobject_class);
@ -93,10 +89,15 @@ gtk_recent_chooser_dialog_init (GtkRecentChooserDialog *dialog)
GtkRecentChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
GTK_TYPE_RECENT_CHOOSER_DIALOG,
GtkRecentChooserDialogPrivate);
GtkDialog *rc_dialog = GTK_DIALOG (dialog);
dialog->priv = priv;
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_dialog_set_has_separator (rc_dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (rc_dialog), 5);
gtk_box_set_spacing (GTK_BOX (rc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (rc_dialog->action_area), 5);
}
/* we intercept the GtkRecentChooser::item_activated signal and try to
@ -165,7 +166,8 @@ gtk_recent_chooser_dialog_constructor (GType type,
g_signal_connect (priv->chooser, "item_activated",
G_CALLBACK (gtk_recent_chooser_item_activated_cb),
object);
gtk_container_set_border_width (GTK_CONTAINER (priv->chooser), 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox),
priv->chooser, TRUE, TRUE, 0);
gtk_widget_show (priv->chooser);
@ -245,30 +247,6 @@ gtk_recent_chooser_dialog_unmap (GtkWidget *widget)
gtk_widget_unmap (priv->chooser);
}
/* taken from gtkfilechooserdialog.c */
static void
gtk_recent_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *old_style)
{
GtkDialog *dialog;
dialog = GTK_DIALOG (widget);
/* Override the style properties with HIG-compliant spacings. Ugh.
* http://developer.gnome.org/projects/gup/hig/1.0/layout.html#layout-dialogs
* http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-spacing
*/
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12);
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 24);
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 0);
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
if (GTK_WIDGET_CLASS (gtk_recent_chooser_dialog_parent_class)->style_set)
GTK_WIDGET_CLASS (gtk_recent_chooser_dialog_parent_class)->style_set (widget, old_style);
}
static GtkWidget *
gtk_recent_chooser_dialog_new_valist (const gchar *title,
GtkWindow *parent,