summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-05 22:26:43 +0200
committerStefano Karapetsas <[email protected]>2012-09-05 22:26:43 +0200
commit79b4d49087d25ce067e9e40ab5e9ee7a70228f6a (patch)
treeb573edc56208861a957008d18f816a621d3f24dd
parent2c7506960cf25b2e35347a95e0eabf9d6acbd8a1 (diff)
downloadcaja-79b4d49087d25ce067e9e40ab5e9ee7a70228f6a.tar.bz2
caja-79b4d49087d25ce067e9e40ab5e9ee7a70228f6a.tar.xz
convert disable-command-line lockdown to gsettings
-rw-r--r--libcaja-private/caja-global-preferences.c2
-rw-r--r--libcaja-private/caja-global-preferences.h5
-rw-r--r--src/file-manager/fm-desktop-icon-view.c29
-rw-r--r--src/file-manager/fm-directory-view.c29
4 files changed, 19 insertions, 46 deletions
diff --git a/libcaja-private/caja-global-preferences.c b/libcaja-private/caja-global-preferences.c
index 4d82e6df..31c86589 100644
--- a/libcaja-private/caja-global-preferences.c
+++ b/libcaja-private/caja-global-preferences.c
@@ -91,6 +91,8 @@ caja_global_preferences_init (void)
caja_tree_sidebar_preferences = g_settings_new("org.mate.caja.sidebar-panels.tree");
caja_list_view_preferences = g_settings_new("org.mate.caja.list-view");
+ mate_lockdown_preferences = g_settings_new("org.mate.desktop.lockdown");
+
caja_mateconf_client = mateconf_client_get_default ();
/* Add monitors for any other MateConf paths we have keys in */
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index efcbbb7e..6ef7f372 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -206,8 +206,7 @@ G_BEGIN_DECLS
#define CAJA_PREFERENCES_DESKTOP_NETWORK_NAME "network-icon-name"
/* Lockdown */
-#define CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE "/desktop/mate/lockdown/disable_command_line"
-#define CAJA_MATECONF_LOCKDOWN_COMMAND_LINE "/desktop/mate/lockdown/disable_command_line"
+#define CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE "disable-command-line"
void caja_global_preferences_init (void);
@@ -222,6 +221,8 @@ GSettings *caja_tree_sidebar_preferences;
GSettings *caja_compact_view_preferences;
GSettings *caja_list_view_preferences;
+GSettings *mate_lockdown_preferences;
+
MateConfClient *caja_mateconf_client;
G_END_DECLS
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 4698e0e1..ae9e4c02 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -78,8 +78,6 @@ struct FMDesktopIconViewDetails
gulong delayed_init_signal;
guint reload_desktop_timeout;
gboolean pending_rescan;
-
- guint lockdown_notification_id;
};
static void fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view);
@@ -109,15 +107,6 @@ desktop_directory_changed_callback (gpointer callback_data)
desktop_directory = caja_get_desktop_directory ();
}
-static void
-lockdown_disable_command_line_changed_callback (MateConfClient* client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer callback_data)
-{
- fm_directory_view_update_menus (FM_DIRECTORY_VIEW (callback_data));
-}
-
static CajaIconContainer *
get_icon_container (FMDesktopIconView *icon_view)
{
@@ -313,8 +302,9 @@ fm_desktop_icon_view_finalize (GObject *object)
font_changed_callback,
icon_view);
- mateconf_client_notify_remove (caja_mateconf_client,
- icon_view->details->lockdown_notification_id);
+ g_signal_handlers_disconnect_by_func (mate_lockdown_preferences,
+ fm_directory_view_update_menus,
+ icon_view);
g_signal_handlers_disconnect_by_func (caja_preferences,
desktop_directory_changed_callback,
NULL);
@@ -636,13 +626,10 @@ 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);
- desktop_icon_view->details->lockdown_notification_id =
- mateconf_client_notify_add (caja_mateconf_client,
- CAJA_MATECONF_LOCKDOWN_COMMAND_LINE,
- lockdown_disable_command_line_changed_callback,
- desktop_icon_view,
- NULL,
- NULL);
+ g_signal_connect_swapped (mate_lockdown_preferences,
+ "changed::" CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+ G_CALLBACK (fm_directory_view_update_menus),
+ desktop_icon_view);
}
@@ -734,7 +721,7 @@ real_update_menus (FMDirectoryView *view)
desktop_view = FM_DESKTOP_ICON_VIEW (view);
/* New Launcher */
- disable_command_line = mateconf_client_get_bool (caja_mateconf_client, CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE, NULL);
+ disable_command_line = g_settings_get_boolean (mate_lockdown_preferences, CAJA_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,
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index e7628333..55b1e5bb 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -253,7 +253,6 @@ struct FMDirectoryViewDetails
gboolean allow_moves;
GdkPoint context_menu_position;
- guint lockdown_notification_id;
gboolean undo_active;
gboolean redo_active;
@@ -1636,18 +1635,6 @@ sort_directories_first_changed_callback (gpointer callback_data)
}
}
-static void
-lockdown_disable_command_line_changed_callback (MateConfClient* client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer callback_data)
-{
- FMDirectoryView *view;
-
- view = FM_DIRECTORY_VIEW (callback_data);
- schedule_update_menus (view);
-}
-
static void set_up_scripts_directory_global(void)
{
if (scripts_directory_uri != NULL)
@@ -2062,13 +2049,9 @@ fm_directory_view_init (FMDirectoryView *view)
"changed::" CAJA_PREFERENCES_SORT_DIRECTORIES_FIRST,
G_CALLBACK(sort_directories_first_changed_callback),
view);
- view->details->lockdown_notification_id =
- mateconf_client_notify_add (caja_mateconf_client,
- CAJA_MATECONF_LOCKDOWN_COMMAND_LINE,
- lockdown_disable_command_line_changed_callback,
- view,
- NULL,
- NULL);
+ g_signal_connect_swapped (mate_lockdown_preferences,
+ "changed::" CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+ G_CALLBACK (schedule_update_menus), view);
/* Update undo actions stuff and connect signals from the undostack manager */
view->details->undo_active = FALSE;
@@ -2196,8 +2179,8 @@ fm_directory_view_finalize (GObject *object)
click_policy_changed_callback, view);
g_signal_handlers_disconnect_by_func (caja_preferences,
sort_directories_first_changed_callback, view);
- mateconf_client_notify_remove (caja_mateconf_client,
- view->details->lockdown_notification_id);
+ g_signal_handlers_disconnect_by_func (mate_lockdown_preferences,
+ schedule_update_menus, view);
unschedule_pop_up_location_context_menu (view);
if (view->details->location_popup_event != NULL) {
@@ -8960,7 +8943,7 @@ real_update_menus (FMDirectoryView *view)
real_update_paste_menu (view, selection, selection_count);
- disable_command_line = mateconf_client_get_bool (caja_mateconf_client, CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE, NULL);
+ disable_command_line = g_settings_get_boolean (mate_lockdown_preferences, CAJA_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 && !disable_command_line);