[gnome-control-center] search: make options insensitive if tracker is not available



commit 2ad13d89f3e32fcf59edd271321d04136a6c2267
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Nov 14 10:47:50 2012 -0500

    search: make options insensitive if tracker is not available
    
    Instead of either hard-depending on Tracker being installed, or crashing
    when the Tracker GSettings schema is not found, make the configuration
    insensitive if the schema is not available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687490

 panels/search/cc-search-locations-dialog.c |   22 ++++++++++++++++++++++
 panels/search/cc-search-locations-dialog.h |    2 ++
 panels/search/cc-search-panel.c            |    1 +
 3 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/panels/search/cc-search-locations-dialog.c b/panels/search/cc-search-locations-dialog.c
index 67b3c84..c9b18be 100644
--- a/panels/search/cc-search-locations-dialog.c
+++ b/panels/search/cc-search-locations-dialog.c
@@ -754,3 +754,25 @@ cc_search_locations_dialog_new (CcSearchPanel *self)
 
   return locations_dialog;
 }
+
+gboolean
+cc_search_locations_dialog_is_available (void)
+{
+  const gchar * const *schemas;
+  const gchar *schema;
+  gint idx;
+  gboolean found = FALSE;
+
+  schemas = g_settings_list_schemas ();
+  for (idx = 0; schemas[idx] != NULL; idx++)
+    {
+      schema = schemas[idx];
+      if (g_strcmp0 (schema, TRACKER_SCHEMA) == 0)
+        {
+          found = TRUE;
+          break;
+        }
+    }
+
+  return found;
+}
diff --git a/panels/search/cc-search-locations-dialog.h b/panels/search/cc-search-locations-dialog.h
index 8831abd..caaade1 100644
--- a/panels/search/cc-search-locations-dialog.h
+++ b/panels/search/cc-search-locations-dialog.h
@@ -26,4 +26,6 @@
 
 GtkWidget *cc_search_locations_dialog_new (CcSearchPanel *panel);
 
+gboolean cc_search_locations_dialog_is_available (void);
+
 #endif /* _CC_SEARCH_LOCATIONS_DIALOG_H */
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index 217a6fc..f73d1c0 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -616,6 +616,7 @@ cc_search_panel_init (CcSearchPanel *self)
   widget = WID ("settings_button");
   g_signal_connect (widget, "clicked",
                     G_CALLBACK (settings_button_clicked), self);
+  gtk_widget_set_sensitive (widget, cc_search_locations_dialog_is_available ());
 
   self->priv->search_settings = g_settings_new ("org.gnome.desktop.search-providers");
   self->priv->sort_order = g_hash_table_new_full (g_str_hash, g_str_equal,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]