mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 04:24:27 +00:00
Add gtkui.common.get_deluge_icon() and use it
This commit is contained in:
parent
26af4214fa
commit
2089fd1823
@ -74,15 +74,7 @@ if not, see <http://www.gnu.org/licenses>."))
|
||||
self.about.set_website("http://deluge-torrent.org")
|
||||
self.about.set_website_label("http://deluge-torrent.org")
|
||||
|
||||
if deluge.common.windows_check():
|
||||
self.about.set_icon(common.get_logo(32))
|
||||
else:
|
||||
try:
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
self.about.set_icon(icon_theme.load_icon("deluge", 32, 0))
|
||||
except:
|
||||
self.about.set_icon(common.get_logo(32))
|
||||
|
||||
self.about.set_icon(common.get_deluge_icon())
|
||||
self.about.set_logo(gtk.gdk.pixbuf_new_from_file(
|
||||
deluge.common.get_pixmap("deluge-about.png")))
|
||||
|
||||
|
@ -207,3 +207,21 @@ def reparent_iter(treestore, itr, parent, move_siblings=False):
|
||||
treestore.remove(to_remove)
|
||||
|
||||
move_children(itr, parent)
|
||||
|
||||
def get_deluge_icon():
|
||||
"""
|
||||
Returns the deluge icon for use in setting a dialogs icon. It will first
|
||||
attempt to get the icon from the theme and will fallback to using an image
|
||||
that is distributed with the package.
|
||||
|
||||
"""
|
||||
import deluge.common
|
||||
if deluge.common.windows_check():
|
||||
return deluge.common.get_logo(32)
|
||||
else:
|
||||
try:
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
return icon_theme.load_icon("deluge", 32, 0)
|
||||
except:
|
||||
return deluge.common.get_logo(32)
|
||||
|
||||
|
@ -123,14 +123,7 @@ class ConnectionManager(component.Component):
|
||||
self.connection_manager = self.glade.get_widget("connection_manager")
|
||||
self.connection_manager.set_transient_for(self.window.window)
|
||||
|
||||
if deluge.common.windows_check():
|
||||
self.connection_manager.set_icon(common.get_logo(32))
|
||||
else:
|
||||
try:
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
self.connection_manager.set_icon(icon_theme.load_icon("deluge", 32, 0))
|
||||
except:
|
||||
self.connection_manager.set_icon(common.get_logo(32))
|
||||
self.connection_manager.set_icon(common.get_deluge_icon())
|
||||
|
||||
self.glade.get_widget("image1").set_from_pixbuf(common.get_logo(32))
|
||||
|
||||
|
@ -56,15 +56,7 @@ class EditTrackersDialog:
|
||||
self.add_tracker_dialog.set_transient_for(self.dialog)
|
||||
self.edit_tracker_entry = self.glade.get_widget("edit_tracker_entry")
|
||||
self.edit_tracker_entry.set_transient_for(self.dialog)
|
||||
|
||||
if deluge.common.windows_check():
|
||||
self.dialog.set_icon(common.get_logo(32))
|
||||
else:
|
||||
try:
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
self.dialog.set_icon(icon_theme.load_icon("deluge", 32, 0))
|
||||
except:
|
||||
self.dialog.set_icon(common.get_logo(32))
|
||||
self.dialog.set_icon(common.get_deluge_icon())
|
||||
|
||||
if parent != None:
|
||||
self.dialog.set_transient_for(parent)
|
||||
|
@ -63,14 +63,8 @@ class MainWindow(component.Component):
|
||||
|
||||
self.window = self.main_glade.get_widget("main_window")
|
||||
|
||||
if deluge.common.windows_check():
|
||||
self.window.set_icon(common.get_logo(32))
|
||||
else:
|
||||
try:
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
self.window.set_icon(icon_theme.load_icon("deluge", 32, 0))
|
||||
except:
|
||||
self.window.set_icon(common.get_logo(32))
|
||||
self.window.set_icon(common.get_deluge_icon())
|
||||
|
||||
self.vpaned = self.main_glade.get_widget("vpaned")
|
||||
self.initial_vpaned_position = self.config["window_pane_position"]
|
||||
|
||||
|
@ -324,11 +324,7 @@ class MenuBar(component.Component):
|
||||
gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
|
||||
chooser.set_local_only(True)
|
||||
if not deluge.common.windows_check():
|
||||
try:
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
chooser.set_icon(icon_theme.load_icon("deluge", 32, 0))
|
||||
except:
|
||||
chooser.set_icon(common.get_logo(32))
|
||||
chooser.set_icon(common.get_deluge_icon())
|
||||
chooser.set_property("skip-taskbar-hint", True)
|
||||
chooser.set_current_folder(config["choose_directory_dialog_path"])
|
||||
if chooser.run() == gtk.RESPONSE_OK:
|
||||
|
@ -56,14 +56,7 @@ class Preferences(component.Component):
|
||||
pkg_resources.resource_filename("deluge.ui.gtkui",
|
||||
"glade/preferences_dialog.glade"))
|
||||
self.pref_dialog = self.glade.get_widget("pref_dialog")
|
||||
if deluge.common.windows_check():
|
||||
self.pref_dialog.set_icon(common.get_logo(32))
|
||||
else:
|
||||
try:
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
self.pref_dialog.set_icon(icon_theme.load_icon("deluge", 32, 0))
|
||||
except:
|
||||
self.pref_dialog.set_icon(common.get_logo(32))
|
||||
self.pref_dialog.set_icon(common.get_deluge_icon())
|
||||
self.treeview = self.glade.get_widget("treeview")
|
||||
self.notebook = self.glade.get_widget("notebook")
|
||||
self.gtkui_config = ConfigManager("gtkui.conf")
|
||||
|
Loading…
x
Reference in New Issue
Block a user