Fawkes API Fawkes Development Version
service_chooser_dialog.h
1
2/***************************************************************************
3 * service_chooser_dialog.cpp - Dialog for choosing a network service
4 *
5 * Created: Sun Oct 12 17:06:06 2008 (split from lasergui_hildon.cpp)
6 * Copyright 2008 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#ifndef _LIBS_GUI_UTILS_SERVICE_CHOOSER_DIALOG_H_
25#define _LIBS_GUI_UTILS_SERVICE_CHOOSER_DIALOG_H_
26
27#include <gtkmm/dialog.h>
28#include <gtkmm/entry.h>
29#include <gtkmm/expander.h>
30#include <gtkmm/scrolledwindow.h>
31#include <gtkmm/treeview.h>
32#include <gui_utils/service_model.h>
33#ifdef HAVE_GCONFMM
34# include <gconfmm.h>
35#endif
36
37#include <sys/socket.h>
38#include <sys/types.h>
39
40namespace fawkes {
41
42class FawkesNetworkClient;
43class ServiceModel;
44
45class ServiceChooserDialog : public Gtk::Dialog
46{
47public:
48 ServiceChooserDialog(Gtk::Window & parent,
49 FawkesNetworkClient *client,
50 Glib::ustring title = "Select Service",
51 const char * service = "_fawkes._tcp");
52
53 ServiceChooserDialog(Gtk::Window & parent,
54 Glib::ustring title = "Select Service",
55 const char * service = "_fawkes._tcp");
56
57 virtual ~ServiceChooserDialog();
58
59 void get_selected_service(Glib::ustring &name, Glib::ustring &hostname, unsigned short int &port);
60 void get_selected_service(Glib::ustring &hostname, struct sockaddr_storage &sockaddr);
61
62 void get_raw_address(struct sockaddr *addr, socklen_t addr_size);
63
64 void run_and_connect();
65
66protected:
67 virtual void on_expander_changed();
68
69private:
70 void ctor();
72
73 Gtk::Window & parent_;
74 Gtk::TreeView treeview_;
75 Gtk::Entry entry_;
76 Gtk::Expander expander_;
77 Gtk::ScrolledWindow scrollwin_;
78#ifdef HAVE_GCONFMM
79 Glib::RefPtr<Gnome::Conf::Client> gconf_;
80#endif
81
82 ServiceModel *service_model_;
83};
84
85} // end of namespace fawkes
86
87#endif
Simple Fawkes network client.
Definition: client.h:52
void get_raw_address(struct sockaddr *addr, socklen_t addr_size)
Get raw address.
ServiceChooserDialog(Gtk::Window &parent, FawkesNetworkClient *client, Glib::ustring title="Select Service", const char *service="_fawkes._tcp")
Constructor.
virtual ~ServiceChooserDialog()
Destructor.
virtual void on_expander_changed()
Signal handler for expander event.
void run_and_connect()
Run dialog and try to connect.
void get_selected_service(Glib::ustring &name, Glib::ustring &hostname, unsigned short int &port)
Get selected service.
Abstract base class for widgets that allow to view the detected services of a certain type.
Definition: service_model.h:36
Fawkes library namespace.