Commit 3549eeac authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte
Browse files

Added add-child-verify function to GtkScrolledWindow which is the only place...

Added add-child-verify function to GtkScrolledWindow which is the only place we want to check if we can add a child or not.
Stop using glade_util_check_and_warn_scrollable() everywhere but in GtkScrolledWindow add-child-verify function.
parent e95245f5
......@@ -433,19 +433,15 @@ glade_placeholder_button_press (GtkWidget *widget, GdkEventButton *event)
{
GladeWidget *parent = glade_placeholder_get_parent (placeholder);
if (!glade_util_check_and_warn_scrollable
(parent, adaptor, glade_app_get_window ()))
{
/* A widget type is selected in the palette.
* Add a new widget of that type.
*/
glade_command_create (adaptor, parent, placeholder, project);
glade_project_set_add_item (project, NULL);
/* reset the cursor */
glade_cursor_set (project, event->window, GLADE_CURSOR_SELECTOR);
}
/* A widget type is selected in the palette.
* Add a new widget of that type.
*/
glade_command_create (adaptor, parent, placeholder, project);
glade_project_set_add_item (project, NULL);
/* reset the cursor */
glade_cursor_set (project, event->window, GLADE_CURSOR_SELECTOR);
handled = TRUE;
}
}
......
......@@ -68,14 +68,10 @@ glade_popup_widget_add_cb (GtkMenuItem *item, RootAddData *data)
{
g_return_if_fail (data->adaptor != NULL);
if (!glade_util_check_and_warn_scrollable
(data->parent, data->adaptor, glade_app_get_window ()))
{
if (glade_command_create (data->adaptor, data->parent,
data->placeholder, data->project))
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);
}
static void
......
......@@ -4834,12 +4834,6 @@ glade_project_command_paste (GladeProject *project,
}
}
/* Abort operation when adding a non scrollable widget to any kind of GtkScrolledWindow. */
if (parent && widget &&
glade_util_check_and_warn_scrollable (parent, glade_widget_get_adaptor (widget),
glade_app_get_window ()))
return;
/* Check if we have anything to paste */
if (g_list_length (glade_clipboard_widgets (clipboard)) == 0)
{
......
......@@ -58,3 +58,17 @@ glade_gtk_scrolled_window_set_property (GladeWidgetAdaptor * adaptor,
else if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value);
}
gboolean
glade_gtk_scrolled_window_add_child_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
GladeWidget *gcontainer = glade_widget_get_from_gobject (container);
GladeWidget *gchild = glade_widget_get_from_gobject (child);
return !glade_util_check_and_warn_scrollable (gcontainer,
glade_widget_get_adaptor (gchild),
glade_app_get_window ());
}
\ No newline at end of file
......@@ -869,12 +869,6 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor,
GladeWidget *gnew_parent;
GladeProperty *property;
/* Dont add non-scrollable widgets to scrolled windows... */
if (gparent &&
glade_util_check_and_warn_scrollable (gparent, adaptor,
glade_app_get_window ()))
return;
glade_command_push_group (_("Adding parent %s for %s"),
glade_widget_adaptor_get_title (adaptor),
glade_widget_get_name (gwidget));
......
......@@ -2362,6 +2362,7 @@ range of values</_tooltip>
<glade-widget-class name="GtkScrolledWindow" generic-name="scrolledwindow" _title="Scrolled Window">
<create-editable-function>glade_gtk_scrolled_window_create_editable</create-editable-function>
<set-property-function>glade_gtk_scrolled_window_set_property</set-property-function>
<add-child-verify-function>glade_gtk_scrolled_window_add_child_verify</add-child-verify-function>
<properties>
<property id="hadjustment" custom-layout="True"/>
<property id="vadjustment" custom-layout="True"/>
......
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