Skip to content

Commit

Permalink
[GTK] Use GtkSpinner when testing open port
Browse files Browse the repository at this point in the history
this switched was motivated by an error which happened each time the check
port button was clicked, and was caused by the GtkImage when loading the
loading.gif file on Windows:

    cannot register existing type 'GdkPixbufGdipAnim'

Closes: deluge-torrent#329
  • Loading branch information
DjLegolas authored and cas-- committed Jan 3, 2022
1 parent f30f7f4 commit 5321d24
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
20 changes: 19 additions & 1 deletion deluge/ui/gtk3/glade/preferences_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2727,6 +2727,24 @@ used sparingly.</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment31">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">10</property>
<child>
<object class="GtkSpinner" id="port_spinner">
<property name="visible">False</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment48">
<property name="visible">True</property>
Expand All @@ -2742,7 +2760,7 @@ used sparingly.</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</object>
Expand Down
12 changes: 6 additions & 6 deletions deluge/ui/gtk3/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ def on_response(response):

def hide(self):
self.window_open = False
self.builder.get_object('port_spinner').stop()
self.builder.get_object('port_img').hide()
self.pref_dialog.hide()

Expand Down Expand Up @@ -1084,6 +1085,8 @@ def on_test_port_clicked(self, data):
log.debug('on_test_port_clicked')

def on_get_test(status):
self.builder.get_object('port_spinner').stop()
self.builder.get_object('port_spinner').hide()
if status:
self.builder.get_object('port_img').set_from_icon_name(
'emblem-ok-symbolic', Gtk.IconSize.MENU
Expand All @@ -1096,12 +1099,9 @@ def on_get_test(status):
self.builder.get_object('port_img').show()

client.core.test_listen_port().addCallback(on_get_test)
# XXX: Consider using gtk.Spinner() instead of the loading gif
# It requires gtk.ver > 2.12
self.builder.get_object('port_img').set_from_file(
deluge.common.get_pixmap('loading.gif')
)
self.builder.get_object('port_img').show()
self.builder.get_object('port_spinner').start()
self.builder.get_object('port_spinner').show()
self.builder.get_object('port_img').hide()
client.force_call()

def on_plugin_toggled(self, renderer, path):
Expand Down

0 comments on commit 5321d24

Please sign in to comment.