Commit 41fee7e5 authored by Matthias Clasen's avatar Matthias Clasen

GtkQuery: Cleanups

Strip leading underscores from GtkQuery api, and
clean up the sources a bit.
parent 3f0f68e6
...@@ -6274,8 +6274,8 @@ search_start_query (GtkFileChooserWidget *impl, ...@@ -6274,8 +6274,8 @@ search_start_query (GtkFileChooserWidget *impl,
if (!priv->search_query) if (!priv->search_query)
{ {
priv->search_query = _gtk_query_new (); priv->search_query = gtk_query_new ();
_gtk_query_set_text (priv->search_query, query_text); gtk_query_set_text (priv->search_query, query_text);
} }
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->current_location_radio)) && if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->current_location_radio)) &&
...@@ -6283,7 +6283,7 @@ search_start_query (GtkFileChooserWidget *impl, ...@@ -6283,7 +6283,7 @@ search_start_query (GtkFileChooserWidget *impl,
{ {
gchar *location; gchar *location;
location = g_file_get_uri (priv->current_folder); location = g_file_get_uri (priv->current_folder);
_gtk_query_set_location (priv->search_query, location); gtk_query_set_location (priv->search_query, location);
g_free (location); g_free (location);
} }
...@@ -6341,7 +6341,7 @@ search_setup_widgets (GtkFileChooserWidget *impl) ...@@ -6341,7 +6341,7 @@ search_setup_widgets (GtkFileChooserWidget *impl)
/* if there already is a query, restart it */ /* if there already is a query, restart it */
if (priv->search_query) if (priv->search_query)
{ {
gchar *query = _gtk_query_get_text (priv->search_query); gchar *query = gtk_query_get_text (priv->search_query);
if (query) if (query)
{ {
......
...@@ -32,7 +32,7 @@ struct _GtkQueryPrivate ...@@ -32,7 +32,7 @@ struct _GtkQueryPrivate
gchar **words; gchar **words;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GtkQuery, _gtk_query, G_TYPE_OBJECT) G_DEFINE_TYPE_WITH_PRIVATE (GtkQuery, gtk_query, G_TYPE_OBJECT)
static void static void
finalize (GObject *object) finalize (GObject *object)
...@@ -45,40 +45,40 @@ finalize (GObject *object) ...@@ -45,40 +45,40 @@ finalize (GObject *object)
g_free (query->priv->location_uri); g_free (query->priv->location_uri);
g_strfreev (query->priv->words); g_strfreev (query->priv->words);
G_OBJECT_CLASS (_gtk_query_parent_class)->finalize (object); G_OBJECT_CLASS (gtk_query_parent_class)->finalize (object);
} }
static void static void
_gtk_query_class_init (GtkQueryClass *class) gtk_query_class_init (GtkQueryClass *class)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (class); gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = finalize; gobject_class->finalize = finalize;
} }
static void static void
_gtk_query_init (GtkQuery *query) gtk_query_init (GtkQuery *query)
{ {
query->priv = _gtk_query_get_instance_private (query); query->priv = gtk_query_get_instance_private (query);
} }
GtkQuery * GtkQuery *
_gtk_query_new (void) gtk_query_new (void)
{ {
return g_object_new (GTK_TYPE_QUERY, NULL); return g_object_new (GTK_TYPE_QUERY, NULL);
} }
gchar * gchar *
_gtk_query_get_text (GtkQuery *query) gtk_query_get_text (GtkQuery *query)
{ {
return g_strdup (query->priv->text); return g_strdup (query->priv->text);
} }
void void
_gtk_query_set_text (GtkQuery *query, gtk_query_set_text (GtkQuery *query,
const gchar *text) const gchar *text)
{ {
g_free (query->priv->text); g_free (query->priv->text);
query->priv->text = g_strdup (text); query->priv->text = g_strdup (text);
...@@ -88,21 +88,21 @@ _gtk_query_set_text (GtkQuery *query, ...@@ -88,21 +88,21 @@ _gtk_query_set_text (GtkQuery *query,
} }
gchar * gchar *
_gtk_query_get_location (GtkQuery *query) gtk_query_get_location (GtkQuery *query)
{ {
return g_strdup (query->priv->location_uri); return g_strdup (query->priv->location_uri);
} }
void void
_gtk_query_set_location (GtkQuery *query, gtk_query_set_location (GtkQuery *query,
const gchar *uri) const gchar *uri)
{ {
g_free (query->priv->location_uri); g_free (query->priv->location_uri);
query->priv->location_uri = g_strdup (uri); query->priv->location_uri = g_strdup (uri);
} }
GList * GList *
_gtk_query_get_mime_types (GtkQuery *query) gtk_query_get_mime_types (GtkQuery *query)
{ {
GList *list, *l; GList *list, *l;
gchar *mime_type; gchar *mime_type;
...@@ -118,8 +118,8 @@ _gtk_query_get_mime_types (GtkQuery *query) ...@@ -118,8 +118,8 @@ _gtk_query_get_mime_types (GtkQuery *query)
} }
void void
_gtk_query_set_mime_types (GtkQuery *query, gtk_query_set_mime_types (GtkQuery *query,
GList *mime_types) GList *mime_types)
{ {
GList *l; GList *l;
gchar *mime_type; gchar *mime_type;
...@@ -135,11 +135,11 @@ _gtk_query_set_mime_types (GtkQuery *query, ...@@ -135,11 +135,11 @@ _gtk_query_set_mime_types (GtkQuery *query,
} }
void void
_gtk_query_add_mime_type (GtkQuery *query, gtk_query_add_mime_type (GtkQuery *query,
const gchar *mime_type) const gchar *mime_type)
{ {
query->priv->mime_types = g_list_prepend (query->priv->mime_types, query->priv->mime_types = g_list_prepend (query->priv->mime_types,
g_strdup (mime_type)); g_strdup (mime_type));
} }
static gchar * static gchar *
......
...@@ -26,18 +26,18 @@ ...@@ -26,18 +26,18 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GTK_TYPE_QUERY (_gtk_query_get_type ()) #define GTK_TYPE_QUERY (gtk_query_get_type ())
#define GTK_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_QUERY, GtkQuery)) #define GTK_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_QUERY, GtkQuery))
#define GTK_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_QUERY, GtkQueryClass)) #define GTK_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_QUERY, GtkQueryClass))
#define GTK_IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_QUERY)) #define GTK_IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_QUERY))
#define GTK_IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_QUERY)) #define GTK_IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_QUERY))
#define GTK_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_QUERY, GtkQueryClass)) #define GTK_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_QUERY, GtkQueryClass))
typedef struct _GtkQuery GtkQuery; typedef struct _GtkQuery GtkQuery;
typedef struct _GtkQueryClass GtkQueryClass; typedef struct _GtkQueryClass GtkQueryClass;
typedef struct _GtkQueryPrivate GtkQueryPrivate; typedef struct _GtkQueryPrivate GtkQueryPrivate;
struct _GtkQuery struct _GtkQuery
{ {
GObject parent; GObject parent;
...@@ -49,23 +49,23 @@ struct _GtkQueryClass ...@@ -49,23 +49,23 @@ struct _GtkQueryClass
GObjectClass parent_class; GObjectClass parent_class;
}; };
GType _gtk_query_get_type (void); GType gtk_query_get_type (void);
GtkQuery* _gtk_query_new (void); GtkQuery* gtk_query_new (void);
gchar* _gtk_query_get_text (GtkQuery *query); gchar* gtk_query_get_text (GtkQuery *query);
void _gtk_query_set_text (GtkQuery *query, void gtk_query_set_text (GtkQuery *query,
const gchar *text); const gchar *text);
gchar* _gtk_query_get_location (GtkQuery *query); gchar* gtk_query_get_location (GtkQuery *query);
void _gtk_query_set_location (GtkQuery *query, void gtk_query_set_location (GtkQuery *query,
const gchar *uri); const gchar *uri);
GList* _gtk_query_get_mime_types (GtkQuery *query); GList* gtk_query_get_mime_types (GtkQuery *query);
void _gtk_query_set_mime_types (GtkQuery *query, void gtk_query_set_mime_types (GtkQuery *query,
GList *mime_types); GList *mime_types);
void _gtk_query_add_mime_type (GtkQuery *query, void gtk_query_add_mime_type (GtkQuery *query,
const gchar *mime_type); const gchar *mime_type);
gboolean gtk_query_matches_string (GtkQuery *query, gboolean gtk_query_matches_string (GtkQuery *query,
const gchar *string); const gchar *string);
......
...@@ -204,7 +204,7 @@ gtk_search_engine_quartz_set_query (GtkSearchEngine *engine, ...@@ -204,7 +204,7 @@ gtk_search_engine_quartz_set_query (GtkSearchEngine *engine,
[quartz->priv->ns_query setPredicate: [quartz->priv->ns_query setPredicate:
[NSPredicate predicateWithFormat: [NSPredicate predicateWithFormat:
[NSString stringWithFormat:@"(kMDItemTextContent LIKE[cd] \"*%s*\")", [NSString stringWithFormat:@"(kMDItemTextContent LIKE[cd] \"*%s*\")",
_gtk_query_get_text (query)]]]; gtk_query_get_text (query)]]];
QUARTZ_POOL_RELEASE; QUARTZ_POOL_RELEASE;
} }
......
...@@ -95,7 +95,7 @@ search_thread_data_new (GtkSearchEngineSimple *engine, ...@@ -95,7 +95,7 @@ search_thread_data_new (GtkSearchEngineSimple *engine,
data->engine = g_object_ref (engine); data->engine = g_object_ref (engine);
data->directories = g_queue_new (); data->directories = g_queue_new ();
data->query = g_object_ref (query); data->query = g_object_ref (query);
uri = _gtk_query_get_location (query); uri = gtk_query_get_location (query);
if (uri != NULL) if (uri != NULL)
location = g_file_new_for_uri (uri); location = g_file_new_for_uri (uri);
else else
......
...@@ -356,8 +356,8 @@ gtk_search_engine_tracker_start (GtkSearchEngine *engine) ...@@ -356,8 +356,8 @@ gtk_search_engine_tracker_start (GtkSearchEngine *engine)
return; return;
} }
search_text = _gtk_query_get_text (tracker->priv->query); search_text = gtk_query_get_text (tracker->priv->query);
location_uri = _gtk_query_get_location (tracker->priv->query); location_uri = gtk_query_get_location (tracker->priv->query);
sparql = g_string_new ("SELECT nie:url(?urn) " sparql = g_string_new ("SELECT nie:url(?urn) "
"WHERE {" "WHERE {"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment