added a GtkSizeGroup member and put all labels into the group.

2005-11-02  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsizebox.[ch]: added a GtkSizeGroup member and put
	all labels into the group.

	* app/dialogs/scale-dialog.c: put the "Interpolation:" label into
	the same size box.
This commit is contained in:
Michael Natterer 2005-11-02 09:27:15 +00:00 committed by Michael Natterer
parent 9c94f603db
commit 67ee237bd8
4 changed files with 49 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2005-11-02 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpsizebox.[ch]: added a GtkSizeGroup member and put
all labels into the group.
* app/dialogs/scale-dialog.c: put the "Interpolation:" label into
the same size box.
2005-11-02 Michael Natterer <mitch@gimp.org>
* libgimp/gimpprocbrowserdialog.c (browser_search): added comment

View File

@ -185,6 +185,8 @@ scale_dialog_new (GimpViewable *viewable,
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_size_group_add_widget (GIMP_SIZE_BOX (private->box)->size_group, label);
private->combo = gimp_enum_combo_box_new (GIMP_TYPE_INTERPOLATION_TYPE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), private->combo);
gtk_box_pack_start (GTK_BOX (hbox), private->combo, TRUE, TRUE, 0);

View File

@ -82,6 +82,8 @@ static void gimp_size_box_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gimp_size_box_destroy (GtkObject *object);
static void gimp_size_box_update_size (GimpSizeBox *box);
static void gimp_size_box_update_resolution (GimpSizeBox *box);
@ -120,7 +122,8 @@ gimp_size_box_get_type (void)
static void
gimp_size_box_class_init (GimpSizeBoxClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -128,6 +131,8 @@ gimp_size_box_class_init (GimpSizeBoxClass *klass)
object_class->set_property = gimp_size_box_set_property;
object_class->get_property = gimp_size_box_get_property;
gtk_object_class->destroy = gimp_size_box_destroy;
g_type_class_add_private (object_class, sizeof (GimpSizeBoxPrivate));
g_object_class_install_property (object_class, PROP_WIDTH,
@ -190,6 +195,8 @@ static void
gimp_size_box_init (GimpSizeBox *box)
{
gtk_box_set_spacing (GTK_BOX (box), 6);
box->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
}
static GObject *
@ -199,11 +206,13 @@ gimp_size_box_constructor (GType type,
{
GObject *object;
GimpSizeBox *box;
GimpSizeBoxPrivate *priv;
GtkWidget *vbox;
GtkWidget *entry;
GtkWidget *hbox;
GtkWidget *label;
GimpSizeBoxPrivate *priv;
GList *children;
GList *list;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
@ -247,6 +256,12 @@ gimp_size_box_constructor (GType type,
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_widget_show (entry);
children = gtk_container_get_children (GTK_CONTAINER (entry));
for (list = children; list; list = g_list_next (list))
if (GTK_IS_LABEL (list->data))
gtk_size_group_add_widget (box->size_group, list->data);
g_list_free (children);
vbox = gtk_vbox_new (2, FALSE);
gtk_table_attach_defaults (GTK_TABLE (entry), vbox, 1, 3, 2, 3);
gtk_widget_show (vbox);
@ -282,6 +297,12 @@ gimp_size_box_constructor (GType type,
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_widget_show (entry);
children = gtk_container_get_children (GTK_CONTAINER (entry));
for (list = children; list; list = g_list_next (list))
if (GTK_IS_LABEL (list->data))
gtk_size_group_add_widget (box->size_group, list->data);
g_list_free (children);
gimp_prop_coordinates_connect (G_OBJECT (box),
"xresolution", "yresolution",
"resolution-unit",
@ -418,6 +439,20 @@ gimp_size_box_get_property (GObject *object,
}
}
static void
gimp_size_box_destroy (GtkObject *object)
{
GimpSizeBox *box = GIMP_SIZE_BOX (object);
if (box->size_group)
{
g_object_unref (box->size_group);
box->size_group = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_size_box_update_size (GimpSizeBox *box)
{

View File

@ -39,6 +39,8 @@ struct _GimpSizeBox
{
GtkVBox parent_instance;
GtkSizeGroup *size_group;
gint width;
gint height;
GimpUnit unit;