mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 19:43:01 +00:00
migrate gimp-2.2 settings if available. Pass the version to
2005-02-20 Sven Neumann <sven@gimp.org> * app/dialogs/user-install-dialog.c: migrate gimp-2.2 settings if available. Pass the version to gimp_templates_migrate(). * app/core/gimp-templates.[ch] (gimp_templates_migrate): if migrating templaterc from ~/.gimp-2.0, do a case-insensitive match on template names to accommodate for the fact that we changed the spelling of some default templates between 2.0 and 2.2.
This commit is contained in:
parent
15ac13e2c4
commit
17e7e13e58
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2005-02-20 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/dialogs/user-install-dialog.c: migrate gimp-2.2 settings if
|
||||
available. Pass the version to gimp_templates_migrate().
|
||||
|
||||
* app/core/gimp-templates.[ch] (gimp_templates_migrate): if
|
||||
migrating templaterc from ~/.gimp-2.0, do a case-insensitive match
|
||||
on template names to accommodate for the fact that we changed the
|
||||
spelling of some default templates between 2.0 and 2.2.
|
||||
|
||||
2005-02-19 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimptexttool.c (gimp_text_tool_create_layer): block
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -105,8 +107,28 @@ gimp_templates_save (Gimp *gimp)
|
|||
}
|
||||
|
||||
|
||||
/* just like gimp_list_get_child_by_name() but matches case-insensitive */
|
||||
static GimpObject *
|
||||
gimp_templates_migrate_get_child_by_name (const GimpContainer *container,
|
||||
const gchar *name)
|
||||
{
|
||||
GimpList *list = GIMP_LIST (container);
|
||||
GList *glist;
|
||||
|
||||
for (glist = list->list; glist; glist = g_list_next (glist))
|
||||
{
|
||||
GimpObject *object = glist->data;
|
||||
|
||||
if (! g_ascii_strcasecmp (object->name, name))
|
||||
return object;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_templates_migrate:
|
||||
* @olddir: the old user directory
|
||||
*
|
||||
* Migrating the templaterc from GIMP 2.0 to GIMP 2.2 needs this special
|
||||
* hack since we changed the way that units are handled. This function
|
||||
|
@ -114,7 +136,7 @@ gimp_templates_save (Gimp *gimp)
|
|||
* is to replace the unit for a couple of default templates with "pixels".
|
||||
**/
|
||||
void
|
||||
gimp_templates_migrate (void)
|
||||
gimp_templates_migrate (const gchar *olddir)
|
||||
{
|
||||
GimpContainer *templates = gimp_list_new (GIMP_TYPE_TEMPLATE, TRUE);
|
||||
gchar *filename = gimp_personal_rc_file ("templaterc");
|
||||
|
@ -125,7 +147,26 @@ gimp_templates_migrate (void)
|
|||
gchar *tmp = g_build_filename (gimp_sysconf_directory (),
|
||||
"templaterc", NULL);
|
||||
|
||||
gimp_config_deserialize_file (GIMP_CONFIG (templates), tmp, NULL, NULL);
|
||||
if (olddir && strstr (olddir, "2.0"))
|
||||
{
|
||||
/* We changed the spelling of a couple of template names
|
||||
* from upper to lower case between 2.0 and 2.2.
|
||||
*/
|
||||
GimpContainerClass *class = GIMP_CONTAINER_GET_CLASS (templates);
|
||||
gpointer func = class->get_child_by_name;
|
||||
|
||||
class->get_child_by_name = gimp_templates_migrate_get_child_by_name;
|
||||
|
||||
gimp_config_deserialize_file (GIMP_CONFIG (templates),
|
||||
tmp, NULL, NULL);
|
||||
|
||||
class->get_child_by_name = func;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_config_deserialize_file (GIMP_CONFIG (templates),
|
||||
tmp, NULL, NULL);
|
||||
}
|
||||
|
||||
g_free (tmp);
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#define __GIMP_TEMPLATES_H__
|
||||
|
||||
|
||||
void gimp_templates_load (Gimp *gimp);
|
||||
void gimp_templates_save (Gimp *gimp);
|
||||
void gimp_templates_load (Gimp *gimp);
|
||||
void gimp_templates_save (Gimp *gimp);
|
||||
|
||||
void gimp_templates_migrate (void);
|
||||
void gimp_templates_migrate (const gchar *olddir);
|
||||
|
||||
|
||||
#endif /* __GIMP_TEMPLATES_H__ */
|
||||
|
|
|
@ -592,12 +592,19 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
|
|||
oldgimp = g_strdup (gimp_directory ());
|
||||
|
||||
/* FIXME */
|
||||
version = strstr (oldgimp, "2.2");
|
||||
if (version)
|
||||
version[2] = '0';
|
||||
version = strstr (oldgimp, "2.3");
|
||||
|
||||
if (version)
|
||||
version[2] = '2';
|
||||
migrate = (version && g_file_test (oldgimp, G_FILE_TEST_IS_DIR));
|
||||
|
||||
if (! migrate)
|
||||
{
|
||||
if (version)
|
||||
version[2] = '0';
|
||||
migrate = (version && g_file_test (oldgimp, G_FILE_TEST_IS_DIR));
|
||||
}
|
||||
|
||||
if (! migrate)
|
||||
{
|
||||
g_free (oldgimp);
|
||||
|
@ -811,6 +818,8 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
|
|||
/* MIGRATION_PAGE */
|
||||
{
|
||||
GtkWidget *box;
|
||||
gchar *title;
|
||||
gchar *label;
|
||||
|
||||
page = user_install_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
_("Migrate User Settings"),
|
||||
|
@ -818,18 +827,24 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
|
|||
"with the user installation."),
|
||||
12);
|
||||
|
||||
box = gimp_int_radio_group_new (TRUE,
|
||||
_("It seems you have used GIMP 2.0 before."),
|
||||
title = g_strdup_printf (_("It seems you have used GIMP %s before."),
|
||||
version);
|
||||
label = g_strdup_printf (_("_Migrate GIMP %s user settings"), version);
|
||||
|
||||
box = gimp_int_radio_group_new (TRUE, title,
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&migrate, migrate,
|
||||
|
||||
_("_Migrate GIMP 2.0 user settings"),
|
||||
label,
|
||||
TRUE, NULL,
|
||||
|
||||
_("Do a _fresh user installation"),
|
||||
FALSE, NULL,
|
||||
NULL);
|
||||
|
||||
g_free (label);
|
||||
g_free (title);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (page), box, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box);
|
||||
}
|
||||
|
@ -1300,7 +1315,7 @@ user_install_migrate_files (const gchar *oldgimp,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gimp_templates_migrate ();
|
||||
gimp_templates_migrate (oldgimp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue