2 * Copyright (C) 2005 Novell, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Author: Anders Carlsson <andersca@imendio.com>
20 * Based on nautilus-query.c
28 struct _GtkQueryPrivate
35 G_DEFINE_TYPE (GtkQuery, _gtk_query, G_TYPE_OBJECT);
38 finalize (GObject *object)
42 query = GTK_QUERY (object);
44 g_free (query->priv->text);
46 G_OBJECT_CLASS (_gtk_query_parent_class)->finalize (object);
50 _gtk_query_class_init (GtkQueryClass *class)
52 GObjectClass *gobject_class;
54 gobject_class = G_OBJECT_CLASS (class);
55 gobject_class->finalize = finalize;
57 g_type_class_add_private (gobject_class, sizeof (GtkQueryPrivate));
61 _gtk_query_init (GtkQuery *query)
63 query->priv = G_TYPE_INSTANCE_GET_PRIVATE (query, GTK_TYPE_QUERY, GtkQueryPrivate);
69 return g_object_new (GTK_TYPE_QUERY, NULL);
74 _gtk_query_get_text (GtkQuery *query)
76 return g_strdup (query->priv->text);
80 _gtk_query_set_text (GtkQuery *query,
83 g_free (query->priv->text);
84 query->priv->text = g_strdup (text);
88 _gtk_query_get_location (GtkQuery *query)
90 return g_strdup (query->priv->location_uri);
94 _gtk_query_set_location (GtkQuery *query,
97 g_free (query->priv->location_uri);
98 query->priv->location_uri = g_strdup (uri);
102 _gtk_query_get_mime_types (GtkQuery *query)
108 for (l = query->priv->mime_types; l; l = l->next)
110 mime_type = (gchar*)l->data;
111 list = g_list_prepend (list, g_strdup (mime_type));
118 _gtk_query_set_mime_types (GtkQuery *query,
124 g_list_foreach (query->priv->mime_types, (GFunc)g_free, NULL);
125 g_list_free (query->priv->mime_types);
126 query->priv->mime_types = NULL;
128 for (l = mime_types; l; l = l->next)
130 mime_type = (gchar*)l->data;
131 query->priv->mime_types = g_list_prepend (query->priv->mime_types, g_strdup (mime_type));
136 _gtk_query_add_mime_type (GtkQuery *query,
137 const gchar *mime_type)
139 query->priv->mime_types = g_list_prepend (query->priv->mime_types,
140 g_strdup (mime_type));