deskbar-applet r1825 - in trunk: . data deskbar/core deskbar/ui/preferences



Author: sebp
Date: Wed Jan  9 21:02:08 2008
New Revision: 1825
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=1825&view=rev

Log:
Added button to preference to reload all modules.
(fixes bug #356008: a 'reload all scripts' button on the deskbar applet)
patch by Jc Razo

Modified:
   trunk/ChangeLog
   trunk/data/prefs-dialog.glade
   trunk/deskbar/core/CoreImpl.py
   trunk/deskbar/core/ModuleLoader.py
   trunk/deskbar/ui/preferences/DeskbarPreferences.py

Modified: trunk/data/prefs-dialog.glade
==============================================================================
--- trunk/data/prefs-dialog.glade	(original)
+++ trunk/data/prefs-dialog.glade	Wed Jan  9 21:02:08 2008
@@ -224,6 +224,84 @@
 			      <property name="spacing">6</property>
 
 			      <child>
+				<widget class="GtkButton" id="reload">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="relief">GTK_RELIEF_NORMAL</property>
+				  <property name="focus_on_click">True</property>
+
+				  <child>
+				    <widget class="GtkAlignment" id="alignment30">
+				      <property name="visible">True</property>
+				      <property name="xalign">0.5</property>
+				      <property name="yalign">0.5</property>
+				      <property name="xscale">0</property>
+				      <property name="yscale">0</property>
+				      <property name="top_padding">0</property>
+				      <property name="bottom_padding">0</property>
+				      <property name="left_padding">0</property>
+				      <property name="right_padding">0</property>
+
+				      <child>
+					<widget class="GtkHBox" id="hbox199">
+					  <property name="visible">True</property>
+					  <property name="homogeneous">False</property>
+					  <property name="spacing">2</property>
+
+					  <child>
+					    <widget class="GtkImage" id="image8">
+					      <property name="visible">True</property>
+					      <property name="stock">gtk-refresh</property>
+					      <property name="icon_size">4</property>
+					      <property name="xalign">0.5</property>
+					      <property name="yalign">0.5</property>
+					      <property name="xpad">0</property>
+					      <property name="ypad">0</property>
+					    </widget>
+					    <packing>
+					      <property name="padding">0</property>
+					      <property name="expand">False</property>
+					      <property name="fill">False</property>
+					    </packing>
+					  </child>
+
+					  <child>
+					    <widget class="GtkLabel" id="label1332">
+					      <property name="visible">True</property>
+					      <property name="label" translatable="yes">_Reload</property>
+					      <property name="use_underline">True</property>
+					      <property name="use_markup">False</property>
+					      <property name="justify">GTK_JUSTIFY_LEFT</property>
+					      <property name="wrap">False</property>
+					      <property name="selectable">False</property>
+					      <property name="xalign">0.5</property>
+					      <property name="yalign">0.5</property>
+					      <property name="xpad">0</property>
+					      <property name="ypad">0</property>
+					      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+					      <property name="width_chars">-1</property>
+					      <property name="single_line_mode">False</property>
+					      <property name="angle">0</property>
+					    </widget>
+					    <packing>
+					      <property name="padding">0</property>
+					      <property name="expand">False</property>
+					      <property name="fill">False</property>
+					    </packing>
+					  </child>
+					</widget>
+				      </child>
+				    </widget>
+				  </child>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
 				<widget class="GtkButton" id="more">
 				  <property name="visible">True</property>
 				  <property name="can_focus">True</property>

Modified: trunk/deskbar/core/CoreImpl.py
==============================================================================
--- trunk/deskbar/core/CoreImpl.py	(original)
+++ trunk/deskbar/core/CoreImpl.py	Wed Jan  9 21:02:08 2008
@@ -237,6 +237,13 @@
         else:
             self._module_loader.initialize_module(module)
         self._module_list.increase_bottom_enabled_path()
+
+    def reload_all_modules(self):
+        self._module_list.clear()
+        self._disabled_module_list.clear()
+        logging.info("Reloading all modules")
+        self._module_loader.emit("modules-reloading")
+        self._module_loader.load_all()
     
     def stop_queries(self):
         self._stop_queries = True
@@ -337,4 +344,4 @@
     def forward_query_ready(self, handler, query, matches):
         if query == self._last_query and matches != None and len(matches) > 0 and not self._stop_queries:
             self._emit_query_ready(matches)
-        
\ No newline at end of file
+        

Modified: trunk/deskbar/core/ModuleLoader.py
==============================================================================
--- trunk/deskbar/core/ModuleLoader.py	(original)
+++ trunk/deskbar/core/ModuleLoader.py	Wed Jan  9 21:02:08 2008
@@ -34,6 +34,8 @@
         "module-not-initialized" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]),
         # Fired when the passed module module has run the stop() method successfully. The module is not usable anymore
         "module-stopped" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]),
+        #Fired when reload_all gets called, but before any reloading actually gets done
+        "modules-reloading" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, []),
     }
     
     def __init__ (self, dirs, extension=".py"):

Modified: trunk/deskbar/ui/preferences/DeskbarPreferences.py
==============================================================================
--- trunk/deskbar/ui/preferences/DeskbarPreferences.py	(original)
+++ trunk/deskbar/ui/preferences/DeskbarPreferences.py	Wed Jan  9 21:02:08 2008
@@ -74,6 +74,9 @@
         self.more_button.set_sensitive(False)
         self.more_button.connect("clicked", self.on_more_button_clicked)
         self.more_button_callback = None
+        self.reload_button = self.glade.get_widget("reload")
+        self.reload_button.connect("clicked", self.on_reload_button_clicked)
+        self.reload_button.set_tooltip_text(_("Reload all extensions"))
 
         # Info are at the bottom
         self.info_area = self.glade.get_widget("info_area")
@@ -220,6 +223,9 @@
     def on_more_button_clicked(self, button):
         if self.more_button_callback != None:
             self.more_button_callback(self.dialog)
+
+    def on_reload_button_clicked(self, button):
+	self._model.reload_all_modules()
     
     def on_module_selected(self, selection):
         module_context = self.moduleview.get_selected_module()



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