As a follow-up to myself, I'm attaching a patch which makes the "path" property work correctly - it deals with escaping/unescaping special characters.
Cheers, James "Doc" Livingston -- "There are some benefits to high blood pressure", Bob mused as another mosquito exploded. -- Bulwer-Lytton contest entry, author unknown.
--- widgets/rb-query-creator-properties.c 2005-07-20 00:30:47.000000000
+1000
+++ widgets/rb-query-creator-properties.c 2005-07-20 02:39:50.818553792
+1000
@@ -28,6 +28,7 @@
#include "rb-rating.h"
const RBQueryCreatorPropertyType string_property_type;
+const RBQueryCreatorPropertyType escaped_string_property_type;
const RBQueryCreatorPropertyType rating_property_type;
const RBQueryCreatorPropertyType integer_property_type;
const RBQueryCreatorPropertyType duration_property_type;
@@ -36,6 +37,8 @@
static GtkWidget * stringCriteriaCreateWidget (gboolean *constrain);
static void stringCriteriaSetWidgetData (GtkWidget *widget, GValue *val);
static void stringCriteriaGetWidgetData (GtkWidget *widget, GValue *val);
+static void escapedStringCriteriaSetWidgetData (GtkWidget *widget, GValue
*val);
+static void escapedStringCriteriaGetWidgetData (GtkWidget *widget, GValue
*val);
static GtkWidget * ratingCriteriaCreateWidget (gboolean *constrain);
static void ratingCriteriaSetWidgetData (GtkWidget *widget, GValue *val);
static void ratingCriteriaGetWidgetData (GtkWidget *widget, GValue *val);
@@ -60,7 +63,7 @@
{ N_("Album"), RHYTHMDB_PROP_ALBUM, RHYTHMDB_PROP_ALBUM_FOLDED,
&string_property_type },
{ N_("Genre"), RHYTHMDB_PROP_GENRE, RHYTHMDB_PROP_GENRE_FOLDED,
&string_property_type },
{ N_("Rating"), RHYTHMDB_PROP_RATING, RHYTHMDB_PROP_RATING,
&rating_property_type },
- { N_("Path"), RHYTHMDB_PROP_LOCATION, RHYTHMDB_PROP_LOCATION,
&string_property_type },
+ { N_("Path"), RHYTHMDB_PROP_LOCATION, RHYTHMDB_PROP_LOCATION,
&escaped_string_property_type },
{ N_("Play Count"), RHYTHMDB_PROP_PLAY_COUNT, RHYTHMDB_PROP_PLAY_COUNT,
&integer_property_type },
{ N_("Track Number"), RHYTHMDB_PROP_TRACK_NUMBER,
RHYTHMDB_PROP_TRACK_NUMBER, &integer_property_type },
@@ -95,6 +98,15 @@
stringCriteriaGetWidgetData
};
+const RBQueryCreatorPropertyType escaped_string_property_type =
+{
+ G_N_ELEMENTS (string_criteria_options),
+ string_criteria_options,
+ stringCriteriaCreateWidget,
+ escapedStringCriteriaSetWidgetData,
+ escapedStringCriteriaGetWidgetData
+};
+
/*
* This are the property types for numeric quantities, such as rating and
playcounts
@@ -197,6 +209,23 @@
g_value_set_string (val, text);
}
+static void
+escapedStringCriteriaSetWidgetData (GtkWidget *widget, GValue *val)
+{
+ char *text = gnome_vfs_unescape_string (g_value_get_string (val), NULL);
+ gtk_entry_set_text (GTK_ENTRY (widget), text);
+ g_free (text);
+}
+
+static void
+escapedStringCriteriaGetWidgetData (GtkWidget *widget, GValue *val)
+{
+ char *text = gnome_vfs_escape_path_string (gtk_entry_get_text
(GTK_ENTRY (widget)));
+
+ g_value_init (val, G_TYPE_STRING);
+ g_value_take_string (val, text);
+}
+
/*
* Implementation for the ratings property, using the RbRating widget
signature.asc
Description: This is a digitally signed message part
_______________________________________________ rhythmbox-devel mailing list [email protected] http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
