[Xfce4-commits] <eatmonkey:aria2-xml-rpc> Add Advanced tab in settings dialog

Mike Massonnet noreply at xfce.org
Sun Jan 24 23:26:06 CET 2010


Updating branch refs/heads/aria2-xml-rpc
         to 8205555e1488519ee087a11ea9809790fea5d4d0 (commit)
       from e9fce19b4ca73c4ab61ee7031368da55e94eb0f7 (commit)

commit 8205555e1488519ee087a11ea9809790fea5d4d0
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sun Jan 24 23:20:23 2010 +0100

    Add Advanced tab in settings dialog
    
    The new tab contains extra options for aria2. Also hardcoded the option
    daemon to false when running the XML-RPC server.

 src/eataria2.rb    |    3 +-
 src/eatsettings.rb |   26 +++++-
 src/manager.ui     |   42 ++++----
 src/settings.ui    |  275 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 319 insertions(+), 27 deletions(-)

diff --git a/src/eataria2.rb b/src/eataria2.rb
index a20a055..42bcc2d 100644
--- a/src/eataria2.rb
+++ b/src/eataria2.rb
@@ -104,7 +104,8 @@ class Eat::Aria2 < GLib::Object
 				# Cleanup log file
 				FileUtils.rm(@confdir+"/aria2.log", :force => true)
 				# Launch aria2c process
-				command = "aria2c --disable-ipv6=true --enable-xml-rpc --xml-rpc-listen-port=#{@port} " \
+				command = "aria2c --disable-ipv6=true --daemon=false " \
+					"--enable-xml-rpc --xml-rpc-listen-port=#{@port} " \
 					"--conf-path=#{@confdir}/aria2.conf --log=#{@confdir}/aria2.log --log-level=notice " \
 					"--dht-file-path=#{@confdir}/dht.dat"
 				debug("start server", command)
diff --git a/src/eatsettings.rb b/src/eatsettings.rb
index 397cdce..1cd6ec5 100644
--- a/src/eatsettings.rb
+++ b/src/eatsettings.rb
@@ -30,7 +30,7 @@ class Eat::Settings
 
 	def default_values()
 		# Download Directory
-		# g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD) or how not to waste time
+		# TODO use g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD) or how not to waste time
 		if @aria2["dir"] == nil
 			if ENV["XDG_DOWNLOAD_DIR"] != nil
 				@aria2["dir"] = ENV["XDG_DOWNLOAD_DIR"]
@@ -55,10 +55,16 @@ class Eat::Settings
 			end
 		end
 
+		# Default preferred locations
+		if @aria2["metalink-location"].empty?
+			@aria2["metalink-location"] = "fr,de,be,se" # TODO read from current locale
+		end
+
 		# XML-RPC Server
 		@values["custom-server"] = false
 		@values["xmlrpc-host"] = "127.0.0.1"
 		@values["xmlrpc-port"] = 6800
+		@values["enable-upnp"] = false
 	end
 
 	def parse()
@@ -140,6 +146,13 @@ class Eat::SettingsDialog
 		@bittorrent[:enable_dht] = builder["enable-dht"]
 		@bittorrent[:enable_pex] = builder["enable-pex"]
 		@bittorrent[:require_encryption] = builder["require-encryption"]
+		@advanced = Hash.new
+		@advanced[:vbox] = builder["advanced-vbox"]
+		@advanced[:certificates] = builder["certificates"]
+		@advanced[:split] = builder["split"]
+		@advanced[:locations] = builder["locations"]
+		@advanced[:listen_port] = builder["listen-port"]
+		@advanced[:enable_upnp] = builder["enable-upnp"]
 
 		# Setup parent window
 		@dialog.set_transient_for(parent_window)
@@ -163,6 +176,11 @@ class Eat::SettingsDialog
 		@bittorrent[:enable_dht].active = @settings.aria2["enable-dht"]
 		@bittorrent[:enable_pex].active = @settings.aria2["enable-peer-exchange"]
 		@bittorrent[:require_encryption].active = @settings.aria2["bt-require-crypto"]
+		@advanced[:certificates].active = @settings.aria2["check-certificate"]
+		@advanced[:split].value = @settings.aria2["split"]
+		@advanced[:locations].text = @settings.aria2["metalink-location"]
+		@advanced[:listen_port].value = @settings.aria2["listen-port"].to_i
+		@advanced[:enable_upnp].active = @settings["enable-upnp"]
 
 		@dialog.vbox.show_all
 	end
@@ -182,6 +200,7 @@ class Eat::SettingsDialog
 			@settings["xmlrpc-port"] = @xmlrpc[:port].value_as_int
 			@settings["xmlrpc-user"] = @xmlrpc[:user].text
 			@settings["xmlrpc-passwd"] = @xmlrpc[:passwd].text
+			@settings["enable-upnp"] = @advanced[:enable_upnp].active?
 			@settings.aria2["max-concurrent-downloads"] = @basic_options[:max_concurrent_downloads].value_as_int
 			@settings.aria2["max-overall-download-limit"] = @basic_options[:max_download_speed].value_as_int
 			@settings.aria2["dir"] = @basic_options[:download_dir_button].current_folder
@@ -191,6 +210,10 @@ class Eat::SettingsDialog
 			@settings.aria2["enable-dht"] = @bittorrent[:enable_dht].active?
 			@settings.aria2["enable-peer-exchange"] = @bittorrent[:enable_pex].active?
 			@settings.aria2["bt-require-crypto"] = @bittorrent[:require_encryption].active?
+			@settings.aria2["check-certificate"] = @advanced[:certificates].active?
+			@settings.aria2["split"] = @advanced[:split].value_as_int
+			@settings.aria2["metalink-location"] = @advanced[:locations].text
+			@settings.aria2["listen-port"] = @advanced[:listen_port].value_as_int
 			@settings.save
 		end
 
@@ -210,6 +233,7 @@ class Eat::SettingsDialog
 		@xmlrpc[:vbox].set_sensitive(active)
 		@basic_options[:frame].set_sensitive(!active)
 		@bittorrent[:frame].set_sensitive(!active)
+		@advanced[:vbox].set_sensitive(!active)
 	end
 
 end
diff --git a/src/manager.ui b/src/manager.ui
index c668ea6..029c0d1 100644
--- a/src/manager.ui
+++ b/src/manager.ui
@@ -52,8 +52,8 @@
                     <child>
                       <object class="GtkImageMenuItem" id="menuitem-add">
                         <property name="visible">True</property>
-                        <property name="related_action">action-add</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">action-add</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                       </object>
@@ -61,8 +61,8 @@
                     <child>
                       <object class="GtkImageMenuItem" id="menuitem-pause">
                         <property name="visible">True</property>
-                        <property name="related_action">action-pause</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">action-pause</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                       </object>
@@ -80,8 +80,8 @@
                     <child>
                       <object class="GtkImageMenuItem" id="menuitem-remove">
                         <property name="visible">True</property>
-                        <property name="related_action">action-remove</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">action-remove</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                       </object>
@@ -94,8 +94,8 @@
                     <child>
                       <object class="GtkImageMenuItem" id="menuitem-quit">
                         <property name="visible">True</property>
-                        <property name="related_action">action-quit</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">action-quit</property>
                         <property name="accel_path"><Manager>/File/Quit</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
@@ -116,8 +116,8 @@
                     <child>
                       <object class="GtkImageMenuItem" id="menuitem-settings">
                         <property name="visible">True</property>
-                        <property name="related_action">action-settings</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">action-settings</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                       </object>
@@ -137,8 +137,8 @@
                     <child>
                       <object class="GtkCheckMenuItem" id="menuitem-showmenubar">
                         <property name="visible">True</property>
-                        <property name="related_action">toggleaction-showmenubar</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">toggleaction-showmenubar</property>
                         <property name="use_underline">True</property>
                         <property name="active">True</property>
                       </object>
@@ -146,8 +146,8 @@
                     <child>
                       <object class="GtkCheckMenuItem" id="menuitem-showtoolbar">
                         <property name="visible">True</property>
-                        <property name="related_action">toggleaction-showtoolbar</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">toggleaction-showtoolbar</property>
                         <property name="use_underline">True</property>
                         <property name="active">True</property>
                       </object>
@@ -213,8 +213,8 @@
                     <child>
                       <object class="GtkImageMenuItem" id="menuitem-about">
                         <property name="visible">True</property>
-                        <property name="related_action">action-about</property>
                         <property name="use_action_appearance">True</property>
+                        <property name="related_action">action-about</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                       </object>
@@ -235,8 +235,8 @@
             <child>
               <object class="GtkToolButton" id="toolbutton-add">
                 <property name="visible">True</property>
-                <property name="related_action">action-add</property>
                 <property name="use_action_appearance">True</property>
+                <property name="related_action">action-add</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -247,8 +247,8 @@
             <child>
               <object class="GtkToolButton" id="toolbutton-pause">
                 <property name="visible">True</property>
-                <property name="related_action">action-pause</property>
                 <property name="use_action_appearance">True</property>
+                <property name="related_action">action-pause</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -259,8 +259,8 @@
             <child>
               <object class="GtkToolButton" id="toolbutton-resume">
                 <property name="visible">True</property>
-                <property name="related_action">action-resume</property>
                 <property name="use_action_appearance">True</property>
+                <property name="related_action">action-resume</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -271,8 +271,8 @@
             <child>
               <object class="GtkToolButton" id="toolbutton-remove">
                 <property name="visible">True</property>
-                <property name="related_action">action-remove</property>
                 <property name="use_action_appearance">True</property>
+                <property name="related_action">action-remove</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -292,8 +292,8 @@
             <child>
               <object class="GtkToolButton" id="toolbutton-settings">
                 <property name="visible">True</property>
-                <property name="related_action">action-settings</property>
                 <property name="use_action_appearance">True</property>
+                <property name="related_action">action-settings</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -304,8 +304,8 @@
             <child>
               <object class="GtkToolButton" id="toolbutton-about">
                 <property name="visible">True</property>
-                <property name="related_action">action-about</property>
                 <property name="use_action_appearance">True</property>
+                <property name="related_action">action-about</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -316,8 +316,8 @@
             <child>
               <object class="GtkToolButton" id="toolbutton-quit">
                 <property name="visible">True</property>
-                <property name="related_action">action-quit</property>
                 <property name="use_action_appearance">True</property>
+                <property name="related_action">action-quit</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -674,8 +674,8 @@
             <property name="visible">True</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button2">
-                <property name="label">gtk-add</property>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -688,8 +688,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button1">
-                <property name="label">gtk-cancel</property>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-add</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -711,8 +711,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-5">button2</action-widget>
       <action-widget response="-6">button1</action-widget>
+      <action-widget response="-5">button2</action-widget>
     </action-widgets>
   </object>
   <object class="GtkImage" id="image2">
@@ -731,8 +731,8 @@
     <property name="skip_pager_hint">True</property>
     <property name="transient_for">dialog-new-download</property>
     <property name="has_separator">False</property>
-    <property name="create_folders">False</property>
     <property name="filter">filefilter-new-download</property>
+    <property name="create_folders">False</property>
     <property name="use_preview_label">False</property>
     <property name="preview_widget_active">False</property>
     <child internal-child="vbox">
diff --git a/src/settings.ui b/src/settings.ui
index 43494cf..b8a8b64 100644
--- a/src/settings.ui
+++ b/src/settings.ui
@@ -672,10 +672,259 @@
               </packing>
             </child>
             <child>
-              <placeholder/>
+              <object class="GtkVBox" id="advanced-vbox">
+                <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkFrame" id="frame2">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment3">
+                        <property name="visible">True</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox6">
+                            <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkCheckButton" id="certificates">
+                                <property name="label" translatable="yes">Check HTTPS certificates</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHBox" id="hbox12">
+                                <property name="visible">True</property>
+                                <property name="tooltip_text" translatable="yes">Number of connections to open for one file to download</property>
+                                <property name="spacing">4</property>
+                                <child>
+                                  <object class="GtkLabel" id="label25">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Number of fragmentation:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkSpinButton" id="split">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">&#x2022;</property>
+                                    <property name="adjustment">adjustment-split</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHBox" id="hbox13">
+                                <property name="visible">True</property>
+                                <property name="tooltip_text" translatable="yes">List of country codes separated by commas like JP,US to use for Metalink</property>
+                                <property name="spacing">4</property>
+                                <child>
+                                  <object class="GtkLabel" id="label26">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Preferred locations:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkEntry" id="locations">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">&#x2022;</property>
+                                    <property name="width_chars">8</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label23">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Advanced Download Options</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame3">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment5">
+                        <property name="visible">True</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox7">
+                            <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkHBox" id="hbox10">
+                                <property name="visible">True</property>
+                                <property name="spacing">4</property>
+                                <child>
+                                  <object class="GtkLabel" id="label24">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Listen port:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkSpinButton" id="listen-port">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">&#x2022;</property>
+                                    <property name="adjustment">adjustment-listen-port</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="enable-upnp">
+                                <property name="label" translatable="yes">Negociate automatic port redirection with UPnP</property>
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label27">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Network</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox11">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkButton" id="button3">
+                        <property name="label" translatable="yes">Edit configuration</property>
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="image">image1</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
             </child>
             <child type="tab">
-              <placeholder/>
+              <object class="GtkLabel" id="label22">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Advanced</property>
+              </object>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+              </packing>
             </child>
           </object>
           <packing>
@@ -758,8 +1007,8 @@
   <object class="GtkAdjustment" id="adjustment-seed-ratio">
     <property name="value">1</property>
     <property name="upper">99</property>
-    <property name="step_increment">0.1</property>
-    <property name="page_increment">0.1</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">0.10000000000000001</property>
   </object>
   <object class="GtkAdjustment" id="adjustment-max-peers">
     <property name="value">55</property>
@@ -767,4 +1016,22 @@
     <property name="step_increment">5</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="stock">gtk-edit</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment-split">
+    <property name="value">5</property>
+    <property name="lower">1</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment-listen-port">
+    <property name="value">6800</property>
+    <property name="lower">1025</property>
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
 </interface>



More information about the Xfce4-commits mailing list