add pause all and resume all to tray
This commit is contained in:
parent
12fe0930b3
commit
1f12f3b421
|
@ -14,6 +14,40 @@
|
|||
<signal name="activate" handler="show_hide_window_toggled"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">_Pause All</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="pause_all"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="menu-item-image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-media-pause</property>
|
||||
<property name="icon_size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem2">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">_Resume All</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="resume_all"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="menu-item-image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
<property name="icon_size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
||||
<property name="visible">True</property>
|
||||
|
|
14
src/core.py
14
src/core.py
|
@ -935,3 +935,17 @@ class Manager:
|
|||
if speed != -1:
|
||||
speed = speed * 1024
|
||||
return deluge_core.set_per_download_rate_limit(unique_ID, speed)
|
||||
|
||||
def pause_all(self):
|
||||
for index, unique_ID in enumerate(self.state.queue):
|
||||
torrent_state = self.get_core_torrent_state(unique_ID)
|
||||
if torrent_state['is_paused']:
|
||||
pass
|
||||
else:
|
||||
self.set_user_pause(unique_ID, True, enforce_queue=False)
|
||||
|
||||
def resume_all(self):
|
||||
for index, unique_ID in enumerate(self.state.queue):
|
||||
torrent_state = self.get_core_torrent_state(unique_ID)
|
||||
if torrent_state['is_paused']:
|
||||
self.set_user_pause(unique_ID, False, enforce_queue=False)
|
||||
|
|
|
@ -169,6 +169,12 @@ class DelugeGTK:
|
|||
# Force an update when user changes the notebook tab
|
||||
self.update_torrent_info_widget(None, page_num)
|
||||
|
||||
def pause_all_clicked(self, arg=None):
|
||||
self.manager.pause_all()
|
||||
|
||||
def resume_all_clicked(self, arg=None):
|
||||
self.manager.resume_all()
|
||||
|
||||
def build_tray_icon(self):
|
||||
self.tray_icon = gtk.status_icon_new_from_file(common.get_pixmap("deluge32.png"))
|
||||
|
||||
|
@ -176,6 +182,8 @@ class DelugeGTK:
|
|||
self.tray_menu = self.tray_glade.get_widget("tray_menu")
|
||||
self.tray_glade.signal_autoconnect({
|
||||
"quit": self.quit,
|
||||
"pause_all": self.pause_all_clicked,
|
||||
"resume_all": self.resume_all_clicked,
|
||||
"plugins": self.show_plugin_dialog_clicked,
|
||||
"preferences": self.show_preferences_dialog_clicked,
|
||||
"add_torrent": self.add_torrent_clicked,
|
||||
|
|
Loading…
Reference in New Issue