aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-view.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-06-29 15:37:55 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-06-29 15:37:55 +0800
commit3bedc38a9480532b83e4bfeb386f4bbd7b611b38 (patch)
tree1a33af67a5949913ca02be4c39d4f8acde34c436 /shell/e-shell-view.c
parent31e562c685d59c22fa1f241aa549bf8867042657 (diff)
downloadgsoc2013-evolution-3bedc38a9480532b83e4bfeb386f4bbd7b611b38.tar.gz
gsoc2013-evolution-3bedc38a9480532b83e4bfeb386f4bbd7b611b38.tar.zst
gsoc2013-evolution-3bedc38a9480532b83e4bfeb386f4bbd7b611b38.zip
Implement saving of configuration information. Now when you run
Evolution it will display the same folder as the last time, and will hide/show the shortcut/folder bars as the last time. This uses GConf so I also put a GConf check into configure.in. svn path=/trunk/; revision=3787
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r--shell/e-shell-view.c114
1 files changed, 114 insertions, 0 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index e3b47c3d25..56ddd12b87 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -467,6 +467,9 @@ get_storage_set_path_from_uri (const char *uri)
{
const char *colon;
+ if (uri == NULL)
+ return NULL;
+
if (g_path_is_absolute (uri))
return NULL;
@@ -981,4 +984,115 @@ 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.
+ *
+ * Return value: TRUE if successful, FALSE if not.
+ **/
+gboolean
+e_shell_view_save_settings (EShellView *shell_view,
+ GConfClient *gconf_client,
+ const char *prefix)
+{
+ 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);
+
+#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; \
+ }
+
+ SET (int, "FolderBarMode", e_shell_view_get_folder_bar_mode (shell_view))
+ SET (int, "ShortcutBarMode", e_shell_view_get_shortcut_bar_mode (shell_view));
+
+ 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
+
+ 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.
+ *
+ * Return value:
+ **/
+gboolean
+e_shell_view_load_settings (EShellView *shell_view,
+ GConfClient *gconf_client,
+ const char *prefix)
+{
+ gboolean val;
+ GConfError *err = NULL;
+ 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);
+
+#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; \
+ }
+
+ GET (int, "FolderBarMode", val);
+ e_shell_view_set_folder_bar_mode (shell_view, val);
+
+ GET (int, "ShortcutBarMode", val);
+ e_shell_view_set_shortcut_bar_mode (shell_view, val);
+
+ GET (string, "DisplayedURI", stringval);
+ e_shell_view_display_uri (shell_view, stringval);
+ g_free (stringval);
+
+#undef GET
+
+ return TRUE;
+}
+
+
E_MAKE_TYPE (e_shell_view, "EShellView", EShellView, class_init, init, PARENT_TYPE)