* gladeui/glade-base-editor.c, gladeui/glade-editor-property.c,

gladeui/glade-editor-table.c, gladeui/glade-editor-table.h,
	plugins/gtk+/glade-activatable-editor.c, plugins/gtk+/glade-button-editor.c,
	plugins/gtk+/glade-entry-editor.c, plugins/gtk+/glade-image-editor.c,
	plugins/gtk+/glade-image-item-editor.c, plugins/gtk+/glade-label-editor.c,
	plugins/gtk+/glade-label-editor.h, plugins/gtk+/glade-tool-button-editor.c:
	Removed the GtkTables and use GtkGrid in property editors so that line wrapping
	is hieght-for-width.
This commit is contained in:
Tristan Van Berkom 2010-12-29 19:14:52 +09:00
parent a334a9d268
commit 0e4da586e9
13 changed files with 229 additions and 304 deletions

View File

@ -1,3 +1,14 @@
2010-12-29 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-base-editor.c, gladeui/glade-editor-property.c,
gladeui/glade-editor-table.c, gladeui/glade-editor-table.h,
plugins/gtk+/glade-activatable-editor.c, plugins/gtk+/glade-button-editor.c,
plugins/gtk+/glade-entry-editor.c, plugins/gtk+/glade-image-editor.c,
plugins/gtk+/glade-image-item-editor.c, plugins/gtk+/glade-label-editor.c,
plugins/gtk+/glade-label-editor.h, plugins/gtk+/glade-tool-button-editor.c:
Removed the GtkTables and use GtkGrid in property editors so that line wrapping
is hieght-for-width.
2010-12-28 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/Makefile.am, gladeui/glade.h, gladeui/glade-clipboard.c, gladeui/glade-app.[ch],

View File

@ -68,7 +68,6 @@ struct _GladeBaseEditorPrivate
GladeWidget *gcontainer; /* The container we are editing */
/* Editor UI */
GtkSizeGroup *group;
GtkWidget *paned, *table, *treeview, *main_scroll, *notebook;
GtkWidget *remove_button;
GladeSignalEditor *signal_editor;
@ -376,24 +375,20 @@ glade_base_editor_table_attach (GladeBaseEditor *e,
GtkWidget *child1,
GtkWidget *child2)
{
GtkTable *table = GTK_TABLE (e->priv->table);
GtkGrid *table = GTK_GRID (e->priv->table);
gint row = e->priv->row;
if (child1)
{
gtk_table_attach (table, child1, 0, 1, row, row + 1,
GTK_EXPAND | GTK_FILL, GTK_FILL, 2, 0);
gtk_grid_attach (table, child1, 0, row, 1, 1);
gtk_widget_set_hexpand (child1, TRUE);
gtk_widget_show (child1);
}
if (child2)
{
gtk_table_attach (table, child2, 1, 2, row, row + 1,
0, GTK_FILL, 2, 0);
gtk_grid_attach (table, child2, 1, row, 1, 1);
gtk_widget_show (child2);
gtk_size_group_add_widget (e->priv->group, child2);
}
e->priv->row++;
@ -1272,10 +1267,6 @@ glade_base_editor_dispose (GObject *object)
glade_base_editor_project_disconnect (cobj);
cobj->priv->project = NULL;
if (cobj->priv->group)
cobj->priv->group =
(g_object_unref (cobj->priv->group), NULL);
G_OBJECT_CLASS(parent_class)->dispose (object);
}
@ -1682,8 +1673,6 @@ 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 ();
@ -1797,9 +1786,11 @@ glade_base_editor_init (GladeBaseEditor *editor)
gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
/* Tables */
e->table = gtk_table_new (1, 2, FALSE);
e->table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (e->table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_column_spacing (GTK_GRID (e->table), 4);
gtk_grid_set_row_spacing (GTK_GRID (e->table), 4);
gtk_widget_show (e->table);
gtk_table_set_row_spacings (GTK_TABLE (e->table), 4);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll), e->table);
/* Signal Editor */
@ -2110,8 +2101,9 @@ glade_base_editor_add_editable (GladeBaseEditor *editor,
gtk_widget_show (GTK_WIDGET (editable));
row = editor->priv->row;
gtk_table_attach (GTK_TABLE (editor->priv->table), GTK_WIDGET (editable), 0, 2, row, row + 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 0);
gtk_grid_attach (GTK_GRID (editor->priv->table), GTK_WIDGET (editable), 0, row, 2, 1);
gtk_widget_set_hexpand (GTK_WIDGET (editable), TRUE);
editor->priv->row++;
@ -2145,8 +2137,8 @@ glade_base_editor_add_label (GladeBaseEditor *editor, gchar *str)
gtk_label_set_markup (GTK_LABEL (label), markup);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_misc_set_padding (GTK_MISC (label), 0, 6);
gtk_table_attach (GTK_TABLE (editor->priv->table), label, 0, 2, row, row + 1,
GTK_FILL, GTK_FILL, 2, 0);
gtk_grid_attach (GTK_GRID (editor->priv->table), label, 0, row, 2, 1);
gtk_widget_show (label);
editor->priv->row++;

View File

@ -285,11 +285,11 @@ glade_editor_property_constructor (GType type,
hbox = gtk_hbox_new (FALSE, 4);
gtk_label_set_line_wrap (GTK_LABEL(eprop->label), TRUE);
gtk_label_set_width_chars (GTK_LABEL(eprop->label), 10);
gtk_label_set_line_wrap_mode (GTK_LABEL(eprop->label), PANGO_WRAP_WORD_CHAR);
gtk_label_set_line_wrap (GTK_LABEL (eprop->label), TRUE);
gtk_label_set_width_chars (GTK_LABEL (eprop->label), 10);
gtk_label_set_line_wrap_mode (GTK_LABEL (eprop->label), PANGO_WRAP_WORD_CHAR);
gtk_misc_set_alignment (GTK_MISC(eprop->label), 0.0, 0.5);
gtk_misc_set_alignment (GTK_MISC (eprop->label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), eprop->label, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), eprop->warning, FALSE, FALSE, 0);

View File

@ -33,7 +33,7 @@ static void glade_editor_table_editable_init (GladeEditableIface *i
static void glade_editor_table_realize (GtkWidget *widget);
static void glade_editor_table_grab_focus (GtkWidget *widget);
G_DEFINE_TYPE_WITH_CODE (GladeEditorTable, glade_editor_table, GTK_TYPE_TABLE,
G_DEFINE_TYPE_WITH_CODE (GladeEditorTable, glade_editor_table, GTK_TYPE_GRID,
G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
glade_editor_table_editable_init));
@ -65,7 +65,8 @@ 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);
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (self), 4);
}
static void
@ -83,10 +84,6 @@ 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);
}
@ -259,15 +256,11 @@ glade_editor_table_attach (GladeEditorTable *table,
GtkWidget *child,
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
0,
3, 1);
if (pos)
gtk_size_group_add_widget (table->group, child);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_widget_set_hexpand (child, TRUE);
}
static gint

View File

@ -40,7 +40,7 @@ typedef struct _GladeEditorTableClass GladeEditorTableClass;
struct _GladeEditorTable
{
GtkTable parent;
GtkGrid parent;
GladeWidgetAdaptor *adaptor; /* The GladeWidgetAdaptor this
* table was created for.
@ -48,8 +48,6 @@ 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
@ -74,7 +72,7 @@ struct _GladeEditorTable
struct _GladeEditorTableClass
{
GtkTableClass parent;
GtkGridClass parent;
};
GType glade_editor_table_get_type (void);

View File

@ -172,17 +172,13 @@ glade_activatable_editor_grab_focus (GtkWidget *widget)
static void
table_attach (GtkWidget *table,
GtkWidget *child,
gint pos, gint row,
GtkSizeGroup *group)
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_size_group_add_widget (group, child);
gtk_widget_set_hexpand (child, TRUE);
}
static void
@ -379,7 +375,6 @@ glade_activatable_editor_new (GladeWidgetAdaptor *adaptor,
GladeActivatableEditor *activatable_editor;
GladeEditorProperty *eprop;
GtkWidget *table, *frame, *alignment, *label;
GtkSizeGroup *group;
gchar *str;
gint row = 0;
@ -405,14 +400,15 @@ glade_activatable_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "related-action", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, row, group);
table_attach (table, GTK_WIDGET (eprop), 1, row++, group);
table_attach (table, eprop->item_label, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
activatable_editor->properties = g_list_prepend (activatable_editor->properties, eprop);
g_signal_connect (G_OBJECT (eprop), "commit",
@ -421,8 +417,8 @@ glade_activatable_editor_new (GladeWidgetAdaptor *adaptor,
G_CALLBACK (related_action_post_commit), activatable_editor);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "use-action-appearance", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, row, group);
table_attach (table, GTK_WIDGET (eprop), 1, row++, group);
table_attach (table, eprop->item_label, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
activatable_editor->properties = g_list_prepend (activatable_editor->properties, eprop);
gtk_widget_show_all (GTK_WIDGET (activatable_editor));

View File

@ -406,24 +406,18 @@ label_toggled (GtkWidget *widget,
button_editor->loaded_widget);
}
static void
table_attach (GtkWidget *table,
GtkWidget *child,
gint pos, gint row,
GtkSizeGroup *group)
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_size_group_add_widget (group, child);
gtk_widget_set_hexpand (child, TRUE);
}
GtkWidget *
glade_button_editor_new (GladeWidgetAdaptor *adaptor,
GladeEditable *embed)
@ -431,7 +425,6 @@ 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);
@ -482,22 +475,21 @@ glade_button_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (button_editor->stock_frame), 6, 0, 12, 0);
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);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 0, group);
table_attach (table, eprop->item_label, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 1, group);
table_attach (table, eprop->item_label, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
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);
@ -508,31 +500,30 @@ glade_button_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (button_editor->label_frame), 6, 0, 12, 0);
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);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 0, group);
table_attach (table, eprop->item_label, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 1, group);
table_attach (table, eprop->item_label, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 2, group);
table_attach (table, eprop->item_label, 0, 2);
table_attach (table, GTK_WIDGET (eprop), 1, 2);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 3, group);
table_attach (table, eprop->item_label, 0, 3);
table_attach (table, GTK_WIDGET (eprop), 1, 3);
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);

View File

@ -479,23 +479,19 @@ secondary_pixbuf_toggled (GtkWidget *widget,
entry_editor->loaded_widget);
}
static void
table_attach (GtkWidget *table,
GtkWidget *child,
gint pos, gint row,
GtkSizeGroup *group)
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_size_group_add_widget (group, child);
gtk_widget_set_hexpand (child, TRUE);
}
GtkWidget *
glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
GladeEditable *embed)
@ -503,7 +499,6 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
GladeEntryEditor *entry_editor;
GladeEditorProperty *eprop;
GtkWidget *table, *frame, *alignment, *label, *hbox;
GtkSizeGroup *group;
gchar *str;
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
@ -530,19 +525,19 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* Text */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "text", FALSE, TRUE);
hbox = gtk_hbox_new (FALSE, 0);
entry_editor->text_radio = gtk_radio_button_new (NULL);
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->text_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);
table_attach (table, hbox, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Buffer */
@ -552,13 +547,10 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (entry_editor->text_radio));
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->buffer_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);
table_attach (table, hbox, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
g_object_unref (group);
/* Progress... */
str = g_strdup_printf ("<b>%s</b>", _("Progress"));
label = gtk_label_new (str);
@ -573,25 +565,23 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* Fraction */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "progress-fraction", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 0, group);
table_attach (table, GTK_WIDGET (eprop), 1, 0, group);
table_attach (table, eprop->item_label, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Pulse */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "progress-pulse-step", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 1, group);
table_attach (table, GTK_WIDGET (eprop), 1, 1, group);
table_attach (table, eprop->item_label, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
g_object_unref (group);
/* Primary icon... */
str = g_strdup_printf ("<b>%s</b>", _("Primary icon"));
label = gtk_label_new (str);
@ -606,19 +596,19 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* Pixbuf */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, PIXBUF_NAME(TRUE), FALSE, TRUE);
hbox = gtk_hbox_new (FALSE, 0);
entry_editor->primary_pixbuf_radio = gtk_radio_button_new (NULL);
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->primary_pixbuf_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);
table_attach (table, hbox, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Stock */
@ -628,8 +618,8 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (entry_editor->primary_pixbuf_radio));
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->primary_stock_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);
table_attach (table, hbox, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Icon name */
@ -639,33 +629,31 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (entry_editor->primary_pixbuf_radio));
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->primary_icon_name_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);
table_attach (table, hbox, 0, 2);
table_attach (table, GTK_WIDGET (eprop), 1, 2);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Other primary icon related properties */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "primary-icon-activatable", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 3, group);
table_attach (table, GTK_WIDGET (eprop), 1, 3, group);
table_attach (table, eprop->item_label, 0, 3);
table_attach (table, GTK_WIDGET (eprop), 1, 3);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "primary-icon-sensitive", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 4, group);
table_attach (table, GTK_WIDGET (eprop), 1, 4, group);
table_attach (table, eprop->item_label, 0, 4);
table_attach (table, GTK_WIDGET (eprop), 1, 4);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "primary-icon-tooltip-text", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 5, group);
table_attach (table, GTK_WIDGET (eprop), 1, 5, group);
table_attach (table, eprop->item_label, 0, 5);
table_attach (table, GTK_WIDGET (eprop), 1, 5);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "primary-icon-tooltip-markup", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 6, group);
table_attach (table, GTK_WIDGET (eprop), 1, 6, group);
table_attach (table, eprop->item_label, 0, 6);
table_attach (table, GTK_WIDGET (eprop), 1, 6);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
g_object_unref (group);
/* Secondary icon... */
str = g_strdup_printf ("<b>%s</b>", _("Secondary icon"));
label = gtk_label_new (str);
@ -680,19 +668,19 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* Pixbuf */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, PIXBUF_NAME(FALSE), FALSE, TRUE);
hbox = gtk_hbox_new (FALSE, 0);
entry_editor->secondary_pixbuf_radio = gtk_radio_button_new (NULL);
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->secondary_pixbuf_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);
table_attach (table, hbox, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Stock */
@ -702,8 +690,8 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (entry_editor->secondary_pixbuf_radio));
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->secondary_stock_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);
table_attach (table, hbox, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Icon name */
@ -713,33 +701,31 @@ glade_entry_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (entry_editor->secondary_pixbuf_radio));
gtk_box_pack_start (GTK_BOX (hbox), entry_editor->secondary_icon_name_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);
table_attach (table, hbox, 0, 2);
table_attach (table, GTK_WIDGET (eprop), 1, 2);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
/* Other secondary icon related properties */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "secondary-icon-activatable", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 3, group);
table_attach (table, GTK_WIDGET (eprop), 1, 3, group);
table_attach (table, eprop->item_label, 0, 3);
table_attach (table, GTK_WIDGET (eprop), 1, 3);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "secondary-icon-sensitive", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 4, group);
table_attach (table, GTK_WIDGET (eprop), 1, 4, group);
table_attach (table, eprop->item_label, 0, 4);
table_attach (table, GTK_WIDGET (eprop), 1, 4);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "secondary-icon-tooltip-text", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 5, group);
table_attach (table, GTK_WIDGET (eprop), 1, 5, group);
table_attach (table, eprop->item_label, 0, 5);
table_attach (table, GTK_WIDGET (eprop), 1, 5);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "secondary-icon-tooltip-markup", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 6, group);
table_attach (table, GTK_WIDGET (eprop), 1, 6, group);
table_attach (table, eprop->item_label, 0, 6);
table_attach (table, GTK_WIDGET (eprop), 1, 6);
entry_editor->properties = g_list_prepend (entry_editor->properties, eprop);
g_object_unref (group);
gtk_widget_show_all (GTK_WIDGET (entry_editor));

View File

@ -189,17 +189,13 @@ glade_image_editor_grab_focus (GtkWidget *widget)
static void
table_attach (GtkWidget *table,
GtkWidget *child,
gint pos, gint row,
GtkSizeGroup *group)
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_size_group_add_widget (group, child);
gtk_widget_set_hexpand (child, TRUE);
}
static void
@ -329,7 +325,6 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor,
GladeImageEditor *image_editor;
GladeEditorProperty *eprop;
GtkWidget *table, *frame, *alignment, *label, *hbox;
GtkSizeGroup *group;
gchar *str;
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
@ -355,19 +350,19 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
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_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);
table_attach (table, hbox, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
image_editor->properties = g_list_prepend (image_editor->properties, eprop);
/* Icon theme image... */
@ -377,8 +372,8 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (image_editor->stock_radio));
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);
table_attach (table, hbox, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
image_editor->properties = g_list_prepend (image_editor->properties, eprop);
/* Filename... */
@ -388,12 +383,10 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (image_editor->stock_radio));
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);
table_attach (table, hbox, 0, 2);
table_attach (table, GTK_WIDGET (eprop), 1, 2);
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);
@ -408,24 +401,23 @@ glade_image_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 0, group);
table_attach (table, eprop->item_label, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 1, group);
table_attach (table, eprop->item_label, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
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);

View File

@ -307,21 +307,16 @@ custom_toggled (GtkWidget *widget,
item_editor->loaded_widget);
}
static void
table_attach (GtkWidget *table,
GtkWidget *child,
gint pos, gint row,
GtkSizeGroup *group)
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_size_group_add_widget (group, child);
gtk_widget_set_hexpand (child, TRUE);
}
GtkWidget *
@ -331,7 +326,6 @@ 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);
@ -344,52 +338,44 @@ glade_image_item_editor_new (GladeWidgetAdaptor *adaptor,
gtk_box_pack_start (GTK_BOX (item_editor), GTK_WIDGET (embed), FALSE, FALSE, 0);
/* Put a radio button to control use-stock here on top... */
main_table = gtk_table_new (0, 0, FALSE);
main_table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (main_table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (main_table), 4);
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, NULL);
table_attach (main_table, item_editor->stock_radio, 0, 0);
alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_table_attach (GTK_TABLE (main_table), alignment,
0, 2, /* left and right */
1, 2, /* top and bottom */
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 6);
gtk_grid_attach (GTK_GRID (main_table), alignment, 0, 1, 2, 1);
gtk_widget_set_hexpand (alignment, TRUE);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 0, group);
table_attach (table, eprop->item_label, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 1, group);
table_attach (table, eprop->item_label, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
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, NULL);
table_attach (main_table, item_editor->custom_radio, 0, 2);
vbox = gtk_vbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (main_table), vbox,
0, 2, /* left and right */
3, 4, /* top and bottom */
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 6);
gtk_grid_attach (GTK_GRID (main_table), vbox, 0, 3, 2, 1);
gtk_widget_set_hexpand (vbox, TRUE);
/* Label area frame... */
str = g_strdup_printf ("<b>%s</b>", _("Edit Label"));
@ -406,25 +392,23 @@ glade_image_item_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 0, group);
table_attach (table, eprop->item_label, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
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, group);
table_attach (table, GTK_WIDGET (eprop), 1, 1, group);
table_attach (table, eprop->item_label, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
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);

View File

@ -53,9 +53,6 @@ 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
@ -218,10 +215,6 @@ 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);
}
@ -509,21 +502,16 @@ wrap_mode_toggled (GtkWidget *widget,
label_editor->loaded_widget);
}
static void
table_attach (GtkWidget *table,
GtkWidget *child,
gint pos, gint row,
GtkSizeGroup *group)
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_size_group_add_widget (group, child);
gtk_widget_set_hexpand (child, TRUE);
}
static void
@ -548,13 +536,15 @@ append_label_appearance (GladeLabelEditor *label_editor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
/* Edit the label itself... */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, 0, label_editor->appearance_group);
table_attach (table, GTK_WIDGET (eprop), 1, 0, label_editor->appearance_group);
table_attach (table, eprop->item_label, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
/* Edit by attributes... */
@ -563,8 +553,8 @@ append_label_appearance (GladeLabelEditor *label_editor,
label_editor->attributes_radio = gtk_radio_button_new (NULL);
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);
table_attach (table, hbox, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
/* Edit with label as pango markup strings... */
@ -574,7 +564,7 @@ append_label_appearance (GladeLabelEditor *label_editor,
(GTK_RADIO_BUTTON (label_editor->attributes_radio));
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);
table_attach (table, hbox, 0, 2);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
markup_property = eprop; /* Its getting into a hidden row on the bottom... */
@ -585,8 +575,8 @@ append_label_appearance (GladeLabelEditor *label_editor,
(GTK_RADIO_BUTTON (label_editor->attributes_radio));
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);
table_attach (table, hbox, 0, 3);
table_attach (table, GTK_WIDGET (eprop), 1, 3);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
/* Tie the invisible editor property to the table's life-cycle */
@ -618,25 +608,27 @@ append_label_formatting (GladeLabelEditor *label_editor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
/* ellipsize... */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "ellipsize", FALSE, TRUE);
table_attach (table, eprop->item_label, 0, row, label_editor->formatting_group);
table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group);
table_attach (table, eprop->item_label, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
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, label_editor->formatting_group);
table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group);
table_attach (table, eprop->item_label, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
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, label_editor->formatting_group);
table_attach (table, GTK_WIDGET (eprop), 1, row++, label_editor->formatting_group);
table_attach (table, eprop->item_label, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
/* width-chars ... */
@ -645,8 +637,8 @@ append_label_formatting (GladeLabelEditor *label_editor,
label_editor->width_radio = gtk_radio_button_new (NULL);
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);
table_attach (table, hbox, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
/* max-width-chars ... */
@ -656,8 +648,8 @@ append_label_formatting (GladeLabelEditor *label_editor,
(GTK_RADIO_BUTTON (label_editor->width_radio));
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);
table_attach (table, hbox, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
}
@ -684,7 +676,9 @@ append_label_wrapping (GladeLabelEditor *label_editor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
table = gtk_table_new (0, 0, FALSE);
table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (alignment), table);
/* Append defaut epropless radio... */
@ -694,7 +688,7 @@ append_label_wrapping (GladeLabelEditor *label_editor,
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);
table_attach (table, hbox, 0, row++);
/* single-line-mode ... */
single_line_eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "single-line-mode", FALSE, TRUE);
@ -703,7 +697,7 @@ append_label_wrapping (GladeLabelEditor *label_editor,
(GTK_RADIO_BUTTON (label_editor->wrap_free_radio));
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);
table_attach (table, hbox, 0, row++);
label_editor->properties = g_list_prepend (label_editor->properties, single_line_eprop);
/* wrap-mode ... */
@ -713,8 +707,8 @@ append_label_wrapping (GladeLabelEditor *label_editor,
(GTK_RADIO_BUTTON (label_editor->wrap_free_radio));
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);
table_attach (table, hbox, 0, row);
table_attach (table, GTK_WIDGET (eprop), 1, row++);
label_editor->properties = g_list_prepend (label_editor->properties, eprop);
/* Tie the invisible editor property to the table's life-cycle */

View File

@ -73,10 +73,6 @@ 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 */
};

View File

@ -415,20 +415,15 @@ glade_tool_button_editor_grab_focus (GtkWidget *widget)
static void
table_attach (GtkWidget *table,
GtkWidget *child,
gint pos, gint row,
GtkSizeGroup *group)
gint pos, gint row)
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? 0 : GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
gtk_grid_attach (GTK_GRID (table), child,
pos, row, 1, 1);
if (pos)
gtk_size_group_add_widget (group, child);
gtk_widget_set_hexpand (child, TRUE);
}
GtkWidget *
glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
GladeEditable *embed)
@ -436,7 +431,6 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
GladeToolButtonEditor *button_editor;
GladeEditorProperty *eprop;
GtkWidget *label, *alignment, *frame, *table, *hbox;
GtkSizeGroup *group;
gchar *str;
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
@ -462,10 +456,11 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
button_editor->label_table = table = gtk_table_new (0, 0, FALSE);
gtk_container_add (GTK_CONTAINER (alignment), table);
button_editor->label_table = table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (alignment), table);
/* Standard label... */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE);
@ -473,8 +468,8 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
button_editor->standard_label_radio = gtk_radio_button_new (NULL);
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);
table_attach (table, hbox, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
button_editor->properties = g_list_prepend (button_editor->properties, eprop);
/* Custom label... */
@ -484,12 +479,10 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (button_editor->standard_label_radio));
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);
table_attach (table, hbox, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
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);
@ -504,10 +497,11 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
button_editor->image_table = table = gtk_table_new (0, 0, FALSE);
gtk_container_add (GTK_CONTAINER (alignment), table);
button_editor->image_table = table = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (table), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (alignment), table);
/* Stock image... */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "stock-id", FALSE, TRUE);
@ -515,8 +509,8 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
button_editor->stock_radio = gtk_radio_button_new (NULL);
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);
table_attach (table, hbox, 0, 0);
table_attach (table, GTK_WIDGET (eprop), 1, 0);
button_editor->properties = g_list_prepend (button_editor->properties, eprop);
/* Icon theme image... */
@ -526,8 +520,8 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (button_editor->stock_radio));
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);
table_attach (table, hbox, 0, 1);
table_attach (table, GTK_WIDGET (eprop), 1, 1);
button_editor->properties = g_list_prepend (button_editor->properties, eprop);
/* Filename... */
@ -537,8 +531,8 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (button_editor->stock_radio));
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);
table_attach (table, hbox, 0, 2);
table_attach (table, GTK_WIDGET (eprop), 1, 2);
button_editor->properties = g_list_prepend (button_editor->properties, eprop);
/* Custom embedded image widget... */
@ -548,12 +542,10 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
(GTK_RADIO_BUTTON (button_editor->stock_radio));
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);
table_attach (table, hbox, 0, 3);
table_attach (table, GTK_WIDGET (eprop), 1, 3);
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);