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. | |
ServiceChooserDialog (Gtk::Window &parent, Glib::ustring title="Select Service", const char *service="_fawkes._tcp") | |
Constructor. | |
virtual | ~ServiceChooserDialog () |
Destructor. | |
void | get_selected_service (Glib::ustring &name, Glib::ustring &hostname, Glib::ustring &ipaddr, unsigned short int &port) |
Get selected service. | |
void | get_raw_address (struct sockaddr *addr, socklen_t addr_size) |
Get raw address. | |
void | run_and_connect () |
Run dialog and try to connect. |
Protected Member Functions | |
virtual void | on_expander_changed () |
Signal handler for expander event. |
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 43 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 74 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 56 of file service_chooser_dialog.cpp.
|
virtual |
Destructor.
Definition at line 88 of file service_chooser_dialog.cpp.
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 197 of file service_chooser_dialog.cpp.
References get_selected_service(), and fawkes::NetworkNameResolver::resolve_name_blocking().
void fawkes::ServiceChooserDialog::get_selected_service | ( | Glib::ustring & | name, |
Glib::ustring & | hostname, | ||
Glib::ustring & | ipaddr, | ||
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 |
ipaddr | upon successful return contains the IP address as string |
port | upon successful return contains the port |
Exception | thrown if no service has been selected |
Definition at line 142 of file service_chooser_dialog.cpp.
References fawkes::ServiceModel::get_column_record(), fawkes::ServiceModel::ServiceRecord::hostname, fawkes::ServiceModel::ServiceRecord::ipaddr, fawkes::ServiceModel::ServiceRecord::name, and fawkes::ServiceModel::ServiceRecord::port.
Referenced by get_raw_address(), and run_and_connect().
|
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 227 of file service_chooser_dialog.cpp.
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 245 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(), and LaserGuiHildonWindow::on_connection_clicked().