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
31using 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 */
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. */
73void
74PluginGuiGtkWindow::on_connect()
75{
76 this->set_title(std::string("Fawkes Plugin Tool @ ") + m_service_selector->get_name());
77}
78
79/** Disconnected handler. */
80void
81PluginGuiGtkWindow::on_disconnect()
82{
83 this->set_title("Fawkes Plugin Tool");
84}
PluginGuiGtkWindow(BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > builder)
Constructor.
Definition: plugin_gui.cpp:44
virtual ~PluginGuiGtkWindow()
Destructor.
Definition: plugin_gui.cpp:67
void set_network_client(fawkes::FawkesNetworkClient *client)
Set the network client.
void set_gconf_prefix(Glib::ustring gconf_prefix)
Set Gconf prefix.
This widget consists of a Gtk::ComboBox and a Gtk::Button.
Glib::ustring get_name()
Returns the currently selected service name (after connect)
sigc::signal< void > signal_connected()
This signal is emitted whenever a network connection is established.
FawkesNetworkClient * get_network_client()
Access the current network client.
sigc::signal< void > signal_disconnected()
This signal is emitted whenever a network connection is terminated.
Fawkes library namespace.