summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-04-24 00:46:13 +0000
committerDarin Adler <darin@src.gnome.org>2001-04-24 00:46:13 +0000
commita72923da4faaeec4f15abe06cbaf1691b3a660b0 (patch)
tree2e1bd6091a9bb7ea53444016ac6343b352c19f71
parentdc5c20a6fe37f363d9231bb402b555a34894cd48 (diff)
downloadnautilus-a72923da4faaeec4f15abe06cbaf1691b3a660b0.tar.gz
reviewed by: John Sullivan <sullivan@eazel.com>
Add a new command-line option "--no-desktop" as requested by fcrozat on behalf of people who want to run Nautilus under KDE as well as under GNOME. The option has no effect if Nautilus is already running, but if it's the first invocation of Nautilus, then no desktop-related preferences show up and the desktop is not shown regardless of the setting of those preferences. * src/nautilus-main.c: (main): Add the no-desktop option. Make the desktop-related preferences invisible if it's on, and pass it down to the NautilusApplication. * src/nautilus-application.h: * src/nautilus-application.c: (nautilus_application_startup): Don't start the desktop if no_desktop is passed in. Otherwise decide based on the preference. * libnautilus-extensions/nautilus-preferences-box.c: (preferences_box_find_row): Mark this private function static. (preferences_box_populate_pane): Get rid of code that would translate the pane_name twice. (nautilus_preferences_dialog_new): Simplified this code a bit. * libnautilus-extensions/nautilus-preferences.h: * libnautilus-extensions/nautilus-preferences.c: (preferences_make_user_level_filtered_key), (nautilus_preferences_get_is_invisible), (nautilus_preferences_set_is_invisible), (preferences_key_make_for_getter), (nautilus_preferences_visible_in_current_user_level), (nautilus_preferences_is_visible): Added new flag to make a preference invisible. * src/nautilus-first-time-druid.h: * src/nautilus-first-time-druid.c: (set_up_gmc_transition_page), (nautilus_first_time_druid_show): Removed code that used to make the druid default based on the desktop preference. Fixed the Tinderbox. * libnautilus-extensions/nautilus-global-preferences.c: (default_default_folder_viewer_callback): Allow NULL because that happens during self-check.
-rw-r--r--ChangeLog47
-rw-r--r--libnautilus-extensions/nautilus-global-preferences.c12
-rw-r--r--libnautilus-extensions/nautilus-preferences-box.c50
-rw-r--r--libnautilus-extensions/nautilus-preferences.c39
-rw-r--r--libnautilus-extensions/nautilus-preferences.h4
-rw-r--r--libnautilus-private/nautilus-global-preferences.c12
-rw-r--r--libnautilus-private/nautilus-preferences-box.c50
-rw-r--r--libnautilus-private/nautilus-preferences.c39
-rw-r--r--libnautilus-private/nautilus-preferences.h4
-rw-r--r--src/nautilus-application.c6
-rw-r--r--src/nautilus-application.h2
-rw-r--r--src/nautilus-first-time-druid.c8
-rw-r--r--src/nautilus-first-time-druid.h3
-rw-r--r--src/nautilus-main.c27
14 files changed, 209 insertions, 94 deletions
diff --git a/ChangeLog b/ChangeLog
index 0564ce68d..3024a99ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+2001-04-23 Darin Adler <darin@eazel.com>
+
+ reviewed by: John Sullivan <sullivan@eazel.com>
+
+ Add a new command-line option "--no-desktop" as requested by
+ fcrozat on behalf of people who want to run Nautilus under KDE as
+ well as under GNOME. The option has no effect if Nautilus is
+ already running, but if it's the first invocation of Nautilus,
+ then no desktop-related preferences show up and the desktop is
+ not shown regardless of the setting of those preferences.
+
+ * src/nautilus-main.c: (main): Add the no-desktop option. Make the
+ desktop-related preferences invisible if it's on, and pass it down
+ to the NautilusApplication.
+
+ * src/nautilus-application.h:
+ * src/nautilus-application.c: (nautilus_application_startup):
+ Don't start the desktop if no_desktop is passed in. Otherwise
+ decide based on the preference.
+
+ * libnautilus-extensions/nautilus-preferences-box.c:
+ (preferences_box_find_row): Mark this private function static.
+ (preferences_box_populate_pane): Get rid of code that would
+ translate the pane_name twice.
+ (nautilus_preferences_dialog_new): Simplified this code a bit.
+
+ * libnautilus-extensions/nautilus-preferences.h:
+ * libnautilus-extensions/nautilus-preferences.c:
+ (preferences_make_user_level_filtered_key),
+ (nautilus_preferences_get_is_invisible),
+ (nautilus_preferences_set_is_invisible),
+ (preferences_key_make_for_getter),
+ (nautilus_preferences_visible_in_current_user_level),
+ (nautilus_preferences_is_visible): Added new flag to make a
+ preference invisible.
+
+ * src/nautilus-first-time-druid.h:
+ * src/nautilus-first-time-druid.c: (set_up_gmc_transition_page),
+ (nautilus_first_time_druid_show): Removed code that used to make
+ the druid default based on the desktop preference.
+
+ Fixed the Tinderbox.
+
+ * libnautilus-extensions/nautilus-global-preferences.c:
+ (default_default_folder_viewer_callback): Allow NULL because that
+ happens during self-check.
+
2001-04-23 Andy Hertzfeld <andy@eazel.com>
* components/news/nautilus-news.c: (has_matching_uri),
diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c
index d15be8014..0f45dd1c8 100644
--- a/libnautilus-extensions/nautilus-global-preferences.c
+++ b/libnautilus-extensions/nautilus-global-preferences.c
@@ -824,13 +824,15 @@ default_default_folder_viewer_callback (int user_level)
int result;
oaf_info = gnome_vfs_mime_get_default_component ("x-directory/normal");
- g_return_val_if_fail (oaf_info != NULL, NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW);
-
- result = get_default_folder_viewer_preference_from_iid (oaf_info->iid);
- if (result == NAUTILUS_DEFAULT_FOLDER_VIEWER_OTHER) {
+ if (oaf_info == NULL) {
result = NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW;
+ } else {
+ result = get_default_folder_viewer_preference_from_iid (oaf_info->iid);
+ if (result == NAUTILUS_DEFAULT_FOLDER_VIEWER_OTHER) {
+ result = NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW;
+ }
+ CORBA_free (oaf_info);
}
- CORBA_free (oaf_info);
return GINT_TO_POINTER (result);
}
diff --git a/libnautilus-extensions/nautilus-preferences-box.c b/libnautilus-extensions/nautilus-preferences-box.c
index 8204ce4b5..18d96e00c 100644
--- a/libnautilus-extensions/nautilus-preferences-box.c
+++ b/libnautilus-extensions/nautilus-preferences-box.c
@@ -2,7 +2,7 @@
/* nautilus-prefs-box.h - Implementation for preferences box component.
- Copyright (C) 1999, 2000 Eazel, Inc.
+ Copyright (C) 1999, 2000, 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
@@ -81,10 +81,9 @@ static void category_list_select_row_callback (GtkCList
gpointer user_data);
/* Convience functions */
-int preferences_box_find_row (GtkCList *clist,
+static int preferences_box_find_row (GtkCList *clist,
char *pane_name);
-
-static void user_level_changed_callback (gpointer callback_data);
+static void user_level_changed_callback (gpointer callback_data);
EEL_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesBox, nautilus_preferences_box, GTK_TYPE_HBOX)
@@ -186,7 +185,7 @@ preferences_box_select_pane (NautilusPreferencesBox *preferences_box,
g_warning ("Pane '%s' could not be found.", pane_name);
}
-int
+static int
preferences_box_find_row (GtkCList *clist, char *pane_name)
{
int i;
@@ -430,6 +429,7 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
NautilusPreferencesGroup *group;
NautilusPreferencesItem *item;
EelStringList *group_names;
+ const char *translated_group_name;
guint i;
g_return_if_fail (NAUTILUS_IS_PREFERENCES_BOX (preferences_box));
@@ -437,18 +437,19 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
g_return_if_fail (items != NULL);
/* Create the pane if needed */
- pane = preferences_box_find_pane (preferences_box, _(pane_name));
+ pane = preferences_box_find_pane (preferences_box, pane_name);
if (pane == NULL) {
- pane = NAUTILUS_PREFERENCES_PANE (preferences_box_add_pane (preferences_box, _(pane_name)));
+ pane = NAUTILUS_PREFERENCES_PANE (preferences_box_add_pane (preferences_box, pane_name));
}
group_names = eel_string_list_new (TRUE);
for (i = 0; items[i].group_name != NULL; i++) {
- if (!eel_string_list_contains (group_names, _(items[i].group_name))) {
- eel_string_list_insert (group_names, _(items[i].group_name));
+ translated_group_name = _(items[i].group_name);
+ if (!eel_string_list_contains (group_names, translated_group_name)) {
+ eel_string_list_insert (group_names, translated_group_name);
nautilus_preferences_pane_add_group (pane,
- _(items[i].group_name));
+ translated_group_name);
}
}
@@ -457,12 +458,12 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
_(items[i].group_name)));
g_return_if_fail (NAUTILUS_IS_PREFERENCES_GROUP (group));
- if (items[i].preference_description != NULL) {
- nautilus_preferences_set_description (items[i].preference_name,
- _(items[i].preference_description));
- }
-
if (items[i].preference_name != NULL) {
+ if (items[i].preference_description != NULL) {
+ nautilus_preferences_set_description (items[i].preference_name,
+ _(items[i].preference_description));
+ }
+
item = NAUTILUS_PREFERENCES_ITEM (nautilus_preferences_group_add_item (group,
items[i].preference_name,
items[i].item_type,
@@ -473,11 +474,9 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
nautilus_preferences_item_set_control_preference (item,
items[i].control_preference_name);
nautilus_preferences_item_set_control_action (item,
- items[i].control_action);
-
+ items[i].control_action);
nautilus_preferences_pane_add_control_preference (pane,
items[i].control_preference_name);
-
}
/* Install exceptions to enum lists uniqueness rule */
@@ -524,17 +523,14 @@ user_level_changed_callback (gpointer callback_data)
nautilus_preferences_box_update (NAUTILUS_PREFERENCES_BOX (callback_data));
}
-static const gchar *stock_buttons[] = {
- GNOME_STOCK_BUTTON_OK,
- NULL
-};
-
-#define DEFAULT_BUTTON 0
-
GtkWidget *
nautilus_preferences_dialog_new (const char *title,
const NautilusPreferencesPaneDescription *panes)
{
+ static const char *stock_buttons[] = {
+ GNOME_STOCK_BUTTON_OK,
+ NULL
+ };
GtkWidget *dialog;
GtkWidget *preference_box;
GtkWidget *vbox;
@@ -550,9 +546,9 @@ nautilus_preferences_dialog_new (const char *title,
TRUE, /* allow_grow */
FALSE); /* auto_shrink */
- gtk_container_set_border_width (GTK_CONTAINER(dialog), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 0);
- gnome_dialog_set_default (GNOME_DIALOG(dialog), DEFAULT_BUTTON);
+ gnome_dialog_set_default (GNOME_DIALOG(dialog), 0);
eel_gtk_window_set_up_close_accelerator (GTK_WINDOW (dialog));
diff --git a/libnautilus-extensions/nautilus-preferences.c b/libnautilus-extensions/nautilus-preferences.c
index 9df5f6175..cd5ea51f4 100644
--- a/libnautilus-extensions/nautilus-preferences.c
+++ b/libnautilus-extensions/nautilus-preferences.c
@@ -65,6 +65,7 @@ typedef struct {
char *name;
char *description;
PreferenceType type;
+ gboolean invisible;
GList *callback_list;
gboolean callbacks_blocked;
GList *auto_storage_list;
@@ -320,7 +321,7 @@ preferences_make_user_level_filtered_key (const char *name)
g_return_val_if_fail (name != NULL, NULL);
- if (nautilus_preferences_is_visible (name)) {
+ if (nautilus_preferences_visible_in_current_user_level (name)) {
key = preferences_key_make (name);
} else {
key = preferences_key_make_for_default (name, nautilus_preferences_get_user_level ());
@@ -388,6 +389,25 @@ nautilus_preferences_set_visible_user_level (const char *name,
g_free (visible_key);
}
+gboolean
+nautilus_preferences_get_is_invisible (const char *name)
+{
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (preferences_is_initialized (), FALSE);
+
+ return preferences_global_table_lookup_or_insert (name)->invisible;
+}
+
+void
+nautilus_preferences_set_is_invisible (const char *name,
+ gboolean is_invisible)
+{
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (preferences_is_initialized ());
+
+ preferences_global_table_lookup_or_insert (name)->invisible = is_invisible;
+}
+
void
nautilus_preferences_set_boolean (const char *name,
gboolean boolean_value)
@@ -412,7 +432,7 @@ preferences_key_make_for_getter (const char *name)
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (preferences_is_initialized (), NULL);
- if (preferences_preference_is_default (name) || !nautilus_preferences_is_visible (name)) {
+ if (preferences_preference_is_default (name) || !nautilus_preferences_visible_in_current_user_level (name)) {
key = preferences_key_make_for_default_getter (name, nautilus_preferences_get_user_level ());
} else {
key = preferences_make_user_level_filtered_key (name);
@@ -1730,7 +1750,7 @@ nautilus_preferences_monitor_directory (const char *directory)
}
gboolean
-nautilus_preferences_is_visible (const char *name)
+nautilus_preferences_visible_in_current_user_level (const char *name)
{
int user_level;
int visible_user_level;
@@ -1744,6 +1764,19 @@ nautilus_preferences_is_visible (const char *name)
return visible_user_level <= user_level;
}
+gboolean
+nautilus_preferences_is_visible (const char *name)
+{
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (preferences_is_initialized (), FALSE);
+
+ if (!nautilus_preferences_visible_in_current_user_level (name)) {
+ return FALSE;
+ }
+
+ return !preferences_global_table_lookup_or_insert (name)->invisible;
+}
+
static void
preferences_remove_user_level_notice (void)
{
diff --git a/libnautilus-extensions/nautilus-preferences.h b/libnautilus-extensions/nautilus-preferences.h
index 2916a907f..2c4de5c7a 100644
--- a/libnautilus-extensions/nautilus-preferences.h
+++ b/libnautilus-extensions/nautilus-preferences.h
@@ -123,6 +123,9 @@ void nautilus_preferences_remove_auto_boolean (const char
int nautilus_preferences_get_visible_user_level (const char *name);
void nautilus_preferences_set_visible_user_level (const char *name,
int visible_user_level);
+gboolean nautilus_preferences_get_is_invisible (const char *name);
+void nautilus_preferences_set_is_invisible (const char *name,
+ gboolean invisible);
char * nautilus_preferences_get_description (const char *name);
void nautilus_preferences_set_description (const char *name,
const char *description);
@@ -130,6 +133,7 @@ char * nautilus_preferences_get_enumeration_id (const char
void nautilus_preferences_set_enumeration_id (const char *name,
const char *enumeration_id);
gboolean nautilus_preferences_monitor_directory (const char *directory);
+gboolean nautilus_preferences_visible_in_current_user_level (const char *name);
gboolean nautilus_preferences_is_visible (const char *name);
void nautilus_preferences_initialize (const char *storage_path);
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index d15be8014..0f45dd1c8 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -824,13 +824,15 @@ default_default_folder_viewer_callback (int user_level)
int result;
oaf_info = gnome_vfs_mime_get_default_component ("x-directory/normal");
- g_return_val_if_fail (oaf_info != NULL, NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW);
-
- result = get_default_folder_viewer_preference_from_iid (oaf_info->iid);
- if (result == NAUTILUS_DEFAULT_FOLDER_VIEWER_OTHER) {
+ if (oaf_info == NULL) {
result = NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW;
+ } else {
+ result = get_default_folder_viewer_preference_from_iid (oaf_info->iid);
+ if (result == NAUTILUS_DEFAULT_FOLDER_VIEWER_OTHER) {
+ result = NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW;
+ }
+ CORBA_free (oaf_info);
}
- CORBA_free (oaf_info);
return GINT_TO_POINTER (result);
}
diff --git a/libnautilus-private/nautilus-preferences-box.c b/libnautilus-private/nautilus-preferences-box.c
index 8204ce4b5..18d96e00c 100644
--- a/libnautilus-private/nautilus-preferences-box.c
+++ b/libnautilus-private/nautilus-preferences-box.c
@@ -2,7 +2,7 @@
/* nautilus-prefs-box.h - Implementation for preferences box component.
- Copyright (C) 1999, 2000 Eazel, Inc.
+ Copyright (C) 1999, 2000, 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
@@ -81,10 +81,9 @@ static void category_list_select_row_callback (GtkCList
gpointer user_data);
/* Convience functions */
-int preferences_box_find_row (GtkCList *clist,
+static int preferences_box_find_row (GtkCList *clist,
char *pane_name);
-
-static void user_level_changed_callback (gpointer callback_data);
+static void user_level_changed_callback (gpointer callback_data);
EEL_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesBox, nautilus_preferences_box, GTK_TYPE_HBOX)
@@ -186,7 +185,7 @@ preferences_box_select_pane (NautilusPreferencesBox *preferences_box,
g_warning ("Pane '%s' could not be found.", pane_name);
}
-int
+static int
preferences_box_find_row (GtkCList *clist, char *pane_name)
{
int i;
@@ -430,6 +429,7 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
NautilusPreferencesGroup *group;
NautilusPreferencesItem *item;
EelStringList *group_names;
+ const char *translated_group_name;
guint i;
g_return_if_fail (NAUTILUS_IS_PREFERENCES_BOX (preferences_box));
@@ -437,18 +437,19 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
g_return_if_fail (items != NULL);
/* Create the pane if needed */
- pane = preferences_box_find_pane (preferences_box, _(pane_name));
+ pane = preferences_box_find_pane (preferences_box, pane_name);
if (pane == NULL) {
- pane = NAUTILUS_PREFERENCES_PANE (preferences_box_add_pane (preferences_box, _(pane_name)));
+ pane = NAUTILUS_PREFERENCES_PANE (preferences_box_add_pane (preferences_box, pane_name));
}
group_names = eel_string_list_new (TRUE);
for (i = 0; items[i].group_name != NULL; i++) {
- if (!eel_string_list_contains (group_names, _(items[i].group_name))) {
- eel_string_list_insert (group_names, _(items[i].group_name));
+ translated_group_name = _(items[i].group_name);
+ if (!eel_string_list_contains (group_names, translated_group_name)) {
+ eel_string_list_insert (group_names, translated_group_name);
nautilus_preferences_pane_add_group (pane,
- _(items[i].group_name));
+ translated_group_name);
}
}
@@ -457,12 +458,12 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
_(items[i].group_name)));
g_return_if_fail (NAUTILUS_IS_PREFERENCES_GROUP (group));
- if (items[i].preference_description != NULL) {
- nautilus_preferences_set_description (items[i].preference_name,
- _(items[i].preference_description));
- }
-
if (items[i].preference_name != NULL) {
+ if (items[i].preference_description != NULL) {
+ nautilus_preferences_set_description (items[i].preference_name,
+ _(items[i].preference_description));
+ }
+
item = NAUTILUS_PREFERENCES_ITEM (nautilus_preferences_group_add_item (group,
items[i].preference_name,
items[i].item_type,
@@ -473,11 +474,9 @@ preferences_box_populate_pane (NautilusPreferencesBox *preferences_box,
nautilus_preferences_item_set_control_preference (item,
items[i].control_preference_name);
nautilus_preferences_item_set_control_action (item,
- items[i].control_action);
-
+ items[i].control_action);
nautilus_preferences_pane_add_control_preference (pane,
items[i].control_preference_name);
-
}
/* Install exceptions to enum lists uniqueness rule */
@@ -524,17 +523,14 @@ user_level_changed_callback (gpointer callback_data)
nautilus_preferences_box_update (NAUTILUS_PREFERENCES_BOX (callback_data));
}
-static const gchar *stock_buttons[] = {
- GNOME_STOCK_BUTTON_OK,
- NULL
-};
-
-#define DEFAULT_BUTTON 0
-
GtkWidget *
nautilus_preferences_dialog_new (const char *title,
const NautilusPreferencesPaneDescription *panes)
{
+ static const char *stock_buttons[] = {
+ GNOME_STOCK_BUTTON_OK,
+ NULL
+ };
GtkWidget *dialog;
GtkWidget *preference_box;
GtkWidget *vbox;
@@ -550,9 +546,9 @@ nautilus_preferences_dialog_new (const char *title,
TRUE, /* allow_grow */
FALSE); /* auto_shrink */
- gtk_container_set_border_width (GTK_CONTAINER(dialog), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 0);
- gnome_dialog_set_default (GNOME_DIALOG(dialog), DEFAULT_BUTTON);
+ gnome_dialog_set_default (GNOME_DIALOG(dialog), 0);
eel_gtk_window_set_up_close_accelerator (GTK_WINDOW (dialog));
diff --git a/libnautilus-private/nautilus-preferences.c b/libnautilus-private/nautilus-preferences.c
index 9df5f6175..cd5ea51f4 100644
--- a/libnautilus-private/nautilus-preferences.c
+++ b/libnautilus-private/nautilus-preferences.c
@@ -65,6 +65,7 @@ typedef struct {
char *name;
char *description;
PreferenceType type;
+ gboolean invisible;
GList *callback_list;
gboolean callbacks_blocked;
GList *auto_storage_list;
@@ -320,7 +321,7 @@ preferences_make_user_level_filtered_key (const char *name)
g_return_val_if_fail (name != NULL, NULL);
- if (nautilus_preferences_is_visible (name)) {
+ if (nautilus_preferences_visible_in_current_user_level (name)) {
key = preferences_key_make (name);
} else {
key = preferences_key_make_for_default (name, nautilus_preferences_get_user_level ());
@@ -388,6 +389,25 @@ nautilus_preferences_set_visible_user_level (const char *name,
g_free (visible_key);
}
+gboolean
+nautilus_preferences_get_is_invisible (const char *name)
+{
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (preferences_is_initialized (), FALSE);
+
+ return preferences_global_table_lookup_or_insert (name)->invisible;
+}
+
+void
+nautilus_preferences_set_is_invisible (const char *name,
+ gboolean is_invisible)
+{
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (preferences_is_initialized ());
+
+ preferences_global_table_lookup_or_insert (name)->invisible = is_invisible;
+}
+
void
nautilus_preferences_set_boolean (const char *name,
gboolean boolean_value)
@@ -412,7 +432,7 @@ preferences_key_make_for_getter (const char *name)
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (preferences_is_initialized (), NULL);
- if (preferences_preference_is_default (name) || !nautilus_preferences_is_visible (name)) {
+ if (preferences_preference_is_default (name) || !nautilus_preferences_visible_in_current_user_level (name)) {
key = preferences_key_make_for_default_getter (name, nautilus_preferences_get_user_level ());
} else {
key = preferences_make_user_level_filtered_key (name);
@@ -1730,7 +1750,7 @@ nautilus_preferences_monitor_directory (const char *directory)
}
gboolean
-nautilus_preferences_is_visible (const char *name)
+nautilus_preferences_visible_in_current_user_level (const char *name)
{
int user_level;
int visible_user_level;
@@ -1744,6 +1764,19 @@ nautilus_preferences_is_visible (const char *name)
return visible_user_level <= user_level;
}
+gboolean
+nautilus_preferences_is_visible (const char *name)
+{
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (preferences_is_initialized (), FALSE);
+
+ if (!nautilus_preferences_visible_in_current_user_level (name)) {
+ return FALSE;
+ }
+
+ return !preferences_global_table_lookup_or_insert (name)->invisible;
+}
+
static void
preferences_remove_user_level_notice (void)
{
diff --git a/libnautilus-private/nautilus-preferences.h b/libnautilus-private/nautilus-preferences.h
index 2916a907f..2c4de5c7a 100644
--- a/libnautilus-private/nautilus-preferences.h
+++ b/libnautilus-private/nautilus-preferences.h
@@ -123,6 +123,9 @@ void nautilus_preferences_remove_auto_boolean (const char
int nautilus_preferences_get_visible_user_level (const char *name);
void nautilus_preferences_set_visible_user_level (const char *name,
int visible_user_level);
+gboolean nautilus_preferences_get_is_invisible (const char *name);
+void nautilus_preferences_set_is_invisible (const char *name,
+ gboolean invisible);
char * nautilus_preferences_get_description (const char *name);
void nautilus_preferences_set_description (const char *name,
const char *description);
@@ -130,6 +133,7 @@ char * nautilus_preferences_get_enumeration_id (const char
void nautilus_preferences_set_enumeration_id (const char *name,
const char *enumeration_id);
gboolean nautilus_preferences_monitor_directory (const char *directory);
+gboolean nautilus_preferences_visible_in_current_user_level (const char *name);
gboolean nautilus_preferences_is_visible (const char *name);
void nautilus_preferences_initialize (const char *storage_path);
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 7e9a138b4..57410b58c 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -338,8 +338,8 @@ void
nautilus_application_startup (NautilusApplication *application,
gboolean kill_shell,
gboolean restart_shell,
- gboolean start_desktop,
gboolean no_default_window,
+ gboolean no_desktop,
gboolean do_first_time_druid_check,
const char *geometry,
const char *urls[])
@@ -371,7 +371,7 @@ nautilus_application_startup (NautilusApplication *application,
/* Run the first time startup druid if needed. */
if (do_first_time_druid_check && need_to_show_first_time_druid ()) {
- nautilus_first_time_druid_show (application, start_desktop, urls);
+ nautilus_first_time_druid_show (application, urls);
return;
}
@@ -489,7 +489,7 @@ nautilus_application_startup (NautilusApplication *application,
} else if (restart_shell) {
Nautilus_Shell_restart (shell, &ev);
} else {
- if (start_desktop) {
+ if (!no_desktop && nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_DESKTOP)) {
Nautilus_Shell_start_desktop (shell, &ev);
}
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index d8f4d020e..064205022 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -57,8 +57,8 @@ NautilusApplication *nautilus_application_new (void);
void nautilus_application_startup (NautilusApplication *application,
gboolean kill_shell,
gboolean restart_shell,
- gboolean start_desktop,
gboolean no_default_window,
+ gboolean no_desktop,
gboolean do_first_time_druid_check,
const char *default_geometry,
const char *urls[]);
diff --git a/src/nautilus-first-time-druid.c b/src/nautilus-first-time-druid.c
index 49fed066f..3009d4612 100644
--- a/src/nautilus-first-time-druid.c
+++ b/src/nautilus-first-time-druid.c
@@ -97,7 +97,6 @@ enum {
/* globals */
static NautilusApplication *save_application;
-static gboolean save_manage_desktop;
static GtkWidget *start_page;
static GtkWidget *finish_page;
@@ -292,7 +291,7 @@ set_up_background (NautilusDruidPageEazel *page, const char *background_color)
}
static void
-update_draw_desktop_checkbox_state ()
+update_draw_desktop_checkbox_state (void)
{
if (current_user_level == NAUTILUS_USER_LEVEL_NOVICE) {
gtk_widget_hide (draw_desktop_checkbox_widget);
@@ -897,7 +896,7 @@ set_up_gmc_transition_page (NautilusDruidPageEazel *page)
GtkWidget *checkbox, *label;
GtkWidget *container, *main_box, *hbox;
- draw_desktop = save_manage_desktop;
+ draw_desktop = TRUE;
add_to_session = TRUE;
transfer_gmc_icons = TRUE;
@@ -1037,7 +1036,7 @@ update_finished_label (void)
}
GtkWidget *
-nautilus_first_time_druid_show (NautilusApplication *application, gboolean manage_desktop, const char *urls[])
+nautilus_first_time_druid_show (NautilusApplication *application, const char *urls[])
{
GtkWidget *dialog;
GtkWidget *druid;
@@ -1046,7 +1045,6 @@ nautilus_first_time_druid_show (NautilusApplication *application, gboolean manag
/* remember parameters for later window invocation */
save_application = application;
- save_manage_desktop = manage_desktop;
current_user_level = nautilus_preferences_get_user_level ();
diff --git a/src/nautilus-first-time-druid.h b/src/nautilus-first-time-druid.h
index 4ae24c710..a2892b47d 100644
--- a/src/nautilus-first-time-druid.h
+++ b/src/nautilus-first-time-druid.h
@@ -33,7 +33,6 @@
#include "nautilus-application.h"
GtkWidget *nautilus_first_time_druid_show (NautilusApplication *application,
- gboolean manage_desktop,
- const char *urls[]);
+ const char *urls[]);
#endif /* NAUTILUS_FIRST_TIME_DRUID_H */
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index d4303df99..ac055ef7a 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -128,8 +128,8 @@ main (int argc, char *argv[])
{
gboolean kill_shell;
gboolean restart_shell;
- gboolean start_desktop;
gboolean no_default_window;
+ gboolean no_desktop;
char *geometry;
gboolean perform_self_check;
poptContext popt_context;
@@ -147,6 +147,8 @@ main (int argc, char *argv[])
N_("Create the initial window with the given geometry."), N_("GEOMETRY") },
{ "no-default-window", 'n', POPT_ARG_NONE, &no_default_window, 0,
N_("Only create windows for explicitly specified URIs."), NULL },
+ { "no-desktop", '\0', POPT_ARG_NONE, &no_desktop, 0,
+ N_("Do not manage the desktop (ignore the preference set in the preferences dialog)."), NULL },
{ "quit", 'q', POPT_ARG_NONE, &kill_shell, 0,
N_("Quit Nautilus."), NULL },
{ "restart", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, &restart_shell, 0,
@@ -190,6 +192,7 @@ main (int argc, char *argv[])
geometry = NULL;
kill_shell = FALSE;
no_default_window = FALSE;
+ no_desktop = FALSE;
perform_self_check = FALSE;
restart_shell = FALSE;
@@ -239,26 +242,24 @@ main (int argc, char *argv[])
/* Initialize preferences. This is needed so that proper
* defaults are available before any preference peeking
- * happens. Do this only if we are not goinh to kill the
+ * happens. Do this only if we are not going to kill the
* nautilus shell.
*/
if (!kill_shell) {
nautilus_global_preferences_initialize ();
- start_desktop = nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_DESKTOP);
- } else {
- start_desktop = FALSE;
+ if (no_desktop) {
+ nautilus_preferences_set_is_invisible
+ (NAUTILUS_PREFERENCES_SHOW_DESKTOP, TRUE);
+ nautilus_preferences_set_is_invisible
+ (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR, TRUE);
+ }
}
/* Do either the self-check or the real work. */
if (perform_self_check) {
#ifndef NAUTILUS_OMIT_SELF_CHECK
- /* Run the checks (each twice) for:
- *
- * nautilus
- * eel
- * libnautilus-extensions
- *
- */
+ /* Run the checks (each twice) for nautilus and libnautilus-extensions. */
+
nautilus_directory_use_self_contained_metafile_factory ();
nautilus_run_self_checks ();
@@ -274,7 +275,7 @@ main (int argc, char *argv[])
application = nautilus_application_new ();
nautilus_application_startup
(application,
- kill_shell, restart_shell, start_desktop, no_default_window,
+ kill_shell, restart_shell, no_default_window, no_desktop,
!(kill_shell || restart_shell),
geometry,
args);