1
Description: Add a first run dialog providing a user warning.
2
Author: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
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
17
DataDir = "@prefix@/share"
18
IconDir = DataDir+"/ccsm/icons"
19
PixmapDir = DataDir+"/ccsm/images"
20
+ConfigHome = os.getenv("XDG_CONFIG_HOME")
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")
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 ())
35
+# First run dialog providing a user warning.
37
+class FirstRun (gtk.MessageDialog):
38
+ '''First run dialog providing a user warning.'''
40
+ def __init__(self, parent):
41
+ gtk.MessageDialog.__init__ (self, parent,
42
+ gtk.DIALOG_DESTROY_WITH_PARENT,
43
+ gtk.MESSAGE_WARNING,
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)
54
+ check_button.connect("toggled", self.callback, "check button 1")
55
+ self.set_transient_for(parent)
56
+ self.set_modal(True)
58
+ self.connect("response", lambda *args: self.destroy ())
60
+ def callback(self, widget, data=None):
61
+ if widget.get_active() == True:
62
+ if os.path.isfile(ConfFile):
65
+ if not os.path.exists(ConfDir):
67
+ if os.path.isdir(ConfDir):
68
+ f = open(ConfFile, "w")
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
83
def try_register_dbus ():
84
'''Return instance of dbus control object on success, None on failure'''
88
from ccm.Utils import GlobalUpdater
89
-from ccm.Constants import Version
90
+from ccm.Constants import Version, ConfFile
95
idle = ccm.IdleSettingsParser(context, mainWin)
98
+# Check if we should show the first run warning dialog.
99
+if os.path.isfile(ConfFile):
102
+ warning = ccm.FirstRun(mainWin)