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 #include <libglademm/xml.h>
00034 #ifdef HAVE_GCONFMM
00035 #  include <gconfmm.h>
00036 #endif
00037 
00038 namespace fawkes {
00039 #if 0 /* just to make Emacs auto-indent happy */
00040 }
00041 #endif
00042 
00043 class FawkesNetworkClient;
00044 class FawkesNetworkMessage;
00045
00046 class PluginTreeView
00047 : public Gtk::TreeView
00048 {
00049  public:
00050   PluginTreeView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> ref_xml);
00051   virtual ~PluginTreeView();
00052
00053   void set_network_client(fawkes::FawkesNetworkClient* client);
00054   void set_gconf_prefix(Glib::ustring gconf_prefix);
00055
00056  private:
00057   class PluginRecord : public Gtk::TreeModelColumnRecord
00058   {
00059    public:
00060     PluginRecord()
00061       {
00062         add(index);
00063         add(name);
00064         add(description);
00065         add(loaded);
00066       }
00067
00068     Gtk::TreeModelColumn<int> index;           /**< an index */
00069     Gtk::TreeModelColumn<Glib::ustring> name;  /**< the name of the plugin */
00070     Gtk::TreeModelColumn<Glib::ustring> description;  /**< description of the plugin */
00071     Gtk::TreeModelColumn<bool> loaded;         /**< the loaded status of the plugin */
00072   };
00073
00074   void on_status_toggled(const Glib::ustring& path);
00075   void on_connected();
00076   void on_disconnected();
00077   void on_message_received(fawkes::FawkesNetworkMessage *msg);
00078   void on_id_clicked();
00079   void on_status_clicked();
00080   void on_name_clicked();
00081   void on_config_changed();
00082
00083   void append_plugin_column();
00084
00085  private:
00086   Glib::RefPtr<Gtk::ListStore> m_plugin_list;
00087 #ifdef HAVE_GCONFMM
00088   Glib::RefPtr<Gnome::Conf::Client> __gconf;
00089 #endif
00090   PluginRecord m_plugin_record;
00091
00092   sigc::connection __gconf_connection;
00093   Glib::ustring    __gconf_prefix;
00094
00095   fawkes::ConnectionDispatcher m_dispatcher;
00096 };
00097
00098 } // end namespace fawkes
00099
00100 #endif /*  __GUI_UTILS_PLUGIN_TREE_VIEW_H_ */