diff options
-rw-r--r-- | libcaja-private/caja-global-preferences.c | 36 | ||||
-rw-r--r-- | libcaja-private/caja-global-preferences.h | 21 | ||||
-rw-r--r-- | src/caja-application.c | 8 | ||||
-rw-r--r-- | src/caja-navigation-window-pane.c | 16 | ||||
-rw-r--r-- | src/caja-navigation-window.c | 102 |
5 files changed, 60 insertions, 123 deletions
diff --git a/libcaja-private/caja-global-preferences.c b/libcaja-private/caja-global-preferences.c index 69ddefa3..ce9336b7 100644 --- a/libcaja-private/caja-global-preferences.c +++ b/libcaja-private/caja-global-preferences.c @@ -268,41 +268,6 @@ static const PreferenceDefault preference_defaults[] = NULL }, { - CAJA_PREFERENCES_START_WITH_TOOLBAR, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_START_WITH_LOCATION_BAR, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, - { - CAJA_PREFERENCES_START_WITH_STATUS_BAR, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_START_WITH_SIDEBAR, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY, - PREFERENCE_STRING, - "" - }, - { - CAJA_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, - { CAJA_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES, PREFERENCE_BOOLEAN, GINT_TO_POINTER (TRUE) @@ -727,6 +692,7 @@ caja_global_preferences_init (void) caja_preferences = g_settings_new("org.mate.caja.preferences"); caja_media_preferences = g_settings_new("org.mate.media-handling"); + caja_window_state = g_settings_new("org.mate.caja.window-state"); /* Set up storage for values accessed in this file */ eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT, diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h index 6d149747..99a1edc8 100644 --- a/libcaja-private/caja-global-preferences.h +++ b/libcaja-private/caja-global-preferences.h @@ -44,9 +44,6 @@ G_BEGIN_DECLS #define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR "side-pane-background-color" #define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_URI "side-pane-background-uri" - /* How wide the sidebar is (or how wide it will be when expanded) */ -#define CAJA_PREFERENCES_SIDEBAR_WIDTH "sidebar-width" - /* Automount options */ #define CAJA_PREFERENCES_MEDIA_AUTOMOUNT "media-automount" #define CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN "media-automount-open" @@ -105,16 +102,17 @@ G_BEGIN_DECLS /* Spatial or browser mode */ #define CAJA_PREFERENCES_ALWAYS_USE_BROWSER "always-use-browser" #define CAJA_PREFERENCES_NEW_TAB_POSITION "tabs-open-position" +#define CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY "always-use-location-entry" /* Which views should be displayed for new windows */ -#define CAJA_PREFERENCES_START_WITH_LOCATION_BAR "preferences/start_with_location_bar" -#define CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY "preferences/always_use_location_entry" -#define CAJA_PREFERENCES_START_WITH_STATUS_BAR "preferences/start_with_status_bar" -#define CAJA_PREFERENCES_START_WITH_SIDEBAR "preferences/start_with_sidebar" -#define CAJA_PREFERENCES_START_WITH_TOOLBAR "preferences/start_with_toolbar" -#define CAJA_PREFERENCES_SIDE_PANE_VIEW "preferences/side_pane_view" -#define CAJA_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY "preferences/navigation_window_saved_geometry" -#define CAJA_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED "preferences/navigation_window_saved_maximized" +#define CAJA_WINDOW_STATE_START_WITH_LOCATION_BAR "start-with-location-bar" +#define CAJA_WINDOW_STATE_START_WITH_STATUS_BAR "start-with-status-bar" +#define CAJA_WINDOW_STATE_START_WITH_SIDEBAR "start-with-sidebar" +#define CAJA_WINDOW_STATE_START_WITH_TOOLBAR "start-with-toolbar" +#define CAJA_WINDOW_STATE_SIDE_PANE_VIEW "side-pane-view" +#define CAJA_WINDOW_STATE_GEOMETRY "geometry" +#define CAJA_WINDOW_STATE_MAXIMIZED "maximized" +#define CAJA_WINDOW_STATE_SIDEBAR_WIDTH "sidebar-width" /* Sorting order */ #define CAJA_PREFERENCES_SORT_DIRECTORIES_FIRST "preferences/sort_directories_first" @@ -233,6 +231,7 @@ char *caja_global_preferences_get_default_folder_viewer_preference_as_iid (void) GSettings *caja_preferences; GSettings *caja_media_preferences; +GSettings *caja_window_state; G_END_DECLS diff --git a/src/caja-application.c b/src/caja-application.c index 9eb18d57..3c1c3f07 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -1556,8 +1556,8 @@ caja_application_create_navigation_window (CajaApplication *application, window = create_window (application, CAJA_TYPE_NAVIGATION_WINDOW, startup_id, screen); - maximized = eel_preferences_get_boolean - (CAJA_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED); + maximized = g_settings_get_boolean (caja_window_state, + CAJA_WINDOW_STATE_MAXIMIZED); if (maximized) { gtk_window_maximize (GTK_WINDOW (window)); @@ -1567,8 +1567,8 @@ caja_application_create_navigation_window (CajaApplication *application, gtk_window_unmaximize (GTK_WINDOW (window)); } - geometry_string = eel_preferences_get - (CAJA_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY); + geometry_string = g_settings_get_string (caja_window_state, + CAJA_WINDOW_STATE_GEOMETRY); if (geometry_string != NULL && geometry_string[0] != 0) { diff --git a/src/caja-navigation-window-pane.c b/src/caja-navigation-window-pane.c index 9b69cba8..627fcc06 100644 --- a/src/caja-navigation-window-pane.c +++ b/src/caja-navigation-window-pane.c @@ -219,7 +219,7 @@ path_bar_location_changed_callback (GtkWidget *widget, static gboolean location_button_should_be_active (CajaNavigationWindowPane *pane) { - return eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY); + return g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY); } static void @@ -229,7 +229,7 @@ location_button_toggled_cb (GtkToggleButton *toggle, gboolean is_active; is_active = gtk_toggle_button_get_active (toggle); - eel_preferences_set_boolean (CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, is_active); + g_settings_set_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, is_active); if (is_active) { caja_navigation_bar_activate (CAJA_NAVIGATION_BAR (pane->navigation_bar)); @@ -653,7 +653,7 @@ caja_navigation_window_pane_hide_temporary_bars (CajaNavigationWindowPane *pane) } else { - if (!eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) + if (!g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) { caja_navigation_window_pane_set_bar_mode (pane, CAJA_BAR_PATH); } @@ -667,7 +667,7 @@ caja_navigation_window_pane_hide_temporary_bars (CajaNavigationWindowPane *pane) { CajaNavigationWindow *window; - if (!eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) + if (!g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) { caja_navigation_window_pane_set_bar_mode (pane, CAJA_BAR_PATH); } @@ -910,9 +910,9 @@ caja_navigation_window_pane_hide_location_bar (CajaNavigationWindowPane *pane, g gtk_widget_hide(pane->location_bar); caja_navigation_window_update_show_hide_menu_items( CAJA_NAVIGATION_WINDOW (CAJA_WINDOW_PANE (pane)->window)); - if (save_preference && eel_preferences_key_is_writable(CAJA_PREFERENCES_START_WITH_LOCATION_BAR)) + if (save_preference) { - eel_preferences_set_boolean(CAJA_PREFERENCES_START_WITH_LOCATION_BAR, FALSE); + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_LOCATION_BAR, FALSE); } } @@ -921,9 +921,9 @@ caja_navigation_window_pane_show_location_bar (CajaNavigationWindowPane *pane, g { gtk_widget_show(pane->location_bar); caja_navigation_window_update_show_hide_menu_items(CAJA_NAVIGATION_WINDOW (CAJA_WINDOW_PANE (pane)->window)); - if (save_preference && eel_preferences_key_is_writable(CAJA_PREFERENCES_START_WITH_LOCATION_BAR)) + if (save_preference) { - eel_preferences_set_boolean(CAJA_PREFERENCES_START_WITH_LOCATION_BAR, TRUE); + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_LOCATION_BAR, TRUE); } } diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c index fa64c1bc..a3c2ae84 100644 --- a/src/caja-navigation-window.c +++ b/src/caja-navigation-window.c @@ -195,9 +195,10 @@ caja_navigation_window_init (CajaNavigationWindow *window) caja_navigation_window_allow_back (window, FALSE); caja_navigation_window_allow_forward (window, FALSE); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, - always_use_location_entry_changed, - window, G_OBJECT (window)); + g_signal_connect_swapped (caja_preferences, + "changed::" CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, + G_CALLBACK(always_use_location_entry_changed), + window); g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_ALWAYS_USE_BROWSER, @@ -214,7 +215,7 @@ always_use_location_entry_changed (gpointer callback_data) window = CAJA_NAVIGATION_WINDOW (callback_data); - use_entry = eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY); + use_entry = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY); for (walk = CAJA_WINDOW(window)->details->panes; walk; walk = walk->next) { @@ -382,12 +383,9 @@ side_pane_size_allocate_callback (GtkWidget *widget, if (allocation->width != window->details->side_pane_width) { window->details->side_pane_width = allocation->width; - if (g_settings_is_writable (caja_preferences, CAJA_PREFERENCES_SIDEBAR_WIDTH)) - { - g_settings_set_int (caja_preferences, - CAJA_PREFERENCES_SIDEBAR_WIDTH, - allocation->width <= 1 ? 0 : allocation->width); - } + g_settings_set_int (caja_window_state, + CAJA_WINDOW_STATE_SIDEBAR_WIDTH, + allocation->width <= 1 ? 0 : allocation->width); } } @@ -397,8 +395,8 @@ setup_side_pane_width (CajaNavigationWindow *window) g_return_if_fail (window->sidebar != NULL); window->details->side_pane_width = - g_settings_get_int (caja_preferences, - CAJA_PREFERENCES_SIDEBAR_WIDTH); + g_settings_get_int (caja_window_state, + CAJA_WINDOW_STATE_SIDEBAR_WIDTH); gtk_paned_set_position (GTK_PANED (window->details->content_paned), window->details->side_pane_width); @@ -441,10 +439,7 @@ side_pane_switch_page_callback (CajaSidePane *side_pane, set_current_side_panel (window, sidebar); id = caja_sidebar_get_sidebar_id (sidebar); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_SIDE_PANE_VIEW)) - { - eel_preferences_set (CAJA_PREFERENCES_SIDE_PANE_VIEW, id); - } + g_settings_set_string (caja_window_state, CAJA_WINDOW_STATE_SIDE_PANE_VIEW, id); } static void @@ -523,8 +518,8 @@ caja_navigation_window_state_event (GtkWidget *widget, { if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) { - eel_preferences_set_boolean (CAJA_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED, - event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED); + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_MAXIMIZED, + event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED); } if (GTK_WIDGET_CLASS (parent_class)->window_state_event != NULL) @@ -630,6 +625,9 @@ caja_navigation_window_finalize (GObject *object) g_signal_handlers_disconnect_by_func (caja_preferences, always_use_browser_changed, window); + g_signal_handlers_disconnect_by_func (caja_preferences, + always_use_location_entry_changed, + window); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -679,7 +677,7 @@ caja_navigation_window_add_sidebar_panel (CajaNavigationWindow *window, /* Show if default */ sidebar_id = caja_sidebar_get_sidebar_id (sidebar_panel); - default_id = eel_preferences_get (CAJA_PREFERENCES_SIDE_PANE_VIEW); + default_id = g_settings_get_string (caja_window_state, CAJA_WINDOW_STATE_SIDE_PANE_VIEW); if (sidebar_id && default_id && !strcmp (sidebar_id, default_id)) { caja_side_pane_show_panel (window->sidebar, @@ -956,11 +954,8 @@ caja_navigation_window_hide_status_bar (CajaNavigationWindow *window) gtk_widget_hide (CAJA_WINDOW (window)->details->statusbar); caja_navigation_window_update_show_hide_menu_items (window); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_START_WITH_STATUS_BAR) && - eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_STATUS_BAR)) - { - eel_preferences_set_boolean (CAJA_PREFERENCES_START_WITH_STATUS_BAR, FALSE); - } + + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_STATUS_BAR, FALSE); } void @@ -969,11 +964,8 @@ caja_navigation_window_show_status_bar (CajaNavigationWindow *window) gtk_widget_show (CAJA_WINDOW (window)->details->statusbar); caja_navigation_window_update_show_hide_menu_items (window); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_START_WITH_STATUS_BAR) && - !eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_STATUS_BAR)) - { - eel_preferences_set_boolean (CAJA_PREFERENCES_START_WITH_STATUS_BAR, TRUE); - } + + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_STATUS_BAR, TRUE); } gboolean @@ -993,11 +985,7 @@ caja_navigation_window_hide_toolbar (CajaNavigationWindow *window) { gtk_widget_hide (window->details->toolbar); caja_navigation_window_update_show_hide_menu_items (window); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_START_WITH_TOOLBAR) && - eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_TOOLBAR)) - { - eel_preferences_set_boolean (CAJA_PREFERENCES_START_WITH_TOOLBAR, FALSE); - } + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_TOOLBAR, FALSE); } void @@ -1005,11 +993,7 @@ caja_navigation_window_show_toolbar (CajaNavigationWindow *window) { gtk_widget_show (window->details->toolbar); caja_navigation_window_update_show_hide_menu_items (window); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_START_WITH_TOOLBAR) && - !eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_TOOLBAR)) - { - eel_preferences_set_boolean (CAJA_PREFERENCES_START_WITH_TOOLBAR, TRUE); - } + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_TOOLBAR, TRUE); } void @@ -1023,11 +1007,7 @@ caja_navigation_window_hide_sidebar (CajaNavigationWindow *window) caja_navigation_window_tear_down_sidebar (window); caja_navigation_window_update_show_hide_menu_items (window); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_START_WITH_SIDEBAR) && - eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_SIDEBAR)) - { - eel_preferences_set_boolean (CAJA_PREFERENCES_START_WITH_SIDEBAR, FALSE); - } + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_SIDEBAR, FALSE); } void @@ -1040,11 +1020,7 @@ caja_navigation_window_show_sidebar (CajaNavigationWindow *window) caja_navigation_window_set_up_sidebar (window); caja_navigation_window_update_show_hide_menu_items (window); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_START_WITH_SIDEBAR) && - !eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_SIDEBAR)) - { - eel_preferences_set_boolean (CAJA_PREFERENCES_START_WITH_SIDEBAR, TRUE); - } + g_settings_set_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_SIDEBAR, TRUE); } gboolean @@ -1108,7 +1084,7 @@ caja_navigation_window_show (GtkWidget *widget) * these can be controlled on a per-window basis from View menu items. */ - if (eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_TOOLBAR)) + if (g_settings_get_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_TOOLBAR)) { caja_navigation_window_show_toolbar (window); } @@ -1117,8 +1093,8 @@ caja_navigation_window_show (GtkWidget *widget) caja_navigation_window_hide_toolbar (window); } - show_location_bar = eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_LOCATION_BAR); - always_use_location_entry = eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY); + show_location_bar = g_settings_get_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_LOCATION_BAR); + always_use_location_entry = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY); for (walk = CAJA_WINDOW(window)->details->panes; walk; walk = walk->next) { CajaNavigationWindowPane *pane = walk->data; @@ -1141,7 +1117,7 @@ caja_navigation_window_show (GtkWidget *widget) } } - if (eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_SIDEBAR)) + if (g_settings_get_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_SIDEBAR)) { caja_navigation_window_show_sidebar (window); } @@ -1150,7 +1126,7 @@ caja_navigation_window_show (GtkWidget *widget) caja_navigation_window_hide_sidebar (window); } - if (eel_preferences_get_boolean (CAJA_PREFERENCES_START_WITH_STATUS_BAR)) + if (g_settings_get_boolean (caja_window_state, CAJA_WINDOW_STATE_START_WITH_STATUS_BAR)) { caja_navigation_window_show_status_bar (window); } @@ -1176,21 +1152,17 @@ caja_navigation_window_save_geometry (CajaNavigationWindow *window) is_maximized = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window))) & GDK_WINDOW_STATE_MAXIMIZED; - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY) && - !is_maximized) + if (!is_maximized) { - eel_preferences_set - (CAJA_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY, - geometry_string); + g_settings_set_string (caja_window_state, + CAJA_WINDOW_STATE_GEOMETRY, + geometry_string); } g_free (geometry_string); - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED)) - { - eel_preferences_set_boolean - (CAJA_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED, - is_maximized); - } + g_settings_set_boolean (caja_window_state, + CAJA_WINDOW_STATE_MAXIMIZED, + is_maximized); } } |