mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-24 10:18:51 +00:00
[Extractor] Update gtkui from libglade to gtkbuilder
This commit is contained in:
parent
1259eca8ad
commit
470490769f
@ -1,31 +1,37 @@
|
||||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.6 -->
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.24"/>
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="extractor_prefs_box">
|
||||
<object class="GtkVBox" id="extractor_prefs_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Extract to:</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@ -33,31 +39,43 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<object class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="folderchooser_path">
|
||||
<object class="GtkFileChooserButton" id="folderchooser_path">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="action">select-folder</property>
|
||||
<property name="title" translatable="yes">Select A Folder</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry_path">
|
||||
<object class="GtkEntry" id="entry_path">
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@ -65,38 +83,38 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_use_name">
|
||||
<object class="GtkCheckButton" id="chk_use_name">
|
||||
<property name="label" translatable="yes">Create torrent name sub-folder</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip" translatable="yes">This option will create a sub-folder using the torrent's name within the selected extract folder and put the extracted files there.</property>
|
||||
<property name="tooltip_text" translatable="yes">This option will create a sub-folder using the torrent's name within the selected extract folder and put the extracted files there.</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>General</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
</object>
|
||||
</interface>
|
@ -16,7 +16,6 @@ from __future__ import unicode_literals
|
||||
import logging
|
||||
|
||||
import gtk
|
||||
import gtk.glade
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.plugins.pluginbase import GtkPluginBase
|
||||
@ -29,9 +28,10 @@ log = logging.getLogger(__name__)
|
||||
|
||||
class GtkUI(GtkPluginBase):
|
||||
def enable(self):
|
||||
self.glade = gtk.glade.XML(get_resource('extractor_prefs.glade'))
|
||||
self.builder = gtk.Builder()
|
||||
self.builder.add_from_file(get_resource('extractor_prefs.ui'))
|
||||
|
||||
component.get('Preferences').add_page(_('Extractor'), self.glade.get_widget('extractor_prefs_box'))
|
||||
component.get('Preferences').add_page(_('Extractor'), self.builder.get_object('extractor_prefs_box'))
|
||||
component.get('PluginManager').register_hook('on_apply_prefs', self.on_apply_prefs)
|
||||
component.get('PluginManager').register_hook('on_show_prefs', self.on_show_prefs)
|
||||
self.on_show_prefs()
|
||||
@ -40,36 +40,36 @@ class GtkUI(GtkPluginBase):
|
||||
component.get('Preferences').remove_page(_('Extractor'))
|
||||
component.get('PluginManager').deregister_hook('on_apply_prefs', self.on_apply_prefs)
|
||||
component.get('PluginManager').deregister_hook('on_show_prefs', self.on_show_prefs)
|
||||
del self.glade
|
||||
del self.builder
|
||||
|
||||
def on_apply_prefs(self):
|
||||
log.debug('applying prefs for Extractor')
|
||||
if client.is_localhost():
|
||||
path = self.glade.get_widget('folderchooser_path').get_filename()
|
||||
path = self.builder.get_object('folderchooser_path').get_filename()
|
||||
else:
|
||||
path = self.glade.get_widget('entry_path').get_text()
|
||||
path = self.builder.get_object('entry_path').get_text()
|
||||
|
||||
config = {
|
||||
'extract_path': path,
|
||||
'use_name_folder': self.glade.get_widget('chk_use_name').get_active()
|
||||
'use_name_folder': self.builder.get_object('chk_use_name').get_active()
|
||||
}
|
||||
|
||||
client.extractor.set_config(config)
|
||||
|
||||
def on_show_prefs(self):
|
||||
if client.is_localhost():
|
||||
self.glade.get_widget('folderchooser_path').show()
|
||||
self.glade.get_widget('entry_path').hide()
|
||||
self.builder.get_object('folderchooser_path').show()
|
||||
self.builder.get_object('entry_path').hide()
|
||||
else:
|
||||
self.glade.get_widget('folderchooser_path').hide()
|
||||
self.glade.get_widget('entry_path').show()
|
||||
self.builder.get_object('folderchooser_path').hide()
|
||||
self.builder.get_object('entry_path').show()
|
||||
|
||||
def on_get_config(config):
|
||||
if client.is_localhost():
|
||||
self.glade.get_widget('folderchooser_path').set_current_folder(config['extract_path'])
|
||||
self.builder.get_object('folderchooser_path').set_current_folder(config['extract_path'])
|
||||
else:
|
||||
self.glade.get_widget('entry_path').set_text(config['extract_path'])
|
||||
self.builder.get_object('entry_path').set_text(config['extract_path'])
|
||||
|
||||
self.glade.get_widget('chk_use_name').set_active(config['use_name_folder'])
|
||||
self.builder.get_object('chk_use_name').set_active(config['use_name_folder'])
|
||||
|
||||
client.extractor.get_config().addCallback(on_get_config)
|
||||
|
Loading…
x
Reference in New Issue
Block a user