Fawkes API  Fawkes Development Version
plugin_tree_view.h
1 
2 /***************************************************************************
3  * plugin_tree_view.h - Displays a list of Fawkes plugins and allows to
4  * start/stop them
5  *
6  * Created: Fri Sep 26 21:06:37 2008
7  * Copyright 2008 Daniel Beck
8  * 2008 Tim Niemueller [www.niemueller.de]
9  *
10  ****************************************************************************/
11 
12 /* This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL file in the doc directory.
23  */
24 
25 #ifndef __GUI_UTILS_PLUGIN_TREE_VIEW_H_
26 #define __GUI_UTILS_PLUGIN_TREE_VIEW_H_
27 
28 #include <netcomm/fawkes/client_handler.h>
29 #include <core/utils/lock_queue.h>
30 #include <gui_utils/connection_dispatcher.h>
31 
32 #include <gtkmm.h>
33 #ifdef HAVE_GCONFMM
34 # include <gconfmm.h>
35 #endif
36 
37 namespace fawkes {
38 #if 0 /* just to make Emacs auto-indent happy */
39 }
40 #endif
41 
42 class FawkesNetworkClient;
43 class FawkesNetworkMessage;
44 
46 : public Gtk::TreeView
47 {
48  public:
50  PluginTreeView(BaseObjectType* cobject,
51  const Glib::RefPtr<Gtk::Builder> builder);
52  virtual ~PluginTreeView();
53 
55  void set_gconf_prefix(Glib::ustring gconf_prefix);
56 
57  private:
58  class PluginRecord : public Gtk::TreeModelColumnRecord
59  {
60  public:
61  PluginRecord()
62  {
63  add(index);
64  add(name);
65  add(description);
66  add(loaded);
67  }
68 
69  Gtk::TreeModelColumn<int> index; /**< an index */
70  Gtk::TreeModelColumn<Glib::ustring> name; /**< the name of the plugin */
71  Gtk::TreeModelColumn<Glib::ustring> description; /**< description of the plugin */
72  Gtk::TreeModelColumn<bool> loaded; /**< the loaded status of the plugin */
73  };
74 
75  void ctor();
76  void on_status_toggled(const Glib::ustring& path);
77  void on_connected();
78  void on_disconnected();
79  void on_message_received(fawkes::FawkesNetworkMessage *msg);
80  void on_id_clicked();
81  void on_status_clicked();
82  void on_name_clicked();
83  void on_config_changed();
84 
85  void append_plugin_column();
86 
87  private:
88  Glib::RefPtr<Gtk::ListStore> m_plugin_list;
89 #ifdef HAVE_GCONFMM
90  Glib::RefPtr<Gnome::Conf::Client> __gconf;
91 #endif
92  PluginRecord m_plugin_record;
93 
94  sigc::connection __gconf_connection;
95  Glib::ustring __gconf_prefix;
96 
97  fawkes::ConnectionDispatcher m_dispatcher;
98 };
99 
100 } // end namespace fawkes
101 
102 #endif /* __GUI_UTILS_PLUGIN_TREE_VIEW_H_ */
A TreeView class to list available plugins und trigger their loading/unloading.
Simple Fawkes network client.
Definition: client.h:52
Fawkes library namespace.
Representation of a message that is sent over the network.
Definition: message.h:75
PluginTreeView()
Constructor.
void set_gconf_prefix(Glib::ustring gconf_prefix)
Set Gconf prefix.
void set_network_client(fawkes::FawkesNetworkClient *client)
Set the network client.
virtual ~PluginTreeView()
Destructor.
Watches network client events and dispatches them as signals.