2
// Copyright (C) 2011 Maxwell Barvian
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
20
public enum PictureMode {
27
public void get_options (out bool stretch_x, out bool stretch_y, out bool center_x, out bool center_y) {
31
case PictureMode.CENTERED:
37
case PictureMode.SCALED:
43
case PictureMode.STRETCHED:
49
case PictureMode.ZOOMED:
65
// Class to interface with GSettings for pantheon-wallpaper
66
public class WallpaperSettings : Granite.Services.Settings {
68
public PictureMode picture_mode { get; set; }
70
public string picture_path { get; set; }
72
public string background_color { get; set; }
74
public WallpaperSettings () {
75
base ("desktop.Wallpaper");
78
protected override void verify (string key) {
82
case "background-color":
84
if (!Gdk.Color.parse (background_color, out bg))
85
background_color = "#000000";
90
// Helper function to make life easier.
91
public void set_picture_mode_from_name (string name) {
93
if (name == "Tiled") {
94
picture_mode = PictureMode.TILED;
96
else if (name == "Centered") {
97
picture_mode = PictureMode.CENTERED;
99
else if (name == "Scaled") {
100
picture_mode = PictureMode.SCALED;
102
else if (name == "Stretched") {
103
picture_mode = PictureMode.STRETCHED;
105
else if (name == "Zoomed") {
106
picture_mode = PictureMode.ZOOMED;