Fawkes API
Fawkes Development Version
|
Service chooser dialog. More...
#include <>>
Public Member Functions | |
ServiceChooserDialog (Gtk::Window &parent, FawkesNetworkClient *client, Glib::ustring title="Select Service", const char *service="_fawkes._tcp") | |
Constructor. More... | |
ServiceChooserDialog (Gtk::Window &parent, Glib::ustring title="Select Service", const char *service="_fawkes._tcp") | |
Constructor. More... | |
virtual | ~ServiceChooserDialog () |
Destructor. More... | |
void | get_selected_service (Glib::ustring &name, Glib::ustring &hostname, unsigned short int &port) |
Get selected service. More... | |
void | get_selected_service (Glib::ustring &hostname, struct sockaddr_storage &sockaddr) |
Get selected service. More... | |
void | get_raw_address (struct sockaddr *addr, socklen_t addr_size) |
Get raw address. More... | |
void | run_and_connect () |
Run dialog and try to connect. More... | |
Protected Member Functions | |
virtual void | on_expander_changed () |
Signal handler for expander event. More... | |
Service chooser dialog.
Allows to choose a service discovered via Avahi. Use the run routine, it returns 1 if a service was selected or 0 if no service was found or the selection was cancelled. The dialog is always modal.
Definition at line 46 of file service_chooser_dialog.h.
fawkes::ServiceChooserDialog::ServiceChooserDialog | ( | Gtk::Window & | parent, |
FawkesNetworkClient * | client, | ||
Glib::ustring | title = "Select Service" , |
||
const char * | service = "_fawkes._tcp" |
||
) |
Constructor.
parent | parent window |
client | Fawkes network client to connect on run() |
title | title of the dialog |
service | service string |
Definition at line 80 of file service_chooser_dialog.cpp.
fawkes::ServiceChooserDialog::ServiceChooserDialog | ( | Gtk::Window & | parent, |
Glib::ustring | title = "Select Service" , |
||
const char * | service = "_fawkes._tcp" |
||
) |
Constructor.
parent | parent window |
title | title of the dialog |
service | service string |
Definition at line 62 of file service_chooser_dialog.cpp.
|
virtual |
Destructor.
Definition at line 94 of file service_chooser_dialog.cpp.
References fawkes::ServiceModel::ServiceRecord::addrport, fawkes::ServiceModel::get_column_record(), fawkes::ServiceModel::get_list_store(), fawkes::ServiceModel::ServiceRecord::name, and on_expander_changed().
void fawkes::ServiceChooserDialog::get_raw_address | ( | struct sockaddr * | addr, |
socklen_t | addr_size | ||
) |
Get raw address.
addr | upon returns contains the raw representation of the IP address |
addr_size | size in bytes of addr, if addr_size is too small for an AF_INET addr an exception is thrown. |
Definition at line 236 of file service_chooser_dialog.cpp.
Referenced by NetLogGuiGtkWindow::~NetLogGuiGtkWindow().
void fawkes::ServiceChooserDialog::get_selected_service | ( | Glib::ustring & | name, |
Glib::ustring & | hostname, | ||
unsigned short int & | port | ||
) |
Get selected service.
If a service has been selected use this method to get the IP Address as string of the host that has the service and the port.
name | name of the service |
hostname | hostname of the host associated with the service |
port | upon successful return contains the port |
Exception | thrown if no service has been selected |
Definition at line 173 of file service_chooser_dialog.cpp.
References fawkes::ServiceModel::get_column_record(), fawkes::ServiceModel::ServiceRecord::ipaddr, fawkes::ServiceModel::ServiceRecord::name, fawkes::ArgumentParser::parse_hostport_s(), and fawkes::ServiceModel::ServiceRecord::port.
Referenced by run_and_connect(), and NetLogGuiGtkWindow::~NetLogGuiGtkWindow().
void fawkes::ServiceChooserDialog::get_selected_service | ( | Glib::ustring & | hostname, |
struct sockaddr_storage & | sockaddr | ||
) |
Get selected service.
If a service has been selected use this method to get the IP Address as string of the host that has the service and the port. May not be called for manual entry since this would require hostname resolution within the dialog. That should be handled on the caller's side.
hostname | hostname of the host associated with the service |
sockaddr | upon successful return contains the sockaddr structure of the specific endpoint |
Exception | thrown if no service has been selected |
Definition at line 210 of file service_chooser_dialog.cpp.
References fawkes::ServiceModel::get_column_record(), fawkes::ServiceModel::ServiceRecord::ipaddr, and fawkes::ServiceModel::ServiceRecord::sockaddr.
|
protectedvirtual |
Signal handler for expander event.
Called when expander is (de-)expanded. Only works with Glibmm properties enabled, i.e. not on Maemo.
Definition at line 267 of file service_chooser_dialog.cpp.
Referenced by ~ServiceChooserDialog().
void fawkes::ServiceChooserDialog::run_and_connect | ( | ) |
Run dialog and try to connect.
This runs the service chooser dialog and connects to the given service with the attached FawkesNetworkClient. If the connection couldn't be established an error dialog is shown. You should not rely on the connection to be active after calling this method, rather you should use a ConnectionDispatcher to get the "connected" signal.
Definition at line 285 of file service_chooser_dialog.cpp.
References fawkes::Exception::begin(), fawkes::FawkesNetworkClient::connect(), fawkes::FawkesNetworkClient::connected(), and get_selected_service().
Referenced by LaserGuiGtkWindow::on_connection_clicked(), LaserGuiHildonWindow::on_connection_clicked(), Bumblebee2CalibGtkWindow::~Bumblebee2CalibGtkWindow(), EclipseDebugger::~EclipseDebugger(), NaoGuiGtkWindow::~NaoGuiGtkWindow(), and SkillGuiGtkWindow::~SkillGuiGtkWindow().