25 #include <gui_utils/service_selector_cbe.h>
26 #include <gui_utils/service_model.h>
27 #include <gui_utils/connection_dispatcher.h>
28 #include <netcomm/fawkes/client.h>
32 using namespace fawkes;
73 #if GTK_VERSION_GE(3,0)
84 m_cbe_services = services;
85 m_btn_connect = connect;
86 m_tbtn_connect = NULL;
98 #if GTK_VERSION_GE(3,0)
103 Gtk::ToolButton* connect,
105 const char* service )
109 m_cbe_services = services;
110 m_btn_connect = NULL;
111 m_tbtn_connect = connect;
125 const char* cbe_name,
126 const char* btn_name,
127 const char* wnd_name,
128 const char* service )
132 builder->get_widget(wnd_name,
m_parent);
143 #if GTK_VERSION_GE(3,0)
145 throw Exception(
"Service combo box does not have an entry, fix UI file?");
149 #if GTK_VERSION_GE(3,0)
157 Gtk::Entry *ent =
static_cast<Gtk::Entry *
>(
m_cbe_services->get_child());
160 char * fawkes_ip = getenv(
"FAWKES_IP");
161 if (fawkes_ip) ent->set_text(fawkes_ip);
162 else ent->set_text(
"localhost");
220 return __servicename;
272 __hostname = entry->get_text();
274 Glib::ustring::size_type pos;
275 if ((pos = __hostname.find(
':')) != Glib::ustring::npos)
277 Glib::ustring host =
"";
278 unsigned int port = 1234567;
279 std::istringstream is(__hostname.replace(pos, 1,
" "));
283 if (port != 1234567 && host.size())
290 __servicename = __hostname;
302 client->
connect( __hostname.c_str(), __port );
306 Glib::ustring message = *(e.
begin());
307 Gtk::MessageDialog md(*
m_parent, message,
false,
308 Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
310 md.set_title(
"Connection failed");
339 client->
connect( __hostname.c_str(), __port );
343 Glib::ustring message = *(e.
begin());
344 Gtk::MessageDialog md(*
m_parent, message,
false,
345 Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
347 md.set_title(
"Connection failed");
359 {
m_tbtn_connect->set_stock_id( Gtk::StockID(
"gtk-disconnect") ); }