From c5e6b7a020b2927afb2862cfe575fd59f0e79740 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 8 Nov 2011 01:53:53 +0100 Subject: [PATCH] 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. --- extensions/adblock.c | 2 +- extensions/addons.c | 2 +- extensions/colorful-tabs.c | 2 +- extensions/cookie-manager/main.c | 2 +- extensions/copy-tabs.c | 2 +- extensions/feed-panel/main.c | 2 +- extensions/formhistory.c | 2 +- extensions/history-list.vala | 2 +- extensions/mouse-gestures.c | 2 +- extensions/shortcuts.c | 2 +- extensions/status-clock.c | 2 +- extensions/statusbar-features.c | 2 +- extensions/tab-panel.c | 2 +- extensions/tabs-minimized.c | 2 +- extensions/toolbar-editor.c | 2 +- extensions/web-cache.c | 2 +- midori/midori-extension.c | 15 ++++++++++++++- midori/midori.vapi | 2 ++ wscript | 4 ++++ 19 files changed, 36 insertions(+), 17 deletions(-) diff --git a/extensions/adblock.c b/extensions/adblock.c index a72c5da5..a68bf0ad 100644 --- a/extensions/adblock.c +++ b/extensions/adblock.c @@ -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 ", NULL); midori_extension_install_string_list (extension, "filters", NULL, G_MAXSIZE); diff --git a/extensions/addons.c b/extensions/addons.c index f23e0429..dee4206d 100644 --- a/extensions/addons.c +++ b/extensions/addons.c @@ -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 ", NULL); g_signal_connect (extension, "activate", diff --git a/extensions/colorful-tabs.c b/extensions/colorful-tabs.c index 1726e290..c00122f8 100644 --- a/extensions/colorful-tabs.c +++ b/extensions/colorful-tabs.c @@ -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 , Samuel Creshal ", NULL); diff --git a/extensions/cookie-manager/main.c b/extensions/cookie-manager/main.c index 81391db0..8a72b707 100644 --- a/extensions/cookie-manager/main.c +++ b/extensions/cookie-manager/main.c @@ -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 ", NULL); diff --git a/extensions/copy-tabs.c b/extensions/copy-tabs.c index 55c4c315..636c1197 100644 --- a/extensions/copy-tabs.c +++ b/extensions/copy-tabs.c @@ -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 ", NULL); diff --git a/extensions/feed-panel/main.c b/extensions/feed-panel/main.c index 89567d5e..8cad47a0 100644 --- a/extensions/feed-panel/main.c +++ b/extensions/feed-panel/main.c @@ -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 ", NULL); diff --git a/extensions/formhistory.c b/extensions/formhistory.c index e5ea71f6..76b39c34 100644 --- a/extensions/formhistory.c +++ b/extensions/formhistory.c @@ -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 diff --git a/extensions/history-list.vala b/extensions/history-list.vala index fc677a4b..44af649f 100644 --- a/extensions/history-list.vala +++ b/extensions/history-list.vala @@ -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 "); this.install_integer ("TabClosingBehavior", TabClosingBehavior.LAST); diff --git a/extensions/mouse-gestures.c b/extensions/mouse-gestures.c index bbe38b49..b1f5b28e 100644 --- a/extensions/mouse-gestures.c +++ b/extensions/mouse-gestures.c @@ -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 ", NULL); midori_extension_install_integer (extension, "button", MOUSE_BUTTON_RIGHT); diff --git a/extensions/shortcuts.c b/extensions/shortcuts.c index 85cb8085..552f1694 100644 --- a/extensions/shortcuts.c +++ b/extensions/shortcuts.c @@ -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 ", NULL); diff --git a/extensions/status-clock.c b/extensions/status-clock.c index 68bf1f2c..639f2ff4 100644 --- a/extensions/status-clock.c +++ b/extensions/status-clock.c @@ -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 ", NULL); midori_extension_install_string (extension, "format", DEFAULT_FORMAT); diff --git a/extensions/statusbar-features.c b/extensions/statusbar-features.c index 2f0ee996..76ca2d3b 100644 --- a/extensions/statusbar-features.c +++ b/extensions/statusbar-features.c @@ -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 ", NULL); diff --git a/extensions/tab-panel.c b/extensions/tab-panel.c index ce33af07..fa54bdf5 100644 --- a/extensions/tab-panel.c +++ b/extensions/tab-panel.c @@ -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 ", NULL); diff --git a/extensions/tabs-minimized.c b/extensions/tabs-minimized.c index feccfed5..0e097865 100644 --- a/extensions/tabs-minimized.c +++ b/extensions/tabs-minimized.c @@ -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 ", NULL); diff --git a/extensions/toolbar-editor.c b/extensions/toolbar-editor.c index b1fbaf0a..6d3e10a3 100644 --- a/extensions/toolbar-editor.c +++ b/extensions/toolbar-editor.c @@ -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 ", NULL); diff --git a/extensions/web-cache.c b/extensions/web-cache.c index a5ae6cdc..a3e592bf 100644 --- a/extensions/web-cache.c +++ b/extensions/web-cache.c @@ -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 ", NULL); diff --git a/midori/midori-extension.c b/midori/midori-extension.c index 3a5cbd13..d4244b9c 100644 --- a/midori/midori-extension.c +++ b/midori/midori-extension.c @@ -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; diff --git a/midori/midori.vapi b/midori/midori.vapi index e2052c14..0f92c1f4 100644 --- a/midori/midori.vapi +++ b/midori/midori.vapi @@ -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 (); diff --git a/wscript b/wscript index 584571e5..d717a3aa 100644 --- a/wscript +++ b/wscript @@ -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': -- 2.39.5