diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-13 22:53:51 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-13 22:53:51 +0800 |
commit | d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9 (patch) | |
tree | 57244f41cfcd1cd6ded0348501ce465ebfba9d2d /shell/e-shell-window-private.c | |
parent | 805d8c25ac6c8f58c8e17f3b89fa50f17cfdf27b (diff) | |
download | gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.gz gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.bz2 gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.lz gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.xz gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.zst gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.zip |
Migrate most of the shell code to GSettings
Diffstat (limited to 'shell/e-shell-window-private.c')
-rw-r--r-- | shell/e-shell-window-private.c | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index 2b86bb1ec3..2b3d159ada 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -31,17 +31,14 @@ shell_window_save_switcher_style_cb (GtkRadioAction *action, EShellWindow *shell_window) { EShell *shell; - GConfClient *client; + GSettings *settings; GtkToolbarStyle style; - const gchar *key; const gchar *string; - GError *error = NULL; shell = e_shell_window_get_shell (shell_window); - client = e_shell_get_gconf_client (shell); + settings = g_settings_new ("org.gnome.evolution.shell"); style = gtk_radio_action_get_current_value (action); - key = "/apps/evolution/shell/view_defaults/buttons_style"; switch (style) { case GTK_TOOLBAR_ICONS: @@ -62,10 +59,8 @@ shell_window_save_switcher_style_cb (GtkRadioAction *action, break; } - if (!gconf_client_set_string (client, key, string, &error)) { - g_warning ("%s", error->message); - g_error_free (error); - } + g_settings_set_string (settings, "buttons-style", string); + g_object_unref (settings); } static void @@ -73,21 +68,16 @@ shell_window_init_switcher_style (EShellWindow *shell_window) { EShell *shell; GtkAction *action; - GConfClient *client; + GSettings *settings; GtkToolbarStyle style; - const gchar *key; gchar *string; - GError *error = NULL; - - /* XXX GConfBridge doesn't let you convert between numeric properties - * and string keys, so we have to create the binding manually. */ shell = e_shell_window_get_shell (shell_window); - client = e_shell_get_gconf_client (shell); + settings = g_settings_new ("org.gnome.evolution.shell"); action = ACTION (SWITCHER_STYLE_ICONS); - key = "/apps/evolution/shell/view_defaults/buttons_style"; - string = gconf_client_get_string (client, key, &error); + string = g_settings_get_string (settings, "buttons-style"); + g_object_unref (settings); if (string != NULL) { if (strcmp (string, "icons") == 0) @@ -266,7 +256,7 @@ e_shell_window_private_constructed (EShellWindow *shell_window) { EShellWindowPrivate *priv = shell_window->priv; EShell *shell; - GConfBridge *bridge; + GSettings *settings; GtkAction *action; GtkAccelGroup *accel_group; GtkUIManager *ui_manager; @@ -421,37 +411,31 @@ e_shell_window_private_constructed (EShellWindow *shell_window) action, "sensitive", G_BINDING_SYNC_CREATE); - /* Bind GObject properties to GConf keys. */ + /* Bind GObject properties to GSettings keys. */ - bridge = gconf_bridge_get (); + settings = g_settings_new ("org.gnome.evolution.shell"); object = G_OBJECT (shell_window); - key = "/apps/evolution/shell/view_defaults/component_id"; - gconf_bridge_bind_property (bridge, key, object, "active-view"); + g_settings_bind (settings, "default-component-id", object, "active-view", G_SETTINGS_BIND_DEFAULT); object = G_OBJECT (priv->content_pane); - key = "/apps/evolution/shell/view_defaults/folder_bar/width"; - gconf_bridge_bind_property_delayed (bridge, key, object, "position"); + g_settings_bind (settings, "folder-bar-width", object, "position", G_SETTINGS_BIND_DEFAULT); object = G_OBJECT (shell_window); - key = "/apps/evolution/shell/view_defaults/sidebar_visible"; - gconf_bridge_bind_property (bridge, key, object, "sidebar-visible"); + g_settings_bind (settings, "sidebar-visible", object, "sidebar-visible", G_SETTINGS_BIND_DEFAULT); object = G_OBJECT (shell_window); - key = "/apps/evolution/shell/view_defaults/statusbar_visible"; - gconf_bridge_bind_property (bridge, key, object, "taskbar-visible"); + g_settings_bind (settings, "statusbar-visible", object, "taskbar-visible", G_SETTINGS_BIND_DEFAULT); if (e_shell_get_express_mode (shell)) { e_shell_window_set_switcher_visible (shell_window, FALSE); } else { object = G_OBJECT (shell_window); - key = "/apps/evolution/shell/view_defaults/buttons_visible"; - gconf_bridge_bind_property (bridge, key, object, "switcher-visible"); + g_settings_bind (settings, "buttons-visible", object, "switcher-visible", G_SETTINGS_BIND_DEFAULT); } object = G_OBJECT (shell_window); - key = "/apps/evolution/shell/view_defaults/toolbar_visible"; - gconf_bridge_bind_property (bridge, key, object, "toolbar-visible"); + g_settings_bind (settings, "toolbar-visible", object, "toolbar-visible", G_SETTINGS_BIND_DEFAULT); /* Configure the initial size and position of the window by way * of either a user-supplied geometry string or the last recorded @@ -465,8 +449,9 @@ e_shell_window_private_constructed (EShellWindow *shell_window) g_free (priv->geometry); priv->geometry = NULL; } else { + /* FIXME: how to bind this */ key = "/apps/evolution/shell/view_defaults/window"; - gconf_bridge_bind_window (bridge, key, window, TRUE, TRUE); + gconf_bridge_bind_window (gconf_bridge_get (), key, window, TRUE, TRUE); } shell_window_init_switcher_style (shell_window); @@ -476,6 +461,8 @@ e_shell_window_private_constructed (EShellWindow *shell_window) e_plugin_ui_enable_manager (ui_manager, id); gtk_application_add_window (GTK_APPLICATION (shell), window); + + g_object_unref (settings); } void |