mirror of https://github.com/GNOME/gimp.git
app: register the "settings folder" (e.g. GIMPDIR/curves) with the settings type
and remove all settings_folder API and values from GimpFilterTool and its subclasses.
This commit is contained in:
parent
82d23fc6ff
commit
4f4d6b27cf
|
@ -106,6 +106,16 @@ set_compat_file (GType type,
|
|||
g_type_set_qdata (type, quark, file);
|
||||
}
|
||||
|
||||
static void
|
||||
set_settings_folder (GType type,
|
||||
const gchar *basename)
|
||||
{
|
||||
GFile *file = gimp_directory_file (basename, NULL);
|
||||
GQuark quark = g_quark_from_static_string ("settings-folder");
|
||||
|
||||
g_type_set_qdata (type, quark, file);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_operations_init (Gimp *gimp)
|
||||
{
|
||||
|
@ -173,34 +183,46 @@ gimp_operations_init (Gimp *gimp)
|
|||
GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG);
|
||||
set_compat_file (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
|
||||
"gimp-brightness-contrast-tool.settings");
|
||||
set_settings_folder (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
|
||||
"brightness-contrast");
|
||||
|
||||
gimp_operation_config_register (gimp,
|
||||
"gimp:color-balance",
|
||||
GIMP_TYPE_COLOR_BALANCE_CONFIG);
|
||||
set_compat_file (GIMP_TYPE_COLOR_BALANCE_CONFIG,
|
||||
"gimp-color-balance-tool.settings");
|
||||
set_settings_folder (GIMP_TYPE_COLOR_BALANCE_CONFIG,
|
||||
"color-balance");
|
||||
|
||||
gimp_operation_config_register (gimp,
|
||||
"gimp:colorize",
|
||||
GIMP_TYPE_COLORIZE_CONFIG);
|
||||
set_compat_file (GIMP_TYPE_COLORIZE_CONFIG,
|
||||
"gimp-colorize-tool.settings");
|
||||
set_settings_folder (GIMP_TYPE_COLORIZE_CONFIG,
|
||||
"colorize");
|
||||
|
||||
gimp_operation_config_register (gimp,
|
||||
"gimp:curves",
|
||||
GIMP_TYPE_CURVES_CONFIG);
|
||||
set_compat_file (GIMP_TYPE_CURVES_CONFIG,
|
||||
"gimp-curves-tool.settings");
|
||||
set_settings_folder (GIMP_TYPE_CURVES_CONFIG,
|
||||
"curves");
|
||||
|
||||
gimp_operation_config_register (gimp,
|
||||
"gimp:hue-saturation",
|
||||
GIMP_TYPE_HUE_SATURATION_CONFIG);
|
||||
set_compat_file (GIMP_TYPE_HUE_SATURATION_CONFIG,
|
||||
"gimp-hue-saturation-tool.settings");
|
||||
set_settings_folder (GIMP_TYPE_HUE_SATURATION_CONFIG,
|
||||
"hue-saturation");
|
||||
|
||||
gimp_operation_config_register (gimp,
|
||||
"gimp:levels",
|
||||
GIMP_TYPE_LEVELS_CONFIG);
|
||||
set_compat_file (GIMP_TYPE_LEVELS_CONFIG,
|
||||
"gimp-levels-tool.settings");
|
||||
set_settings_folder (GIMP_TYPE_LEVELS_CONFIG,
|
||||
"levels");
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@ static gchar *
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title);
|
||||
static void gimp_brightness_contrast_tool_dialog (GimpFilterTool *filter_tool);
|
||||
|
@ -170,13 +169,11 @@ gimp_brightness_contrast_tool_get_operation (GimpFilterTool *filter_tool,
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title)
|
||||
{
|
||||
*description = g_strdup (_("Adjust Brightness and Contrast"));
|
||||
*has_settings = TRUE;
|
||||
*settings_folder = g_strdup ("brightness-contrast");
|
||||
*import_dialog_title = g_strdup (_("Import Brightness-Contrast settings"));
|
||||
*export_dialog_title = g_strdup (_("Export Brightness-Contrast settings"));
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ static gchar * gimp_curves_tool_get_operation (GimpFilterTool *filter
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title);
|
||||
static void gimp_curves_tool_dialog (GimpFilterTool *filter_tool);
|
||||
|
@ -370,13 +369,11 @@ gimp_curves_tool_get_operation (GimpFilterTool *filter_tool,
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title)
|
||||
{
|
||||
*description = g_strdup (_("Adjust Color Curves"));
|
||||
*has_settings = TRUE;
|
||||
*settings_folder = g_strdup ("curves");
|
||||
*import_dialog_title = g_strdup (_("Import Curves"));
|
||||
*export_dialog_title = g_strdup (_("Export Curves"));
|
||||
|
||||
|
|
|
@ -66,17 +66,22 @@ GtkWidget *
|
|||
gimp_filter_tool_get_settings_box (GimpFilterTool *filter_tool)
|
||||
{
|
||||
GimpToolInfo *tool_info = GIMP_TOOL (filter_tool)->tool_info;
|
||||
GQuark quark = g_quark_from_static_string ("settings-folder");
|
||||
GType type = G_TYPE_FROM_INSTANCE (filter_tool->config);
|
||||
GFile *settings_folder;
|
||||
GtkWidget *box;
|
||||
GtkWidget *label;
|
||||
GtkWidget *combo;
|
||||
|
||||
settings_folder = g_type_get_qdata (type, quark);
|
||||
|
||||
box = gimp_settings_box_new (tool_info->gimp,
|
||||
filter_tool->config,
|
||||
filter_tool->settings,
|
||||
filter_tool->import_dialog_title,
|
||||
filter_tool->export_dialog_title,
|
||||
filter_tool->help_id,
|
||||
filter_tool->settings_folder,
|
||||
settings_folder,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (box, "import",
|
||||
|
|
|
@ -277,12 +277,6 @@ gimp_filter_tool_finalize (GObject *object)
|
|||
filter_tool->help_id = NULL;
|
||||
}
|
||||
|
||||
if (filter_tool->settings_folder)
|
||||
{
|
||||
g_object_unref (filter_tool->settings_folder);
|
||||
filter_tool->settings_folder = NULL;
|
||||
}
|
||||
|
||||
if (filter_tool->import_dialog_title)
|
||||
{
|
||||
g_free (filter_tool->import_dialog_title);
|
||||
|
@ -1226,7 +1220,6 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
|
|||
GimpFilterToolClass *klass;
|
||||
GimpToolInfo *tool_info;
|
||||
gchar *operation_name;
|
||||
gchar *settings_folder = NULL;
|
||||
|
||||
g_return_if_fail (GIMP_IS_FILTER_TOOL (filter_tool));
|
||||
|
||||
|
@ -1299,12 +1292,6 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
|
|||
filter_tool->help_id = NULL;
|
||||
}
|
||||
|
||||
if (filter_tool->settings_folder)
|
||||
{
|
||||
g_object_unref (filter_tool->settings_folder);
|
||||
filter_tool->settings_folder = NULL;
|
||||
}
|
||||
|
||||
if (filter_tool->import_dialog_title)
|
||||
{
|
||||
g_free (filter_tool->import_dialog_title);
|
||||
|
@ -1324,7 +1311,6 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
|
|||
&filter_tool->icon_name,
|
||||
&filter_tool->help_id,
|
||||
&filter_tool->has_settings,
|
||||
&settings_folder,
|
||||
&filter_tool->import_dialog_title,
|
||||
&filter_tool->export_dialog_title);
|
||||
|
||||
|
@ -1347,13 +1333,6 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
|
|||
if (! filter_tool->help_id)
|
||||
filter_tool->help_id = g_strdup (tool_info->help_id);
|
||||
|
||||
if (settings_folder)
|
||||
{
|
||||
filter_tool->settings_folder = gimp_directory_file (settings_folder,
|
||||
NULL);
|
||||
g_free (settings_folder);
|
||||
}
|
||||
|
||||
filter_tool->operation = gegl_node_new_child (NULL,
|
||||
"operation", operation_name,
|
||||
NULL);
|
||||
|
@ -1433,6 +1412,12 @@ gimp_filter_tool_set_has_settings (GimpFilterTool *filter_tool,
|
|||
{
|
||||
if (filter_tool->has_settings)
|
||||
{
|
||||
GQuark quark = g_quark_from_static_string ("settings-folder");
|
||||
GType type = G_TYPE_FROM_INSTANCE (filter_tool->config);
|
||||
GFile *settings_folder;
|
||||
|
||||
settings_folder = g_type_get_qdata (type, quark);
|
||||
|
||||
g_object_set (filter_tool->settings_box,
|
||||
"visible", TRUE,
|
||||
"config", filter_tool->config,
|
||||
|
@ -1440,7 +1425,7 @@ gimp_filter_tool_set_has_settings (GimpFilterTool *filter_tool,
|
|||
"help-id", filter_tool->help_id,
|
||||
"import-title", filter_tool->import_dialog_title,
|
||||
"export-title", filter_tool->export_dialog_title,
|
||||
"default-folder", filter_tool->settings_folder,
|
||||
"default-folder", settings_folder,
|
||||
"last-file", NULL,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ struct _GimpFilterTool
|
|||
gchar *help_id;
|
||||
|
||||
gboolean has_settings;
|
||||
GFile *settings_folder;
|
||||
gchar *import_dialog_title;
|
||||
gchar *export_dialog_title;
|
||||
|
||||
|
@ -83,7 +82,6 @@ struct _GimpFilterToolClass
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title);
|
||||
void (* dialog) (GimpFilterTool *filter_tool);
|
||||
|
|
|
@ -79,7 +79,6 @@ static gchar * gimp_levels_tool_get_operation (GimpFilterTool *filter_tool
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title);
|
||||
static void gimp_levels_tool_dialog (GimpFilterTool *filter_tool);
|
||||
|
@ -261,13 +260,11 @@ gimp_levels_tool_get_operation (GimpFilterTool *filter_tool,
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title)
|
||||
{
|
||||
*description = g_strdup (_("Adjust Color Levels"));
|
||||
*has_settings = TRUE;
|
||||
*settings_folder = g_strdup ("levels");
|
||||
*import_dialog_title = g_strdup (_("Import Levels"));
|
||||
*export_dialog_title = g_strdup (_("Export Levels"));
|
||||
|
||||
|
|
|
@ -85,7 +85,6 @@ static gchar * gimp_operation_tool_get_operation (GimpFilterTool *filte
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title);
|
||||
static void gimp_operation_tool_dialog (GimpFilterTool *filter_tool);
|
||||
|
@ -261,7 +260,6 @@ gimp_operation_tool_get_operation (GimpFilterTool *filter_tool,
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,6 @@ static gchar * gimp_threshold_tool_get_operation (GimpFilterTool *filter
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title);
|
||||
static void gimp_threshold_tool_dialog (GimpFilterTool *filter_tool);
|
||||
|
@ -177,13 +176,11 @@ gimp_threshold_tool_get_operation (GimpFilterTool *filter_tool,
|
|||
gchar **icon_name,
|
||||
gchar **help_id,
|
||||
gboolean *has_settings,
|
||||
gchar **settings_folder,
|
||||
gchar **import_dialog_title,
|
||||
gchar **export_dialog_title)
|
||||
{
|
||||
*description = g_strdup (_("Apply Threshold"));
|
||||
*has_settings = TRUE;
|
||||
*settings_folder = g_strdup ("threshold");
|
||||
*import_dialog_title = g_strdup (_("Import Threshold Settings"));
|
||||
*export_dialog_title = g_strdup (_("Export Threshold Settings"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue