diff options
author | Stefano Karapetsas <[email protected]> | 2012-09-05 15:00:29 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-09-05 15:00:29 +0200 |
commit | ab3a27b67b830897c49ecf395ee5e63e4dfdfc26 (patch) | |
tree | f07a381b7a80426ef607410c8a2bfdf4126348dc /src | |
parent | b10e30db918ff889bb06540e129b3f31b2815da2 (diff) | |
download | caja-ab3a27b67b830897c49ecf395ee5e63e4dfdfc26.tar.bz2 caja-ab3a27b67b830897c49ecf395ee5e63e4dfdfc26.tar.xz |
convert always-use-browser to gsettings
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-application.c | 6 | ||||
-rw-r--r-- | src/caja-bookmarks-window.c | 2 | ||||
-rw-r--r-- | src/caja-connect-server-dialog-nonmain.c | 2 | ||||
-rw-r--r-- | src/caja-file-management-properties.c | 37 | ||||
-rw-r--r-- | src/caja-navigation-window-menus.c | 2 | ||||
-rw-r--r-- | src/caja-navigation-window.c | 13 | ||||
-rw-r--r-- | src/caja-window-manage-views.c | 2 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 10 |
8 files changed, 55 insertions, 19 deletions
diff --git a/src/caja-application.c b/src/caja-application.c index 54023ec9..9eb18d57 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -785,7 +785,7 @@ open_window (CajaApplication *application, CajaWindow *window; if (browser_window || - eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) + g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { window = caja_application_create_navigation_window (application, startup_id, @@ -1713,8 +1713,8 @@ autorun_show_window (GMount *mount, gpointer user_data) location = g_mount_get_root (mount); - /* Ther should probably be an easier way to do this */ - if (eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) + /* There should probably be an easier way to do this */ + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { CajaWindow *window; window = caja_application_create_navigation_window (application, diff --git a/src/caja-bookmarks-window.c b/src/caja-bookmarks-window.c index d4089b8a..1a6659c6 100644 --- a/src/caja-bookmarks-window.c +++ b/src/caja-bookmarks-window.c @@ -599,7 +599,7 @@ open_selected_bookmark (gpointer user_data, GdkScreen *screen) } else /* window that opened bookmarks window has been closed */ { - if (parent_is_browser_window || eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) + if (parent_is_browser_window || g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { window = caja_application_create_navigation_window (application, NULL, diff --git a/src/caja-connect-server-dialog-nonmain.c b/src/caja-connect-server-dialog-nonmain.c index 99bde7ba..0f196ca0 100644 --- a/src/caja-connect-server-dialog-nonmain.c +++ b/src/caja-connect-server-dialog-nonmain.c @@ -38,7 +38,7 @@ caja_connect_server_dialog_present_uri (CajaApplication *application, { CajaWindow *window; - if (eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { window = caja_application_create_navigation_window (application, NULL, diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c index fca7a149..9293f714 100644 --- a/src/caja-file-management-properties.c +++ b/src/caja-file-management-properties.c @@ -716,6 +716,37 @@ bind_builder_bool (GtkBuilder *builder, } static gboolean +inverted_get_mapping (GValue *value, + GVariant *variant, + gpointer user_data) +{ + g_value_set_boolean (value, !g_variant_get_boolean (variant)); + return TRUE; +} + +static GVariant * +inverted_set_mapping (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) +{ + return g_variant_new_boolean (!g_value_get_boolean (value)); +} + +static void +bind_builder_bool_inverted (GtkBuilder *builder, + GSettings *settings, + const char *widget_name, + const char *prefs) +{ + g_settings_bind_with_mapping (settings, prefs, + gtk_builder_get_object (builder, widget_name), + "active", G_SETTINGS_BIND_DEFAULT, + inverted_get_mapping, + inverted_set_mapping, + NULL, NULL); +} + +static gboolean enum_get_mapping (GValue *value, GVariant *variant, gpointer user_data) @@ -879,9 +910,9 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi eel_preferences_builder_connect_bool (builder, CAJA_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET, CAJA_PREFERENCES_SORT_DIRECTORIES_FIRST); - eel_preferences_builder_connect_inverted_bool (builder, - CAJA_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET, - CAJA_PREFERENCES_ALWAYS_USE_BROWSER); + bind_builder_bool_inverted (builder, caja_preferences, + CAJA_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET, + CAJA_PREFERENCES_ALWAYS_USE_BROWSER); bind_builder_bool (builder, caja_media_preferences, CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN, diff --git a/src/caja-navigation-window-menus.c b/src/caja-navigation-window-menus.c index 30c2e570..033bfaa0 100644 --- a/src/caja-navigation-window-menus.c +++ b/src/caja-navigation-window-menus.c @@ -345,7 +345,7 @@ caja_navigation_window_update_spatial_menu_item (CajaNavigationWindow *window) action = gtk_action_group_get_action (window->details->navigation_action_group, CAJA_ACTION_FOLDER_WINDOW); gtk_action_set_visible (action, - !eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)); + !g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)); } static void diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c index 827ba154..fa64c1bc 100644 --- a/src/caja-navigation-window.c +++ b/src/caja-navigation-window.c @@ -199,9 +199,10 @@ caja_navigation_window_init (CajaNavigationWindow *window) always_use_location_entry_changed, window, G_OBJECT (window)); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ALWAYS_USE_BROWSER, - always_use_browser_changed, - window, G_OBJECT (window)); + g_signal_connect_swapped (caja_preferences, + "changed::" CAJA_PREFERENCES_ALWAYS_USE_BROWSER, + G_CALLBACK(always_use_browser_changed), + window); } static void @@ -626,6 +627,10 @@ caja_navigation_window_finalize (GObject *object) caja_navigation_window_remove_go_menu_callback (window); + g_signal_handlers_disconnect_by_func (caja_preferences, + always_use_browser_changed, + window); + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -757,7 +762,7 @@ real_sync_title (CajaWindow *window, /* if spatial mode is default, we keep "File Browser" in the window title * to recognize browser windows. Otherwise, we default to the directory name. */ - if (!eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) + if (!g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { full_title = g_strdup_printf (_("%s - File Browser"), slot->title); window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH); diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c index f9f6600e..980c780c 100644 --- a/src/caja-window-manage-views.c +++ b/src/caja-window-manage-views.c @@ -551,7 +551,7 @@ caja_window_slot_open_location_full (CajaWindowSlot *slot, switch (mode) { case CAJA_WINDOW_OPEN_ACCORDING_TO_MODE : - if (eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { target_window = window; if (CAJA_IS_SPATIAL_WINDOW (window)) diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index db03d79d..1ee8e12f 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -8466,7 +8466,7 @@ real_update_location_menu (FMDirectoryView *view) show_open_in_new_tab = FALSE; if (caja_window_info_get_window_type (view->details->window) == CAJA_WINDOW_NAVIGATION) { - if (eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { label = _("Open in New _Window"); } else { label = _("Browse in New _Window"); @@ -8489,7 +8489,7 @@ real_update_location_menu (FMDirectoryView *view) gtk_action_set_visible (action, show_open_in_new_tab); if (show_open_in_new_tab) { - if (eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { label = _("Open in New _Tab"); } else { label = _("Browse in New _Tab"); @@ -8772,10 +8772,10 @@ real_update_menus (FMDirectoryView *view) show_open_alternate = file_list_all_are_folders (selection) && selection_count > 0 && !(caja_window_info_get_window_type (view->details->window) == CAJA_WINDOW_DESKTOP && - eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)); + g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)); show_open_folder_window = FALSE; if (caja_window_info_get_window_type (view->details->window) == CAJA_WINDOW_NAVIGATION) { - if (eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { if (selection_count == 0 || selection_count == 1) { label_with_underscore = g_strdup (_("Open in New _Window")); } else { @@ -8814,7 +8814,7 @@ real_update_menus (FMDirectoryView *view) /* Open in New Tab action */ if (caja_window_info_get_window_type (view->details->window) == CAJA_WINDOW_NAVIGATION) { - if (eel_preferences_get_boolean (CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { if (selection_count == 0 || selection_count == 1) { label_with_underscore = g_strdup (_("Open in New _Tab")); } else { |