~smspillaz/compiz/experimental

« back to all changes in this revision

Viewing changes to debian/patches/ccsm_add_first_run_warning.patch

  • Committer: Daniel van Vugt
  • Author(s): Michael Terry
  • Date: 2012-11-06 02:27:15 UTC
  • mfrom: (3450.1.2 compiz.inline.orig)
  • Revision ID: daniel.van.vugt@canonical.com-20121106022715-8lltd00qklkv008i
Bring debian/ packaging inline.

Reviewed/tested/approved by Daniel van Vugt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Add a first run dialog providing a user warning.
 
2
Author: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
 
3
 
 
4
=== modified file 'ccm/Widgets.py'
 
5
diff -Nur -x '*.orig' -x '*~' a/compizconfig/ccsm/ccm/Constants.py.in b/compizconfig/ccsm/ccm/Constants.py.in
 
6
--- a/compizconfig/ccsm/ccm/Constants.py.in     2012-02-01 13:30:19.131478000 -0500
 
7
+++ b/compizconfig/ccsm/ccm/Constants.py.in     2012-02-13 18:26:19.699626332 -0500
 
8
@@ -23,6 +23,7 @@
 
9
 import pygtk
 
10
 import gtk
 
11
 import gtk.gdk
 
12
+import os
 
13
 
 
14
 # Current Screen
 
15
 #
 
16
@@ -66,6 +67,11 @@
 
17
 DataDir = "@prefix@/share"
 
18
 IconDir = DataDir+"/ccsm/icons"
 
19
 PixmapDir = DataDir+"/ccsm/images"
 
20
+ConfigHome = os.getenv("XDG_CONFIG_HOME")
 
21
+if not ConfigHome:
 
22
+   ConfigHome = os.path.join(os.getenv("HOME"), ".config")
 
23
+ConfDir = os.path.join(ConfigHome, "compiz-1/compizconfig/")
 
24
+ConfFile = os.path.join(ConfDir, "firstrun")
 
25
 
 
26
 # Version
 
27
 #
 
28
diff -Nur -x '*.orig' -x '*~' a/compizconfig/ccsm/ccm/Widgets.py b/compizconfig/ccsm/ccm/Widgets.py
 
29
--- a/compizconfig/ccsm/ccm/Widgets.py  2012-02-02 22:43:52.623481000 -0500
 
30
+++ b/compizconfig/ccsm/ccm/Widgets.py  2012-02-13 18:25:55.659409730 -0500
 
31
@@ -1371,6 +1371,42 @@
 
32
         self.set_transient_for (parent)
 
33
         self.connect_after ("response", lambda *args: self.destroy ())
 
34
 
 
35
+# First run dialog providing a user warning.
 
36
+#
 
37
+class FirstRun (gtk.MessageDialog):
 
38
+    '''First run dialog providing a user warning.'''
 
39
+
 
40
+    def __init__(self, parent):
 
41
+        gtk.MessageDialog.__init__ (self, parent,
 
42
+                                    gtk.DIALOG_DESTROY_WITH_PARENT,
 
43
+                                    gtk.MESSAGE_WARNING,
 
44
+                                    gtk.BUTTONS_OK)
 
45
+        self.set_position (gtk.WIN_POS_CENTER)
 
46
+        title = _("CCSM is an advanced tool. Use with caution.")
 
47
+        self.set_markup("<b>%s</b>" % title)
 
48
+        message = _("This tool allows you to deeply configure Compiz's settings. Some options may be incompatible with each other. Unless used with care, it is possible to be left with an unusable desktop.")
 
49
+        self.format_secondary_markup(message)
 
50
+        check_button = gtk.CheckButton(label=_("Show this warning next time?"))
 
51
+        check_button.set_active(True)
 
52
+        self.vbox.pack_start(check_button, True, True, 2)
 
53
+        check_button.show()
 
54
+        check_button.connect("toggled", self.callback, "check button 1")
 
55
+        self.set_transient_for(parent)
 
56
+        self.set_modal(True)
 
57
+        self.show_all()
 
58
+        self.connect("response", lambda *args: self.destroy ())
 
59
+        
 
60
+    def callback(self, widget, data=None):
 
61
+        if widget.get_active() == True:
 
62
+            if os.path.isfile(ConfFile):
 
63
+                os.remove(ConfFile)
 
64
+        else:
 
65
+            if not os.path.exists(ConfDir):
 
66
+                os.mkdir(ConfDir)
 
67
+            if os.path.isdir(ConfDir):
 
68
+                f = open(ConfFile, "w")
 
69
+                f.close()
 
70
+
 
71
 # Plugin Button
 
72
 #
 
73
 class PluginButton (gtk.HBox):
 
74
diff -Nur -x '*.orig' -x '*~' a/compizconfig/ccsm/ccsm b/compizconfig/ccsm/ccsm
 
75
--- a/compizconfig/ccsm/ccsm    2012-02-02 16:42:01.161305000 -0500
 
76
+++ b/compizconfig/ccsm/ccsm    2012-02-13 18:25:55.663409766 -0500
 
77
@@ -31,6 +31,7 @@
 
78
 pygtk.require('2.0')
 
79
 import gtk
 
80
 import sys
 
81
+import os
 
82
 
 
83
 def try_register_dbus ():
 
84
     '''Return instance of dbus control object on success, None on failure'''
 
85
@@ -92,7 +93,7 @@
 
86
 import compizconfig
 
87
 import ccm
 
88
 from ccm.Utils import GlobalUpdater
 
89
-from ccm.Constants import Version
 
90
+from ccm.Constants import Version, ConfFile
 
91
 
 
92
 plugin   = None
 
93
 category = None
 
94
@@ -124,4 +125,11 @@
 
95
 idle = ccm.IdleSettingsParser(context, mainWin)
 
96
 mainWin.show_all()
 
97
 
 
98
+# Check if we should show the first run warning dialog.
 
99
+if os.path.isfile(ConfFile):
 
100
+    pass
 
101
+else:
 
102
+    warning = ccm.FirstRun(mainWin)
 
103
+    warning.show_all()
 
104
+
 
105
 gtk.main()