core, tools, widget: Lock filters when editing
When editing a filter, the NDE UI is set to insensitive so they can't be deleted. However, closing and reopening the popover re-enables the options. This patch adds a new "temporary" boolean to GimpDrawableFilter. It is only set to TRUE if the filter is a temporary "editing" filter. When we reopen the NDE UI, this checks if the filter stack contains a temporary filter, and if so, once again locks the options.
This commit is contained in:
@ -68,6 +68,7 @@ enum
|
||||
PROP_DRAWABLE,
|
||||
PROP_MASK,
|
||||
PROP_CUSTOM_NAME,
|
||||
PROP_TEMPORARY,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
@ -110,6 +111,8 @@ struct _GimpDrawableFilter
|
||||
GeglNode *crop_before;
|
||||
GeglNode *crop_after;
|
||||
GimpApplicator *applicator;
|
||||
|
||||
gboolean is_temporary;
|
||||
};
|
||||
|
||||
static void gimp_drawable_filter_set_property (GObject *object,
|
||||
@ -217,6 +220,11 @@ gimp_drawable_filter_class_init (GimpDrawableFilterClass *klass)
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE);
|
||||
|
||||
drawable_filter_props[PROP_TEMPORARY] = g_param_spec_boolean ("temporary",
|
||||
NULL, NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE);
|
||||
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, drawable_filter_props);
|
||||
}
|
||||
@ -273,6 +281,10 @@ gimp_drawable_filter_set_property (GObject *object,
|
||||
filter->has_custom_name = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_TEMPORARY:
|
||||
filter->is_temporary = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -298,6 +310,9 @@ gimp_drawable_filter_get_property (GObject *object,
|
||||
case PROP_CUSTOM_NAME:
|
||||
g_value_set_boolean (value, filter->has_custom_name);
|
||||
break;
|
||||
case PROP_TEMPORARY:
|
||||
g_value_set_boolean (value, filter->is_temporary);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
@ -2186,8 +2186,9 @@ gimp_filter_tool_set_config (GimpFilterTool *filter_tool,
|
||||
}
|
||||
|
||||
g_object_set (filter_tool->filter,
|
||||
"name", name,
|
||||
"mask", mask,
|
||||
"name", name,
|
||||
"mask", mask,
|
||||
"temporary", TRUE,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
@ -2357,6 +2357,7 @@ gimp_item_tree_view_effects_clicked (GtkCellRendererToggle *toggle,
|
||||
GtkTreeViewColumn *column;
|
||||
GimpContainerTreeView *filter_tree_view = NULL;
|
||||
GtkWidget *scrolled_window = NULL;
|
||||
gboolean is_editing = FALSE;
|
||||
|
||||
filter_view = gimp_container_tree_view_new (filters,
|
||||
gimp_container_view_get_context (GIMP_CONTAINER_VIEW (view)),
|
||||
@ -2402,8 +2403,18 @@ gimp_item_tree_view_effects_clicked (GtkCellRendererToggle *toggle,
|
||||
filter_list = g_list_previous (filter_list))
|
||||
{
|
||||
if (GIMP_IS_DRAWABLE_FILTER (filter_list->data))
|
||||
gimp_item_tree_view_filter_active_changed (GIMP_FILTER (filter_list->data),
|
||||
filter_tree_view);
|
||||
{
|
||||
gboolean is_temporary;
|
||||
|
||||
gimp_item_tree_view_filter_active_changed (GIMP_FILTER (filter_list->data),
|
||||
filter_tree_view);
|
||||
|
||||
g_object_get (filter_list->data,
|
||||
"temporary", &is_temporary,
|
||||
NULL);
|
||||
if (is_temporary)
|
||||
is_editing = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect (filter_tree_view, "select-items",
|
||||
@ -2433,6 +2444,9 @@ gimp_item_tree_view_effects_clicked (GtkCellRendererToggle *toggle,
|
||||
|
||||
gimp_item_tree_view_filters_changed (item, view);
|
||||
gtk_widget_show (view->priv->effects_popover);
|
||||
|
||||
/* Lock filter options if we're actively editing a filter */
|
||||
gimp_item_tree_effects_set_sensitive (view, ! is_editing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user