Fawkes API  Fawkes Development Version
fawkes::ServiceChooserDialog Class Reference

Service chooser dialog. More...

#include <>>

List of all members.

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.

Detailed Description

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.

Author:
Tim Niemueller

Constructor & Destructor Documentation

fawkes::ServiceChooserDialog::ServiceChooserDialog ( Gtk::Window &  parent,
FawkesNetworkClient client,
Glib::ustring  title = "Select Service",
const char *  service = "_fawkes._tcp" 
)

Constructor.

Parameters:
parentparent window
clientFawkes network client to connect on run()
titletitle of the dialog
serviceservice 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.

Parameters:
parentparent window
titletitle of the dialog
serviceservice string

Definition at line 56 of file service_chooser_dialog.cpp.

fawkes::ServiceChooserDialog::~ServiceChooserDialog ( ) [virtual]

Destructor.

Definition at line 88 of file service_chooser_dialog.cpp.


Member Function Documentation

void fawkes::ServiceChooserDialog::get_raw_address ( struct sockaddr *  addr,
socklen_t  addr_size 
)

Get raw address.

Parameters:
addrupon returns contains the raw representation of the IP address
addr_sizesize 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.

Parameters:
namename of the service
hostnamehostname of the host associated with the service
ipaddrupon successful return contains the IP address as string
portupon successful return contains the port
Exceptions:
Exceptionthrown if no service has been selected

Definition at line 142 of file service_chooser_dialog.cpp.

References fawkes::ServiceModel::get_column_record().

Referenced by get_raw_address(), and run_and_connect().

void fawkes::ServiceChooserDialog::on_expander_changed ( ) [protected, virtual]

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::FawkesNetworkClient::connected(), get_selected_service(), fawkes::FawkesNetworkClient::connect(), and fawkes::Exception::begin().

Referenced by LaserGuiGtkWindow::on_connection_clicked(), and LaserGuiHildonWindow::on_connection_clicked().


The documentation for this class was generated from the following files: