From 583bbec280424953b29502d0e8ba6e0e0947853b Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Fri, 28 Mar 2003 21:52:31 +0000 Subject: (kill_old_wombat): New. (kill_wombat): New. (idle_cb): Call kill_old_wombat(). svn path=/trunk/; revision=20565 --- shell/main.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'shell/main.c') diff --git a/shell/main.c b/shell/main.c index 45a2e0c74f..8aa3b9b79a 100644 --- a/shell/main.c +++ b/shell/main.c @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* main.c * - * Copyright (C) 2000, 2001, 2002 Ximian, Inc. + * Copyright (C) 2000, 2001, 2002, 2003 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 @@ -60,6 +60,7 @@ #include #include "e-config-upgrade.h" +#include "Evolution-Wombat.h" #ifdef GTKHTML_HAVE_GCONF #include @@ -166,6 +167,53 @@ shell_weak_notify (void *data, bonobo_main_quit (); } + +static void +kill_wombat (void) +{ + g_print ("(Killing old version of Wombat...)\n"); + + system (KILL_PROCESS_CMD " -9 lt-evolution-wombat 2> /dev/null"); + system (KILL_PROCESS_CMD " -9 evolution-wombat 2> /dev/null"); +} + +static void +kill_old_wombat (void) +{ + GNOME_Evolution_WombatInterfaceCheck iface; + CORBA_Environment ev; + CORBA_char *version; + + CORBA_exception_init (&ev); + + iface = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Wombat_InterfaceCheck", 0, NULL, &ev); + if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) { + kill_wombat (); + CORBA_exception_free (&ev); + return; + } + + version = GNOME_Evolution_WombatInterfaceCheck__get_interfaceVersion (iface, &ev); + if (BONOBO_EX (&ev)) { + kill_wombat (); + CORBA_Object_release (iface, &ev); + CORBA_exception_free (&ev); + return; + } + + if (strcmp (version, VERSION) != 0) { + CORBA_free (version); + kill_wombat (); + CORBA_Object_release (iface, &ev); + CORBA_exception_free (&ev); + return; + } + + CORBA_free (version); + CORBA_Object_release (iface, &ev); + CORBA_exception_free (&ev); +} + /* Warning dialog to scare people off a little bit. */ @@ -299,6 +347,8 @@ idle_cb (void *data) gboolean display_default; gboolean displayed_any; + kill_old_wombat (); + CORBA_exception_init (&ev); uri_list = (GSList *) data; -- cgit v1.2.3