[Xfce4-commits] <xfce4-appfinder:master> Fix property-changed matching.

Nick Schermer noreply at xfce.org
Fri Apr 20 18:46:03 CEST 2012


Updating branch refs/heads/master
         to 1407f1b1330e93de9defd44045304af6a53137c2 (commit)
       from 73662a19a92aa037f4f39f586e20b4042c2088ab (commit)

commit 1407f1b1330e93de9defd44045304af6a53137c2
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Apr 20 18:43:35 2012 +0200

    Fix property-changed matching.
    
    %s in scanf sucks since it continues even if the character
    is not a digit anymore. Use %n to check the suffix.

 src/appfinder-preferences.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/appfinder-preferences.c b/src/appfinder-preferences.c
index 233aed1..becc111 100644
--- a/src/appfinder-preferences.c
+++ b/src/appfinder-preferences.c
@@ -392,6 +392,7 @@ xfce_appfinder_preferences_action_changed (XfconfChannel            *channel,
   gint           unique_id;
   GObject       *store;
   UpdateContext  context;
+  gint           offset = 0;
 
   if (prop_name == NULL)
     return;
@@ -400,8 +401,9 @@ xfce_appfinder_preferences_action_changed (XfconfChannel            *channel,
     {
       xfce_appfinder_preferences_action_populate (preferences);
     }
-  else if (sscanf (prop_name, "/actions/action-%d/pattern", &unique_id) == 1
-           && G_VALUE_HOLDS_STRING (value))
+  else if (G_VALUE_HOLDS_STRING (value)
+           && sscanf (prop_name, "/actions/action-%d%n", &unique_id, &offset) == 1
+           && g_strcmp0 (prop_name + offset, "/pattern") == 0)
     {
       context.unique_id = unique_id;
       context.value = value;


More information about the Xfce4-commits mailing list