[Xfce4-commits] <midori:master> Show mismatching build version suffix for extensions

Christian Dywan noreply at xfce.org
Tue Nov 8 01:58:01 CET 2011


Updating branch refs/heads/master
         to c5e6b7a020b2927afb2862cfe575fd59f0e79740 (commit)
       from 2b6ccad3f87d59f6e2db92046e52c7e93438effc (commit)

commit c5e6b7a020b2927afb2862cfe575fd59f0e79740
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Nov 8 01:53:53 2011 +0100

    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 a72c5da..a68bf0a 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 <christian at twotoasts.de>",
         NULL);
     midori_extension_install_string_list (extension, "filters", NULL, G_MAXSIZE);
diff --git a/extensions/addons.c b/extensions/addons.c
index f23e042..dee4206 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 <arno at renevier.net>",
         NULL);
     g_signal_connect (extension, "activate",
diff --git a/extensions/colorful-tabs.c b/extensions/colorful-tabs.c
index 1726e29..c00122f 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 <christian at twotoasts.de>, Samuel Creshal <creshal at arcor.de>",
         NULL);
 
diff --git a/extensions/cookie-manager/main.c b/extensions/cookie-manager/main.c
index 81391db..8a72b70 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 <enrico(dot)troeger(at)uvena(dot)de>",
 		NULL);
 
diff --git a/extensions/copy-tabs.c b/extensions/copy-tabs.c
index 55c4c31..636c119 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 <pixelmonkey at ensellitis.com>",
         NULL);
 
diff --git a/extensions/feed-panel/main.c b/extensions/feed-panel/main.c
index 89567d5..8cad47a 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 <dayul at users.sf.net>",
         NULL);
 
diff --git a/extensions/formhistory.c b/extensions/formhistory.c
index e5ea71f..76b39c3 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 fc677a4..44af649 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 <andre at stoesel.de>");
 
             this.install_integer ("TabClosingBehavior", TabClosingBehavior.LAST);
diff --git a/extensions/mouse-gestures.c b/extensions/mouse-gestures.c
index bbe38b4..b1f5b28 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 <mkruk at matthiaskruk.de>", NULL);
     midori_extension_install_integer (extension, "button", MOUSE_BUTTON_RIGHT);
 
diff --git a/extensions/shortcuts.c b/extensions/shortcuts.c
index 85cb808..552f169 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 <christian at twotoasts.de>",
         NULL);
 
diff --git a/extensions/status-clock.c b/extensions/status-clock.c
index 68bf1f2..639f2ff 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 <arno at renevier.net>",
         NULL);
     midori_extension_install_string (extension, "format", DEFAULT_FORMAT);
diff --git a/extensions/statusbar-features.c b/extensions/statusbar-features.c
index 2f0ee99..76ca2d3 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 <christian at twotoasts.de>",
         NULL);
 
diff --git a/extensions/tab-panel.c b/extensions/tab-panel.c
index ce33af0..fa54bdf 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 <christian at twotoasts.de>",
         NULL);
 
diff --git a/extensions/tabs-minimized.c b/extensions/tabs-minimized.c
index feccfed..0e09786 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 <pixelmonkey at ensellitis.com>",
         NULL);
 
diff --git a/extensions/toolbar-editor.c b/extensions/toolbar-editor.c
index b1fbaf0..6d3e10a 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 <enrico(dot)troeger(at)uvena(dot)de>",
 		NULL);
 
diff --git a/extensions/web-cache.c b/extensions/web-cache.c
index a5ae6cd..a3e592b 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 <christian at twotoasts.de>",
         NULL);
 
diff --git a/midori/midori-extension.c b/midori/midori-extension.c
index 3a5cbd1..d4244b9 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 e2052c1..0f92c1f 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 584571e..d717a3a 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':


More information about the Xfce4-commits mailing list