summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIzhar Firdaus <kagesenshi.87@gmail.com>2008-12-26 22:51:47 +0800
committerIzhar Firdaus <kagesenshi.87@gmail.com>2008-12-26 22:51:47 +0800
commita374af1923d3df3164b5f3a2b2b4e6e0e131e43b (patch)
treeb68a92a5e18d3f48b73ae8425408c232b56b54b0
parenta135e14deb0a90f931358a28a4ec19c74d78a7e3 (diff)
downloadfusion-desktop-effects-a374af1923d3df3164b5f3a2b2b4e6e0e131e43b.tar.gz
fusion-desktop-effects-a374af1923d3df3164b5f3a2b2b4e6e0e131e43b.tar.xz
fusion-desktop-effects-a374af1923d3df3164b5f3a2b2b4e6e0e131e43b.zip
- added enable desktop integration checkbox
-rwxr-xr-xfusion-desktop-effects.in48
1 files changed, 48 insertions, 0 deletions
diff --git a/fusion-desktop-effects.in b/fusion-desktop-effects.in
index 1bb4d81..c8853c5 100755
--- a/fusion-desktop-effects.in
+++ b/fusion-desktop-effects.in
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import gtk
+import gtk.gdk
import sys
import gobject
import gettext
@@ -8,6 +9,7 @@ import subprocess
import time
import gconf
import os
+import compizconfig
_ = gettext.gettext
gettext.bindtextdomain("fusion-desktop-effects", "@prefix@/share/locale")
@@ -17,6 +19,15 @@ COMPIZ_WM = "compiz-fusion-gtk"
WM_KEY = "/desktop/gnome/session/required_components/windowmanager"
BANNER = "@datadir@/cf_logo.png"
+def get_screens():
+ screens = []
+ display = gtk.gdk.display_get_default()
+ nScreens = display.get_n_screens()
+ for i in range(nScreens):
+ screens.append(i)
+ return screens
+
+
def enable_compiz():
gc = gconf.client_get_default()
gc.set_string(WM_KEY,COMPIZ_WM)
@@ -39,6 +50,10 @@ def command_exists(cmd):
class MainWindow:
def __init__(self):
self.window = gtk.Dialog()
+
+ self.Screens = get_screens()
+ self.Context = compizconfig.Context(self.Screens)
+
self.window.set_title(_("Compiz Fusion"))
self.togglebutton = gtk.ToggleButton(_("Enable Compiz Fusion Desktop Effects"))
self.window.set_resizable(False)
@@ -57,10 +72,25 @@ class MainWindow:
img = gtk.Image()
img.set_from_file(BANNER)
+ integrationbutton = gtk.CheckButton('Enable desktop integration')
+ integrationbutton.set_active(self.Context.Integration)
+
+ integrationbutton.connect('toggled',self.integration_add_timeout)
+
+ allow_integration = False
+ available_backends = [b.Name for b in self.Context.Backends.values()]
+ if os.environ['DESKTOP_SESSION'] == "gnome" and 'gconf' in available_backends:
+ allow_integration = True
+ elif os.environ['DESKTOP_SESSION'] == "kde" and 'kconfig' in available_backends:
+ allow_integration = True
+
+ integrationbutton.set_sensitive(allow_integration)
+
vbox.pack_start(img)
hbox.pack_start(vbox,padding=10)
vbox.pack_start(heading)
vbox.pack_start(self.togglebutton)
+ vbox.pack_start(integrationbutton,padding=5)
prefimg = gtk.Image()
prefimg.set_from_icon_name('gtk-preferences',1)
@@ -111,6 +141,24 @@ class MainWindow:
def launch_ccsm(self,widget):
subprocess.Popen(['ccsm'])
+ def integration_add_timeout(self,widget):
+ gobject.timeout_add(500,self.toggle_integration,widget)
+
+ def toggle_integration(self,widget):
+ enable = widget.get_active()
+ if enable:
+ available_backends = [b.Name for b in self.Context.Backends.values()]
+ if os.environ['DESKTOP_SESSION'] == "gnome" and 'gconf' in available_backends:
+ if self.Context.CurrentBackend.Name != 'gconf':
+ self.Context.CurrentBackend = self.Context.Backends['gconf']
+ elif os.environ['DESKTOP_SESSION'] == "kde" and 'kconfig' in available_backends:
+ if self.Context.CurrentBackend.Name != 'kconfig':
+ self.Context.CurrentBackend = self.Context.Backends['kconfig']
+ self.Context.Integration = True
+ else:
+ self.Context.CurrentBackend = self.Context.Backends['ini']
+ self.Context.Integration = False
+
class TimeoutDialog:
def __init__(self,togglebutton):