diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 18 | ||||
-rw-r--r-- | shell/Makefile.am | 6 | ||||
-rw-r--r-- | shell/e-shell-view.c | 79 | ||||
-rw-r--r-- | shell/e-shell-view.h | 2 | ||||
-rw-r--r-- | shell/e-shell.c | 55 | ||||
-rw-r--r-- | shell/e-shell.h | 7 | ||||
-rw-r--r-- | shell/main.c | 19 |
7 files changed, 70 insertions, 116 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index e1e38b6a2c..921431b0a0 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -9,6 +9,24 @@ * e-shortcuts-view.c (destroy): unref the shortcuts, causing a massive ripple chain ref-count reaction. +2000-08-03 JP Rosevear <jpr@helixcode.com> + + * e-shell.h: Remove gconf references + + * e-shell-view.h: Remove gconf references + + * main.c (idle_cb): Remove gconf references + + * Makefile.am: Remove gconf cflags and libs + + * e-shell-view.c (e_shell_view_load_settings): Change to use + gnome-config + (e_shell_view_save_settings): ditto + + * e-shell.c (e_shell_restore_from_settings): Change to + use gnome_config + (save_settings_for_views): ditto + 2000-08-03 Michael Meeks <michael@helixcode.com> * e-shell-view.c (destroy): unref the UI handler. diff --git a/shell/Makefile.am b/shell/Makefile.am index 6d124f9631..3d1ae7e096 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -5,7 +5,6 @@ INCLUDES = \ -I$(top_srcdir)/widgets/misc \ -I$(top_srcdir) \ $(BONOBO_GNOME_CFLAGS) \ - $(GCONF_CFLAGS) \ -DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \ -DEVOLUTION_VERSION=\""$(VERSION)"\" \ -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ @@ -111,8 +110,7 @@ evolution_LDADD = \ $(top_builddir)/widgets/e-text/libetext.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ - $(BONOBO_GNOME_LIBS) \ - $(GCONF_LIBS) + $(BONOBO_GNOME_LIBS) # Purify support @@ -127,3 +125,5 @@ evolution.pure: evolution $(PLINK) $(evolution_LDFLAGS) $(evolution_OBJECTS) $(evolution_LDADD) $(LIBS) endif + + 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; } diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index 603fe0ede0..69a0e5c22c 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -92,10 +92,8 @@ GtkWidget *e_shell_view_get_appbar (EShellView const char *e_shell_view_get_current_uri (EShellView *shell_view); gboolean e_shell_view_save_settings (EShellView *shell_view, - GConfClient *gconf_client, const char *prefix); gboolean e_shell_view_load_settings (EShellView *shell_view, - GConfClient *gconf_client, const char *prefix); #ifdef __cplusplus diff --git a/shell/e-shell.c b/shell/e-shell.c index ed7715b652..89ebe2f20e 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -60,8 +60,6 @@ struct _EShellPrivate { EComponentRegistry *component_registry; ECorbaStorageRegistry *corba_storage_registry; - - GConfClient *gconf_client; }; @@ -393,9 +391,6 @@ destroy (GtkObject *object) if (priv->corba_storage_registry != NULL) bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); - if (priv->gconf_client != NULL) - gtk_object_unref (GTK_OBJECT (priv->gconf_client)); - g_free (priv); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -463,7 +458,6 @@ init (EShell *shell) priv->component_registry = NULL; priv->folder_type_registry = NULL; priv->corba_storage_registry = NULL; - priv->gconf_client = NULL; shell->priv = priv; } @@ -472,8 +466,7 @@ init (EShell *shell) void e_shell_construct (EShell *shell, Evolution_Shell corba_object, - const char *local_directory, - GConfClient *gconf_client) + const char *local_directory) { EShellPrivate *priv; gchar *shortcut_path; @@ -491,8 +484,8 @@ e_shell_construct (EShell *shell, priv->local_directory = g_strdup (local_directory); priv->folder_type_registry = e_folder_type_registry_new (); priv->storage_set = e_storage_set_new (shell->priv->folder_type_registry); - gtk_object_ref (GTK_OBJECT (gconf_client)); - priv->gconf_client = gconf_client; + + gtk_object_ref (GTK_OBJECT (priv->storage_set )); /* CORBA storages must be set up before the components, because otherwise components cannot register their own storages. */ @@ -516,8 +509,7 @@ e_shell_construct (EShell *shell, } EShell * -e_shell_new (const char *local_directory, - GConfClient *gconf_client) +e_shell_new (const char *local_directory) { EShell *new; EShellPrivate *priv; @@ -534,7 +526,7 @@ e_shell_new (const char *local_directory, new = gtk_type_new (e_shell_get_type ()); corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - e_shell_construct (new, corba_object, local_directory, gconf_client); + e_shell_construct (new, corba_object, local_directory); priv = new->priv; @@ -603,9 +595,9 @@ static gboolean save_settings_for_views (EShell *shell) { EShellPrivate *priv; - GConfError *err = NULL; GList *p; gboolean retval; + char *prefix; int i; priv = shell->priv; @@ -613,23 +605,26 @@ save_settings_for_views (EShell *shell) for (p = priv->views, i = 0; p != NULL; p = p->next, i++) { EShellView *view; - char *gconf_prefix; view = E_SHELL_VIEW (p->data); - gconf_prefix = g_strdup_printf ("/apps/Evolution/Shell/Views/%d", i); + prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/", + priv->local_directory, i); - if (! e_shell_view_save_settings (view, priv->gconf_client, gconf_prefix)) { + if (! e_shell_view_save_settings (view, prefix)) { g_warning ("Cannot save settings for view -- %d", i); retval = FALSE; } - g_free (gconf_prefix); + g_free (prefix); } - gconf_client_set_int (priv->gconf_client, "/apps/Evolution/Shell/NumberOfViews", - g_list_length (priv->views), &err); - gconf_client_suggest_sync (priv->gconf_client, NULL); + prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews", + priv->local_directory, i); + gnome_config_set_int (prefix, g_list_length (priv->views)); + g_free (prefix); + + gnome_config_sync (); return TRUE; } @@ -740,8 +735,8 @@ gboolean e_shell_restore_from_settings (EShell *shell) { EShellPrivate *priv; - GConfError *err = NULL; gboolean retval; + char *prefix; int num_views; int i; @@ -751,11 +746,9 @@ e_shell_restore_from_settings (EShell *shell) priv = shell->priv; - num_views = gconf_client_get_int (priv->gconf_client, "/apps/Evolution/Shell/NumberOfViews", &err); - if (err != NULL) { - gconf_error_destroy (err); - return FALSE; - } + prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews", + priv->local_directory); + num_views = gnome_config_get_int (prefix); if (num_views == 0) return FALSE; @@ -763,18 +756,18 @@ e_shell_restore_from_settings (EShell *shell) for (i = 0; i < num_views; i++) { GtkWidget *view_widget; - char *gconf_prefix; - gconf_prefix = g_strdup_printf ("/apps/Evolution/Shell/Views/%d", i); + prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/", + priv->local_directory, i); /* FIXME restore the URI here. There should be an e_shell_view_new_from_configuration() thingie. */ view_widget = e_shell_new_view (shell, NULL); - if (! e_shell_view_load_settings (E_SHELL_VIEW (view_widget), priv->gconf_client, gconf_prefix)) + if (! e_shell_view_load_settings (E_SHELL_VIEW (view_widget), prefix)) retval = FALSE; - g_free (gconf_prefix); + g_free (prefix); } return retval; diff --git a/shell/e-shell.h b/shell/e-shell.h index e9ccaa096f..37c8a879b7 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -29,7 +29,6 @@ #endif #include <bonobo/bonobo-object.h> -#include <gconf/gconf-client.h> #include "Evolution.h" #include "e-shortcuts.h" @@ -66,11 +65,9 @@ struct _EShellClass { GtkType e_shell_get_type (void); void e_shell_construct (EShell *shell, Evolution_Shell corba_object, - const char *local_directory, - GConfClient *gconf_client); + const char *local_directory); -EShell *e_shell_new (const char *local_directory, - GConfClient *gconf_client); +EShell *e_shell_new (const char *local_directory); GtkWidget *e_shell_new_view (EShell *shell, const char *uri); diff --git a/shell/main.c b/shell/main.c index 352773e45f..1e2d3c3cc2 100644 --- a/shell/main.c +++ b/shell/main.c @@ -109,18 +109,11 @@ static gint idle_cb (gpointer data) { GtkWidget *view; - GConfClient *gconf_client; char *evolution_directory; evolution_directory = (char *) data; -#ifdef HAVE_GCONF_CLIENT_GET_DEFAULT - gconf_client = gconf_client_get_default (); -#else - gconf_client = gconf_client_new (); -#endif - - shell = e_shell_new (evolution_directory, gconf_client); + shell = e_shell_new (evolution_directory); g_free (evolution_directory); if (shell == NULL) { @@ -140,15 +133,12 @@ idle_cb (gpointer data) if (!getenv ("EVOLVE_ME_HARDER")) development_warning (); - gtk_object_unref (GTK_OBJECT (gconf_client)); - return FALSE; } int main (int argc, char **argv) { - GConfError *err = NULL; char *evolution_directory; bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); @@ -161,12 +151,6 @@ main (int argc, char **argv) gnome_window_icon_set_default_from_file (EVOLUTION_IMAGES "/evolution-inbox.png"); - if (! gconf_init (argc, argv, &err)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize the configuration system.")); - exit (1); - } - if (! bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Cannot initialize the Bonobo component system.")); @@ -187,3 +171,4 @@ main (int argc, char **argv) return 0; } + |