Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 199 lines (160 sloc) 6.249 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
#
# Copyright 2012 Tomasz Wiszkowski
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import gobject
import gtk

class XfConSettings(gobject.GObject):
  __gproperties__ = {
    'key-show-hide' : (gobject.TYPE_STRING,
        _("Shows / hides the console."),
        _("Keyboard shortcut"),
        "Pause",
        gobject.PARAM_READWRITE),

    'key-quit' : (gobject.TYPE_STRING,
        _("Quit XfCon."),
        _("Keyboard shortcut"),
        "<Control><Shift>q",
        gobject.PARAM_READWRITE),

    'key-new-tab' : (gobject.TYPE_STRING,
        _("Open new tab with default view."),
        _("Keyboard shortcut"),
        "<Control><Shift>t",
        gobject.PARAM_READWRITE),

    'key-notebook-tab-close' : (gobject.TYPE_STRING,
        _("Close current tab."),
        _("Keyboard shortcut"),
        "<Control><Shift>w",
        gobject.PARAM_READWRITE),

    'key-notebook-tab-rename' : (gobject.TYPE_STRING,
        _("Rename current tab."),
        _("Keyboard shortcut"),
        "<Control><Shift>r",
        gobject.PARAM_READWRITE),

    'key-notebook-tab-next' : (gobject.TYPE_STRING,
        _("Jump to next tab."),
        _("Keyboard shortcut"),
        "<Control>Page_Up",
        gobject.PARAM_READWRITE),

    'key-notebook-tab-previous' : (gobject.TYPE_STRING,
        _("Jump to previous tab."),
        _("Keyboard shortcut"),
        "<Control>Page_Down",
        gobject.PARAM_READWRITE),

    'key-view-split-vertical' : (gobject.TYPE_STRING,
        _("Split view vertically."),
        _("Keyboard shortcut"),
        "<Control><Alt>v",
        gobject.PARAM_READWRITE),

    'key-view-split-horizontal' : (gobject.TYPE_STRING,
        _("Split view horizontally."),
        _("Keyboard shortcut"),
        "<Control><Alt>h",
        gobject.PARAM_READWRITE),

    'key-view-activate-next' : (gobject.TYPE_STRING,
        _("Activate next view in split."),
        _("Keyboard shortcut"),
        "<Control><Alt>Right",
        gobject.PARAM_READWRITE),

    'key-view-activate-previous' : (gobject.TYPE_STRING,
        _("Activate previous view in split."),
        _("Keyboard shortcut"),
        "<Control><Alt>Left",
        gobject.PARAM_READWRITE),

    'key-clipboard-copy' : (gobject.TYPE_STRING,
        _("Copy selection to clipboard."),
        _("Keyboard shortcut"),
        "<Control><Shift>c",
        gobject.PARAM_READWRITE),

    'key-clipboard-paste' : (gobject.TYPE_STRING,
        _("Paste clipboard contents."),
        _("Keyboard shortcut"),
        "<Control><Shift>v",
        gobject.PARAM_READWRITE),

    # Resolved
    'window-follows-mouse': (gobject.TYPE_BOOLEAN,
        _("Define if window should be open on same monitor as mouse."),
        _("True, if window should be opened on same monitor as mouse."),
        False,
        gobject.PARAM_READWRITE),

    'window-width': (gobject.TYPE_UINT,
        _("Window width."),
        _("Percentage of screen occupied by window."),
        20, 100, 100,
        gobject.PARAM_READWRITE),

    'window-height': (gobject.TYPE_UINT,
        _("Window height."),
        _("Percentage of screen occupied by window."),
        20, 100, 80,
        gobject.PARAM_READWRITE),

    'window-animations': (gobject.TYPE_BOOLEAN,
        _("Window animations."),
        _("Tick to enable window animations."),
        False,
        gobject.PARAM_READWRITE),

    'window-animation-expose-direction': (gtk.DirectionType,
        _("Animate position on show/hide."),
        _("Direction in which the window will be animated during exposition."),
        gtk.DIR_UP,
        gobject.PARAM_READWRITE),

    'window-animation-expose-alpha': (gobject.TYPE_BOOLEAN,
        _("Animate transparency on show/hide."),
        _("If set, transparency will be animated during exposition."),
        True,
        gobject.PARAM_READWRITE),
  }

  __properties__ = {}
  __instance__ = None

  def __init__(self):
    super(XfConSettings, self).__init__()
    if (XfConSettings.__instance__):
      raise RuntimeError("Settings already instantiated")
    XfConSettings.__instance__ = self
    if (self.__properties__ == {}):
      for prop in gobject.list_properties(XfConSettings):
        self.__properties__[prop.name] = prop.default_value

  @classmethod
  def Instance(cls):
    if not XfConSettings.__instance__:
      XfConSettings()
    return XfConSettings.__instance__

  def do_get_property(self, name):
    return self.__properties__[name.name]

  def do_set_property(self, name, value):
    self.__properties__[name.name] = value

  def set_window_follows_mouse(self, status):
    self.set_property("window-follows-mouse", status)

  def get_window_follows_mouse(self):
    return self.get_property("window-follows-mouse")

  def set_window_animations(self, status):
    self.set_property("window-animations", status)

  def get_window_animations(self):
    return self.get_property("window-animations")

  def set_window_width(self, value):
    self.set_property("window-width", int(value))

  def get_window_width(self):
    return self.get_property("window-width")

  def set_window_height(self, value):
    self.set_property("window-height", int(value))

  def get_window_height(self):
    return self.get_property("window-height")

  def set_window_animation_expose_direction(self, value):
    self.set_property("window-animation-expose-direction", value)

  def get_window_animation_expose_direction(self):
    return self.get_property("window-animation-expose-direction")

  def set_window_animation_expose_alpha(self, value):
    self.set_property("window-animation-expose-alpha", value)

  def get_window_animation_expose_alpha(self):
    return self.get_property("window-animation-expose-alpha")

gobject.type_register(XfConSettings)

Something went wrong with that request. Please try again.