Re: [sabayon] Sabayon Crashes



On Thu, 2008-02-28 at 00:12 -0500, Johnny Robeson wrote:

> It is not currently possible to disable right clicks on the desktop, but
> it is possible to disable it on panels. These are things i'd definitely
> like to work on for the next version.

Funny that you mention it; recently I was working on a patch for
openSUSE to allow disabling context menus in Nautilus.  The patch is a
bit rough, but it works :)  It's attached to this mail; I hope you find
it useful.

  Federico
diff --git a/libnautilus-private/apps_nautilus_preferences.schemas.in b/libnautilus-private/apps_nautilus_preferences.schemas.in
index bbdfddc..5dcec2c 100644
--- a/libnautilus-private/apps_nautilus_preferences.schemas.in
+++ b/libnautilus-private/apps_nautilus_preferences.schemas.in
@@ -989,6 +989,21 @@ most cases, this should be left alone. -->Sans 10</default>
          </long>
       </locale>
     </schema>
-        
+
+    <schema>
+      <key>/schemas/apps/nautilus/lockdown/disable_context_menus</key>
+      <applyto>/apps/nautilus/lockdown/disable_context_menus</applyto>
+      <owner>nautilus</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Disable context menus in file views</short>
+         <long>
+          Set this to true if you are deploying a kiosk and don't want users
+          to access the context menu in file views.
+         </long>
+      </locale>
+    </schema>
+
   </schemalist>  
 </gconfschemafile>
--- nautilus/libnautilus-private/nautilus-debug-log.h.orig	2008-02-19 14:39:31.000000000 -0600
+++ nautilus/libnautilus-private/nautilus-debug-log.h	2008-02-19 14:40:05.000000000 -0600
@@ -32,6 +32,7 @@
 #define NAUTILUS_DEBUG_LOG_DESKTOP_LINKS	"desktop-links"		/* Desktop links in general */
 #define NAUTILUS_DEBUG_LOG_DRIVES_VOLUMES	"drives-volumes"	/* desktop link monitoring of drives/volumes */
 #define NAUTILUS_DEBUG_LOG_DOMAIN_GLOG          "GLog"	 /* used for GLog messages; don't use it yourself */
+#define NAUTILUS_DEBUG_LOG_DOMAIN_LOCKDOWN	"lockdown"	/* when things get *not* done due to lockdown */
 
 void nautilus_debug_log (gboolean is_milestone, const char *domain, const char *format, ...);
 
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 5f4f498..279810f 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -227,6 +227,10 @@ typedef struct
  * YOU SHOULD EDIT THE SCHEMAS FILE TO CHANGE DEFAULTS.
  */
 static const PreferenceDefault preference_defaults[] = {
+	{ NAUTILUS_LOCKDOWN_DISABLE_CONTEXT_MENUS,
+	  PREFERENCE_BOOLEAN,
+	  GINT_TO_POINTER (FALSE)
+	},
 	{ NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (FALSE)
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index e6d0301..96dc6e2 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -30,6 +30,8 @@
 
 G_BEGIN_DECLS
 
+#define NAUTILUS_LOCKDOWN_DISABLE_CONTEXT_MENUS			"lockdown/disable_context_menus"
+
 /* Which theme is active */
 #define NAUTILUS_PREFERENCES_THEME				"/desktop/gnome/file_views/icon_theme"
 
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index d88d6f9..e6b8719 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -7283,6 +7283,12 @@ fm_directory_view_pop_up_selection_context_menu  (FMDirectoryView *view,
 {
 	g_assert (FM_IS_DIRECTORY_VIEW (view));
 
+	if (eel_preferences_get_boolean (NAUTILUS_LOCKDOWN_DISABLE_CONTEXT_MENUS)) {
+		nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_LOCKDOWN,
+				    "Ignoring request to pop up the context menu for the view's selection");
+		return;
+	}
+
 	/* Make the context menu items not flash as they update to proper disabled,
 	 * etc. states by forcing menus to update now.
 	 */
@@ -7312,6 +7318,12 @@ fm_directory_view_pop_up_background_context_menu (FMDirectoryView *view,
 {
 	g_assert (FM_IS_DIRECTORY_VIEW (view));
 
+	if (eel_preferences_get_boolean (NAUTILUS_LOCKDOWN_DISABLE_CONTEXT_MENUS)) {
+		nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_LOCKDOWN,
+				    "Ignoring request to pop up the context menu for the view's background");
+		return;
+	}
+
 	/* Make the context menu items not flash as they update to proper disabled,
 	 * etc. states by forcing menus to update now.
 	 */
@@ -7340,6 +7352,12 @@ fm_directory_view_pop_up_location_context_menu (FMDirectoryView *view,
 {
 	g_assert (FM_IS_DIRECTORY_VIEW (view));
 
+	if (eel_preferences_get_boolean (NAUTILUS_LOCKDOWN_DISABLE_CONTEXT_MENUS)) {
+		nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_LOCKDOWN,
+				    "Ignoring request to pop up the context menu for the view");
+		return;
+	}
+
 	/* always update the menu before showing it. Shouldn't be too expensive. */
 	real_update_location_menu (view);
 


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