diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-07-03 01:27:06 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-07-03 02:19:33 +0800 |
commit | 6cda29281f23dbf2ceff713a40c08415266d3c98 (patch) | |
tree | 5abc96c1995c2130a258ecfed82531b36bde15fb | |
parent | 34eeda37d39f37fc88fa93dd7a890424fbcf6d3d (diff) | |
download | gsoc2013-evolution-6cda29281f23dbf2ceff713a40c08415266d3c98.tar.gz gsoc2013-evolution-6cda29281f23dbf2ceff713a40c08415266d3c98.tar.zst gsoc2013-evolution-6cda29281f23dbf2ceff713a40c08415266d3c98.zip |
Record the actual Evolution version after migration.
Not the next stable version. If migration needs to occur multiple times
during a development cycle for different reasons, we'll need an accurate
last-used-version stamp.
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | shell/Makefile.am | 9 | ||||
-rw-r--r-- | shell/e-shell-migrate.c | 16 | ||||
-rw-r--r-- | shell/evo-version.h.in | 30 |
4 files changed, 50 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index e61ee5807d..41ea4c3dab 100644 --- a/configure.ac +++ b/configure.ac @@ -130,6 +130,10 @@ fi AC_SUBST([BASE_VERSION], [base_version]) AC_DEFINE_UNQUOTED(BASE_VERSION, ["$BASE_VERSION"], [Base version (Major.Minor)]) +AC_SUBST([EVO_MAJOR_VERSION], [evo_major_version]) +AC_SUBST([EVO_MINOR_VERSION], [evo_minor_version]) +AC_SUBST([EVO_MICRO_VERSION], [evo_micro_version]) + AC_PROG_CC AC_C_INLINE AC_PROG_CPP @@ -1487,6 +1491,7 @@ libemail-engine/Makefile libemail-engine/libemail-engine.pc libgnomecanvas/Makefile shell/Makefile +shell/evo-version.h shell/evolution-nognome shell/test/Makefile ui/Makefile diff --git a/shell/Makefile.am b/shell/Makefile.am index 9edfe88cd6..b61accec1e 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -43,6 +43,8 @@ libeshell_la_CPPFLAGS = \ -I$(top_srcdir)/widgets/misc \ -I$(top_srcdir) \ -I$(top_srcdir)/shell \ + -I$(top_builddir) \ + -I$(top_builddir)/shell \ -DEVOLUTION_BINDIR=\""$(bindir)"\" \ -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ @@ -85,6 +87,7 @@ libeshell_la_SOURCES = \ e-shell-migrate.c \ e-shell-migrate.h \ e-shell-window-actions.c \ + evo-version.h \ es-event.c libeshell_la_LDFLAGS = -avoid-version $(NO_UNDEFINED) @@ -186,6 +189,7 @@ errordir = $(privdatadir)/errors # Extra dist stuff EXTRA_DIST = \ + evo-version.h.in \ shell.error.xml \ evolution-nognome.in \ evolution-icon.rc \ @@ -208,7 +212,10 @@ evolution.pure: evolution endif -BUILT_SOURCES = $(error_DATA) $(ENUM_GENERATED) +BUILT_SOURCES = \ + $(error_DATA) \ + $(ENUM_GENERATED) \ + evo-version.h CLEANFILES = $(BUILT_SOURCES) dist-hook: diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index b05e8a293f..26901e7177 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -38,6 +38,7 @@ #include "e-util/e-util.h" #include "es-event.h" +#include "evo-version.h" /******************** Begin XDG Base Directory Migration ********************/ /* These are the known EShellBackend names as of Evolution 3.0 */ @@ -799,18 +800,12 @@ e_shell_migrate_attempt (EShell *shell) ESEvent *ese; GSettings *settings; gint major, minor, micro; - gint curr_major, curr_minor; gchar *string; g_return_val_if_fail (E_IS_SHELL (shell), FALSE); settings = g_settings_new ("org.gnome.evolution"); - if (sscanf (BASE_VERSION, "%d.%d", &curr_major, &curr_minor) != 2) { - g_warning ("Could not parse BASE_VERSION (%s)", BASE_VERSION); - return TRUE; - } - shell_migrate_get_version (shell, &major, &minor, µ); /* Migrate to XDG Base Directories first, so shell backends @@ -818,7 +813,7 @@ e_shell_migrate_attempt (EShell *shell) shell_migrate_to_xdg_base_dirs (shell); /* This sets the folder permissions to S_IRWXU if needed */ - if (curr_major <= 2 && curr_minor <= 30) + if (major <= 2 && minor <= 30) fix_folder_permissions (e_get_user_data_dir ()); /* Attempt to run migration all the time and let the backend @@ -828,7 +823,10 @@ e_shell_migrate_attempt (EShell *shell) /* Record a successful migration. */ string = g_strdup_printf ( - "%d.%d.%d", curr_major, curr_minor, 0); + "%d.%d.%d", + EVO_MAJOR_VERSION, + EVO_MINOR_VERSION, + EVO_MICRO_VERSION); g_settings_set_string (settings, "version", string); g_free (string); @@ -845,7 +843,7 @@ e_shell_migrate_attempt (EShell *shell) e_event_emit ( (EEvent *) ese, "upgrade.done", (EEventTarget *) es_event_target_new_upgrade ( - ese, curr_major, curr_minor, 0)); + ese, EVO_MAJOR_VERSION, EVO_MINOR_VERSION, EVO_MICRO_VERSION)); return TRUE; } diff --git a/shell/evo-version.h.in b/shell/evo-version.h.in new file mode 100644 index 0000000000..81acd98473 --- /dev/null +++ b/shell/evo-version.h.in @@ -0,0 +1,30 @@ +/* + * evo-version.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef EVO_VERSION_H +#define EVO_VERSION_H + +/* This is a private header used only to record migration. + * If a need arises to make this header public, expand the + * API to mimic libedataserver/eds-version.h. */ + +#define EVO_MAJOR_VERSION @EVO_MAJOR_VERSION@ +#define EVO_MINOR_VERSION @EVO_MINOR_VERSION@ +#define EVO_MICRO_VERSION @EVO_MICRO_VERSION@ + +#endif /* EVO_VERSION_H */ |