Commit aa044add authored by Tristan Van Berkom's avatar Tristan Van Berkom

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
parent cf462815
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
......
......@@ -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 ();
......
/* -*- 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.
*
*/
......
......@@ -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
......
......@@ -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
......
......@@ -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>
......
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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<