aboutsummaryrefslogtreecommitdiffstats
path: root/shell/main.c
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 /shell/main.c
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
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c39
1 files changed, 35 insertions, 4 deletions
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;
}
-