~ubuntu-branches/ubuntu/raring/virt-manager/raring

« back to all changes in this revision

Viewing changes to debian/patches/fork_before_gtk_import.patch

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-04-04 13:40:54 UTC
  • Revision ID: package-import@ubuntu.com-20120404134054-bgc3817gt2it3rjm
Tags: 0.9.1-1ubuntu4
debian/patches/fork_before_gtk_import.patch: updated to also parse
command line options before forking so we get error messages and help.
Unfortunately, this has the side-effect of preventing the use of GTK
command-line options. (LP: #973585)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Description: fork earlier to work around global menu and appindicator issue
2
2
Author: Marc Deslauriers <marc.deslauriers@ubuntu.com>
3
3
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/overlay-scrollbar/+bug/965318
 
4
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/973585
4
5
Forwarded: No, needs a better fix before sending upstream
5
6
 
6
7
Index: virt-manager-0.9.1/src/virt-manager.py.in
7
8
===================================================================
8
 
--- virt-manager-0.9.1.orig/src/virt-manager.py.in      2012-04-03 08:45:31.661376178 -0400
9
 
+++ virt-manager-0.9.1/src/virt-manager.py.in   2012-04-03 08:45:56.493375941 -0400
10
 
@@ -251,6 +251,15 @@
 
9
--- virt-manager-0.9.1.orig/src/virt-manager.py.in      2012-04-04 13:37:49.834148495 -0400
 
10
+++ virt-manager-0.9.1/src/virt-manager.py.in   2012-04-04 13:40:41.790143763 -0400
 
11
@@ -251,6 +251,17 @@
11
12
     gtk_error = None
12
13
     origargs = " ".join(sys.argv[:])
13
14
 
14
15
+    # We need to fork before importing gtk so global menus and appindicator
15
 
+    # support works. We also need to defer parsing the command line until
16
 
+    # after gtk strips out it's own options. Cheat by taking a peek into
17
 
+    # sys.argv directly here. We have to defer dropping stdio until later
18
 
+    # once we've actually parsed the command line, or we won't get any
19
 
+    # errors or help text.
20
 
+    if not '--no-fork' in sys.argv and not '--debug' in sys.argv:
 
16
+    # support works. Unfortunately, that means we need to parse the command
 
17
+    # line before gtk can strip out it's own options.
 
18
+    (options, ignore) = parse_commandline()
 
19
+    if not options.nofork and not options.debug:
21
20
+        drop_tty()
 
21
+        drop_stdio()
 
22
+
 
23
+        # Ignore SIGHUP, otherwise a serial console closing drops the whole app
 
24
+        signal.signal(signal.SIGHUP, signal.SIG_IGN)
22
25
+
23
26
     # Urgh, pygtk merely logs a warning when failing to open
24
27
     # the X11 display connection, and lets everything carry
25
28
     # on as if all were fine. Ultimately bad stuff happens,
26
 
@@ -308,9 +317,6 @@
 
29
@@ -275,9 +286,6 @@
 
30
         gtk_error = e
 
31
     warnings.resetwarnings()
 
32
 
 
33
-    # Need to parse CLI after import gtk, since gtk strips --sync
 
34
-    (options, ignore) = parse_commandline()
 
35
-
 
36
     # Only raise this error after parsing the CLI, so users at least
 
37
     # get --help output and CLI validation
 
38
     if gtk_error:
 
39
@@ -308,9 +316,6 @@
27
40
     dbus.mainloop.glib.threads_init()
28
41
     import dbus.service
29
42
 
33
46
     import virtManager.config
34
47
     import virtManager.util
35
48
     config = virtManager.config.vmmConfig(appname, appversion, glade_dir)
36
 
@@ -325,9 +331,8 @@
 
49
@@ -325,14 +330,6 @@
37
50
     import virtManager.guidiff
38
51
     virtManager.guidiff.is_gui(True)
39
52
 
40
53
-    # Now we've got basic environment up & running we can fork
41
 
+    # Now we've got basic environment up & running we can drop stdio
42
 
     if not options.nofork and not options.debug:
 
54
-    if not options.nofork and not options.debug:
43
55
-        drop_tty()
44
 
         drop_stdio()
 
56
-        drop_stdio()
 
57
-
 
58
-        # Ignore SIGHUP, otherwise a serial console closing drops the whole app
 
59
-        signal.signal(signal.SIGHUP, signal.SIG_IGN)
 
60
-
 
61
     from virtManager.engine import vmmEngine
45
62
 
46
 
         # Ignore SIGHUP, otherwise a serial console closing drops the whole app
 
63
     gtk.window_set_default_icon_name(appname)