[Xfce4-commits] <eatmonkey:aria2-xml-rpc> Add info bar to reconnect to aria2 server
Mike Massonnet
noreply at xfce.org
Thu Feb 11 22:58:03 CET 2010
Updating branch refs/heads/aria2-xml-rpc
to c3f200fa4cc5a1fee12e1f171eaa15011237601d (commit)
from fd103e266cf3e8b0f8aba5dd5fd0594a8bbd6cf5 (commit)
commit c3f200fa4cc5a1fee12e1f171eaa15011237601d
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Wed Feb 10 02:05:59 2010 +0100
Add info bar to reconnect to aria2 server
When the connection fails a fake "GtkInfoBar" is displayed and allows to
manually reconnect to the server.
src/eataria2.rb | 2 +-
src/eatmanager.rb | 28 ++++++++++++++++++++++------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/eataria2.rb b/src/eataria2.rb
index e07b88a..ff2bcbf 100644
--- a/src/eataria2.rb
+++ b/src/eataria2.rb
@@ -276,7 +276,7 @@ class Eat::Aria2 < GLib::Object
end
def use_local_server?()
- @use_local_server and @@pid > 0
+ @use_local_server
end
=begin
diff --git a/src/eatmanager.rb b/src/eatmanager.rb
index fecb8d4..458e213 100644
--- a/src/eatmanager.rb
+++ b/src/eatmanager.rb
@@ -21,8 +21,18 @@ class Eat::Manager
def initialize()
# Setup aria2 listener
@aria2 = Eat::Aria2Listener.instance
- @aria2.signal_connect("connected") { set_sensitive(true) }
- @aria2.signal_connect("disconnected") { set_sensitive(false) }
+ @aria2.signal_connect("connected") {
+ set_sensitive(true)
+ @infobar.hide_all
+ @infobar.set_no_show_all(true)
+ }
+ @aria2.signal_connect("disconnected") {
+ set_sensitive(false)
+ if !@aria2.use_local_server?
+ @infobar.set_no_show_all(false)
+ @infobar.show_all
+ end
+ }
@aria2.signal_connect("download_status") { |this, gid| update_row(gid) }
@aria2.signal_connect("download_completed") { |this, gid| update_row(gid) }
@aria2.signal_connect("download_removed") { |this, gid| update_row(gid) }
@@ -66,12 +76,18 @@ class Eat::Manager
# refused. It will provide a visible message with an action button to manually
# try to reconnect.
@infobar = InfoBar.new
- @infobar.set_no_show_all
- @infolabel = Label.new
- @infobar.add(@infolabel)
+=end
+ @infobar = HBox.new(false, 4)
+ @infobar.set_no_show_all(true)
+ infobutton = Button.new("Reconnect")
+ infobutton.signal_connect('clicked') { @aria2.connect(true) }
+ @infobar.pack_end(infobutton, false, false, 0)
+ infolabel = Label.new("Disconnected from aria2")
+ @infobar.pack_end(infolabel, false, false, 0)
+ infoimg = Image.new(Stock::DIALOG_ERROR, IconSize::MENU)
+ @infobar.pack_end(infoimg, false, false, 0)
hbox = builder["hbox-info-bar"]
hbox.add(@infobar)
-=end
# Setup tree view
cell = CellRendererText.new
More information about the Xfce4-commits
mailing list