conduit r1404 - in trunk: . conduit/modules/BoxDotNetModule



Author: thomasvm
Date: Sat Mar 29 17:43:09 2008
New Revision: 1404
URL: http://svn.gnome.org/viewvc/conduit?rev=1404&view=rev

Log:
2008-03-29  Thomas Van Machelen <thomas vanmachelen gmail com>

	* conduit/modules/BoxDotNetModule/BoxDotNetModule.py:
	* conduit/modules/BoxDotNetModule/config.glade: Give the user the
	option to load the list of folders on request; we do this
	automatically if we're already logged in.  The user can still fill in
	a text freely, that way we don't force him to login at configure time.



Modified:
   trunk/ChangeLog
   trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py
   trunk/conduit/modules/BoxDotNetModule/config.glade

Modified: trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py
==============================================================================
--- trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py	(original)
+++ trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py	Sat Mar 29 17:43:09 2008
@@ -276,24 +276,53 @@
         """
         Configures the BoxDotNet sink
         """
+        import gtk
+        import gobject
+        def load_button_clicked(button):
+            if not self.token:
+                self._login()
+
+            build_folder_store()
+
+        def build_folder_store():
+            self.folder_store.clear()
+            for folder_name in self._get_folders().keys():
+                self.folder_store.append((folder_name,))
+
         tree = Utils.dataprovider_glade_get_widget(
                         __file__,
                         "config.glade",
                         "BoxDotNetConfigDialog")
 
         #get a whole bunch of widgets
-        foldername = tree.get_widget("foldername")
+        foldername_entry = tree.get_widget("foldername_entry")
+        load_button = tree.get_widget("load_button")
+
+        # setup combobox
+        self.folder_store = gtk.ListStore(gobject.TYPE_STRING)
+        foldername_entry.set_model(self.folder_store)
+        cell = gtk.CellRendererText()
+        foldername_entry.pack_start(cell, True)
+        foldername_entry.set_text_column(0)
+
+        # already load the folders if we're logged in
+        if self.token:
+            build_folder_store()
+
+        # load button
+        load_button.connect('clicked', load_button_clicked)
 
         #preload the widgets
-        foldername.set_text(self.foldername)
+        foldername_entry.child.set_text(self.foldername)
 
+        # run the dialog
         dlg = tree.get_widget("BoxDotNetConfigDialog")
-
         response = Utils.run_dialog (dlg, window)
         if response == True:
             # get the values from the widgets
-            self.foldername = foldername.get_text()
+            self.foldername = foldername_entry.child.get_text()
 
+        del self.folder_store
         dlg.destroy()
 
     def is_configured (self, isSource, isTwoWay):

Modified: trunk/conduit/modules/BoxDotNetModule/config.glade
==============================================================================
--- trunk/conduit/modules/BoxDotNetModule/config.glade	(original)
+++ trunk/conduit/modules/BoxDotNetModule/config.glade	Sat Mar 29 17:43:09 2008
@@ -94,16 +94,40 @@
       </child>
 
       <child>
-	<widget class="GtkEntry" id="foldername">
+	<widget class="GtkHBox" id="hbox1">
 	  <property name="visible">True</property>
-	  <property name="can_focus">True</property>
-	  <property name="editable">True</property>
-	  <property name="visibility">True</property>
-	  <property name="max_length">0</property>
-	  <property name="text" translatable="yes"></property>
-	  <property name="has_frame">True</property>
-	  <property name="invisible_char">â</property>
-	  <property name="activates_default">False</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkComboBoxEntry" id="foldername_entry">
+	      <property name="visible">True</property>
+	      <property name="add_tearoffs">False</property>
+	      <property name="has_frame">True</property>
+	      <property name="focus_on_click">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="load_button">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Load</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>



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