GNOME Bugzilla – Bug 165568
Support global lockdown keys
Last modified: 2006-06-15 14:11:46 UTC
Currently, gedit doesn't seem to honour the global lockdown keys disable_printing, disable_print_setup or disable_save_to_disk.
I didn't know about these global lockdown keys. Where can I find more info about them?
Paolo, theres some discussion of lockdown in the desktop-devel thread starting at: http://mail.gnome.org/archives/desktop-devel-list/2003-September/msg00594.html Google throws up http://primates.ximian.com/~clahey/epiphany-disable-printing.patch as the patch for Epiphany to support printing lockdown. Epiphany also supports the other global keys, and has it's own as well. Hope this helps.
We should also support disable_command_line in the shell_output plugin. The keys are in "/desktop/gnome/lockdown/"
Created attachment 36831 [details] [review] Patch against CVS HEAD (v. 1) The attached patch should add support for all the 4 global lockdown keys. I'm not sure we can include it for gnome 2.10 since we are quite late in the development cycle and the patch introduces some UI and string changes. Even if I have already tested the patch and I'm quite confident about its quality, in order to prevent unexpected side effects, I'd prefer to punt it and commit it on CVS HEAD as soon as gedit 2.10.0 will be released.
My patches does not disable autosave, I need to fix it before committing.
Sigh... I have to punt this bug again, it is already too late in the development cycle.
*** Bug 341860 has been marked as a duplicate of this bug. ***
Created attachment 66476 [details] [review] lockdown patch This patch uses a GeditApp property to track the lockdown state.
Paolo, could you please have a look at the patch ? thanks.
Comment on attachment 66476 [details] [review] lockdown patch I think we can commit this patch in an incremetal way. We can start committing the GeditApp e GeditPrefsManager part. Here my comments on that part. > struct _GeditAppPrivate > { >- GList *windows; >- GeditWindow *active_window; >+ GList *windows; >+ GeditWindow *active_window; >+ guint lockdown; > } In order to improve code readability please use GeditLockdownMask instead of guint. >+guint >+gedit_app_get_lockdown (GeditApp *app) >+{ >+ g_return_val_if_fail (GEDIT_IS_APP (app), FALSE); Return "0" or better "all lockdown" since it is safer. > > /* >+ * Lockdown mask definition >+ */ >+typedef enum >+{ >+ GEDIT_LOCKDOWN_COMMAND_LINE = 1 << 1, It should start from "1 << 0" > >+/* Lockdown state */ >+guint gedit_app_get_lockdown (GeditApp *app); >+ > /* > * Non exported functions > */ >@@ -101,6 +115,12 @@ GeditWindow *_gedit_app_restore_window > GeditWindow *_gedit_app_get_window_in_workspace (GeditApp *app, > GdkScreen *screen, > gint workspace); >+void _gedit_app_set_lockdown (GeditApp *app, >+ guint lockdown); >+void _gedit_app_set_lockdown_bit (GeditApp *app, >+ GeditLockdownMask bit, >+ gboolean value); >+ Use GeditLockdownMask instead of guint. >+ >+/* Global Lockdown */ >+guint >+gedit_prefs_manager_get_lockdown (void) Use GeditLockdownMask instead of guint. >+ >+/* Global lockdown */ >+guint gedit_prefs_manager_get_lockdown (void); Ditto. I have also a general comment about the patch. It introduces a new way for managing "global" preferences. I think the new way is more elegant than the current one but at the same way I'm a bit worried about it since it breaks code consistency. May be we should start using the same approach for future changes. BTW, please commit the first part of the patch. I will review the second part later. Note that we should also disable the External Tool plugin if "disable_command_line" is true.
(In reply to comment #10) > In order to improve code readability please use GeditLockdownMask instead of > guint. I used guint because it was what gtk+ did (I took GtkWidget as an example) and I was not sure the compiler would allow a combination of several enum values. But I can make the change, it would slightly improve the readability. > Note that we should also disable the External Tool plugin if > "disable_command_line" is true. I did also do a patch for the Terminal plugin (from gedit-plugins). Anyway the rationale we ended with was that the manager of a locked down box could just not install these sensible plugins. What is your opinion about that ?
Note that commiting this part will also need the commit of the glib-mkenum part, since it's required when registering the property.
Sure, I mean we can commit the non-UI related part of the work (GeditApp, Prefs and mkenum stuff). Looking at gedit-tab.c patch it seems you do not manage changes to the lockdown state after tab initialization.
I think we should try to minimize application specific configuration changes to create a lookdown environment. So I think we should disable the features in the plugins and don't ask the administrator to uninstall specific plugins.
Created attachment 67126 [details] [review] part 1 of the patch I've comitted the first part of the patch. 2006-06-11 Steve Frécinaux <steve@istique.net> Fix for bug #165568 – Support global lockdown keys (first part) * gedit/gedit-app.[ch]: define GeditLockdownMask as a flag type, add a 'lockdown' property to GeditApp, of type GeditLockdownMask, and define its getter/setter. * gedit/gedit-prefs-manager.[ch]: define a new helper function gedit_prefs_manager_get_lockdown. * gedit/gedit-prefs-manager-app.c: Listen to lockdown GConf folder changes. Update GeditApp's lockdown properties when a lockdown key is changed. * gedit/gedit-enum-types.h.template: * gedit/gedit-enum-types.c.template: * gedit/Makefile.am: Autogenerate type definitions for exported enums using glib-mkenums. * configure.ac: add GLIB_MKENUMS definition.
You would also need to disable shell and python snippets.
Created attachment 67188 [details] [review] part 2 of the patch This is the second part of the patch, which is related to the UI. The autosave status update has been fixed, and s/guint/GeditLockdownMask where needed.
pbor quickly reviewed the patch and said it looks ok, so I'll commit this last patch thursday...
comitted in HEAD. 2006-06-15 Steve Frécinaux <steve@istique.net> Fix for bug #165568 – Support global lockdown keys (second part) * gedit/gedit-window.c: disable some menu entries according the current lockdown state; listen to app's lockdown property changes to update the menus sensitivity and autosave status accordingly. * gedit/gedit-ui.h: move FilePageSetup from always sensitive actions. * gedit/gedit-tab.c: do not enable autosave if save_to_disk is disabled. * gedit/dialogs/gedit-close-confirmation-dialog.c: adapt the dialog to the case save_to_disk is disabled.