Fawkes API  Fawkes Development Version
plugin_tree_view.h
00001 
00002 /***************************************************************************
00003  *  plugin_tree_view.h - Displays a list of Fawkes plugins and allows to
00004  *                       start/stop them
00005  *
00006  *  Created: Fri Sep 26 21:06:37 2008
00007  *  Copyright  2008  Daniel Beck
00008  *             2008  Tim Niemueller [www.niemueller.de]
00009  *
00010  ****************************************************************************/
00011 
00012 /*  This program is free software; you can redistribute it and/or modify
00013  *  it under the terms of the GNU General Public License as published by
00014  *  the Free Software Foundation; either version 2 of the License, or
00015  *  (at your option) any later version.
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL file in the doc directory.
00023  */
00024 
00025 #ifndef __GUI_UTILS_PLUGIN_TREE_VIEW_H_
00026 #define __GUI_UTILS_PLUGIN_TREE_VIEW_H_
00027 
00028 #include <netcomm/fawkes/client_handler.h>
00029 #include <core/utils/lock_queue.h>
00030 #include <gui_utils/connection_dispatcher.h>
00031 
00032 #include <gtkmm.h>
00033 #ifdef HAVE_GCONFMM
00034 #  include <gconfmm.h>
00035 #endif
00036 
00037 namespace fawkes {
00038 #if 0 /* just to make Emacs auto-indent happy */
00039 }
00040 #endif
00041 
00042 class FawkesNetworkClient;
00043 class FawkesNetworkMessage;
00044 
00045 class PluginTreeView
00046 : public Gtk::TreeView
00047 {
00048  public:
00049   PluginTreeView();
00050   PluginTreeView(BaseObjectType* cobject,
00051                  const Glib::RefPtr<Gtk::Builder> builder);
00052   virtual ~PluginTreeView();
00053 
00054   void set_network_client(fawkes::FawkesNetworkClient* client);
00055   void set_gconf_prefix(Glib::ustring gconf_prefix);
00056 
00057  private:
00058   class PluginRecord : public Gtk::TreeModelColumnRecord
00059   {
00060    public:
00061     PluginRecord()
00062       {
00063         add(index);
00064         add(name);
00065         add(description);
00066         add(loaded);
00067       }
00068 
00069     Gtk::TreeModelColumn<int> index;           /**< an index */
00070     Gtk::TreeModelColumn<Glib::ustring> name;  /**< the name of the plugin */
00071     Gtk::TreeModelColumn<Glib::ustring> description;  /**< description of the plugin */
00072     Gtk::TreeModelColumn<bool> loaded;         /**< the loaded status of the plugin */
00073   };
00074 
00075   void ctor();
00076   void on_status_toggled(const Glib::ustring& path);
00077   void on_connected();
00078   void on_disconnected();
00079   void on_message_received(fawkes::FawkesNetworkMessage *msg);
00080   void on_id_clicked();
00081   void on_status_clicked();
00082   void on_name_clicked();
00083   void on_config_changed();
00084 
00085   void append_plugin_column();
00086 
00087  private:
00088   Glib::RefPtr<Gtk::ListStore> m_plugin_list;
00089 #ifdef HAVE_GCONFMM
00090   Glib::RefPtr<Gnome::Conf::Client> __gconf;
00091 #endif
00092   PluginRecord m_plugin_record;
00093 
00094   sigc::connection __gconf_connection;
00095   Glib::ustring    __gconf_prefix;
00096 
00097   fawkes::ConnectionDispatcher m_dispatcher;
00098 };
00099 
00100 } // end namespace fawkes
00101 
00102 #endif /*  __GUI_UTILS_PLUGIN_TREE_VIEW_H_ */