Commit 690c919c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

don't attempt to store a pointer to the last used filename in the plug-in

2004-07-04  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/channel_mixer.c: don't attempt to store a
	pointer to the last used filename in the plug-in parameter
	struct. Fixes bug #145380.
parent 21fea37d
2004-07-04 Sven Neumann <sven@gimp.org>
* plug-ins/common/channel_mixer.c: don't attempt to store a
pointer to the last used filename in the plug-in parameter
struct. Fixes bug #145380.
2004-07-04 Sven Neumann <sven@gimp.org>
* modules/cdisplay_gamma.c
......
......@@ -83,8 +83,6 @@ typedef struct
CmModeType output_channel;
gchar *filename;
GtkAdjustment *red_data;
GtkAdjustment *green_data;
GtkAdjustment *blue_data;
......@@ -977,32 +975,12 @@ cm_preserve_luminosity_callback (GtkWidget *widget,
}
static gchar *
cm_settings_filename (CmParamsType *mix)
cm_settings_filename (void)
{
gchar *filename;
if (! mix->filename)
mix->filename = g_strdup ("settings");
if (! g_path_is_absolute (mix->filename))
{
gchar *basedir;
basedir = g_build_filename (gimp_directory (), "channel-mixer", NULL);
if (! g_file_test (basedir, G_FILE_TEST_IS_DIR))
mkdir (basedir, 0775);
filename = g_build_filename (basedir, mix->filename, NULL);
g_free (basedir);
}
else
{
filename = g_strdup (mix->filename);
}
return filename;
return g_build_filename (gimp_directory (),
"channel-mixer",
"settings",
NULL);
}
static void
......@@ -1011,11 +989,10 @@ cm_load_file_callback (GtkWidget *widget,
{
static GtkWidget *dialog = NULL;
gchar *name;
if (! dialog)
{
GtkWidget *parent = gtk_widget_get_toplevel (widget);
gchar *name;
dialog =
gtk_file_chooser_dialog_new (_("Load Channel Mixer Settings"),
......@@ -1035,11 +1012,11 @@ cm_load_file_callback (GtkWidget *widget,
g_signal_connect (dialog, "delete_event",
G_CALLBACK (gtk_true),
NULL);
}
name = cm_settings_filename (mix);
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), name);
g_free (name);
name = cm_settings_filename ();
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), name);
g_free (name);
}
gtk_window_present (GTK_WINDOW (dialog));
}
......@@ -1053,12 +1030,11 @@ cm_load_file_response_callback (GtkWidget *dialog,
if (response_id == GTK_RESPONSE_OK)
{
g_free (mix->filename);
gchar *filename;
mix->filename =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
fp = fopen (mix->filename, "r");
fp = fopen (filename, "r");
if (fp)
{
......@@ -1137,9 +1113,11 @@ cm_load_file_response_callback (GtkWidget *dialog,
else
{
g_message (_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (mix->filename),
gimp_filename_to_utf8 (filename),
g_strerror (errno));
}
g_free (filename);
}
gtk_widget_hide (dialog);
......@@ -1151,11 +1129,10 @@ cm_save_file_callback (GtkWidget *widget,
{
static GtkWidget *dialog = NULL;
gchar *name;
if (! dialog)
{
GtkWidget *parent = gtk_widget_get_toplevel (widget);
gchar *name;
dialog =
gtk_file_chooser_dialog_new (_("Save Channel Mixer Settings"),
......@@ -1175,11 +1152,11 @@ cm_save_file_callback (GtkWidget *widget,
g_signal_connect (dialog, "delete_event",
G_CALLBACK (gtk_true),
NULL);
}
name = cm_settings_filename (mix);
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), name);
g_free (name);
name = cm_settings_filename ();
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), name);
g_free (name);
}
gtk_window_present (GTK_WINDOW (dialog));
}
......@@ -1219,12 +1196,9 @@ cm_save_file_response_callback (GtkWidget *dialog,
return;
}
g_free (mix->filename);
mix->filename = filename;
cm_save_file (mix, file);
g_message (_("Parameters were Saved to '%s'"),
g_message (_("Parameters were saved to '%s'"),
gimp_filename_to_utf8 (filename));
gtk_widget_hide (dialog);
......
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