nautilus-07-lockdown.diff revision 12467
--- /usr/tmp/clean/nautilus-2.21.1/libnautilus-private/Makefile.am 2007-12-10 13:22:01.000000000 +0000
+++ nautilus-2.21.1/libnautilus-private/Makefile.am 2008-01-07 15:24:15.457462000 +0000
@@ -125,6 +125,8 @@
nautilus-lib-self-check-functions.h \
nautilus-link.c \
nautilus-link.h \
+ nautilus-lockdown.c \
+ nautilus-lockdown.h \
nautilus-marshal.c \
nautilus-marshal.h \
nautilus-merged-directory.c \
--- /usr/tmp/clean/nautilus-2.21.1/libnautilus-private/nautilus-directory-async.c 2007-12-20 13:22:58.000000000 +0000
+++ nautilus-2.21.1/libnautilus-private/nautilus-directory-async.c 2008-01-04 10:14:16.919383000 +0000
@@ -33,6 +33,7 @@
#include "nautilus-signaller.h"
#include "nautilus-global-preferences.h"
#include "nautilus-link.h"
+#include "nautilus-lockdown.h"
#include "nautilus-marshal.h"
#include "nautilus-metafile.h"
#include <eel/eel-glib-extensions.h>
@@ -781,6 +782,10 @@
return TRUE;
}
+ if (nautilus_lockdown_is_forbidden_file(directory, info)) {
+ return TRUE;
+ }
+
return FALSE;
}
diff -urN -x '*~' naut.orig/libnautilus-private/nautilus-directory.c naut.new/libnautilus-private/nautilus-directory.c
--- naut.orig/libnautilus-private/nautilus-directory.c 2007-01-23 12:14:22.112062000 +0000
+++ naut.new/libnautilus-private/nautilus-directory.c 2007-01-23 12:15:48.504527000 +0000
@@ -310,6 +310,7 @@
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
filtering_changed_callback,
NULL);
+ nautilus_lockdown_notify_add(filtering_changed_callback, NULL) ;
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
async_data_preference_changed_callback,
NULL);
diff -urN -x '*~' naut.orig/libnautilus-private/nautilus-file.c naut.new/libnautilus-private/nautilus-file.c
--- naut.orig/libnautilus-private/nautilus-file.c 2007-01-23 12:14:22.111021000 +0000
+++ naut.new/libnautilus-private/nautilus-file.c 2007-01-23 12:15:48.511205000 +0000
@@ -48,6 +48,7 @@
#include "nautilus-users-groups-cache.h"
#include "nautilus-vfs-file.h"
#include "nautilus-saved-search-file.h"
+#include "nautilus-lockdown.h"
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
@@ -2348,7 +2349,8 @@
gboolean show_backup)
{
return (show_hidden || (!nautilus_file_is_hidden_file (file) && !is_file_hidden (file))) &&
- (show_backup || !nautilus_file_is_backup_file (file));
+ (show_backup || !nautilus_file_is_backup_file (file) &&
+ !nautilus_lockdown_is_forbidden_nautilus_file(file));
}
diff -urN -x '*~' naut.orig/libnautilus-private/nautilus-global-preferences.c naut.new/libnautilus-private/nautilus-global-preferences.c
--- naut.orig/libnautilus-private/nautilus-global-preferences.c 2007-01-23 12:14:21.403884000 +0000
+++ naut.new/libnautilus-private/nautilus-global-preferences.c 2007-01-23 12:15:48.513608000 +0000
@@ -46,6 +46,7 @@
/* Path for gnome-vfs preferences */
static const char *EXTRA_MONITOR_PATHS[] = { "/system/gnome_vfs",
"/desktop/gnome/file_views",
+ "/desktop/gnome/lockdown",
NULL };
/* Forward declarations */
diff -urN -x '*~' naut.orig/libnautilus-private/nautilus-global-preferences.h naut.new/libnautilus-private/nautilus-global-preferences.h
--- naut.orig/libnautilus-private/nautilus-global-preferences.h 2007-01-23 12:14:22.123798000 +0000
+++ naut.new/libnautilus-private/nautilus-global-preferences.h 2007-01-23 12:15:48.514623000 +0000
@@ -190,6 +190,10 @@
#define NAUTILUS_PREFERENCES_DESKTOP_NETWORK_NAME "desktop/network_icon_name"
#define NAUTILUS_PREFERENCES_DESKTOP_PRIMARY_SCREEN "desktop/primary_screen"
+#define NAUTILUS_PREFERENCES_DISABLE_COMMANDLINE "/desktop/gnome/lockdown/disable_command_line"
+#define NAUTILUS_PREFERENCES_RESTRICT_APP_LAUNCHING "/desktop/gnome/lockdown/restrict_application_launching"
+#define NAUTILUS_PREFERENCES_ALLOWED_APPLICATIONS "/desktop/gnome/lockdown/allowed_applications"
+
void nautilus_global_preferences_init (void);
char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void);
G_END_DECLS
--- /dev/null 2008-02-05 11:58:55.000000000 +0000
+++ nautilus-2.21.90/libnautilus-private/nautilus-lockdown.h 2008-02-05 11:08:51.622425000 +0000
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2004 Sun Microsystems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Matt Keenan <matt.keenan@sun.com>
+ * Mark McLoughlin <mark@skynet.ie>
+ */
+
+#ifndef __NAUTILUS_LOCKDOWN_H__
+#define __NAUTILUS_LOCKDOWN_H__
+
+#include <libgnomevfs/gnome-vfs.h>
+#include <glib.h>
+#include <glib-object.h>
+#include "nautilus-directory.h"
+
+G_BEGIN_DECLS
+
+void nautilus_lockdown_init (void);
+void nautilus_lockdown_finalize (void);
+
+void nautilus_lockdown_notify_add (GCallback callback_func,
+ gpointer user_data);
+void nautilus_lockdown_notify_remove (GCallback callback_func,
+ gpointer user_data);
+
+gboolean nautilus_lockdown_is_command_line_disabled(void) ;
+gboolean nautilus_lockdown_is_app_launching_restricted(void) ;
+char** nautilus_lockdown_get_allowed_apps(void) ;
+
+gboolean nautilus_lockdown_is_forbidden_file(NautilusDirectory *directory,
+ GFileInfo *file) ;
+gboolean nautilus_lockdown_is_forbidden_nautilus_file(NautilusFile *file) ;
+gboolean nautilus_lockdown_is_forbidden_command(const char *command) ;
+
+G_END_DECLS
+
+#endif /* __NAUTILUS_LOCKDOWN_H__ */
--- /dev/null 2008-02-05 11:59:02.000000000 +0000
+++ nautilus-2.21.90/libnautilus-private/nautilus-lockdown.c 2008-02-05 11:55:36.052611000 +0000
@@ -0,0 +1,335 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2004 Sun Microsystems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Matt Keenan <matt.keenan@sun.com>
+ * Mark McLoughlin <mark@skynet.ie>
+ */
+
+#include <config.h>
+
+#include "nautilus-lockdown.h"
+#include "nautilus-global-preferences.h"
+#include "nautilus-program-choosing.h"
+#include <eel/eel-preferences.h>
+#include <eel/eel-string.h>
+#include <libgnome/gnome-desktop-item.h>
+
+#include <string.h>
+
+#define N_LISTENERS 3
+
+typedef struct {
+ guint initialized : 1;
+ guint disable_command_line : 1;
+ guint restrict_application_launching : 1;
+
+ char** allowed_applications;
+
+ guint listeners [N_LISTENERS];
+
+ GSList *closures;
+} NautilusLockdown ;
+
+const gchar *command_line_execs[] = {
+ "/usr/bin/gnome-terminal",
+ "/usr/bin/xterm",
+};
+#define NUMBER_COMMAND_LINE_EXECS 2
+
+static NautilusLockdown nautilus_lockdown = { 0, };
+
+
+static inline void
+nautilus_lockdown_invoke_closures (NautilusLockdown *lockdown)
+{
+ GSList *l;
+
+ for (l = lockdown->closures; l; l = l->next)
+ g_closure_invoke (l->data, NULL, 0, NULL, NULL);
+}
+
+static void
+disable_command_line_notify (NautilusLockdown *lockdown)
+{
+ lockdown->disable_command_line =
+ eel_preferences_get_boolean(
+ NAUTILUS_PREFERENCES_DISABLE_COMMANDLINE) ;
+ nautilus_lockdown_invoke_closures (lockdown);
+}
+
+static void
+restrict_application_launching_notify (NautilusLockdown *lockdown)
+{
+ lockdown->restrict_application_launching =
+ eel_preferences_get_boolean (
+ NAUTILUS_PREFERENCES_RESTRICT_APP_LAUNCHING);
+ nautilus_lockdown_invoke_closures (lockdown);
+}
+
+static void
+allowed_applications_notify (NautilusLockdown *lockdown)
+{
+ g_strfreev(lockdown->allowed_applications) ;
+ lockdown->allowed_applications =
+ eel_preferences_get_string_array(
+ NAUTILUS_PREFERENCES_ALLOWED_APPLICATIONS) ;
+ nautilus_lockdown_invoke_closures (lockdown);
+}
+
+static gboolean
+nautilus_lockdown_load_bool (NautilusLockdown *lockdown,
+ const char *key,
+ EelPreferencesCallback notify_func)
+{
+ gboolean retval = eel_preferences_get_boolean (key);
+
+ eel_preferences_add_callback(key, notify_func, lockdown) ;
+ return retval;
+}
+
+static char**
+nautilus_lockdown_load_allowed_applications (NautilusLockdown *lockdown)
+{
+ char **retval;
+
+ retval = eel_preferences_get_string_array(
+ NAUTILUS_PREFERENCES_ALLOWED_APPLICATIONS) ;
+ eel_preferences_add_callback(NAUTILUS_PREFERENCES_ALLOWED_APPLICATIONS,
+ allowed_applications_notify, lockdown) ;
+ return retval;
+}
+
+void
+nautilus_lockdown_init (void)
+{
+ nautilus_lockdown.disable_command_line =
+ nautilus_lockdown_load_bool (
+ &nautilus_lockdown,
+ NAUTILUS_PREFERENCES_DISABLE_COMMANDLINE,
+ disable_command_line_notify);
+ nautilus_lockdown.restrict_application_launching =
+ nautilus_lockdown_load_bool (
+ &nautilus_lockdown,
+ NAUTILUS_PREFERENCES_RESTRICT_APP_LAUNCHING,
+ restrict_application_launching_notify) ;
+ nautilus_lockdown.allowed_applications =
+ nautilus_lockdown_load_allowed_applications (
+ &nautilus_lockdown) ;
+ nautilus_lockdown.initialized = TRUE;
+}
+
+void
+nautilus_lockdown_finalize (void)
+{
+ GSList *l = NULL ;
+
+ g_assert (nautilus_lockdown.initialized == TRUE);
+ eel_preferences_remove_callback(
+ NAUTILUS_PREFERENCES_DISABLE_COMMANDLINE,
+ disable_command_line_notify,
+ &nautilus_lockdown) ;
+ eel_preferences_remove_callback(
+ NAUTILUS_PREFERENCES_RESTRICT_APP_LAUNCHING,
+ restrict_application_launching_notify,
+ &nautilus_lockdown) ;
+ eel_preferences_remove_callback(
+ NAUTILUS_PREFERENCES_ALLOWED_APPLICATIONS,
+ allowed_applications_notify,
+ &nautilus_lockdown) ;
+ g_strfreev(nautilus_lockdown.allowed_applications) ;
+ for (l = nautilus_lockdown.closures; l; l = l->next) {
+ g_closure_unref (l->data);
+ }
+ g_slist_free (nautilus_lockdown.closures);
+ nautilus_lockdown.closures = NULL;
+ nautilus_lockdown.initialized = FALSE;
+}
+
+gboolean
+nautilus_lockdown_is_command_line_disabled (void)
+{
+ g_assert (nautilus_lockdown.initialized == TRUE);
+ return nautilus_lockdown.disable_command_line;
+}
+
+gboolean
+nautilus_lockdown_is_app_launching_restricted (void)
+{
+ g_assert (nautilus_lockdown.initialized == TRUE);
+ return nautilus_lockdown.restrict_application_launching;
+}
+
+char**
+nautilus_lockdown_get_allowed_apps (void)
+{
+ g_assert (nautilus_lockdown.initialized == TRUE);
+ return nautilus_lockdown.allowed_applications;
+}
+
+static GClosure *
+nautilus_lockdown_notify_find (GSList *closures,
+ GCallback callback_func,
+ gpointer user_data)
+{
+ GSList *l;
+
+ for (l = closures; l; l = l->next) {
+ GCClosure *cclosure = l->data;
+ GClosure *closure = l->data;
+
+ if (closure->data == user_data &&
+ cclosure->callback == callback_func)
+ return closure;
+ }
+
+ return NULL;
+}
+
+static void
+marshal_user_data (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data)
+{
+ GCClosure *cclosure = (GCClosure*) closure;
+
+ g_return_if_fail (cclosure->callback != NULL);
+ g_return_if_fail (n_param_values == 0);
+
+ ((void (*) (gpointer *))cclosure->callback) (closure->data);
+}
+
+void
+nautilus_lockdown_notify_add (GCallback callback_func,
+ gpointer user_data)
+{
+ GClosure *closure;
+
+ g_assert (nautilus_lockdown_notify_find (nautilus_lockdown.closures,
+ callback_func,
+ user_data) == NULL);
+ closure = g_cclosure_new (callback_func, user_data, NULL);
+ g_closure_set_marshal (closure, marshal_user_data);
+ nautilus_lockdown.closures = g_slist_append (nautilus_lockdown.closures,
+ closure);
+}
+
+void
+nautilus_lockdown_notify_remove (GCallback callback_func,
+ gpointer user_data)
+{
+ GClosure *closure;
+
+ closure = nautilus_lockdown_notify_find (nautilus_lockdown.closures,
+ callback_func,
+ user_data);
+ g_assert (closure != NULL);
+ nautilus_lockdown.closures = g_slist_remove (nautilus_lockdown.closures,
+ closure);
+ g_closure_unref (closure);
+}
+
+static gboolean nautilus_lockdown_is_forbidden_uri(const char *uri)
+{
+ GnomeDesktopItem *item = NULL ;
+ GError *error = NULL ;
+ const char *command = NULL ;
+ gboolean ret_code = FALSE ;
+
+ if (eel_str_has_prefix(uri, NAUTILUS_DESKTOP_COMMAND_SPECIFIER)) {
+ uri += strlen(NAUTILUS_DESKTOP_COMMAND_SPECIFIER) ;
+ }
+ item = gnome_desktop_item_new_from_uri(uri, 0, &error) ;
+ if (error != NULL) {
+ g_error_free(error) ;
+ return ret_code ;
+ }
+ command = gnome_desktop_item_get_string(item, GNOME_DESKTOP_ITEM_EXEC) ;
+ if (command == NULL) { return ret_code ; }
+ return nautilus_lockdown_is_forbidden_command(command) ;
+}
+
+static const char *GNOME_APP_MIME = "application/x-gnome-app-info" ;
+static const char *DESKTOP_MIME = "application/x-desktop" ;
+
+gboolean nautilus_lockdown_is_forbidden_file(NautilusDirectory *directory,
+ GFileInfo *file)
+{
+ const char *mime_type = g_file_info_get_content_type(file) ;
+
+ if (nautilus_lockdown.restrict_application_launching &&
+ mime_type != NULL &&
+ (strcmp(mime_type, GNOME_APP_MIME) == 0 ||
+ strcmp(mime_type, DESKTOP_MIME) == 0)) {
+ return nautilus_lockdown_is_forbidden_command(
+ nautilus_directory_get_file_uri(directory, g_file_info_get_name(file)));
+ }
+ return FALSE ;
+}
+
+gboolean nautilus_lockdown_is_forbidden_nautilus_file(NautilusFile *file)
+{
+ if (nautilus_lockdown.restrict_application_launching &&
+ (nautilus_file_is_mime_type(file, GNOME_APP_MIME) ||
+ nautilus_file_is_mime_type(file, DESKTOP_MIME))) {
+ return nautilus_lockdown_is_forbidden_uri(nautilus_file_get_uri(file)) ;
+ }
+ return FALSE ;
+}
+
+gboolean nautilus_lockdown_is_forbidden_command(const char *command)
+{
+ char *commandCopy = NULL ;
+ char *program = NULL ;
+ char *allowed_app;
+ gboolean retCode = FALSE ;
+
+ if (!nautilus_lockdown.restrict_application_launching) { return retCode ; }
+ commandCopy = g_shell_unquote(command, NULL) ;
+ if (commandCopy == NULL) { commandCopy = g_strdup(command) ; }
+ strtok(commandCopy, " ") ;
+ if (g_path_is_absolute(commandCopy)) {
+ program = commandCopy ;
+ }
+ else {
+ char *stripped = g_path_get_basename(commandCopy) ;
+
+ program = g_find_program_in_path(stripped) ;
+ g_free(stripped) ;
+ g_free(commandCopy) ;
+ }
+ retCode = TRUE;
+ if (program != NULL) {
+ int i = 0;
+ allowed_app = nautilus_lockdown.allowed_applications[i];
+ while (allowed_app != NULL) {
+ if (!strcmp(allowed_app, program)) {
+ retCode = FALSE;
+ break;
+ }
+ allowed_app = nautilus_lockdown.allowed_applications[++i];
+ }
+ g_free(program) ;
+ }
+ return retCode ;
+}
+
--- /usr/tmp/clean/nautilus-2.21.1/libnautilus-private/nautilus-program-choosing.c 2007-12-14 10:24:07.000000000 +0000
+++ nautilus-2.21.1/libnautilus-private/nautilus-program-choosing.c 2008-01-04 10:39:03.297183000 +0000
@@ -324,6 +324,22 @@
eel_g_object_list_free (locations);
}
+static gboolean
+command_is_allowed (const char *full_command)
+{
+ gboolean allowed = !nautilus_lockdown_is_forbidden_command(full_command);
+ if (!allowed) {
+ eel_show_error_dialog
+ /* SUN_BRANDING */
+ (_("Sorry, This is a restricted application which "
+ "you may not run."),
+ /* SUN_BRANDING */
+ _("Restricted Application"),
+ NULL);
+ }
+ return allowed;
+}
+
/**
* nautilus_launch_application_from_command:
*
@@ -352,8 +368,22 @@
full_command = g_strdup (command_string);
}
+ if (!command_is_allowed (command_string)) {
+ g_free (full_command);
+ return;
+ }
+
if (use_terminal) {
- eel_gnome_open_terminal_on_screen (full_command, screen);
+ if (!nautilus_lockdown_is_command_line_disabled ()) {
+ eel_gnome_open_terminal_on_screen (full_command, screen);
+ } else {
+ eel_show_error_dialog
+ /* SUN_BRANDING */
+ (_("Sorry, this command requires a terminal "),
+ /* SUN_BRANDING */
+ _("Terminal access is restricted."),
+ NULL);
+ }
} else {
gdk_spawn_command_line_on_screen (screen, full_command, NULL);
}
@@ -429,6 +459,11 @@
/* check if this app only supports local files */
command_string = gnome_desktop_item_get_string (ditem, GNOME_DESKTOP_ITEM_EXEC);
+
+ if (!command_is_allowed (command_string)) {
+ return;
+ }
+
if (command_string != NULL && (strstr (command_string, "%F") || strstr (command_string, "%f"))
&& !(strstr (command_string, "%U") || strstr (command_string, "%u"))
&& parameter_uris != NULL) {
diff -urN -x '*~' naut.orig/src/file-manager/fm-directory-view.c naut.new/src/file-manager/fm-directory-view.c
--- naut.orig/src/file-manager/fm-directory-view.c 2007-01-23 12:14:22.597209000 +0000
+++ naut.new/src/file-manager/fm-directory-view.c 2007-01-23 12:15:48.534029000 +0000
@@ -366,6 +366,7 @@
static void unschedule_display_of_pending_files (FMDirectoryView *view);
static void disconnect_model_handlers (FMDirectoryView *view);
static void filtering_changed_callback (gpointer callback_data);
+static void lockdown_changed_callback(gpointer context) ;
static void metadata_for_directory_as_file_ready_callback (NautilusFile *file,
gpointer callback_data);
static void metadata_for_files_in_directory_ready_callback (NautilusDirectory *directory,
@@ -1982,6 +1983,7 @@
filtering_changed_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
filtering_changed_callback, view);
+ nautilus_lockdown_notify_add(lockdown_changed_callback, view) ;
}
static void
@@ -9499,6 +9501,7 @@
return;
}
+ nautilus_lockdown_notify_remove(lockdown_changed_callback, view) ;
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
filtering_changed_callback,
view);
@@ -9992,6 +9995,15 @@
g_free (container_uri);
}
+static void lockdown_changed_callback(gpointer context)
+{
+ FMDirectoryView *directory_view = FM_DIRECTORY_VIEW(context) ;
+
+ if (directory_view != NULL && directory_view->details->model != NULL) {
+ load_directory(directory_view, directory_view->details->model) ;
+ }
+}
+
void
fm_directory_view_handle_text_drop (FMDirectoryView *view,
const char *text,
diff -urN -x '*~' naut.orig/src/file-manager/fm-tree-model.c naut.new/src/file-manager/fm-tree-model.c
--- naut.orig/src/file-manager/fm-tree-model.c 2007-01-23 12:14:22.594599000 +0000
+++ naut.new/src/file-manager/fm-tree-model.c 2007-01-23 12:15:48.536375000 +0000
@@ -38,6 +38,8 @@
#include <gtk/gtkenums.h>
#include <string.h>
+#include <libnautilus-private/nautilus-lockdown.h>
+
enum {
ROW_LOADED,
LAST_SIGNAL
@@ -1725,6 +1727,14 @@
schedule_monitoring_update (model);
}
+void fm_tree_model_refresh_permissions(FMTreeModel *model)
+{
+ g_return_if_fail(FM_IS_TREE_MODEL(model)) ;
+ stop_monitoring(model) ;
+ destroy_by_function(model, nautilus_lockdown_is_forbidden_nautilus_file) ;
+ schedule_monitoring_update(model) ;
+}
+
static gboolean
file_is_not_directory (NautilusFile *file)
{
diff -urN -x '*~' naut.orig/src/file-manager/fm-tree-view.c naut.new/src/file-manager/fm-tree-view.c
--- naut.orig/src/file-manager/fm-tree-view.c 2007-01-23 12:14:22.602086000 +0000
+++ naut.new/src/file-manager/fm-tree-view.c 2007-01-23 12:15:48.538554000 +0000
@@ -1499,6 +1499,7 @@
fm_tree_model_set_show_only_directories
(view->details->child_model,
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES));
+ fm_tree_model_refresh_permissions(view->details->child_model) ;
}
static void
@@ -1554,6 +1555,7 @@
filtering_changed_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
filtering_changed_callback, view);
+ nautilus_lockdown_notify_add(filtering_changed_callback, view) ;
eel_preferences_add_callback (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
filtering_changed_callback, view);
@@ -1600,6 +1602,7 @@
filtering_changed_callback, view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
filtering_changed_callback, view);
+ nautilus_lockdown_notify_remove(filtering_changed_callback, view) ;
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
filtering_changed_callback, view);
--- /usr/tmp/clean/nautilus-2.21.90/src/nautilus-main.c 2007-12-17 11:14:03.000000000 +0000
+++ nautilus-2.21.90/src/nautilus-main.c 2008-01-04 11:23:35.463968000 +0000
@@ -54,6 +54,7 @@
#include <libnautilus-private/nautilus-debug-log.h>
#include <libnautilus-private/nautilus-directory-metafile.h>
#include <libnautilus-private/nautilus-global-preferences.h>
+#include <libnautilus-private/nautilus-lockdown.h>
#include <libnautilus-private/nautilus-lib-self-check-functions.h>
#include <libnautilus-private/nautilus-icon-names.h>
#include <libxml/parser.h>
@@ -526,6 +527,7 @@
(NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR, TRUE);
}
+ nautilus_lockdown_init() ;
bonobo_activate (); /* do now since we need it before main loop */
application = NULL;
@@ -577,6 +577,8 @@
bonobo_object_unref (application);
}
+ nautilus_lockdown_finalize ();
+
eel_debug_shut_down ();
/* If told to restart, exec() myself again. This is used when
--- /usr/tmp/clean/nautilus-2.21.90/src/nautilus-window-menus.c 2007-12-14 10:23:00.000000000 +0000
+++ nautilus-2.21.90/src/nautilus-window-menus.c 2008-01-04 11:29:00.728638000 +0000
@@ -52,6 +52,7 @@
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-icon-names.h>
#include <libnautilus-private/nautilus-ui-utilities.h>
+#include <libnautilus-private/nautilus-lockdown.h>
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-undo-manager.h>
#include <libnautilus-private/nautilus-search-directory.h>
@@ -779,6 +780,22 @@
return items;
}
+static gboolean
+load_extension_menus_idle(gpointer context)
+{
+ NautilusWindow *window = NAUTILUS_WINDOW(context);
+
+ nautilus_window_load_extension_menus(window);
+ return FALSE;
+}
+
+static void
+lockdown_changed_callback(gpointer context)
+{
+ NautilusWindow *window = NAUTILUS_WINDOW(context);
+ g_idle_add(load_extension_menus_idle, window);
+}
+
void
nautilus_window_load_extension_menus (NautilusWindow *window)
{
@@ -794,6 +811,8 @@
gtk_ui_manager_remove_ui (window->details->ui_manager,
window->details->extensions_menu_merge_id);
window->details->extensions_menu_merge_id = 0;
+ } else {
+ nautilus_lockdown_notify_add(lockdown_changed_callback, window);
}
if (window->details->extensions_menu_action_group != NULL) {