Show mismatching build version suffix for extensions

MIDORI_VERSION_SUFFIX resolves to a string that needs to be
added to each extension's version at build time. If it is
different than the running Midori's, it is shown in the
extension list.
This commit is contained in:
Christian Dywan 2011-11-08 01:53:53 +01:00
parent 2b6ccad3f8
commit c5e6b7a020
19 changed files with 36 additions and 17 deletions

View file

@ -1483,7 +1483,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Advertisement blocker"), "name", _("Advertisement blocker"),
"description", _("Block advertisements according to a filter list"), "description", _("Block advertisements according to a filter list"),
"version", "0.5", "version", "0.5" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>", "authors", "Christian Dywan <christian@twotoasts.de>",
NULL); NULL);
midori_extension_install_string_list (extension, "filters", NULL, G_MAXSIZE); midori_extension_install_string_list (extension, "filters", NULL, G_MAXSIZE);

View file

@ -1889,7 +1889,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("User addons"), "name", _("User addons"),
"description", _("Support for userscripts and userstyles"), "description", _("Support for userscripts and userstyles"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Arno Renevier <arno@renevier.net>", "authors", "Arno Renevier <arno@renevier.net>",
NULL); NULL);
g_signal_connect (extension, "activate", g_signal_connect (extension, "activate",

View file

@ -201,7 +201,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Colorful Tabs"), "name", _("Colorful Tabs"),
"description", _("Tint each tab distinctly"), "description", _("Tint each tab distinctly"),
"version", "0.5", "version", "0.5" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>, Samuel Creshal <creshal@arcor.de>", "authors", "Christian Dywan <christian@twotoasts.de>, Samuel Creshal <creshal@arcor.de>",
NULL); NULL);

View file

@ -34,7 +34,7 @@ MidoriExtension *extension_init(void)
MidoriExtension *extension = g_object_new(MIDORI_TYPE_EXTENSION, MidoriExtension *extension = g_object_new(MIDORI_TYPE_EXTENSION,
"name", _("Cookie Manager"), "name", _("Cookie Manager"),
"description", _("List, view and delete cookies"), "description", _("List, view and delete cookies"),
"version", "0.2", "version", "0.2" MIDORI_VERSION_SUFFIX,
"authors", "Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>", "authors", "Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>",
NULL); NULL);

View file

@ -94,7 +94,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Copy Addresses of Tabs"), "name", _("Copy Addresses of Tabs"),
"description", _("Copy the addresses of all tabs to the clipboard"), "description", _("Copy the addresses of all tabs to the clipboard"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "MonkeyOfDoom <pixelmonkey@ensellitis.com>", "authors", "MonkeyOfDoom <pixelmonkey@ensellitis.com>",
NULL); NULL);

View file

@ -517,7 +517,7 @@ extension_init (void)
extension = g_object_new (MIDORI_TYPE_EXTENSION, extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Feed Panel"), "name", _("Feed Panel"),
"description", _("Read Atom/ RSS feeds"), "description", _("Read Atom/ RSS feeds"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Dale Whittaker <dayul@users.sf.net>", "authors", "Dale Whittaker <dayul@users.sf.net>",
NULL); NULL);

View file

@ -564,7 +564,7 @@ extension_init (void)
if (formhistory_prepare_js ()) if (formhistory_prepare_js ())
{ {
ver = "1.0"; ver = "1.0" MIDORI_VERSION_SUFFIX;
desc = g_strdup (_("Stores history of entered form data")); desc = g_strdup (_("Stores history of entered form data"));
} }
else else

View file

@ -568,7 +568,7 @@ namespace HistoryList {
internal Manager () { internal Manager () {
GLib.Object (name: _("History List"), GLib.Object (name: _("History List"),
description: _("Move to the last used tab when switching or closing tabs"), description: _("Move to the last used tab when switching or closing tabs"),
version: "0.4", version: "0.4" + Midori.VERSION_SUFFIX,
authors: "André Stösel <andre@stoesel.de>"); authors: "André Stösel <andre@stoesel.de>");
this.install_integer ("TabClosingBehavior", TabClosingBehavior.LAST); this.install_integer ("TabClosingBehavior", TabClosingBehavior.LAST);

View file

@ -300,7 +300,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Mouse Gestures"), "name", _("Mouse Gestures"),
"description", _("Control Midori by moving the mouse"), "description", _("Control Midori by moving the mouse"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Matthias Kruk <mkruk@matthiaskruk.de>", NULL); "authors", "Matthias Kruk <mkruk@matthiaskruk.de>", NULL);
midori_extension_install_integer (extension, "button", MOUSE_BUTTON_RIGHT); midori_extension_install_integer (extension, "button", MOUSE_BUTTON_RIGHT);

View file

@ -321,7 +321,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Shortcuts"), "name", _("Shortcuts"),
"description", _("View and edit keyboard shortcuts"), "description", _("View and edit keyboard shortcuts"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>", "authors", "Christian Dywan <christian@twotoasts.de>",
NULL); NULL);

View file

@ -173,7 +173,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Statusbar Clock"), "name", _("Statusbar Clock"),
"description", _("Display date and time in the statusbar"), "description", _("Display date and time in the statusbar"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Arno Renevier <arno@renevier.net>", "authors", "Arno Renevier <arno@renevier.net>",
NULL); NULL);
midori_extension_install_string (extension, "format", DEFAULT_FORMAT); midori_extension_install_string (extension, "format", DEFAULT_FORMAT);

View file

@ -191,7 +191,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Statusbar Features"), "name", _("Statusbar Features"),
"description", _("Easily toggle features on web pages on and off"), "description", _("Easily toggle features on web pages on and off"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>", "authors", "Christian Dywan <christian@twotoasts.de>",
NULL); NULL);

View file

@ -682,7 +682,7 @@ extension_init (void)
extension = g_object_new (MIDORI_TYPE_EXTENSION, extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Tab Panel"), "name", _("Tab Panel"),
"description", _("Show tabs in a vertical panel"), "description", _("Show tabs in a vertical panel"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>", "authors", "Christian Dywan <christian@twotoasts.de>",
NULL); NULL);

View file

@ -75,7 +75,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Only Icons on Tabs by default"), "name", _("Only Icons on Tabs by default"),
"description", _("New tabs have no label by default"), "description", _("New tabs have no label by default"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "MonkeyOfDoom <pixelmonkey@ensellitis.com>", "authors", "MonkeyOfDoom <pixelmonkey@ensellitis.com>",
NULL); NULL);

View file

@ -630,7 +630,7 @@ MidoriExtension *extension_init(void)
MidoriExtension* extension = g_object_new(MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new(MIDORI_TYPE_EXTENSION,
"name", _("Toolbar Editor"), "name", _("Toolbar Editor"),
"description", _("Easily edit the toolbar layout"), "description", _("Easily edit the toolbar layout"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>", "authors", "Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>",
NULL); NULL);

View file

@ -461,7 +461,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION, MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Web Cache"), "name", _("Web Cache"),
"description", _("Cache HTTP communication on disk"), "description", _("Cache HTTP communication on disk"),
"version", "0.1", "version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>", "authors", "Christian Dywan <christian@twotoasts.de>",
NULL); NULL);

View file

@ -425,8 +425,21 @@ midori_extension_set_property (GObject* object,
katze_assign (extension->priv->description, g_value_dup_string (value)); katze_assign (extension->priv->description, g_value_dup_string (value));
break; break;
case PROP_VERSION: case PROP_VERSION:
katze_assign (extension->priv->version, g_value_dup_string (value)); {
/* Don't show version suffix if it matches the running Midori */
const gchar* version = g_value_get_string (value);
if (g_str_has_suffix (version, MIDORI_VERSION_SUFFIX))
katze_assign (extension->priv->version,
g_strndup (version,
strlen (version) - strlen (MIDORI_VERSION_SUFFIX)));
/* No version suffix at all, must be 0.4.1 or 0.4.1 git */
else if (!strchr (version, '-') && !strchr (version, '('))
katze_assign (extension->priv->version,
g_strconcat (version, " (0.4.1)", NULL));
else
katze_assign (extension->priv->version, g_strdup (version));
break; break;
}
case PROP_AUTHORS: case PROP_AUTHORS:
katze_assign (extension->priv->authors, g_value_dup_string (value)); katze_assign (extension->priv->authors, g_value_dup_string (value));
break; break;

View file

@ -3,6 +3,8 @@
[CCode (cprefix = "Midori", lower_case_cprefix = "midori_")] [CCode (cprefix = "Midori", lower_case_cprefix = "midori_")]
namespace Midori { namespace Midori {
public const string VERSION_SUFFIX;
[CCode (cheader_filename = "midori/midori.h")] [CCode (cheader_filename = "midori/midori.h")]
public class App : GLib.Object { public class App : GLib.Object {
public App (); public App ();

View file

@ -33,12 +33,14 @@ micro = 1
APPNAME = 'midori' APPNAME = 'midori'
VERSION = VERSION_FULL = str (major) + '.' + str (minor) + '.' + str (micro) VERSION = VERSION_FULL = str (major) + '.' + str (minor) + '.' + str (micro)
VERSION_SUFFIX = ' (%s)' % VERSION
try: try:
if os.path.isdir ('.git'): if os.path.isdir ('.git'):
git = Utils.cmd_output (['git', 'describe'], silent=True) git = Utils.cmd_output (['git', 'describe'], silent=True)
if git: if git:
VERSION_FULL = git.strip () VERSION_FULL = git.strip ()
VERSION_SUFFIX = VERSION_FULL.replace (VERSION, '')
except: except:
pass pass
@ -300,8 +302,10 @@ def configure (conf):
if debug_level == 'full': if debug_level == 'full':
conf.define ('PACKAGE_VERSION', '%s (debug)' % VERSION_FULL) conf.define ('PACKAGE_VERSION', '%s (debug)' % VERSION_FULL)
conf.env.append_value ('CCFLAGS', '-DMIDORI_VERSION_SUFFIX="%s (debug)"' % VERSION_SUFFIX)
else: else:
conf.define ('PACKAGE_VERSION', VERSION_FULL) conf.define ('PACKAGE_VERSION', VERSION_FULL)
conf.env.append_value ('CCFLAGS', '-DMIDORI_VERSION_SUFFIX="%s"' % VERSION_SUFFIX)
conf.write_config_header ('config.h') conf.write_config_header ('config.h')
if compiler == 'gcc': if compiler == 'gcc':