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,
"name", _("Advertisement blocker"),
"description", _("Block advertisements according to a filter list"),
"version", "0.5",
"version", "0.5" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>",
NULL);
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,
"name", _("User addons"),
"description", _("Support for userscripts and userstyles"),
"version", "0.1",
"version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Arno Renevier <arno@renevier.net>",
NULL);
g_signal_connect (extension, "activate",

View file

@ -201,7 +201,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Colorful Tabs"),
"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>",
NULL);

View file

@ -34,7 +34,7 @@ MidoriExtension *extension_init(void)
MidoriExtension *extension = g_object_new(MIDORI_TYPE_EXTENSION,
"name", _("Cookie Manager"),
"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>",
NULL);

View file

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

View file

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

View file

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

View file

@ -568,7 +568,7 @@ namespace HistoryList {
internal Manager () {
GLib.Object (name: _("History List"),
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>");
this.install_integer ("TabClosingBehavior", TabClosingBehavior.LAST);

View file

@ -300,7 +300,7 @@ extension_init (void)
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Mouse Gestures"),
"description", _("Control Midori by moving the mouse"),
"version", "0.1",
"version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Matthias Kruk <mkruk@matthiaskruk.de>", NULL);
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,
"name", _("Shortcuts"),
"description", _("View and edit keyboard shortcuts"),
"version", "0.1",
"version", "0.1" MIDORI_VERSION_SUFFIX,
"authors", "Christian Dywan <christian@twotoasts.de>",
NULL);

View file

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

View file

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

View file

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

View file

@ -630,7 +630,7 @@ MidoriExtension *extension_init(void)
MidoriExtension* extension = g_object_new(MIDORI_TYPE_EXTENSION,
"name", _("Toolbar Editor"),
"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>",
NULL);

View file

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

View file

@ -425,8 +425,21 @@ midori_extension_set_property (GObject* object,
katze_assign (extension->priv->description, g_value_dup_string (value));
break;
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;
}
case PROP_AUTHORS:
katze_assign (extension->priv->authors, g_value_dup_string (value));
break;

View file

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

View file

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