Back to index

unity  6.0.0
FavoriteStoreGSettings.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003 * Copyright (C) 2010 Canonical Ltd
00004 *
00005 * This program is free software: you can redistribute it and/or modify
00006 * it under the terms of the GNU General Public License version 3 as
00007 * published by the Free Software Foundation.
00008 *
00009 * This program is distributed in the hope that it will be useful,
00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 * GNU General Public License for more details.
00013 *
00014 * You should have received a copy of the GNU General Public License
00015 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 *
00017 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
00018 */
00019 
00020 #ifndef FAVORITE_STORE_GSETTINGS_H
00021 #define FAVORITE_STORE_GSETTINGS_H
00022 
00023 #include <gio/gio.h>
00024 
00025 #include "FavoriteStore.h"
00026 #include <UnityCore/GLibWrapper.h>
00027 
00028 // An abstract object that facilitates getting and modifying the list of favorites
00029 // Use GetDefault () to get the correct store for the session
00030 namespace unity
00031 {
00032 namespace internal
00033 {
00034 
00035 class FavoriteStoreGSettings : public FavoriteStore
00036 {
00037 public:
00038   FavoriteStoreGSettings();
00039   FavoriteStoreGSettings(GSettingsBackend* backend);
00040 
00041   virtual FavoriteList const& GetFavorites();
00042   virtual void AddFavorite(std::string const& desktop_path, int position);
00043   virtual void RemoveFavorite(std::string const& desktop_path);
00044   virtual void MoveFavorite(std::string const& desktop_path, int position);
00045   void SaveFavorites(FavoriteList const& favorites, bool ignore = true);
00046   virtual void SetFavorites(FavoriteList const& desktop_paths);
00047 
00048   //Methods
00049   void Changed(std::string const& key);
00050 
00051 private:
00052   void Init();
00053   void Refresh();
00054   void FillList(FavoriteList& list);
00055 
00056   FavoriteList favorites_;
00057   glib::Object<GSettings> settings_;
00058   bool ignore_signals_;
00059 };
00060 
00061 }
00062 }
00063 
00064 #endif // FAVORITE_STORE_GSETTINGS_H