Fawkes API  Fawkes Development Version
plugin_gui.cpp
1 
2 /***************************************************************************
3  * plugin_gui.cpp - Plugin Tool Gui
4  *
5  * Created: Thu Nov 09 20:16:23 2007
6  * Copyright 2007 Daniel Beck
7  * 2008-2009 Tim Niemueller [www.niemueller.de]
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #include "plugin_gui.h"
25 
26 #include <gui_utils/plugin_tree_view.h>
27 #include <gui_utils/service_selector_cbe.h>
28 
29 #include <string>
30 
31 using namespace fawkes;
32 
33 /** @class PluginGuiGtkWindow "plugin_gui.h"
34  * Graphical plugin management tool.
35  *
36  * @author Daniel Beck
37  * @author Tim Niemueller
38  */
39 
40 /** Constructor.
41  * @param cobject C base object
42  * @param builder Gtk Builder
43  */
44 PluginGuiGtkWindow::PluginGuiGtkWindow(BaseObjectType * cobject,
45  const Glib::RefPtr<Gtk::Builder> builder)
46 : Gtk::Window(cobject)
47 {
48  builder->get_widget("stbStatus", m_stb_status);
49  builder->get_widget_derived("trvPlugins", m_trv_plugins);
50 
51 #ifdef HAVE_GCONFMM
52  m_trv_plugins->set_gconf_prefix(GCONF_PREFIX);
53 #endif
54 
55  m_service_selector = new ServiceSelectorCBE(builder, "cbeHosts", "btnConnect", "wndMain");
56  m_trv_plugins->set_network_client(m_service_selector->get_network_client());
57 
58  m_service_selector->signal_connected().connect(
59  sigc::mem_fun(*this, &PluginGuiGtkWindow::on_connect));
60  m_service_selector->signal_disconnected().connect(
61  sigc::mem_fun(*this, &PluginGuiGtkWindow::on_disconnect));
62 
63  m_stb_status->push("Started");
64 }
65 
66 /** Destructor. */
68 {
69  m_stb_status->push("Exiting");
70 }
71 
72 /** Connected handler. */
73 void
74 PluginGuiGtkWindow::on_connect()
75 {
76  this->set_title(std::string("Fawkes Plugin Tool @ ") + m_service_selector->get_name());
77 }
78 
79 /** Disconnected handler. */
80 void
81 PluginGuiGtkWindow::on_disconnect()
82 {
83  this->set_title("Fawkes Plugin Tool");
84 }
fawkes::PluginTreeView::set_network_client
void set_network_client(fawkes::FawkesNetworkClient *client)
Set the network client.
Definition: plugin_tree_view.cpp:128
fawkes::ServiceSelectorCBE::signal_disconnected
sigc::signal< void > signal_disconnected()
This signal is emitted whenever a network connection is terminated.
Definition: service_selector_cbe.cpp:248
fawkes::PluginTreeView::set_gconf_prefix
void set_gconf_prefix(Glib::ustring gconf_prefix)
Set Gconf prefix.
Definition: plugin_tree_view.cpp:137
PluginGuiGtkWindow::~PluginGuiGtkWindow
virtual ~PluginGuiGtkWindow()
Destructor.
Definition: plugin_gui.cpp:67
fawkes::ServiceSelectorCBE::get_name
Glib::ustring get_name()
Returns the currently selected service name (after connect)
Definition: service_selector_cbe.cpp:220
fawkes
fawkes::ServiceSelectorCBE
Definition: service_selector_cbe.h:48
fawkes::ServiceSelectorCBE::get_network_client
FawkesNetworkClient * get_network_client()
Access the current network client.
Definition: service_selector_cbe.cpp:200
fawkes::ServiceSelectorCBE::signal_connected
sigc::signal< void > signal_connected()
This signal is emitted whenever a network connection is established.
Definition: service_selector_cbe.cpp:239
PluginGuiGtkWindow::PluginGuiGtkWindow
PluginGuiGtkWindow(BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > builder)
Constructor.
Definition: plugin_gui.cpp:44