Added dconf settings

This commit is contained in:
Garden Gnome 2012-05-31 15:07:43 +01:00
parent 9c2a31fbd6
commit 8900137646
5 changed files with 81 additions and 4 deletions

View File

@ -42,6 +42,7 @@ ensure_vala_version("0.16.0" MINIMUM)
include(ValaPrecompile)
vala_precompile(VALA_C
src/gala.vala
src/gala-settings.vala
src/gala-plugin.vala
src/main.vala
src/Widgets/WorkspaceSwitcher.vala
@ -61,8 +62,8 @@ OPTIONS
#add_subdirectory (po)
#include(GSettings)
#add_schema ("data/org.pantheon.audience.gschema.xml")
include(GSettings)
add_schema ("data/org.pantheon.desktop.gala.gschema.xml")
add_executable(gala ${VALA_C})#src/main.c)

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema path="/org/pantheon/desktop/gala/" id="org.pantheon.desktop.gala" gettext-domain="gala">
<key type="b" name="attach-modal-dialogs">
<default>true</default>
<summary>Attach modal dialogs</summary>
<description>When true, instead of having independent titlebars, modal dialogs appear attached to the titlebar of the parent window and are moved together with the parent window.</description>
</key>
<key type="s" name="button-layout">
<default>'close:maximize'</default>
<summary>Arrangement of buttons on the titlebar</summary>
<description>Arrangement of buttons on the titlebar. The value should be a string, such as "menu:minimize,maximize,spacer,close"; the colon separates the left corner of the window from the right corner, and the button names are comma-separated. Duplicate buttons are not allowed. Unknown button names are silently ignored so that buttons can be added in future metacity versions without breaking older versions. A special spacer tag can be used to insert some space between two adjacent buttons.</description>
</key>
<key type="b" name="edge-tiling">
<default>true</default>
<summary>Enable edge tiling when dropping windows on screen edges</summary>
<description>If enabled, dropping windows on vertical screen edges maximizes them vertically and resizes them horizontally to cover half of the available area. Dropping windows on the top screen edge maximizes them completely.</description>
</key>
<key type="b" name="enable-animations">
<default>true</default>
<summary>Enable Animations</summary>
<description>Whether animations should be displayed. Note: This is a global key, it changes the behaviour of the window manager, the panel etc.</description>
</key>
<key type="s" name="panel-main-menu-action">
<default>'slingshot'</default>
<summary>Panel main menu action</summary>
<description>Sets the command to run when the panel-main-menu keybinding is pressed</description>
</key>
<key type="s" name="theme">
<default>'elementary'</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="use-gnome-defaults">
<default>false</default>
<summary></summary>
<description></description>
</key>
</schema>
</schemalist>

View File

@ -8,7 +8,13 @@ namespace Gala {
public Clutter.Actor elements;
public Plugin () {
if (Settings.get_default().use_gnome_defaults)
return;
Meta.Prefs.override_preference_schema ("attach-modal-dialogs", SCHEMA);
Meta.Prefs.override_preference_schema ("button-layout", SCHEMA);
Meta.Prefs.override_preference_schema ("edge-tiling", SCHEMA);
Meta.Prefs.override_preference_schema ("enable-animations", SCHEMA);
Meta.Prefs.override_preference_schema ("theme", SCHEMA);
}
public override void start () {
@ -32,7 +38,7 @@ namespace Gala {
this.elements.add_child (this.winswitcher);
Meta.KeyBinding.set_custom_handler ("panel-main-menu",
() => {
Process.spawn_command_line_async ("slingshot");
Process.spawn_command_line_async (Settings.get_default().panel_main_menu_action);
});
Meta.KeyBinding.set_custom_handler ("switch-windows",
(display, screen, window, ev, binding) => {

28
src/gala-settings.vala Normal file
View File

@ -0,0 +1,28 @@
namespace Gala
{
public class Settings : Granite.Services.Settings
{
public bool attach_modal_dialogs { get; set; }
public string[] button_layout { get; set; }
public bool edge_tiling { get; set; }
public bool enable_animations { get; set; }
public string panel_main_menu_action { get; set; }
public string theme { get; set; }
public bool use_gnome_defaults { get; set; }
static Settings? instance = null;
private Settings ()
{
base (SCHEMA);
}
public static Settings get_default()
{
if (instance == null)
instance = new Settings ();
return instance;
}
}
}

View File

@ -39,6 +39,8 @@ namespace Gala {
const string VERSION = "0.1";
const string SCHEMA = "org.pantheon.desktop.gala";
const OptionEntry[] OPTIONS = {
{ "version", 0, OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) print_version, "Print version", null },
{ null }