[GTK3] Replace stock icons for named icons
This commit is contained in:
parent
cf4012bb60
commit
4df5bd05ec
|
@ -29,7 +29,7 @@ class BaseDialog(Gtk.Dialog):
|
|||
"""
|
||||
:param header: str, the header portion of the dialog
|
||||
:param text: str, the text body of the dialog
|
||||
:param icon: gtk Stock ID, a stock id for the gtk icon to display
|
||||
:param icon: icon name from icon theme or icon filename.
|
||||
:param buttons: tuple, of gtk stock ids and responses
|
||||
:param parent: gtkWindow, the parent window, if None it will default to the
|
||||
MainWindow
|
||||
|
@ -51,15 +51,13 @@ class BaseDialog(Gtk.Dialog):
|
|||
self.set_default_size(200, 100)
|
||||
hbox = Gtk.HBox(spacing=5)
|
||||
image = Gtk.Image()
|
||||
if not Gtk.stock_lookup(icon) and (
|
||||
icon.endswith('.svg') or icon.endswith('.png')
|
||||
):
|
||||
if icon.endswith('.svg') or icon.endswith('.png'):
|
||||
# Hack for Windows since it doesn't support svg
|
||||
if icon.endswith('.svg') and windows_check():
|
||||
icon = icon.rpartition('.svg')[0] + '16.png'
|
||||
image.set_from_pixbuf(get_pixbuf_at_size(icon, 32))
|
||||
image.set_from_pixbuf(get_pixbuf_at_size(icon, Gtk.IconSize.DIALOG))
|
||||
else:
|
||||
image.set_from_stock(icon, Gtk.IconSize.DIALOG)
|
||||
image.set_from_icon_name(icon, Gtk.IconSize.DIALOG)
|
||||
image.set_alignment(0.5, 0.0)
|
||||
hbox.pack_start(image, False, False, 0)
|
||||
vbox = Gtk.VBox(spacing=5)
|
||||
|
|
|
@ -13,7 +13,7 @@ import logging
|
|||
import os.path
|
||||
|
||||
import six.moves.cPickle as pickle
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gio, Gtk
|
||||
from gi.repository.Gdk import DragAction, ModifierType, keyval_name
|
||||
from gi.repository.GObject import TYPE_UINT64
|
||||
|
||||
|
@ -34,12 +34,14 @@ from .torrentview_data_funcs import cell_data_size
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
CELL_PRIORITY_ICONS = {
|
||||
'Ignore': Gtk.STOCK_NO,
|
||||
'Low': Gtk.STOCK_GO_DOWN,
|
||||
'Normal': Gtk.STOCK_OK,
|
||||
'High': Gtk.STOCK_GO_UP,
|
||||
'Ignore': 'action-unavailable-symbolic',
|
||||
'Low': 'go-down-symbolic',
|
||||
'Normal': 'go-next-symbolic',
|
||||
'High': 'go-up-symbolic',
|
||||
}
|
||||
|
||||
G_ICON_DIRECTORY = Gio.content_type_get_icon('inode/directory')
|
||||
|
||||
|
||||
def cell_priority(column, cell, model, row, data):
|
||||
if model.get_value(row, 5) == -1:
|
||||
|
@ -53,10 +55,10 @@ def cell_priority(column, cell, model, row, data):
|
|||
def cell_priority_icon(column, cell, model, row, data):
|
||||
if model.get_value(row, 5) == -1:
|
||||
# This is a folder, so lets just set it blank for now
|
||||
cell.set_property('stock-id', None)
|
||||
cell.set_property('icon-name', None)
|
||||
return
|
||||
priority = model.get_value(row, data)
|
||||
cell.set_property('stock-id', CELL_PRIORITY_ICONS[FILE_PRIORITY[priority]])
|
||||
cell.set_property('icon-name', CELL_PRIORITY_ICONS[FILE_PRIORITY[priority]])
|
||||
|
||||
|
||||
def cell_filename(column, cell, model, row, data):
|
||||
|
@ -79,7 +81,7 @@ class FilesTab(Tab):
|
|||
|
||||
self.listview = self.main_builder.get_object('files_listview')
|
||||
# filename, size, progress string, progress value, priority, file index, icon id
|
||||
self.treestore = Gtk.TreeStore(str, TYPE_UINT64, str, float, int, int, str)
|
||||
self.treestore = Gtk.TreeStore(str, TYPE_UINT64, str, float, int, int, Gio.Icon)
|
||||
self.treestore.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
# We need to store the row that's being edited to prevent updating it until
|
||||
|
@ -91,7 +93,7 @@ class FilesTab(Tab):
|
|||
column = Gtk.TreeViewColumn(self.filename_column_name)
|
||||
render = Gtk.CellRendererPixbuf()
|
||||
column.pack_start(render, False)
|
||||
column.add_attribute(render, 'stock-id', 6)
|
||||
column.add_attribute(render, 'gicon', 6)
|
||||
render = Gtk.CellRendererText()
|
||||
render.set_property('editable', True)
|
||||
render.connect('edited', self._on_filename_edited)
|
||||
|
@ -123,6 +125,7 @@ class FilesTab(Tab):
|
|||
# Progress column
|
||||
column = Gtk.TreeViewColumn(_('Progress'))
|
||||
render = Gtk.CellRendererProgress()
|
||||
render.set_padding(0, 1)
|
||||
column.pack_start(render, True)
|
||||
column.set_cell_data_func(render, cell_progress, (2, 3))
|
||||
column.set_sort_column_id(3)
|
||||
|
@ -361,15 +364,19 @@ class FilesTab(Tab):
|
|||
for key, value in split_files.items():
|
||||
if key.endswith('/'):
|
||||
chunk_iter = self.treestore.append(
|
||||
parent_iter, [key, 0, '', 0, 0, -1, Gtk.STOCK_DIRECTORY]
|
||||
parent_iter, [key, 0, '', 0, 0, -1, G_ICON_DIRECTORY]
|
||||
)
|
||||
chunk_size = self.add_files(chunk_iter, value)
|
||||
self.treestore.set(chunk_iter, 1, chunk_size)
|
||||
chunk_size_total += chunk_size
|
||||
else:
|
||||
mime_type, uncertain = Gio.content_type_guess(key, None)
|
||||
if not uncertain and mime_type:
|
||||
mime_icon = Gio.content_type_get_icon(mime_type)
|
||||
else:
|
||||
mime_icon = Gio.content_type_get_icon('text/plain')
|
||||
self.treestore.append(
|
||||
parent_iter,
|
||||
[key, value[1]['size'], '', 0, 0, value[0], Gtk.STOCK_FILE],
|
||||
parent_iter, [key, value[1]['size'], '', 0, 0, value[0], mime_icon]
|
||||
)
|
||||
chunk_size_total += value[1]['size']
|
||||
return chunk_size_total
|
||||
|
@ -653,15 +660,7 @@ class FilesTab(Tab):
|
|||
p_itr = self.get_iter_at_path('/'.join(parent_path[:i]) + '/')
|
||||
p_itr = self.treestore.append(
|
||||
p_itr,
|
||||
[
|
||||
parent_path[i] + '/',
|
||||
0,
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
Gtk.STOCK_DIRECTORY,
|
||||
],
|
||||
[parent_path[i] + '/', 0, '', 0, 0, -1, G_ICON_DIRECTORY],
|
||||
)
|
||||
p_itr = self.get_iter_at_path('/'.join(parent_path) + '/')
|
||||
old_name_itr = self.get_iter_at_path(old_name)
|
||||
|
@ -681,7 +680,7 @@ class FilesTab(Tab):
|
|||
parent_iter = None
|
||||
for f in new_folders:
|
||||
parent_iter = self.treestore.append(
|
||||
parent_iter, [f + '/', 0, '', 0, 0, -1, Gtk.STOCK_DIRECTORY]
|
||||
parent_iter, [f + '/', 0, '', 0, 0, -1, G_ICON_DIRECTORY]
|
||||
)
|
||||
child = self.get_iter_at_path(old_name)
|
||||
self.treestore.append(
|
||||
|
@ -790,7 +789,7 @@ class FilesTab(Tab):
|
|||
if new_split:
|
||||
for ns in new_split[:-1]:
|
||||
parent = self.treestore.append(
|
||||
parent, [ns + '/', 0, '', 0, 0, -1, Gtk.STOCK_DIRECTORY]
|
||||
parent, [ns + '/', 0, '', 0, 0, -1, G_ICON_DIRECTORY]
|
||||
)
|
||||
|
||||
self.treestore[old_folder_iter][0] = new_split[-1] + '/'
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<object class="GtkImage" id="image_dialog_magnet">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-revert-to-saved</property>
|
||||
<property name="icon_name">document-revert-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_name">document-open-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -191,7 +191,7 @@
|
|||
<object class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-network</property>
|
||||
<property name="icon_name">insert-link-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -237,7 +237,7 @@
|
|||
<object class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-revert-to-saved</property>
|
||||
<property name="icon_name">document-revert-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -283,7 +283,7 @@
|
|||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -425,7 +425,7 @@
|
|||
<object class="GtkImage" id="image9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_name">document-open-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -878,7 +878,8 @@ used sparingly.</property>
|
|||
<object class="GtkImage" id="image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-apply</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="icon_name">emblem-ok-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -929,7 +930,7 @@ used sparingly.</property>
|
|||
<object class="GtkImage" id="image8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-revert-to-saved</property>
|
||||
<property name="icon_name">document-revert-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -982,7 +983,7 @@ used sparingly.</property>
|
|||
<object class="GtkImage" id="image10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<property name="icon_name">document-properties-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<object class="GtkImage" id="image11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
|
@ -5,53 +5,65 @@
|
|||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-zoom-fit</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_name">zoom-fit-best-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-no</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_name">action-unavailable-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-yes</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_name">go-next-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-go-up</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_name">go-up-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-go-down</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_name">go-down-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">document-open-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">folder-open-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkMenu" id="menu_file_tab">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_open_file">
|
||||
<property name="label">gtk-open</property>
|
||||
<property name="label">_Open File</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image6</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_open_file_activate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_show_file">
|
||||
<property name="label">_Show</property>
|
||||
<property name="label">_Show Folder</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image7</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_show_file_activate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.0"/>
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="about-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">help-about-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkAccelGroup" id="accelgroup1"/>
|
||||
<object class="GtkImage" id="add-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
<property name="lower">-1</property>
|
||||
<property name="upper">999999</property>
|
||||
|
@ -33,41 +49,50 @@
|
|||
<property name="step_increment">0.10000000000000001</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image1">
|
||||
<object class="GtkImage" id="connection-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-no</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-yes</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_name">preferences-system-network-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-go-up</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-goto-top</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-zoom-fit</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="new-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">document-new-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="prefs-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">preferences-system-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="quit-daemon-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">system-shutdown-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="quit_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">application-exit-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="main_window">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -100,9 +125,10 @@
|
|||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">add-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<accelerator key="O" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="on_menuitem_addtorrent_activate" swapped="no"/>
|
||||
<accelerator key="O" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -111,9 +137,10 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">new-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<accelerator key="N" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="on_menuitem_createtorrent_activate" swapped="no"/>
|
||||
<accelerator key="N" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -126,9 +153,11 @@
|
|||
<property name="label" translatable="yes">Quit & _Shutdown Daemon</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">quit-daemon-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<accelerator key="Q" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="activate" handler="on_menuitem_quitdaemon_activate" swapped="no"/>
|
||||
<accelerator key="Q" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -139,11 +168,12 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_quit">
|
||||
<property name="label">gtk-quit</property>
|
||||
<property name="label">_Quit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">quit_image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<property name="accel_group">accelgroup1</property>
|
||||
<signal name="activate" handler="on_menuitem_quit_activate" swapped="no"/>
|
||||
</object>
|
||||
|
@ -164,14 +194,15 @@
|
|||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_preferences">
|
||||
<property name="label">gtk-preferences</property>
|
||||
<property name="label">_Preferences</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">prefs-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<property name="accel_group">accelgroup1</property>
|
||||
<accelerator key="P" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="on_menuitem_preferences_activate" swapped="no"/>
|
||||
<accelerator key="P" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -180,9 +211,10 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">connection-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<accelerator key="M" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="on_menuitem_connectionmanager_activate" swapped="no"/>
|
||||
<accelerator key="M" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -265,8 +297,8 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_Find ...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="on_search_filter_toggle" swapped="no"/>
|
||||
<accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -345,8 +377,8 @@
|
|||
<property name="tooltip_text" translatable="yes">Frequently Asked Questions</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<accelerator key="F1" signal="activate"/>
|
||||
<signal name="activate" handler="on_menuitem_faq_activate" swapped="no"/>
|
||||
<accelerator key="F1" signal="activate"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -356,6 +388,7 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="activate" handler="on_menuitem_community_activate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -367,11 +400,12 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_about">
|
||||
<property name="label">gtk-about</property>
|
||||
<property name="label">_About</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">about-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<property name="accel_group">accelgroup1</property>
|
||||
<signal name="activate" handler="on_menuitem_about_activate" swapped="no"/>
|
||||
</object>
|
||||
|
@ -391,6 +425,7 @@
|
|||
<object class="GtkToolbar" id="toolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_size">2</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton_add">
|
||||
<property name="visible">True</property>
|
||||
|
@ -399,8 +434,7 @@
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Add torrent</property>
|
||||
<property name="label" translatable="yes">Add Torrent</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-add</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_add_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -416,7 +450,7 @@
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Remove torrent</property>
|
||||
<property name="label" translatable="yes">Remove Torrent</property>
|
||||
<property name="stock_id">gtk-remove</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_remove_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -431,11 +465,10 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Filter torrents by name.
|
||||
This will filter torrents for the current selection on the sidebar.</property>
|
||||
<property name="label" translatable="yes">_Filter</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-find</property>
|
||||
<accelerator key="f" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||
<property name="label" translatable="yes">Filter</property>
|
||||
<property name="icon_name">system-search-symbolic</property>
|
||||
<signal name="clicked" handler="on_search_filter_toggle" swapped="no"/>
|
||||
<accelerator key="f" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -459,8 +492,7 @@ This will filter torrents for the current selection on the sidebar.</property>
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Pause the selected torrents</property>
|
||||
<property name="label" translatable="yes">Pause</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-media-pause</property>
|
||||
<property name="icon_name">media-playback-pause-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_pause_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -476,7 +508,7 @@ This will filter torrents for the current selection on the sidebar.</property>
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Resume the selected torrents</property>
|
||||
<property name="label" translatable="yes">Resume</property>
|
||||
<property name="stock_id">gtk-media-play</property>
|
||||
<property name="icon_name">media-playback-start-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_resume_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -501,7 +533,7 @@ This will filter torrents for the current selection on the sidebar.</property>
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Queue Torrent Up</property>
|
||||
<property name="label" translatable="yes">Queue Up</property>
|
||||
<property name="stock_id">gtk-go-up</property>
|
||||
<property name="icon_name">go-up-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_queue_up_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -517,7 +549,7 @@ This will filter torrents for the current selection on the sidebar.</property>
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Queue Torrent Down</property>
|
||||
<property name="label" translatable="yes">Queue Down</property>
|
||||
<property name="stock_id">gtk-go-down</property>
|
||||
<property name="icon_name">go-down-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_queue_down_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -541,8 +573,7 @@ This will filter torrents for the current selection on the sidebar.</property>
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Preferences</property>
|
||||
<property name="label" translatable="yes">Preferences</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-preferences</property>
|
||||
<property name="icon_name">preferences-system-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_preferences_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -557,7 +588,7 @@ This will filter torrents for the current selection on the sidebar.</property>
|
|||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Connection Manager</property>
|
||||
<property name="label" translatable="yes">Connection Manager</property>
|
||||
<property name="stock_id">gtk-network</property>
|
||||
<property name="icon_name">preferences-system-network-symbolic</property>
|
||||
<signal name="clicked" handler="on_toolbutton_connectionmanager_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -619,7 +650,7 @@ This will filter torrents for the current selection on the sidebar.</property>
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-close</property>
|
||||
<property name="icon-size">2</property>
|
||||
<property name="icon_size">2</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -539,7 +539,7 @@
|
|||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_name">folder-open-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -968,7 +968,7 @@
|
|||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<property name="icon_name">document-properties-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -5,23 +5,23 @@
|
|||
<object class="GtkImage" id="download-limit-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon_name">deluge-downloading</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="max-connections-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-network</property>
|
||||
<property name="icon_name">network-transmit-receive-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="upload-limit-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon_name">deluge-seeding</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="upload-slots-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-sort-ascending</property>
|
||||
<property name="icon_name">view-sort-descending-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkMenu" id="options_torrent_menu">
|
||||
|
|
|
@ -2,46 +2,66 @@
|
|||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.0"/>
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-top-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-up-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-down-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-bottom-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkMenu" id="queue_torrent_menu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_queue_top">
|
||||
<property name="label">gtk-goto-top</property>
|
||||
<property name="label">Top</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image5</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_queue_top_activate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_queue_up">
|
||||
<property name="label">gtk-go-up</property>
|
||||
<property name="label">Up</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image6</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_queue_up_activate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_queue_down">
|
||||
<property name="label">gtk-go-down</property>
|
||||
<property name="label">Down</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image7</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_queue_down_activate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_queue_bottom">
|
||||
<property name="label">gtk-goto-bottom</property>
|
||||
<property name="label">Bottom</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image8</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_queue_bottom_activate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -6,60 +6,71 @@
|
|||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_name">preferences-system-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">media-playback-stop-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image12">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-edit</property>
|
||||
<property name="icon_name">document-edit-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image13">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
<property name="icon_name">media-playback-start-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image14">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-pause</property>
|
||||
<property name="icon_name">media-playback-pause-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image19">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-sort-descending</property>
|
||||
<property name="icon_name">media-playlist-shuffle-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">media-playlist-repeat-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-refresh</property>
|
||||
<property name="icon_name">view-refresh-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-redo</property>
|
||||
<property name="icon_name">edit-redo-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_name">folder-open-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-save-as</property>
|
||||
<property name="icon_name">document-save-as-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkMenu" id="torrent_menu">
|
||||
|
|
|
@ -3,33 +3,39 @@
|
|||
<interface>
|
||||
<requires lib="gtk+" version="3.0"/>
|
||||
<object class="GtkAccelGroup" id="accelgroup1"/>
|
||||
<object class="GtkImage" id="add-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="download-limit-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image1">
|
||||
<object class="GtkImage" id="pause-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_name">media-playback-stop-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image6">
|
||||
<object class="GtkImage" id="quit-daemon-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-pause</property>
|
||||
<property name="icon_name">system-shutdown-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image7">
|
||||
<object class="GtkImage" id="quit-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
<property name="icon_name">application-exit-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="menu-item-image8">
|
||||
<object class="GtkImage" id="resume-image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-quit</property>
|
||||
<property name="icon_name">media-playlist-repeat-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="upload-limit-image">
|
||||
|
@ -61,7 +67,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">menu-item-image1</property>
|
||||
<property name="image">add-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_add_torrent_activate" swapped="no"/>
|
||||
</object>
|
||||
|
@ -78,7 +84,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">menu-item-image6</property>
|
||||
<property name="image">pause-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_pause_session_activate" swapped="no"/>
|
||||
</object>
|
||||
|
@ -89,7 +95,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">menu-item-image7</property>
|
||||
<property name="image">resume-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_resume_session_activate" swapped="no"/>
|
||||
</object>
|
||||
|
@ -134,7 +140,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">menu-item-image8</property>
|
||||
<property name="image">quit-daemon-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_quitdaemon_activate" swapped="no"/>
|
||||
</object>
|
||||
|
@ -147,11 +153,12 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem_quit">
|
||||
<property name="label">gtk-quit</property>
|
||||
<property name="label">_Quit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">quit-image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<property name="accel_group">accelgroup1</property>
|
||||
<signal name="activate" handler="on_menuitem_quit_activate" swapped="no"/>
|
||||
</object>
|
||||
|
|
|
@ -30,6 +30,7 @@ class StatusBarItem(object):
|
|||
self,
|
||||
image=None,
|
||||
stock=None,
|
||||
icon=None,
|
||||
text=None,
|
||||
markup=False,
|
||||
callback=None,
|
||||
|
@ -41,16 +42,18 @@ class StatusBarItem(object):
|
|||
self._hbox.set_spacing(3)
|
||||
self._image = Gtk.Image()
|
||||
self._label = Gtk.Label()
|
||||
self._hbox.add(self._image)
|
||||
if image or icon or stock:
|
||||
self._hbox.add(self._image)
|
||||
self._hbox.add(self._label)
|
||||
self._ebox.add(self._hbox)
|
||||
|
||||
# Add image from file or stock
|
||||
if image is not None or stock is not None:
|
||||
if image is not None:
|
||||
self.set_image_from_file(image)
|
||||
if stock is not None:
|
||||
self.set_image_from_stock(stock)
|
||||
if image:
|
||||
self.set_image_from_file(image)
|
||||
if stock:
|
||||
self.set_image_from_stock(stock)
|
||||
if icon:
|
||||
self.set_image_from_icon(icon)
|
||||
|
||||
# Add text
|
||||
if markup:
|
||||
|
@ -80,6 +83,9 @@ class StatusBarItem(object):
|
|||
def set_image_from_stock(self, stock):
|
||||
self._image.set_from_stock(stock, Gtk.IconSize.MENU)
|
||||
|
||||
def set_image_from_icon(self, icon):
|
||||
self._image.set_from_icon_name(icon, Gtk.IconSize.MENU)
|
||||
|
||||
def set_text(self, text):
|
||||
if not text:
|
||||
self._label.hide()
|
||||
|
@ -147,7 +153,7 @@ class StatusBar(component.Component):
|
|||
self.statusbar.show_all()
|
||||
# Create the not connected item
|
||||
self.not_connected_item = StatusBarItem(
|
||||
stock=Gtk.STOCK_STOP,
|
||||
icon='network-offline-symbolic',
|
||||
text=_('Not Connected'),
|
||||
callback=self._on_notconnected_item_clicked,
|
||||
)
|
||||
|
@ -166,7 +172,7 @@ class StatusBar(component.Component):
|
|||
self.remove_item(self.not_connected_item)
|
||||
|
||||
self.connections_item = self.add_item(
|
||||
stock=Gtk.STOCK_NETWORK,
|
||||
icon='network-transmit-receive-symbolic',
|
||||
callback=self._on_connection_item_clicked,
|
||||
tooltip=_('Connections (Limit)'),
|
||||
pack_start=True,
|
||||
|
@ -198,24 +204,27 @@ class StatusBar(component.Component):
|
|||
)
|
||||
|
||||
self.diskspace_item = self.add_item(
|
||||
stock=Gtk.STOCK_HARDDISK,
|
||||
icon='drive-harddisk-symbolic',
|
||||
callback=self._on_diskspace_item_clicked,
|
||||
tooltip=_('Free Disk Space'),
|
||||
pack_start=True,
|
||||
)
|
||||
|
||||
self.external_ip_item = self.add_item(
|
||||
tooltip=_('External IP Address'),
|
||||
text=_('<b>IP</b> <small>%s</small>') % _('n/a'),
|
||||
markup=True,
|
||||
pack_start=True,
|
||||
)
|
||||
|
||||
self.health_item = self.add_item(
|
||||
stock=Gtk.STOCK_DIALOG_ERROR,
|
||||
icon='network-error-symbolic',
|
||||
text=_('<b><small>Port Issue</small></b>'),
|
||||
markup=True,
|
||||
tooltip=_('No incoming connections, check port forwarding'),
|
||||
callback=self._on_health_icon_clicked,
|
||||
)
|
||||
|
||||
self.external_ip_item = self.add_item(
|
||||
tooltip=_('External IP Address'), pack_start=True
|
||||
)
|
||||
|
||||
self.health = False
|
||||
|
||||
def update_config_values(configs):
|
||||
|
@ -260,6 +269,7 @@ class StatusBar(component.Component):
|
|||
self,
|
||||
image=None,
|
||||
stock=None,
|
||||
icon=None,
|
||||
text=None,
|
||||
markup=False,
|
||||
callback=None,
|
||||
|
@ -268,7 +278,7 @@ class StatusBar(component.Component):
|
|||
):
|
||||
"""Adds an item to the status bar"""
|
||||
# The return tuple.. we return whatever widgets we add
|
||||
item = StatusBarItem(image, stock, text, markup, callback, tooltip)
|
||||
item = StatusBarItem(image, stock, icon, text, markup, callback, tooltip)
|
||||
if pack_start:
|
||||
self.hbox.pack_start(item.get_eventbox(), False, False, 0)
|
||||
else:
|
||||
|
@ -284,10 +294,10 @@ class StatusBar(component.Component):
|
|||
log.debug('Unable to remove widget: %s', ex)
|
||||
|
||||
def add_timeout_item(
|
||||
self, seconds=3, image=None, stock=None, text=None, callback=None
|
||||
self, seconds=3, image=None, stock=None, icon=None, text=None, callback=None
|
||||
):
|
||||
"""Adds an item to the StatusBar for seconds"""
|
||||
item = self.add_item(image, stock, text, callback)
|
||||
item = self.add_item(image, stock, icon, text, callback)
|
||||
# Start a timer to remove this item in seconds
|
||||
timeout_add(seconds * 1000, self.remove_item, item)
|
||||
|
||||
|
@ -295,7 +305,7 @@ class StatusBar(component.Component):
|
|||
"""Displays a warning to the user in the status bar"""
|
||||
if text not in self.current_warnings:
|
||||
item = self.add_item(
|
||||
stock=Gtk.STOCK_DIALOG_WARNING, text=text, callback=callback
|
||||
icon='dialog-warning-symbolic', text=text, callback=callback
|
||||
)
|
||||
self.current_warnings.append(text)
|
||||
timeout_add(3000, self.remove_warning, item)
|
||||
|
@ -412,6 +422,13 @@ class StatusBar(component.Component):
|
|||
|
||||
self.connections_item.set_markup(label_string)
|
||||
|
||||
if self.num_connections:
|
||||
self.connections_item.set_image_from_icon(
|
||||
'network-transmit-receive-symbolic'
|
||||
)
|
||||
else:
|
||||
self.connections_item.set_image_from_icon('network-idle-symbolic')
|
||||
|
||||
def update_dht_label(self):
|
||||
# Set the max connections label
|
||||
self.dht_item.set_markup('<small>%s</small>' % (self.dht_nodes))
|
||||
|
@ -474,7 +491,7 @@ class StatusBar(component.Component):
|
|||
_('Incoming Connections'),
|
||||
_('Set the maximum incoming connections'),
|
||||
'',
|
||||
Gtk.STOCK_NETWORK,
|
||||
'network-transmit-receive-symbolic',
|
||||
self.max_connections_global,
|
||||
),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue