diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-11-23 09:48:44 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-11-23 09:48:44 +0800 |
commit | 9918361aef9ad1360a0ed3a240cc58d6cd9e30f8 (patch) | |
tree | 50bf24934b5ab3fefcc27913d1855a27c75e6d40 /shell | |
parent | fa1bb9a17e11cf12ce02d9b49bba2753f6020ea0 (diff) | |
parent | e64d6fe05c30c2cc1d7625a202afba3ba2da07cd (diff) | |
download | gsoc2013-evolution-9918361aef9ad1360a0ed3a240cc58d6cd9e30f8.tar gsoc2013-evolution-9918361aef9ad1360a0ed3a240cc58d6cd9e30f8.tar.gz gsoc2013-evolution-9918361aef9ad1360a0ed3a240cc58d6cd9e30f8.tar.bz2 gsoc2013-evolution-9918361aef9ad1360a0ed3a240cc58d6cd9e30f8.tar.lz gsoc2013-evolution-9918361aef9ad1360a0ed3a240cc58d6cd9e30f8.tar.xz gsoc2013-evolution-9918361aef9ad1360a0ed3a240cc58d6cd9e30f8.tar.zst gsoc2013-evolution-9918361aef9ad1360a0ed3a240cc58d6cd9e30f8.zip |
Merge branch 'wip/gsettings'
Diffstat (limited to 'shell')
-rw-r--r-- | shell/e-shell-backend.c | 11 | ||||
-rw-r--r-- | shell/e-shell-migrate.c | 30 | ||||
-rw-r--r-- | shell/e-shell-searchbar.c | 9 | ||||
-rw-r--r-- | shell/e-shell-settings.c | 229 | ||||
-rw-r--r-- | shell/e-shell-settings.h | 3 | ||||
-rw-r--r-- | shell/e-shell-sidebar.c | 17 | ||||
-rw-r--r-- | shell/e-shell-switcher.c | 19 | ||||
-rw-r--r-- | shell/e-shell-taskbar.c | 11 | ||||
-rw-r--r-- | shell/e-shell-view.c | 11 | ||||
-rw-r--r-- | shell/e-shell-window-private.c | 58 | ||||
-rw-r--r-- | shell/e-shell-window-private.h | 4 | ||||
-rw-r--r-- | shell/e-shell-window.c | 3 | ||||
-rw-r--r-- | shell/e-shell.c | 25 | ||||
-rw-r--r-- | shell/main.c | 68 |
14 files changed, 230 insertions, 268 deletions
diff --git a/shell/e-shell-backend.c b/shell/e-shell-backend.c index d8af58c6b3..e5700d4b2c 100644 --- a/shell/e-shell-backend.c +++ b/shell/e-shell-backend.c @@ -41,6 +41,10 @@ #include "e-shell.h" #include "e-shell-view.h" +#define E_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_BACKEND, EShellBackendPrivate)) + struct _EShellBackendPrivate { /* We keep a reference to corresponding EShellView subclass @@ -171,7 +175,7 @@ shell_backend_dispose (GObject *object) { EShellBackendPrivate *priv; - priv = E_SHELL_BACKEND (object)->priv; + priv = E_SHELL_BACKEND_GET_PRIVATE (object); if (priv->shell_view_class != NULL) { g_type_class_unref (priv->shell_view_class); @@ -187,7 +191,7 @@ shell_backend_finalize (GObject *object) { EShellBackendPrivate *priv; - priv = E_SHELL_BACKEND (object)->priv; + priv = E_SHELL_BACKEND_GET_PRIVATE (object); g_warn_if_fail (g_queue_is_empty (priv->activities)); g_queue_free (priv->activities); @@ -294,8 +298,7 @@ e_shell_backend_class_init (EShellBackendClass *class) static void e_shell_backend_init (EShellBackend *shell_backend) { - shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell_backend, E_TYPE_SHELL_BACKEND, EShellBackendPrivate); + shell_backend->priv = E_SHELL_BACKEND_GET_PRIVATE (shell_backend); shell_backend->priv->activities = g_queue_new (); } diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index dd75a40b82..b0fa40d146 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,8 +899,8 @@ gboolean e_shell_migrate_attempt (EShell *shell) { ESEvent *ese; + GSettings *settings; GConfClient *client; - const gchar *key; gint major, minor, micro; gint last_major, last_minor, last_micro; gint curr_major, curr_minor, curr_micro; @@ -912,7 +909,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 +935,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 +962,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-searchbar.c b/shell/e-shell-searchbar.c index 370d6b4f5e..ff3f06b403 100644 --- a/shell/e-shell-searchbar.c +++ b/shell/e-shell-searchbar.c @@ -39,6 +39,10 @@ #include "e-shell-window-actions.h" +#define E_SHELL_SEARCHBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_SEARCHBAR, EShellSearchbarPrivate)) + #define SEARCH_OPTION_ADVANCED (-1) /* Default "state key file" group: [Search Bar] */ @@ -629,7 +633,7 @@ shell_searchbar_dispose (GObject *object) { EShellSearchbarPrivate *priv; - priv = E_SHELL_SEARCHBAR (object)->priv; + priv = E_SHELL_SEARCHBAR_GET_PRIVATE (object); if (priv->shell_view != NULL) { g_object_remove_weak_pointer ( @@ -911,8 +915,7 @@ e_shell_searchbar_init (EShellSearchbar *searchbar) GtkLabel *label; GtkWidget *widget; - searchbar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - searchbar, E_TYPE_SHELL_SEARCHBAR, EShellSearchbarPrivate); + searchbar->priv = E_SHELL_SEARCHBAR_GET_PRIVATE (searchbar); gtk_box_set_spacing (GTK_BOX (searchbar), 24); diff --git a/shell/e-shell-settings.c b/shell/e-shell-settings.c index 5e5f3428fe..a46123f325 100644 --- a/shell/e-shell-settings.c +++ b/shell/e-shell-settings.c @@ -31,7 +31,9 @@ #include "e-shell-settings.h" -#include "e-util/gconf-bridge.h" +#define E_SHELL_SETTINGS_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_SETTINGS, EShellSettingsPrivate)) struct _EShellSettingsPrivate { GArray *value_array; @@ -44,130 +46,90 @@ static gpointer parent_class; static GParamSpec * shell_settings_pspec_for_key (const gchar *property_name, - const gchar *gconf_key) + const gchar *schema, + const gchar *key) { - GConfClient *client; - GConfEntry *entry; - GConfSchema *schema; - GConfValue *default_value; - GConfValueType value_type; + GSettings *settings; + GVariant *v; GParamSpec *pspec; const gchar *bad_type; - const gchar *schema_name; - GError *error = NULL; - client = gconf_client_get_default (); - - entry = gconf_client_get_entry (client, gconf_key, NULL, TRUE, &error); - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - return NULL; - } - - schema_name = gconf_entry_get_schema_name (entry); - g_return_val_if_fail (schema_name != NULL, NULL); - - schema = gconf_client_get_schema (client, schema_name, &error); - if (error != NULL) { - g_warning ("%s", error->message); - gconf_entry_unref (entry); - g_error_free (error); - return NULL; - } - - value_type = gconf_schema_get_type (schema); - default_value = gconf_schema_get_default_value (schema); - - /* If the schema does not specify a default value, make one up. */ - if (default_value == NULL) { - default_value = gconf_value_new (value_type); - - /* XXX This should NOT be necessary, but the GConfValue - * documentation claims it is. Bother. */ - switch (value_type) { - case GCONF_VALUE_STRING: - gconf_value_set_string (default_value, ""); - break; - - case GCONF_VALUE_INT: - gconf_value_set_int (default_value, 0); - break; - - case GCONF_VALUE_FLOAT: - gconf_value_set_float (default_value, 0.0); - break; - - case GCONF_VALUE_BOOL: - gconf_value_set_bool (default_value, FALSE); - break; - - default: - /* We'll fail in the next switch statement. */ - break; - } + settings = g_settings_new (schema); + + v = g_settings_get_value (settings, key); + + if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING)) { + pspec = g_param_spec_string ( + property_name, NULL, NULL, + g_variant_get_string (v, NULL), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_BYTE)) { + pspec = g_param_spec_int ( + property_name, NULL, NULL, + G_MININT, G_MAXINT, + g_variant_get_byte (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_INT16)) { + pspec = g_param_spec_int ( + property_name, NULL, NULL, + G_MININT, G_MAXINT, + g_variant_get_int16 (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT16)) { + pspec = g_param_spec_int ( + property_name, NULL, NULL, + G_MININT, G_MAXINT, + g_variant_get_uint16 (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_INT32)) { + pspec = g_param_spec_int ( + property_name, NULL, NULL, + G_MININT, G_MAXINT, + g_variant_get_int32 (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT32)) { + pspec = g_param_spec_int ( + property_name, NULL, NULL, + G_MININT, G_MAXINT, + g_variant_get_uint32 (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_INT64)) { + pspec = g_param_spec_int ( + property_name, NULL, NULL, + G_MININT, G_MAXINT, + g_variant_get_int64 (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT64)) { + pspec = g_param_spec_int ( + property_name, NULL, NULL, + G_MININT, G_MAXINT, + g_variant_get_uint64 (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_DOUBLE)) { + pspec = g_param_spec_double ( + property_name, NULL, NULL, + -G_MAXDOUBLE, G_MAXDOUBLE, + g_variant_get_double (v), + G_PARAM_READWRITE); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_BOOLEAN)) { + pspec = g_param_spec_boolean ( + property_name, NULL, NULL, + g_variant_get_boolean (v), + G_PARAM_READWRITE); } else { - default_value = gconf_value_copy (default_value); + bad_type = g_variant_get_type_string (v); + goto fail; } - switch (value_type) { - case GCONF_VALUE_STRING: - pspec = g_param_spec_string ( - property_name, NULL, NULL, - gconf_value_get_string (default_value), - G_PARAM_READWRITE); - break; - - case GCONF_VALUE_INT: - pspec = g_param_spec_int ( - property_name, NULL, NULL, - G_MININT, G_MAXINT, - gconf_value_get_int (default_value), - G_PARAM_READWRITE); - break; - - case GCONF_VALUE_FLOAT: - pspec = g_param_spec_double ( - property_name, NULL, NULL, - -G_MAXDOUBLE, G_MAXDOUBLE, - gconf_value_get_float (default_value), - G_PARAM_READWRITE); - break; - - case GCONF_VALUE_BOOL: - pspec = g_param_spec_boolean ( - property_name, NULL, NULL, - gconf_value_get_bool (default_value), - G_PARAM_READWRITE); - break; - - case GCONF_VALUE_SCHEMA: - bad_type = "schema"; - goto fail; - - case GCONF_VALUE_LIST: - bad_type = "list"; - goto fail; - - case GCONF_VALUE_PAIR: - bad_type = "pair"; - goto fail; - - default: - bad_type = "invalid"; - goto fail; - } - - gconf_value_free (default_value); - gconf_schema_free (schema); - gconf_entry_unref (entry); + g_variant_unref (v); + g_object_unref (settings); return pspec; fail: g_error ( "Unable to create EShellSettings property for " - "GConf key '%s' of type '%s'", gconf_key, bad_type); + "GSettings key '%s' of type '%s'", key, bad_type); g_assert_not_reached (); } @@ -180,7 +142,7 @@ shell_settings_set_property (GObject *object, EShellSettingsPrivate *priv; GValue *dest_value; - priv = E_SHELL_SETTINGS (object)->priv; + priv = E_SHELL_SETTINGS_GET_PRIVATE (object); dest_value = &g_array_index ( priv->value_array, GValue, property_id - 1); @@ -208,7 +170,7 @@ shell_settings_get_property (GObject *object, EShellSettingsPrivate *priv; GValue *src_value; - priv = E_SHELL_SETTINGS (object)->priv; + priv = E_SHELL_SETTINGS_GET_PRIVATE (object); src_value = &g_array_index ( priv->value_array, GValue, property_id - 1); @@ -222,7 +184,7 @@ shell_settings_finalize (GObject *object) EShellSettingsPrivate *priv; guint ii; - priv = E_SHELL_SETTINGS (object)->priv; + priv = E_SHELL_SETTINGS_GET_PRIVATE (object); for (ii = 0; ii < priv->value_array->len; ii++) g_value_unset (&g_array_index (priv->value_array, GValue, ii)); @@ -260,8 +222,7 @@ shell_settings_init (EShellSettings *shell_settings, value_array = g_array_new (FALSE, TRUE, sizeof (GValue)); g_array_set_size (value_array, property_count); - shell_settings->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell_settings, E_TYPE_SHELL_SETTINGS, EShellSettingsPrivate); + shell_settings->priv = E_SHELL_SETTINGS_GET_PRIVATE (shell_settings); shell_settings->priv->value_array = value_array; g_object_freeze_notify (G_OBJECT (shell_settings)); @@ -277,7 +238,7 @@ shell_settings_init (EShellSettings *shell_settings, g_object_notify (G_OBJECT (shell_settings), pspec->name); /* FIXME Need to bind those properties that have - * associated GConf keys. */ + * associated GSettings keys. */ } g_free (pspecs); @@ -366,33 +327,39 @@ e_shell_settings_install_property (GParamSpec *pspec) /** * e_shell_settings_install_property_for_key: * @property_name: the name of the property to install - * @gconf_key: the GConf key to bind the property to + * @schema: the GSettings schema to use for @key + * @key: the GSettings key to bind the property to * * Installs a new #EShellSettings class property by examining the - * GConf schema for @gconf_key to determine the appropriate type and + * GSettings schema for @key to determine the appropriate type and * default value. This is usually done during initialization of an * #EShellBackend of other dynamically loaded entity. * * After the class property is installed, all #EShellSettings instances - * are bound to @gconf_key, causing @property_name and @gconf_key to have + * are bound to @key, causing @property_name and @key to have * the same value at all times. **/ void e_shell_settings_install_property_for_key (const gchar *property_name, - const gchar *gconf_key) + const gchar *schema, + const gchar *key) { GParamSpec *pspec; GList *iter, *next; + GSettings *settings; g_return_if_fail (property_name != NULL); - g_return_if_fail (gconf_key != NULL); + g_return_if_fail (schema != NULL); + g_return_if_fail (key != NULL); - pspec = shell_settings_pspec_for_key (property_name, gconf_key); + pspec = shell_settings_pspec_for_key (property_name, schema, key); if (!pspec) return; e_shell_settings_install_property (pspec); + settings = g_settings_new (schema); + for (iter = instances; iter != NULL; iter = iter->next) g_object_freeze_notify (iter->data); @@ -401,15 +368,17 @@ e_shell_settings_install_property_for_key (const gchar *property_name, shell_settings = E_SHELL_SETTINGS (iter->data); - gconf_bridge_bind_property ( - gconf_bridge_get (), gconf_key, - G_OBJECT (shell_settings), property_name); + g_settings_bind ( + settings, key, G_OBJECT (shell_settings), + property_name, G_SETTINGS_BIND_DEFAULT); } for (iter = instances; iter != NULL; iter = next) { next = iter->next; g_object_thaw_notify (iter->data); } + + g_object_unref (settings); } /** @@ -463,7 +432,7 @@ e_shell_settings_get_boolean (EShellSettings *shell_settings, * @v_boolean: boolean value to be set * * Sets the contents of an #EShellSettings property of type #G_TYPE_BOOLEAN - * to @v_boolean. If @property_name is bound to a GConf key, the GConf key + * to @v_boolean. If @property_name is bound to a GSettings key, the GSettings key * will also be set to @v_boolean. **/ void @@ -521,7 +490,7 @@ e_shell_settings_get_int (EShellSettings *shell_settings, * @v_int: integer value to be set * * Sets the contents of an #EShellSettings property of type #G_TYPE_INT - * to @v_int. If @property_name is bound to a GConf key, the GConf key + * to @v_int. If @property_name is bound to a GSettings key, the GSettings key * will also be set to @v_int. **/ void @@ -579,7 +548,7 @@ e_shell_settings_get_string (EShellSettings *shell_settings, * @v_string: string to be set * * Sets the contents of an #EShellSettings property of type #G_TYPE_STRING - * to @v_string. If @property_name is bound to a GConf key, the GConf key + * to @v_string. If @property_name is bound to a GSettings key, the GSettings key * will also be set to @v_string. **/ void diff --git a/shell/e-shell-settings.h b/shell/e-shell-settings.h index 15aaff2071..0316a7bb0b 100644 --- a/shell/e-shell-settings.h +++ b/shell/e-shell-settings.h @@ -69,7 +69,8 @@ void e_shell_settings_install_property (GParamSpec *pspec); void e_shell_settings_install_property_for_key (const gchar *property_name, - const gchar *gconf_key); + const gchar *schema, + const gchar *key); void e_shell_settings_enable_debug (EShellSettings *shell_settings); /* Getters and setters for common EShellSettings property types. diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c index 62652dee1f..b7e523f733 100644 --- a/shell/e-shell-sidebar.c +++ b/shell/e-shell-sidebar.c @@ -37,6 +37,10 @@ #include <e-util/e-unicode.h> #include <shell/e-shell-view.h> +#define E_SHELL_SIDEBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_SIDEBAR, EShellSidebarPrivate)) + struct _EShellSidebarPrivate { gpointer shell_view; /* weak pointer */ @@ -157,7 +161,7 @@ shell_sidebar_dispose (GObject *object) { EShellSidebarPrivate *priv; - priv = E_SHELL_SIDEBAR (object)->priv; + priv = E_SHELL_SIDEBAR_GET_PRIVATE (object); if (priv->shell_view != NULL) { g_object_remove_weak_pointer ( @@ -184,7 +188,7 @@ shell_sidebar_finalize (GObject *object) { EShellSidebarPrivate *priv; - priv = E_SHELL_SIDEBAR (object)->priv; + priv = E_SHELL_SIDEBAR_GET_PRIVATE (object); g_free (priv->icon_name); g_free (priv->primary_text); @@ -249,7 +253,7 @@ shell_sidebar_get_preferred_height (GtkWidget *widget, gint child_min, child_nat; GtkWidget *child; - priv = E_SHELL_SIDEBAR (widget)->priv; + priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget); child = gtk_bin_get_child (GTK_BIN (widget)); gtk_widget_get_preferred_height (child, minimum, natural); @@ -270,7 +274,7 @@ shell_sidebar_size_allocate (GtkWidget *widget, GtkRequisition child_requisition; GtkWidget *child; - priv = E_SHELL_SIDEBAR (widget)->priv; + priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget); gtk_widget_set_allocation (widget, allocation); @@ -301,7 +305,7 @@ shell_sidebar_forall (GtkContainer *container, { EShellSidebarPrivate *priv; - priv = E_SHELL_SIDEBAR (container)->priv; + priv = E_SHELL_SIDEBAR_GET_PRIVATE (container); if (include_internals && callback && priv->event_box) callback (priv->event_box, callback_data); @@ -434,8 +438,7 @@ e_shell_sidebar_init (EShellSidebar *shell_sidebar) const GdkColor *color; const gchar *icon_name; - shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell_sidebar, E_TYPE_SHELL_SIDEBAR, EShellSidebarPrivate); + shell_sidebar->priv = E_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); gtk_widget_set_has_window (GTK_WIDGET (shell_sidebar), FALSE); diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c index 77c1fd2929..3a72851f97 100644 --- a/shell/e-shell-switcher.c +++ b/shell/e-shell-switcher.c @@ -34,6 +34,10 @@ #include <glib/gi18n.h> #include <libebackend/e-extensible.h> +#define E_SHELL_SWITCHER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcherPrivate)) + #define H_PADDING 6 #define V_PADDING 6 @@ -235,7 +239,7 @@ shell_switcher_dispose (GObject *object) { EShellSwitcherPrivate *priv; - priv = E_SHELL_SWITCHER (object)->priv; + priv = E_SHELL_SWITCHER_GET_PRIVATE (object); while (priv->proxies != NULL) { GtkWidget *widget = priv->proxies->data; @@ -255,7 +259,7 @@ shell_switcher_get_preferred_width (GtkWidget *widget, GtkWidget *child; GList *iter; - priv = E_SHELL_SWITCHER (widget)->priv; + priv = E_SHELL_SWITCHER_GET_PRIVATE (widget); *minimum = *natural = 0; @@ -290,7 +294,7 @@ shell_switcher_get_preferred_height (GtkWidget *widget, GtkWidget *child; GList *iter; - priv = E_SHELL_SWITCHER (widget)->priv; + priv = E_SHELL_SWITCHER_GET_PRIVATE (widget); *minimum = *natural = 0; @@ -351,7 +355,7 @@ shell_switcher_screen_changed (GtkWidget *widget, EShellSwitcherPrivate *priv; GtkSettings *settings; - priv = E_SHELL_SWITCHER (widget)->priv; + priv = E_SHELL_SWITCHER_GET_PRIVATE (widget); if (gtk_widget_has_screen (widget)) settings = gtk_widget_get_settings (widget); @@ -386,7 +390,7 @@ shell_switcher_remove (GtkContainer *container, EShellSwitcherPrivate *priv; GList *link; - priv = E_SHELL_SWITCHER (container)->priv; + priv = E_SHELL_SWITCHER_GET_PRIVATE (container); /* Look in the internal widgets first. */ @@ -413,7 +417,7 @@ shell_switcher_forall (GtkContainer *container, { EShellSwitcherPrivate *priv; - priv = E_SHELL_SWITCHER (container)->priv; + priv = E_SHELL_SWITCHER_GET_PRIVATE (container); if (include_internals) g_list_foreach ( @@ -551,8 +555,7 @@ e_shell_switcher_class_init (EShellSwitcherClass *class) static void e_shell_switcher_init (EShellSwitcher *switcher) { - switcher->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - switcher, E_TYPE_SHELL_SWITCHER, EShellSwitcherPrivate); + switcher->priv = E_SHELL_SWITCHER_GET_PRIVATE (switcher); gtk_widget_set_has_window (GTK_WIDGET (switcher), FALSE); diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c index adc0d27980..3dd995ded1 100644 --- a/shell/e-shell-taskbar.c +++ b/shell/e-shell-taskbar.c @@ -36,6 +36,10 @@ #include <e-shell-view.h> #include <misc/e-activity-proxy.h> +#define E_SHELL_TASKBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_TASKBAR, EShellTaskbarPrivate)) + struct _EShellTaskbarPrivate { gpointer shell_view; /* weak pointer */ @@ -204,7 +208,7 @@ shell_taskbar_dispose (GObject *object) { EShellTaskbarPrivate *priv; - priv = E_SHELL_TASKBAR (object)->priv; + priv = E_SHELL_TASKBAR_GET_PRIVATE (object); g_hash_table_foreach_remove ( priv->proxy_table, (GHRFunc) @@ -243,7 +247,7 @@ shell_taskbar_finalize (GObject *object) { EShellTaskbarPrivate *priv; - priv = E_SHELL_TASKBAR (object)->priv; + priv = E_SHELL_TASKBAR_GET_PRIVATE (object); g_hash_table_destroy (priv->proxy_table); @@ -371,8 +375,7 @@ e_shell_taskbar_init (EShellTaskbar *shell_taskbar) { GtkWidget *widget; - shell_taskbar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell_taskbar, E_TYPE_SHELL_TASKBAR, EShellTaskbarPrivate); + shell_taskbar->priv = E_SHELL_TASKBAR_GET_PRIVATE (shell_taskbar); shell_taskbar->priv->proxy_table = g_hash_table_new (NULL, NULL); gtk_box_set_spacing (GTK_BOX (shell_taskbar), 12); diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index a2fc00e3b5..89ac929160 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -45,6 +45,10 @@ #include "e-shell-searchbar.h" #include "e-shell-window-actions.h" +#define E_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_VIEW, EShellViewPrivate)) + #define SIMPLE_SEARCHBAR_WIDTH 300 #define STATE_SAVE_TIMEOUT_SECONDS 3 @@ -502,7 +506,7 @@ shell_view_dispose (GObject *object) { EShellViewPrivate *priv; - priv = E_SHELL_VIEW (object)->priv; + priv = E_SHELL_VIEW_GET_PRIVATE (object); /* Expedite any pending state saves. */ if (priv->state_save_timeout_id > 0) { @@ -568,7 +572,7 @@ shell_view_finalize (GObject *object) { EShellViewPrivate *priv; - priv = E_SHELL_VIEW (object)->priv; + priv = E_SHELL_VIEW_GET_PRIVATE (object); g_key_file_free (priv->state_key_file); @@ -1107,8 +1111,7 @@ e_shell_view_init (EShellView *shell_view, size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); - shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell_view, E_TYPE_SHELL_VIEW, EShellViewPrivate); + shell_view->priv = E_SHELL_VIEW_GET_PRIVATE (shell_view); shell_view->priv->state_key_file = g_key_file_new (); shell_view->priv->size_group = size_group; } 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-window-private.h b/shell/e-shell-window-private.h index d36a3e64f6..e3a0e50665 100644 --- a/shell/e-shell-window-private.h +++ b/shell/e-shell-window-private.h @@ -49,6 +49,10 @@ #include <e-shell-window-actions.h> #include <e-shell-utils.h> +#define E_SHELL_WINDOW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL_WINDOW, EShellWindowPrivate)) + /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 1a969de8c9..19178f8292 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -958,8 +958,7 @@ e_shell_window_alert_sink_init (EAlertSinkInterface *interface) static void e_shell_window_init (EShellWindow *shell_window) { - shell_window->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell_window, E_TYPE_SHELL_WINDOW, EShellWindowPrivate); + shell_window->priv = E_SHELL_WINDOW_GET_PRIVATE (shell_window); e_shell_window_private_init (shell_window); } diff --git a/shell/e-shell.c b/shell/e-shell.c index a9c2fdc22f..cc1591337f 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -705,6 +705,12 @@ shell_dispose (GObject *object) g_object_unref (alert); } + 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); + } + if (priv->startup_view != NULL) { g_free (priv->startup_view); priv->startup_view = NULL; @@ -1194,7 +1200,8 @@ e_shell_init (EShell *shell) e_shell_settings_install_property_for_key ( "start-offline", - "/apps/evolution/shell/start_offline"); + "org.gnome.evolution.shell", + "start-offline"); /*** Session Management ***/ @@ -1427,18 +1434,12 @@ 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; - const gchar *key; - GError *error = NULL; + GSettings *settings; - client = e_shell_get_gconf_client (shell); - key = "/apps/evolution/shell/view_defaults/component_id"; - gconf_client_set_string (client, key, view_name, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + settings = g_settings_new ("org.gnome.evolution.shell"); + g_settings_set_string ( + settings, "default-component-id", view_name); + 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 (); |