~unity-team/unity/trunk

« back to all changes in this revision

Viewing changes to launcher/DevicesSettings.h

  • Committer: Tarmac
  • Author(s): Andrea Azzarone
  • Date: 2012-08-30 18:02:07 UTC
  • mfrom: (2540.12.27 dclt2)
  • Revision ID: tarmac-20120830180207-h3y5jfjl3zen4wwy
Refactor device launcher icons.. Fixes: https://bugs.launchpad.net/bugs/713423. Approved by Marco Trevisan (Treviño).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2
2
/*
3
 
 * Copyright (C) 2010 Canonical Ltd
 
3
 * Copyright (C) 2010-12 Canonical Ltd
4
4
 *
5
5
 * This program is free software: you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License version 3 as
14
14
 * You should have received a copy of the GNU General Public License
15
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
16
 *
17
 
 * Authored by: Andrea Azzarone <aazzarone@hotmail.it>
 
17
 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
18
18
 */
19
19
 
20
 
#ifndef DEVICES_SETTINGS_H
21
 
#define DEVICES_SETTINGS_H
 
20
#ifndef UNITYSHELL_DEVICES_SETTINGS_H
 
21
#define UNITYSHELL_DEVICES_SETTINGS_H
22
22
 
23
 
#include <list>
 
23
#include <boost/noncopyable.hpp>
 
24
#include <memory>
24
25
#include <string>
25
26
 
26
 
#include <gio/gio.h>
27
 
#include <boost/utility.hpp>
28
 
#include <sigc++/sigc++.h>
29
 
#include <UnityCore/GLibWrapper.h>
30
 
 
31
 
namespace unity {
32
 
 
33
 
typedef std::list<std::string> DeviceList;
34
 
 
35
 
class DevicesSettings : boost::noncopyable
 
27
#include <sigc++/signal.h>
 
28
#include <sigc++/trackable.h>
 
29
 
 
30
namespace unity
 
31
{
 
32
namespace launcher
 
33
{
 
34
 
 
35
class DevicesSettings : boost::noncopyable, public sigc::trackable
36
36
{
37
37
public:
38
 
  typedef enum
39
 
  {
40
 
    NEVER = 0,
41
 
    ONLY_MOUNTED,
42
 
    ALWAYS
43
 
 
44
 
  } DevicesOption;
45
 
 
46
 
  DevicesSettings();
47
 
  
48
 
  static DevicesSettings& GetDefault();
49
 
 
50
 
  void SetDevicesOption(DevicesOption devices_option);
51
 
  DevicesOption GetDevicesOption() { return devices_option_; };
52
 
 
53
 
  DeviceList const& GetFavorites() { return favorites_; };
54
 
  void AddFavorite(std::string const& uuid);
55
 
  void RemoveFavorite(std::string const& uuid);
56
 
 
57
 
  void Changed(std::string const& key);
58
 
  
59
 
  // Signals
 
38
  typedef std::shared_ptr<DevicesSettings> Ptr;
 
39
 
 
40
  virtual ~DevicesSettings() {};
 
41
 
 
42
  virtual bool IsABlacklistedDevice(std::string const& uuid) const = 0;
 
43
  virtual void TryToBlacklist(std::string const& uuid) = 0;
 
44
  virtual void TryToUnblacklist(std::string const& uuid) = 0;
 
45
 
60
46
  sigc::signal<void> changed;
61
 
  
62
 
private:
63
 
  void Refresh();
64
 
  void SaveFavorites(DeviceList const& favorites);
65
 
 
66
 
  glib::Object<GSettings> settings_;
67
 
  DeviceList favorites_;
68
 
  bool ignore_signals_;
69
 
  DevicesOption devices_option_;
70
47
};
71
48
 
72
 
} // namespace unity
 
49
}
 
50
}
73
51
 
74
 
#endif // DEVICES_SETTINGS_H
 
52
#endif