Commit e0987c71 authored by Alex Muñoz's avatar Alex Muñoz Committed by John Stowers

UI changes, new categorization of the tweaks

parent 93d57f1f
......@@ -6,6 +6,10 @@
<item>
<attribute name="label" translatable="yes">_Reset to Defaults</attribute>
<attribute name="action">app.reset</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Disable All Shell Extensions</attribute>
<attribute name="action">app.disable_extension</attribute>
</item>
</section>
<section>
......@@ -30,87 +34,53 @@
<property name="resizable">True</property>
<property name="icon_name">preferences-desktop</property>
<child>
<object class="GtkVBox" id="vbox1">
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar" id="toolbar">
<object class="GtkBox" id="topbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolItem" id="toolbutton1">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">5</property>
<property name="bottom_padding">5</property>
<property name="left_padding">10</property>
<property name="right_padding">5</property>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkAlignment" id="entry-alignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="xscale">0</property>
<child>
<object class="GtkEntry" id="search_entry">
<property name="width_request">210</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
<property name="secondary_icon_name">edit-find-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="info_vbox">
<object class="GtkSeparator" id="separator2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="info_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">10</property>
<child>
<object class="GtkHBox" id="hbox2">
<object class="GtkBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
<object class="GtkScrolledWindow" id="overview_sw">
<property name="width_request">150</property>
<object class="GtkBox" id="leftbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
......@@ -122,9 +92,22 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="detail_vbox">
<object class="GtkSeparator" id="separator1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="detail_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<child>
<object class="GtkNotebook" id="notebook">
......@@ -205,7 +188,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
......@@ -219,7 +202,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
......
......@@ -25,8 +25,10 @@ from gtweak.tweakmodel import TweakModel
from gtweak.tweakview import TweakView
from gtweak.utils import SchemaList
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.utils import DisableExtension
class GnomeTweakTool(Gtk.Application):
def __init__(self):
Gtk.Application.__init__(self,application_id="org.gnome.TweakTool")
......@@ -35,12 +37,9 @@ class GnomeTweakTool(Gtk.Application):
self.win.set_position(Gtk.WindowPosition.CENTER)
self.win.set_application(self)
self.win.set_size_request(720, 580)
toolbar = self.builder.get_object('toolbar')
toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
model = TweakModel()
view = TweakView(self.builder, model)
self.builder.get_object('overview_sw').add(view.treeview)
self.win.show_all()
view.run()
......@@ -58,7 +57,11 @@ class GnomeTweakTool(Gtk.Application):
reset_action = Gio.SimpleAction.new("reset", None)
reset_action.connect("activate", self.reset_cb)
self.add_action(reset_action)
self.add_action(reset_action)
disable_extension_action = Gio.SimpleAction.new("disable_extension", None)
disable_extension_action.connect("activate", self.disable_cb)
self.add_action(disable_extension_action)
help_action = Gio.SimpleAction.new("help", None)
help_action.connect("activate", self.help_cb)
......@@ -72,7 +75,6 @@ class GnomeTweakTool(Gtk.Application):
quit_action.connect("activate", self.quit_cb)
self.add_action(quit_action)
def reset_cb(self, action, parameter):
dialog = Gtk.MessageDialog(self.win,0, Gtk.MessageType.QUESTION,
Gtk.ButtonsType.OK_CANCEL, "Reset to Defaults")
......@@ -86,6 +88,10 @@ class GnomeTweakTool(Gtk.Application):
def help_cb(self, action, parameter):
print "This does nothing. It is only a demonstration."
def disable_cb(self, action, parameter):
ds = DisableExtension()
ds.disable()
def about_cb(self, action, parameter):
aboutdialog = Gtk.AboutDialog()
aboutdialog.set_title("About GNOME Tweak Tool")
......@@ -113,4 +119,4 @@ class GnomeTweakTool(Gtk.Application):
def quit_cb(self, action, parameter):
self.quit()
......@@ -25,15 +25,19 @@ from gi.repository import Gtk
def N_(x): return x
TWEAK_GROUP_FONTS = N_("Fonts")
TWEAK_GROUP_THEME = N_("Theme")
TWEAK_GROUP_APPEARANCE = N_("Appearance")
TWEAK_GROUP_DESKTOP = N_("Desktop")
TWEAK_GROUP_EXTENSION = N_("Extensions")
TWEAK_GROUP_FONTS = N_("Fonts")
TWEAK_GROUP_KEYBOARD = N_("Keyboard Layout")
TWEAK_GROUP_POWER = N_("Power")
TWEAK_GROUP_APPLICATION = N_("Startup Applications")
TWEAK_GROUP_TOPBAR = N_("Top Bar")
TWEAK_GROUP_WINDOWS = N_("Windows")
TWEAK_GROUP_SHELL = N_("Shell")
TWEAK_GROUP_TYPING = N_("Typing")
TWEAK_GROUP_MOUSE = N_("Mouse")
TWEAK_GROUP_WORKSPACES = N_("Workspaces")
#translate this the same as the name of the file manager (nautilus)
TWEAK_GROUP_MOUSE = N_("Mouse")
TWEAK_GROUP_TYPING = N_("Typing")
TWEAK_GROUP_FILES = N_("Files")
TWEAK_SORT_FIRST = -1e3
......@@ -51,7 +55,8 @@ class Tweak:
self.widget_sort_hint = None
self._search_cache = None
if options.get("sort"):
self.widget_sort_hint = options.get("sort")
#FIXME: I would have rather done these as a GObject signal, but it
#would prohibit other tweaks from inheriting from GtkWidgets
self._notify_cb = None
......
......@@ -17,17 +17,17 @@
from gi.repository import Gtk
from gtweak.tweakmodel import Tweak, TWEAK_GROUP_FONTS
from gtweak.tweakmodel import Tweak, TWEAK_GROUP_FONTS, TWEAK_SORT_FIRST, TWEAK_SORT_LAST
from gtweak.widgets import GSettingsSpinButtonTweak, GSettingsFontButtonTweak, GSettingsComboTweak
TWEAKS = (
GSettingsSpinButtonTweak("org.gnome.desktop.interface", "text-scaling-factor", adjustment_step=0.1, digits=1, group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "monospace-font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.wm.preferences", "titlebar-font", group_name=TWEAK_GROUP_FONTS),
GSettingsComboTweak("org.gnome.settings-daemon.plugins.xsettings", "hinting",
[(i, i.title()) for i in ("none", "slight", "medium", "full")], group_name=TWEAK_GROUP_FONTS),
GSettingsComboTweak("org.gnome.settings-daemon.plugins.xsettings", "antialiasing",
[(i, i.title()) for i in ("none", "grayscale", "rgba")], group_name=TWEAK_GROUP_FONTS),
#GSettingsSpinButtonTweak("org.gnome.desktop.interface", "text-scaling-factor", adjustment_step=0.1, digits=1, group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("Interface","org.gnome.desktop.interface", "font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("Documents", "org.gnome.desktop.interface", "document-font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("Monospace", "org.gnome.desktop.interface", "monospace-font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("Window Titles","org.gnome.desktop.wm.preferences", "titlebar-font", group_name=TWEAK_GROUP_FONTS, sort=TWEAK_SORT_FIRST),
GSettingsComboTweak("Hinting","org.gnome.settings-daemon.plugins.xsettings", "hinting",
[(i, i.title()) for i in ("none", "slight", "medium", "full")], group_name=TWEAK_GROUP_FONTS, sort=TWEAK_SORT_LAST),
GSettingsComboTweak("Antialiasing","org.gnome.settings-daemon.plugins.xsettings", "antialiasing",
[(i, i.title()) for i in ("none", "grayscale", "rgba")], group_name=TWEAK_GROUP_FONTS,sort=TWEAK_SORT_LAST),
)
......@@ -22,12 +22,13 @@ from gi.repository import GLib
import gtweak
from gtweak.utils import walk_directories, make_combo_list_with_default
from gtweak.tweakmodel import TWEAK_GROUP_THEME
from gtweak.widgets import GSettingsSwitchTweak, GSettingsComboTweak, DarkThemeSwitcher
from gtweak.tweakmodel import TWEAK_GROUP_APPEARANCE, TWEAK_GROUP_KEYBOARD, TWEAK_SORT_FIRST
from gtweak.widgets import GSettingsSwitchTweak, GSettingsComboTweak, DarkThemeSwitcher, Title
class GtkThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
"GTK+",
"org.gnome.desktop.interface",
"gtk-theme",
make_combo_list_with_default(self._get_valid_themes(), "Adwaita"),
......@@ -46,7 +47,8 @@ class GtkThemeSwitcher(GSettingsComboTweak):
class IconThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
"org.gnome.desktop.interface",
"Icons",
"org.gnome.desktop.interface",
"icon-theme",
make_combo_list_with_default(self._get_valid_icon_themes(), "gnome"),
**options)
......@@ -63,6 +65,7 @@ class IconThemeSwitcher(GSettingsComboTweak):
class CursorThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
"Cursor",
"org.gnome.desktop.interface",
"cursor-theme",
make_combo_list_with_default(self._get_valid_cursor_themes(), "Adwaita"),
......@@ -80,6 +83,7 @@ class CursorThemeSwitcher(GSettingsComboTweak):
class KeyThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
"Key",
"org.gnome.desktop.interface",
"gtk-key-theme",
make_combo_list_with_default(
......@@ -98,11 +102,12 @@ class KeyThemeSwitcher(GSettingsComboTweak):
return valid
TWEAKS = (
GSettingsSwitchTweak("org.gnome.desktop.interface", "menus-have-icons", group_name=TWEAK_GROUP_THEME),
GSettingsSwitchTweak("org.gnome.desktop.interface", "buttons-have-icons", group_name=TWEAK_GROUP_THEME),
DarkThemeSwitcher(group_name=TWEAK_GROUP_THEME),
CursorThemeSwitcher(group_name=TWEAK_GROUP_THEME),
KeyThemeSwitcher(group_name=TWEAK_GROUP_THEME),
IconThemeSwitcher(group_name=TWEAK_GROUP_THEME),
GtkThemeSwitcher(group_name=TWEAK_GROUP_THEME),
#GSettingsSwitchTweak("Buttons Icons","org.gnome.desktop.interface", "buttons-have-icons", group_name=TWEAK_GROUP_APPEARANCE),
#GSettingsSwitchTweak("Menu Icons","org.gnome.desktop.interface", "menus-have-icons", group_name=TWEAK_GROUP_APPEARANCE),
DarkThemeSwitcher(group_name=TWEAK_GROUP_APPEARANCE),
Title("Theme", "", group_name=TWEAK_GROUP_APPEARANCE),
KeyThemeSwitcher(group_name=TWEAK_GROUP_KEYBOARD),
GtkThemeSwitcher(group_name=TWEAK_GROUP_APPEARANCE),
IconThemeSwitcher(group_name=TWEAK_GROUP_APPEARANCE),
CursorThemeSwitcher(group_name=TWEAK_GROUP_APPEARANCE),
)
......@@ -2,7 +2,8 @@ from gtweak.tweakmodel import TWEAK_GROUP_MOUSE
from gtweak.widgets import GSettingsSwitchTweak
TWEAKS = (
GSettingsSwitchTweak("org.gnome.settings-daemon.peripherals.mouse",
GSettingsSwitchTweak("Show location of pointer",
"org.gnome.settings-daemon.peripherals.mouse",
"locate-pointer",
schema_filename="org.gnome.settings-daemon.peripherals.gschema.xml",
group_name=TWEAK_GROUP_MOUSE),
......
......@@ -25,6 +25,7 @@ from gtweak.widgets import GSettingsSwitchTweak, GSettingsComboEnumTweak, GSetti
class DesktopIconTweak(GSettingsSwitchTweak):
def __init__(self, **options):
GSettingsSwitchTweak.__init__(self,
"Icons on Desktop",
"org.gnome.desktop.background",
"show-desktop-icons",
**options)
......@@ -47,13 +48,12 @@ dicons = DesktopIconTweak(group_name=TWEAK_GROUP_DESKTOP)
TWEAKS = (
dicons,
GSettingsSwitchTweak("org.gnome.nautilus.desktop", "computer-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("org.gnome.nautilus.desktop", "home-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("org.gnome.nautilus.desktop", "network-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("org.gnome.nautilus.desktop", "trash-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("org.gnome.nautilus.desktop", "volumes-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("org.gnome.nautilus.preferences", "always-use-location-entry",
schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_FILES),
GSettingsComboEnumTweak("org.gnome.desktop.background", "picture-options", group_name=TWEAK_GROUP_DESKTOP),
GSettingsFileChooserButtonTweak("org.gnome.desktop.background", "picture-uri", local_only=True, mimetypes=["application/xml","image/png","image/jpeg"], group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("Computer","org.gnome.nautilus.desktop", "computer-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("Home","org.gnome.nautilus.desktop", "home-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("Network Servers","org.gnome.nautilus.desktop", "network-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("Trash","org.gnome.nautilus.desktop", "trash-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
GSettingsSwitchTweak("Mounted Volumes","org.gnome.nautilus.desktop", "volumes-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_DESKTOP),
#GSettingsSwitchTweak("org.gnome.nautilus.preferences", "always-use-location-entry",schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_FILES),
#GSettingsComboEnumTweak("org.gnome.desktop.background", "picture-options", group_name=TWEAK_GROUP_DESKTOP),
#GSettingsFileChooserButtonTweak("org.gnome.desktop.background", "picture-uri", local_only=True, mimetypes=["application/xml","image/png","image/jpeg"], group_name=TWEAK_GROUP_DESKTOP),
)
......@@ -27,8 +27,8 @@ from gi.repository import Gtk, GLib, GObject, Gio
from gtweak.utils import walk_directories, extract_zip_file, make_combo_list_with_default
from gtweak.gsettings import GSettingsSetting, GSettingsMissingError, GSettingsFakeSetting
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.tweakmodel import Tweak, TweakGroup, TWEAK_GROUP_THEME, TWEAK_GROUP_SHELL, TWEAK_SORT_LAST
from gtweak.widgets import FileChooserButton, GSettingsComboTweak, GSettingsComboEnumTweak, GSettingsSwitchTweak, adjust_schema_for_overrides, build_label_beside_widget, build_horizontal_sizegroup, build_combo_box_text, UI_BOX_SPACING
from gtweak.tweakmodel import Tweak, TweakGroup, TWEAK_GROUP_APPEARANCE, TWEAK_GROUP_TOPBAR, TWEAK_GROUP_WINDOWS, TWEAK_GROUP_WORKSPACES, TWEAK_GROUP_POWER, TWEAK_SORT_FIRST, TWEAK_SORT_LAST
from gtweak.widgets import FileChooserButton, GSettingsComboTweak, GSettingsComboEnumTweak, GSettingsSwitchTweak, adjust_schema_for_overrides, build_label_beside_widget, build_horizontal_sizegroup, build_combo_box_text, UI_BOX_SPACING, Title
_shell = GnomeShellFactory().get_shell()
_shell_loaded = _shell is not None
......@@ -36,6 +36,7 @@ _shell_loaded = _shell is not None
class ShowWindowButtons(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
"Title Bar Buttons",
"org.gnome.desktop.wm.preferences",
"button-layout",
((':close', _("Close Only")),
......@@ -245,21 +246,24 @@ class StaticWorkspaceTweak(Tweak):
sg = build_horizontal_sizegroup()
TWEAKS = (
ShellThemeTweak(group_name=TWEAK_GROUP_THEME, loaded=_shell_loaded),
ShellThemeTweak(group_name=TWEAK_GROUP_APPEARANCE, loaded=_shell_loaded),
ShowWindowButtons(group_name=TWEAK_GROUP_WINDOWS, size_group=sg),
StaticWorkspaceTweak(size_group=sg, loaded=_shell_loaded, group_name=TWEAK_GROUP_WORKSPACES),
GSettingsComboEnumTweak("Power Button Action", "org.gnome.settings-daemon.plugins.power", "button-power", size_group=sg, group_name=TWEAK_GROUP_POWER, sort=TWEAK_SORT_FIRST),
Title("When Laptop Lid is Closed", "", group_name=TWEAK_GROUP_POWER),
#GSettingsSwitchTweak("org.gnome.settings-daemon.plugins.power", "lid-close-suspend-with-external-monitor"),
GSettingsComboEnumTweak("On Battery Power","org.gnome.settings-daemon.plugins.power", "lid-close-battery-action", size_group=sg, group_name=TWEAK_GROUP_POWER),
GSettingsComboEnumTweak("When plugged in","org.gnome.settings-daemon.plugins.power", "lid-close-ac-action", size_group=sg, group_name=TWEAK_GROUP_POWER),
)
TWEAK_GROUPS = (
TweakGroup(
TWEAK_GROUP_SHELL,
GSettingsSwitchTweak("org.gnome.desktop.interface", "clock-show-date", schema_filename="org.gnome.desktop.interface.gschema.xml"),
GSettingsSwitchTweak("org.gnome.desktop.interface", "clock-show-seconds", schema_filename="org.gnome.desktop.interface.gschema.xml"),
GSettingsSwitchTweak("org.gnome.shell.calendar", "show-weekdate", schema_filename="org.gnome.shell.gschema.xml", loaded=_shell_loaded),
ShowWindowButtons(size_group=sg),
GSettingsSwitchTweak("org.gnome.settings-daemon.plugins.power", "lid-close-suspend-with-external-monitor"),
GSettingsComboEnumTweak("org.gnome.settings-daemon.plugins.power", "lid-close-battery-action", size_group=sg),
GSettingsComboEnumTweak("org.gnome.settings-daemon.plugins.power", "lid-close-ac-action", size_group=sg),
GSettingsComboEnumTweak("org.gnome.settings-daemon.plugins.power", "button-power", size_group=sg),
GSettingsComboEnumTweak("org.gnome.settings-daemon.plugins.xrandr", "default-monitors-setup", size_group=sg),
GSettingsSwitchTweak("org.gnome.mutter", "workspaces-only-on-primary", schema_filename="org.gnome.shell.gschema.xml", loaded=_shell_loaded),
StaticWorkspaceTweak(size_group=sg, loaded=_shell_loaded)),
TWEAK_GROUP_TOPBAR,
GSettingsSwitchTweak("Show date","org.gnome.desktop.interface", "clock-show-date", schema_filename="org.gnome.desktop.interface.gschema.xml"),
GSettingsSwitchTweak("Show seconds", "org.gnome.desktop.interface", "clock-show-seconds", schema_filename="org.gnome.desktop.interface.gschema.xml"),
GSettingsSwitchTweak("Show week numbers","org.gnome.shell.calendar", "show-weekdate", schema_filename="org.gnome.shell.gschema.xml", loaded=_shell_loaded),
#GSettingsComboEnumTweak("org.gnome.settings-daemon.plugins.xrandr", "default-monitors-setup", size_group=sg),
#GSettingsSwitchTweak("org.gnome.mutter", "workspaces-only-on-primary", schema_filename="org.gnome.shell.gschema.xml", loaded=_shell_loaded),
),
)
......@@ -15,6 +15,7 @@ from gtweak.gshellwrapper import GnomeShell, GnomeShellFactory
from gtweak.tweakmodel import Tweak, TweakGroup
from gtweak.widgets import FileChooserButton, build_label_beside_widget, build_horizontal_sizegroup, build_tight_button, UI_BOX_SPACING
from gtweak.egowrapper import ExtensionsDotGnomeDotOrg
from gtweak.utils import DisableExtension
def N_(x): return x
......@@ -62,6 +63,9 @@ class _ShellExtensionTweak(Tweak):
deleteButton.connect("clicked", self._on_extension_delete, uuid, ext["name"])
widgets.append(deleteButton)
de = DisableExtension()
de.connect('disable-extension', self._on_disable_extension, sw)
widgets.append(sw)
self.widget = build_label_beside_widget(
......@@ -70,6 +74,9 @@ class _ShellExtensionTweak(Tweak):
warning=warning)
self.widget_for_size_group = None
def _on_disable_extension(self, de, sw):
sw.set_active(False)
def _on_configure_clicked(self, btn, uuid):
execute_subprocess(['gnome-shell-extension-prefs', uuid], block=False)
......@@ -211,7 +218,7 @@ class _ShellExtensionInstallerTweak(Tweak):
class ShellExtensionTweakGroup(TweakGroup):
def __init__(self):
TweakGroup.__init__(self, N_("Shell Extensions"))
TweakGroup.__init__(self, N_("Extensions"))
extension_tweaks = []
sg = build_horizontal_sizegroup()
......
......@@ -132,7 +132,8 @@ TWEAK_GROUPS = (
)
TWEAKS = (
GSettingsSwitchTweak("org.gnome.desktop.input-sources",
GSettingsSwitchTweak("Show All Sources",
"org.gnome.desktop.input-sources",
"show-all-sources",
logout_required=True,
group_name=TWEAK_GROUP_TYPING),
......
......@@ -21,12 +21,13 @@ from gi.repository import GLib
import gtweak
from gtweak.utils import walk_directories, make_combo_list_with_default
from gtweak.tweakmodel import TWEAK_GROUP_WINDOWS, TWEAK_GROUP_THEME
from gtweak.widgets import GSettingsComboTweak, GSettingsComboEnumTweak, GSettingsSwitchTweak
from gtweak.tweakmodel import TWEAK_GROUP_WINDOWS, TWEAK_GROUP_APPEARANCE, TWEAK_SORT_FIRST, TWEAK_SORT_LAST
from gtweak.widgets import GSettingsComboTweak, GSettingsComboEnumTweak, GSettingsSwitchTweak, Title
class WindowThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
"Window",
"org.gnome.desktop.wm.preferences",
"theme",
make_combo_list_with_default(self._get_valid_themes(), "Adwaita"),
......@@ -40,16 +41,17 @@ class WindowThemeSwitcher(GSettingsComboTweak):
return valid
TWEAKS = (
WindowThemeSwitcher(group_name=TWEAK_GROUP_THEME),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "action-double-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "action-right-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "focus-mode", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboTweak("org.gnome.desktop.wm.preferences",
"mouse-button-modifier",
[("disabled", _("Disabled")), ("<Alt>", "Alt"), ("<Super>", "Super")],
group_name=TWEAK_GROUP_WINDOWS),
GSettingsSwitchTweak("org.gnome.desktop.wm.preferences", "resize-with-right-button", group_name=TWEAK_GROUP_WINDOWS),
GSettingsSwitchTweak("org.gnome.desktop.wm.preferences", "raise-on-click", group_name=TWEAK_GROUP_WINDOWS),
GSettingsSwitchTweak("org.gnome.mutter", "attach-modal-dialogs", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("Focus Mode", "org.gnome.desktop.wm.preferences", "focus-mode", group_name=TWEAK_GROUP_WINDOWS),
WindowThemeSwitcher(group_name=TWEAK_GROUP_APPEARANCE),
Title("Titlebar Actions", "", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("Double-click","org.gnome.desktop.wm.preferences", "action-double-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("Middle-click","org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("Secondary-click","org.gnome.desktop.wm.preferences", "action-right-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
#GSettingsComboTweak("org.gnome.desktop.wm.preferences",
# "mouse-button-modifier",
# [("disabled", _("Disabled")), ("<Alt>", "Alt"), ("<Super>", "Super")],
# group_name=TWEAK_GROUP_WINDOWS),
#GSettingsSwitchTweak("org.gnome.desktop.wm.preferences", "resize-with-right-button", group_name=TWEAK_GROUP_WINDOWS),
#GSettingsSwitchTweak("org.gnome.desktop.wm.preferences", "raise-on-click", group_name=TWEAK_GROUP_WINDOWS),
#GSettingsSwitchTweak("org.gnome.mutter", "attach-modal-dialogs", group_name=TWEAK_GROUP_WINDOWS),
)
......@@ -23,7 +23,7 @@ from gi.repository import Gtk, Gdk, GObject
import gtweak.tweakmodel
from gtweak.tweakmodel import TweakModel
DEFAULT_TWEAKGROUP = gtweak.tweakmodel.TWEAK_GROUP_SHELL
DEFAULT_TWEAKGROUP = gtweak.tweakmodel.TWEAK_GROUP_APPEARANCE
WIDGET_SORT_ORDER = (Gtk.Switch, Gtk.SpinButton, Gtk.ComboBox, Gtk.Box, Gtk.VBox, Gtk.HBox)
def _sort_tweak_widgets_by_widget_type(tweak):
......@@ -43,21 +43,32 @@ class TweakView:
self._notebook = builder.get_object('notebook')
self._detail_vbox = builder.get_object('detail_vbox')
self.headerbar = Gtk.HeaderBar()
searchToggle = Gtk.ToggleButton()
searchToggle.add(Gtk.Image.new_from_stock(Gtk.STOCK_FIND, Gtk.IconSize.MENU))
top = builder.get_object('topbox')
top.pack_start(self.headerbar, True, True, 0)
self.headerbar.pack_start(searchToggle)
leftbox = builder.get_object('leftbox')
revealer = Gtk.Revealer();
entry = Gtk.SearchEntry()
self._entry_manager = EntryManager(
builder.get_object('search_entry'),
entry,
self._on_search,
self._on_search_cancel)
revealer.add(entry)
leftbox.pack_start(revealer, False, True, 0)
searchToggle.connect("toggled", self.transition, entry, revealer)
self._model = model
self._model.load_tweaks()
self.treeview = Gtk.TreeView(model=model)
self.treeview.props.headers_visible = False
self.treeview.append_column(
Gtk.TreeViewColumn(
"Tweak", Gtk.CellRendererText(), text=TweakModel.COLUMN_NAME))
self.treeview.get_selection().connect("changed", self._on_selection_changed)
self.treeview.show_all()
groups = self._model._tweak_group_names.keys()
groups = sorted(groups)
listbox = self.init_listbox(groups)
leftbox.pack_start(listbox, True, True, 0)
#make sure the tweak background is the correct color
ctx = builder.get_object('tweak_viewport').get_style_context ()
......@@ -77,9 +88,13 @@ class TweakView:
self._notification_functions = {}
def run(self):
self.treeview.get_selection().select_iter(
self._model.get_tweakgroup_iter(DEFAULT_TWEAKGROUP))
itere = self._model.get_tweakgroup_iter(DEFAULT_TWEAKGROUP)
self._on_pre_selection_change()
tweakgroup = self._model.get_value(itere, self._model.COLUMN_TWEAK)
self.show_only_tweaks(tweakgroup.tweaks)
self._on_post_selection_change()
self.headerbar.set_title(tweakgroup.name)
def show_only_tweaks(self, tweaks):
for t in self._model.tweaks:
if t in tweaks:
......@@ -88,7 +103,7 @@ class TweakView:
t.widget.hide()
def select_none(self):
self.treeview.get_selection().unselect_all()
print "filter"
def _on_tweak_notify_response(self, info, response, func):
self._detail_vbox.remove(info)
......@@ -138,17 +153,38 @@ class TweakView:
def _on_post_selection_change(self):
self._notebook.set_current_page(1)
def _on_selection_changed(self, selection):
t1 = datetime.datetime.now()
model, selected = selection.get_selected()
if selected:
def _on_selection_changed(self, lista, row):
if row is not None:
text = row.get_child().get_text()
itere = self._model._tweak_group_iters[text]
self._on_pre_selection_change()
tweakgroup = model.get_value(selected, model.COLUMN_TWEAK)
tweakgroup = self._model.get_value(itere, self._model.COLUMN_TWEAK)
self.show_only_tweaks(tweakgroup.tweaks)
self._on_post_selection_change()
t2 = datetime.datetime.now()
#print "TTTTTT=",t2-t1
self.headerbar.set_title(tweakgroup.name)
def init_listbox(self, values):
listbox = Gtk.ListBox()
for i in values:
lbl = Gtk.Label(i)
lbl.props.xalign = 0.0
row = Gtk.ListBoxRow()
listbox.add(lbl)
widget = listbox.get_row_at_index(0)
listbox.select_row (widget)
listbox.connect("row-selected", self._on_selection_changed)
return listbox
def transition(self, btn, entry, revealer):
if revealer.get_reveal_child():
revealer.set_reveal_child(False)
entry.set_text("")
btn.grab_focus()
else:
revealer.set_reveal_child(True)
entry.grab_focus()
class EntryManager:
SYMBOLIC = "-symbolic"
......
......@@ -24,6 +24,7 @@ import subprocess
import gtweak
from gtweak.gsettings import GSettingsSetting
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio
def singleton(cls):
......@@ -245,6 +246,18 @@ class SchemaList:
for i in SchemaList.__list:
s = Gio.Settings(i[1])
s.reset(i[0])
@singleton
class DisableExtension(GObject.GObject):
__gsignals__ = {
"disable-extension": (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE,()),
}
def __init__(self):
GObject.GObject.__init__(self)
def disable(self):
self.emit("disable-extension")
@singleton
class XSettingsOverrides:
......
......@@ -61,7 +61,19 @@ def build_label_beside_widget(txt, *widget, **kwargs):
lbl.props.xalign = 0.0
lbl.set_has_tooltip(True)
lbl.connect("query-tooltip", show_tooltip_when_ellipsized)
hbox.pack_start(lbl, True, True, 0)
if kwargs.get("desc"):
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box.pack_start(lbl, True, True, 0)
desc = kwargs.get("desc")
lbl_des = Gtk.Label()
lbl_des.props.xalign = 0.0
lbl_des.set_markup("<span size='x-small'>"+desc+"</span>")
box.pack_start(lbl_des, True, True,0)
hbox.pack_start(box, True, True,0)
else:
hbox.pack_start(lbl, True, True, 0)
if kwargs.get("info"):
hbox.pack_start(
......@@ -201,12 +213,12 @@ class _DependableMixin:
self.widget.set_sensitive(sensitive)
class GSettingsSwitchTweak(_GSettingsTweak, _DependableMixin):
def __init__(self, schema_name, key_name, **options):
def __init__(self, name, schema_name, key_name, **options):
_GSettingsTweak.__init__(self, schema_name, key_name, **options)