Commit a72c4fca authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

GladePopup: special case add to box/grid

Increase size of grid/box if there is no space to add a widget in the container

Fix issue #470 "Widgets of type need placeholders to add children"
parent 5781798e
...@@ -66,12 +66,41 @@ typedef struct { ...@@ -66,12 +66,41 @@ typedef struct {
static void static void
glade_popup_widget_add_cb (GtkMenuItem *item, RootAddData *data) glade_popup_widget_add_cb (GtkMenuItem *item, RootAddData *data)
{ {
gboolean use_group = FALSE;
GObject *parent;
g_return_if_fail (data->adaptor != NULL); g_return_if_fail (data->adaptor != NULL);
if (glade_command_create (data->adaptor, data->parent, parent = glade_widget_get_object (data->parent);
data->placeholder, data->project))
if ((GTK_IS_BOX (parent) || GTK_IS_GRID (parent)) &&
glade_util_count_placeholders (data->parent) == 0)
{
GladeProperty *prop;
gint value;
glade_command_push_group (_("Create %s"),
glade_widget_adaptor_get_name (data->adaptor));
if (GTK_IS_BOX (parent))
prop = glade_widget_get_property (data->parent, "size");
else
prop = glade_widget_get_property (data->parent, "n-columns");
glade_property_get (prop, &value);
glade_command_set_property (prop, ++value);
use_group = TRUE;
}
if (glade_command_create (data->adaptor,
data->parent,
data->placeholder,
data->project))
glade_project_set_add_item (data->project, NULL); glade_project_set_add_item (data->project, NULL);
if (use_group)
glade_command_pop_group();
} }
static void static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment