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, see <http://www.gnu.org/licenses/>.
17 * Author: Anders Carlsson <andersca@imendio.com>
19 * Based on nautilus-query.c
27 struct _GtkQueryPrivate
34 G_DEFINE_TYPE (GtkQuery, _gtk_query, G_TYPE_OBJECT);
37 finalize (GObject *object)
41 query = GTK_QUERY (object);
43 g_free (query->priv->text);
45 G_OBJECT_CLASS (_gtk_query_parent_class)->finalize (object);
49 _gtk_query_class_init (GtkQueryClass *class)
51 GObjectClass *gobject_class;
53 gobject_class = G_OBJECT_CLASS (class);
54 gobject_class->finalize = finalize;
56 g_type_class_add_private (gobject_class, sizeof (GtkQueryPrivate));
60 _gtk_query_init (GtkQuery *query)
62 query->priv = G_TYPE_INSTANCE_GET_PRIVATE (query, GTK_TYPE_QUERY, GtkQueryPrivate);
68 return g_object_new (GTK_TYPE_QUERY, NULL);
73 _gtk_query_get_text (GtkQuery *query)
75 return g_strdup (query->priv->text);
79 _gtk_query_set_text (GtkQuery *query,
82 g_free (query->priv->text);
83 query->priv->text = g_strdup (text);
87 _gtk_query_get_location (GtkQuery *query)
89 return g_strdup (query->priv->location_uri);
93 _gtk_query_set_location (GtkQuery *query,
96 g_free (query->priv->location_uri);
97 query->priv->location_uri = g_strdup (uri);
101 _gtk_query_get_mime_types (GtkQuery *query)
107 for (l = query->priv->mime_types; l; l = l->next)
109 mime_type = (gchar*)l->data;
110 list = g_list_prepend (list, g_strdup (mime_type));
117 _gtk_query_set_mime_types (GtkQuery *query,
123 g_list_free_full (query->priv->mime_types, g_free);
124 query->priv->mime_types = NULL;
126 for (l = mime_types; l; l = l->next)
128 mime_type = (gchar*)l->data;
129 query->priv->mime_types = g_list_prepend (query->priv->mime_types, g_strdup (mime_type));
134 _gtk_query_add_mime_type (GtkQuery *query,
135 const gchar *mime_type)
137 query->priv->mime_types = g_list_prepend (query->priv->mime_types,
138 g_strdup (mime_type));