[hamster-applet] hiding workspace tab if there is no wnck



commit 9477f0cab7ba51b8a599708164969e3eee87f2dc
Author: Toms Bauģis <toms baugis gmail com>
Date:   Tue Jan 19 12:53:01 2010 +0000

    hiding workspace tab if there is no wnck

 data/preferences.ui    |    3 ++-
 hamster/preferences.py |   22 +++++++++++++---------
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index 1182a93..b640201 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -697,8 +697,9 @@
               </packing>
             </child>
             <child>
-              <object class="GtkAlignment" id="alignment11">
+              <object class="GtkAlignment" id="workspace_tab">
                 <property name="visible">True</property>
+                <property name="no_show_all">True</property>
                 <property name="top_padding">12</property>
                 <property name="bottom_padding">8</property>
                 <property name="left_padding">4</property>
diff --git a/hamster/preferences.py b/hamster/preferences.py
index bb1e97a..4106c4f 100755
--- a/hamster/preferences.py
+++ b/hamster/preferences.py
@@ -27,6 +27,11 @@ import gtk
 
 import datetime as dt
 
+try:
+    import wnck
+except:
+    wnck = None
+
 def get_prev(selection, model):
     (model, iter) = selection.get_selected()
 
@@ -214,17 +219,16 @@ class PreferencesEditor:
 
 
         # disable workspace tracking if wnck is not there
-        try:
-            import wnck
-        except:
-            self.get_widget("workspace_frame").hide()
+        if wnck:
+            self.screen = wnck.screen_get_default()
+            for workspace in self.screen.get_workspaces():
+                self.on_workspace_created(self.screen, workspace)
 
-        self.screen = wnck.screen_get_default()
-        for workspace in self.screen.get_workspaces():
-            self.on_workspace_created(self.screen, workspace)
+            self.screen.workspace_add_handler = self.screen.connect("workspace-created", self.on_workspace_created)
+            self.screen.workspace_del_handler = self.screen.connect("workspace-destroyed", self.on_workspace_deleted)
+        else:
+            self.get_widget("workspace_tab").hide()
 
-        self.screen.workspace_add_handler = self.screen.connect("workspace-created", self.on_workspace_created)
-        self.screen.workspace_del_handler = self.screen.connect("workspace-destroyed", self.on_workspace_deleted)
 
         self._gui.connect_signals(self)
         self.window.show_all()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]