mirror of https://github.com/GNOME/gimp.git
Bug 599573 - Remember dialog defaults between Gimp sessions
Remember the "New Path" dialog settings in GimpDialogConfig.
This commit is contained in:
parent
8132d51b29
commit
2ae3393c3b
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include "actions-types.h"
|
#include "actions-types.h"
|
||||||
|
|
||||||
|
#include "config/gimpdialogconfig.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
#include "core/gimp-utils.h"
|
#include "core/gimp-utils.h"
|
||||||
#include "core/gimpchannel.h"
|
#include "core/gimpchannel.h"
|
||||||
|
@ -86,7 +88,6 @@ static void vectors_export_response (GtkWidget *widget,
|
||||||
|
|
||||||
/* private variables */
|
/* private variables */
|
||||||
|
|
||||||
static gchar *vectors_name = NULL;
|
|
||||||
static gboolean vectors_import_merge = FALSE;
|
static gboolean vectors_import_merge = FALSE;
|
||||||
static gboolean vectors_import_scale = FALSE;
|
static gboolean vectors_import_scale = FALSE;
|
||||||
static gboolean vectors_export_active_only = TRUE;
|
static gboolean vectors_export_active_only = TRUE;
|
||||||
|
@ -156,14 +157,16 @@ vectors_new_cmd_callback (GtkAction *action,
|
||||||
VectorsOptionsDialog *options;
|
VectorsOptionsDialog *options;
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
GimpDialogConfig *config;
|
||||||
return_if_no_image (image, data);
|
return_if_no_image (image, data);
|
||||||
return_if_no_widget (widget, data);
|
return_if_no_widget (widget, data);
|
||||||
|
|
||||||
|
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||||
|
|
||||||
options = vectors_options_dialog_new (image, NULL,
|
options = vectors_options_dialog_new (image, NULL,
|
||||||
action_data_get_context (data),
|
action_data_get_context (data),
|
||||||
widget,
|
widget,
|
||||||
vectors_name ? vectors_name :
|
config->vectors_new_name,
|
||||||
_("Path"),
|
|
||||||
_("New Path"),
|
_("New Path"),
|
||||||
"gimp-vectors-new",
|
"gimp-vectors-new",
|
||||||
GIMP_STOCK_PATH,
|
GIMP_STOCK_PATH,
|
||||||
|
@ -182,12 +185,15 @@ vectors_new_last_vals_cmd_callback (GtkAction *action,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
GimpVectors *new_vectors;
|
GimpVectors *vectors;
|
||||||
|
GimpDialogConfig *config;
|
||||||
return_if_no_image (image, data);
|
return_if_no_image (image, data);
|
||||||
|
|
||||||
new_vectors = gimp_vectors_new (image, vectors_name);
|
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||||
|
|
||||||
gimp_image_add_vectors (image, new_vectors,
|
vectors = gimp_vectors_new (image, config->vectors_new_name);
|
||||||
|
|
||||||
|
gimp_image_add_vectors (image, vectors,
|
||||||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||||
|
|
||||||
gimp_image_flush (image);
|
gimp_image_flush (image);
|
||||||
|
@ -752,27 +758,29 @@ vectors_lock_position_cmd_callback (GtkAction *action,
|
||||||
static void
|
static void
|
||||||
vectors_new_vectors_response (GtkWidget *widget,
|
vectors_new_vectors_response (GtkWidget *widget,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
VectorsOptionsDialog *options)
|
VectorsOptionsDialog *dialog)
|
||||||
{
|
{
|
||||||
if (response_id == GTK_RESPONSE_OK)
|
if (response_id == GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
GimpVectors *new_vectors;
|
GimpDialogConfig *config;
|
||||||
|
GimpVectors *vectors;
|
||||||
|
|
||||||
if (vectors_name)
|
config = GIMP_DIALOG_CONFIG (dialog->image->gimp->config);
|
||||||
g_free (vectors_name);
|
|
||||||
|
|
||||||
vectors_name =
|
g_object_set (config,
|
||||||
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
|
"path-new-name",
|
||||||
|
gtk_entry_get_text (GTK_ENTRY (dialog->name_entry)),
|
||||||
|
NULL);
|
||||||
|
|
||||||
new_vectors = gimp_vectors_new (options->image, vectors_name);
|
vectors = gimp_vectors_new (dialog->image, config->vectors_new_name);
|
||||||
|
|
||||||
gimp_image_add_vectors (options->image, new_vectors,
|
gimp_image_add_vectors (dialog->image, vectors,
|
||||||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||||
|
|
||||||
gimp_image_flush (options->image);
|
gimp_image_flush (dialog->image);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy (options->dialog);
|
gtk_widget_destroy (dialog->dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -48,7 +48,9 @@ enum
|
||||||
PROP_LAYER_ADD_MASK_INVERT,
|
PROP_LAYER_ADD_MASK_INVERT,
|
||||||
|
|
||||||
PROP_CHANNEL_NEW_NAME,
|
PROP_CHANNEL_NEW_NAME,
|
||||||
PROP_CHANNEL_NEW_COLOR
|
PROP_CHANNEL_NEW_COLOR,
|
||||||
|
|
||||||
|
PROP_VECTORS_NEW_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,6 +132,13 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
|
||||||
TRUE,
|
TRUE,
|
||||||
&half_transparent,
|
&half_transparent,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
GIMP_CONFIG_PROP_STRING (object_class, PROP_VECTORS_NEW_NAME,
|
||||||
|
"path-new-name",
|
||||||
|
"Default new path name",
|
||||||
|
VECTORS_NEW_NAME_BLURB,
|
||||||
|
_("Path"),
|
||||||
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -154,6 +163,12 @@ gimp_dialog_config_finalize (GObject *object)
|
||||||
config->channel_new_name = NULL;
|
config->channel_new_name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config->vectors_new_name)
|
||||||
|
{
|
||||||
|
g_free (config->vectors_new_name);
|
||||||
|
config->vectors_new_name = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,6 +211,12 @@ gimp_dialog_config_set_property (GObject *object,
|
||||||
gimp_value_get_rgb (value, &config->channel_new_color);
|
gimp_value_get_rgb (value, &config->channel_new_color);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_VECTORS_NEW_NAME:
|
||||||
|
if (config->vectors_new_name)
|
||||||
|
g_free (config->vectors_new_name);
|
||||||
|
config->vectors_new_name = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -237,6 +258,10 @@ gimp_dialog_config_get_property (GObject *object,
|
||||||
gimp_value_set_rgb (value, &config->channel_new_color);
|
gimp_value_set_rgb (value, &config->channel_new_color);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_VECTORS_NEW_NAME:
|
||||||
|
g_value_set_string (value, config->vectors_new_name);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -47,6 +47,8 @@ struct _GimpDialogConfig
|
||||||
|
|
||||||
gchar *channel_new_name;
|
gchar *channel_new_name;
|
||||||
GimpRGB channel_new_color;
|
GimpRGB channel_new_color;
|
||||||
|
|
||||||
|
gchar *vectors_new_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpDialogConfigClass
|
struct _GimpDialogConfigClass
|
||||||
|
|
|
@ -438,6 +438,9 @@ _("Sets the default channel name for the 'New Channel' dialog.")
|
||||||
#define CHANNEL_NEW_COLOR_BLURB \
|
#define CHANNEL_NEW_COLOR_BLURB \
|
||||||
_("Sets the default color and opacity for the 'New Channel' dialog.")
|
_("Sets the default color and opacity for the 'New Channel' dialog.")
|
||||||
|
|
||||||
|
#define VECTORS_NEW_NAME_BLURB \
|
||||||
|
_("Sets the default path name for the 'New Path' dialog.")
|
||||||
|
|
||||||
#define THUMBNAIL_SIZE_BLURB \
|
#define THUMBNAIL_SIZE_BLURB \
|
||||||
_("Sets the size of the thumbnail shown in the Open dialog.")
|
_("Sets the size of the thumbnail shown in the Open dialog.")
|
||||||
|
|
||||||
|
|
|
@ -1650,16 +1650,13 @@ prefs_dialog_new (Gimp *gimp,
|
||||||
/* Quick Mask Color */
|
/* Quick Mask Color */
|
||||||
vbox2 = prefs_frame_new (_("Quick Mask"), GTK_CONTAINER (vbox), FALSE);
|
vbox2 = prefs_frame_new (_("Quick Mask"), GTK_CONTAINER (vbox), FALSE);
|
||||||
table = prefs_table_new (1, GTK_CONTAINER (vbox2));
|
table = prefs_table_new (1, GTK_CONTAINER (vbox2));
|
||||||
button = gimp_prop_color_button_new (object, "quick-mask-color",
|
|
||||||
|
button = prefs_color_button_add (object, "quick-mask-color",
|
||||||
|
_("Quick Mask color:"),
|
||||||
_("Set the default Quick Mask color"),
|
_("Set the default Quick Mask color"),
|
||||||
COLOR_BUTTON_WIDTH,
|
GTK_TABLE (table), 0, NULL);
|
||||||
COLOR_BUTTON_HEIGHT,
|
|
||||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
|
||||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
|
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
|
||||||
gimp_get_user_context (gimp));
|
gimp_get_user_context (gimp));
|
||||||
prefs_widget_add_aligned (button, _("Quick Mask color:"),
|
|
||||||
GTK_TABLE (table), 0, TRUE, NULL);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
@ -2052,9 +2049,10 @@ prefs_dialog_new (Gimp *gimp,
|
||||||
table = prefs_table_new (2, GTK_CONTAINER (vbox2));
|
table = prefs_table_new (2, GTK_CONTAINER (vbox2));
|
||||||
|
|
||||||
entry = gimp_prop_entry_new (object, "layer-new-name", -1);
|
entry = gimp_prop_entry_new (object, "layer-new-name", -1);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
prefs_widget_add_aligned (entry,
|
||||||
_("Layer name:"), 0.0, 0.5,
|
_("Layer name:"),
|
||||||
entry, 1, FALSE);
|
GTK_WIDGET (table), 0, FALSE,
|
||||||
|
size_group);
|
||||||
|
|
||||||
prefs_enum_combo_box_add (object, "layer-new-fill-type", 0, 0,
|
prefs_enum_combo_box_add (object, "layer-new-fill-type", 0, 0,
|
||||||
_("Fill type:"),
|
_("Fill type:"),
|
||||||
|
@ -2079,9 +2077,10 @@ prefs_dialog_new (Gimp *gimp,
|
||||||
table = prefs_table_new (2, GTK_CONTAINER (vbox2));
|
table = prefs_table_new (2, GTK_CONTAINER (vbox2));
|
||||||
|
|
||||||
entry = gimp_prop_entry_new (object, "channel-new-name", -1);
|
entry = gimp_prop_entry_new (object, "channel-new-name", -1);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
prefs_widget_add_aligned (entry,
|
||||||
_("Channel name:"), 0.0, 0.5,
|
_("Channel name:"),
|
||||||
entry, 1, FALSE);
|
GTK_WIDGET (table), 0, FALSE,
|
||||||
|
size_group);
|
||||||
|
|
||||||
button = prefs_color_button_add (object, "channel-new-color",
|
button = prefs_color_button_add (object, "channel-new-color",
|
||||||
_("Color and opacity:"),
|
_("Color and opacity:"),
|
||||||
|
@ -2090,6 +2089,17 @@ prefs_dialog_new (Gimp *gimp,
|
||||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
|
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
|
||||||
gimp_get_user_context (gimp));
|
gimp_get_user_context (gimp));
|
||||||
|
|
||||||
|
/* New Path Dialog */
|
||||||
|
vbox2 = prefs_frame_new (_("New Path Dialog"),
|
||||||
|
GTK_CONTAINER (vbox), FALSE);
|
||||||
|
table = prefs_table_new (1, GTK_CONTAINER (vbox2));
|
||||||
|
|
||||||
|
entry = gimp_prop_entry_new (object, "path-new-name", -1);
|
||||||
|
prefs_widget_add_aligned (entry,
|
||||||
|
_("Path name:"),
|
||||||
|
GTK_WIDGET (table), 0, FALSE,
|
||||||
|
size_group);
|
||||||
|
|
||||||
g_object_unref (size_group);
|
g_object_unref (size_group);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue