3
# Ubuntu Tweak - PyGTK based desktop configure tool
5
# Copyright (C) 2007-2008 TualatriX <tualatrix@gmail.com>
7
# Ubuntu Tweak is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2 of the License, or
10
# (at your option) any later version.
12
# Ubuntu Tweak is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with Ubuntu Tweak; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26
from tweak import TweakModule
27
from common.consts import *
28
from common.factory import WidgetFactory
32
"label" : _('Show "Computer" icon on desktop'),
33
"rename" : _('Rename'),
34
"visible" : "computer_icon_visible",
35
"name" : "computer_icon_name",
36
"icon" : "gnome-fs-client"
41
"label" : _('Show "Home Folder" icon on desktop'),
42
"rename" : _('Rename'),
43
"visible" : "home_icon_visible",
44
"name" : "home_icon_name",
45
"icon" : "gnome-fs-home"
50
"label" : _('Show "Trash" icon on desktop'),
51
"rename" : _('Rename'),
52
"visible" : "trash_icon_visible",
53
"name" : "trash_icon_name",
54
"icon" : "gnome-fs-trash-empty"
57
desktop_icon = (computer_icon, home_icon, trash_icon)
59
class DesktopIcon(gtk.VBox):
60
def __init__(self, item):
61
gtk.VBox.__init__(self)
63
self.show_button = WidgetFactory.create("GconfCheckButton",
64
label = item["label"],
65
key = item["visible"])
66
self.show_button.connect('toggled', self.colleague_changed)
67
self.pack_start(self.show_button, False, False, 0)
69
self.show_hbox = gtk.HBox(False, 10)
70
self.pack_start(self.show_hbox, False, False, 0)
72
if not self.show_button.get_active():
73
self.show_hbox.set_sensitive(False)
75
icon = gtk.image_new_from_icon_name(item["icon"], gtk.ICON_SIZE_DIALOG)
76
self.show_hbox.pack_start(icon, False, False, 0)
78
self.rename_button = WidgetFactory.create("StrGconfCheckButton",
79
label = item["rename"],
81
self.rename_button.connect('toggled', self.colleague_changed)
82
vbox = gtk.VBox(False, 5)
83
self.show_hbox.pack_start(vbox, False, False, 0)
84
vbox.pack_start(self.rename_button, False, False, 0)
86
self.entry = WidgetFactory.create("GconfEntry", key = item["name"])
87
self.entry.connect('focus-out-event', self.entry_focus_out)
88
if not self.rename_button.get_active():
89
self.entry.set_sensitive(False)
90
vbox.pack_start(self.entry, False, False, 0)
92
def entry_focus_out(self, widget, event):
93
self.entry.get_gsetting().set_string(self.entry.get_text())
95
def colleague_changed(self, widget):
96
self.show_hbox.set_sensitive(self.show_button.get_active())
97
active = self.rename_button.get_active()
99
self.entry.set_sensitive(True)
100
self.entry.grab_focus()
102
self.entry.set_sensitive(False)
103
self.entry.get_gsetting().unset()
104
self.entry.set_text(_("Unset"))
106
class Icon(TweakModule):
107
__title__ = _('Desktop Icon settings')
108
__desc__ = _('Change your desktop icons behavir')
109
__icon__ = 'user-desktop'
110
__url__ = 'http://ubuntu-tweak.com'
111
__category__ = 'desktop'
114
TweakModule.__init__(self)
116
for item in desktop_icon:
117
self.add_start(DesktopIcon(item), False, False, 0)
119
button = WidgetFactory.create("GconfCheckButton",
120
label = _("Show \"Network\" icon on desktop"),
121
key = "network_icon_visible")
122
self.add_start(button, False, False, 0)
124
button = WidgetFactory.create("GconfCheckButton",
125
label = _("Show mounted volumes on desktop"),
126
key = "volumes_visible")
127
self.add_start(button, False, False, 0)
129
button = WidgetFactory.create("GconfCheckButton",
130
label = _('Use "Home Folder" as desktop (Logout for changes to take effect)'),
131
key = "desktop_is_home_dir")
132
self.add_start(button, False, False, 0)