mirror of https://github.com/GNOME/gimp.git
Revert "Issue #9228: make GEGL Operation tool's operations their own actions too."
This reverts commit d51c64ec06
.
This commit is contained in:
parent
806f88b9a0
commit
39942c1260
|
@ -142,12 +142,6 @@ gimp_tool_dialog_new (GimpToolInfo *tool_info,
|
||||||
gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
|
gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
/* We don't register a foreign dialog for every generated GEGL op tool. Simply
|
|
||||||
* use the base GimpGeglTool dialog for them all.
|
|
||||||
*/
|
|
||||||
if (g_str_has_prefix (gimp_object_get_name (tool_info), "gimp-gegl-op-"))
|
|
||||||
identifier = g_strdup ("gimp-gegl-tool-dialog");
|
|
||||||
else
|
|
||||||
identifier = g_strconcat (gimp_object_get_name (tool_info), "-dialog", NULL);
|
identifier = g_strconcat (gimp_object_get_name (tool_info), "-dialog", NULL);
|
||||||
|
|
||||||
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
|
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
|
||||||
|
|
|
@ -748,10 +748,7 @@ gimp_tools_register (GType tool_type,
|
||||||
gimp_tool_item_set_visible (GIMP_TOOL_ITEM (tool_info), visible);
|
gimp_tool_item_set_visible (GIMP_TOOL_ITEM (tool_info), visible);
|
||||||
|
|
||||||
/* hack to hide the operation tool entirely */
|
/* hack to hide the operation tool entirely */
|
||||||
if (tool_type == GIMP_TYPE_OPERATION_TOOL ||
|
if (tool_type == GIMP_TYPE_OPERATION_TOOL)
|
||||||
/* Don't show the generated GEGL tools either. */
|
|
||||||
(tool_type == GIMP_TYPE_GEGL_TOOL &&
|
|
||||||
g_strcmp0 (identifier, "gimp-gegl-tool") != 0))
|
|
||||||
tool_info->hidden = TRUE;
|
tool_info->hidden = TRUE;
|
||||||
|
|
||||||
/* hack to not require experimental tools to be present in toolrc */
|
/* hack to not require experimental tools to be present in toolrc */
|
||||||
|
|
|
@ -32,12 +32,10 @@
|
||||||
#include "gegl/gimp-gegl-utils.h"
|
#include "gegl/gimp-gegl-utils.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
#include "core/gimp-filter.h"
|
|
||||||
#include "core/gimptoolinfo.h"
|
#include "core/gimptoolinfo.h"
|
||||||
|
|
||||||
#include "widgets/gimphelp-ids.h"
|
#include "widgets/gimphelp-ids.h"
|
||||||
#include "widgets/gimppropwidgets.h"
|
#include "widgets/gimppropwidgets.h"
|
||||||
#include "widgets/gimpwidgets-utils.h"
|
|
||||||
|
|
||||||
#include "gimpfilteroptions.h"
|
#include "gimpfilteroptions.h"
|
||||||
#include "gimpgegltool.h"
|
#include "gimpgegltool.h"
|
||||||
|
@ -77,10 +75,6 @@ void
|
||||||
gimp_gegl_tool_register (GimpToolRegisterCallback callback,
|
gimp_gegl_tool_register (GimpToolRegisterCallback callback,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
Gimp *gimp = GIMP (data);
|
|
||||||
GList *opclasses;
|
|
||||||
GList *iter;
|
|
||||||
|
|
||||||
(* callback) (GIMP_TYPE_GEGL_TOOL,
|
(* callback) (GIMP_TYPE_GEGL_TOOL,
|
||||||
GIMP_TYPE_FILTER_OPTIONS,
|
GIMP_TYPE_FILTER_OPTIONS,
|
||||||
gimp_color_options_gui,
|
gimp_color_options_gui,
|
||||||
|
@ -92,76 +86,6 @@ gimp_gegl_tool_register (GimpToolRegisterCallback callback,
|
||||||
NULL, GIMP_HELP_TOOL_GEGL,
|
NULL, GIMP_HELP_TOOL_GEGL,
|
||||||
GIMP_ICON_GEGL,
|
GIMP_ICON_GEGL,
|
||||||
data);
|
data);
|
||||||
|
|
||||||
/* We generate hidden tools for every non-ignored GEGL operation, allowing
|
|
||||||
* people to easily access their custom GEGL operations.
|
|
||||||
*/
|
|
||||||
opclasses = gimp_gegl_get_op_classes ();
|
|
||||||
|
|
||||||
for (iter = opclasses; iter; iter = iter->next)
|
|
||||||
{
|
|
||||||
GeglOperationClass *opclass = GEGL_OPERATION_CLASS (iter->data);
|
|
||||||
const gchar *icon_name = NULL;
|
|
||||||
const gchar *op_name = opclass->name;
|
|
||||||
const gchar *title;
|
|
||||||
const gchar *desc;
|
|
||||||
gchar *formatted_op_name;
|
|
||||||
gchar *action_name;
|
|
||||||
gchar *identifier;
|
|
||||||
gchar *label;
|
|
||||||
gint i = 2;
|
|
||||||
|
|
||||||
formatted_op_name = g_strdup (opclass->name);
|
|
||||||
gimp_make_valid_action_name (formatted_op_name);
|
|
||||||
action_name = g_strdup_printf ("tools-gegl-op-%s", formatted_op_name);
|
|
||||||
|
|
||||||
while (g_action_group_has_action (G_ACTION_GROUP (gimp->app), action_name))
|
|
||||||
{
|
|
||||||
/* In the off-chance that after formatting to a valid action name, 2
|
|
||||||
* operations end up generating the same action name.
|
|
||||||
*/
|
|
||||||
g_free (action_name);
|
|
||||||
action_name = g_strdup_printf ("tools-gegl-op-%s-%d", formatted_op_name, i++);
|
|
||||||
}
|
|
||||||
g_free (formatted_op_name);
|
|
||||||
|
|
||||||
/* gimp_tool_info_get_action_name() expects a name starting with "gimp-"
|
|
||||||
* and ending with "-tool".
|
|
||||||
*/
|
|
||||||
identifier = g_strdup_printf ("gimp-%s-tool", action_name + strlen ("tools-"));
|
|
||||||
gimp_filter_gegl_ops_add (gimp, action_name, op_name);
|
|
||||||
g_free (action_name);
|
|
||||||
|
|
||||||
if (g_str_has_prefix (op_name, "gegl:"))
|
|
||||||
icon_name = GIMP_ICON_GEGL;
|
|
||||||
|
|
||||||
if (g_str_has_prefix (op_name, "gegl:"))
|
|
||||||
op_name += strlen ("gegl:");
|
|
||||||
|
|
||||||
title = gegl_operation_class_get_key (opclass, "title");
|
|
||||||
desc = gegl_operation_class_get_key (opclass, "description");
|
|
||||||
|
|
||||||
if (title)
|
|
||||||
label = g_strdup_printf ("%s (%s)", title, op_name);
|
|
||||||
else
|
|
||||||
label = g_strdup (op_name);
|
|
||||||
|
|
||||||
(* callback) (GIMP_TYPE_GEGL_TOOL,
|
|
||||||
GIMP_TYPE_FILTER_OPTIONS,
|
|
||||||
gimp_color_options_gui,
|
|
||||||
0,
|
|
||||||
identifier,
|
|
||||||
label, desc ? desc : label,
|
|
||||||
label, NULL,
|
|
||||||
NULL, GIMP_HELP_TOOL_GEGL,
|
|
||||||
icon_name,
|
|
||||||
data);
|
|
||||||
|
|
||||||
g_free (label);
|
|
||||||
g_free (identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (opclasses);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -214,8 +138,7 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
{
|
{
|
||||||
GimpGeglTool *tool = GIMP_GEGL_TOOL (filter_tool);
|
GimpGeglTool *tool = GIMP_GEGL_TOOL (filter_tool);
|
||||||
GimpOperationTool *o_tool = GIMP_OPERATION_TOOL (filter_tool);
|
GimpOperationTool *o_tool = GIMP_OPERATION_TOOL (filter_tool);
|
||||||
GimpToolInfo *tool_info = GIMP_TOOL (tool)->tool_info;
|
GtkListStore *store;
|
||||||
GtkListStore *store = NULL;
|
|
||||||
GtkCellRenderer *cell;
|
GtkCellRenderer *cell;
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
|
@ -224,12 +147,6 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
GtkWidget *options_box;
|
GtkWidget *options_box;
|
||||||
GList *opclasses;
|
GList *opclasses;
|
||||||
GList *iter;
|
GList *iter;
|
||||||
gchar *action_name;
|
|
||||||
const gchar *show_op_name;
|
|
||||||
|
|
||||||
action_name = gimp_tool_info_get_action_name (tool_info);
|
|
||||||
show_op_name = gimp_filter_gegl_ops_get (tool_info->gimp, action_name);
|
|
||||||
g_free (action_name);
|
|
||||||
|
|
||||||
GIMP_FILTER_TOOL_CLASS (parent_class)->dialog (filter_tool);
|
GIMP_FILTER_TOOL_CLASS (parent_class)->dialog (filter_tool);
|
||||||
|
|
||||||
|
@ -244,7 +161,6 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
gtk_box_reorder_child (GTK_BOX (main_vbox), hbox, 0);
|
gtk_box_reorder_child (GTK_BOX (main_vbox), hbox, 0);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
if (show_op_name == NULL)
|
|
||||||
store = gtk_list_store_new (N_COLUMNS,
|
store = gtk_list_store_new (N_COLUMNS,
|
||||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
|
|
||||||
|
@ -258,9 +174,6 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
const gchar *title;
|
const gchar *title;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
|
|
||||||
if (show_op_name != NULL && g_strcmp0 (show_op_name, op_name) != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (g_str_has_prefix (opclass->name, "gegl:"))
|
if (g_str_has_prefix (opclass->name, "gegl:"))
|
||||||
icon_name = GIMP_ICON_GEGL;
|
icon_name = GIMP_ICON_GEGL;
|
||||||
|
|
||||||
|
@ -274,33 +187,17 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
else
|
else
|
||||||
label = g_strdup (op_name);
|
label = g_strdup (op_name);
|
||||||
|
|
||||||
if (store != NULL)
|
|
||||||
gtk_list_store_insert_with_values (store, NULL, -1,
|
gtk_list_store_insert_with_values (store, NULL, -1,
|
||||||
COLUMN_NAME, opclass->name,
|
COLUMN_NAME, opclass->name,
|
||||||
COLUMN_LABEL, label,
|
COLUMN_LABEL, label,
|
||||||
COLUMN_ICON_NAME, icon_name,
|
COLUMN_ICON_NAME, icon_name,
|
||||||
-1);
|
-1);
|
||||||
else
|
|
||||||
gimp_operation_tool_set_operation (GIMP_OPERATION_TOOL (tool),
|
|
||||||
opclass->name,
|
|
||||||
label,
|
|
||||||
gegl_operation_class_get_key (opclass, "description"),
|
|
||||||
NULL,
|
|
||||||
icon_name,
|
|
||||||
GIMP_HELP_TOOL_GEGL);
|
|
||||||
|
|
||||||
g_free (label);
|
g_free (label);
|
||||||
|
|
||||||
if (show_op_name != NULL)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free (opclasses);
|
g_list_free (opclasses);
|
||||||
|
|
||||||
/* We either show the full combo or we found a specific operation. */
|
|
||||||
g_return_if_fail (store != NULL || iter != NULL);
|
|
||||||
|
|
||||||
if (store != NULL)
|
|
||||||
{
|
|
||||||
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
|
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
|
||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
||||||
|
@ -324,7 +221,6 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
tool);
|
tool);
|
||||||
|
|
||||||
tool->operation_combo = combo;
|
tool->operation_combo = combo;
|
||||||
}
|
|
||||||
|
|
||||||
tool->description_label = gtk_label_new ("");
|
tool->description_label = gtk_label_new ("");
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (tool->description_label), TRUE);
|
gtk_label_set_line_wrap (GTK_LABEL (tool->description_label), TRUE);
|
||||||
|
|
Loading…
Reference in New Issue