diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/e-shell-migrate.c | 29 | ||||
-rw-r--r-- | shell/e-shell-window-private.c | 58 | ||||
-rw-r--r-- | shell/e-shell.c | 30 | ||||
-rw-r--r-- | shell/main.c | 68 |
4 files changed, 77 insertions, 108 deletions
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index dd75a40b82..1931011516 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -38,9 +38,6 @@ #include "es-event.h" -#define GCONF_VERSION_KEY "/apps/evolution/version" -#define GCONF_LAST_VERSION_KEY "/apps/evolution/last_version" - /******************** Begin XDG Base Directory Migration ********************/ /* These are the known EShellBackend names as of Evolution 3.0 */ static const gchar *shell_backend_names[] = @@ -735,23 +732,23 @@ shell_migrate_get_version (EShell *shell, gint *minor, gint *micro) { - GConfClient *client; - const gchar *key; + GSettings *settings; gchar *string; *major = 0; *minor = 0; *micro = 0; - key = GCONF_VERSION_KEY; - client = e_shell_get_gconf_client (shell); - string = gconf_client_get_string (client, key, NULL); + settings = g_settings_new ("org.gnome.evolution"); + string = g_settings_get_string (settings, "version"); if (string != NULL) { /* Since 1.4.0 we've kept the version key in GConf. */ sscanf (string, "%d.%d.%d", major, minor, micro); g_free (string); } + + g_object_unref (settings); } static void @@ -902,6 +899,7 @@ gboolean e_shell_migrate_attempt (EShell *shell) { ESEvent *ese; + GSettings *settings; GConfClient *client; const gchar *key; gint major, minor, micro; @@ -912,7 +910,7 @@ e_shell_migrate_attempt (EShell *shell) g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - client = e_shell_get_gconf_client (shell); + settings = g_settings_new ("org.gnome.evolution"); if (sscanf (BASE_VERSION, "%d.%d", &curr_major, &curr_minor) != 2) { g_warning ("Could not parse BASE_VERSION (%s)", BASE_VERSION); @@ -938,22 +936,23 @@ e_shell_migrate_attempt (EShell *shell) /* The 2.32.x (except of 2.32.2) lefts duplicate On This Computer/Personal sources, * thus clean the mess up */ + client = gconf_client_get_default (); merge_duplicate_local_sources (client, "/apps/evolution/addressbook/sources"); merge_duplicate_local_sources (client, "/apps/evolution/calendar/sources"); merge_duplicate_local_sources (client, "/apps/evolution/tasks/sources"); merge_duplicate_local_sources (client, "/apps/evolution/memos/sources"); + g_object_unref (client); /* Record a successful migration. */ string = g_strdup_printf ( "%d.%d.%d", curr_major, curr_minor, curr_micro); - gconf_client_set_string (client, GCONF_VERSION_KEY, string, NULL); + g_settings_set_string (settings, "version", string); g_free (string); migrated = TRUE; - key = GCONF_LAST_VERSION_KEY; - /* Try to retrieve the last migrated version from GConf. */ - string = gconf_client_get_string (client, key, NULL); + /* Try to retrieve the last migrated version from GSettings. */ + string = g_settings_get_string (settings, "last-upgraded-version"); if (migrated || string == NULL || sscanf (string, "%d.%d.%d", &last_major, &last_minor, &last_micro) != 3) { last_major = major; @@ -964,9 +963,11 @@ e_shell_migrate_attempt (EShell *shell) string = g_strdup_printf ( "%d.%d.%d", last_major, last_minor, last_micro); - gconf_client_set_string (client, key, string, NULL); + g_settings_set_string (settings, "last-upgraded-version", string); g_free (string); + g_object_unref (settings); + /** @Event: Shell attempted upgrade * @Id: upgrade.done * @Target: ESMenuTargetState diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index 2b86bb1ec3..cfee37ddbf 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -30,18 +30,13 @@ shell_window_save_switcher_style_cb (GtkRadioAction *action, GtkRadioAction *current, 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,32 +57,23 @@ 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 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 +252,6 @@ e_shell_window_private_constructed (EShellWindow *shell_window) { EShellWindowPrivate *priv = shell_window->priv; EShell *shell; - GConfBridge *bridge; GtkAction *action; GtkAccelGroup *accel_group; GtkUIManager *ui_manager; @@ -421,37 +406,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 +444,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 +456,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 diff --git a/shell/e-shell.c b/shell/e-shell.c index a9c2fdc22f..740bec8306 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -46,10 +46,6 @@ #include "e-shell-window.h" #include "e-shell-utils.h" -#define E_SHELL_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_SHELL, EShellPrivate)) - struct _EShellPrivate { GQueue alerts; EShellSettings *settings; @@ -697,7 +693,13 @@ shell_dispose (GObject *object) EShellPrivate *priv; EAlert *alert; - priv = E_SHELL_GET_PRIVATE (object); + priv = E_SHELL (object)->priv; + + while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) { + g_signal_handlers_disconnect_by_func ( + alert, shell_alert_response_cb, object); + g_object_unref (alert); + } while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) { g_signal_handlers_disconnect_by_func ( @@ -745,7 +747,7 @@ shell_finalize (GObject *object) { EShellPrivate *priv; - priv = E_SHELL_GET_PRIVATE (object); + priv = E_SHELL (object)->priv; g_hash_table_destroy (priv->backends_by_name); g_hash_table_destroy (priv->backends_by_scheme); @@ -1160,7 +1162,8 @@ e_shell_init (EShell *shell) GtkIconTheme *icon_theme; EggSMClient *sm_client; - shell->priv = E_SHELL_GET_PRIVATE (shell); + shell->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + shell, E_TYPE_SHELL, EShellPrivate); backends_by_name = g_hash_table_new (g_str_hash, g_str_equal); backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal); @@ -1427,18 +1430,13 @@ e_shell_create_shell_window (EShell *shell, /* EShellWindow initializes its active view from a GConf key, * so set the key ahead of time to control the intial view. */ if (view_name != NULL) { - GConfClient *client; + GSettings *settings; const gchar *key; - GError *error = NULL; - client = e_shell_get_gconf_client (shell); - key = "/apps/evolution/shell/view_defaults/component_id"; - gconf_client_set_string (client, key, view_name, &error); + settings = g_settings_new ("org.gnome.evolution.shell"); + g_settings_set_string (settings, "default-component-id", view_name); - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + g_object_unref (settings); } shell_window = e_shell_window_new ( diff --git a/shell/main.c b/shell/main.c index 6da0745391..c8ce8a014a 100644 --- a/shell/main.c +++ b/shell/main.c @@ -52,8 +52,6 @@ #endif #endif -#include <gconf/gconf-client.h> - #include <libxml/xmlmemory.h> #include <libxml/parser.h> #include <libxml/tree.h> @@ -90,9 +88,6 @@ #define APPLICATION_ID "org.gnome.Evolution" -#define SKIP_WARNING_DIALOG_KEY \ - "/apps/evolution/shell/skip_warning_dialog" - /* STABLE_VERSION is only defined for development versions. */ #ifdef STABLE_VERSION #define DEVELOPMENT 1 @@ -351,31 +346,28 @@ static EShell * create_default_shell (void) { EShell *shell; - GConfClient *client; + GSettings *settings; GApplicationFlags flags; - const gchar *key; gboolean online = TRUE; gboolean is_meego = FALSE; gboolean small_screen = FALSE; GError *error = NULL; - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.shell"); /* Requesting online or offline mode from the command-line * should be persistent, just like selecting it in the UI. */ - key = "/apps/evolution/shell/start_offline"; - if (start_online || force_online) { online = TRUE; - gconf_client_set_bool (client, key, FALSE, &error); + g_settings_set_boolean (settings, "start-offline", FALSE); } else if (start_offline) { online = FALSE; - gconf_client_set_bool (client, key, TRUE, &error); + g_settings_set_boolean (settings, "start-offline", TRUE); } else { gboolean value; - value = gconf_client_get_bool (client, key, &error); + value = g_settings_get_boolean (settings, "start-offline"); if (error == NULL) online = !value; } @@ -387,10 +379,8 @@ create_default_shell (void) /* Determine whether to run Evolution in "express" mode. */ - key = "/apps/evolution/shell/express_mode"; - if (!express_mode) - express_mode = gconf_client_get_bool (client, key, &error); + express_mode = g_settings_get_boolean (settings, "express-mode"); if (express_mode) e_shell_detect_meego (&is_meego, &small_screen); @@ -422,7 +412,7 @@ create_default_shell (void) if (force_online) e_shell_lock_network_available (shell); - g_object_unref (client); + g_object_unref (settings); return shell; } @@ -432,7 +422,7 @@ main (gint argc, gchar **argv) { EShell *shell; - GConfClient *client; + GSettings *settings; #ifdef DEVELOPMENT gboolean skip_warning_dialog; #endif @@ -592,22 +582,19 @@ main (gint argc, if (force_shutdown) shell_force_shutdown (); - client = gconf_client_get_default (); - if (disable_preview) { - const gchar *key; - - key = "/apps/evolution/mail/display/safe_list"; - gconf_client_set_bool (client, key, TRUE, NULL); - - key = "/apps/evolution/addressbook/display/show_preview"; - gconf_client_set_bool (client, key, FALSE, NULL); - - key = "/apps/evolution/calendar/display/show_memo_preview"; - gconf_client_set_bool (client, key, FALSE, NULL); - - key = "/apps/evolution/calendar/display/show_task_preview"; - gconf_client_set_bool (client, key, FALSE, NULL); + settings = g_settings_new ("org.gnome.evolution.mail"); + g_settings_set_boolean (settings, "safe-list", TRUE); + g_object_unref (settings); + + settings = g_settings_new ("org.gnome.evolution.addressbook"); + g_settings_set_boolean (settings, "show-preview", FALSE); + g_object_unref (settings); + + settings = g_settings_new ("org.gnome.evolution.calendar"); + g_settings_set_boolean (settings, "show-memo-preview", FALSE); + g_settings_set_boolean (settings, "show-task-preview", FALSE); + g_object_unref (settings); } #ifdef G_OS_UNIX @@ -639,16 +626,17 @@ main (gint argc, gtk_accel_map_load (e_get_accels_filename ()); #ifdef DEVELOPMENT - skip_warning_dialog = gconf_client_get_bool ( - client, SKIP_WARNING_DIALOG_KEY, NULL); + settings = g_settings_new ("org.gnome.evolution.shell"); + skip_warning_dialog = g_settings_get_boolean ( + settings, "skip-warning-dialog"); if (!skip_warning_dialog && !getenv ("EVOLVE_ME_HARDER")) - gconf_client_set_bool ( - client, SKIP_WARNING_DIALOG_KEY, - show_development_warning (), NULL); -#endif + g_settings_set_boolean ( + settings, "skip-warning-dialog", + show_development_warning ()); - g_object_unref (client); + g_object_unref (settings); +#endif shell = create_default_shell (); |