Freya  0.0.1
A Gtk3 MPD Client
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
src/GManager/BrowserList.hh
Go to the documentation of this file.
00001 /***********************************************************
00002 * This file is part of Freya
00003 * - A free MPD Gtk3 MPD Client -
00004 *
00005 * Authors: Christopher Pahl, Christoph Piechula,
00006 *          Eduard Schneider
00007 *
00008 * Copyright (C) [2011-2012]
00009 * Hosted at: https://github.com/studentkittens/Freya
00010 *
00011 *              __..--''``---....___   _..._    __
00012 *    /// //_.-'    .-/";  `        ``<._  ``.''_ `. / // /
00013 *   ///_.-' _..--.'_                        `( ) ) // //
00014 *   / (_..-' // (< _     ;_..__               ; `' / ///
00015 *    / // // //  `-._,_)' // / ``--...____..-' /// / //
00016 *  Ascii-Art by Felix Lee <flee@cse.psu.edu>
00017 *
00018 * Freya is free software: you can redistribute it and/or modify
00019 * it under the terms of the GNU General Public License as published by
00020 * the Free Software Foundation, either version 3 of the License, or
00021 * (at your option) any later version.
00022 *
00023 * Freya is distributed in the hope that it will be useful,
00024 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00025 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00026 * GNU General Public License for more details.
00027 *
00028 * You should have received a copy of the GNU General Public License
00029 * along with Freya. If not, see <http://www.gnu.org/licenses/>.
00030 **************************************************************/
00031 #ifndef FREYA_BROWSERLIST_GUARD
00032 #define FREYA_BROWSERLIST_GUARD
00033 
00034 #include "../ui_includes.hh"
00035 #include "../MPD/AbstractClientUser.hh"
00036 
00037 class AbstractBrowser;
00038 
00039 namespace GManager
00040 {
00048     class BrowserList : public MPD::AbstractClientUser
00049     {
00050     public:
00051 
00052         BrowserList(MPD::Client& client, const Glib::RefPtr<Gtk::Builder>& builder);
00053 
00059         void add(AbstractBrowser& browser);
00060 
00068         void set(AbstractBrowser& browser);
00069 
00070     private:
00071 
00072         void change_browser(AbstractBrowser * browser);
00073         void on_selection_changed();
00074         void on_client_update(enum mpd_idle type, MPD::NotifyData& data);
00075         void on_connection_change(bool server_changed, bool is_connected);
00076 
00077         /* Tree model columns: */
00078         class ModelColumns : public Gtk::TreeModel::ColumnRecord
00079         {
00080         public:
00081             ModelColumns()
00082             {
00083                 add(m_col_name);
00084                 add(m_col_icon);
00085                 add(m_col_browser);
00086             }
00087             Gtk::TreeModelColumn<Glib::ustring> m_col_name;
00088             Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>> m_col_icon;
00089             Gtk::TreeModelColumn<AbstractBrowser*> m_col_browser;
00090         };
00091 
00092         /* View */
00093         Gtk::TreeView * mp_PluginListview;
00094 
00095         /* Actual model */
00096         Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
00097 
00098         /* Model layout */
00099         ModelColumns m_Columns;
00100 
00101         /* Selected data of model */
00102         Glib::RefPtr<Gtk::TreeSelection> m_TreeSelection;
00103 
00104         /* Browserlist widget, where all browser stuff is happening in */
00105         Gtk::Box * mp_List;
00106 
00107         /* fortune label on startup */
00108         Gtk::Label m_NoBrowsers;
00109 
00110         /* Actively shown browser */
00111         AbstractBrowser * mp_Active;
00112 
00113     };
00114 }
00115 
00116 #endif