Disabled for now.

* main.c (upgrade_from_1_0_if_needed): Disabled for now.

* e-shell-startup-wizard.c: Removed member config_listener from
struct SWData.
(e_shell_startup_wizard_create): Updated accordingly, just use
GConf, checking the /apps/evolution/mail/account-list key.
(finish_func): Use GConf.

* e-shell-config-default-folders.c: Removed member config_listener
in struct EvolutionDefaultFolderConfig.
(e_shell_config_default_folders_create_widget): Do not initialize
here.  GConfified the paths.
(config_control_destroy_notify): No unref of the config_listener
anymore.
(config_control_apply_cb): Use GConf.
(setup_folder_selector): Likewise.

* e-shell-config-autocompletion.c: Removed member config_listener
from EvolutionAutocompletionConfig.
(config_control_destroy_notify): Do not unref.
(config_control_apply_callback): Use a GConfClient.

* e-folder-list.c (e_folder_list_init): Add missing cast.

* main.c (show_development_warning): Use GConf.

* e-setup.c (e_setup_check_config): Removed arg @listener.
GConfified.

* e-shell-view.c (e_shell_view_save_defaults): New.
(e_shell_view_save_settings): Removed.
(e_shell_view_load_settings): Removed.
(setup_defaults): New helper function.
(e_shell_view_construct): New arg @uri.
(e_shell_view_new): New arg @uri.

* e-shell.c: Removed member config_listener in struct
EShellPrivate.
(impl_dispose): Do not unref.
(init): Do not initialize.
(get_config_start_offline): New helper function.
(e_shell_construct): Use this to get the startup mode in case
E_SHELL_STARTUP_LINE_MODE_CONFIG.
(save_misc_settings): Changed to use GConfClient instead of
EConfigListener.
(e_shell_create_view_from_settings): Removed.
(e_shell_restore_from_settings): Removed.
(e_shell_get_config_listener): Removed.
(e_shell_disconnect_db): Removed.
(parse_default_uri): Use GConf.

* main.c (idle_cb): Simplified the logic here.  Always assume that
the view will be created with the default folder open by just
using e_shell_create_view().

svn path=/trunk/; revision=18844
This commit is contained in:
Ettore Perazzoli
2002-11-19 21:25:37 +00:00
parent 6f1d5b3135
commit 8b3091dea7
15 changed files with 658 additions and 467 deletions

View File

@ -1,3 +1,60 @@
2002-11-19 Ettore Perazzoli <ettore@ximian.com>
* main.c (upgrade_from_1_0_if_needed): Disabled for now.
* e-shell-startup-wizard.c: Removed member config_listener from
struct SWData.
(e_shell_startup_wizard_create): Updated accordingly, just use
GConf, checking the /apps/evolution/mail/account-list key.
(finish_func): Use GConf.
* e-shell-config-default-folders.c: Removed member config_listener
in struct EvolutionDefaultFolderConfig.
(e_shell_config_default_folders_create_widget): Do not initialize
here. GConfified the paths.
(config_control_destroy_notify): No unref of the config_listener
anymore.
(config_control_apply_cb): Use GConf.
(setup_folder_selector): Likewise.
* e-shell-config-autocompletion.c: Removed member config_listener
from EvolutionAutocompletionConfig.
(config_control_destroy_notify): Do not unref.
(config_control_apply_callback): Use a GConfClient.
* e-folder-list.c (e_folder_list_init): Add missing cast.
* main.c (show_development_warning): Use GConf.
* e-setup.c (e_setup_check_config): Removed arg @listener.
GConfified.
* e-shell-view.c (e_shell_view_save_defaults): New.
(e_shell_view_save_settings): Removed.
(e_shell_view_load_settings): Removed.
(setup_defaults): New helper function.
(e_shell_view_construct): New arg @uri.
(e_shell_view_new): New arg @uri.
* e-shell.c: Removed member config_listener in struct
EShellPrivate.
(impl_dispose): Do not unref.
(init): Do not initialize.
(get_config_start_offline): New helper function.
(e_shell_construct): Use this to get the startup mode in case
E_SHELL_STARTUP_LINE_MODE_CONFIG.
(save_misc_settings): Changed to use GConfClient instead of
EConfigListener.
(e_shell_create_view_from_settings): Removed.
(e_shell_restore_from_settings): Removed.
(e_shell_get_config_listener): Removed.
(e_shell_disconnect_db): Removed.
(parse_default_uri): Use GConf.
* main.c (idle_cb): Simplified the logic here. Always assume that
the view will be created with the default folder open by just
using e_shell_create_view().
2002-11-19 Not Zed <NotZed@Ximian.com>
* e-shell-shared-folder-picker-dialog.c (show_dialog): Pass type

View File

@ -269,6 +269,18 @@ icons = \
check-filled.xpm \
check-missing.xpm
# GConf schemas
schemadir = $(GCONF_SCHEMA_FILE_DIR)
schema_DATA = apps_evolution_shell.schemas
install-data-local:
if test -z "$(DESTDIR)" ; then \
for p in $(schema_DATA) ; do \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \
done \
fi
# GLib marshalling cruft

View File

@ -0,0 +1,241 @@
<gconfschemafile>
<schemalist>
<!-- Default mail folder -->
<schema>
<key>/schemas/apps/evolution/shell/default_folders/mail_path</key>
<applyto>/apps/evolution/shell/default_folders/mail_path</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Path to the default mail folder</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/default_folders/mail_uri</key>
<applyto>/apps/evolution/shell/default_folders/mail_uri</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Physical URI to the default mail folder</short>
</locale>
</schema>
<!-- Default contacts folder -->
<schema>
<key>/schemas/apps/evolution/shell/default_folders/contacts_path</key>
<applyto>/apps/evolution/shell/default_folders/contacts_path</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Path to the default contacts folder</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/default_folders/contacts_uri</key>
<applyto>/apps/evolution/shell/default_folders/contacts_uri</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Physical URI to the default contacts folder</short>
</locale>
</schema>
<!-- Default calendar folder -->
<schema>
<key>/schemas/apps/evolution/shell/default_folders/calendar_path</key>
<applyto>/apps/evolution/shell/default_folders/calendar_path</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Path to the default calendar folder</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/default_folders/calendar_uri</key>
<applyto>/apps/evolution/shell/default_folders/calendar_uri</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Physical URI to the default calendar folder</short>
</locale>
</schema>
<!-- Default tasks folder -->
<schema>
<key>/schemas/apps/evolution/shell/default_folders/tasks_path</key>
<applyto>/apps/evolution/shell/default_folders/tasks_path</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Path to the default tasks folder</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/default_folders/tasks_uri</key>
<applyto>/apps/evolution/shell/default_folders/tasks_uri</applyto>
<owner>evolution</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Physical URI to the default tasks folder</short>
</locale>
</schema>
<!-- Development warning dialog -->
<schema>
<key>/schemas/apps/evolution/shell/skip_warning_dialog</key>
<applyto>/apps/evolution/shell/skip_warning_dialog</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Whether to skip the development warning dialog</short>
<long>
If set to true, the warning dialog in development versions
of Evolution is not displayed.
</long>
</locale>
</schema>
<!-- Offline Mode -->
<schema>
<key>/schemas/apps/evolution/shell/start_offline</key>
<applyto>/apps/evolution/shell/start_offline</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Whether Evolution should start up in offline mode</short>
<long>
If set to true, Evolution will start up in offline mode
instead of online mode.
</long>
</locale>
</schema>
<!-- View defaults -->
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/width</key>
<applyto>/apps/evolution/shell/view_defaults/width</applyto>
<owner>evolution</owner>
<type>int</type>
<default>640</default>
<locale name="C">
<short>Default window width</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/height</key>
<applyto>/apps/evolution/shell/view_defaults/height</applyto>
<owner>evolution</owner>
<type>int</type>
<locale name="C">
<default>480</default>
<short>Default window height</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/selected_shortcut_group</key>
<applyto>/apps/evolution/shell/view_defaults/selected_shortcut_group</applyto>
<owner>evolution</owner>
<type>int</type>
<default>0</default>
<locale name="C">
<short>Default shortcut group</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/show_folder_bar</key>
<applyto>/apps/evolution/shell/view_defaults/show_folder_bar</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Whether to show the folder bar</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/show_shortcut_bar</key>
<applyto>/apps/evolution/shell/view_defaults/show_shortcut_bar</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Whether to show the shortcut bar</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/folder_path</key>
<applyto>/apps/evolution/shell/view_defaults/folder_path</applyto>
<owner>evolution</owner>
<type>string</type>
<locale name="C">
<default>/Summary</default>
<short>Path to the folder to be displayed by default</short>
</locale>
</schema>
<!-- Folder bar -->
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/folder_bar/width</key>
<applyto>/apps/evolution/shell/view_defaults/folder_bar/width</applyto>
<owner>evolution</owner>
<type>int</type>
<default>100</default>
<locale name="C">
<short>Default width of the folder bar pane</short>
</locale>
</schema>
<!-- Shortcut bar -->
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/shortcut_bar/width</key>
<applyto>/apps/evolution/shell/view_defaults/shortcut_bar/width</applyto>
<owner>evolution</owner>
<type>int</type>
<default>100</default>
<locale name="C">
<short>Default width of the shortcut bar pane</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/shell/view_defaults/shortcut_bar/icon_types</key>
<key>/apps/evolution/shell/view_defaults/shortcut_bar/icon_types</key>
<owner>evolution</owner>
<type>list</type>
<list_type>int</list_type>
<default>[]</default>
<locale name="C">
<short>Icon sizes for the shortcut bar groups</short>
</locale>
</schema>
</schemalist>
</gconfschemafile>

View File

@ -444,7 +444,7 @@ e_folder_list_init (EFolderList *efl)
/* XXX libglade2 seems to not show custom widgets even when
they're flagged Visible.*/
gtk_widget_show_all (efl->priv->scrolled_table);
gtk_widget_show_all (GTK_WIDGET (efl->priv->scrolled_table));
efl->priv->possible_types = NULL;
set_frame_label (efl);

View File

@ -25,6 +25,21 @@
#include <config.h>
#endif
#include "e-setup.h"
#include "e-local-folder.h"
#include "e-shell-config.h"
#include "e-shell-constants.h"
#include <gconf/gconf-client.h>
#include <gtk/gtklabel.h>
#include <gal/widgets/e-gui-utils.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -33,17 +48,6 @@
#include <string.h>
#include <unistd.h>
#include <gtk/gtklabel.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
#include <gal/widgets/e-gui-utils.h>
#include "e-local-folder.h"
#include "e-shell-config.h"
#include "e-shell-constants.h"
#include "e-setup.h"
static GList *
check_dir_recur (const char *evolution_directory,
@ -417,34 +421,39 @@ e_setup (const char *evolution_directory)
void
e_setup_check_config (EConfigListener *listener,
const char *evolution_directory)
e_setup_check_config (const char *evolution_directory)
{
GConfClient *client;
char *tmp;
char *uri;
if (e_config_listener_get_string_with_default (listener, "/DefaultFolders/mail_path", NULL, NULL) == NULL) {
e_config_listener_set_string (listener, "/DefaultFolders/mail_path", E_LOCAL_INBOX_URI);
uri = g_strconcat ("file://", evolution_directory, "/local",
strrchr (E_LOCAL_INBOX_URI, '/'), NULL);
e_config_listener_set_string (listener, "/DefaultFolders/mail_uri", uri);
g_free (uri);
client = gconf_client_get_default ();
e_config_listener_set_string (listener, "/DefaultFolders/contacts_path", E_LOCAL_CONTACTS_URI);
uri = g_strconcat ("file://", evolution_directory, "/local",
strrchr (E_LOCAL_CONTACTS_URI, '/'), NULL);
e_config_listener_set_string (listener, "/DefaultFolders/contacts_uri", uri);
g_free (uri);
e_config_listener_set_string (listener, "/DefaultFolders/calendar_path", E_LOCAL_CALENDAR_URI);
uri = g_strconcat ("file://", evolution_directory, "/local",
strrchr (E_LOCAL_CALENDAR_URI, '/'), NULL);
e_config_listener_set_string (listener, "/DefaultFolders/calendar_uri", uri);
g_free (uri);
e_config_listener_set_string (listener, "/DefaultFolders/tasks_path", E_LOCAL_TASKS_URI);
uri = g_strconcat ("file://", evolution_directory, "/local",
strrchr (E_LOCAL_TASKS_URI, '/'), NULL);
e_config_listener_set_string (listener, "/DefaultFolders/tasks_uri", uri);
g_free (uri);
tmp = gconf_client_get_string (client, "/apps/evolution/shell/default_folders/mail_path", NULL);
if (tmp != NULL && *tmp != 0) {
g_object_unref (client);
return;
}
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_path", E_LOCAL_INBOX_URI, NULL);
uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_INBOX_URI, '/'), NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_uri", uri, NULL);
g_free (uri);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_path", E_LOCAL_CONTACTS_URI, NULL);
uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_CONTACTS_URI, '/'), NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_uri", uri, NULL);
g_free (uri);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_path", E_LOCAL_TASKS_URI, NULL);
uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_TASKS_URI, '/'), NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_uri", uri, NULL);
g_free (uri);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_path", E_LOCAL_CALENDAR_URI, NULL);
uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_CALENDAR_URI, '/'), NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_uri", uri, NULL);
g_free (uri);
g_object_unref (client);
}

View File

@ -23,13 +23,10 @@
#ifndef _E_SETUP_H
#define _E_SETUP_H
#include "e-util/e-config-listener.h"
#include <glib.h>
gboolean e_setup (const char *evolution_directory);
void e_setup_check_config (EConfigListener *config_listener,
const char *evolution_directory);
void e_setup_check_config (const char *evolution_directory);
#endif /* _E_SETUP_H */

View File

@ -38,13 +38,14 @@
#include <gtk/gtkwidget.h>
#include <gtk/gtksignal.h>
#include <gconf/gconf-client.h>
typedef struct {
EvolutionConfigControl *config_control;
GtkWidget *control_widget;
EConfigListener *config_listener;
EvolutionShellClient *shell_client;
} EvolutionAutocompletionConfig;
@ -62,7 +63,6 @@ config_control_destroy_notify (void *data,
EvolutionAutocompletionConfig *ac = (EvolutionAutocompletionConfig *) data;
g_object_unref (ac->shell_client);
g_object_unref (ac->config_listener);
g_free (ac);
}
@ -72,11 +72,16 @@ static void
config_control_apply_callback (EvolutionConfigControl *config_control,
EvolutionAutocompletionConfig *ac)
{
GConfClient *client;
char *xml;
client = gconf_client_get_default ();
xml = e_folder_list_get_xml (E_FOLDER_LIST (ac->control_widget));
e_config_listener_set_string (ac->config_listener, "/Addressbook/Completion/uris", xml);
gconf_client_set_string (client, "/apps/evolution/addressbook/completion/uris", xml, NULL);
g_free (xml);
g_object_unref (client);
}
GtkWidget *
@ -84,21 +89,21 @@ e_shell_config_autocompletion_create_widget (EShell *shell, EvolutionConfigContr
{
GNOME_Evolution_Shell shell_dup;
EvolutionAutocompletionConfig *ac;
char *xml;
CORBA_Environment ev;
GConfClient *client;
static const char *possible_types[] = { "contacts/*", NULL };
char *xml;
ac = g_new0 (EvolutionAutocompletionConfig, 1);
ac->config_listener = e_config_listener_new ();
CORBA_exception_init (&ev);
shell_dup = CORBA_Object_duplicate (BONOBO_OBJREF (shell), &ev);
ac->shell_client = evolution_shell_client_new (shell_dup);
xml = e_config_listener_get_string_with_default (ac->config_listener,
"/Addressbook/Completion/uris",
NULL, NULL);
client = gconf_client_get_default ();
xml = gconf_client_get_string (client, "/apps/evolution/addressbook/completion/uris", NULL);
g_object_unref (client);
ac->control_widget = e_folder_list_new (ac->shell_client, xml);
g_free (xml);

View File

@ -29,14 +29,14 @@
#include "evolution-folder-selector-button.h"
#include "e-util/e-config-listener.h"
#include <glade/glade-xml.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-i18n.h>
#include <gconf/gconf-client.h>
typedef struct {
GladeXML *glade;
@ -47,7 +47,6 @@ typedef struct {
char *calendar_uri, *calendar_path;
char *tasks_uri, *tasks_path;
EConfigListener *config_listener;
EvolutionShellClient *shell_client;
} EvolutionDefaultFolderConfig;
@ -84,14 +83,21 @@ static void
config_control_apply_cb (EvolutionConfigControl *control,
EvolutionDefaultFolderConfig *dfc)
{
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/mail_path", dfc->mail_path);
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/mail_uri", dfc->mail_uri);
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/contacts_path", dfc->contacts_path);
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/contacts_uri", dfc->contacts_uri);
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/calendar_path", dfc->calendar_path);
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/calendar_uri", dfc->calendar_uri);
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/tasks_path", dfc->tasks_path);
e_config_listener_set_string (dfc->config_listener, "/DefaultFolders/tasks_uri", dfc->tasks_uri);
GConfClient *client;
client = gconf_client_get_default ();
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_path", dfc->mail_path, NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_uri", dfc->mail_uri, NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_path", dfc->contacts_path, NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_uri", dfc->contacts_uri, NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_path", dfc->calendar_path, NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_uri", dfc->calendar_uri, NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_path", dfc->tasks_path, NULL);
gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_uri", dfc->tasks_uri, NULL);
g_object_unref (client);
}
static void
@ -100,8 +106,6 @@ config_control_destroy_notify (void *data,
{
EvolutionDefaultFolderConfig *dfc = (EvolutionDefaultFolderConfig *) data;
g_object_unref (dfc->config_listener);
g_free (dfc->mail_uri);
g_free (dfc->mail_path);
g_free (dfc->contacts_uri);
@ -129,10 +133,15 @@ setup_folder_selector (EvolutionDefaultFolderConfig *dfc,
char **uri_ptr, char *uri_dbpath,
const char **types)
{
GConfClient *client;
GtkWidget *button;
*path_ptr = e_config_listener_get_string_with_default (dfc->config_listener, path_dbpath, NULL, NULL);
*uri_ptr = e_config_listener_get_string_with_default (dfc->config_listener, uri_dbpath, NULL, NULL);
client = gconf_client_get_default ();
*path_ptr = gconf_client_get_string (client, path_dbpath, NULL);
*uri_ptr = gconf_client_get_string (client, uri_dbpath, NULL);
g_object_unref (client);
button = glade_xml_get_widget (dfc->glade, widget_name);
evolution_folder_selector_button_construct (
@ -160,8 +169,6 @@ e_shell_config_default_folders_create_widget (EShell *shell, EvolutionConfigCont
dfc = g_new0 (EvolutionDefaultFolderConfig, 1);
dfc->config_listener = e_config_listener_new ();
CORBA_exception_init (&ev);
shell_dup = CORBA_Object_duplicate (BONOBO_OBJREF (shell), &ev);
CORBA_exception_free (&ev);
@ -170,20 +177,20 @@ e_shell_config_default_folders_create_widget (EShell *shell, EvolutionConfigCont
dfc->glade = glade_xml_new (EVOLUTION_GLADEDIR "/e-shell-config-default-folders.glade", NULL, NULL);
setup_folder_selector (dfc, "default_mail_button",
&dfc->mail_path, "/DefaultFolders/mail_path",
&dfc->mail_uri, "/DefaultFolders/mail_uri",
&dfc->mail_path, "/apps/evolution/shell/default_folders/mail_path",
&dfc->mail_uri, "/apps/evolution/shell/default_folders/mail_uri",
mail_types);
setup_folder_selector (dfc, "default_contacts_button",
&dfc->contacts_path, "/DefaultFolders/contacts_path",
&dfc->contacts_uri, "/DefaultFolders/contacts_uri",
&dfc->contacts_path, "/apps/evolution/shell/default_folders/contacts_path",
&dfc->contacts_uri, "/apps/evolution/shell/default_folders/contacts_uri",
contacts_types);
setup_folder_selector (dfc, "default_calendar_button",
&dfc->calendar_path, "/DefaultFolders/calendar_path",
&dfc->calendar_uri, "/DefaultFolders/calendar_uri",
&dfc->calendar_path, "/apps/evolution/shell/default_folders/calendar_path",
&dfc->calendar_uri, "/apps/evolution/shell/default_folders/calendar_uri",
calendar_types);
setup_folder_selector (dfc, "default_tasks_button",
&dfc->tasks_path, "/DefaultFolders/tasks_path",
&dfc->tasks_uri, "/DefaultFolders/tasks_uri",
&dfc->tasks_path, "/apps/evolution/shell/default_folders/tasks_path",
&dfc->tasks_uri, "/apps/evolution/shell/default_folders/tasks_uri",
tasks_types);
widget = glade_xml_get_widget (dfc->glade, "default_folders_table");

View File

@ -30,8 +30,6 @@
#include "evolution-config-control.h"
#include "e-storage-set-view.h"
#include "e-util/e-config-listener.h"
#include "Evolution.h"
#include <bonobo/bonobo-exception.h>

View File

@ -26,7 +26,13 @@
#include "e-shell-startup-wizard.h"
#include <errno.h>
#include "e-timezone-dialog/e-timezone-dialog.h"
#include "e-util/e-gtk-utils.h"
#include <gconf/gconf-client.h>
#include <evolution-wizard.h>
#include "Evolution.h"
#include <glib.h>
#include <gtk/gtk.h>
@ -44,13 +50,6 @@
#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
#include "e-timezone-dialog/e-timezone-dialog.h"
#include "e-util/e-gtk-utils.h"
#include "e-util/e-config-listener.h"
#include <evolution-wizard.h>
#include "Evolution.h"
typedef struct _TimezoneDialogPage {
GtkWidget *page;
GtkWidget *vbox;
@ -95,8 +94,6 @@ typedef struct _SWData {
CORBA_Object mailer;
Bonobo_EventSource event_source;
BonoboListener *listener;
EConfigListener *config_listener;
} SWData;
typedef struct _IntelligentImporterData {
@ -338,6 +335,7 @@ finish_func (GnomeDruidPage *page,
GnomeDruid *druid,
SWData *data)
{
GConfClient *client;
CORBA_Environment ev;
const char *displayname;
char *tz;
@ -358,8 +356,11 @@ finish_func (GnomeDruidPage *page,
tz = g_strdup ("UTC");
else
tz = g_strdup (icaltimezone_get_location (zone));
e_config_listener_set_string (data->config_listener, "/Calendar/Display/Timezone", tz);
client = gconf_client_get_default ();
gconf_client_set_string (client, "/apps/evolution/calendar/display/timezone", tz, NULL);
g_object_unref (client);
g_free (tz);
do_import (data);
@ -843,23 +844,24 @@ startup_wizard_cancel (GnomeDruid *druid,
gboolean
e_shell_startup_wizard_create (void)
{
GConfClient *client;
SWData *data;
int num_accounts;
GSList *accounts;
return TRUE;
data = g_new0 (SWData, 1);
client = gconf_client_get_default ();
accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
g_object_unref (client);
data->config_listener = e_config_listener_new();
num_accounts = e_config_listener_get_long_with_default (data->config_listener, "/Mail/Accounts/num", 0, NULL);
if (num_accounts != 0) {
g_object_unref (data->config_listener);
g_free (data);
if (accounts != NULL) {
g_slist_foreach (accounts, (GFunc) g_free, NULL);
g_slist_free (accounts);
return TRUE;
}
data = g_new0 (SWData, 1);
data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/evolution-startup-wizard.glade", NULL, NULL);
g_return_val_if_fail (data->wizard != NULL, FALSE);
data->dialog = glade_xml_get_widget (data->wizard, "startup-wizard");
@ -907,8 +909,5 @@ e_shell_startup_wizard_create (void)
gtk_main ();
g_object_unref (data->config_listener);
data->config_listener = NULL;
return !data->cancel;
}

View File

@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-shell-view.c
*
* Copyright (C) 2000, 2001 Ximian, Inc.
* Copyright (C) 2000, 2001, 2002 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@ -64,6 +64,8 @@
#include <libgnomeui/gnome-window-icon.h>
#include <libgnomeui/gnome-app.h>
#include <gconf/gconf-client.h>
#include <bonobo/bonobo-socket.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-ui-container.h>
@ -379,6 +381,82 @@ remove_uri_from_history (EShellView *shell_view,
e_history_remove_matching (priv->history, uri, history_uri_matching_func);
}
static void
setup_defaults (EShellView *shell_view,
gboolean setup_default_uri)
{
EShellViewPrivate *priv;
EShortcutBar *shortcut_bar;
GConfClient *client;
GSList *icon_types_list;
GSList *p;
char *path;
char *uri;
int shortcut_group;
int width;
int i;
g_return_if_fail (shell_view != NULL);
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
priv = shell_view->priv;
shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar);
client = gconf_client_get_default ();
gtk_window_set_default_size (GTK_WINDOW (shell_view),
gconf_client_get_int (client, "/apps/evolution/shell/view_defaults/width", NULL),
gconf_client_get_int (client, "/apps/evolution/shell/view_defaults/height", NULL));
shortcut_group = gconf_client_get_int (client, "/apps/evolution/shell/view_defaults/selected_shortcut_group", NULL);
e_shell_view_set_current_shortcuts_group_num (shell_view, shortcut_group);
e_shell_view_show_folder_bar (shell_view,
gconf_client_get_bool (client, "/apps/evolution/shell/view_defaults/show_folder_bar", NULL));
e_shell_view_show_shortcut_bar (shell_view,
gconf_client_get_bool (client, "/apps/evolution/shell/view_defaults/show_shortcut_bar", NULL));
width = gconf_client_get_int (client, "/apps/evolution/shell/view_defaults/shortcut_bar/width", NULL);
if (priv->shortcut_bar_shown)
e_paned_set_position (E_PANED (priv->hpaned), width);
priv->hpaned_position = width;
width = gconf_client_get_int (client, "/apps/evolution/shell/view_defaults/folder_bar/width", NULL);
if (priv->folder_bar_shown)
e_paned_set_position (E_PANED (priv->view_hpaned), width);
priv->view_hpaned_position = width;
if (setup_default_uri) {
path = gconf_client_get_string (client, "/apps/evolution/shell/view_defaults/folder_path", NULL);
uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
if (! e_shell_view_display_uri (shell_view, uri, FALSE)) {
e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI, FALSE);
e_shell_view_display_uri (shell_view, uri, TRUE);
}
g_free (path);
g_free (uri);
}
icon_types_list = gconf_client_get_list (client, "/apps/evolution/shell/view_defaults/shortcut_bar/icon_types",
GCONF_VALUE_INT, NULL);
for (p = icon_types_list, i = 0; p != NULL; p = p->next, i++)
e_shortcut_bar_set_view_type (shortcut_bar, i, GPOINTER_TO_INT (p->data));
g_slist_free (icon_types_list);
#if 0
/* Load the expanded state for the ShellView's StorageSetView */
filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d",
e_shell_get_local_directory (priv->shell),
view_num);
e_tree_load_expanded_state (E_TREE (priv->storage_set_view),
filename);
g_free (filename);
#endif
}
/* This implements the behavior for when the folder which is currently displayed
gets deleted. */
@ -1681,7 +1759,8 @@ delete_event_cb (GtkWidget *widget,
EShellView *
e_shell_view_construct (EShellView *shell_view,
EShell *shell)
EShell *shell,
const char *uri)
{
EShellViewPrivate *priv;
EShellView *view;
@ -1744,6 +1823,8 @@ e_shell_view_construct (EShellView *shell_view,
e_shell_user_creatable_items_handler_attach_menus (e_shell_get_user_creatable_items_handler (priv->shell),
shell_view);
setup_defaults (view, uri != NULL);
return view;
}
@ -1753,7 +1834,8 @@ e_shell_view_construct (EShellView *shell_view,
bookkeeping for the created views. Instead, the right way to create a new
view is calling `e_shell_create_view()'. */
EShellView *
e_shell_view_new (EShell *shell)
e_shell_view_new (EShell *shell,
const char *uri)
{
GtkWidget *new;
@ -1762,7 +1844,7 @@ e_shell_view_new (EShell *shell)
new = g_object_new (e_shell_view_get_type (), NULL);
return e_shell_view_construct (E_SHELL_VIEW (new), shell);
return e_shell_view_construct (E_SHELL_VIEW (new), shell, uri);
}
const GNOME_Evolution_ShellView
@ -2676,92 +2758,78 @@ e_shell_view_get_current_component_id (EShellView *shell_view)
/**
* e_shell_view_save_settings:
* e_shell_view_save_defaults:
* @shell_view:
* @prefix:
*
* 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,
int view_num)
void
e_shell_view_save_defaults (EShellView *shell_view)
{
EConfigListener *config_listener;
GConfClient *client;
EShellViewPrivate *priv;
EShortcutBar *shortcut_bar;
GSList *shortcut_view_type_list;
const char *uri;
char *prefix, *key;
char *filename;
int num_groups;
int group;
struct stat temp;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
g_return_if_fail (shell_view != NULL);
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
priv = shell_view->priv;
shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar);
config_listener = e_config_listener_new ();
client = gconf_client_get_default ();
prefix = g_strdup_printf ("/Shell/Views/%d/", view_num);
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/width",
GTK_WIDGET (shell_view)->allocation.width, NULL);
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/height",
GTK_WIDGET (shell_view)->allocation.height, NULL);
key = g_strconcat (prefix, "Width", NULL);
e_config_listener_set_long (config_listener, key, GTK_WIDGET (shell_view)->allocation.width);
g_free (key);
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/selected_shortcut_group",
e_shell_view_get_current_shortcuts_group_num (shell_view), NULL);
key = g_strconcat (prefix, "Height", NULL);
e_config_listener_set_long (config_listener, key, GTK_WIDGET (shell_view)->allocation.height);
g_free (key);
gconf_client_set_bool (client, "/apps/evolution/shell/view_defaults/show_folder_bar",
e_shell_view_folder_bar_shown (shell_view), NULL);
gconf_client_set_bool (client, "/apps/evolution/shell/view_defaults/show_shortcut_bar",
e_shell_view_shortcut_bar_shown (shell_view), NULL);
key = g_strconcat (prefix, "CurrentShortcutsGroupNum", NULL);
e_config_listener_set_long (config_listener, key,
e_shell_view_get_current_shortcuts_group_num (shell_view));
g_free (key);
key = g_strconcat (prefix, "FolderBarShown", NULL);
e_config_listener_set_long (config_listener, key, e_shell_view_folder_bar_shown (shell_view));
g_free (key);
key = g_strconcat (prefix, "ShortcutBarShown", NULL);
e_config_listener_set_long (config_listener, key, e_shell_view_shortcut_bar_shown (shell_view));
g_free (key);
key = g_strconcat (prefix, "HPanedPosition", NULL);
if (GTK_WIDGET_VISIBLE (priv->shortcut_frame))
e_config_listener_set_long (config_listener, key, E_PANED (priv->hpaned)->child1_size);
if (priv->shortcut_bar_shown)
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/shortcut_bar/width",
E_PANED (priv->hpaned)->child1_size, NULL);
else
e_config_listener_set_long (config_listener, key, priv->hpaned_position);
g_free (key);
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/shortcut_bar/width",
priv->hpaned_position, NULL);
key = g_strconcat (prefix, "ViewHPanedPosition", NULL);
if (GTK_WIDGET_VISIBLE (priv->storage_set_view_box))
e_config_listener_set_long (config_listener, key, E_PANED (priv->view_hpaned)->child1_size);
if (priv->folder_bar_shown)
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/folder_bar/width",
E_PANED (priv->view_hpaned)->child1_size, NULL);
else
e_config_listener_set_long (config_listener, key, priv->view_hpaned_position);
g_free (key);
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/folder_bar/width",
priv->view_hpaned_position, NULL);
key = g_strconcat (prefix, "DisplayedURI", NULL);
uri = e_shell_view_get_current_uri (shell_view);
if (uri != NULL)
e_config_listener_set_string (config_listener, key, uri);
gconf_client_set_string (client, "/apps/evolution/shell/view_defaults/folder_path",
uri + E_SHELL_URI_PREFIX_LEN, NULL);
else
e_config_listener_set_string (config_listener, key, E_SHELL_VIEW_DEFAULT_URI);
g_free (key);
gconf_client_unset (client, "/apps/evolution/shell/view_defaults/folder_path", NULL);
num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
shortcut_view_type_list = NULL;
for (group = 0; group < num_groups; group++) {
key = g_strdup_printf ("%sShortcutBarGroup%dIconMode", prefix,
group);
e_config_listener_set_long (config_listener, key,
e_shortcut_bar_get_view_type (shortcut_bar, group));
g_free (key);
EIconBarViewType view_type;
view_type = e_shortcut_bar_get_view_type (shortcut_bar, group);
shortcut_view_type_list = g_slist_prepend (shortcut_view_type_list, GINT_TO_POINTER (view_type));
}
g_free (prefix);
gconf_client_set_list (client, "/apps/evolution/shell/view_defaults/shortcut_bar/icon_types",
GCONF_VALUE_INT, shortcut_view_type_list, NULL);
g_slist_free (shortcut_view_type_list);
/* If ~/evolution/config/ doesn't exist yet, make it */
filename = g_strdup_printf ("%s/config/", e_shell_get_local_directory (priv->shell));
@ -2769,6 +2837,7 @@ e_shell_view_save_settings (EShellView *shell_view,
mkdir (filename, S_IRWXU);
g_free (filename);
#if 0
/* Save the expanded state for this ShellView's StorageSetView */
filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d",
e_shell_get_local_directory (priv->shell),
@ -2776,110 +2845,9 @@ e_shell_view_save_settings (EShellView *shell_view,
e_tree_save_expanded_state (E_TREE (priv->storage_set_view),
filename);
g_free (filename);
#endif
return TRUE;
}
/**
* e_shell_view_load_settings:
* @shell_view:
* @prefix:
*
* Load settings for @shell_view at the specified gnome config @prefix
*
* Return value:
**/
gboolean
e_shell_view_load_settings (EShellView *shell_view,
int view_num)
{
EShellViewPrivate *priv;
EShortcutBar *shortcut_bar;
EConfigListener *config_listener;
int num_groups, val;
long width, height;
char *stringval, *prefix, *filename, *key;
CORBA_Environment ev;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
priv = shell_view->priv;
shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar);
config_listener = e_config_listener_new ();
prefix = g_strdup_printf ("/Shell/Views/%d/", view_num);
CORBA_exception_init (&ev);
key = g_strconcat (prefix, "Width", NULL);
width = e_config_listener_get_long_with_default (config_listener, key, 0, NULL);
g_free (key);
key = g_strconcat (prefix, "Height", NULL);
height = e_config_listener_get_long_with_default (config_listener, key, 0, NULL);
g_free (key);
gtk_window_set_default_size (GTK_WINDOW (shell_view), width, height);
key = g_strconcat (prefix, "CurrentShortcutsGroupNum", NULL);
val = e_config_listener_get_long_with_default (config_listener, key, 0, NULL);
e_shell_view_set_current_shortcuts_group_num (shell_view, val);
g_free (key);
key = g_strconcat (prefix, "FolderBarShown", NULL);
val = e_config_listener_get_long_with_default (config_listener, key, 0, NULL);
e_shell_view_show_folder_bar (shell_view, val);
g_free (key);
key = g_strconcat (prefix, "ShortcutBarShown", NULL);
val = e_config_listener_get_long_with_default (config_listener, key, 0, NULL);
e_shell_view_show_shortcut_bar (shell_view, val);
g_free (key);
key = g_strconcat (prefix, "HPanedPosition", NULL);
val = e_config_listener_get_long_with_default (config_listener, key, 0, NULL);
if (priv->shortcut_bar_shown)
e_paned_set_position (E_PANED (priv->hpaned), val);
priv->hpaned_position = val;
g_free (key);
key = g_strconcat (prefix, "ViewHPanedPosition", NULL);
val = e_config_listener_get_long_with_default (config_listener, key, 0, NULL);
if (priv->folder_bar_shown)
e_paned_set_position (E_PANED (priv->view_hpaned), val);
priv->view_hpaned_position = val;
g_free (key);
if (priv->uri == NULL && priv->delayed_selection == NULL) {
key = g_strconcat (prefix, "DisplayedURI", NULL);
stringval = e_config_listener_get_string_with_default (config_listener, key, NULL, NULL);
if (stringval) {
if (! e_shell_view_display_uri (shell_view, stringval, FALSE)) {
e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI, FALSE);
e_shell_view_display_uri (shell_view, stringval, TRUE);
}
} else {
e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI, TRUE);
}
g_free (stringval);
g_free (key);
}
num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
g_free (prefix);
/* Load the expanded state for the ShellView's StorageSetView */
filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d",
e_shell_get_local_directory (priv->shell),
view_num);
e_tree_load_expanded_state (E_TREE (priv->storage_set_view),
filename);
g_free (filename);
return TRUE;
g_object_unref (client);
}

View File

@ -81,8 +81,10 @@ struct _EShellViewClass {
GtkType e_shell_view_get_type (void);
EShellView *e_shell_view_construct (EShellView *shell_view,
EShell *shell);
EShellView *e_shell_view_new (EShell *shell);
EShell *shell,
const char *uri);
EShellView *e_shell_view_new (EShell *shell,
const char *uri);
const GNOME_Evolution_ShellView e_shell_view_get_corba_interface (EShellView *view);
@ -110,10 +112,7 @@ const char *e_shell_view_get_current_folder_type (EShellView *shell_vi
const char *e_shell_view_get_current_component_id (EShellView *shell_view);
const char *e_shell_view_get_current_path (EShellView *shell_view);
gboolean e_shell_view_save_settings (EShellView *shell_view,
int view_num);
gboolean e_shell_view_load_settings (EShellView *shell_view,
int view_num);
void e_shell_view_save_defaults (EShellView *shell_view);
int e_shell_view_get_current_shortcuts_group_num (EShellView *shell_view);
void e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view,

View File

@ -24,28 +24,7 @@
#include <config.h>
#endif
#include <glib.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
/* (For the displayName stuff.) */
#include <gdk/gdkprivate.h>
#include <X11/Xlib.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/util/e-util.h>
#include "Evolution.h"
#include "e-shell.h"
#include "e-util/e-dialog-utils.h"
@ -74,10 +53,33 @@
#include "evolution-shell-component-utils.h"
#include "evolution-storage-set-view-factory.h"
#include "e-shell.h"
#include "importer/intelligent.h"
#include <glib.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
/* (For the displayName stuff.) */
#include <gdk/gdkprivate.h>
#include <X11/Xlib.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/util/e-util.h>
#include <gconf/gconf-client.h>
#include "Evolution.h"
#define PARENT_TYPE bonobo_x_object_get_type ()
static BonoboXObjectClass *parent_class = NULL;
@ -124,9 +126,6 @@ struct _EShellPrivate {
/* Settings Dialog */
GtkWidget *settings_dialog;
/* Configuration Database */
EConfigListener *config_listener;
/* Whether the shell is succesfully initialized. This is needed during
the start-up sequence, to avoid CORBA calls to do make wrong things
to happen while the shell is initializing. */
@ -179,6 +178,21 @@ pop_up_activation_error_dialog (ESplash *splash,
g_free (error_message);
}
static gboolean
get_config_start_offline (void)
{
GConfClient *client;
gboolean value;
client = gconf_client_get_default ();
value = gconf_client_get_bool (client, "/apps/evolution/shell/start_offline", NULL);
g_object_unref (client);
return value;
}
/* Interactivity handling. */
@ -415,7 +429,7 @@ impl_Shell_createNewView (PortableServer_Servant servant,
return CORBA_OBJECT_NIL;
}
shell_view = e_shell_create_view_from_uri_and_settings (shell, uri, 0);
shell_view = e_shell_create_view (shell, uri, NULL);
if (shell_view == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Shell_NotFound, NULL);
@ -452,7 +466,7 @@ impl_Shell_handleURI (PortableServer_Servant servant,
if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0
|| strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0) {
e_shell_create_view_from_uri_and_settings (shell, uri, 0);
e_shell_create_view (shell, uri, NULL);
return;
}
@ -1008,7 +1022,7 @@ create_view (EShell *shell,
priv = shell->priv;
view = e_shell_view_new (shell);
view = e_shell_view_new (shell, uri);
g_signal_connect (view, "delete_event",
G_CALLBACK (view_delete_event_cb), shell);
@ -1121,11 +1135,6 @@ impl_dispose (GObject *object)
priv->settings_dialog = NULL;
}
if (priv->config_listener != NULL) {
g_object_unref (priv->config_listener);
priv->config_listener = NULL;
}
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
@ -1229,7 +1238,6 @@ init (EShell *shell)
priv->crash_type_names = NULL;
priv->line_status = E_SHELL_LINE_STATUS_OFFLINE;
priv->settings_dialog = NULL;
priv->config_listener = e_config_listener_new();
priv->is_initialized = FALSE;
priv->is_interactive = FALSE;
priv->preparing_to_quit = FALSE;
@ -1299,7 +1307,7 @@ e_shell_construct (EShell *shell,
if (! setup_corba_storages (shell))
return FALSE;
e_setup_check_config (priv->config_listener, local_directory);
e_setup_check_config (local_directory);
/* Now we can register into OAF. Notice that we shouldn't be
registering into OAF until we are sure we can complete. */
@ -1369,9 +1377,7 @@ e_shell_construct (EShell *shell,
switch (startup_line_mode) {
case E_SHELL_STARTUP_LINE_MODE_CONFIG:
start_online = ! e_config_listener_get_boolean_with_default (priv->config_listener,
"/Shell/StartOffline", FALSE,
NULL);
start_online = ! get_config_start_offline ();
break;
case E_SHELL_STARTUP_LINE_MODE_ONLINE:
start_online = TRUE;
@ -1475,28 +1481,6 @@ e_shell_create_view (EShell *shell,
return view;
}
EShellView *
e_shell_create_view_from_uri_and_settings (EShell *shell,
const char *uri,
int view_num)
{
EShellView *view;
g_return_val_if_fail (shell != NULL, NULL);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
view = create_view (shell, uri, NULL);
e_shell_view_load_settings (view, view_num);
gtk_widget_show (GTK_WIDGET (view));
while (gtk_events_pending ())
gtk_main_iteration ();
set_interactive (shell, TRUE);
return view;
}
gboolean
e_shell_request_close_view (EShell *shell,
EShellView *shell_view)
@ -1696,13 +1680,17 @@ save_settings_for_components (EShell *shell)
static gboolean
save_misc_settings (EShell *shell)
{
GConfClient *client;
EShellPrivate *priv;
gboolean is_offline;
priv = shell->priv;
is_offline = ( e_shell_get_line_status (shell) == E_SHELL_LINE_STATUS_OFFLINE );
e_config_listener_set_boolean (priv->config_listener, "/Shell/StartOffline", is_offline);
client = gconf_client_get_default ();
gconf_client_set_bool (client, "/apps/evolution/shell/start_offline", is_offline, NULL);
g_object_unref (client);
return TRUE;
}
@ -1732,45 +1720,6 @@ e_shell_save_settings (EShell *shell)
return components_saved && misc_saved;
}
/**
* e_shell_restore_from_settings:
* @shell: An EShell object.
* @restore_all_views: whether to restore all the views
*
* Restore the existing views from the saved configuration. The shell must
* have no views for this to work. If @restore_all_views is TRUE, restore all
* the views; otherwise, just the first one.
*
* Return value: %FALSE if the shell has some open views or there is no saved
* configuration. %TRUE if the configuration could be restored successfully.
**/
gboolean
e_shell_restore_from_settings (EShell *shell,
gboolean restore_all_views)
{
EShellPrivate *priv;
int num_views;
int i;
g_return_val_if_fail (shell != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
g_return_val_if_fail (shell->priv->views == NULL, FALSE);
priv = shell->priv;
num_views = e_config_listener_get_long_with_default (priv->config_listener,
"/Shell/Views/NumberOfViews", 0, NULL);
for (i = 0; i < num_views; i++) {
e_shell_create_view_from_uri_and_settings (shell, NULL, i);
if (! restore_all_views)
break;
}
return (num_views > 0);
}
/**
* e_shell_destroy_all_views:
* @shell:
@ -2087,14 +2036,6 @@ e_shell_show_settings (EShell *shell, const char *type, EShellView *shell_view)
}
EConfigListener *
e_shell_get_config_listener (EShell *shell)
{
g_return_val_if_fail (E_IS_SHELL (shell), CORBA_OBJECT_NIL);
return shell->priv->config_listener;
}
EComponentRegistry *
e_shell_get_component_registry (EShell *shell)
{
@ -2133,22 +2074,6 @@ e_shell_unregister_all (EShell *shell)
priv->component_registry = NULL;
}
void
e_shell_disconnect_db (EShell *shell)
{
EShellPrivate *priv;
g_return_if_fail (E_IS_SHELL (shell));
priv = shell->priv;
if (priv->config_listener == NULL)
return;
g_object_unref (priv->config_listener);
priv->config_listener = NULL;
}
const char *
e_shell_construct_result_to_string (EShellConstructResult result)
@ -2243,10 +2168,11 @@ parse_default_uri (EShell *shell,
char **path_return,
char **extra_return)
{
GConfClient *client;
const char *component_start;
const char *component;
const char *p;
char *db_path;
char *config_path;
char *path;
gboolean is_default;
@ -2258,9 +2184,11 @@ parse_default_uri (EShell *shell,
else
component = g_strndup (component_start, p - component_start);
db_path = g_strdup_printf ("/DefaultFolders/%s_path", component);
path = e_config_listener_get_string_with_default (shell->priv->config_listener,
db_path, NULL, &is_default);
client = gconf_client_get_default ();
config_path = g_strdup_printf ("/apps/evolution/shell/default_folders/%s_path", component);
path = gconf_client_get_string (client, config_path, NULL);
g_object_unref (client);
/* We expect an evolution: URI here, if we don't get it then something
is messed up. */

View File

@ -23,8 +23,6 @@
#ifndef _E_SHELL_H_
#define _E_SHELL_H_
#include "e-util/e-config-listener.h"
#include <bonobo-activation/bonobo-activation.h>
#include <bonobo/bonobo-xobject.h>
@ -130,13 +128,10 @@ EFolderTypeRegistry *e_shell_get_folder_type_registry (EShell *shell);
EUriSchemaRegistry *e_shell_get_uri_schema_registry (EShell *shell);
gboolean e_shell_save_settings (EShell *shell);
gboolean e_shell_restore_from_settings (EShell *shell,
gboolean restore_all_views);
void e_shell_destroy_all_views (EShell *shell);
void e_shell_unregister_all (EShell *shell);
void e_shell_disconnect_db (EShell *shell);
void e_shell_component_maybe_crashed (EShell *shell,
const char *uri,
@ -157,7 +152,6 @@ void e_shell_show_settings (EShell *shell,
const char *type,
EShellView *shell_view);
EConfigListener *e_shell_get_config_listener (EShell *shell);
EComponentRegistry *e_shell_get_component_registry (EShell *shell);
EShellUserCreatableItemsHandler *e_shell_get_user_creatable_items_handler (EShell *shell);

View File

@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* main.c
*
* Copyright (C) 2000 Ximian, Inc.
* Copyright (C) 2000, 2001, 2002 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@ -21,9 +21,17 @@
*/
#include <config.h>
#include <fcntl.h>
#include <glib.h>
#include <stdio.h>
#include "e-util/e-gtk-utils.h"
#include "e-icon-factory.h"
#include "e-shell-constants.h"
#include "e-shell-config.h"
#include "e-setup.h"
#include "e-shell.h"
#include <gconf/gconf-client.h>
#include <gtk/gtkalignment.h>
#include <gtk/gtkframe.h>
@ -55,18 +63,12 @@
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-cursors.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "e-util/e-gtk-utils.h"
#include "e-icon-factory.h"
#include "e-shell-constants.h"
#include "e-shell-config.h"
#include "e-setup.h"
#include "e-shell.h"
static EShell *shell = NULL;
static char *evolution_directory = NULL;
@ -142,29 +144,6 @@ no_views_left_cb (EShell *shell, gpointer data)
e_shell_unregister_all (shell);
/* FIXME: And this is another ugly hack. We have a strange race
condition that I cannot work around. What happens is that the
EShell object gets unreffed and its aggregate EActivityHandler gets
destroyed too. But for some reason, the EActivityHanlder GtkObject
gets freed, while its CORBA object counterpart is still an active
server. So there is a slight chance that we receive CORBA
invocation that act on an uninitialized object, and we crash. (See
#8615.)
The CORBA invocation on the dead object only happens because we
::unref the BonoboConf database server in the ::destroy method of
the shell. Since this is a CORBA call, it allows incoming CORBA
calls to happen -- and these get invoked on the partially
uninitialized object.
Since I am not 100% sure what the reason for this half-stale object
is, I am just going to make sure that no CORBA ops happen in
::destroy... And this is achieved by placing this call here. (If
the DB is disconnected, there will be no ::unref of it in
::destroy.) */
e_shell_disconnect_db (shell);
bonobo_object_unref (BONOBO_OBJECT (shell));
if (quit_box != NULL)
@ -189,16 +168,15 @@ warning_dialog_clicked_callback (GnomeDialog *dialog,
void *data)
{
GtkCheckButton *dont_bother_me_again_checkbox;
EConfigListener *config_listener;
GConfClient *client;
dont_bother_me_again_checkbox = GTK_CHECK_BUTTON (data);
config_listener = e_config_listener_new ();
e_config_listener_set_boolean (config_listener, "/Shell/skip_warning_dialog_1_1",
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dont_bother_me_again_checkbox)));
g_object_unref (config_listener);
client = gconf_client_get_default ();
gconf_client_set_bool (client, "/apps/evolution/shell/skip_warning_dialog",
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dont_bother_me_again_checkbox)),
NULL);
g_object_unref (client);
gtk_widget_destroy (GTK_WIDGET (dialog));
}
@ -210,11 +188,16 @@ show_development_warning (GtkWindow *parent)
GtkWidget *warning_dialog;
GtkWidget *dont_bother_me_again_checkbox;
GtkWidget *alignment;
EConfigListener *config_listener;
config_listener = e_shell_get_config_listener (shell);
if (e_config_listener_get_boolean_with_default (config_listener, "/Shell/skip_warning_dialog_1_1", FALSE, NULL))
GConfClient *client;
client = gconf_client_get_default ();
if (gconf_client_get_bool (client, "/apps/evolution/shell/skip_warning_dialog", NULL)) {
g_object_unref (client);
return;
}
g_object_unref (client);
warning_dialog = gnome_dialog_new ("Ximian Evolution " VERSION, GNOME_STOCK_BUTTON_OK, NULL);
gtk_window_set_transient_for (GTK_WINDOW (warning_dialog), parent);
@ -242,11 +225,8 @@ show_development_warning (GtkWindow *parent)
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox),
label, TRUE, TRUE, 4);
label = gtk_label_new (
_(
"Thanks\n"
"The Ximian Evolution Team\n"
));
label = gtk_label_new (_("Thanks\n"
"The Ximian Evolution Team\n"));
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment(GTK_MISC(label), 1, .5);
@ -299,6 +279,7 @@ new_view_created_callback (EShell *shell,
static void
upgrade_from_1_0_if_needed (void)
{
#if 0
EConfigListener *config_listener;
int result;
@ -321,6 +302,7 @@ upgrade_from_1_0_if_needed (void)
e_config_listener_set_boolean (config_listener, "/Shell/upgrade_from_1_0_to_1_2_performed", TRUE);
g_object_unref (config_listener);
#endif /* FIXME */
}
@ -402,24 +384,19 @@ idle_cb (void *data)
}
if (shell == NULL) {
/* We're talking to a remote shell. If the user didn't
* ask us to open any particular URI, then open another
* view of the default URI
*/
/* We're talking to a remote shell. If the user didn't ask us to open any particular
URI, then open another view of the default URI. */
if (uri_list == NULL)
display_default = TRUE;
else
display_default = FALSE;
} else {
/* We're starting a new shell. If the user didn't specify
* any evolution: URIs to view, AND we can't load the
* user's previous settings, then show the default URI.
*/
/* We're starting a new shell. If the user didn't specify any evolution: URIs to
view, AND we can't load the user's previous settings, then show the default
URI. */
if (! have_evolution_uri) {
if (! e_shell_restore_from_settings (shell, FALSE))
display_default = TRUE;
else
display_default = FALSE;
e_shell_create_view (shell, NULL, NULL);
display_default = TRUE;
} else {
display_default = FALSE;
}