diff options
author | Rebecca Schulman <rebecka@eazel.com> | 2001-02-20 03:29:18 +0000 |
---|---|---|
committer | Rebecca Schulman <rebecka@src.gnome.org> | 2001-02-20 03:29:18 +0000 |
commit | 5510539d69fb21f656e79798aecf24992259014d (patch) | |
tree | 9a89fff32134e69dc78906df604a0b88572fde9d | |
parent | 19f5c02f750177827d4aff1c8fd950db33c8d1bb (diff) | |
download | nautilus-5510539d69fb21f656e79798aecf24992259014d.tar.gz |
Fix bugzilla.eazel.com 6414 to add prefence to nautilus to enable/disable
2001-02-20 Rebecca Schulman <rebecka@eazel.com>
Fix bugzilla.eazel.com 6414 to add prefence to nautilus
to enable/disable medusa
* libnautilus-extensions/nautilus-global-preferences.h:
* libnautilus-extensions/nautilus-global-preferences.c:
(global_preferences_install_descriptions),
(global_preferences_install_defaults),
(global_preferences_install_visibility),
(global_preferences_create_dialog):
Add the fast search preference pane, visibility level,
change SEARCH_METHOD -> BACKUP_SEARCH
* libnautilus-extensions/nautilus-system-preferences.c:
* libnautilus-extensions/nautilus-system-preferences.h:
* libnautilus-extensions/Makefile.am:
(nautilus_is_system_preference),
(nautilus_system_preference_get_boolean),
(nautilus_system_preference_set_boolean):
Add setters and getters for system preferences that are not
managed by gconf. The current set and get functions
turn on and off medusa services
* libnautilus-extensions/nautilus-preferences.c:
(nautilus_preferences_set_boolean),
(nautilus_preferences_get_boolean):
Use the new system preference setters and getters instead of the standard
ones if the preference is not managed by gconf
* src/file-manager/fm-search-list-view.c: (load_location_callback),
(display_system_services_are_blocked_dialog):
* src/nautilus-complex-search-bar.c:
(nautilus_complex_search_bar_get_location):
change SEARCH_METHOD -> BACKUP_SEARCH
-rw-r--r-- | ChangeLog | 35 | ||||
-rw-r--r-- | libnautilus-extensions/Makefile.am | 2 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.c | 26 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.h | 5 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-preferences.c | 10 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-system-preferences.c | 70 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-system-preferences.h | 44 | ||||
-rw-r--r-- | libnautilus-private/Makefile.am | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.c | 26 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.h | 5 | ||||
-rw-r--r-- | libnautilus-private/nautilus-preferences.c | 10 | ||||
-rw-r--r-- | libnautilus-private/nautilus-system-preferences.c | 70 | ||||
-rw-r--r-- | libnautilus-private/nautilus-system-preferences.h | 44 | ||||
-rw-r--r-- | src/file-manager/fm-search-list-view.c | 3 | ||||
-rw-r--r-- | src/nautilus-complex-search-bar.c | 2 |
15 files changed, 336 insertions, 18 deletions
@@ -1,3 +1,38 @@ +2001-02-20 Rebecca Schulman <rebecka@eazel.com> + Fix bugzilla.eazel.com 6414 to add prefence to nautilus + to enable/disable medusa + + * libnautilus-extensions/nautilus-global-preferences.h: + * libnautilus-extensions/nautilus-global-preferences.c: + (global_preferences_install_descriptions), + (global_preferences_install_defaults), + (global_preferences_install_visibility), + (global_preferences_create_dialog): + Add the fast search preference pane, visibility level, + change SEARCH_METHOD -> BACKUP_SEARCH + + * libnautilus-extensions/nautilus-system-preferences.c: + * libnautilus-extensions/nautilus-system-preferences.h: + * libnautilus-extensions/Makefile.am: + (nautilus_is_system_preference), + (nautilus_system_preference_get_boolean), + (nautilus_system_preference_set_boolean): + Add setters and getters for system preferences that are not + managed by gconf. The current set and get functions + turn on and off medusa services + + * libnautilus-extensions/nautilus-preferences.c: + (nautilus_preferences_set_boolean), + (nautilus_preferences_get_boolean): + Use the new system preference setters and getters instead of the standard + ones if the preference is not managed by gconf + + * src/file-manager/fm-search-list-view.c: (load_location_callback), + (display_system_services_are_blocked_dialog): + * src/nautilus-complex-search-bar.c: + (nautilus_complex_search_bar_get_location): + change SEARCH_METHOD -> BACKUP_SEARCH + 2001-02-19 Maciej Stachowiak <mjs@eazel.com> reviewed by: John Harper <jsh@eazel.com> diff --git a/libnautilus-extensions/Makefile.am b/libnautilus-extensions/Makefile.am index 771e2bf72..f665064fd 100644 --- a/libnautilus-extensions/Makefile.am +++ b/libnautilus-extensions/Makefile.am @@ -145,6 +145,7 @@ libnautilus_extensions_la_SOURCES = \ nautilus-string-map.c \ nautilus-string-picker.c \ nautilus-string.c \ + nautilus-system-preferences.c \ nautilus-tabs.c \ nautilus-text-caption.c \ nautilus-text-layout.c \ @@ -266,6 +267,7 @@ noinst_HEADERS = \ nautilus-string-map.h \ nautilus-string-picker.h \ nautilus-string.h \ + nautilus-system-preferences.h \ nautilus-tabs.h \ nautilus-text-caption.h \ nautilus-text-layout.h \ diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c index 5cc921982..fc2a6fa64 100644 --- a/libnautilus-extensions/nautilus-global-preferences.c +++ b/libnautilus-extensions/nautilus-global-preferences.c @@ -32,6 +32,7 @@ #include "nautilus-preferences-group.h" #include "nautilus-preferences-item.h" #include "nautilus-string.h" +#include "nautilus-system-preferences.h" #include "nautilus-view-identifier.h" #include <gconf/gconf.h> #include <gconf/gconf-client.h> @@ -166,7 +167,14 @@ global_preferences_install_descriptions (void) nautilus_preferences_set_description (NAUTILUS_PREFERENCES_SHOW_DESKTOP, _("Use Nautilus to draw the desktop")); - nautilus_preferences_set_description (NAUTILUS_PREFERENCES_SEARCH_METHOD, + /* search tradeoffs */ + nautilus_preferences_set_description (NAUTILUS_PREFERENCES_USE_FAST_SEARCH, + _("Enable fast search (indexes your hard drive)\n" + "Turns on the Medusa daemon, which indexes your hard disk\n" + "when your computer is idle.")); + + + nautilus_preferences_set_description (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, _("Do slower but more complete search whenever possible\n" "(slower search is not available when searching by content)")); @@ -301,7 +309,7 @@ global_preferences_install_defaults (void) nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_SHOW_DESKTOP, NAUTILUS_USER_LEVEL_NOVICE, TRUE); - nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_SEARCH_METHOD, + nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, NAUTILUS_USER_LEVEL_NOVICE, TRUE); @@ -454,7 +462,10 @@ global_preferences_install_visibility (void) nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE, NAUTILUS_USER_LEVEL_INTERMEDIATE); - nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_SEARCH_METHOD, + nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_USE_FAST_SEARCH, + NAUTILUS_USER_LEVEL_INTERMEDIATE); + + nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, NAUTILUS_USER_LEVEL_INTERMEDIATE); nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_SEARCH_WEB_URI, @@ -589,7 +600,6 @@ global_preferences_create_dialog (void) _("Icon & List Views"), _("Icon & List Views Settings")); - nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Click Behavior")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), @@ -682,10 +692,16 @@ global_preferences_create_dialog (void) NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE, NAUTILUS_PREFERENCE_ITEM_ENUM); nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), + _("Fast Search")); + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), + 1, + NAUTILUS_PREFERENCES_USE_FAST_SEARCH, + NAUTILUS_PREFERENCE_ITEM_BOOLEAN); + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), _("Search Tradeoffs")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), 1, - NAUTILUS_PREFERENCES_SEARCH_METHOD, + NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, NAUTILUS_PREFERENCE_ITEM_BOOLEAN); diff --git a/libnautilus-extensions/nautilus-global-preferences.h b/libnautilus-extensions/nautilus-global-preferences.h index 9a7d8d9d3..a61434a9b 100644 --- a/libnautilus-extensions/nautilus-global-preferences.h +++ b/libnautilus-extensions/nautilus-global-preferences.h @@ -90,9 +90,8 @@ BEGIN_GNOME_DECLS #define NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY "directory-view/font_family" /* File Indexing */ -/* This "SEARCH_METHOD" name isn't a good name, because it sounds like an - enum value rather than a boolean. We should change it so it is more clear. */ -#define NAUTILUS_PREFERENCES_SEARCH_METHOD "preferences/also_do_slow_search" +#define NAUTILUS_PREFERENCES_USE_FAST_SEARCH "preferences/use_medusa" +#define NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH "preferences/use_backup_search" #define NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE "preferences/search_bar_type" /* searching */ diff --git a/libnautilus-extensions/nautilus-preferences.c b/libnautilus-extensions/nautilus-preferences.c index 99730a9bf..076d4c146 100644 --- a/libnautilus-extensions/nautilus-preferences.c +++ b/libnautilus-extensions/nautilus-preferences.c @@ -28,6 +28,7 @@ #include "nautilus-gconf-extensions.h" #include "nautilus-string-list.h" #include "nautilus-string.h" +#include "nautilus-system-preferences.h" #include "nautilus-glib-extensions.h" #include "nautilus-enumeration.h" #include "nautilus-lib-self-check-functions.h" @@ -408,6 +409,11 @@ nautilus_preferences_set_boolean (const char *name, g_return_if_fail (name != NULL); + if (nautilus_is_system_preference (name)) { + nautilus_system_preference_set_boolean (name, boolean_value); + return; + } + key = preferences_key_make (name); nautilus_gconf_set_boolean (key, boolean_value); g_free (key); @@ -438,6 +444,10 @@ nautilus_preferences_get_boolean (const char *name) char *key; g_return_val_if_fail (name != NULL, FALSE); + + if (nautilus_is_system_preference (name)) { + return nautilus_system_preference_get_boolean (name); + } key = preferences_key_make_for_getter (name); result = nautilus_gconf_get_boolean (key); diff --git a/libnautilus-extensions/nautilus-system-preferences.c b/libnautilus-extensions/nautilus-system-preferences.c new file mode 100644 index 000000000..867bd5e7a --- /dev/null +++ b/libnautilus-extensions/nautilus-system-preferences.c @@ -0,0 +1,70 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-system-preferences.c - Preferences that cannot be managed with gconf + + Copyright (C) 2001 Eazel, Inc. + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Authors: Rebecca Schulman <rebecka@eazel.com> +*/ + +#include <config.h> +#include <glib.h> +#include <string.h> + +#include "nautilus-global-preferences.h" +#include "nautilus-system-preferences.h" + +#ifdef HAVE_MEDUSA +#include <libmedusa/medusa-system-state.h> +#endif HAVE_MEDUSA + + +gboolean +nautilus_is_system_preference (const char *preference_name) +{ + g_return_val_if_fail (preference_name != NULL, FALSE); + + return strcmp (preference_name, NAUTILUS_PREFERENCES_USE_FAST_SEARCH) == 0; +} + +gboolean +nautilus_system_preference_get_boolean (const char *preference_name) +{ + g_return_val_if_fail (preference_name != NULL, FALSE); + g_return_val_if_fail (nautilus_is_system_preference (preference_name), FALSE); + +#ifdef HAVE_MEDUSA + return medusa_system_services_have_been_enabled_by_user (g_get_user_name ()); +#else + return FALSE; +#endif +} + +void +nautilus_system_preference_set_boolean (const char *preference_name, + gboolean value) +{ + g_return_if_fail (preference_name != NULL); + g_return_if_fail (nautilus_is_system_preference (preference_name)); + +#ifdef HAVE_MEDUSA + medusa_enable_medusa_services (value); +#endif +} + + diff --git a/libnautilus-extensions/nautilus-system-preferences.h b/libnautilus-extensions/nautilus-system-preferences.h new file mode 100644 index 000000000..daf6ef47e --- /dev/null +++ b/libnautilus-extensions/nautilus-system-preferences.h @@ -0,0 +1,44 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-system-preferences.h - Preferences that cannot be managed + with gconf + + Copyright (C) 2001 Eazel, Inc. + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Authors: Rebecca Schulman <rebecka@eazel.com> +*/ + +#ifndef NAUTILUS_SYSTEM_PREFERENCES_H +#define NAUTILUS_SYSTEM_PREFERENCES_H + +#include <glib.h> + +gboolean nautilus_is_system_preference (const char *preference_name); + +gboolean nautilus_system_preference_get_boolean (const char *preference_name); +void nautilus_system_preference_set_boolean (const char *preference_name, + gboolean preference_value); + +void nautilus_system_preferences_initialize (void); + +/* Set up callbacks that will change system preferences if they are changed at the command line. */ +void nautilus_system_preferences_check_for_system_level_changes (void); + + +#endif /* NAUTILUS_SYSTEM_PREFERENCES_H */ + diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am index 771e2bf72..f665064fd 100644 --- a/libnautilus-private/Makefile.am +++ b/libnautilus-private/Makefile.am @@ -145,6 +145,7 @@ libnautilus_extensions_la_SOURCES = \ nautilus-string-map.c \ nautilus-string-picker.c \ nautilus-string.c \ + nautilus-system-preferences.c \ nautilus-tabs.c \ nautilus-text-caption.c \ nautilus-text-layout.c \ @@ -266,6 +267,7 @@ noinst_HEADERS = \ nautilus-string-map.h \ nautilus-string-picker.h \ nautilus-string.h \ + nautilus-system-preferences.h \ nautilus-tabs.h \ nautilus-text-caption.h \ nautilus-text-layout.h \ diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c index 5cc921982..fc2a6fa64 100644 --- a/libnautilus-private/nautilus-global-preferences.c +++ b/libnautilus-private/nautilus-global-preferences.c @@ -32,6 +32,7 @@ #include "nautilus-preferences-group.h" #include "nautilus-preferences-item.h" #include "nautilus-string.h" +#include "nautilus-system-preferences.h" #include "nautilus-view-identifier.h" #include <gconf/gconf.h> #include <gconf/gconf-client.h> @@ -166,7 +167,14 @@ global_preferences_install_descriptions (void) nautilus_preferences_set_description (NAUTILUS_PREFERENCES_SHOW_DESKTOP, _("Use Nautilus to draw the desktop")); - nautilus_preferences_set_description (NAUTILUS_PREFERENCES_SEARCH_METHOD, + /* search tradeoffs */ + nautilus_preferences_set_description (NAUTILUS_PREFERENCES_USE_FAST_SEARCH, + _("Enable fast search (indexes your hard drive)\n" + "Turns on the Medusa daemon, which indexes your hard disk\n" + "when your computer is idle.")); + + + nautilus_preferences_set_description (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, _("Do slower but more complete search whenever possible\n" "(slower search is not available when searching by content)")); @@ -301,7 +309,7 @@ global_preferences_install_defaults (void) nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_SHOW_DESKTOP, NAUTILUS_USER_LEVEL_NOVICE, TRUE); - nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_SEARCH_METHOD, + nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, NAUTILUS_USER_LEVEL_NOVICE, TRUE); @@ -454,7 +462,10 @@ global_preferences_install_visibility (void) nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE, NAUTILUS_USER_LEVEL_INTERMEDIATE); - nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_SEARCH_METHOD, + nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_USE_FAST_SEARCH, + NAUTILUS_USER_LEVEL_INTERMEDIATE); + + nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, NAUTILUS_USER_LEVEL_INTERMEDIATE); nautilus_preferences_set_visible_user_level (NAUTILUS_PREFERENCES_SEARCH_WEB_URI, @@ -589,7 +600,6 @@ global_preferences_create_dialog (void) _("Icon & List Views"), _("Icon & List Views Settings")); - nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Click Behavior")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), @@ -682,10 +692,16 @@ global_preferences_create_dialog (void) NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE, NAUTILUS_PREFERENCE_ITEM_ENUM); nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), + _("Fast Search")); + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), + 1, + NAUTILUS_PREFERENCES_USE_FAST_SEARCH, + NAUTILUS_PREFERENCE_ITEM_BOOLEAN); + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), _("Search Tradeoffs")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (file_indexing_pane), 1, - NAUTILUS_PREFERENCES_SEARCH_METHOD, + NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH, NAUTILUS_PREFERENCE_ITEM_BOOLEAN); diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h index 9a7d8d9d3..a61434a9b 100644 --- a/libnautilus-private/nautilus-global-preferences.h +++ b/libnautilus-private/nautilus-global-preferences.h @@ -90,9 +90,8 @@ BEGIN_GNOME_DECLS #define NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY "directory-view/font_family" /* File Indexing */ -/* This "SEARCH_METHOD" name isn't a good name, because it sounds like an - enum value rather than a boolean. We should change it so it is more clear. */ -#define NAUTILUS_PREFERENCES_SEARCH_METHOD "preferences/also_do_slow_search" +#define NAUTILUS_PREFERENCES_USE_FAST_SEARCH "preferences/use_medusa" +#define NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH "preferences/use_backup_search" #define NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE "preferences/search_bar_type" /* searching */ diff --git a/libnautilus-private/nautilus-preferences.c b/libnautilus-private/nautilus-preferences.c index 99730a9bf..076d4c146 100644 --- a/libnautilus-private/nautilus-preferences.c +++ b/libnautilus-private/nautilus-preferences.c @@ -28,6 +28,7 @@ #include "nautilus-gconf-extensions.h" #include "nautilus-string-list.h" #include "nautilus-string.h" +#include "nautilus-system-preferences.h" #include "nautilus-glib-extensions.h" #include "nautilus-enumeration.h" #include "nautilus-lib-self-check-functions.h" @@ -408,6 +409,11 @@ nautilus_preferences_set_boolean (const char *name, g_return_if_fail (name != NULL); + if (nautilus_is_system_preference (name)) { + nautilus_system_preference_set_boolean (name, boolean_value); + return; + } + key = preferences_key_make (name); nautilus_gconf_set_boolean (key, boolean_value); g_free (key); @@ -438,6 +444,10 @@ nautilus_preferences_get_boolean (const char *name) char *key; g_return_val_if_fail (name != NULL, FALSE); + + if (nautilus_is_system_preference (name)) { + return nautilus_system_preference_get_boolean (name); + } key = preferences_key_make_for_getter (name); result = nautilus_gconf_get_boolean (key); diff --git a/libnautilus-private/nautilus-system-preferences.c b/libnautilus-private/nautilus-system-preferences.c new file mode 100644 index 000000000..867bd5e7a --- /dev/null +++ b/libnautilus-private/nautilus-system-preferences.c @@ -0,0 +1,70 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-system-preferences.c - Preferences that cannot be managed with gconf + + Copyright (C) 2001 Eazel, Inc. + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Authors: Rebecca Schulman <rebecka@eazel.com> +*/ + +#include <config.h> +#include <glib.h> +#include <string.h> + +#include "nautilus-global-preferences.h" +#include "nautilus-system-preferences.h" + +#ifdef HAVE_MEDUSA +#include <libmedusa/medusa-system-state.h> +#endif HAVE_MEDUSA + + +gboolean +nautilus_is_system_preference (const char *preference_name) +{ + g_return_val_if_fail (preference_name != NULL, FALSE); + + return strcmp (preference_name, NAUTILUS_PREFERENCES_USE_FAST_SEARCH) == 0; +} + +gboolean +nautilus_system_preference_get_boolean (const char *preference_name) +{ + g_return_val_if_fail (preference_name != NULL, FALSE); + g_return_val_if_fail (nautilus_is_system_preference (preference_name), FALSE); + +#ifdef HAVE_MEDUSA + return medusa_system_services_have_been_enabled_by_user (g_get_user_name ()); +#else + return FALSE; +#endif +} + +void +nautilus_system_preference_set_boolean (const char *preference_name, + gboolean value) +{ + g_return_if_fail (preference_name != NULL); + g_return_if_fail (nautilus_is_system_preference (preference_name)); + +#ifdef HAVE_MEDUSA + medusa_enable_medusa_services (value); +#endif +} + + diff --git a/libnautilus-private/nautilus-system-preferences.h b/libnautilus-private/nautilus-system-preferences.h new file mode 100644 index 000000000..daf6ef47e --- /dev/null +++ b/libnautilus-private/nautilus-system-preferences.h @@ -0,0 +1,44 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-system-preferences.h - Preferences that cannot be managed + with gconf + + Copyright (C) 2001 Eazel, Inc. + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Authors: Rebecca Schulman <rebecka@eazel.com> +*/ + +#ifndef NAUTILUS_SYSTEM_PREFERENCES_H +#define NAUTILUS_SYSTEM_PREFERENCES_H + +#include <glib.h> + +gboolean nautilus_is_system_preference (const char *preference_name); + +gboolean nautilus_system_preference_get_boolean (const char *preference_name); +void nautilus_system_preference_set_boolean (const char *preference_name, + gboolean preference_value); + +void nautilus_system_preferences_initialize (void); + +/* Set up callbacks that will change system preferences if they are changed at the command line. */ +void nautilus_system_preferences_check_for_system_level_changes (void); + + +#endif /* NAUTILUS_SYSTEM_PREFERENCES_H */ + diff --git a/src/file-manager/fm-search-list-view.c b/src/file-manager/fm-search-list-view.c index 900cf5bd0..5250c52e4 100644 --- a/src/file-manager/fm-search-list-view.c +++ b/src/file-manager/fm-search-list-view.c @@ -137,7 +137,7 @@ load_location_callback (NautilusView *nautilus_view, char *location) indexed_search_is_available = medusa_indexed_search_is_available () == GNOME_VFS_OK; if (indexed_search_is_available && - !nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SEARCH_METHOD)) { + !nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH)) { last_indexing_time = nautilus_indexing_info_get_last_index_time (); if (last_indexing_time) { status_string = g_strdup_printf (_("Search results may not include items modified after %s, " @@ -367,6 +367,7 @@ display_system_services_are_blocked_dialog (gboolean unindexed_search_is_availab "minutes. "), _("Indexing is Blocked on Your Computer"), NULL); + } diff --git a/src/nautilus-complex-search-bar.c b/src/nautilus-complex-search-bar.c index 371ea6aeb..e9a06c182 100644 --- a/src/nautilus-complex-search-bar.c +++ b/src/nautilus-complex-search-bar.c @@ -356,7 +356,7 @@ nautilus_complex_search_bar_get_location (NautilusNavigationBar *navigation_bar) escaped_fragment = gnome_vfs_escape_string (trimmed_fragment); g_free (trimmed_fragment); - if (nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SEARCH_METHOD)) { + if (nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_USE_BACKUP_SEARCH)) { search_uri = g_strconcat ("search:index-with-backup", escaped_fragment, NULL); } else { search_uri = g_strconcat ("search:index-if-available", escaped_fragment, NULL); |