mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
Bug 408244 – add GtkDialog::content-area-spacing
* gtk/gtkbox.c (gtk_box_init), (gtk_box_set_spacing), (_gtk_box_set_spacing_set), (_gtk_box_get_spacing_set): * gtk/gtkbox.h: * gtk/gtkdialog.c (gtk_dialog_class_init), (update_spacings): Implement "content-area-spacing" style property in GtkDialog and internal helper _gtk_box_get_spacing_set in GtkBox. Patch by Tim Janik, Sven Herzberg and myself. svn path=/trunk/; revision=21508
This commit is contained in:
parent
0c5bfe5f2b
commit
3a872a3c42
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2008-09-24 Christian Dywan <christian@imendio.com>
|
||||||
|
|
||||||
|
Bug 408244 – add GtkDialog::content-area-spacing
|
||||||
|
|
||||||
|
* gtk/gtkbox.c (gtk_box_init), (gtk_box_set_spacing),
|
||||||
|
(_gtk_box_set_spacing_set), (_gtk_box_get_spacing_set):
|
||||||
|
* gtk/gtkbox.h:
|
||||||
|
* gtk/gtkdialog.c (gtk_dialog_class_init), (update_spacings):
|
||||||
|
Implement "content-area-spacing" style property in GtkDialog
|
||||||
|
and internal helper _gtk_box_get_spacing_set in GtkBox.
|
||||||
|
Patch by Tim Janik, Sven Herzberg and myself.
|
||||||
|
|
||||||
2008-09-24 Christian Dywan <christian@imendio.com>
|
2008-09-24 Christian Dywan <christian@imendio.com>
|
||||||
|
|
||||||
Bug 541391 – Unfocussable Treeview swallows focus
|
Bug 541391 – Unfocussable Treeview swallows focus
|
||||||
|
23
gtk/gtkbox.c
23
gtk/gtkbox.c
@ -101,7 +101,7 @@ gtk_box_class_init (GtkBoxClass *class)
|
|||||||
G_MAXINT,
|
G_MAXINT,
|
||||||
0,
|
0,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_HOMOGENEOUS,
|
PROP_HOMOGENEOUS,
|
||||||
g_param_spec_boolean ("homogeneous",
|
g_param_spec_boolean ("homogeneous",
|
||||||
@ -155,6 +155,7 @@ gtk_box_init (GtkBox *box)
|
|||||||
|
|
||||||
box->children = NULL;
|
box->children = NULL;
|
||||||
box->spacing = 0;
|
box->spacing = 0;
|
||||||
|
box->spacing_set = FALSE;
|
||||||
box->homogeneous = FALSE;
|
box->homogeneous = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,7 +532,10 @@ gtk_box_set_spacing (GtkBox *box,
|
|||||||
if (spacing != box->spacing)
|
if (spacing != box->spacing)
|
||||||
{
|
{
|
||||||
box->spacing = spacing;
|
box->spacing = spacing;
|
||||||
|
box->spacing_set = TRUE;
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (box), "spacing");
|
g_object_notify (G_OBJECT (box), "spacing");
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (box));
|
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -552,6 +556,23 @@ gtk_box_get_spacing (GtkBox *box)
|
|||||||
return box->spacing;
|
return box->spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gtk_box_set_spacing_set (GtkBox *box,
|
||||||
|
gboolean spacing_set)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
|
|
||||||
|
box->spacing_set = spacing_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_gtk_box_get_spacing_set (GtkBox *box)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_BOX (box), FALSE);
|
||||||
|
|
||||||
|
return box->spacing_set;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_box_reorder_child:
|
* gtk_box_reorder_child:
|
||||||
* @box: a #GtkBox
|
* @box: a #GtkBox
|
||||||
|
@ -59,6 +59,7 @@ struct _GtkBox
|
|||||||
GList *GSEAL (children);
|
GList *GSEAL (children);
|
||||||
gint16 GSEAL (spacing);
|
gint16 GSEAL (spacing);
|
||||||
guint GSEAL (homogeneous) : 1;
|
guint GSEAL (homogeneous) : 1;
|
||||||
|
guint GSEAL (spacing_set) : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkBoxClass
|
struct _GtkBoxClass
|
||||||
@ -115,6 +116,9 @@ void gtk_box_set_child_packing (GtkBox *box,
|
|||||||
gboolean fill,
|
gboolean fill,
|
||||||
guint padding,
|
guint padding,
|
||||||
GtkPackType pack_type);
|
GtkPackType pack_type);
|
||||||
|
gboolean _gtk_box_get_spacing_set (GtkBox* box);
|
||||||
|
void _gtk_box_set_spacing_set (GtkBox *box,
|
||||||
|
gboolean spacing_set);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -194,6 +194,24 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
|||||||
G_MAXINT,
|
G_MAXINT,
|
||||||
2,
|
2,
|
||||||
GTK_PARAM_READABLE));
|
GTK_PARAM_READABLE));
|
||||||
|
/**
|
||||||
|
* GtkDialog:content-area-spacing:
|
||||||
|
*
|
||||||
|
* The default spacing used between elements of the
|
||||||
|
* content area of the dialog, as returned by
|
||||||
|
* gtk_dialog_get_content_area(), unless gtk_box_set_spacing()
|
||||||
|
* was called on that widget directly.
|
||||||
|
*
|
||||||
|
* Since: 2.16
|
||||||
|
*/
|
||||||
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
|
g_param_spec_int ("content-area-spacing",
|
||||||
|
P_("Content area spacing"),
|
||||||
|
P_("Spacing between elements of the main dialog area"),
|
||||||
|
0,
|
||||||
|
G_MAXINT,
|
||||||
|
0,
|
||||||
|
GTK_PARAM_READABLE));
|
||||||
gtk_widget_class_install_style_property (widget_class,
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
g_param_spec_int ("button-spacing",
|
g_param_spec_int ("button-spacing",
|
||||||
P_("Button spacing"),
|
P_("Button spacing"),
|
||||||
@ -220,21 +238,25 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
|||||||
static void
|
static void
|
||||||
update_spacings (GtkDialog *dialog)
|
update_spacings (GtkDialog *dialog)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
|
||||||
gint content_area_border;
|
gint content_area_border;
|
||||||
|
gint content_area_spacing;
|
||||||
gint button_spacing;
|
gint button_spacing;
|
||||||
gint action_area_border;
|
gint action_area_border;
|
||||||
|
|
||||||
widget = GTK_WIDGET (dialog);
|
|
||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (GTK_WIDGET (dialog),
|
||||||
"content-area-border", &content_area_border,
|
"content-area-border", &content_area_border,
|
||||||
|
"content-area-spacing", &content_area_spacing,
|
||||||
"button-spacing", &button_spacing,
|
"button-spacing", &button_spacing,
|
||||||
"action-area-border", &action_area_border,
|
"action-area-border", &action_area_border,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox),
|
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox),
|
||||||
content_area_border);
|
content_area_border);
|
||||||
|
if (!_gtk_box_get_spacing_set (GTK_BOX (dialog->vbox)))
|
||||||
|
{
|
||||||
|
gtk_box_set_spacing (GTK_BOX (dialog->vbox), content_area_spacing);
|
||||||
|
_gtk_box_set_spacing_set (GTK_BOX (dialog->vbox), FALSE);
|
||||||
|
}
|
||||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area),
|
gtk_box_set_spacing (GTK_BOX (dialog->action_area),
|
||||||
button_spacing);
|
button_spacing);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area),
|
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area),
|
||||||
|
Loading…
Reference in New Issue
Block a user