[nautilus] Respect /desktop/gnome/lockdown/disable_command_line
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus] Respect /desktop/gnome/lockdown/disable_command_line
- Date: Wed, 29 Jul 2009 00:27:29 +0000 (UTC)
commit 97d348f792a2659fbb88de17d25e83c93b14414c
Author: Vincent Untz <vuntz gnome org>
Date: Tue Jul 28 17:27:57 2009 +0200
Respect /desktop/gnome/lockdown/disable_command_line
We need to show/hide the "New Launcher" menu item in the context
menu, depending on this gconf key.
libnautilus-private/nautilus-global-preferences.c | 7 ++++++
libnautilus-private/nautilus-global-preferences.h | 3 ++
src/file-manager/fm-actions.h | 1 +
src/file-manager/fm-desktop-icon-view.c | 23 +++++++++++++++++++++
src/file-manager/fm-directory-view.c | 17 ++++++++++++++-
5 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 1ea83dc..61f207a 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -42,6 +42,7 @@
/* Path for gnome-vfs preferences */
static const char *EXTRA_MONITOR_PATHS[] = { "/desktop/gnome/file_views",
"/desktop/gnome/background",
+ "/desktop/gnome/lockdown",
NULL };
/* Forward declarations */
@@ -563,6 +564,10 @@ static const PreferenceDefault preference_defaults[] = {
PREFERENCE_INTEGER,
GINT_TO_POINTER (9)
},
+ { NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+ PREFERENCE_BOOLEAN,
+ GINT_TO_POINTER (FALSE)
+ },
{ NULL }
};
@@ -839,6 +844,8 @@ nautilus_global_preferences_init (void)
GCONF_CLIENT_PRELOAD_ONELEVEL);
eel_gconf_preload_cache ("/desktop/gnome/background",
GCONF_CLIENT_PRELOAD_ONELEVEL);
+ eel_gconf_preload_cache ("/desktop/gnome/lockdown",
+ GCONF_CLIENT_PRELOAD_ONELEVEL);
/* These are always needed for the desktop */
eel_gconf_preload_cache ("/apps/nautilus/desktop",
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 38c1dc2..2213843 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -228,6 +228,9 @@ typedef enum
#define NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE "desktop/network_icon_visible"
#define NAUTILUS_PREFERENCES_DESKTOP_NETWORK_NAME "desktop/network_icon_name"
+/* Lockdown */
+#define NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE "/desktop/gnome/lockdown/disable_command_line"
+
void nautilus_global_preferences_init (void);
char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void);
G_END_DECLS
diff --git a/src/file-manager/fm-actions.h b/src/file-manager/fm-actions.h
index 9bb01f6..0294ea3 100644
--- a/src/file-manager/fm-actions.h
+++ b/src/file-manager/fm-actions.h
@@ -51,6 +51,7 @@
#define FM_ACTION_PASTE_FILES_INTO "Paste Files Into"
#define FM_ACTION_LOCATION_PASTE_FILES_INTO "LocationPasteFilesInto"
#define FM_ACTION_NEW_LAUNCHER "New Launcher"
+#define FM_ACTION_NEW_LAUNCHER_DESKTOP "New Launcher Desktop"
#define FM_ACTION_RENAME "Rename"
#define FM_ACTION_DUPLICATE "Duplicate"
#define FM_ACTION_CREATE_LINK "Create Link"
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 0804598..039f150 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -105,6 +105,12 @@ desktop_directory_changed_callback (gpointer callback_data)
desktop_directory = nautilus_get_desktop_directory ();
}
+static void
+lockdown_disable_command_line_changed_callback (gpointer callback_data)
+{
+ fm_directory_view_update_menus (FM_DIRECTORY_VIEW (callback_data));
+}
+
static NautilusIconContainer *
get_icon_container (FMDesktopIconView *icon_view)
{
@@ -287,6 +293,10 @@ fm_desktop_icon_view_finalize (GObject *object)
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
default_zoom_level_changed,
icon_view);
+
+ eel_preferences_remove_callback (NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+ lockdown_disable_command_line_changed_callback,
+ icon_view);
g_free (icon_view->details);
@@ -589,6 +599,11 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view)
default_zoom_level_changed (desktop_icon_view);
fm_desktop_icon_view_update_icon_container_fonts (desktop_icon_view);
+
+ eel_preferences_add_callback (NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+ lockdown_disable_command_line_changed_callback,
+ desktop_icon_view);
+
}
static void
@@ -665,6 +680,7 @@ real_update_menus (FMDirectoryView *view)
{
FMDesktopIconView *desktop_view;
char *label;
+ gboolean disable_command_line;
gboolean include_empty_trash;
GtkAction *action;
@@ -674,6 +690,13 @@ real_update_menus (FMDirectoryView *view)
desktop_view = FM_DESKTOP_ICON_VIEW (view);
+ /* New Launcher */
+ disable_command_line = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE);
+ action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
+ FM_ACTION_NEW_LAUNCHER_DESKTOP);
+ gtk_action_set_visible (action,
+ !disable_command_line);
+
/* Empty Trash */
include_empty_trash = trash_link_is_selection (view);
action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index ae70b32..33d493c 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -1586,6 +1586,15 @@ sort_directories_first_changed_callback (gpointer callback_data)
}
static void
+lockdown_disable_command_line_changed_callback (gpointer callback_data)
+{
+ FMDirectoryView *view;
+
+ view = FM_DIRECTORY_VIEW (callback_data);
+ schedule_update_menus (view);
+}
+
+static void
set_up_scripts_directory_global (void)
{
char *scripts_directory_path;
@@ -1929,6 +1938,8 @@ fm_directory_view_init (FMDirectoryView *view)
click_policy_changed_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST,
sort_directories_first_changed_callback, view);
+ eel_preferences_add_callback (NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+ lockdown_disable_command_line_changed_callback, view);
}
static void
@@ -2043,6 +2054,8 @@ fm_directory_view_finalize (GObject *object)
click_policy_changed_callback, view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST,
sort_directories_first_changed_callback, view);
+ eel_preferences_remove_callback (NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+ lockdown_disable_command_line_changed_callback, view);
unschedule_pop_up_location_context_menu (view);
if (view->details->location_popup_event != NULL) {
@@ -8329,6 +8342,7 @@ real_update_menus (FMDirectoryView *view)
gboolean can_duplicate_files;
gboolean show_separate_delete_command;
gboolean vfolder_directory;
+ gboolean disable_command_line;
gboolean show_open_alternate;
gboolean can_open;
gboolean show_app;
@@ -8635,9 +8649,10 @@ real_update_menus (FMDirectoryView *view)
real_update_paste_menu (view, selection, selection_count);
+ disable_command_line = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE);
action = gtk_action_group_get_action (view->details->dir_action_group,
FM_ACTION_NEW_LAUNCHER);
- gtk_action_set_visible (action, vfolder_directory);
+ gtk_action_set_visible (action, vfolder_directory && !disable_command_line);
gtk_action_set_sensitive (action, can_create_files);
real_update_menus_volumes (view, selection, selection_count);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]