aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-12-05 00:09:27 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-12-05 00:09:27 +0800
commited458bfc2a20b5de9b95834dcf4a2e764f0f270e (patch)
tree04e5fa0d9f685bf3b233497a28b184926f02a9d9
parent32d142ec2ea20842431397486c9e3fa92e952db4 (diff)
downloadgsoc2013-evolution-ed458bfc2a20b5de9b95834dcf4a2e764f0f270e.tar
gsoc2013-evolution-ed458bfc2a20b5de9b95834dcf4a2e764f0f270e.tar.gz
gsoc2013-evolution-ed458bfc2a20b5de9b95834dcf4a2e764f0f270e.tar.bz2
gsoc2013-evolution-ed458bfc2a20b5de9b95834dcf4a2e764f0f270e.tar.lz
gsoc2013-evolution-ed458bfc2a20b5de9b95834dcf4a2e764f0f270e.tar.xz
gsoc2013-evolution-ed458bfc2a20b5de9b95834dcf4a2e764f0f270e.tar.zst
gsoc2013-evolution-ed458bfc2a20b5de9b95834dcf4a2e764f0f270e.zip
New `createNewView' method in `Evolution::Shell'. Register the shell
at startup; if a shell is already registered, use this CORBA method to make it open a new view and exit. Also, fixed a missing ref problem with EShortcut (it used to crash on exit when more than one view was open). svn path=/trunk/; revision=6774
-rw-r--r--shell/ChangeLog41
-rw-r--r--shell/Evolution-Shell.idl8
-rw-r--r--shell/GNOME_Evolution_Shell.oaf.in15
-rw-r--r--shell/GNOME_Evolution_Shell.oafinfo15
-rw-r--r--shell/Makefile.am7
-rw-r--r--shell/e-shell-view.c63
-rw-r--r--shell/e-shell-view.h37
-rw-r--r--shell/e-shell.c106
-rw-r--r--shell/e-shell.h29
-rw-r--r--shell/e-shortcuts-view.c2
-rw-r--r--shell/evolution.oafinfo15
-rw-r--r--shell/main.c39
12 files changed, 296 insertions, 81 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 5673ecb114..df600ac65c 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,44 @@
+2000-12-04 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shortcuts-view.c (e_shortcuts_view_construct): Ref the
+ shortcuts.
+
+ * main.c (new_view_on_running_shell): New.
+ (idle_cb): If the shell cannot be created, then call
+ `new_view_on_running_shell'.
+
+ * e-shell-view.c: New member `shell_view_interface' in
+ `EShellViewPrivate'.
+ (init): Init to NULL.
+ (setup_evolution_shell_view_interface): Set up.
+ (destroy): Unref.
+
+ * e-shell.c (impl_Shell_getComponentByType): Renamed from
+ `impl_Shell_get_component_for_type'.
+ (impl_Shell_selectUserFolder): Renamed from
+ `impl_Shell_user_select_folder'.
+ (impl_Shell_getLocalStorage): Renamed from
+ `impl_Shell_get_local_storage'.
+ (impl_Shell_createStorageSetView): Renamed from
+ `impl_Shell_create_storage_set_view'.
+ (corba_class_init): Updated accordingly.
+ (impl_Shell_createNewView): New, implementation for the
+ `createNewView' CORBA method.
+ (corba_class_init): Install it.
+
+ * Evolution-Shell.idl: New method `::createNewView'.
+
+ * e-shell.c (register_shell): New.
+ (e_shell_construct): Return value changed to `gboolean'. New arg
+ @iid. Construct the Bonobo object before displaying the splash,
+ then try to register it with the specified @iid. If registration
+ fails, return %FALSE. Otherwise, just do everything normally and
+ return %TRUE.
+ (e_shell_new): Pass the OAFIID to `e_shell_construct()'. If it
+ fails, unref the object and return NULL.
+
+ * evolution.oafinfo: New.
+
2000-11-27 JP Rosevear <jpr@helixcode.com>
* e-shell-view-menu.c (command_about_box): Add myself, anna, jesse
diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl
index 7a06d902d4..f2124c40c8 100644
--- a/shell/Evolution-Shell.idl
+++ b/shell/Evolution-Shell.idl
@@ -35,6 +35,14 @@ module Evolution {
typedef sequence<string> FolderTypeList;
/**
+ * createNewView:
+ * @uri: URI for the view to open
+ *
+ * Return value: the new view.
+ */
+ ShellView createNewView (in string uri);
+
+ /**
* selectUserFolder:
* @listener: a listener interface to report the answer of the user.
* @title: title for the folder selector dialog
diff --git a/shell/GNOME_Evolution_Shell.oaf.in b/shell/GNOME_Evolution_Shell.oaf.in
new file mode 100644
index 0000000000..3f84707c93
--- /dev/null
+++ b/shell/GNOME_Evolution_Shell.oaf.in
@@ -0,0 +1,15 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:evolution:584cc84c-27d4-42c8-ae4d-39a64bdefbd2"
+ type="exe"
+ location="evolution">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/Evolution/Shell:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="The Evolution shell."/>
+</oaf_server>
+
+</oaf_info>
diff --git a/shell/GNOME_Evolution_Shell.oafinfo b/shell/GNOME_Evolution_Shell.oafinfo
new file mode 100644
index 0000000000..3f84707c93
--- /dev/null
+++ b/shell/GNOME_Evolution_Shell.oafinfo
@@ -0,0 +1,15 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:evolution:584cc84c-27d4-42c8-ae4d-39a64bdefbd2"
+ type="exe"
+ location="evolution">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/Evolution/Shell:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="The Evolution shell."/>
+</oaf_server>
+
+</oaf_info>
diff --git a/shell/Makefile.am b/shell/Makefile.am
index beb9ccbcbc..5e2c3e9a34 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -13,8 +13,6 @@ INCLUDES = \
-DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" \
-DG_LOG_DOMAIN=\"evolution-shell\"
-EXTRA_DIST = $(IDLS)
-
CLEANFILES = $(IDL_GENERATED)
# CORBA stuff
@@ -141,6 +139,11 @@ evolution_LDADD = \
$(GNOME_PRINT_LIBS) \
$(BONOBO_GNOME_LIBS)
+oafdir = $(datadir)/oaf
+oaf_DATA = evolution.oafinfo
+
+EXTRA_DIST = $(IDLS) $(oaf_DATA)
+
# Purify support
if ENABLE_PURIFY
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 774de785d4..884396d149 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -62,6 +62,10 @@ struct _EShellViewPrivate {
/* The shell. */
EShell *shell;
+ /* EvolutionShellView Bonobo object for implementing the
+ Evolution::ShellView interface. */
+ EvolutionShellView *corba_interface;
+
/* The UI handler. */
BonoboUIComponent *ui_component;
@@ -555,6 +559,9 @@ destroy (GtkObject *object)
shell_view = E_SHELL_VIEW (object);
priv = shell_view->priv;
+ if (priv->corba_interface != NULL)
+ bonobo_object_unref (BONOBO_OBJECT (priv->corba_interface));
+
for (p = priv->sockets; p != NULL; p = p->next) {
GtkWidget *socket_widget;
int destroy_connection_id;
@@ -636,6 +643,7 @@ init (EShellView *shell_view)
priv = g_new (EShellViewPrivate, 1);
priv->shell = NULL;
+ priv->corba_interface = NULL;
priv->ui_component = NULL;
priv->uri = NULL;
priv->delayed_selection = NULL;
@@ -735,7 +743,7 @@ stop_progress_bar (EShellView *shell_view)
/* EvolutionShellView interface callbacks. */
static void
-shell_view_interface_set_message_cb (EvolutionShellView *shell_view,
+corba_interface_set_message_cb (EvolutionShellView *shell_view,
const char *message,
gboolean busy,
void *data)
@@ -770,7 +778,7 @@ shell_view_interface_set_message_cb (EvolutionShellView *shell_view,
}
static void
-shell_view_interface_unset_message_cb (EvolutionShellView *shell_view,
+corba_interface_unset_message_cb (EvolutionShellView *shell_view,
void *data)
{
EShellView *view;
@@ -785,7 +793,7 @@ shell_view_interface_unset_message_cb (EvolutionShellView *shell_view,
}
static void
-shell_view_interface_change_current_view_cb (EvolutionShellView *shell_view,
+corba_interface_change_current_view_cb (EvolutionShellView *shell_view,
const char *uri,
void *data)
{
@@ -799,7 +807,7 @@ shell_view_interface_change_current_view_cb (EvolutionShellView *shell_view,
}
static void
-shell_view_interface_set_title (EvolutionShellView *shell_view,
+corba_interface_set_title (EvolutionShellView *shell_view,
const char *title,
void *data)
{
@@ -895,6 +903,19 @@ e_shell_view_new (EShell *shell)
return e_shell_view_construct (E_SHELL_VIEW (new), shell);
}
+const GNOME_Evolution_ShellView
+e_shell_view_get_corba_interface (EShellView *shell_view)
+{
+ EShellViewPrivate *priv;
+
+ g_return_val_if_fail (shell_view != NULL, CORBA_OBJECT_NIL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), CORBA_OBJECT_NIL);
+
+ priv = shell_view->priv;
+
+ return bonobo_object_corba_objref (BONOBO_OBJECT (priv->corba_interface));
+}
+
static const char *
get_storage_set_path_from_uri (const char *uri)
@@ -1080,30 +1101,36 @@ set_current_notebook_page (EShellView *shell_view,
}
static void
-setup_evolution_shell_view_interface (EShellView *shell_view,
- GtkWidget *control)
+setup_corba_interface (EShellView *shell_view,
+ GtkWidget *control)
{
+ EShellViewPrivate *priv;
BonoboControlFrame *control_frame;
- EvolutionShellView *shell_view_interface;
+ EvolutionShellView *corba_interface;
+
+ priv = shell_view->priv;
control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (control));
- shell_view_interface = evolution_shell_view_new ();
+ corba_interface = evolution_shell_view_new ();
- gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "set_message",
- GTK_SIGNAL_FUNC (shell_view_interface_set_message_cb),
+ gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_message",
+ GTK_SIGNAL_FUNC (corba_interface_set_message_cb),
shell_view, GTK_OBJECT (shell_view));
- gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "unset_message",
- GTK_SIGNAL_FUNC (shell_view_interface_unset_message_cb),
+ gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "unset_message",
+ GTK_SIGNAL_FUNC (corba_interface_unset_message_cb),
shell_view, GTK_OBJECT (shell_view));
- gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "change_current_view",
- GTK_SIGNAL_FUNC (shell_view_interface_change_current_view_cb),
+ gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "change_current_view",
+ GTK_SIGNAL_FUNC (corba_interface_change_current_view_cb),
shell_view, GTK_OBJECT (shell_view));
- gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "set_title",
- GTK_SIGNAL_FUNC (shell_view_interface_set_title),
+ gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_title",
+ GTK_SIGNAL_FUNC (corba_interface_set_title),
shell_view, GTK_OBJECT (shell_view));
bonobo_object_add_interface (BONOBO_OBJECT (control_frame),
- BONOBO_OBJECT (shell_view_interface));
+ BONOBO_OBJECT (corba_interface));
+
+ bonobo_object_ref (BONOBO_OBJECT (corba_interface));
+ priv->corba_interface = corba_interface;
}
@@ -1250,7 +1277,7 @@ get_control_for_uri (EShellView *shell_view,
priv->sockets = g_list_prepend (priv->sockets, socket);
- setup_evolution_shell_view_interface (shell_view, control);
+ setup_corba_interface (shell_view, control);
return control;
}
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index d3eb889fec..520f9842a3 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -70,30 +70,33 @@ 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);
+GtkType e_shell_view_get_type (void);
+EShellView *e_shell_view_construct (EShellView *shell_view,
+ EShell *shell);
+EShellView *e_shell_view_new (EShell *shell);
-gboolean e_shell_view_display_uri (EShellView *shell_view,
- const char *uri);
+const GNOME_Evolution_ShellView e_shell_view_get_corba_interface (EShellView *view);
+
+gboolean e_shell_view_display_uri (EShellView *shell_view,
+ const char *uri);
void e_shell_view_set_shortcut_bar_mode (EShellView *shell_view,
EShellViewSubwindowMode mode);
-void e_shell_view_set_folder_bar_mode (EShellView *shell_view,
- EShellViewSubwindowMode mode);
EShellViewSubwindowMode e_shell_view_get_shortcut_bar_mode (EShellView *shell_view);
-EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView *shell_view);
-EShell *e_shell_view_get_shell (EShellView *shell_view);
-BonoboUIComponent *e_shell_view_get_bonobo_ui_component(EShellView *shell_view);
-GtkWidget *e_shell_view_get_appbar (EShellView *shell_view);
-const char *e_shell_view_get_current_uri (EShellView *shell_view);
+void e_shell_view_set_folder_bar_mode (EShellView *shell_view,
+ EShellViewSubwindowMode mode);
+EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView *shell_view);
+
+EShell *e_shell_view_get_shell (EShellView *shell_view);
+BonoboUIComponent *e_shell_view_get_bonobo_ui_component (EShellView *shell_view);
+GtkWidget *e_shell_view_get_appbar (EShellView *shell_view);
+const char *e_shell_view_get_current_uri (EShellView *shell_view);
-gboolean e_shell_view_save_settings (EShellView *shell_view,
- const char *prefix);
-gboolean e_shell_view_load_settings (EShellView *shell_view,
- const char *prefix);
+gboolean e_shell_view_save_settings (EShellView *shell_view,
+ const char *prefix);
+gboolean e_shell_view_load_settings (EShellView *shell_view,
+ const char *prefix);
#ifdef __cplusplus
}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index a577635bb1..99be4848bf 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -48,8 +48,6 @@
#include "e-shell.h"
-static gboolean save_settings_for_views (EShell *shell);
-
#define PARENT_TYPE BONOBO_OBJECT_TYPE
static BonoboObjectClass *parent_class = NULL;
@@ -175,9 +173,9 @@ create_servant (void)
}
static GNOME_Evolution_ShellComponent
-impl_Shell_get_component_for_type (PortableServer_Servant servant,
- const CORBA_char *type,
- CORBA_Environment *ev)
+impl_Shell_getComponentByType (PortableServer_Servant servant,
+ const CORBA_char *type,
+ CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EvolutionShellComponentClient *handler;
@@ -202,6 +200,26 @@ impl_Shell_get_component_for_type (PortableServer_Servant servant,
return CORBA_Object_duplicate (corba_component, ev);
}
+static GNOME_Evolution_ShellView
+impl_Shell_createNewView (PortableServer_Servant servant,
+ const CORBA_char *uri,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EShell *shell;
+ EShellView *shell_view;
+ GNOME_Evolution_ShellView shell_view_interface;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ shell = E_SHELL (bonobo_object);
+
+ shell_view = e_shell_new_view (shell, uri);
+ shell_view_interface = e_shell_view_get_corba_interface (shell_view);
+
+ Bonobo_Unknown_ref (shell_view_interface, ev);
+ return CORBA_Object_duplicate ((CORBA_Object) shell_view_interface, ev);
+}
+
static void
corba_listener_destroy_notify (void *data)
{
@@ -216,12 +234,12 @@ corba_listener_destroy_notify (void *data)
}
static void
-impl_Shell_user_select_folder (PortableServer_Servant servant,
- const GNOME_Evolution_FolderSelectionListener listener,
- const CORBA_char *title,
- const CORBA_char *default_folder,
- const GNOME_Evolution_Shell_FolderTypeList *corba_allowed_types,
- CORBA_Environment *ev)
+impl_Shell_selectUserFolder (PortableServer_Servant servant,
+ const GNOME_Evolution_FolderSelectionListener listener,
+ const CORBA_char *title,
+ const CORBA_char *default_folder,
+ const GNOME_Evolution_Shell_FolderTypeList *corba_allowed_types,
+ CORBA_Environment *ev)
{
GtkWidget *folder_selection_dialog;
BonoboObject *bonobo_object;
@@ -256,8 +274,8 @@ impl_Shell_user_select_folder (PortableServer_Servant servant,
}
static GNOME_Evolution_LocalStorage
-impl_Shell_get_local_storage (PortableServer_Servant servant,
- CORBA_Environment *ev)
+impl_Shell_getLocalStorage (PortableServer_Servant servant,
+ CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
GNOME_Evolution_LocalStorage local_storage_interface;
@@ -278,8 +296,8 @@ impl_Shell_get_local_storage (PortableServer_Servant servant,
}
static Bonobo_Control
-impl_Shell_create_storage_set_view (PortableServer_Servant servant,
- CORBA_Environment *ev)
+impl_Shell_createStorageSetView (PortableServer_Servant servant,
+ CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EShell *shell;
@@ -294,6 +312,21 @@ impl_Shell_create_storage_set_view (PortableServer_Servant servant,
}
+/* OAF registration. */
+
+static OAF_RegistrationResult
+register_shell (EShell *shell,
+ const char *iid)
+{
+ CORBA_Object corba_object;
+
+ /* FIXME: Multi-display stuff. */
+
+ corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell));
+ return oaf_active_server_register (iid, corba_object);
+}
+
+
/* Initialization of the storages. */
static gboolean
@@ -580,10 +613,11 @@ corba_class_init (void)
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_Shell__epv, 1);
- epv->getComponentByType = impl_Shell_get_component_for_type;
- epv->selectUserFolder = impl_Shell_user_select_folder;
- epv->getLocalStorage = impl_Shell_get_local_storage;
- epv->createStorageSetView = impl_Shell_create_storage_set_view;
+ epv->getComponentByType = impl_Shell_getComponentByType;
+ epv->createNewView = impl_Shell_createNewView;
+ epv->selectUserFolder = impl_Shell_selectUserFolder;
+ epv->getLocalStorage = impl_Shell_getLocalStorage;
+ epv->createStorageSetView = impl_Shell_createStorageSetView;
vepv = &shell_vepv;
vepv->_base_epv = base_epv;
@@ -640,15 +674,19 @@ init (EShell *shell)
* e_shell_construct:
* @shell: An EShell object to construct
* @corba_object: A CORBA Object implementing the Evolution::Shell interface
+ * @iid: OAFIID for registering the shell into the name server
* @local_directory: Local directory for storing local information and folders
* @show_splash: Whether to display a splash screen.
*
* Construct @shell so that it uses the specified @local_directory and
* @corba_object.
+ *
+ * Return value: %FALSE if the shell cannot be registered; %TRUE otherwise.
**/
-void
+gboolean
e_shell_construct (EShell *shell,
GNOME_Evolution_Shell corba_object,
+ const char *iid,
const char *local_directory,
gboolean show_splash)
{
@@ -656,11 +694,16 @@ e_shell_construct (EShell *shell,
EShellPrivate *priv;
gchar *shortcut_path;
- g_return_if_fail (shell != NULL);
- g_return_if_fail (E_IS_SHELL (shell));
- g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
- g_return_if_fail (local_directory != NULL);
- g_return_if_fail (g_path_is_absolute (local_directory));
+ g_return_val_if_fail (shell != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+ g_return_val_if_fail (corba_object != CORBA_OBJECT_NIL, FALSE);
+ g_return_val_if_fail (local_directory != NULL, FALSE);
+ g_return_val_if_fail (g_path_is_absolute (local_directory), FALSE);
+
+ bonobo_object_construct (BONOBO_OBJECT (shell), corba_object);
+
+ if (register_shell (shell, iid) != OAF_REG_SUCCESS)
+ return FALSE;
if (! show_splash) {
splash = NULL;
@@ -672,8 +715,6 @@ e_shell_construct (EShell *shell,
while (gtk_events_pending ())
gtk_main_iteration ();
- bonobo_object_construct (BONOBO_OBJECT (shell), corba_object);
-
priv = shell->priv;
priv->local_directory = g_strdup (local_directory);
@@ -686,7 +727,7 @@ e_shell_construct (EShell *shell,
/* CORBA storages must be set up before the components, because otherwise components
cannot register their own storages. */
if (! setup_corba_storages (shell))
- return;
+ return FALSE;
if (splash != NULL)
setup_components (shell, E_SPLASH (splash));
@@ -713,6 +754,8 @@ e_shell_construct (EShell *shell,
sleep (2);
gtk_widget_destroy (splash);
+
+ return TRUE;
}
/**
@@ -743,7 +786,12 @@ 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, show_splash);
+ if (! e_shell_construct (new,
+ corba_object, E_SHELL_OAFIID,
+ local_directory, show_splash)) {
+ bonobo_object_unref (BONOBO_OBJECT (new));
+ return NULL;
+ }
priv = new->priv;
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 4eb5c2c462..3548de03c7 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -30,6 +30,8 @@
#include <bonobo/bonobo-object.h>
+#include <liboaf/liboaf.h> /* For the registration stuff. */
+
#ifdef __cplusplus
extern "C" {
#pragma }
@@ -43,6 +45,7 @@ typedef struct _EShellClass EShellClass;
#include "e-shortcuts.h"
#include "e-shell-view.h"
+
#define E_TYPE_SHELL (e_shell_get_type ())
#define E_SHELL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL, EShell))
#define E_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL, EShellClass))
@@ -50,7 +53,6 @@ typedef struct _EShellClass EShellClass;
#define E_IS_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL))
-
struct _EShell {
BonoboObject parent;
@@ -64,16 +66,21 @@ struct _EShellClass {
};
-GtkType e_shell_get_type (void);
-void e_shell_construct (EShell *shell,
- GNOME_Evolution_Shell corba_object,
- const char *local_directory,
- gboolean show_splash);
-
-EShell *e_shell_new (const char *local_directory,
- gboolean show_splash);
-EShellView *e_shell_new_view (EShell *shell,
- const char *uri);
+/* ID for registering the shell in the OAF name service. */
+#define E_SHELL_OAFIID "OAFIID:evolution:584cc84c-27d4-42c8-ae4d-39a64bdefbd2"
+
+
+GtkType e_shell_get_type (void);
+gboolean e_shell_construct (EShell *shell,
+ GNOME_Evolution_Shell corba_object,
+ const char *iid,
+ const char *local_directory,
+ gboolean show_splash);
+EShell *e_shell_new (const char *local_directory,
+ gboolean show_splash);
+
+EShellView *e_shell_new_view (EShell *shell,
+ const char *uri);
const char *e_shell_get_local_directory (EShell *shell);
EShortcuts *e_shell_get_shortcuts (EShell *shell);
diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c
index a4b60eee56..59eef10833 100644
--- a/shell/e-shortcuts-view.c
+++ b/shell/e-shortcuts-view.c
@@ -521,6 +521,8 @@ e_shortcuts_view_construct (EShortcutsView *shortcuts_view,
g_return_if_fail (E_IS_SHORTCUTS (shortcuts));
priv = shortcuts_view->priv;
+
+ gtk_object_ref (GTK_OBJECT (priv->shortcuts));
priv->shortcuts = shortcuts;
e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcuts_view), icon_callback,
diff --git a/shell/evolution.oafinfo b/shell/evolution.oafinfo
new file mode 100644
index 0000000000..3f84707c93
--- /dev/null
+++ b/shell/evolution.oafinfo
@@ -0,0 +1,15 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:evolution:584cc84c-27d4-42c8-ae4d-39a64bdefbd2"
+ type="exe"
+ location="evolution">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/Evolution/Shell:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="The Evolution shell."/>
+</oaf_server>
+
+</oaf_info>
diff --git a/shell/main.c b/shell/main.c
index 76d0582bd0..421dc85ba9 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -35,12 +35,15 @@
#include "e-shell.h"
+
#define STARTUP_URI "evolution:/local/Inbox"
+
static EShell *shell = NULL;
static char *evolution_directory = NULL;
static gboolean no_splash = FALSE;
+
static void
no_views_left_cb (EShell *shell, gpointer data)
{
@@ -54,8 +57,9 @@ destroy_cb (GtkObject *object, gpointer data)
gtk_main_quit ();
}
+
static void
-development_warning ()
+development_warning (void)
{
GtkWidget *label, *warning_dialog;
int ret;
@@ -109,6 +113,33 @@ development_warning ()
gtk_object_destroy (GTK_OBJECT (warning_dialog));
}
+
+/* This is for doing stuff that requires the GTK+ loop to be running already. */
+
+static void
+new_view_on_running_shell (void)
+{
+ CORBA_Object corba_object;
+ GNOME_Evolution_ShellView shell_view;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ corba_object = oaf_activate_from_id (E_SHELL_OAFIID, 0, NULL, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
+ _("Cannot initialize the Evolution shell."));
+ return;
+ }
+
+ shell_view = GNOME_Evolution_Shell_createNewView ((GNOME_Evolution_Shell) corba_object, STARTUP_URI, &ev);
+
+ Bonobo_Unknown_unref ((Bonobo_Unknown) shell_view, &ev);
+ CORBA_Object_release ((CORBA_Object) shell_view, &ev);
+
+ CORBA_exception_free (&ev);
+}
+
static gint
idle_cb (gpointer data)
{
@@ -118,8 +149,9 @@ idle_cb (gpointer data)
g_free (evolution_directory);
if (shell == NULL) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Cannot initialize the Evolution shell."));
+ /* A new shell cannot be created, so try to get a new view from
+ an already running one. */
+ new_view_on_running_shell ();
exit (1);
}
@@ -179,4 +211,3 @@ main (int argc, char **argv)
return 0;
}
-