[Xfce4-commits] <midori:master> Fix uri matching for addon infobar on userstyles.org

Christian Dywan noreply at xfce.org
Mon Apr 4 01:52:01 CEST 2011


Updating branch refs/heads/master
         to 61d6da99ed996e40e356ed1f9063f156ca5a8892 (commit)
       from 2771eee995a9d65408aca60858bdf4fa4114b306 (commit)

commit 61d6da99ed996e40e356ed1f9063f156ca5a8892
Author: Paweł Forysiuk <tuxator at o2.pl>
Date:   Fri Apr 1 16:10:16 2011 +0200

    Fix uri matching for addon infobar on userstyles.org
    
    We want to match a style, with a number in the URI, but not when
    browsing styles.

 extensions/addons.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/extensions/addons.c b/extensions/addons.c
index d099812..62030cf 100644
--- a/extensions/addons.c
+++ b/extensions/addons.c
@@ -1,7 +1,7 @@
 /*
  Copyright (C) 2008 Christian Dywan <christian at twotoasts.de>
  Copyright (C) 2008-2010 Arno Renevier <arno at renevier.net>
- Copyright (C) 2010 Paweł Forysiuk <tuxator at o2.pl>
+ Copyright (C) 2010-2011 Paweł Forysiuk <tuxator at o2.pl>
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
@@ -152,15 +152,10 @@ addons_install_response (GtkWidget*  infobar,
             }
             else if (!g_strcmp0 (hostname, "userstyles.org"))
             {
-                gchar* subpage;
+                gchar* subpage = split_uri[4];
 
                 folder = "styles";
-                if (g_str_has_suffix (uri, "/"))
-                    subpage = split_uri[6];
-                else
-                    subpage = split_uri[5];
-
-                if (!subpage)
+                if ((subpage && *subpage) && g_ascii_isdigit (subpage[0]))
                 {
                     gchar* style_id;
                     const gchar* js_script;
@@ -278,14 +273,10 @@ addons_notify_load_status_cb (MidoriView*      view,
            else if (g_str_has_prefix (uri, "http://userstyles.org/styles/"))
            {
                gchar** split_uri = g_strsplit (uri, "/", -1);
-               gchar* subpage;
+               gchar* subpage = split_uri[4];
 
-               if (g_str_has_suffix (uri, "/"))
-                   subpage = split_uri[6];
-               else
-                   subpage = split_uri[5];
                /* userstyles.org style main page with style description */
-               if (!subpage)
+               if ((subpage && *subpage) && g_ascii_isdigit (subpage[0]))
                    addons_uri_install (view, ADDONS_USER_STYLES);
 
                g_strfreev (split_uri);



More information about the Xfce4-commits mailing list