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



commit 6c943cd99d1c969d8259dc9143f23c4bd2e1536a
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.
    (cherry picked from commit 8266e0918ff843af14913fb16723cc8b18000a8d)

 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 b8aa145..4779d82 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -574,6 +574,8 @@ on_name_lost (GDBusConnection *connection,
 	}
 
 	g_mutex_unlock (factory->priv->connections_lock);
+	g_print ("Superseded...\n");
+	g_main_loop_quit (loop);
 }
 
 #ifndef G_OS_WIN32
@@ -667,7 +669,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 0b02e42..3af0ab6 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -891,6 +891,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);
 }
 
 #ifndef G_OS_WIN32
@@ -992,7 +994,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]