1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
3
* Copyright (C) 2010 Canonical Ltd
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
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/>.
17
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
22
#include "DashSettings.h"
24
#define FORM_FACTOR "form-factor"
26
static DashSettings* _places_settings = NULL;
28
DashSettings::DashSettings()
33
_settings = g_settings_new("com.canonical.Unity");
34
g_signal_connect(_settings, "changed",
35
(GCallback)(DashSettings::Changed), this);
39
DashSettings::~DashSettings()
41
g_object_unref(_settings);
45
DashSettings::Refresh()
47
_raw_from_factor = g_settings_get_enum(_settings, FORM_FACTOR);
49
if (_raw_from_factor == 0) //Automatic
55
screen = gdk_screen_get_default();
56
primary_monitor = gdk_screen_get_primary_monitor(screen);
57
gdk_screen_get_monitor_geometry(screen, primary_monitor, &geo);
59
_form_factor = geo.height > 799 ? DESKTOP : NETBOOK;
63
_form_factor = (FormFactor)_raw_from_factor;
70
DashSettings::Changed(GSettings* settings, char* key, DashSettings* self)
76
DashSettings::GetDefault()
78
if (G_UNLIKELY(!_places_settings))
79
_places_settings = new DashSettings();
81
return _places_settings;
84
DashSettings::FormFactor
85
DashSettings::GetFormFactor()
91
DashSettings::SetFormFactor(FormFactor factor)
93
_form_factor = factor;
94
g_settings_set_enum(_settings, FORM_FACTOR, factor);