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 #include <gui_utils/plugin_tree_view.h>
26 #include <gui_utils/service_selector_cbe.h>
27 
28 #include <string>
29 
30 using namespace fawkes;
31 
32 /** @class PluginGuiGtkWindow "plugin_gui.h"
33  * Graphical plugin management tool.
34  *
35  * @author Daniel Beck
36  * @author Tim Niemueller
37  */
38 
39 /** Constructor.
40  * @param cobject C base object
41  * @param builder Gtk Builder
42  */
44  const Glib::RefPtr<Gtk::Builder> builder)
45  : Gtk::Window(cobject)
46 {
47  builder->get_widget("stbStatus", m_stb_status);
48  builder->get_widget_derived("trvPlugins", m_trv_plugins);
49 
50 #ifdef HAVE_GCONFMM
51  m_trv_plugins->set_gconf_prefix(GCONF_PREFIX);
52 #endif
53 
54  m_service_selector = new ServiceSelectorCBE(builder, "cbeHosts", "btnConnect", "wndMain");
55  m_trv_plugins->set_network_client( m_service_selector->get_network_client() );
56 
57  m_service_selector->signal_connected().connect(sigc::mem_fun(*this, &PluginGuiGtkWindow::on_connect));
58  m_service_selector->signal_disconnected().connect(sigc::mem_fun(*this, &PluginGuiGtkWindow::on_disconnect));
59 
60  m_stb_status->push("Started");
61 }
62 
63 /** Destructor. */
65 {
66  m_stb_status->push("Exiting");
67 }
68 
69 /** Connected handler. */
70 void
71 PluginGuiGtkWindow::on_connect()
72 {
73  this->set_title(std::string("Fawkes Plugin Tool @ ") + m_service_selector->get_name());
74 }
75 
76 /** Disconnected handler. */
77 void
78 PluginGuiGtkWindow::on_disconnect()
79 {
80  this->set_title("Fawkes Plugin Tool");
81 }
sigc::signal< void > signal_disconnected()
This signal is emitted whenever a network connection is terminated.
Fawkes library namespace.
virtual ~PluginGuiGtkWindow()
Destructor.
Definition: plugin_gui.cpp:64
PluginGuiGtkWindow(BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > builder)
Constructor.
Definition: plugin_gui.cpp:43
Glib::ustring get_name()
Returns the currently selected service name (after connect)
void set_gconf_prefix(Glib::ustring gconf_prefix)
Set Gconf prefix.
FawkesNetworkClient * get_network_client()
Access the current network client.
sigc::signal< void > signal_connected()
This signal is emitted whenever a network connection is established.
void set_network_client(fawkes::FawkesNetworkClient *client)
Set the network client.
This widget consists of a Gtk::ComboBox and a Gtk::Button.