deskbar-applet r2016 - in trunk: . deskbar/interfaces deskbar/ui



Author: sebp
Date: Wed Mar 19 18:06:07 2008
New Revision: 2016
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2016&view=rev

Log:
Mark history ComboBox insensitive when no items are in history (fixes bug #486072)

Modified:
   trunk/ChangeLog
   trunk/deskbar/interfaces/View.py
   trunk/deskbar/ui/CuemiacAlignedView.py
   trunk/deskbar/ui/CuemiacWindowController.py
   trunk/deskbar/ui/CuemiacWindowView.py

Modified: trunk/deskbar/interfaces/View.py
==============================================================================
--- trunk/deskbar/interfaces/View.py	(original)
+++ trunk/deskbar/interfaces/View.py	Wed Mar 19 18:06:07 2008
@@ -40,4 +40,7 @@
         raise NotImplementedError
        
     def display_actions(self, actions, qstring):
+        raise NotImplementedError
+    
+    def mark_history_empty(self, val):
         raise NotImplementedError
\ No newline at end of file

Modified: trunk/deskbar/ui/CuemiacAlignedView.py
==============================================================================
--- trunk/deskbar/ui/CuemiacAlignedView.py	(original)
+++ trunk/deskbar/ui/CuemiacAlignedView.py	Wed Mar 19 18:06:07 2008
@@ -195,6 +195,12 @@
         self.present_with_time(time)
         self.entry.grab_focus()
         
+    def mark_history_empty(self, val):
+        if val:
+            self.hview.set_sensitive (False)
+        else:
+            self.hview.set_sensitive (True)
+        
     def __show_matches(self):
         self.scrolled_results.show()
         self.actions_box.hide()

Modified: trunk/deskbar/ui/CuemiacWindowController.py
==============================================================================
--- trunk/deskbar/ui/CuemiacWindowController.py	(original)
+++ trunk/deskbar/ui/CuemiacWindowController.py	Wed Mar 19 18:06:07 2008
@@ -18,6 +18,7 @@
     def __init__(self, model):
         super(CuemiacWindowController, self).__init__(model)
         self._model.connect("keybinding-activated", self.on_keybinding_activated)
+        self._model.connect("initialized", self.on_core_initialized)
         self._clipboard = gtk.clipboard_get (selection="PRIMARY")
         
     def on_keybinding_activated(self, core, time, paste=True):
@@ -134,6 +135,11 @@
         if not action.is_valid():
             LOGGER.warning("Action is not valid anymore")
             return
+        
+        # Check if only the "Choose action" item is in history
+        if len(self._model.get_history()) == 1:
+            self._view.mark_history_empty(False)
+            
         self._model.get_history().add(text, action)
         action.activate(text)
         if self._model.get_clear_entry():
@@ -146,6 +152,7 @@
         history.clear()
         history.reset()
         history.save()
+        self._view.mark_history_empty(True)
         
     def on_history_match_selected(self, history, text, action):
         action.activate(text)
@@ -168,3 +175,6 @@
     def on_category_added (self, widget, cat, path):
         if cat.get_id() not in self._model.get_collapsed_cat():
             self._view.cview.expand_row (path, False)
+            
+    def on_core_initialized (self, core):
+        self._view.mark_history_empty ( (len(core.get_history()) == 1) )

Modified: trunk/deskbar/ui/CuemiacWindowView.py
==============================================================================
--- trunk/deskbar/ui/CuemiacWindowView.py	(original)
+++ trunk/deskbar/ui/CuemiacWindowView.py	Wed Mar 19 18:06:07 2008
@@ -187,7 +187,13 @@
         self.window.set_user_time(time)
         self.present()
         self.move( self._model.get_window_x(), self._model.get_window_y() )
-    
+        
+    def mark_history_empty(self, val):
+        if val:
+            self.hview.set_sensitive (False)
+        else:
+            self.hview.set_sensitive (True)
+        
     def __show_matches(self):
         self.scrolled_results.show()
         self.actions_box.hide()



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