diff options
author | Tristan Van Berkom <tvb@src.gnome.org> | 2008-12-11 07:01:29 +0000 |
---|---|---|
committer | Tristan Van Berkom <tvb@src.gnome.org> | 2008-12-11 07:01:29 +0000 |
commit | aa044addc8f3288e3511f145c649b82b8e142a2e (patch) | |
tree | 9d73ad70b17f108348aae03cef1079464ecd0078 | |
parent | cf4628150cd31307674e42b0cda00a25b47d49dc (diff) | |
download | glade-aa044addc8f3288e3511f145c649b82b8e142a2e.tar.gz |
Relicensed LGPL.
* gladeui/glade-name-context.[ch], gladeui/glade-editable.[ch]: Relicensed LGPL.
* plugins/gtk+/glade-image-editor.c, plugins/gtk+/glade-image-item-editor.c,
plugins/gtk+/glade-button-editor.c, plugins/gtk+/glade-label-editor.c,
plugins/gtk+/glade-cell-renderer-editor.c, plugins/gtk+/glade-tool-button-editor.c,
gladeui/glade-editor-table.c, gladeui/glade-base-editor.c:
Now editable portions of properties dont expand in tables, leaving more freedom
for labels to expand in tight spots, no more item_labels in radio buttons (they dont expand).
* gladeui/glade-widget-adaptor.c: Fixed regression, now disabled classes are not
reinstalled in subclasses.
svn path=/trunk/; revision=2065
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | gladeui/glade-base-editor.c | 10 | ||||
-rw-r--r-- | gladeui/glade-editable.c | 22 | ||||
-rw-r--r-- | gladeui/glade-editor-table.c | 12 | ||||
-rw-r--r-- | gladeui/glade-editor-table.h | 2 | ||||
-rw-r--r-- | gladeui/glade-name-context.c | 26 | ||||
-rw-r--r-- | gladeui/glade-project.c | 16 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.c | 44 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.h | 4 | ||||
-rw-r--r-- | gladeui/glade-xml-utils.c | 4 | ||||
-rw-r--r-- | gladeui/glade-xml-utils.h | 2 | ||||
-rw-r--r-- | plugins/gtk+/glade-button-editor.c | 40 | ||||
-rw-r--r-- | plugins/gtk+/glade-cell-renderer-editor.c | 54 | ||||
-rw-r--r-- | plugins/gtk+/glade-image-editor.c | 50 | ||||
-rw-r--r-- | plugins/gtk+/glade-image-item-editor.c | 37 | ||||
-rw-r--r-- | plugins/gtk+/glade-label-editor.c | 100 | ||||
-rw-r--r-- | plugins/gtk+/glade-label-editor.h | 4 | ||||
-rw-r--r-- | plugins/gtk+/glade-tool-button-editor.c | 71 |
18 files changed, 352 insertions, 160 deletions
@@ -1,3 +1,17 @@ +2008-12-10 Tristan Van Berkom <tvb@gnome.org> + + * gladeui/glade-name-context.[ch], gladeui/glade-editable.[ch]: Relicensed LGPL. + + * plugins/gtk+/glade-image-editor.c, plugins/gtk+/glade-image-item-editor.c, + plugins/gtk+/glade-button-editor.c, plugins/gtk+/glade-label-editor.c, + plugins/gtk+/glade-cell-renderer-editor.c, plugins/gtk+/glade-tool-button-editor.c, + gladeui/glade-editor-table.c, gladeui/glade-base-editor.c: + Now editable portions of properties dont expand in tables, leaving more freedom + for labels to expand in tight spots, no more item_labels in radio buttons (they dont expand). + + * gladeui/glade-widget-adaptor.c: Fixed regression, now disabled classes are not + reinstalled in subclasses. + 2008-12-09 Tristan Van Berkom <tvb@gnome.org> * NEWS, configure.ac: Rolling 3.5.3 diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c index f40e2448..20238368 100644 --- a/gladeui/glade-base-editor.c +++ b/gladeui/glade-base-editor.c @@ -67,6 +67,7 @@ struct _GladeBaseEditorPrivate GladeWidget *gcontainer; /* The container we are editing */ /* Editor UI */ + GtkSizeGroup *group; GtkWidget *paned, *table, *treeview, *main_scroll, *notebook; GtkWidget *remove_button, *signal_editor_w; GladeSignalEditor *signal_editor; @@ -356,8 +357,11 @@ glade_base_editor_table_attach (GladeBaseEditor *e, if (child2) { gtk_table_attach (table, child2, 1, 2, row, row + 1, - GTK_EXPAND | GTK_FILL, GTK_FILL, 2, 0); + 0, GTK_FILL, 2, 0); gtk_widget_show (child2); + + + gtk_size_group_add_widget (e->priv->group, child2); } e->priv->row++; @@ -1230,6 +1234,8 @@ glade_base_editor_finalize (GObject *object) /* Free private members, etc. */ glade_base_editor_project_disconnect (cobj); + + g_object_unref (cobj->priv->group); g_free (cobj->priv); G_OBJECT_CLASS(parent_class)->finalize(object); @@ -1635,6 +1641,8 @@ glade_base_editor_init (GladeBaseEditor *editor) gtk_box_set_spacing (GTK_BOX (editor), 8); e = editor->priv = g_new0(GladeBaseEditorPrivate, 1); + + e->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /* Paned */ e->paned = paned = gtk_vpaned_new (); diff --git a/gladeui/glade-editable.c b/gladeui/glade-editable.c index a252ca4c..fbdf6fb0 100644 --- a/gladeui/glade-editable.c +++ b/gladeui/glade-editable.c @@ -1,24 +1,24 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * glade-name-context.c + * glade-editable.c * * Copyright (C) 2008 Tristan Van Berkom. * * Authors: * Tristan Van Berkom <tvb@gnome.org> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/gladeui/glade-editor-table.c b/gladeui/glade-editor-table.c index 2d84be7f..96932d05 100644 --- a/gladeui/glade-editor-table.c +++ b/gladeui/glade-editor-table.c @@ -51,7 +51,7 @@ glade_editor_table_class_init (GladeEditorTableClass *klass) static void glade_editor_table_init (GladeEditorTable *self) { - + self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); } static void @@ -69,6 +69,10 @@ glade_editor_table_dispose (GObject *object) glade_editable_load (GLADE_EDITABLE (table), NULL); + if (table->group) + g_object_unref (table->group); + table->group = NULL; + G_OBJECT_CLASS (glade_editor_table_parent_class)->dispose (object); } @@ -219,9 +223,13 @@ glade_editor_table_attach (GladeEditorTable *table, { gtk_table_attach (GTK_TABLE (table), child, pos, pos+1, row, row +1, - GTK_EXPAND | GTK_FILL, + pos ? 0 : GTK_EXPAND | GTK_FILL, 0, 3, 1); + + if (pos) + gtk_size_group_add_widget (table->group, child); + } static gint diff --git a/gladeui/glade-editor-table.h b/gladeui/glade-editor-table.h index bae603e7..1f08d30b 100644 --- a/gladeui/glade-editor-table.h +++ b/gladeui/glade-editor-table.h @@ -48,6 +48,8 @@ struct _GladeEditorTable GladeWidget *loaded_widget; /* A pointer to the currently loaded GladeWidget */ + + GtkSizeGroup *group; /* Group of editing widgets in the right hand column */ GtkWidget *name_label; /* A pointer to the "Name:" label (for show/hide) */ GtkWidget *name_entry; /* A pointer to the gtk_entry that holds diff --git a/gladeui/glade-name-context.c b/gladeui/glade-name-context.c index d4b52918..42b1cc80 100644 --- a/gladeui/glade-name-context.c +++ b/gladeui/glade-name-context.c @@ -4,23 +4,23 @@ * * Copyright (C) 2008 Tristan Van Berkom. * - * Authors: - * Tristan Van Berkom <tvb@gnome.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + * Authors: + * Tristan Van Berkom <tvb@gnome.org> + * */ #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c index bf8faa0a..f7def8e2 100644 --- a/gladeui/glade-project.c +++ b/gladeui/glade-project.c @@ -167,8 +167,8 @@ typedef struct { static void glade_project_set_target_version (GladeProject *project, const gchar *catalog, - gint major, - gint minor); + guint16 major, + guint16 minor); static void glade_project_get_target_version (GladeProject *project, const gchar *catalog, gint *major, @@ -912,10 +912,10 @@ glade_project_fix_object_props (GladeProject *project) static gchar * glade_project_read_requires_from_comment (GladeXmlNode *comment, - gint *major, - gint *minor) + guint16 *major, + guint16 *minor) { - gint maj, min; + gint maj, min; gchar *value, buffer[256]; gchar *required_lib = NULL; @@ -949,7 +949,7 @@ glade_project_read_requires (GladeProject *project, GladeXmlNode *node; gchar *required_lib = NULL; gboolean loadable = TRUE; - gint major, minor; + guint16 major, minor; for (node = glade_xml_node_get_children_with_comments (root_node); node; node = glade_xml_node_next_with_comments (node)) @@ -2654,8 +2654,8 @@ glade_project_get_target_version (GladeProject *project, static void glade_project_set_target_version (GladeProject *project, const gchar *catalog, - gint major, - gint minor) + guint16 major, + guint16 minor) { GladeTargetableVersion *version; GSList *radios, *list; diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c index a6d93b0f..a51f7343 100644 --- a/gladeui/glade-widget-adaptor.c +++ b/gladeui/glade-widget-adaptor.c @@ -415,16 +415,40 @@ gwa_setup_introspected_props_from_pspecs (GladeWidgetAdaptor *adaptor, for (i = 0; i < n_specs; i++) { - if (parent_adaptor == NULL || - (!is_packing && !glade_widget_adaptor_get_property_class (parent_adaptor, - specs[i]->name)) || - (is_packing && !glade_widget_adaptor_get_pack_property_class (parent_adaptor, - specs[i]->name))) - { - if ((property_class = - glade_property_class_new_from_spec (adaptor, specs[i])) != NULL) - list = g_list_prepend (list, property_class); - } + GType class_type; + gboolean found; + + /* Only create properties that dont exist on the adaptor yet */ + for (found = FALSE, class_type = adaptor->type; + ((!parent_adaptor && class_type != 0) || + ( parent_adaptor && class_type != parent_adaptor->type)); + class_type = g_type_parent (class_type)) + if (specs[i]->owner_type == class_type || + (G_TYPE_IS_INTERFACE (specs[i]->owner_type) && + glade_util_class_implements_interface (class_type, specs[i]->owner_type))) + { + found = TRUE; + break; + } + + if (found && + (property_class = + glade_property_class_new_from_spec (adaptor, specs[i])) != NULL) + list = g_list_prepend (list, property_class); + + + +/* if (parent_adaptor == NULL || */ +/* /\* Dont create it if the pspec owner is not us. *\/ */ +/* (!is_packing && !glade_widget_adaptor_get_property_class (parent_adaptor, */ +/* specs[i]->name)) || */ +/* (is_packing && !glade_widget_adaptor_get_pack_property_class (parent_adaptor, */ +/* specs[i]->name))) */ +/* { */ +/* if ((property_class = */ +/* glade_property_class_new_from_spec (adaptor, specs[i])) != NULL) */ +/* list = g_list_prepend (list, property_class); */ +/* } */ } if (is_packing) diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h index ac184d4e..bfe5ba28 100644 --- a/gladeui/glade-widget-adaptor.h +++ b/gladeui/glade-widget-adaptor.h @@ -544,10 +544,10 @@ struct _GladeSignalClass GSignalQuery query; - gint version_since_major; /* Version in which this signal was + guint16 version_since_major; /* Version in which this signal was * introduced */ - gint version_since_minor; + guint16 version_since_minor; const gchar *name; /* Name of the signal, eg clicked */ gchar *type; /* Name of the object class that this signal belongs to diff --git a/gladeui/glade-xml-utils.c b/gladeui/glade-xml-utils.c index 699887ab..e61e0083 100644 --- a/gladeui/glade-xml-utils.c +++ b/gladeui/glade-xml-utils.c @@ -488,8 +488,8 @@ glade_xml_get_property_string_required (GladeXmlNode *node_in, gboolean glade_xml_get_property_version (GladeXmlNode *node_in, const gchar *name, - gint *major, - gint *minor) + guint16 *major, + guint16 *minor) { xmlNodePtr node = (xmlNodePtr) node_in; gchar *value = glade_xml_get_property_string (node_in, name); diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h index e7322d70..f43cef06 100644 --- a/gladeui/glade-xml-utils.h +++ b/gladeui/glade-xml-utils.h @@ -240,7 +240,7 @@ gchar * glade_xml_get_property_string (GladeXmlNode *node_in, const gchar *name gboolean glade_xml_get_property_boolean (GladeXmlNode *node_in, const gchar *name, gboolean _default); gdouble glade_xml_get_property_double (GladeXmlNode *node_in, const gchar *name, gdouble _default); gint glade_xml_get_property_int (GladeXmlNode *node_in, const gchar *name, gint _default); -gboolean glade_xml_get_property_version (GladeXmlNode *node_in, const gchar *name, gint *major, gint *minor); +gboolean glade_xml_get_property_version (GladeXmlNode *node_in, const gchar *name, guint16 *major, guint16 *minor); GList *glade_xml_get_property_targetable_versions (GladeXmlNode *node_in, const gchar *name); diff --git a/plugins/gtk+/glade-button-editor.c b/plugins/gtk+/glade-button-editor.c index 1350fbeb..53560a17 100644 --- a/plugins/gtk+/glade-button-editor.c +++ b/plugins/gtk+/glade-button-editor.c @@ -383,16 +383,21 @@ label_toggled (GtkWidget *widget, button_editor->loaded_widget); } + static void table_attach (GtkWidget *table, GtkWidget *child, - gint pos, gint row) + gint pos, gint row, + GtkSizeGroup *group) { gtk_table_attach (GTK_TABLE (table), child, pos, pos+1, row, row +1, - GTK_EXPAND | GTK_FILL, + pos ? 0 : GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 3, 1); + + if (pos) + gtk_size_group_add_widget (group, child); } @@ -403,6 +408,7 @@ glade_button_editor_new (GladeWidgetAdaptor *adaptor, GladeButtonEditor *button_editor; GladeEditorProperty *eprop; GtkWidget *vbox, *table, *frame; + GtkSizeGroup *group; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); g_return_val_if_fail (GLADE_IS_EDITABLE (embed), NULL); @@ -454,18 +460,21 @@ glade_button_editor_new (GladeWidgetAdaptor *adaptor, gtk_container_add (GTK_CONTAINER (frame), button_editor->stock_frame); table = gtk_table_new (0, 0, FALSE); + group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_container_add (GTK_CONTAINER (button_editor->stock_frame), table); eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "stock", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + table_attach (table, eprop->item_label, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "image-position", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + table_attach (table, eprop->item_label, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); + g_object_unref (group); + /* Populate label frame here... */ frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); @@ -477,28 +486,31 @@ glade_button_editor_new (GladeWidgetAdaptor *adaptor, gtk_container_add (GTK_CONTAINER (frame), button_editor->label_frame); table = gtk_table_new (0, 0, FALSE); + group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_container_add (GTK_CONTAINER (button_editor->label_frame), table); eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + table_attach (table, eprop->item_label, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "use-underline", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + table_attach (table, eprop->item_label, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "image", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 2); - table_attach (table, GTK_WIDGET (eprop), 1, 2); + table_attach (table, eprop->item_label, 0, 2, group); + table_attach (table, GTK_WIDGET (eprop), 1, 2, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "image-position", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 3); - table_attach (table, GTK_WIDGET (eprop), 1, 3); + table_attach (table, eprop->item_label, 0, 3, group); + table_attach (table, GTK_WIDGET (eprop), 1, 3, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); + g_object_unref (group); + /* Custom radio button on the bottom */ gtk_box_pack_start (GTK_BOX (button_editor), button_editor->custom_radio, FALSE, FALSE, 0); diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c index beb76d41..e755b99e 100644 --- a/plugins/gtk+/glade-cell-renderer-editor.c +++ b/plugins/gtk+/glade-cell-renderer-editor.c @@ -217,7 +217,7 @@ table_attach (GtkWidget *table, { gtk_table_attach (GTK_TABLE (table), child, pos, pos+1, row, row +1, - pos ? GTK_FILL : GTK_EXPAND | GTK_FILL, + pos ? 0 : GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 3, 1); } @@ -373,7 +373,6 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor *adaptor, GladePropertyClass *pclass, *attr_pclass, *use_attr_pclass; GList *list, *sorted; GtkWidget *label, *alignment, *table, *hbox, *separator; - GtkSizeGroup *input_group; gchar *str; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); @@ -385,8 +384,6 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor *adaptor, /* Pack the parent on top... */ gtk_box_pack_start (GTK_BOX (renderer_editor), GTK_WIDGET (embed), FALSE, FALSE, 0); - input_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - sorted = get_sorted_properties (adaptor, type); /* For each normal property, if we have an attr- and use-attr- counterpart, load @@ -461,7 +458,6 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor *adaptor, table_attach (table, eprop->item_label, 0, rows); table_attach (table, GTK_WIDGET (eprop), 1, rows++); renderer_editor->properties = g_list_prepend (renderer_editor->properties, eprop); - gtk_size_group_add_widget (input_group, GTK_WIDGET (eprop)); tab->use_prop_label = eprop->item_label; tab->use_prop_eprop = GTK_WIDGET (eprop); @@ -471,7 +467,6 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor *adaptor, table_attach (table, eprop->item_label, 0, rows); table_attach (table, GTK_WIDGET (eprop), 1, rows++); renderer_editor->properties = g_list_prepend (renderer_editor->properties, eprop); - gtk_size_group_add_widget (input_group, GTK_WIDGET (eprop)); tab->use_attr_label = eprop->item_label; tab->use_attr_eprop = GTK_WIDGET (eprop); @@ -593,7 +588,7 @@ glade_eprop_cell_attribute_load (GladeEditorProperty *eprop, for (l = columns; l; l = l->next) { GladeColumnType *column = l->data; - gchar *str = g_strdup_printf ("%s (%s)", column->column_name, + gchar *str = g_strdup_printf ("%s - %s", column->column_name, g_type_name (column->type)); gtk_list_store_append (store, &iter); @@ -650,6 +645,37 @@ spin_changed (GtkWidget *spin, g_value_unset (&val); } +static void +combo_popup_down (GtkWidget *combo, + GParamSpec *spec, + GtkCellRenderer *cell) +{ + gboolean popup_shown = FALSE; + + g_object_get (G_OBJECT (combo), "popup-shown", &popup_shown, NULL); + + g_object_ref (cell); + + gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo)); + + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, + "text", 0, NULL); + + g_object_unref (cell); + + if (popup_shown) + g_object_set (cell, + "ellipsize", PANGO_ELLIPSIZE_NONE, + "width", -1, + NULL); + else + g_object_set (cell, + "ellipsize", PANGO_ELLIPSIZE_END, + "width", 60, + NULL); +} + static GtkWidget * glade_eprop_cell_attribute_create_input (GladeEditorProperty *eprop) { @@ -668,12 +694,24 @@ glade_eprop_cell_attribute_create_input (GladeEditorProperty *eprop) /* Add cell renderer */ cell = gtk_cell_renderer_text_new (); + g_object_set (cell, + "xpad", 0, + "xalign", 0.0F, + "ellipsize", PANGO_ELLIPSIZE_END, + "width", 60, + NULL); + + gtk_cell_layout_clear (GTK_CELL_LAYOUT (eprop_attribute->combo)); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (eprop_attribute->combo), cell, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (eprop_attribute->combo), cell, "text", 0, NULL); + g_signal_connect (G_OBJECT (eprop_attribute->combo), "notify::popup-shown", + G_CALLBACK (combo_popup_down), cell); + gtk_box_pack_start (GTK_BOX (hbox), eprop_attribute->spin, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), eprop_attribute->combo, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), eprop_attribute->combo, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (eprop_attribute->combo), "changed", G_CALLBACK (combo_changed), eprop); diff --git a/plugins/gtk+/glade-image-editor.c b/plugins/gtk+/glade-image-editor.c index 309364fe..75f3a053 100644 --- a/plugins/gtk+/glade-image-editor.c +++ b/plugins/gtk+/glade-image-editor.c @@ -189,13 +189,17 @@ glade_image_editor_grab_focus (GtkWidget *widget) static void table_attach (GtkWidget *table, GtkWidget *child, - gint pos, gint row) + gint pos, gint row, + GtkSizeGroup *group) { gtk_table_attach (GTK_TABLE (table), child, pos, pos+1, row, row +1, - GTK_EXPAND | GTK_FILL, + pos ? 0 : GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 3, 1); + + if (pos) + gtk_size_group_add_widget (group, child); } static void @@ -324,7 +328,8 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor, { GladeImageEditor *image_editor; GladeEditorProperty *eprop; - GtkWidget *table, *frame, *alignment, *label; + GtkWidget *table, *frame, *alignment, *label, *hbox; + GtkSizeGroup *group; gchar *str; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); @@ -353,32 +358,42 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor, table = gtk_table_new (0, 0, FALSE); gtk_container_add (GTK_CONTAINER (alignment), table); + group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /* Stock image... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "stock", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); image_editor->stock_radio = gtk_radio_button_new (NULL); - gtk_container_add (GTK_CONTAINER (image_editor->stock_radio), eprop->item_label); - table_attach (table, image_editor->stock_radio, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + gtk_box_pack_start (GTK_BOX (hbox), image_editor->stock_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); image_editor->properties = g_list_prepend (image_editor->properties, eprop); /* Icon theme image... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-name", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); image_editor->icon_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (image_editor->stock_radio)); - gtk_container_add (GTK_CONTAINER (image_editor->icon_radio), eprop->item_label); - table_attach (table, image_editor->icon_radio, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + gtk_box_pack_start (GTK_BOX (hbox), image_editor->icon_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); image_editor->properties = g_list_prepend (image_editor->properties, eprop); /* Filename... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "pixbuf", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); image_editor->file_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (image_editor->stock_radio)); - gtk_container_add (GTK_CONTAINER (image_editor->file_radio), eprop->item_label); - table_attach (table, image_editor->file_radio, 0, 2); - table_attach (table, GTK_WIDGET (eprop), 1, 2); + gtk_box_pack_start (GTK_BOX (hbox), image_editor->file_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 2, group); + table_attach (table, GTK_WIDGET (eprop), 1, 2, group); image_editor->properties = g_list_prepend (image_editor->properties, eprop); + g_object_unref (group); + /* Image size frame... */ str = g_strdup_printf ("<b>%s</b>", _("Set Image Size")); label = gtk_label_new (str); @@ -395,19 +410,22 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor, table = gtk_table_new (0, 0, FALSE); gtk_container_add (GTK_CONTAINER (alignment), table); + group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /* Icon Size... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-size", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + table_attach (table, eprop->item_label, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); image_editor->properties = g_list_prepend (image_editor->properties, eprop); /* Pixel Size... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "pixel-size", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + table_attach (table, eprop->item_label, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); image_editor->properties = g_list_prepend (image_editor->properties, eprop); + g_object_unref (group); + /* Connect radio button signals... */ g_signal_connect (G_OBJECT (image_editor->stock_radio), "toggled", G_CALLBACK (stock_toggled), image_editor); diff --git a/plugins/gtk+/glade-image-item-editor.c b/plugins/gtk+/glade-image-item-editor.c index 2768115a..5fef3359 100644 --- a/plugins/gtk+/glade-image-item-editor.c +++ b/plugins/gtk+/glade-image-item-editor.c @@ -311,13 +311,17 @@ custom_toggled (GtkWidget *widget, static void table_attach (GtkWidget *table, GtkWidget *child, - gint pos, gint row) + gint pos, gint row, + GtkSizeGroup *group) { gtk_table_attach (GTK_TABLE (table), child, pos, pos+1, row, row +1, - GTK_EXPAND | GTK_FILL, + pos ? 0 : GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 3, 1); + + if (pos) + gtk_size_group_add_widget (group, child); } GtkWidget * @@ -327,6 +331,7 @@ glade_image_item_editor_new (GladeWidgetAdaptor *adaptor, GladeImageItemEditor *item_editor; GladeEditorProperty *eprop; GtkWidget *label, *alignment, *frame, *main_table, *table, *vbox; + GtkSizeGroup *group; gchar *str; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); @@ -343,7 +348,7 @@ glade_image_item_editor_new (GladeWidgetAdaptor *adaptor, gtk_box_pack_start (GTK_BOX (item_editor), main_table, FALSE, FALSE, 8); item_editor->stock_radio = gtk_radio_button_new_with_label (NULL, _("Stock Item:")); - table_attach (main_table, item_editor->stock_radio, 0, 0); + table_attach (main_table, item_editor->stock_radio, 0, 0, NULL); alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0); @@ -357,23 +362,27 @@ glade_image_item_editor_new (GladeWidgetAdaptor *adaptor, table = gtk_table_new (0, 0, FALSE); gtk_container_add (GTK_CONTAINER (alignment), table); + group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /* The stock item */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "stock", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + table_attach (table, eprop->item_label, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); item_editor->properties = g_list_prepend (item_editor->properties, eprop); /* An accel group for the item's accelerator */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "accel-group", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + table_attach (table, eprop->item_label, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); item_editor->properties = g_list_prepend (item_editor->properties, eprop); + g_object_unref (group); + /* Now put a radio button in the same table for the custom image editing */ item_editor->custom_radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (item_editor->stock_radio), _("Custom label and image:")); - table_attach (main_table, item_editor->custom_radio, 0, 2); + table_attach (main_table, item_editor->custom_radio, 0, 2, NULL); vbox = gtk_vbox_new (FALSE, 0); gtk_table_attach (GTK_TABLE (main_table), vbox, 0, 2, /* left and right */ @@ -400,18 +409,22 @@ glade_image_item_editor_new (GladeWidgetAdaptor *adaptor, table = gtk_table_new (0, 0, FALSE); gtk_container_add (GTK_CONTAINER (alignment), table); + group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /* The menu label... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + table_attach (table, eprop->item_label, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); item_editor->properties = g_list_prepend (item_editor->properties, eprop); /* Whether to use-underline... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "use-underline", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + table_attach (table, eprop->item_label, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); item_editor->properties = g_list_prepend (item_editor->properties, eprop); + g_object_unref (group); + /* Internal Image area... */ str = g_strdup_printf ("<b>%s</b>", _("Edit Image")); label = gtk_label_new (str); diff --git a/plugins/gtk+/glade-label-editor.c b/plugins/gtk+/glade-label-editor.c index 3313df94..95783811 100644 --- a/plugins/gtk+/glade-label-editor.c +++ b/plugins/gtk+/glade-label-editor.c @@ -53,6 +53,9 @@ glade_label_editor_class_init (GladeLabelEditorClass *klass) static void glade_label_editor_init (GladeLabelEditor *self) { + self->appearance_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + self->formatting_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + self->wrap_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); } static void @@ -215,6 +218,10 @@ glade_label_editor_finalize (GObject *object) glade_editable_load (GLADE_EDITABLE (object), NULL); + g_object_unref (label_editor->appearance_group); + g_object_unref (label_editor->formatting_group); + g_object_unref (label_editor->wrap_group); + G_OBJECT_CLASS (glade_label_editor_parent_class)->finalize (object); } @@ -506,13 +513,17 @@ wrap_mode_toggled (GtkWidget *widget, static void table_attach (GtkWidget *table, GtkWidget *child, - gint pos, gint row) + gint pos, gint row, + GtkSizeGroup *group) { gtk_table_attach (GTK_TABLE (table), child, pos, pos+1, row, row +1, - GTK_EXPAND | GTK_FILL, + pos ? 0 : GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 3, 1); + + if (pos) + gtk_size_group_add_widget (group, child); } static void @@ -520,7 +531,7 @@ append_label_appearance (GladeLabelEditor *label_editor, GladeWidgetAdaptor *adaptor) { GladeEditorProperty *eprop, *markup_property; - GtkWidget *table, *frame, *alignment, *label; + GtkWidget *table, *frame, *alignment, *label, *hbox; gchar *str; /* Label appearance... */ @@ -542,40 +553,46 @@ append_label_appearance (GladeLabelEditor *label_editor, /* Edit the label itself... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + table_attach (table, eprop->item_label, 0, 0, label_editor->appearance_group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, label_editor->appearance_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* Edit by attributes... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "glade-attributes", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); label_editor->attributes_radio = gtk_radio_button_new (NULL); - gtk_container_add (GTK_CONTAINER (label_editor->attributes_radio), eprop->item_label); - table_attach (table, label_editor->attributes_radio, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->attributes_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 1, label_editor->appearance_group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, label_editor->appearance_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* Edit with label as pango markup strings... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "use-markup", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); label_editor->markup_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (label_editor->attributes_radio)); - gtk_container_add (GTK_CONTAINER (label_editor->markup_radio), eprop->item_label); - table_attach (table, label_editor->markup_radio, 0, 2); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->markup_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 2, label_editor->appearance_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); markup_property = eprop; /* Its getting into a hidden row on the bottom... */ /* Add underscores from pattern string... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "pattern", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); label_editor->pattern_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (label_editor->attributes_radio)); - gtk_container_add (GTK_CONTAINER (label_editor->pattern_radio), eprop->item_label); - table_attach (table, label_editor->pattern_radio, 0, 3); - table_attach (table, GTK_WIDGET (eprop), 1, 3); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->pattern_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 3, label_editor->appearance_group); + table_attach (table, GTK_WIDGET (eprop), 1, 3, label_editor->appearance_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* Add invisible eprops at the end of this table... */ gtk_widget_set_no_show_all (GTK_WIDGET (markup_property), TRUE); gtk_widget_hide (GTK_WIDGET (markup_property)); - table_attach (table, GTK_WIDGET (markup_property), 0, 4); + table_attach (table, GTK_WIDGET (markup_property), 0, 4, label_editor->appearance_group); } @@ -584,7 +601,7 @@ append_label_formatting (GladeLabelEditor *label_editor, GladeWidgetAdaptor *adaptor) { GladeEditorProperty *eprop; - GtkWidget *table, *frame, *alignment, *label; + GtkWidget *table, *frame, *alignment, *label, *hbox; gchar *str; gint row = 0; @@ -607,37 +624,41 @@ append_label_formatting (GladeLabelEditor *label_editor, /* ellipsize... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "ellipsize", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, row); - table_attach (table, GTK_WIDGET (eprop), 1, row++); + table_attach (table, eprop->item_label, 0, row, label_editor->formatting_group); + table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* justify... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "justify", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, row); - table_attach (table, GTK_WIDGET (eprop), 1, row++); + table_attach (table, eprop->item_label, 0, row, label_editor->formatting_group); + table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* angle... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "angle", FALSE, TRUE); - table_attach (table, eprop->item_label, 0, row); - table_attach (table, GTK_WIDGET (eprop), 1, row++); + table_attach (table, eprop->item_label, 0, row, label_editor->formatting_group); + table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* width-chars ... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "width-chars", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); label_editor->width_radio = gtk_radio_button_new (NULL); - gtk_container_add (GTK_CONTAINER (label_editor->width_radio), eprop->item_label); - table_attach (table, label_editor->width_radio, 0, row); - table_attach (table, GTK_WIDGET (eprop), 1, row++); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->width_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, row, label_editor->formatting_group); + table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* max-width-chars ... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "max-width-chars", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); label_editor->max_width_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (label_editor->width_radio)); - gtk_container_add (GTK_CONTAINER (label_editor->max_width_radio), eprop->item_label); - table_attach (table, label_editor->max_width_radio, 0, row); - table_attach (table, GTK_WIDGET (eprop), 1, row++); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->max_width_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, row, label_editor->formatting_group); + table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); } @@ -646,7 +667,7 @@ append_label_wrapping (GladeLabelEditor *label_editor, GladeWidgetAdaptor *adaptor) { GladeEditorProperty *eprop, *single_line_eprop; - GtkWidget *table, *frame, *alignment, *label; + GtkWidget *table, *frame, *alignment, *label, *hbox; gchar *str; gint row = 0; @@ -668,32 +689,39 @@ append_label_wrapping (GladeLabelEditor *label_editor, gtk_container_add (GTK_CONTAINER (alignment), table); /* Append defaut epropless radio... */ + hbox = gtk_hbox_new (FALSE, 0); label_editor->wrap_free_radio = gtk_radio_button_new (NULL); label_editor->wrap_free_label = gtk_label_new (_("Text wraps normally")); - gtk_container_add (GTK_CONTAINER (label_editor->wrap_free_radio), label_editor->wrap_free_label); - table_attach (table, label_editor->wrap_free_radio, 0, row++); + gtk_misc_set_alignment (GTK_MISC (label_editor->wrap_free_label), 0.0F, 0.5F); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->wrap_free_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->wrap_free_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, row++, label_editor->wrap_group); /* single-line-mode ... */ single_line_eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "single-line-mode", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); label_editor->single_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (label_editor->wrap_free_radio)); - gtk_container_add (GTK_CONTAINER (label_editor->single_radio), single_line_eprop->item_label); - table_attach (table, label_editor->single_radio, 0, row++); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->single_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), single_line_eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, row++, label_editor->wrap_group); label_editor->properties = g_list_prepend (label_editor->properties, single_line_eprop); /* wrap-mode ... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "wrap-mode", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); label_editor->wrap_mode_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (label_editor->wrap_free_radio)); - gtk_container_add (GTK_CONTAINER (label_editor->wrap_mode_radio), eprop->item_label); - table_attach (table, label_editor->wrap_mode_radio, 0, row); - table_attach (table, GTK_WIDGET (eprop), 1, row++); + gtk_box_pack_start (GTK_BOX (hbox), label_editor->wrap_mode_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, row, label_editor->wrap_group); + table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->wrap_group); label_editor->properties = g_list_prepend (label_editor->properties, eprop); /* Add invisible eprops at the end of this table... */ gtk_widget_set_no_show_all (GTK_WIDGET (single_line_eprop), TRUE); gtk_widget_hide (GTK_WIDGET (single_line_eprop)); - table_attach (table, GTK_WIDGET (single_line_eprop), 0, row); + table_attach (table, GTK_WIDGET (single_line_eprop), 0, row, label_editor->wrap_group); } GtkWidget * diff --git a/plugins/gtk+/glade-label-editor.h b/plugins/gtk+/glade-label-editor.h index ac432b80..f25a1c28 100644 --- a/plugins/gtk+/glade-label-editor.h +++ b/plugins/gtk+/glade-label-editor.h @@ -73,6 +73,10 @@ struct _GladeLabelEditor GList *properties; /* A list of eprops to update at load() time */ + GtkSizeGroup *appearance_group; + GtkSizeGroup *formatting_group; + GtkSizeGroup *wrap_group; + gboolean loading; /* Loading flag for loading widgets in the editor */ gboolean modifying; /* Flag for monitoring project changes */ }; diff --git a/plugins/gtk+/glade-tool-button-editor.c b/plugins/gtk+/glade-tool-button-editor.c index 94d92b33..cbb4e36a 100644 --- a/plugins/gtk+/glade-tool-button-editor.c +++ b/plugins/gtk+/glade-tool-button-editor.c @@ -403,23 +403,28 @@ glade_tool_button_editor_grab_focus (GtkWidget *widget) static void table_attach (GtkWidget *table, GtkWidget *child, - gint pos, gint row) + gint pos, gint row, + GtkSizeGroup *group) { gtk_table_attach (GTK_TABLE (table), child, pos, pos+1, row, row +1, - GTK_EXPAND | GTK_FILL, + pos ? 0 : GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 3, 1); + + if (pos) + gtk_size_group_add_widget (group, child); } GtkWidget * glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor, - GladeEditable *embed) + GladeEditable *embed) { GladeToolButtonEditor *button_editor; GladeEditorProperty *eprop; - GtkWidget *label, *alignment, *frame, *table; + GtkWidget *label, *alignment, *frame, *table, *hbox; + GtkSizeGroup *group; gchar *str; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); @@ -448,25 +453,31 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor, table = gtk_table_new (0, 0, FALSE); gtk_container_add (GTK_CONTAINER (alignment), table); + group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /* Standard label... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); button_editor->standard_label_radio = gtk_radio_button_new (NULL); - gtk_container_add (GTK_CONTAINER (button_editor->standard_label_radio), - eprop->item_label); - table_attach (table, button_editor->standard_label_radio, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + gtk_box_pack_start (GTK_BOX (hbox), button_editor->standard_label_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); /* Custom label... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label-widget", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); button_editor->custom_label_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (button_editor->standard_label_radio)); - gtk_container_add (GTK_CONTAINER (button_editor->custom_label_radio), - eprop->item_label); - table_attach (table, button_editor->custom_label_radio, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + gtk_box_pack_start (GTK_BOX (hbox), button_editor->custom_label_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); + g_object_unref (group); + /* Image area frame... */ str = g_strdup_printf ("<b>%s</b>", _("Edit Image")); label = gtk_label_new (str); @@ -484,41 +495,53 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor, table = gtk_table_new (0, 0, FALSE); gtk_container_add (GTK_CONTAINER (alignment), table); + gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /* Stock image... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "stock-id", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); button_editor->stock_radio = gtk_radio_button_new (NULL); - gtk_container_add (GTK_CONTAINER (button_editor->stock_radio), eprop->item_label); - table_attach (table, button_editor->stock_radio, 0, 0); - table_attach (table, GTK_WIDGET (eprop), 1, 0); + gtk_box_pack_start (GTK_BOX (hbox), button_editor->stock_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 0, group); + table_attach (table, GTK_WIDGET (eprop), 1, 0, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); /* Icon theme image... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-name", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); button_editor->icon_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (button_editor->stock_radio)); - gtk_container_add (GTK_CONTAINER (button_editor->icon_radio), eprop->item_label); - table_attach (table, button_editor->icon_radio, 0, 1); - table_attach (table, GTK_WIDGET (eprop), 1, 1); + gtk_box_pack_start (GTK_BOX (hbox), button_editor->icon_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 1, group); + table_attach (table, GTK_WIDGET (eprop), 1, 1, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); /* Filename... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); button_editor->file_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (button_editor->stock_radio)); - gtk_container_add (GTK_CONTAINER (button_editor->file_radio), eprop->item_label); - table_attach (table, button_editor->file_radio, 0, 2); - table_attach (table, GTK_WIDGET (eprop), 1, 2); + gtk_box_pack_start (GTK_BOX (hbox), button_editor->file_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 2, group); + table_attach (table, GTK_WIDGET (eprop), 1, 2, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); /* Custom embedded image widget... */ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-widget", FALSE, TRUE); + hbox = gtk_hbox_new (FALSE, 0); button_editor->custom_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (button_editor->stock_radio)); - gtk_container_add (GTK_CONTAINER (button_editor->custom_radio), eprop->item_label); - table_attach (table, button_editor->custom_radio, 0, 3); - table_attach (table, GTK_WIDGET (eprop), 1, 3); + gtk_box_pack_start (GTK_BOX (hbox), button_editor->custom_radio, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2); + table_attach (table, hbox, 0, 3, group); + table_attach (table, GTK_WIDGET (eprop), 1, 3, group); button_editor->properties = g_list_prepend (button_editor->properties, eprop); + g_object_unref (group); + /* Connect radio button signals... */ g_signal_connect (G_OBJECT (button_editor->standard_label_radio), "toggled", G_CALLBACK (standard_label_toggled), button_editor); |