diff --git a/deluge/ui/gtk3/dialogs.py b/deluge/ui/gtk3/dialogs.py index f310ce53a..21709723f 100644 --- a/deluge/ui/gtk3/dialogs.py +++ b/deluge/ui/gtk3/dialogs.py @@ -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) diff --git a/deluge/ui/gtk3/files_tab.py b/deluge/ui/gtk3/files_tab.py index 40adf62c4..216e5a7c1 100644 --- a/deluge/ui/gtk3/files_tab.py +++ b/deluge/ui/gtk3/files_tab.py @@ -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] + '/' diff --git a/deluge/ui/gtk3/glade/add_torrent_dialog.infohash.ui b/deluge/ui/gtk3/glade/add_torrent_dialog.infohash.ui index 2663b08a9..2391bff0b 100644 --- a/deluge/ui/gtk3/glade/add_torrent_dialog.infohash.ui +++ b/deluge/ui/gtk3/glade/add_torrent_dialog.infohash.ui @@ -78,7 +78,7 @@ True False - gtk-revert-to-saved + document-revert-symbolic False diff --git a/deluge/ui/gtk3/glade/add_torrent_dialog.ui b/deluge/ui/gtk3/glade/add_torrent_dialog.ui index 66ce8c16b..c401a85f4 100644 --- a/deluge/ui/gtk3/glade/add_torrent_dialog.ui +++ b/deluge/ui/gtk3/glade/add_torrent_dialog.ui @@ -145,7 +145,7 @@ True False - gtk-open + document-open-symbolic 1 @@ -191,7 +191,7 @@ True False - gtk-network + insert-link-symbolic 1 @@ -237,7 +237,7 @@ True False - gtk-revert-to-saved + document-revert-symbolic 1 @@ -283,7 +283,7 @@ True False - gtk-remove + list-remove-symbolic False @@ -425,7 +425,7 @@ True False - gtk-open + document-open-symbolic True @@ -878,7 +878,8 @@ used sparingly. True False - gtk-apply + 1 + emblem-ok-symbolic False @@ -929,7 +930,7 @@ used sparingly. True False - gtk-revert-to-saved + document-revert-symbolic False @@ -982,7 +983,7 @@ used sparingly. True False - gtk-properties + document-properties-symbolic True diff --git a/deluge/ui/gtk3/glade/add_torrent_dialog.url.ui b/deluge/ui/gtk3/glade/add_torrent_dialog.url.ui index 55139d8eb..7c7cfbbd6 100644 --- a/deluge/ui/gtk3/glade/add_torrent_dialog.url.ui +++ b/deluge/ui/gtk3/glade/add_torrent_dialog.url.ui @@ -78,7 +78,7 @@ True False - gtk-add + list-add-symbolic False diff --git a/deluge/ui/gtk3/glade/main_window.tabs.menu_file.ui b/deluge/ui/gtk3/glade/main_window.tabs.menu_file.ui index 64e6d8bbb..e4534e5be 100644 --- a/deluge/ui/gtk3/glade/main_window.tabs.menu_file.ui +++ b/deluge/ui/gtk3/glade/main_window.tabs.menu_file.ui @@ -5,53 +5,65 @@ True False - gtk-zoom-fit - 1 + zoom-fit-best-symbolic + 1 True False - gtk-no - 1 + action-unavailable-symbolic + 1 True False - gtk-yes - 1 + go-next-symbolic + 1 True False - gtk-go-up - 1 + go-up-symbolic + 1 True False - gtk-go-down - 1 + go-down-symbolic + 1 + + + True + False + document-open-symbolic + + + True + False + folder-open-symbolic True False - gtk-open + _Open File True False True - True + image6 + False - _Show + _Show Folder True False True - True + image7 + False diff --git a/deluge/ui/gtk3/glade/main_window.ui b/deluge/ui/gtk3/glade/main_window.ui index 33731d905..3a8e879ff 100644 --- a/deluge/ui/gtk3/glade/main_window.ui +++ b/deluge/ui/gtk3/glade/main_window.ui @@ -1,8 +1,24 @@ + - + + True + False + gtk-missing-image + + + True + False + help-about-symbolic + + + True + False + list-add-symbolic + 1 + -1 999999 @@ -33,41 +49,50 @@ 0.10000000000000001 10 - + True False - gtk-add - 1 - - - True - False - gtk-no - 1 - - - True - False - gtk-yes - 1 + preferences-system-network-symbolic True False gtk-go-up - 1 + 1 True False gtk-goto-top - 1 + 1 True False gtk-zoom-fit - 1 + 1 + + + True + False + document-new-symbolic + 1 + + + True + False + preferences-system-symbolic + + + True + False + system-shutdown-symbolic + 1 + + + True + False + application-exit-symbolic False @@ -100,9 +125,10 @@ False False True + add-image False - + @@ -111,9 +137,10 @@ True False True + new-image False - + @@ -126,9 +153,11 @@ Quit & _Shutdown Daemon False True + quit-daemon-image False - + True + @@ -139,11 +168,12 @@ - gtk-quit + _Quit True False True - True + quit_image + False accelgroup1 @@ -164,14 +194,15 @@ False - gtk-preferences + _Preferences True False True - True + prefs-image + False accelgroup1 - + @@ -180,9 +211,10 @@ True False True + connection-image False - + @@ -265,8 +297,8 @@ False _Find ... True - + @@ -345,8 +377,8 @@ Frequently Asked Questions True False - + @@ -356,6 +388,7 @@ False True False + True @@ -367,11 +400,12 @@ - gtk-about + _About True False True - True + about-image + False accelgroup1 @@ -391,6 +425,7 @@ True False + 2 True @@ -399,8 +434,7 @@ True Add torrent Add Torrent - True - gtk-add + list-add-symbolic @@ -416,7 +450,7 @@ True Remove torrent Remove Torrent - gtk-remove + list-remove-symbolic @@ -431,11 +465,10 @@ False Filter torrents by name. This will filter torrents for the current selection on the sidebar. - _Filter - True - gtk-find - + Filter + system-search-symbolic + False @@ -459,8 +492,7 @@ This will filter torrents for the current selection on the sidebar. True Pause the selected torrents Pause - True - gtk-media-pause + media-playback-pause-symbolic @@ -476,7 +508,7 @@ This will filter torrents for the current selection on the sidebar. True Resume the selected torrents Resume - gtk-media-play + media-playback-start-symbolic @@ -501,7 +533,7 @@ This will filter torrents for the current selection on the sidebar. True Queue Torrent Up Queue Up - gtk-go-up + go-up-symbolic @@ -517,7 +549,7 @@ This will filter torrents for the current selection on the sidebar. True Queue Torrent Down Queue Down - gtk-go-down + go-down-symbolic @@ -541,8 +573,7 @@ This will filter torrents for the current selection on the sidebar. True Preferences Preferences - True - gtk-preferences + preferences-system-symbolic @@ -557,7 +588,7 @@ This will filter torrents for the current selection on the sidebar. True Connection Manager Connection Manager - gtk-network + preferences-system-network-symbolic @@ -619,7 +650,7 @@ This will filter torrents for the current selection on the sidebar. True False gtk-close - 2 + 2 diff --git a/deluge/ui/gtk3/glade/path_combo_chooser.ui b/deluge/ui/gtk3/glade/path_combo_chooser.ui index 27acc934d..f79685d26 100644 --- a/deluge/ui/gtk3/glade/path_combo_chooser.ui +++ b/deluge/ui/gtk3/glade/path_combo_chooser.ui @@ -539,7 +539,7 @@ True False - gtk-open + folder-open-symbolic False @@ -968,7 +968,7 @@ True False - gtk-properties + document-properties-symbolic diff --git a/deluge/ui/gtk3/glade/torrent_menu.options.ui b/deluge/ui/gtk3/glade/torrent_menu.options.ui index abb9c3af1..df34445d5 100644 --- a/deluge/ui/gtk3/glade/torrent_menu.options.ui +++ b/deluge/ui/gtk3/glade/torrent_menu.options.ui @@ -5,23 +5,23 @@ True False - gtk-missing-image + deluge-downloading True False - gtk-network + network-transmit-receive-symbolic 1 True False - gtk-missing-image + deluge-seeding True False - gtk-sort-ascending + view-sort-descending-symbolic 1 diff --git a/deluge/ui/gtk3/glade/torrent_menu.queue.ui b/deluge/ui/gtk3/glade/torrent_menu.queue.ui index 5fb394fbf..e955adea1 100644 --- a/deluge/ui/gtk3/glade/torrent_menu.queue.ui +++ b/deluge/ui/gtk3/glade/torrent_menu.queue.ui @@ -2,46 +2,66 @@ + + True + False + go-top-symbolic + + + True + False + go-up-symbolic + + + True + False + go-down-symbolic + + + True + False + go-bottom-symbolic + True False - gtk-goto-top + Top True False - True - True + image5 + False - gtk-go-up + Up True False - True - True + image6 + False - gtk-go-down + Down True False - True - True + image7 + False - gtk-goto-bottom + Bottom True False - True - True + image8 + False diff --git a/deluge/ui/gtk3/glade/torrent_menu.ui b/deluge/ui/gtk3/glade/torrent_menu.ui index a0c0e1e8e..c1b77b4ad 100644 --- a/deluge/ui/gtk3/glade/torrent_menu.ui +++ b/deluge/ui/gtk3/glade/torrent_menu.ui @@ -6,60 +6,71 @@ True False - gtk-preferences + preferences-system-symbolic + 1 + + + False + media-playback-stop-symbolic 1 True False - gtk-edit + document-edit-symbolic 1 True False - gtk-media-play + media-playback-start-symbolic 1 False - gtk-media-pause + media-playback-pause-symbolic 1 True False - gtk-sort-descending + media-playlist-shuffle-symbolic + 1 + + + True + False + media-playlist-repeat-symbolic 1 True False - gtk-refresh + view-refresh-symbolic 1 True False - gtk-redo + edit-redo-symbolic 1 True False - gtk-open + folder-open-symbolic 1 True False - gtk-save-as + document-save-as-symbolic 1 True False - gtk-remove + list-remove-symbolic 1 diff --git a/deluge/ui/gtk3/glade/tray_menu.ui b/deluge/ui/gtk3/glade/tray_menu.ui index 1147b72df..6b2053062 100644 --- a/deluge/ui/gtk3/glade/tray_menu.ui +++ b/deluge/ui/gtk3/glade/tray_menu.ui @@ -3,33 +3,39 @@ + + True + False + list-add-symbolic + 1 + True False 1 - + True False - gtk-add + media-playback-stop-symbolic 1 - + True False - gtk-media-pause + system-shutdown-symbolic 1 - + True False - gtk-media-play + application-exit-symbolic 1 - + True False - gtk-quit + media-playlist-repeat-symbolic 1 @@ -61,7 +67,7 @@ True False True - menu-item-image1 + add-image False @@ -78,7 +84,7 @@ True False True - menu-item-image6 + pause-image False @@ -89,7 +95,7 @@ True False True - menu-item-image7 + resume-image False @@ -134,7 +140,7 @@ True False True - menu-item-image8 + quit-daemon-image False @@ -147,11 +153,12 @@ - gtk-quit + _Quit True False True - True + quit-image + False accelgroup1 diff --git a/deluge/ui/gtk3/statusbar.py b/deluge/ui/gtk3/statusbar.py index 2674ccdf1..b197c929c 100644 --- a/deluge/ui/gtk3/statusbar.py +++ b/deluge/ui/gtk3/statusbar.py @@ -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=_('IP %s') % _('n/a'), + markup=True, + pack_start=True, + ) + self.health_item = self.add_item( - stock=Gtk.STOCK_DIALOG_ERROR, + icon='network-error-symbolic', text=_('Port Issue'), 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('%s' % (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, ), }