diff options
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r-- | shell/e-shell-view.c | 79 |
1 files changed, 21 insertions, 58 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 414b9ddefc..ddf31747af 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1128,124 +1128,87 @@ e_shell_view_get_current_uri (EShellView *shell_view) /** * e_shell_view_save_settings: * @shell_view: - * @gconf_client: * @prefix: * - * Save settings for @shell_view at the specified GConf @prefix through - * @gconf_client. + * Save settings for @shell_view at the specified gnome config @prefix * * Return value: TRUE if successful, FALSE if not. **/ gboolean e_shell_view_save_settings (EShellView *shell_view, - GConfClient *gconf_client, const char *prefix) { EShellViewPrivate *priv; - GConfError *err = NULL; const char *uri; - char *path; g_return_val_if_fail (shell_view != NULL, FALSE); g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - g_return_val_if_fail (gconf_client != NULL, FALSE); - g_return_val_if_fail (GCONF_IS_CLIENT (gconf_client), FALSE); g_return_val_if_fail (prefix != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (prefix), FALSE); priv = shell_view->priv; -#define SET(type, key, value) \ - path = g_strconcat (prefix, "/", (key), NULL); \ - gconf_client_set_##type (gconf_client, path, (value), &err); \ - g_free (path); \ - if (err != NULL) { \ - gconf_error_destroy (err); \ - return FALSE; \ - } + gnome_config_push_prefix (prefix); - SET (int, "FolderBarMode", e_shell_view_get_folder_bar_mode (shell_view)) - SET (int, "ShortcutBarMode", e_shell_view_get_shortcut_bar_mode (shell_view)); - SET (int, "HPanedPosition", e_paned_get_position (E_PANED (priv->hpaned))); - SET (int, "ViewHPanedPosition", e_paned_get_position (E_PANED (priv->view_hpaned))); + gnome_config_set_int ("FolderBarMode", e_shell_view_get_folder_bar_mode (shell_view)); + gnome_config_set_int ("ShortcutBarMode", e_shell_view_get_shortcut_bar_mode (shell_view)); + gnome_config_set_int ("HPanedPosition", e_paned_get_position (E_PANED (priv->hpaned))); + gnome_config_set_int ("ViewHPanedPosition", e_paned_get_position (E_PANED (priv->view_hpaned))); uri = e_shell_view_get_current_uri (shell_view); - if (uri != NULL) { - SET (string, "DisplayedURI", uri); - } else { - path = g_strconcat (prefix, "/", "DisplayedURI", NULL); - gconf_client_unset (gconf_client, path, &err); - g_free (path); - - if (err != NULL) { - gconf_error_destroy (err); - return FALSE; - } - } - -#undef SET + if (uri != NULL) + gnome_config_set_string ("DisplayedURI", uri); + else + gnome_config_clean_section ("DisplayedURI"); + gnome_config_pop_prefix (); + return TRUE; } /** * e_shell_view_load_settings: * @shell_view: - * @gconf_client: * @prefix: * - * Load settings for @shell_view at the specified GConf @prefix through - * @gconf_client. + * Load settings for @shell_view at the specified gnome config @prefix * * Return value: **/ gboolean e_shell_view_load_settings (EShellView *shell_view, - GConfClient *gconf_client, const char *prefix) { EShellViewPrivate *priv; - GConfError *err = NULL; int val; char *stringval; char *path; g_return_val_if_fail (shell_view != NULL, FALSE); g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - g_return_val_if_fail (gconf_client != NULL, FALSE); - g_return_val_if_fail (GCONF_IS_CLIENT (gconf_client), FALSE); g_return_val_if_fail (prefix != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (prefix), FALSE); priv = shell_view->priv; -#define GET(type, key, value) \ - path = g_strconcat (prefix, "/", (key), NULL); \ - (value) = gconf_client_get_##type (gconf_client, path, &err); \ - g_free (path); \ - if (err != NULL) { \ - gconf_error_destroy (err); \ - return FALSE; \ - } + gnome_config_push_prefix (prefix); - GET (int, "FolderBarMode", val); + val = gnome_config_get_int ("FolderBarMode"); e_shell_view_set_folder_bar_mode (shell_view, val); - GET (int, "ShortcutBarMode", val); + val = gnome_config_get_int ("ShortcutBarMode"); e_shell_view_set_shortcut_bar_mode (shell_view, val); - GET (int, "HPanedPosition", val); + val = gnome_config_get_int ("HPanedPosition"); e_paned_set_position (E_PANED (priv->hpaned), val); - GET (int, "ViewHPanedPosition", val); + val = gnome_config_get_int ("ViewHPanedPosition"); e_paned_set_position (E_PANED (priv->view_hpaned), val); - GET (string, "DisplayedURI", stringval); + stringval = gnome_config_get_string ("DisplayedURI"); e_shell_view_display_uri (shell_view, stringval); g_free (stringval); -#undef GET - + gnome_config_pop_prefix (); + return TRUE; } |