deja-dup-team team mailing list archive
-
deja-dup-team team
-
Mailing list archive
-
Message #00497
[Merge] lp:~mterry/deja-dup/quit-on-dbus-exit into lp:deja-dup
Michael Terry has proposed merging lp:~mterry/deja-dup/quit-on-dbus-exit into lp:deja-dup.
Requested reviews:
Robert Bruce Park (robru)
Related bugs:
Bug #891797 in Déjà Dup: "Deja-dup should detect that another instance is already running for the same user."
https://bugs.launchpad.net/deja-dup/+bug/891797
Bug #1051811 in Déjà Dup: "deja-dup-monitor process survives after logout"
https://bugs.launchpad.net/deja-dup/+bug/1051811
For more details, see:
https://code.launchpad.net/~mterry/deja-dup/quit-on-dbus-exit/+merge/124606
Have deja-dup-monitor try to own a bus name on startup and quit if it can't own it or loses the name for any reason.
This fixes two issues:
1) A user somehow tries to run two monitors in the same session. This is almost always due to the user doing something goofy, but whatever, we should help the user there. (Bug 891797)
2) Quantal seems to have a new bug where logging out does not make old deja-dup-monitor processes quit. By owning a bus name, it makes it easy to notice when a dbus session dies, so that we can exit with the session. (Bug 1051811)
--
https://code.launchpad.net/~mterry/deja-dup/quit-on-dbus-exit/+merge/124606
Your team Déjà Dup Developers is subscribed to branch lp:deja-dup.
=== modified file 'monitor/monitor.vala'
--- monitor/monitor.vala 2012-08-06 22:41:13 +0000
+++ monitor/monitor.vala 2012-09-17 06:17:21 +0000
@@ -294,6 +294,27 @@
settings.changed.connect(prepare_if_necessary);
}
+static void begin_monitoring()
+{
+ DejaDup.Network.ensure_status.begin();
+ DejaDup.Network.get().notify["connected"].connect(network_changed);
+
+ Bus.watch_name(BusType.SESSION, "org.gnome.DejaDup.Operation",
+ BusNameWatcherFlags.NONE, op_started, op_ended);
+
+ var mon = VolumeMonitor.get();
+ mon.ref(); // bug 569418; bad things happen when VM goes away
+ mon.volume_added.connect(volume_added);
+
+ watch_settings();
+
+ // Delay first check to give the network and desktop environment a chance to start up.
+ if (DejaDup.in_testing_mode())
+ make_first_check();
+ else
+ Timeout.add_seconds(120, () => {make_first_check(); return false;});
+}
+
static int main(string[] args)
{
DejaDup.i18n_setup();
@@ -319,27 +340,17 @@
if (!DejaDup.initialize(null, null))
return 1;
- DejaDup.Network.ensure_status.begin();
- DejaDup.Network.get().notify["connected"].connect(network_changed);
-
- Bus.watch_name(BusType.SESSION, "org.gnome.DejaDup.Operation",
- BusNameWatcherFlags.NONE, op_started, op_ended);
-
- var mon = VolumeMonitor.get();
- mon.ref(); // bug 569418; bad things happen when VM goes away
- mon.volume_added.connect(volume_added);
-
var loop = new MainLoop(null, false);
-
- // Delay first check to give the network and desktop environment a chance to start up.
- if (DejaDup.in_testing_mode())
- make_first_check();
- else
- Timeout.add_seconds(120, () => {make_first_check(); return false;});
-
- watch_settings();
+ Idle.add(() => {
+ // quit if we can't get the bus name or become disconnected
+ Bus.own_name(BusType.SESSION, "org.gnome.DejaDup.Monitor",
+ BusNameOwnerFlags.NONE, ()=>{},
+ ()=>{begin_monitoring();},
+ ()=>{loop.quit();});
+ return false;
+ });
loop.run();
-
+
return 0;
}
Follow ups