glade3 r2065 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r2065 - in trunk: . gladeui plugins/gtk+
- Date: Thu, 11 Dec 2008 07:01:30 +0000 (UTC)
Author: tvb
Date: Thu Dec 11 07:01:29 2008
New Revision: 2065
URL: http://svn.gnome.org/viewvc/glade3?rev=2065&view=rev
Log:
* 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.
Modified:
trunk/ChangeLog
trunk/gladeui/glade-base-editor.c
trunk/gladeui/glade-editable.c
trunk/gladeui/glade-editor-table.c
trunk/gladeui/glade-editor-table.h
trunk/gladeui/glade-name-context.c
trunk/gladeui/glade-project.c
trunk/gladeui/glade-widget-adaptor.c
trunk/gladeui/glade-widget-adaptor.h
trunk/gladeui/glade-xml-utils.c
trunk/gladeui/glade-xml-utils.h
trunk/plugins/gtk+/glade-button-editor.c
trunk/plugins/gtk+/glade-cell-renderer-editor.c
trunk/plugins/gtk+/glade-image-editor.c
trunk/plugins/gtk+/glade-image-item-editor.c
trunk/plugins/gtk+/glade-label-editor.c
trunk/plugins/gtk+/glade-label-editor.h
trunk/plugins/gtk+/glade-tool-button-editor.c
Modified: trunk/gladeui/glade-base-editor.c
==============================================================================
--- trunk/gladeui/glade-base-editor.c (original)
+++ trunk/gladeui/glade-base-editor.c Thu Dec 11 07:01:29 2008
@@ -67,6 +67,7 @@
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 @@
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 @@
/* 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 @@
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 ();
Modified: trunk/gladeui/glade-editable.c
==============================================================================
--- trunk/gladeui/glade-editable.c (original)
+++ trunk/gladeui/glade-editable.c Thu Dec 11 07:01:29 2008
@@ -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 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 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 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.
*
*/
Modified: trunk/gladeui/glade-editor-table.c
==============================================================================
--- trunk/gladeui/glade-editor-table.c (original)
+++ trunk/gladeui/glade-editor-table.c Thu Dec 11 07:01:29 2008
@@ -51,7 +51,7 @@
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_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 @@
{
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
Modified: trunk/gladeui/glade-editor-table.h
==============================================================================
--- trunk/gladeui/glade-editor-table.h (original)
+++ trunk/gladeui/glade-editor-table.h Thu Dec 11 07:01:29 2008
@@ -48,6 +48,8 @@
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
Modified: trunk/gladeui/glade-name-context.c
==============================================================================
--- trunk/gladeui/glade-name-context.c (original)
+++ trunk/gladeui/glade-name-context.c Thu Dec 11 07:01:29 2008
@@ -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 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 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 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>
Modified: trunk/gladeui/glade-project.c
==============================================================================
--- trunk/gladeui/glade-project.c (original)
+++ trunk/gladeui/glade-project.c Thu Dec 11 07:01:29 2008
@@ -167,8 +167,8 @@
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 @@
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 @@
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 @@
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;
Modified: trunk/gladeui/glade-widget-adaptor.c
==============================================================================
--- trunk/gladeui/glade-widget-adaptor.c (original)
+++ trunk/gladeui/glade-widget-adaptor.c Thu Dec 11 07:01:29 2008
@@ -415,16 +415,40 @@
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)
Modified: trunk/gladeui/glade-widget-adaptor.h
==============================================================================
--- trunk/gladeui/glade-widget-adaptor.h (original)
+++ trunk/gladeui/glade-widget-adaptor.h Thu Dec 11 07:01:29 2008
@@ -544,10 +544,10 @@
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
Modified: trunk/gladeui/glade-xml-utils.c
==============================================================================
--- trunk/gladeui/glade-xml-utils.c (original)
+++ trunk/gladeui/glade-xml-utils.c Thu Dec 11 07:01:29 2008
@@ -488,8 +488,8 @@
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);
Modified: trunk/gladeui/glade-xml-utils.h
==============================================================================
--- trunk/gladeui/glade-xml-utils.h (original)
+++ trunk/gladeui/glade-xml-utils.h Thu Dec 11 07:01:29 2008
@@ -240,7 +240,7 @@
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);
Modified: trunk/plugins/gtk+/glade-button-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-button-editor.c (original)
+++ trunk/plugins/gtk+/glade-button-editor.c Thu Dec 11 07:01:29 2008
@@ -383,16 +383,21 @@
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 @@
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 @@
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 @@
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);
Modified: trunk/plugins/gtk+/glade-cell-renderer-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-cell-renderer-editor.c (original)
+++ trunk/plugins/gtk+/glade-cell-renderer-editor.c Thu Dec 11 07:01:29 2008
@@ -217,7 +217,7 @@
{
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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
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 @@
/* 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);
Modified: trunk/plugins/gtk+/glade-image-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-image-editor.c (original)
+++ trunk/plugins/gtk+/glade-image-editor.c Thu Dec 11 07:01:29 2008
@@ -189,13 +189,17 @@
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 @@
{
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 @@
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 @@
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);
Modified: trunk/plugins/gtk+/glade-image-item-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-image-item-editor.c (original)
+++ trunk/plugins/gtk+/glade-image-item-editor.c Thu Dec 11 07:01:29 2008
@@ -311,13 +311,17 @@
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 @@
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 @@
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 @@
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 @@
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);
Modified: trunk/plugins/gtk+/glade-label-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-label-editor.c (original)
+++ trunk/plugins/gtk+/glade-label-editor.c Thu Dec 11 07:01:29 2008
@@ -53,6 +53,9 @@
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_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 @@
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 @@
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 @@
/* 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 @@
GladeWidgetAdaptor *adaptor)
{
GladeEditorProperty *eprop;
- GtkWidget *table, *frame, *alignment, *label;
+ GtkWidget *table, *frame, *alignment, *label, *hbox;
gchar *str;
gint row = 0;
@@ -607,37 +624,41 @@
/* 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 @@
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 @@
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 *
Modified: trunk/plugins/gtk+/glade-label-editor.h
==============================================================================
--- trunk/plugins/gtk+/glade-label-editor.h (original)
+++ trunk/plugins/gtk+/glade-label-editor.h Thu Dec 11 07:01:29 2008
@@ -73,6 +73,10 @@
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 */
};
Modified: trunk/plugins/gtk+/glade-tool-button-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-tool-button-editor.c (original)
+++ trunk/plugins/gtk+/glade-tool-button-editor.c Thu Dec 11 07:01:29 2008
@@ -403,23 +403,28 @@
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 @@
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 @@
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]