mirror of https://github.com/GNOME/gimp.git
app/core/gimp-templates.[ch] merge the migrated user templaterc with the
2004-11-23 Sven Neumann <sven@gimp.org> * app/core/gimp-templates.[ch] * app/dialogs/user-install-dialog.c: merge the migrated user templaterc with the system templaterc so the users who have used gimp-2.0 before get our changes to the default templates.
This commit is contained in:
parent
d8a5ca6c1b
commit
7eed9323db
|
@ -1,3 +1,10 @@
|
||||||
|
2004-11-23 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimp-templates.[ch]
|
||||||
|
* app/dialogs/user-install-dialog.c: merge the migrated user
|
||||||
|
templaterc with the system templaterc so the users who have used
|
||||||
|
gimp-2.0 before get our changes to the default templates.
|
||||||
|
|
||||||
2004-11-23 Michael Natterer <mitch@gimp.org>
|
2004-11-23 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpwidgets-utils.[ch]: added new function
|
* app/widgets/gimpwidgets-utils.[ch]: added new function
|
||||||
|
|
|
@ -105,3 +105,37 @@ gimp_templates_save (Gimp *gimp)
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_templates_migrate:
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* merges the user's templaterc with the systemwide templaterc. The goal
|
||||||
|
* is to replace the unit for a couple of default templates with "pixels".
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gimp_templates_migrate (void)
|
||||||
|
{
|
||||||
|
GimpContainer *templates = gimp_list_new (GIMP_TYPE_TEMPLATE, TRUE);
|
||||||
|
gchar *filename = gimp_personal_rc_file ("templaterc");
|
||||||
|
|
||||||
|
if (gimp_config_deserialize_file (GIMP_CONFIG (templates), filename,
|
||||||
|
NULL, NULL))
|
||||||
|
{
|
||||||
|
gchar *tmp = g_build_filename (gimp_sysconf_directory (),
|
||||||
|
"templaterc", NULL);
|
||||||
|
|
||||||
|
gimp_config_deserialize_file (GIMP_CONFIG (templates), tmp, NULL, NULL);
|
||||||
|
|
||||||
|
g_free (tmp);
|
||||||
|
|
||||||
|
gimp_list_reverse (GIMP_LIST (templates));
|
||||||
|
|
||||||
|
gimp_config_serialize_to_file (GIMP_CONFIG (templates), filename,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
|
}
|
||||||
|
|
|
@ -20,8 +20,10 @@
|
||||||
#define __GIMP_TEMPLATES_H__
|
#define __GIMP_TEMPLATES_H__
|
||||||
|
|
||||||
|
|
||||||
void gimp_templates_load (Gimp *gimp);
|
void gimp_templates_load (Gimp *gimp);
|
||||||
void gimp_templates_save (Gimp *gimp);
|
void gimp_templates_save (Gimp *gimp);
|
||||||
|
|
||||||
|
void gimp_templates_migrate (void);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_TEMPLATES_H__ */
|
#endif /* __GIMP_TEMPLATES_H__ */
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#include "config/gimpconfig-utils.h"
|
#include "config/gimpconfig-utils.h"
|
||||||
#include "config/gimprc.h"
|
#include "config/gimprc.h"
|
||||||
|
|
||||||
|
#include "core/gimp-templates.h"
|
||||||
|
|
||||||
#include "widgets/gimppropwidgets.h"
|
#include "widgets/gimppropwidgets.h"
|
||||||
#include "widgets/gimpwidgets-utils.h"
|
#include "widgets/gimpwidgets-utils.h"
|
||||||
|
|
||||||
|
@ -339,39 +341,38 @@ user_install_response (GtkWidget *widget,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
GimpRc *gimprc)
|
GimpRc *gimprc)
|
||||||
{
|
{
|
||||||
static gint notebook_index = GPL_PAGE;
|
static gint index = GPL_PAGE;
|
||||||
|
|
||||||
if (response_id != GTK_RESPONSE_OK)
|
if (response_id != GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (notebook_index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case GPL_PAGE:
|
case GPL_PAGE:
|
||||||
if (oldgimp)
|
if (oldgimp)
|
||||||
notebook_index = MIGRATION_PAGE;
|
index = MIGRATION_PAGE;
|
||||||
else
|
else
|
||||||
notebook_index = TREE_PAGE;
|
index = TREE_PAGE;
|
||||||
|
|
||||||
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), notebook_index);
|
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MIGRATION_PAGE:
|
case MIGRATION_PAGE:
|
||||||
if (migrate)
|
if (migrate)
|
||||||
{
|
{
|
||||||
notebook_index = TREE_PAGE;
|
index = TREE_PAGE;
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user_install_notebook_set_page (GTK_NOTEBOOK (notebook),
|
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), ++index);
|
||||||
++notebook_index);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TREE_PAGE:
|
case TREE_PAGE:
|
||||||
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), ++notebook_index);
|
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), ++index);
|
||||||
|
|
||||||
/* Creating the directories can take some time on NFS, so inform
|
/* Creating the directories can take some time on NFS, so inform
|
||||||
* the user and set the buttons insensitive
|
* the user and set the buttons insensitive
|
||||||
|
@ -395,7 +396,7 @@ user_install_response (GtkWidget *widget,
|
||||||
_("Installation failed. "
|
_("Installation failed. "
|
||||||
"Contact system administrator."));
|
"Contact system administrator."));
|
||||||
|
|
||||||
notebook_index = TUNING_PAGE; /* skip to last page */
|
index = TUNING_PAGE; /* skip to last page */
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (widget),
|
gtk_dialog_set_response_sensitive (GTK_DIALOG (widget),
|
||||||
|
@ -405,8 +406,7 @@ user_install_response (GtkWidget *widget,
|
||||||
case LOG_PAGE:
|
case LOG_PAGE:
|
||||||
if (! migrate)
|
if (! migrate)
|
||||||
{
|
{
|
||||||
user_install_notebook_set_page (GTK_NOTEBOOK (notebook),
|
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), ++index);
|
||||||
++notebook_index);
|
|
||||||
user_install_tuning (gimprc);
|
user_install_tuning (gimprc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1294,6 +1294,8 @@ user_install_migrate_files (const gchar *oldgimp,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gimp_templates_migrate ();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue