Removed lockdown support (tied with MATE)
This commit is contained in:
parent
f8e40ce128
commit
8da17d74e8
|
@ -3,14 +3,12 @@
|
|||
XeditAppPrivate
|
||||
<TITLE>XeditApp</TITLE>
|
||||
XeditApp
|
||||
XeditLockdownMask
|
||||
xedit_app_get_default
|
||||
xedit_app_create_window
|
||||
xedit_app_get_windows
|
||||
xedit_app_get_active_window
|
||||
xedit_app_get_documents
|
||||
xedit_app_get_views
|
||||
xedit_app_get_lockdown
|
||||
<SUBSECTION Standard>
|
||||
XEDIT_APP
|
||||
XEDIT_IS_APP
|
||||
|
@ -579,11 +577,6 @@ GPM_SHOWN_IN_MENU_ENCODINGS
|
|||
GPM_SYNTAX_HL_DIR
|
||||
GPM_SYNTAX_HL_ENABLE
|
||||
GPM_WRITABLE_VFS_SCHEMES
|
||||
GPM_LOCKDOWN_DIR
|
||||
GPM_LOCKDOWN_COMMAND_LINE
|
||||
GPM_LOCKDOWN_PRINTING
|
||||
GPM_LOCKDOWN_PRINT_SETUP
|
||||
GPM_LOCKDOWN_SAVE_TO_DISK
|
||||
GPM_DEFAULT_USE_DEFAULT_FONT
|
||||
GPM_DEFAULT_EDITOR_FONT
|
||||
GPM_DEFAULT_USE_DEFAULT_COLORS
|
||||
|
@ -750,7 +743,6 @@ xedit_prefs_manager_get_restore_cursor_position
|
|||
xedit_prefs_manager_get_enable_search_highlighting
|
||||
xedit_prefs_manager_set_enable_search_highlighting
|
||||
xedit_prefs_manager_enable_search_highlighting_can_set
|
||||
xedit_prefs_manager_get_lockdown
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
@ -789,8 +781,6 @@ xedit_utils_format_uri_for_display
|
|||
|
||||
<SECTION>
|
||||
<FILE>xedit-enum-types</FILE>
|
||||
XEDIT_TYPE_LOCKDOWN_MASK
|
||||
xedit_lockdown_mask_get_type
|
||||
XEDIT_TYPE_CONVERT_ERROR
|
||||
xedit_convert_error_get_type
|
||||
XEDIT_TYPE_DEBUG_SECTION
|
||||
|
|
|
@ -79,19 +79,6 @@
|
|||
|
||||
;; Enumerations and flags ...
|
||||
|
||||
(define-flags LockdownMask
|
||||
(in-module "Xedit")
|
||||
(c-name "XeditLockdownMask")
|
||||
(gtype-id "XEDIT_TYPE_LOCKDOWN_MASK")
|
||||
(values
|
||||
'("command-line" "XEDIT_LOCKDOWN_COMMAND_LINE")
|
||||
'("printing" "XEDIT_LOCKDOWN_PRINTING")
|
||||
'("print-setup" "XEDIT_LOCKDOWN_PRINT_SETUP")
|
||||
'("save-to-disk" "XEDIT_LOCKDOWN_SAVE_TO_DISK")
|
||||
'("all" "XEDIT_LOCKDOWN_ALL")
|
||||
)
|
||||
)
|
||||
|
||||
(define-flags SearchFlags
|
||||
(in-module "Xedit")
|
||||
(c-name "XeditSearchFlags")
|
||||
|
@ -223,12 +210,6 @@
|
|||
(return-type "GList*")
|
||||
)
|
||||
|
||||
(define-method get_lockdown
|
||||
(of-object "XeditApp")
|
||||
(c-name "xedit_app_get_lockdown")
|
||||
(return-type "XeditLockdownMask")
|
||||
)
|
||||
|
||||
|
||||
;; From ../../xedit/xedit-document.h
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ struct _XeditCloseConfirmationDialogPrivate
|
|||
|
||||
GtkTreeModel *list_store;
|
||||
|
||||
gboolean disable_save_to_disk;
|
||||
};
|
||||
|
||||
#define XEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
|
@ -160,13 +159,7 @@ set_logout_mode (XeditCloseConfirmationDialog *dlg,
|
|||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||
}
|
||||
|
||||
if (dlg->priv->disable_save_to_disk)
|
||||
{
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dlg),
|
||||
GTK_RESPONSE_NO);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const gchar *stock_id = GTK_STOCK_SAVE;
|
||||
|
||||
if (GET_MODE (dlg->priv) == SINGLE_DOC_MODE)
|
||||
|
@ -186,7 +179,6 @@ set_logout_mode (XeditCloseConfirmationDialog *dlg,
|
|||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dlg),
|
||||
GTK_RESPONSE_YES);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -196,10 +188,6 @@ xedit_close_confirmation_dialog_init (XeditCloseConfirmationDialog *dlg)
|
|||
|
||||
dlg->priv = XEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg);
|
||||
|
||||
dlg->priv->disable_save_to_disk =
|
||||
xedit_app_get_lockdown (xedit_app_get_default ())
|
||||
& XEDIT_LOCKDOWN_SAVE_TO_DISK;
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
|
||||
14);
|
||||
|
@ -530,16 +518,7 @@ build_single_doc_dialog (XeditCloseConfirmationDialog *dlg)
|
|||
|
||||
doc_name = xedit_document_get_short_name_for_display (doc);
|
||||
|
||||
if (dlg->priv->disable_save_to_disk)
|
||||
{
|
||||
str = g_markup_printf_escaped (_("Changes to document \"%s\" will be permanently lost."),
|
||||
doc_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = g_markup_printf_escaped (_("Save changes to document \"%s\" before closing?"),
|
||||
doc_name);
|
||||
}
|
||||
str = g_markup_printf_escaped (_("Save changes to document \"%s\" before closing?"), doc_name);
|
||||
|
||||
g_free (doc_name);
|
||||
|
||||
|
@ -550,9 +529,6 @@ build_single_doc_dialog (XeditCloseConfirmationDialog *dlg)
|
|||
g_free (markup_str);
|
||||
|
||||
/* Secondary label */
|
||||
if (dlg->priv->disable_save_to_disk)
|
||||
str = g_strdup (_("Saving has been disabled by the system administrator."));
|
||||
else
|
||||
str = get_text_secondary_label (doc);
|
||||
secondary_label = gtk_label_new (str);
|
||||
g_free (str);
|
||||
|
@ -656,8 +632,7 @@ create_treeview (XeditCloseConfirmationDialogPrivate *priv)
|
|||
priv->list_store = GTK_TREE_MODEL (store);
|
||||
|
||||
/* Add columns */
|
||||
if (!priv->disable_save_to_disk)
|
||||
{
|
||||
|
||||
renderer = gtk_cell_renderer_toggle_new ();
|
||||
g_signal_connect (renderer, "toggled",
|
||||
G_CALLBACK (save_toggled), store);
|
||||
|
@ -668,7 +643,6 @@ create_treeview (XeditCloseConfirmationDialogPrivate *priv)
|
|||
SAVE_COLUMN,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
|
||||
}
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Name",
|
||||
|
@ -734,13 +708,6 @@ build_multiple_docs_dialog (XeditCloseConfirmationDialog *dlg)
|
|||
#endif
|
||||
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
|
||||
|
||||
if (priv->disable_save_to_disk)
|
||||
str = g_strdup_printf (
|
||||
ngettext ("Changes to %d document will be permanently lost.",
|
||||
"Changes to %d documents will be permanently lost.",
|
||||
g_list_length (priv->unsaved_documents)),
|
||||
g_list_length (priv->unsaved_documents));
|
||||
else
|
||||
str = g_strdup_printf (
|
||||
ngettext ("There is %d document with unsaved changes. "
|
||||
"Save changes before closing?",
|
||||
|
@ -759,9 +726,6 @@ build_multiple_docs_dialog (XeditCloseConfirmationDialog *dlg)
|
|||
vbox2 = gtk_vbox_new (FALSE, 8);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
|
||||
|
||||
if (priv->disable_save_to_disk)
|
||||
select_label = gtk_label_new_with_mnemonic (_("Docum_ents with unsaved changes:"));
|
||||
else
|
||||
select_label = gtk_label_new_with_mnemonic (_("S_elect the documents you want to save:"));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), select_label, FALSE, FALSE, 0);
|
||||
|
@ -784,9 +748,6 @@ build_multiple_docs_dialog (XeditCloseConfirmationDialog *dlg)
|
|||
gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview);
|
||||
|
||||
/* Secondary label */
|
||||
if (priv->disable_save_to_disk)
|
||||
secondary_label = gtk_label_new (_("Saving has been disabled by the system administrator."));
|
||||
else
|
||||
secondary_label = gtk_label_new (_("If you don't save, "
|
||||
"all your changes will be permanently lost."));
|
||||
|
||||
|
|
|
@ -55,16 +55,12 @@
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_LOCKDOWN
|
||||
};
|
||||
|
||||
struct _XeditAppPrivate
|
||||
{
|
||||
GList *windows;
|
||||
XeditWindow *active_window;
|
||||
|
||||
XeditLockdownMask lockdown;
|
||||
|
||||
GtkPageSetup *page_setup;
|
||||
GtkPrintSettings *print_settings;
|
||||
};
|
||||
|
@ -96,9 +92,6 @@ xedit_app_get_property (GObject *object,
|
|||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LOCKDOWN:
|
||||
g_value_set_flags (value, xedit_app_get_lockdown (app));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -113,16 +106,6 @@ xedit_app_class_init (XeditAppClass *klass)
|
|||
object_class->finalize = xedit_app_finalize;
|
||||
object_class->get_property = xedit_app_get_property;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_LOCKDOWN,
|
||||
g_param_spec_flags ("lockdown",
|
||||
"Lockdown",
|
||||
"The lockdown mask",
|
||||
XEDIT_TYPE_LOCKDOWN_MASK,
|
||||
0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XeditAppPrivate));
|
||||
}
|
||||
|
||||
|
@ -332,9 +315,6 @@ xedit_app_init (XeditApp *app)
|
|||
app->priv = XEDIT_APP_GET_PRIVATE (app);
|
||||
|
||||
load_accels ();
|
||||
|
||||
/* initial lockdown state */
|
||||
app->priv->lockdown = xedit_prefs_manager_get_lockdown ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -792,60 +772,6 @@ xedit_app_get_views (XeditApp *app)
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* xedit_app_get_lockdown:
|
||||
* @app: a #XeditApp
|
||||
*
|
||||
* Gets the lockdown mask (see #XeditLockdownMask) for the application.
|
||||
* The lockdown mask determines which functions are locked down using
|
||||
* the MATE-wise lockdown GSettings keys.
|
||||
**/
|
||||
XeditLockdownMask
|
||||
xedit_app_get_lockdown (XeditApp *app)
|
||||
{
|
||||
g_return_val_if_fail (XEDIT_IS_APP (app), XEDIT_LOCKDOWN_ALL);
|
||||
|
||||
return app->priv->lockdown;
|
||||
}
|
||||
|
||||
static void
|
||||
app_lockdown_changed (XeditApp *app)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = app->priv->windows; l != NULL; l = l->next)
|
||||
_xedit_window_set_lockdown (XEDIT_WINDOW (l->data),
|
||||
app->priv->lockdown);
|
||||
|
||||
g_object_notify (G_OBJECT (app), "lockdown");
|
||||
}
|
||||
|
||||
void
|
||||
_xedit_app_set_lockdown (XeditApp *app,
|
||||
XeditLockdownMask lockdown)
|
||||
{
|
||||
g_return_if_fail (XEDIT_IS_APP (app));
|
||||
|
||||
app->priv->lockdown = lockdown;
|
||||
|
||||
app_lockdown_changed (app);
|
||||
}
|
||||
|
||||
void
|
||||
_xedit_app_set_lockdown_bit (XeditApp *app,
|
||||
XeditLockdownMask bit,
|
||||
gboolean value)
|
||||
{
|
||||
g_return_if_fail (XEDIT_IS_APP (app));
|
||||
|
||||
if (value)
|
||||
app->priv->lockdown |= bit;
|
||||
else
|
||||
app->priv->lockdown &= ~bit;
|
||||
|
||||
app_lockdown_changed (app);
|
||||
}
|
||||
|
||||
/* Returns a copy */
|
||||
GtkPageSetup *
|
||||
_xedit_app_get_default_page_setup (XeditApp *app)
|
||||
|
|
|
@ -73,18 +73,6 @@ struct _XeditAppClass
|
|||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Lockdown mask definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
XEDIT_LOCKDOWN_COMMAND_LINE = 1 << 0,
|
||||
XEDIT_LOCKDOWN_PRINTING = 1 << 1,
|
||||
XEDIT_LOCKDOWN_PRINT_SETUP = 1 << 2,
|
||||
XEDIT_LOCKDOWN_SAVE_TO_DISK = 1 << 3,
|
||||
XEDIT_LOCKDOWN_ALL = 0xF
|
||||
} XeditLockdownMask;
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
|
@ -104,9 +92,6 @@ GList *xedit_app_get_documents (XeditApp *app);
|
|||
/* Returns a newly allocated list with all the views */
|
||||
GList *xedit_app_get_views (XeditApp *app);
|
||||
|
||||
/* Lockdown state */
|
||||
XeditLockdownMask xedit_app_get_lockdown (XeditApp *app);
|
||||
|
||||
/*
|
||||
* Non exported functions
|
||||
*/
|
||||
|
@ -117,17 +102,6 @@ XeditWindow *_xedit_app_get_window_in_viewport (XeditApp *app,
|
|||
gint workspace,
|
||||
gint viewport_x,
|
||||
gint viewport_y);
|
||||
void _xedit_app_set_lockdown (XeditApp *app,
|
||||
XeditLockdownMask lockdown);
|
||||
void _xedit_app_set_lockdown_bit (XeditApp *app,
|
||||
XeditLockdownMask bit,
|
||||
gboolean value);
|
||||
/*
|
||||
* This one is a xedit-window function, but we declare it here to avoid
|
||||
* #include headaches since it needs the XeditLockdownMask declaration.
|
||||
*/
|
||||
void _xedit_window_set_lockdown (XeditWindow *window,
|
||||
XeditLockdownMask lockdown);
|
||||
|
||||
/* global print config */
|
||||
GtkPageSetup *_xedit_app_get_default_page_setup (XeditApp *app);
|
||||
|
|
|
@ -116,10 +116,6 @@ static void xedit_prefs_manager_active_plugins_changed (GSettings *settings,
|
|||
gchar *key,
|
||||
gpointer user_data);
|
||||
|
||||
static void xedit_prefs_manager_lockdown_changed (GSettings *settings,
|
||||
gchar *key,
|
||||
gpointer user_data);
|
||||
|
||||
/* GUI state is serialized to a .desktop file, not in GSettings */
|
||||
|
||||
#define XEDIT_STATE_DEFAULT_WINDOW_STATE 0
|
||||
|
@ -717,11 +713,6 @@ xedit_prefs_manager_app_init (void)
|
|||
"changed::" GPM_ACTIVE_PLUGINS,
|
||||
G_CALLBACK (xedit_prefs_manager_active_plugins_changed),
|
||||
NULL);
|
||||
|
||||
g_signal_connect (xedit_prefs_manager->lockdown_settings,
|
||||
"changed",
|
||||
G_CALLBACK (xedit_prefs_manager_lockdown_changed),
|
||||
NULL);
|
||||
}
|
||||
|
||||
return xedit_prefs_manager != NULL;
|
||||
|
@ -1439,37 +1430,3 @@ xedit_prefs_manager_active_plugins_changed (GSettings *settings,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xedit_prefs_manager_lockdown_changed (GSettings *settings,
|
||||
gchar *key,
|
||||
gpointer user_data)
|
||||
{
|
||||
XeditApp *app;
|
||||
gboolean locked;
|
||||
|
||||
xedit_debug (DEBUG_PREFS);
|
||||
|
||||
locked = g_settings_get_boolean (settings, key);
|
||||
|
||||
app = xedit_app_get_default ();
|
||||
|
||||
if (strcmp (key, GPM_LOCKDOWN_COMMAND_LINE) == 0)
|
||||
_xedit_app_set_lockdown_bit (app,
|
||||
XEDIT_LOCKDOWN_COMMAND_LINE,
|
||||
locked);
|
||||
|
||||
else if (strcmp (key, GPM_LOCKDOWN_PRINTING) == 0)
|
||||
_xedit_app_set_lockdown_bit (app,
|
||||
XEDIT_LOCKDOWN_PRINTING,
|
||||
locked);
|
||||
|
||||
else if (strcmp (key, GPM_LOCKDOWN_PRINT_SETUP) == 0)
|
||||
_xedit_app_set_lockdown_bit (app,
|
||||
XEDIT_LOCKDOWN_PRINT_SETUP,
|
||||
locked);
|
||||
|
||||
else if (strcmp (key, GPM_LOCKDOWN_SAVE_TO_DISK) == 0)
|
||||
_xedit_app_set_lockdown_bit (app,
|
||||
XEDIT_LOCKDOWN_SAVE_TO_DISK,
|
||||
locked);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ typedef struct _XeditPrefsManager XeditPrefsManager;
|
|||
|
||||
struct _XeditPrefsManager {
|
||||
GSettings *settings;
|
||||
GSettings *lockdown_settings;
|
||||
GSettings *interface_settings;
|
||||
};
|
||||
|
||||
|
|
|
@ -143,7 +143,6 @@ xedit_prefs_manager_init (void)
|
|||
{
|
||||
xedit_prefs_manager = g_new0 (XeditPrefsManager, 1);
|
||||
xedit_prefs_manager->settings = g_settings_new (XEDIT_SCHEMA);
|
||||
xedit_prefs_manager->lockdown_settings = g_settings_new (GPM_LOCKDOWN_SCHEMA);
|
||||
xedit_prefs_manager->interface_settings = g_settings_new (GPM_INTERFACE_SCHEMA);
|
||||
}
|
||||
|
||||
|
@ -159,8 +158,6 @@ xedit_prefs_manager_shutdown (void)
|
|||
|
||||
g_object_unref (xedit_prefs_manager->settings);
|
||||
xedit_prefs_manager->settings = NULL;
|
||||
g_object_unref (xedit_prefs_manager->lockdown_settings);
|
||||
xedit_prefs_manager->lockdown_settings = NULL;
|
||||
g_object_unref (xedit_prefs_manager->interface_settings);
|
||||
xedit_prefs_manager->interface_settings = NULL;
|
||||
}
|
||||
|
@ -917,25 +914,3 @@ xedit_prefs_manager_active_plugins_can_set (void)
|
|||
|
||||
return xedit_prefs_manager_key_is_writable (GPM_ACTIVE_PLUGINS);
|
||||
}
|
||||
|
||||
/* Global Lockdown */
|
||||
|
||||
XeditLockdownMask
|
||||
xedit_prefs_manager_get_lockdown (void)
|
||||
{
|
||||
guint lockdown = 0;
|
||||
|
||||
if (g_settings_get_boolean (xedit_prefs_manager->lockdown_settings, GPM_LOCKDOWN_COMMAND_LINE))
|
||||
lockdown |= XEDIT_LOCKDOWN_COMMAND_LINE;
|
||||
|
||||
if (g_settings_get_boolean (xedit_prefs_manager->lockdown_settings, GPM_LOCKDOWN_PRINTING))
|
||||
lockdown |= XEDIT_LOCKDOWN_PRINTING;
|
||||
|
||||
if (g_settings_get_boolean (xedit_prefs_manager->lockdown_settings, GPM_LOCKDOWN_PRINT_SETUP))
|
||||
lockdown |= XEDIT_LOCKDOWN_PRINT_SETUP;
|
||||
|
||||
if (g_settings_get_boolean (xedit_prefs_manager->lockdown_settings, GPM_LOCKDOWN_SAVE_TO_DISK))
|
||||
lockdown |= XEDIT_LOCKDOWN_SAVE_TO_DISK;
|
||||
|
||||
return lockdown;
|
||||
}
|
||||
|
|
|
@ -111,13 +111,6 @@
|
|||
#define GPM_INTERFACE_SCHEMA "org.mate.interface"
|
||||
#define GPM_SYSTEM_FONT "monospace-font-name"
|
||||
|
||||
/* Global Lockdown keys */
|
||||
#define GPM_LOCKDOWN_SCHEMA "org.mate.lockdown"
|
||||
#define GPM_LOCKDOWN_COMMAND_LINE "disable-command-line"
|
||||
#define GPM_LOCKDOWN_PRINTING "disable-printing"
|
||||
#define GPM_LOCKDOWN_PRINT_SETUP "disable-print-setup"
|
||||
#define GPM_LOCKDOWN_SAVE_TO_DISK "disable-save-to-disk"
|
||||
|
||||
/* Fallback default values. Keep in sync with org.x.editor.gschema.xml */
|
||||
#define GPM_DEFAULT_AUTO_SAVE_INTERVAL 10 /* minutes */
|
||||
#define GPM_DEFAULT_MAX_RECENTS 5
|
||||
|
@ -323,9 +316,6 @@ GSList *xedit_prefs_manager_get_active_plugins (void);
|
|||
void xedit_prefs_manager_set_active_plugins (const GSList *plugins);
|
||||
gboolean xedit_prefs_manager_active_plugins_can_set (void);
|
||||
|
||||
/* Global lockdown */
|
||||
XeditLockdownMask xedit_prefs_manager_get_lockdown (void);
|
||||
|
||||
/* GSettings utilities */
|
||||
GSList* xedit_prefs_manager_get_gslist (GSettings *settings, const gchar *key);
|
||||
void xedit_prefs_manager_set_gslist (GSettings *settings, const gchar *key, GSList *list);
|
||||
|
|
|
@ -1478,7 +1478,6 @@ xedit_tab_init (XeditTab *tab)
|
|||
{
|
||||
GtkWidget *sw;
|
||||
XeditDocument *doc;
|
||||
XeditLockdownMask lockdown;
|
||||
|
||||
tab->priv = XEDIT_TAB_GET_PRIVATE (tab);
|
||||
|
||||
|
@ -1504,9 +1503,7 @@ xedit_tab_init (XeditTab *tab)
|
|||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
/* Manage auto save data */
|
||||
lockdown = xedit_app_get_lockdown (xedit_app_get_default ());
|
||||
tab->priv->auto_save = xedit_prefs_manager_get_auto_save () &&
|
||||
!(lockdown & XEDIT_LOCKDOWN_SAVE_TO_DISK);
|
||||
tab->priv->auto_save = xedit_prefs_manager_get_auto_save ();
|
||||
tab->priv->auto_save = (tab->priv->auto_save != FALSE);
|
||||
|
||||
tab->priv->auto_save_interval = xedit_prefs_manager_get_auto_save_interval ();
|
||||
|
@ -2670,17 +2667,10 @@ xedit_tab_set_auto_save_enabled (XeditTab *tab,
|
|||
gboolean enable)
|
||||
{
|
||||
XeditDocument *doc = NULL;
|
||||
XeditLockdownMask lockdown;
|
||||
|
||||
xedit_debug (DEBUG_TAB);
|
||||
|
||||
g_return_if_fail (XEDIT_IS_TAB (tab));
|
||||
|
||||
/* Force disabling when lockdown is active */
|
||||
lockdown = xedit_app_get_lockdown (xedit_app_get_default());
|
||||
if (lockdown & XEDIT_LOCKDOWN_SAVE_TO_DISK)
|
||||
enable = FALSE;
|
||||
|
||||
doc = xedit_tab_get_document (tab);
|
||||
|
||||
if (tab->priv->auto_save == enable)
|
||||
|
|
|
@ -666,14 +666,11 @@ set_sensitivity_according_to_tab (XeditWindow *window,
|
|||
gboolean editable;
|
||||
XeditTabState state;
|
||||
GtkClipboard *clipboard;
|
||||
XeditLockdownMask lockdown;
|
||||
|
||||
g_return_if_fail (XEDIT_TAB (tab));
|
||||
|
||||
xedit_debug (DEBUG_WINDOW);
|
||||
|
||||
lockdown = xedit_app_get_lockdown (xedit_app_get_default ());
|
||||
|
||||
state = xedit_tab_get_state (tab);
|
||||
state_normal = (state == XEDIT_TAB_STATE_NORMAL);
|
||||
|
||||
|
@ -691,8 +688,7 @@ set_sensitivity_according_to_tab (XeditWindow *window,
|
|||
(state_normal ||
|
||||
(state == XEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) ||
|
||||
(state == XEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
|
||||
!xedit_document_get_readonly (doc) &&
|
||||
!(lockdown & XEDIT_LOCKDOWN_SAVE_TO_DISK));
|
||||
!xedit_document_get_readonly (doc));
|
||||
|
||||
action = gtk_action_group_get_action (window->priv->action_group,
|
||||
"FileSaveAs");
|
||||
|
@ -700,8 +696,7 @@ set_sensitivity_according_to_tab (XeditWindow *window,
|
|||
(state_normal ||
|
||||
(state == XEDIT_TAB_STATE_SAVING_ERROR) ||
|
||||
(state == XEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) ||
|
||||
(state == XEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
|
||||
!(lockdown & XEDIT_LOCKDOWN_SAVE_TO_DISK));
|
||||
(state == XEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)));
|
||||
|
||||
action = gtk_action_group_get_action (window->priv->action_group,
|
||||
"FileRevert");
|
||||
|
@ -713,15 +708,13 @@ set_sensitivity_according_to_tab (XeditWindow *window,
|
|||
action = gtk_action_group_get_action (window->priv->action_group,
|
||||
"FilePrintPreview");
|
||||
gtk_action_set_sensitive (action,
|
||||
state_normal &&
|
||||
!(lockdown & XEDIT_LOCKDOWN_PRINTING));
|
||||
state_normal);
|
||||
|
||||
action = gtk_action_group_get_action (window->priv->action_group,
|
||||
"FilePrint");
|
||||
gtk_action_set_sensitive (action,
|
||||
(state_normal ||
|
||||
(state == XEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
|
||||
!(lockdown & XEDIT_LOCKDOWN_PRINTING));
|
||||
(state == XEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)));
|
||||
|
||||
action = gtk_action_group_get_action (window->priv->close_action_group,
|
||||
"FileClose");
|
||||
|
@ -2445,9 +2438,6 @@ static void
|
|||
set_sensitivity_according_to_window_state (XeditWindow *window)
|
||||
{
|
||||
GtkAction *action;
|
||||
XeditLockdownMask lockdown;
|
||||
|
||||
lockdown = xedit_app_get_lockdown (xedit_app_get_default ());
|
||||
|
||||
/* We disable File->Quit/SaveAll/CloseAll while printing to avoid to have two
|
||||
operations (save and print/print preview) that uses the message area at
|
||||
|
@ -2467,8 +2457,7 @@ set_sensitivity_according_to_window_state (XeditWindow *window)
|
|||
action = gtk_action_group_get_action (window->priv->action_group,
|
||||
"FileSaveAll");
|
||||
gtk_action_set_sensitive (action,
|
||||
!(window->priv->state & XEDIT_WINDOW_STATE_PRINTING) &&
|
||||
!(lockdown & XEDIT_LOCKDOWN_SAVE_TO_DISK));
|
||||
!(window->priv->state & XEDIT_WINDOW_STATE_PRINTING));
|
||||
|
||||
action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
|
||||
"FileNew");
|
||||
|
@ -2530,33 +2519,6 @@ update_tab_autosave (GtkWidget *widget,
|
|||
xedit_tab_set_auto_save_enabled (tab, *enabled);
|
||||
}
|
||||
|
||||
void
|
||||
_xedit_window_set_lockdown (XeditWindow *window,
|
||||
XeditLockdownMask lockdown)
|
||||
{
|
||||
XeditTab *tab;
|
||||
GtkAction *action;
|
||||
gboolean autosave;
|
||||
|
||||
/* start/stop autosave in each existing tab */
|
||||
autosave = xedit_prefs_manager_get_auto_save ();
|
||||
gtk_container_foreach (GTK_CONTAINER (window->priv->notebook),
|
||||
update_tab_autosave,
|
||||
&autosave);
|
||||
|
||||
/* update menues wrt the current active tab */
|
||||
tab = xedit_window_get_active_tab (window);
|
||||
|
||||
set_sensitivity_according_to_tab (window, tab);
|
||||
|
||||
action = gtk_action_group_get_action (window->priv->action_group,
|
||||
"FileSaveAll");
|
||||
gtk_action_set_sensitive (action,
|
||||
!(window->priv->state & XEDIT_WINDOW_STATE_PRINTING) &&
|
||||
!(lockdown & XEDIT_LOCKDOWN_SAVE_TO_DISK));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
analyze_tab_state (XeditTab *tab,
|
||||
XeditWindow *window)
|
||||
|
|
Loading…
Reference in New Issue