From f8563bc638b2295ad65cae1b193b1ba96f7f2ae1 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sat, 6 Jul 2013 19:07:39 +0200 Subject: [PATCH] Added commit preferences panel class --- gitg/preferences/gitg-preferences-commit.vala | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 gitg/preferences/gitg-preferences-commit.vala diff --git a/gitg/preferences/gitg-preferences-commit.vala b/gitg/preferences/gitg-preferences-commit.vala new file mode 100644 index 00000000..d6e1f8a7 --- /dev/null +++ b/gitg/preferences/gitg-preferences-commit.vala @@ -0,0 +1,71 @@ +/* + * This file is part of gitg + * + * Copyright (C) 2013 - Jesse van den Kieboom + * + * gitg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * gitg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gitg. If not, see . + */ + +namespace Gitg +{ + +[GtkTemplate (ui = "/org/gnome/gitg/ui/gitg-preferences-commit.ui")] +public class PreferencesCommit : Gtk.Grid, GitgExt.Preferences +{ + // Do this to pull in config.h before glib.h (for gettext...) + private const string version = Gitg.Config.VERSION; + + [GtkChild (name = "check_button_show_right_margin")] + private Gtk.CheckButton d_check_button_show_right_margin; + + [GtkChild (name = "spin_button_right_margin")] + private Gtk.SpinButton d_spin_button_right_margin; + + construct + { + var settings = new Settings("org.gnome.gitg.preferences.commit.message"); + + settings.bind("show-right-margin", + d_check_button_show_right_margin, + "active", + SettingsBindFlags.GET | SettingsBindFlags.SET); + + settings.bind("right-margin-at", + d_spin_button_right_margin, + "value", + SettingsBindFlags.GET | SettingsBindFlags.SET); + } + + public Gtk.Widget widget + { + owned get + { + return this; + } + } + + public string id + { + owned get { return "/org/gnome/gitg/Preferences/Commit"; } + } + + public string display_name + { + owned get { return _("Commit"); } + } +} + +} + +// vi:ts=4