22
22
name = _('Mini Mode')
23
23
basedir = os.path.dirname(os.path.realpath(__file__))
24
glade = os.path.join(basedir, "minimodeprefs_pane.glade")
26
def get_workarea_size():
28
Returns the height and width of the work area
30
rootwindow = gtk.gdk.get_default_root_window()
31
workarea = gtk.gdk.atom_intern('_NET_WORKAREA')
33
return rootwindow.property_get(workarea)[2][2:4] # W,H
24
ui = os.path.join(basedir, "minimodeprefs_pane.ui")
35
26
class AlwaysOnTopPreference(widgets.CheckPrefsItem):
36
27
name = 'plugin/minimode/always_on_top'
48
39
name = 'plugin/minimode/display_window_decorations'
51
class HorizontalPositionPreference(widgets.SpinPrefsItem):
52
name = 'plugin/minimode/horizontal_position'
54
def __init__(self, prefs, widget):
56
Sets the maximum value to the highest
57
possible horizontal position
59
width, height = get_workarea_size()
60
widget.set_range(0, width)
61
widgets.SpinPrefsItem.__init__(self, prefs, widget)
62
event.add_callback(self._on_setting_change, 'option_set')
64
def _on_setting_change(self, event, settings_manager, option):
66
Handles changed position triggered by
67
moving the mini mode window
69
if option == self.name:
70
value = settings.get_option(option, self.default)
71
self.widget.set_value(value)
73
class VerticalPositionPreference(widgets.SpinPrefsItem):
74
name = 'plugin/minimode/vertical_position'
76
def __init__(self, prefs, widget):
78
Sets the maximum value to the highest
79
possible vertical position
81
width, height = get_workarea_size()
82
widget.set_range(0, height)
83
widgets.SpinPrefsItem.__init__(self, prefs, widget)
84
event.add_callback(self._on_setting_change, 'option_set')
86
def _on_setting_change(self, event, settings_manager, option):
88
Handles changed position triggered by
89
moving the mini mode window
91
if option == self.name:
92
value = settings.get_option(option, self.default)
93
self.widget.set_value(value)
95
42
class SelectedControlsPreference(widgets.SelectionListPrefsItem):
96
43
name = 'plugin/minimode/selected_controls'
97
44
available_title = _('Available controls')