have plugin button go to plugin tab in preferences dialog

This commit is contained in:
Marcos Pinto 2007-08-26 20:47:59 +00:00
parent 22390d96dd
commit d4b79ec6f7
3 changed files with 46 additions and 1 deletions

View File

@ -836,6 +836,22 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem7">
<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">Plu_gins</property>
<property name="use_underline">True</property>
<signal name="activate" handler="plugin_clicked"/>
<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-disconnect</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem9">
<property name="visible">True</property>
@ -1186,6 +1202,18 @@
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton2">
<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">Plugins</property>
<property name="stock_id">gtk-disconnect</property>
<signal name="clicked" handler="plugin_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
</widget>
<packing>
<property name="top_attach">1</property>

View File

@ -40,9 +40,11 @@ import pref
PREFS_FILENAME = "prefs.state"
class PreferencesDlg:
def __init__(self, preferences, active_port, plugins):
def __init__(self, preferences, active_port, plugins, plugin_tab=False):
self.glade = gtk.glade.XML(common.get_glade_file("preferences_dialog.glade"), domain='deluge')
self.dialog = self.glade.get_widget("pref_dialog")
if plugin_tab:
self.glade.get_widget("notebook").set_current_page(6)
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png"))
self.glade.signal_autoconnect({

View File

@ -153,6 +153,7 @@ class DelugeGTK:
"menu_quit": self.quit,
## Edit Menu
"select_all_torrents": self.select_all_torrents,
"plugin_clicked": self.show_plugin_dialog_clicked,
"pref_clicked": self.show_preferences_dialog_clicked,
## View Menu
"toolbar_toggle": self.toolbar_toggle,
@ -204,6 +205,7 @@ class DelugeGTK:
"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,
"show_hide_window_toggled": self.show_hide_window_toggled
@ -681,6 +683,19 @@ class DelugeGTK:
else:
self.show_preferences_dialog()
def show_plugin_dialog(self, plugin_tab=True):
active_port = self.manager.get_state()['port']
plugin_dialog = dialogs.PreferencesDlg(self.config, active_port, \
self.plugins, plugin_tab=True)
plugin_dialog.show(self, self.window)
def show_plugin_dialog_clicked(self, arg=None):
if self.config.get("enable_system_tray") and \
self.config.get("lock_tray"):
self.unlock_tray("prefwinshow")
else:
self.show_plugin_dialog(plugin_tab=True)
def apply_prefs(self):
# Show tray icon if necessary
self.tray_icon.set_visible(self.config.get("enable_system_tray"))