~jamespharaoh/ubuntu/oneiric/unity/fix-for-880672

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/DashSettings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-25 15:40:18 UTC
  • mfrom: (1.1.52 upstream)
  • Revision ID: james.westby@ubuntu.com-20110825154018-enhrknkztdco821i
Tags: 4.10.0-0ubuntu1
* New upstream release:
  - unity task switcher (alt-tab, alt-down) shows empty spaces for iconified 
    windows in window detail mode (lp: #828348)
  - compiz crashed with SIGSEGV in 
    unity::DeviceLauncherIcon::OnStopDriveReady() (lp: #824093)
  - Dash performance issues with 'Active Blur' enabled (lp: #824890)
  - compiz crashed with SIGABRT in raise() when setting background 
    to full color (lp: #829049)
  - Dragging from dash to launcher still doesn't work (lp: #824833)
  - .desktops dragged on to unity launcher will not be added to 
     com.canonical.Unity.Launcher favorites unless moved in the launcher
     (lp: #830536)
  - application's menu shown when the cursor is a little left 
    to window controls (lp: #820293)
  - Ubuntu Start launcher item should always start the dash with 
    the Home screen (lp: #825034)
  - search spinner does not stop hence nothing can be launched with 
    the Return key (lp: #824836)
* debian/control: updated nux requirement
* debian/rules: updated shlibs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
 
2
/*
 
3
* Copyright (C) 2010 Canonical Ltd
 
4
*
 
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.
 
8
*
 
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.
 
13
*
 
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/>.
 
16
*
 
17
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
 
18
*/
 
19
 
 
20
#include "gdk/gdk.h"
 
21
 
 
22
#include "DashSettings.h"
 
23
 
 
24
#define FORM_FACTOR "form-factor"
 
25
 
 
26
static DashSettings* _places_settings = NULL;
 
27
 
 
28
DashSettings::DashSettings()
 
29
  : _settings(NULL),
 
30
    _raw_from_factor(0),
 
31
    _form_factor(DESKTOP)
 
32
{
 
33
  _settings = g_settings_new("com.canonical.Unity");
 
34
  g_signal_connect(_settings, "changed",
 
35
                   (GCallback)(DashSettings::Changed), this);
 
36
  Refresh();
 
37
}
 
38
 
 
39
DashSettings::~DashSettings()
 
40
{
 
41
  g_object_unref(_settings);
 
42
}
 
43
 
 
44
void
 
45
DashSettings::Refresh()
 
46
{
 
47
  _raw_from_factor = g_settings_get_enum(_settings, FORM_FACTOR);
 
48
 
 
49
  if (_raw_from_factor == 0) //Automatic
 
50
  {
 
51
    GdkScreen*   screen;
 
52
    gint         primary_monitor;
 
53
    GdkRectangle geo;
 
54
 
 
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);
 
58
 
 
59
    _form_factor = geo.height > 799 ? DESKTOP : NETBOOK;
 
60
  }
 
61
  else
 
62
  {
 
63
    _form_factor = (FormFactor)_raw_from_factor;
 
64
  }
 
65
 
 
66
  changed.emit();
 
67
}
 
68
 
 
69
void
 
70
DashSettings::Changed(GSettings* settings, char* key, DashSettings* self)
 
71
{
 
72
  self->Refresh();
 
73
}
 
74
 
 
75
DashSettings*
 
76
DashSettings::GetDefault()
 
77
{
 
78
  if (G_UNLIKELY(!_places_settings))
 
79
    _places_settings = new DashSettings();
 
80
 
 
81
  return _places_settings;
 
82
}
 
83
 
 
84
DashSettings::FormFactor
 
85
DashSettings::GetFormFactor()
 
86
{
 
87
  return _form_factor;
 
88
}
 
89
 
 
90
void
 
91
DashSettings::SetFormFactor(FormFactor factor)
 
92
{
 
93
  _form_factor = factor;
 
94
  g_settings_set_enum(_settings, FORM_FACTOR, factor);
 
95
}