Merge lp:~tkluck/backintime/mountmonitor into lp:backintime/1.0
- mountmonitor
- Merge into release-1.0
Status: | Needs review |
---|---|
Proposed branch: | lp:~tkluck/backintime/mountmonitor |
Merge into: | lp:backintime/1.0 |
Diff against target: |
666 lines (+334/-11) 21 files modified
AUTHORS (+1/-0) CHANGES (+2/-0) VERSION (+2/-1) common/Makefile.template (+4/-0) common/backintime-mountmonitor.desktop (+12/-0) common/backintime.py (+23/-0) common/config.py (+18/-2) common/debian_specific/control (+2/-2) common/mountmonitor.py (+117/-0) common/pluginmanager.py (+9/-0) gnome/debian_specific/control (+2/-2) gnome/docbook/C/backintime-C.omf (+8/-0) gnome/docbook/C/backintime.xml (+10/-0) gnome/settingsdialog.glade (+30/-1) gnome/settingsdialog.py (+26/-0) kde4/backintime-kde4.desktop (+1/-0) kde4/debian_specific/control (+2/-2) kde4/docbook/en/index.docbook (+10/-0) kde4/settingsdialog.py (+16/-1) plugins/gnomeplugin.py (+16/-0) plugins/kde4plugin.py (+23/-0) |
To merge this branch: | bzr merge lp:~tkluck/backintime/mountmonitor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Christophe CHAUVET (community) | Needs Fixing | ||
Back In Time Team | Pending | ||
Review via email: mp+16196@code.launchpad.net |
Commit message
Description of the change
Christophe CHAUVET (christophe-chauvet) wrote : | # |
Hi
I see lot of conflict in your merge proposal, can you resolve it before ask to merge ?
Regards,
Timo Kluck (tkluck) wrote : | # |
> Hi
>
> I see lot of conflict in your merge proposal, can you resolve it before ask to
> merge ?
>
> Regards,
Hi,
I think I have fixed the merge conflicts in the code. I kept different version numbers for 'my' branch though (appending -tjk) to distinguish the branches. Should I change those too?
Also, I added the dependency python-gobject (part of PythonGTK) to the backintime-common package. The mount monitor daemon depends on it. I am unsure of whether this is a problem for KDE users?
Unmerged revisions
- 594. By Timo Kluck <tkluck@netbook-tjk>
-
fixed merge conflicts
- 593. By Timo Kluck <tkluck@netbook-tjk>
-
fixed merge conflict config.py
- 592. By Timo Kluck <tkluck@netbook-tjk>
-
fix some merge conflicts.
- 591. By Timo Kluck <tkluck@netbook-tjk>
-
KDE4Plugin now working.
Added logging in mount monitor - 590. By Timo Kluck <tkluck@netbook-tjk>
-
Correct dialog box for KDE
- 589. By Timo Kluck <tkluck@netbook-tjk>
-
removed merge tags
- 588. By Timo Kluck <tkluck@netbook-tjk>
-
* added kde support
* removed accidentally added ¨feature¨ of a per-folder on-mount action (added by copy pasting code)
* merge with current version in trunk - 587. By Timo Kluck <tkluck@netbook-tjk>
-
added new files
- 586. By Timo Kluck <tkluck@netbook-tjk>
-
adding mount monitor
Preview Diff
1 | === modified file 'AUTHORS' |
2 | --- AUTHORS 2009-11-06 13:00:42 +0000 |
3 | +++ AUTHORS 2010-01-08 19:59:12 +0000 |
4 | @@ -1,3 +1,4 @@ |
5 | Oprea Dan (<dan@le-web.org>) |
6 | Bart de Koning (<bratdaking@gmail.com>) |
7 | Richard Bailey (<rmjb@mail.com>) |
8 | +Timo Kluck (<tkluck@science.uva.nl>) (additional code) |
9 | |
10 | === modified file 'CHANGES' |
11 | --- CHANGES 2010-01-07 08:57:36 +0000 |
12 | +++ CHANGES 2010-01-08 19:59:12 +0000 |
13 | @@ -1,5 +1,6 @@ |
14 | Back In Time |
15 | |
16 | +======= |
17 | Version 1.0.0 |
18 | * smart remove was slightly changed (https://bugs.launchpad.net/backintime/+bug/502435) |
19 | * fix bug: https://bugs.launchpad.net/backintime/+bug/503859 |
20 | @@ -17,6 +18,7 @@ |
21 | * fix bug: https://bugs.launchpad.net/backintime/+bug/412695 |
22 | * update Slovak translation (Tomáš Vadina <kyberdev@gmail.com>) |
23 | * multiple profiles support |
24 | +* Added a backintime daemon that (optionally) makes a snapshot upon mounting an external drive. |
25 | * GNOME: fix notification |
26 | * backintime snapshot folder is restructured to ../backintime/machine/user/profile_id/ |
27 | * added the possibility to include other snapshot folders within a profile, it can only read those, there is not a GUI implementation yet |
28 | |
29 | === modified file 'VERSION' |
30 | --- VERSION 2010-01-07 08:57:36 +0000 |
31 | +++ VERSION 2010-01-08 19:59:12 +0000 |
32 | @@ -1,1 +1,2 @@ |
33 | -0.9.99beta10 |
34 | +0.9.99tjk |
35 | + |
36 | |
37 | === modified file 'common/Makefile.template' |
38 | --- common/Makefile.template 2009-04-28 14:02:13 +0000 |
39 | +++ common/Makefile.template 2010-01-08 19:59:12 +0000 |
40 | @@ -37,4 +37,8 @@ |
41 | #install application |
42 | install -d $(DEST)/bin |
43 | install backintime $(DEST)/bin |
44 | + |
45 | + # install daemon |
46 | + install -d $(DESTDIR)/etc/xdg/autostart |
47 | + install --mode=644 backintime-mountmonitor.desktop $(DESTDIR)/etc/xdg/autostart |
48 | |
49 | |
50 | === added file 'common/backintime-mountmonitor.desktop' |
51 | --- common/backintime-mountmonitor.desktop 1970-01-01 00:00:00 +0000 |
52 | +++ common/backintime-mountmonitor.desktop 2010-01-08 19:59:12 +0000 |
53 | @@ -0,0 +1,12 @@ |
54 | +[Desktop Entry] |
55 | +Name=Back In Time (Mount Monitor) |
56 | +Exec=backintime --mountmonitor |
57 | +NoDisplay=true |
58 | +Icon=gtk-save |
59 | +Terminal=false |
60 | +X-MultipleArgs=false |
61 | +Type=Application |
62 | +StartupNotify=false |
63 | +Categories=GNOME;GTK;System; |
64 | +Comment=Simple backup system |
65 | +Name[nl_NL]=backintime-mountmonitor.desktop |
66 | |
67 | === modified file 'common/backintime.py' |
68 | --- common/backintime.py 2009-12-17 10:18:53 +0000 |
69 | +++ common/backintime.py 2010-01-08 19:59:12 +0000 |
70 | @@ -72,6 +72,10 @@ |
71 | print '\tShow the ID of the last snapshot (and exit)' |
72 | print '--last-snapshot-path' |
73 | print '\tShow the path to the last snapshot (and exit)' |
74 | + print '--mountmonitor' |
75 | + print '\tStart the mount monitor daemon' |
76 | + print '--mountmonitor-stop' |
77 | + print '\tStop the mount monitor daemon' |
78 | print '-v | --version' |
79 | print '\tShow version (and exit)' |
80 | print '--license' |
81 | @@ -80,7 +84,17 @@ |
82 | print '\tShow this help (and exit)' |
83 | print '' |
84 | |
85 | +def start_mountmonitor(): |
86 | + import subprocess |
87 | + source = os.path.join(os.path.dirname(__file__),"mountmonitor.py") |
88 | + cmd = "python" |
89 | + p=subprocess.Popen((cmd,source)) |
90 | + print "Mount Monitor Started, Process ID is %s." % p.pid |
91 | + |
92 | |
93 | +def stop_mountmonitor(): |
94 | + print "Cannot stop Mount Monitor, not implemented." |
95 | + |
96 | def start_app( app_name = 'backintime', extra_args = [] ): |
97 | cfg = config.Config() |
98 | print_version( cfg, app_name ) |
99 | @@ -182,6 +196,15 @@ |
100 | if arg == '--gnome' or arg == '--kde4' or arg == '--kde3': |
101 | continue |
102 | |
103 | + if arg == '--mountmonitor': |
104 | + start_mountmonitor() |
105 | + sys.exit(0) |
106 | + |
107 | + if arg == '--mountmonitor-stop': |
108 | + stop_mountmonitor() |
109 | + sys.exit(0) |
110 | + |
111 | + |
112 | if arg[0] == '-': |
113 | if not arg[0] in extra_args: |
114 | print "Ignore option: %s" % arg |
115 | |
116 | === modified file 'common/config.py' |
117 | --- common/config.py 2010-01-07 08:57:36 +0000 |
118 | +++ common/config.py 2010-01-08 19:59:12 +0000 |
119 | @@ -35,7 +35,7 @@ |
120 | |
121 | class Config( configfile.ConfigFileWithProfiles ): |
122 | APP_NAME = 'Back In Time' |
123 | - VERSION = '0.9.99beta10' |
124 | + VERSION = '0.9.99tjk' |
125 | COPYRIGHT = 'Copyright (c) 2008-2009 Oprea Dan, Bart de Koning, Richard Bailey' |
126 | CONFIG_VERSION = 4 |
127 | |
128 | @@ -50,6 +50,10 @@ |
129 | |
130 | DISK_UNIT_MB = 10 |
131 | DISK_UNIT_GB = 20 |
132 | + |
133 | + NO_ACTION = 0 |
134 | + ASK = 10 |
135 | + SILENT_SNAPSHOT = 20 |
136 | |
137 | AUTOMATIC_BACKUP_MODES = { |
138 | NONE : _('Disabled'), |
139 | @@ -68,6 +72,12 @@ |
140 | } |
141 | |
142 | MIN_FREE_SPACE_UNITS = { DISK_UNIT_MB : 'Mb', DISK_UNIT_GB : 'Gb' } |
143 | + |
144 | + ON_MOUNT_ACTIONS = { |
145 | + NO_ACTION: _('No action'), |
146 | + ASK: _('Ask user'), |
147 | + SILENT_SNAPSHOT: _('Silently take snapshot') |
148 | + } |
149 | |
150 | |
151 | def __init__( self ): |
152 | @@ -238,7 +248,7 @@ |
153 | profile_id = self.get_current_profile() |
154 | |
155 | if not os.path.isdir( value ): |
156 | - self.notify_error( _( '%s is not a folder !' ) ) |
157 | + self.notify_error( _( '%s is not a folder !' % value) ) |
158 | return False |
159 | |
160 | #Initialize the snapshots folder |
161 | @@ -335,6 +345,12 @@ |
162 | def set_automatic_backup_mode( self, value, profile_id = None ): |
163 | self.set_profile_int_value( 'snapshots.automatic_backup_mode', value, profile_id ) |
164 | |
165 | + def get_on_mount_action( self, profile_id = None ): |
166 | + return self.get_profile_int_value( 'snapshots.on_mount_action', self.NO_ACTION, profile_id ) |
167 | + |
168 | + def set_on_mount_action( self, value, profile_id = None ): |
169 | + self.set_profile_int_value( 'snapshots.on_mount_action', value, profile_id ) |
170 | + |
171 | #def get_per_directory_schedule( self, profile_id = None ): |
172 | # return self.get_profile_bool_value( 'snapshots.expert.per_directory_schedule', False, profile_id ) |
173 | |
174 | |
175 | === modified file 'common/debian_specific/control' |
176 | --- common/debian_specific/control 2010-01-07 08:57:36 +0000 |
177 | +++ common/debian_specific/control 2010-01-08 19:59:12 +0000 |
178 | @@ -1,11 +1,11 @@ |
179 | Package: backintime-common |
180 | -Version: 0.9.99beta10 |
181 | +Version: 0.9.99tjk |
182 | Priority: optional |
183 | Section: utils |
184 | Maintainer: BIT Team <bit-team@lists.launchpad.net> |
185 | Architecture: all |
186 | Homepage: http://backintime.le-web.org |
187 | -Depends: python, rsync, cron |
188 | +Depends: python, rsync, cron, python-gobject |
189 | Recommends: powermgmt-base |
190 | Conflicts: backintime |
191 | Replaces: backintime |
192 | |
193 | === removed file 'common/man/C/backintime.1.gz' |
194 | Binary files common/man/C/backintime.1.gz 2010-01-07 08:57:36 +0000 and common/man/C/backintime.1.gz 1970-01-01 00:00:00 +0000 differ |
195 | === added file 'common/mountmonitor.py' |
196 | --- common/mountmonitor.py 1970-01-01 00:00:00 +0000 |
197 | +++ common/mountmonitor.py 2010-01-08 19:59:12 +0000 |
198 | @@ -0,0 +1,117 @@ |
199 | +# Back In Time |
200 | +# Copyright (C) 2008-2009 Oprea Dan |
201 | +# Additional code for monitoring volume mounts: Copyright (C) 2009 Timo Kluck |
202 | +# |
203 | +# This program is free software; you can redistribute it and/or modify |
204 | +# it under the terms of the GNU General Public License as published by |
205 | +# the Free Software Foundation; either version 2 of the License, or |
206 | +# (at your option) any later version. |
207 | +# |
208 | +# This program is distributed in the hope that it will be useful, |
209 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
210 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
211 | +# GNU General Public License for more details. |
212 | +# |
213 | +# You should have received a copy of the GNU General Public License along |
214 | +# with this program; if not, write to the Free Software Foundation, Inc., |
215 | +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
216 | + |
217 | +import sys |
218 | + |
219 | +import os |
220 | + |
221 | +import gtk |
222 | + |
223 | +import config |
224 | +import pluginmanager |
225 | +import logger |
226 | + |
227 | + |
228 | +# this function can be called if we find another way of monitoring mounts than running a daemon |
229 | +def on_mount_action(mount_path): |
230 | + mount_monitor=backintime_mount_monitor() |
231 | + mount_monitor.on_mount_added(mount_path) |
232 | + |
233 | +# set up a monitor |
234 | +class backintime_mount_monitor(): |
235 | + |
236 | + # connect specifies whether to listen for mount events |
237 | + def __init__(self, connect=False): |
238 | + |
239 | + if connect: |
240 | + import gio |
241 | + self.volume_monitor=gio.VolumeMonitor() |
242 | + #self.volume_monitor.connect("drive-connected",self._on_drive_connected) |
243 | + self.volume_monitor.connect("mount-added",self._on_mount_added) |
244 | + |
245 | + |
246 | + self.pluginmanager = pluginmanager.PluginManager() |
247 | + |
248 | + self.config=config.Config() |
249 | + # FIXME: no Snapshots object available, but plugins use only snapshots.config. So we pass self as argument. |
250 | + # this is probably going to be buggy in the future |
251 | + self.pluginmanager.load_plugins(self) |
252 | + |
253 | + # ask user whether he/she wants to take a snapshot |
254 | + def ask_user(self, mount_path): |
255 | + if self.pluginmanager.has_gui_plugins(): |
256 | + make_backup=self.pluginmanager.ask_user_on_mount(mount_path) |
257 | + |
258 | + if make_backup: |
259 | + self.make_snapshot() |
260 | + |
261 | + # make a snapshot |
262 | + def make_snapshot(self): |
263 | + app = 'backintime' |
264 | + if os.path.isfile( './backintime' ): |
265 | + app = './backintime' |
266 | + cmd = "%s --backup &" % app |
267 | + os.system( cmd ) |
268 | + |
269 | + |
270 | + # callback for gio |
271 | + def _on_mount_added(self,volume_monitor,mount): |
272 | + |
273 | + mount_path=mount.get_root().get_path() |
274 | + logger.info("Mount detected: %s" % mount_path) |
275 | + self.on_mount_added(mount_path) |
276 | + |
277 | + # callback for gio |
278 | + def _on_drive_connected(self,volume_monitor,drive): |
279 | + # reload configuration |
280 | + self.config=config.Config() |
281 | + |
282 | + snapshots_path=self.config.get_snapshots_path() |
283 | + |
284 | + volumes=drive.get_volumes() |
285 | + for volume in volumes: |
286 | + if snapshots_path.find(volume.get_name())>=0: |
287 | + volume.mount(None,self._empty_callback) |
288 | + |
289 | + def _empty_callback(a,b,c): |
290 | + return |
291 | + |
292 | + # actual code to run when mount added |
293 | + def on_mount_added(self,mount_path): |
294 | + |
295 | + # reload configuration |
296 | + self.config=config.Config() |
297 | + |
298 | + snapshots_path=self.config.get_snapshots_path() |
299 | + |
300 | + if os.path.commonprefix([snapshots_path,mount_path])==mount_path: |
301 | + if os.path.isdir(snapshots_path): |
302 | + logger.info("Mounted disk contains snapshots. Performing configured action.") |
303 | + on_mount_action=self.config.get_on_mount_action() |
304 | + if on_mount_action==self.config.ASK: |
305 | + self.ask_user(mount_path) |
306 | + elif on_mount_action==self.config.SILENT_SNAPSHOT: |
307 | + self.make_snapshot() |
308 | + |
309 | + |
310 | +if __name__=="__main__": |
311 | + mount_monitor=backintime_mount_monitor(True) |
312 | + |
313 | + |
314 | + gtk.main() |
315 | + |
316 | |
317 | === modified file 'common/pluginmanager.py' |
318 | --- common/pluginmanager.py 2009-11-02 13:52:00 +0000 |
319 | +++ common/pluginmanager.py 2010-01-08 19:59:12 +0000 |
320 | @@ -46,6 +46,9 @@ |
321 | |
322 | def on_new_snapshot( self, snapshot_id, snapshot_path ): |
323 | return |
324 | + |
325 | + def ask_user_on_mount( self, path ): |
326 | + return False |
327 | |
328 | |
329 | class PluginManager(): |
330 | @@ -103,4 +106,10 @@ |
331 | def on_new_snapshot( self, snapshot_id, snapshot_path ): |
332 | for plugin in self.plugins: |
333 | plugin.on_new_snapshot( snapshot_id, snapshot_path ) |
334 | + |
335 | + def ask_user_on_mount( self,path ): |
336 | + if self.has_gui_plugins_: |
337 | + return self.plugins[0].ask_user_on_mount( path ) |
338 | + else: |
339 | + return False |
340 | |
341 | |
342 | === modified file 'gnome/debian_specific/control' |
343 | --- gnome/debian_specific/control 2010-01-07 08:57:36 +0000 |
344 | +++ gnome/debian_specific/control 2010-01-08 19:59:12 +0000 |
345 | @@ -1,10 +1,10 @@ |
346 | Package: backintime-gnome |
347 | -Version: 0.9.99beta10 |
348 | +Version: 0.9.99tjk |
349 | Priority: optional |
350 | Section: gnome |
351 | Maintainer: BIT Team <bit-team@lists.launchpad.net> |
352 | Architecture: all |
353 | Homepage: http://backintime.le-web.org |
354 | -Depends: x11-utils, python-glade2, python-gnome2, python-notify, meld, gksu, backintime-common (= 0.9.99beta10) |
355 | +Depends: x11-utils, python-glade2, python-gnome2, python-notify, meld, gksu, backintime-common (= 0.9.99tjk) |
356 | Description: Simple backup system for GNOME Desktop |
357 | This is a GNOME GUI frontend for backintime-common. |
358 | |
359 | === modified file 'gnome/docbook/C/backintime-C.omf' |
360 | --- gnome/docbook/C/backintime-C.omf 2010-01-07 08:57:36 +0000 |
361 | +++ gnome/docbook/C/backintime-C.omf 2010-01-08 19:59:12 +0000 |
362 | @@ -5,7 +5,15 @@ |
363 | <maintainer>(BIT Team)</maintainer> |
364 | <title>Back In Time Manual</title> |
365 | <date>November 2008</date> |
366 | +<<<<<<< TREE |
367 | +<<<<<<< TREE |
368 | + <version identifier="Back In Time Manual 0.9.26" date="November 2008"/> |
369 | +======= |
370 | + <version identifier="Back In Time Manual 0.9.99beta2" date="November 2008"/> |
371 | +>>>>>>> MERGE-SOURCE |
372 | +======= |
373 | <version identifier="Back In Time Manual 0.9.99beta10" date="November 2008"/> |
374 | +>>>>>>> MERGE-SOURCE |
375 | <subject category="GNOME|Applications|System Tools"/> |
376 | <description> |
377 | Back In Time is a simple backup system for GNOME desktop. |
378 | |
379 | === modified file 'gnome/docbook/C/backintime.xml' |
380 | --- gnome/docbook/C/backintime.xml 2010-01-07 08:57:36 +0000 |
381 | +++ gnome/docbook/C/backintime.xml 2010-01-08 19:59:12 +0000 |
382 | @@ -3,8 +3,18 @@ |
383 | <!ENTITY legal SYSTEM "legal.xml"> |
384 | <!ENTITY appname "Back In Time"> |
385 | <!ENTITY app "<application>&appname;</application>"> |
386 | +<<<<<<< TREE |
387 | +<<<<<<< TREE |
388 | +<!ENTITY appversion "0.9.26"> |
389 | +<!ENTITY manrevision "0.9.26"> |
390 | +======= |
391 | +<!ENTITY appversion "0.9.99beta2"> |
392 | +<!ENTITY manrevision "0.9.99beta2"> |
393 | +>>>>>>> MERGE-SOURCE |
394 | +======= |
395 | <!ENTITY appversion "0.9.99beta10"> |
396 | <!ENTITY manrevision "0.9.99beta10"> |
397 | +>>>>>>> MERGE-SOURCE |
398 | <!ENTITY date "Mars 2009"> |
399 | ]> |
400 | <!-- |
401 | |
402 | === removed file 'gnome/man/C/backintime-gnome.1.gz' |
403 | Binary files gnome/man/C/backintime-gnome.1.gz 2010-01-07 08:57:36 +0000 and gnome/man/C/backintime-gnome.1.gz 1970-01-01 00:00:00 +0000 differ |
404 | === modified file 'gnome/settingsdialog.glade' |
405 | --- gnome/settingsdialog.glade 2010-01-07 08:57:36 +0000 |
406 | +++ gnome/settingsdialog.glade 2010-01-08 19:59:12 +0000 |
407 | @@ -205,6 +205,35 @@ |
408 | </packing> |
409 | </child> |
410 | <child> |
411 | + <object class="GtkFrame" id="frame3"> |
412 | + <property name="visible">True</property> |
413 | + <property name="label_xalign">0</property> |
414 | + <property name="shadow_type">none</property> |
415 | + <child> |
416 | + <object class="GtkAlignment" id="alignment3"> |
417 | + <property name="visible">True</property> |
418 | + <property name="left_padding">12</property> |
419 | + <child> |
420 | + <object class="GtkComboBox" id="cb_on_mount_action"> |
421 | + <property name="visible">True</property> |
422 | + </object> |
423 | + </child> |
424 | + </object> |
425 | + </child> |
426 | + <child type="label"> |
427 | + <object class="GtkLabel" id="lbl_onmount1"> |
428 | + <property name="visible">True</property> |
429 | + <property name="label" translatable="yes"><b>On connecting disk</b></property> |
430 | + <property name="use_markup">True</property> |
431 | + </object> |
432 | + </child> |
433 | + </object> |
434 | + <packing> |
435 | + <property name="expand">False</property> |
436 | + <property name="position">2</property> |
437 | + </packing> |
438 | + </child> |
439 | + <child> |
440 | <object class="GtkHBox" id="hbox1"> |
441 | <property name="visible">True</property> |
442 | <child> |
443 | @@ -223,7 +252,7 @@ |
444 | </child> |
445 | </object> |
446 | <packing> |
447 | - <property name="position">2</property> |
448 | + <property name="position">3</property> |
449 | </packing> |
450 | </child> |
451 | </object> |
452 | |
453 | === modified file 'gnome/settingsdialog.py' |
454 | --- gnome/settingsdialog.py 2010-01-06 08:42:40 +0000 |
455 | +++ gnome/settingsdialog.py 2010-01-08 19:59:12 +0000 |
456 | @@ -111,6 +111,17 @@ |
457 | self.rev_automatic_backup_modes[ map[key] ] = key |
458 | self.store_backup_mode.append( [ map[key], key ] ) |
459 | |
460 | + #on mount action store |
461 | + self.store_on_mount_action = gtk.ListStore( str, int ) |
462 | + default_on_mount_action_index = 0 |
463 | + map = self.config.ON_MOUNT_ACTIONS |
464 | + self.rev_on_mount_actions = {} |
465 | + keys = map.keys() |
466 | + keys.sort() |
467 | + for key in keys: |
468 | + self.rev_on_mount_actions[ map[key] ] = key |
469 | + self.store_on_mount_action.append( [ map[key], key ] ) |
470 | + |
471 | #per directory schedule |
472 | #self.cb_per_directory_schedule = get( 'cb_per_directory_schedule' ) |
473 | #self.lbl_schedule = get( 'lbl_schedule' ) |
474 | @@ -168,6 +179,15 @@ |
475 | self.cb_backup_mode.pack_start( renderer, True ) |
476 | self.cb_backup_mode.add_attribute( renderer, 'text', 0 ) |
477 | |
478 | + #setup on mount action |
479 | + self.cb_on_mount_action = get( 'cb_on_mount_action' ) |
480 | + self.cb_on_mount_action.set_model( self.store_on_mount_action ) |
481 | + |
482 | + self.cb_on_mount_action.clear() |
483 | + renderer = gtk.CellRendererText() |
484 | + self.cb_on_mount_action.pack_end( renderer, True ) |
485 | + self.cb_on_mount_action.add_attribute( renderer, 'text', 0 ) |
486 | + |
487 | #setup remove old backups older than |
488 | self.edit_remove_old_backup_value = get( 'edit_remove_old_backup_value' ) |
489 | self.cb_remove_old_backup_unit = get( 'cb_remove_old_backup_unit' ) |
490 | @@ -308,6 +328,9 @@ |
491 | #per directory schedule |
492 | #self.cb_per_directory_schedule.set_active( self.config.get_per_directory_schedule() ) |
493 | |
494 | + #setup on mount action |
495 | + self.cb_on_mount_action.set_active( self.config.get_on_mount_action() ) |
496 | + |
497 | #setup include folders |
498 | #self.update_per_directory_option() |
499 | |
500 | @@ -433,6 +456,9 @@ |
501 | |
502 | #global schedule |
503 | self.config.set_automatic_backup_mode( self.store_backup_mode.get_value( self.cb_backup_mode.get_active_iter(), 1 ) ) |
504 | + |
505 | + #on mount action |
506 | + self.config.set_on_mount_action( self.store_on_mount_action.get_value( self.cb_on_mount_action.get_active_iter(), 1 ) ) |
507 | |
508 | #auto-remove snapshots |
509 | self.config.set_remove_old_snapshots( |
510 | |
511 | === modified file 'kde4/backintime-kde4.desktop' (properties changed: -x to +x) |
512 | --- kde4/backintime-kde4.desktop 2009-04-27 13:43:00 +0000 |
513 | +++ kde4/backintime-kde4.desktop 2010-01-08 19:59:12 +0000 |
514 | @@ -1,3 +1,4 @@ |
515 | +#!/usr/bin/env xdg-open |
516 | [Desktop Entry] |
517 | Name=Back In Time |
518 | Exec=backintime-kde4 |
519 | |
520 | === modified file 'kde4/debian_specific/control' |
521 | --- kde4/debian_specific/control 2010-01-07 08:57:36 +0000 |
522 | +++ kde4/debian_specific/control 2010-01-08 19:59:12 +0000 |
523 | @@ -1,11 +1,11 @@ |
524 | Package: backintime-kde4 |
525 | -Version: 0.9.99beta10 |
526 | +Version: 0.9.99tjk |
527 | Priority: optional |
528 | Section: kde4 |
529 | Maintainer: BIT Team <bit-team@lists.launchpad.net> |
530 | Architecture: all |
531 | Homepage: http://backintime.le-web.org |
532 | -Depends: x11-utils, kdesudo, python-kde4 (>= 4.1), backintime-common (= 0.9.99beta10) |
533 | +Depends: x11-utils, kdesudo, python-kde4 (>= 4.1), backintime-common (= 0.9.99tjk) |
534 | Suggests: kompare |
535 | Description: Simple backup system for KDE4 Desktop |
536 | This is a KDE4 (>= 4.1) GUI frontend for backintime-common. |
537 | |
538 | === modified file 'kde4/docbook/en/index.docbook' |
539 | --- kde4/docbook/en/index.docbook 2010-01-07 08:57:36 +0000 |
540 | +++ kde4/docbook/en/index.docbook 2010-01-08 19:59:12 +0000 |
541 | @@ -3,8 +3,18 @@ |
542 | <!ENTITY legal SYSTEM "legal.xml"> |
543 | <!ENTITY appname "Back In Time"> |
544 | <!ENTITY app "<application>&appname;</application>"> |
545 | +<<<<<<< TREE |
546 | +<<<<<<< TREE |
547 | +<!ENTITY appversion "0.9.26"> |
548 | +<!ENTITY manrevision "0.9.26"> |
549 | +======= |
550 | +<!ENTITY appversion "0.9.99beta2"> |
551 | +<!ENTITY manrevision "0.9.99beta2"> |
552 | +>>>>>>> MERGE-SOURCE |
553 | +======= |
554 | <!ENTITY appversion "0.9.99beta10"> |
555 | <!ENTITY manrevision "0.9.99beta10"> |
556 | +>>>>>>> MERGE-SOURCE |
557 | <!ENTITY date "November 2008"> |
558 | ]> |
559 | <!-- |
560 | |
561 | === removed file 'kde4/man/C/backintime-kde4.1.gz' |
562 | Binary files kde4/man/C/backintime-kde4.1.gz 2010-01-07 08:57:36 +0000 and kde4/man/C/backintime-kde4.1.gz 1970-01-01 00:00:00 +0000 differ |
563 | === modified file 'kde4/settingsdialog.py' |
564 | --- kde4/settingsdialog.py 2010-01-07 09:15:31 +0000 |
565 | +++ kde4/settingsdialog.py 2010-01-08 19:59:12 +0000 |
566 | @@ -130,6 +130,17 @@ |
567 | hlayout.addWidget( self.combo_automatic_snapshots ) |
568 | self.fill_combo( self.combo_automatic_snapshots, self.config.AUTOMATIC_BACKUP_MODES ) |
569 | |
570 | + #On mount action |
571 | + group_box = QGroupBox( self ) |
572 | + self.global_on_mount_group_box = group_box |
573 | + group_box.setTitle( QString.fromUtf8( _( 'On connecting disk:' ) ) ) |
574 | + layout.addWidget( group_box ) |
575 | + |
576 | + hlayout = QHBoxLayout( group_box ) |
577 | + |
578 | + self.combo_on_mount_action = KComboBox( self ) |
579 | + hlayout.addWidget( self.combo_on_mount_action ) |
580 | + self.fill_combo( self.combo_on_mount_action, self.config.ON_MOUNT_ACTIONS ) |
581 | # |
582 | layout.addStretch() |
583 | |
584 | @@ -361,7 +372,8 @@ |
585 | #TAB: General |
586 | self.edit_snapshots_path.setText( QString.fromUtf8( self.config.get_snapshots_path() ) ) |
587 | self.set_combo_value( self.combo_automatic_snapshots, self.config.get_automatic_backup_mode() ) |
588 | - |
589 | + self.set_combo_value( self.combo_on_mount_action, self.config.get_on_mount_action() ) |
590 | + |
591 | #TAB: Include |
592 | self.list_include.clear() |
593 | |
594 | @@ -433,6 +445,9 @@ |
595 | #schedule |
596 | self.config.set_automatic_backup_mode( self.combo_automatic_snapshots.itemData( self.combo_automatic_snapshots.currentIndex() ).toInt()[0] ) |
597 | |
598 | + # onmount action |
599 | + self.config.set_on_mount_action( self.combo_on_mount_action.itemData( self.combo_on_mount_action.currentIndex() ).toInt()[0] ) |
600 | + |
601 | #auto-remove |
602 | self.config.set_remove_old_snapshots( |
603 | self.cb_remove_older_then.isChecked(), |
604 | |
605 | === modified file 'plugins/gnomeplugin.py' |
606 | --- plugins/gnomeplugin.py 2009-12-01 08:48:44 +0000 |
607 | +++ plugins/gnomeplugin.py 2010-01-08 19:59:12 +0000 |
608 | @@ -163,6 +163,9 @@ |
609 | return False |
610 | |
611 | self.systray = None |
612 | + |
613 | + self.config=snapshots.config |
614 | + |
615 | try: |
616 | self.systray = GnomePlugin.Systray( snapshots ) |
617 | except: |
618 | @@ -186,4 +189,17 @@ |
619 | |
620 | def on_new_snapshot( self, snapshot_id, snapshot_path ): |
621 | return |
622 | + |
623 | + |
624 | + def ask_user_on_mount(self, path): |
625 | + |
626 | + tools.register_backintime_path('gnome') |
627 | + import messagebox |
628 | + |
629 | + make_backup=messagebox.show_question(None,self.config,"\ |
630 | +The location %s contains snapshots (backups) of \ |
631 | +some files in the system. Do you want to make \ |
632 | +a snapshot now?" % path) |
633 | + from gtk import RESPONSE_YES |
634 | + return make_backup==RESPONSE_YES |
635 | |
636 | |
637 | === modified file 'plugins/kde4plugin.py' |
638 | --- plugins/kde4plugin.py 2009-12-28 12:17:16 +0000 |
639 | +++ plugins/kde4plugin.py 2010-01-08 19:59:12 +0000 |
640 | @@ -70,3 +70,26 @@ |
641 | except: |
642 | pass |
643 | |
644 | + def ask_user_on_mount( self, path ): |
645 | + from PyKDE4.kdecore import KAboutData, KCmdLineArgs, ki18n |
646 | + from PyKDE4.kdeui import KApplication, KSystemTrayIcon, KIcon, KMessageBox |
647 | + |
648 | + kaboutdata = KAboutData( 'backintime', '', ki18n( self.config.APP_NAME ), self.config.VERSION, ki18n( '' ), KAboutData.License_GPL_V2, ki18n( self.config.COPYRIGHT ), ki18n( '' ), 'http://backintime.le-web.org', 'bit-team@lists.launchpad.net' ) |
649 | + |
650 | + kaboutdata.setProgramIconName( 'document-save' ) |
651 | + |
652 | + KCmdLineArgs.init( [sys.argv[0]], kaboutdata ) |
653 | + kapp = KApplication() |
654 | + messagebox = KMessageBox() |
655 | + |
656 | + make_backup=messagebox.questionYesNo(None,"\ |
657 | +The location %s contains snapshots (backups) of \ |
658 | +some files in the system. Do you want to make \ |
659 | +a snapshot now?" % path, "") |
660 | + |
661 | + kapp = None |
662 | + |
663 | + return make_backup==messagebox.Yes |
664 | + |
665 | + |
666 | + |
I added some functionality that I want to propose for the main trunk.
It is a small python script that monitors mounting of filesystems. It checks whether a new mount contains a backintime directory, and if it does, shows a dialog box to the user asking whether to make a snapshot. Behaviour (no action / show dialog box / silently make backup) is configurable.
Works both in Gnome and KDE4. However, Gnome mounts connected volumes automatically, and KDE does not. So in Gnome, the dialog box is shown after connecting the drive, and in KDE, only after manually mounting.
Pros: this feature has been requested a couple of times, and I myself am a happy user.
Cons: it seems a waste of resources to have a daemon running just for showing a single dialog box. This is not yet configurable from BiT (but is it with system preferences).