Label: Fix setting 'Move on completed' folder when connected to a remote daemon

This commit is contained in:
Andrew Resch 2009-03-08 20:14:42 +00:00
parent 3072fc48da
commit 849b579316
2 changed files with 37 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Fri Nov 28 19:28:51 2008 -->
<!--Generated with glade3 3.4.5 on Sun Mar 8 13:07:58 2009 -->
<glade-interface>
<widget class="GtkDialog" id="dlg_label_options">
<property name="border_width">5</property>
@ -446,18 +446,6 @@
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkFileChooserButton" id="move_completed_path">
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="move_completed">
<property name="visible">True</property>
@ -482,6 +470,29 @@
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="move_completed_path">
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="move_completed_path_entry">
<property name="can_focus">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
</widget>

View File

@ -191,7 +191,14 @@ class OptionsDialog(object):
for id in self.chk_ids:
self.glade.get_widget(id).set_active(bool(options[id]))
self.glade.get_widget("move_completed_path").set_filename(options["move_completed_path"])
if client.is_localhost():
self.glade.get_widget("move_completed_path").set_filename(options["move_completed_path"])
self.glade.get_widget("move_completed_path").show()
self.glade.get_widget("move_completed_path_entry").hide()
else:
self.glade.get_widget("move_completed_path_entry").set_text(options["move_completed_path"])
self.glade.get_widget("move_completed_path_entry").show()
self.glade.get_widget("move_completed_path").hide()
self.glade.get_widget("auto_add_trackers").get_buffer().set_text("\n".join(options["auto_add_trackers"]))
@ -206,7 +213,11 @@ class OptionsDialog(object):
for id in self.chk_ids:
options[id] = self.glade.get_widget(id).get_active()
options["move_completed_path"] = self.glade.get_widget("move_completed_path").get_filename()
if client.is_localhost():
options["move_completed_path"] = self.glade.get_widget("move_completed_path").get_filename()
else:
options["move_completed_path"] = self.glade.get_widget("move_completed_path_entry").get_text()
buff = self.glade.get_widget("auto_add_trackers").get_buffer() #sometimes I hate gtk...
tracker_lst = buff.get_text(buff.get_start_iter(), buff.get_end_iter()).strip().split("\n")
options["auto_add_trackers"] = [x for x in tracker_lst if x] #filter out empty lines.