Back to index

unity  6.0.0
LauncherEntryRemote.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2011 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: Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
00018  */
00019 
00020 #ifndef LAUNCHER_ENTRY_REMOTE_H
00021 #define LAUNCHER_ENTRY_REMOTE_H
00022 
00023 #include <glib.h>
00024 #include <memory>
00025 #include <sigc++/sigc++.h>
00026 #include <libdbusmenu-glib/client.h>
00027 #include <libdbusmenu-glib/menuitem.h>
00028 #include <UnityCore/GLibWrapper.h>
00029 
00030  #include "unity-shared/Introspectable.h"
00031 
00032 namespace unity
00033 {
00034 
00042 class LauncherEntryRemote : public sigc::trackable, public unity::debug::Introspectable
00043 {
00044 public:
00045   typedef std::shared_ptr<LauncherEntryRemote> Ptr;
00046 
00047   LauncherEntryRemote(std::string const& dbus_name, GVariant* val);
00048 
00049   std::string const& AppUri() const;
00050   std::string const& DBusName() const;
00051   std::string const& Emblem() const;
00052   long long Count() const;
00053   double Progress() const;
00054   glib::Object<DbusmenuClient> const& Quicklist() const;
00055 
00056   bool EmblemVisible() const;
00057   bool CountVisible() const;
00058   bool ProgressVisible() const;
00059   bool Urgent() const;
00060 
00062   void Update(LauncherEntryRemote::Ptr const& other);
00064   void Update(GVariantIter* prop_iter);
00066   void SetDBusName(std::string const& dbus_name);
00067 
00068   // from Introspectable:
00069   std::string GetName() const;
00070   void AddProperties(GVariantBuilder* builder);
00071 
00072   sigc::signal<void, LauncherEntryRemote*, std::string> dbus_name_changed;   // gives the old name as arg
00073   sigc::signal<void, LauncherEntryRemote*> emblem_changed;
00074   sigc::signal<void, LauncherEntryRemote*> count_changed;
00075   sigc::signal<void, LauncherEntryRemote*> progress_changed;
00076   sigc::signal<void, LauncherEntryRemote*> quicklist_changed;
00077 
00078   sigc::signal<void, LauncherEntryRemote*> emblem_visible_changed;
00079   sigc::signal<void, LauncherEntryRemote*> count_visible_changed;
00080   sigc::signal<void, LauncherEntryRemote*> progress_visible_changed;
00081   sigc::signal<void, LauncherEntryRemote*> urgent_changed;
00082 
00083 private:
00084   std::string _dbus_name;
00085 
00086   std::string _app_uri;
00087   std::string _emblem;
00088   long long _count;
00089   double _progress;
00090 
00091   std::string _quicklist_dbus_path;
00092   glib::Object<DbusmenuClient> _quicklist;
00093 
00094   bool _emblem_visible;
00095   bool _count_visible;
00096   bool _progress_visible;
00097   bool _urgent;
00098 
00099   void SetEmblem(std::string const& emblem);
00100   void SetCount(long long count);
00101   void SetProgress(double progress);
00102   void SetQuicklistPath(std::string const& dbus_path);
00103   void SetQuicklist(DbusmenuClient* quicklist);
00104   void SetEmblemVisible(bool visible);
00105   void SetCountVisible(bool visible);
00106   void SetProgressVisible(bool visible);
00107   void SetUrgent(bool urgent);
00108 };
00109 
00110 } // namespace
00111 #endif // LAUNCHER_ENTRY_REMOTE_H