[nautilus] search-directory: make the query a GObject property
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] search-directory: make the query a GObject property
- Date: Thu, 6 Sep 2012 19:24:08 +0000 (UTC)
commit 204e273aea6b633e258ea26991a28dcf1247f1c0
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Sep 6 14:25:19 2012 -0400
search-directory: make the query a GObject property
Now that the search directory supports those.
libnautilus-private/nautilus-search-directory.c | 40 ++++++++++++++--------
1 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/libnautilus-private/nautilus-search-directory.c b/libnautilus-private/nautilus-search-directory.c
index 30da376..4318d2e 100644
--- a/libnautilus-private/nautilus-search-directory.c
+++ b/libnautilus-private/nautilus-search-directory.c
@@ -80,6 +80,7 @@ typedef struct {
enum {
PROP_0,
PROP_BASE_MODEL,
+ PROP_QUERY,
NUM_PROPERTIES
};
@@ -685,6 +686,9 @@ search_set_property (GObject *object,
case PROP_BASE_MODEL:
nautilus_search_directory_set_base_model (search, g_value_get_object (value));
break;
+ case PROP_QUERY:
+ nautilus_search_directory_set_query (search, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -703,6 +707,9 @@ search_get_property (GObject *object,
case PROP_BASE_MODEL:
g_value_set_object (value, nautilus_search_directory_get_base_model (search));
break;
+ case PROP_QUERY:
+ g_value_take_object (value, nautilus_search_directory_get_query (search));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -820,6 +827,12 @@ nautilus_search_directory_class_init (NautilusSearchDirectoryClass *class)
"The base directory model for this directory",
NAUTILUS_TYPE_DIRECTORY,
G_PARAM_READWRITE);
+ properties[PROP_QUERY] =
+ g_param_spec_object ("query",
+ "The query",
+ "The query for this search directory",
+ NAUTILUS_TYPE_QUERY,
+ G_PARAM_READWRITE);
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
g_type_class_add_private (class, sizeof (NautilusSearchDirectoryDetails));
@@ -862,32 +875,29 @@ nautilus_search_directory_generate_new_uri (void)
return uri;
}
-
void
nautilus_search_directory_set_query (NautilusSearchDirectory *search,
NautilusQuery *query)
{
- NautilusDirectory *dir;
- NautilusFile *as_file;
+ NautilusFile *file;
if (search->details->query != query) {
search->details->modified = TRUE;
- }
- if (query) {
- g_object_ref (query);
- }
+ if (query) {
+ g_object_ref (query);
+ }
- if (search->details->query) {
- g_object_unref (search->details->query);
- }
+ g_clear_object (&search->details->query);
+ search->details->query = query;
- search->details->query = query;
+ g_object_notify_by_pspec (G_OBJECT (search), properties[PROP_QUERY]);
+ }
- dir = NAUTILUS_DIRECTORY (search);
- as_file = dir->details->as_file;
- if (as_file != NULL) {
- nautilus_search_directory_file_update_display_name (NAUTILUS_SEARCH_DIRECTORY_FILE (as_file));
+ file = nautilus_directory_get_existing_corresponding_file (NAUTILUS_DIRECTORY (search));
+ if (file != NULL) {
+ nautilus_search_directory_file_update_display_name (NAUTILUS_SEARCH_DIRECTORY_FILE (file));
+ g_object_unref (file);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]