mirror of https://github.com/GNOME/gimp.git
fixed Bug # 147483 (gimpressionist will delete global presets if the user
* plug-ins/gimpressionist/presets.c: fixed Bug # 147483 (gimpressionist will delete global presets if the user running GIMP has priviliges to do so ). This was done by creating a function to check if a preset is global, and by making sure the delete button is in-sensitive when this is the case.
This commit is contained in:
parent
45a7f5e459
commit
00645d1018
|
@ -1,3 +1,11 @@
|
|||
2004-07-13 Shlomi Fish <shlomif@iglu.org.il>
|
||||
|
||||
* plug-ins/gimpressionist/presets.c: fixed Bug # 147483 (gimpressionist
|
||||
will delete global presets if the user running GIMP has priviliges to
|
||||
do so ). This was done by creating a function to check if a preset is
|
||||
global, and by making sure the delete button is in-sensitive when this
|
||||
is the case.
|
||||
|
||||
2004-07-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpcolorbutton.c
|
||||
|
|
|
@ -29,10 +29,27 @@ static GtkWidget *presetnameentry = NULL;
|
|||
static GtkWidget *presetlist = NULL;
|
||||
static GtkWidget *presetdesclabel = NULL;
|
||||
static GtkWidget *presetsavebutton = NULL;
|
||||
static GtkWidget *delete_button = NULL;
|
||||
static GtkListStore *store;
|
||||
static gchar *selected_preset_orig_name = NULL;
|
||||
static gchar *selected_preset_filename = NULL;
|
||||
|
||||
static gboolean can_delete_preset (const gchar *abs)
|
||||
{
|
||||
gchar *user_data_dir;
|
||||
gboolean ret;
|
||||
|
||||
user_data_dir = g_strconcat (gimp_directory (),
|
||||
G_DIR_SEPARATOR_S,
|
||||
NULL);
|
||||
|
||||
|
||||
ret = (!strncmp (abs, user_data_dir, strlen (user_data_dir)));
|
||||
|
||||
g_free (user_data_dir);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void preset_save_button_set_sensitive (gboolean s)
|
||||
{
|
||||
|
@ -488,8 +505,13 @@ static void deletepreset(GtkWidget *w, GtkTreeSelection *selection)
|
|||
g_free (rel);
|
||||
|
||||
if (abs)
|
||||
{
|
||||
/* Don't delete global presets - bug # 147483 */
|
||||
if (can_delete_preset (abs))
|
||||
{
|
||||
unlink (abs);
|
||||
}
|
||||
|
||||
g_free (abs);
|
||||
}
|
||||
|
||||
|
@ -772,11 +794,22 @@ static void readdesc(const char *fn)
|
|||
g_free (rel_fname);
|
||||
|
||||
if (!fname)
|
||||
{
|
||||
if (!strcmp (fn, factory_defaults))
|
||||
{
|
||||
gtk_widget_set_sensitive (delete_button, FALSE);
|
||||
set_preset_description_text (_("The Gimpressionist Defaults"));
|
||||
}
|
||||
else
|
||||
{
|
||||
set_preset_description_text("");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't delete global presets - bug # 147483 */
|
||||
gtk_widget_set_sensitive (delete_button, can_delete_preset (fname));
|
||||
|
||||
f = fopen(fname, "rt");
|
||||
g_free(fname);
|
||||
if (f)
|
||||
|
@ -937,7 +970,7 @@ void create_presetpage(GtkNotebook *notebook)
|
|||
gimp_help_set_help_data
|
||||
(tmpw, _("Reads the selected Preset into memory"), NULL);
|
||||
|
||||
tmpw = gtk_button_new_from_stock (GTK_STOCK_DELETE);
|
||||
tmpw = delete_button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
|
||||
gtk_box_pack_start(GTK_BOX(box2), tmpw, FALSE, FALSE,0);
|
||||
gtk_widget_show (tmpw);
|
||||
g_signal_connect (tmpw, "clicked", G_CALLBACK(deletepreset), selection);
|
||||
|
|
Loading…
Reference in New Issue