[evolution-data-server] Make e-{addressbook, calendar}-factory supersede old factory at startup.



commit 8266e0918ff843af14913fb16723cc8b18000a8d
Author: David Woodhouse <David Woodhouse intel com>
Date:   Thu Jul 28 17:19:00 2011 +0100

    Make e-{addressbook,calendar}-factory supersede old factory at startup.
    
    I've lost count of the number of times I've run a factory for debugging
    purposes but actually discovered that there's another one already running,
    so my new one isn't being used. It's particularly likely because when you
    *kill* an existing factory Evolution will bitch about how calendars will
    never work again until you restart Evolution... but it *will* restart the
    factory automatically!
    
    So make the new factory supersede an old one, and make the old one quit
    when it's superseded. This will make debugging a whole lot saner.

 addressbook/libedata-book/e-data-book-factory.c |    4 +++-
 calendar/libedata-cal/e-data-cal-factory.c      |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index 955d731..e49a1e3c 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -739,6 +739,8 @@ on_name_lost (GDBusConnection *connection,
 	}
 
 	g_mutex_unlock (factory->priv->connections_lock);
+	g_print ("Superseded...\n");
+	g_main_loop_quit (loop);
 }
 
 #ifdef G_OS_UNIX
@@ -822,7 +824,7 @@ main (gint argc, gchar **argv)
 	owner_id = g_bus_own_name (
 		G_BUS_TYPE_SESSION,
 		ADDRESS_BOOK_DBUS_SERVICE_NAME,
-		G_BUS_NAME_OWNER_FLAGS_NONE,
+		G_BUS_NAME_OWNER_FLAGS_REPLACE | G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT,
 		on_bus_acquired,
 		on_name_acquired,
 		on_name_lost,
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index 385b7ab..660f010 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -957,6 +957,8 @@ on_name_lost (GDBusConnection *connection,
 		g_list_foreach (copy, remove_data_cal_cb, NULL);
 		g_list_free (copy);
 	}
+	g_print ("Superseded...\n");
+	g_main_loop_quit (loop);
 }
 
 #ifdef G_OS_UNIX
@@ -1048,7 +1050,7 @@ main (gint argc, gchar **argv)
 	owner_id = g_bus_own_name (
 		G_BUS_TYPE_SESSION,
 		CALENDAR_DBUS_SERVICE_NAME,
-		G_BUS_NAME_OWNER_FLAGS_NONE,
+		G_BUS_NAME_OWNER_FLAGS_REPLACE | G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT,
 		on_bus_acquired,
 		on_name_acquired,
 		on_name_lost,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]