fawkes::ServiceChooserDialog Class Reference

Service chooser dialog. More...

#include <gui_utils/service_chooser_dialog.h>

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

Definition at line 43 of file service_chooser_dialog.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
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.

Parameters:
parent parent window
title title of the dialog
service service 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:
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().

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


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:32:50 2011 for Fawkes API by  doxygen 1.4.7