00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __LIBS_GUI_UTILS_SERVICE_CHOOSER_DIALOG_H_
00025 #define __LIBS_GUI_UTILS_SERVICE_CHOOSER_DIALOG_H_
00026
00027 #include <gui_utils/service_model.h>
00028
00029 #include <gtkmm/dialog.h>
00030 #include <gtkmm/treeview.h>
00031 #include <gtkmm/entry.h>
00032 #include <gtkmm/expander.h>
00033 #include <gtkmm/scrolledwindow.h>
00034
00035 #include <sys/types.h>
00036 #include <sys/socket.h>
00037
00038 namespace fawkes {
00039
00040 class FawkesNetworkClient;
00041 class ServiceModel;
00042
00043 class ServiceChooserDialog
00044 : public Gtk::Dialog
00045 {
00046 public:
00047 ServiceChooserDialog(Gtk::Window &parent,
00048 FawkesNetworkClient *client,
00049 Glib::ustring title = "Select Service",
00050 const char *service = "_fawkes._tcp");
00051
00052 ServiceChooserDialog(Gtk::Window &parent,
00053 Glib::ustring title = "Select Service",
00054 const char *service = "_fawkes._tcp");
00055
00056 virtual ~ServiceChooserDialog();
00057
00058 void get_selected_service(Glib::ustring &name, Glib::ustring &hostname,
00059 Glib::ustring &ipaddr, unsigned short int &port);
00060 void get_raw_address(struct sockaddr *addr, socklen_t addr_size);
00061
00062 void run_and_connect();
00063
00064 protected:
00065 virtual void on_expander_changed();
00066
00067 private:
00068 void ctor();
00069 fawkes::FawkesNetworkClient *__client;
00070
00071 Gtk::Window &__parent;
00072 Gtk::TreeView __treeview;
00073 Gtk::Entry __entry;
00074 Gtk::Expander __expander;
00075 Gtk::ScrolledWindow __scrollwin;
00076
00077 ServiceModel *__service_model;
00078 };
00079
00080 }
00081
00082 #endif