]> git.meshlink.io Git - catta/blob - avahi-ui/avahi-ui.h
d780f83e9a8580701bb7b450d2afbe1229e012d9
[catta] / avahi-ui / avahi-ui.h
1 #ifndef fooavahiuihfoo
2 #define fooavahiuihfoo
3
4 /* $Id$ */
5
6 /***
7   This file is part of avahi.
8
9   avahi is free software; you can redistribute it and/or modify it
10   under the terms of the GNU Lesser General Public License as
11   published by the Free Software Foundation; either version 2.1 of the
12   License, or (at your option) any later version.
13
14   avahi is distributed in the hope that it will be useful, but WITHOUT
15   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
17   Public License for more details.
18
19   You should have received a copy of the GNU Lesser General Public
20   License along with avahi; if not, write to the Free Software
21   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22   USA.
23 ***/
24
25 #include <gtk/gtk.h>
26
27 #include <avahi-client/client.h>
28
29 /** \file avahi-ui.h A Gtk dialog for browsing for services */
30
31 G_BEGIN_DECLS
32
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34
35 #define AUI_TYPE_SERVICE_DIALOG            (aui_service_dialog_get_type())
36 #define AUI_SERVICE_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), AUI_TYPE_SERVICE_DIALOG, AuiServiceDialog))
37 #define AUI_SERVICE_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), AUI_TYPE_SERVICE_DIALOG, AuiServiceDialogClass))
38 #define AUI_IS_SERVICE_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), AUI_TYPE_SERVICE_DIALOG))
39 #define AUI_IS_SERVICE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), AUI_TYPE_SERVICE_DIALOG))
40 #define AUI_SERVICE_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), AUI_TYPE_SERVICE_DIALOG, AuiServiceDialogClass))
41
42 typedef struct _AuiServiceDialogPrivate AuiServiceDialogPrivate;
43 typedef struct _AuiServiceDialogClass  AuiServiceDialogClass;
44
45 struct _AuiServiceDialogClass {
46     GtkDialogClass parent_class;
47
48     /* Padding for future expansion */
49     void (*_aui_reserved1)(void);
50     void (*_aui_reserved2)(void);
51     void (*_aui_reserved3)(void);
52     void (*_aui_reserved4)(void);
53 };
54
55 struct _AuiServiceDialog {
56     GtkDialog parent_instance;
57     AuiServiceDialogPrivate *priv;
58 };
59
60 /* ServiceDialog */
61 GType aui_service_dialog_get_type(void) G_GNUC_CONST;
62
63 #endif
64
65 /** The GTK service dialog structure */
66 typedef struct _AuiServiceDialog AuiServiceDialog;
67
68 /** @{ \name Construction */
69
70 /** Create a new service browser dialog with the specific title,
71  * parent window and the speicified buttons. The buttons are specified
72  * in a similar way to GtkFileChooserDialog. Please note that at least
73  * one button has to respond GTK_RESPONSE_ACCEPT. */
74 GtkWidget* aui_service_dialog_new(
75         const gchar *title,
76         GtkWindow *parent,
77         const gchar *first_button_text, ...) G_GNUC_NULL_TERMINATED;
78
79 /** \cond fulldocs */
80 GtkWidget *aui_service_dialog_new_valist(
81         const gchar *title,
82         GtkWindow *parent,
83         const gchar *first_button_text,
84         va_list varargs);
85 /** \endcond */
86
87 /** @} */
88
89 /** @{ \name Service types to browse for */
90
91 /** Select the service types to browse for. Takes a NULL terminated list of DNS-SD service types. i.e. _http._tcp */
92 void aui_service_dialog_set_browse_service_types(AuiServiceDialog *d, const gchar *type, ...) G_GNUC_NULL_TERMINATED;
93 /** Same as aui_service_dialog_set_browse_service_types() but take a NULL terminated array */
94 void aui_service_dialog_set_browse_service_typesv(AuiServiceDialog *d, const gchar *const*type);
95 /** Return the service types currently browsed for. i.e. what was previously set with aui_service_dialog_set_browse_service_types() */
96 const gchar*const* aui_service_dialog_get_browse_service_types(AuiServiceDialog *d);
97 /** Overwrite the pretty name shown in the service type column. \since 0.6.22 */
98 void aui_service_dialog_set_service_type_name(AuiServiceDialog *d, const gchar *type, const gchar *name);
99
100 /** @} */
101
102 /** @{ \name Domain to browse in */
103
104 /** Set the domain to browse in */
105 void aui_service_dialog_set_domain(AuiServiceDialog *d, const gchar *domain);
106 /** Query the domain that is browsed in */
107 const gchar* aui_service_dialog_get_domain(AuiServiceDialog *d);
108
109 /** @} */
110
111 /** @{ \name Selected service item */
112
113 /** Set the service type for the service to select */
114 void aui_service_dialog_set_service_type(AuiServiceDialog *d, const gchar *name);
115
116 /** Query the service type of the currently selected service */
117 const gchar* aui_service_dialog_get_service_type(AuiServiceDialog *d);
118
119 /** Set the service name for the service to select */
120 void aui_service_dialog_set_service_name(AuiServiceDialog *d, const gchar *name);
121
122 /** Query the service name of the currently select service */
123 const gchar* aui_service_dialog_get_service_name(AuiServiceDialog *d);
124
125 /** @} */
126
127 /** @{ \name Resolved service information */
128
129 /** Return the IP address of the selected service. (Only valid if host name resolving has not been disabled via aui_service_dialog_set_resolve_host_name()) */
130 const AvahiAddress* aui_service_dialog_get_address(AuiServiceDialog *d);
131
132 /** Return the IP port number of the selected service */
133 guint16 aui_service_dialog_get_port(AuiServiceDialog *d);
134
135 /** Return the host name of the selected service */
136 const gchar* aui_service_dialog_get_host_name(AuiServiceDialog *d);
137
138 /** Return the TXT metadata of the selected service */
139 const AvahiStringList *aui_service_dialog_get_txt_data(AuiServiceDialog *d);
140
141 /** @} */
142
143 /** @{ \name Resolving settings */
144
145 /** Disable/Enable automatic service resolving. Disabling this feature
146  * will require you to resolve the selected service on our own. I.e. the port
147  * number, the TXT data and the host name/IP address will not be
148  * available after a service has been selected. This functionality
149  * offers a certain optimization in the traffic imposed on the
150  * network. Most people will not want to touch this. */
151 void aui_service_dialog_set_resolve_service(AuiServiceDialog *d, gboolean resolve);
152
153 /** Query the last status of aui_service_dialog_set_resolve_service() */
154 gboolean aui_service_dialog_get_resolve_service(AuiServiceDialog *d);
155
156 /** Disable/Enable automatic host name resolving. Disabling this
157  * feature will cause aui_service_dialog_get_address() return NULL in
158  * all case because avahi-ui will not resolve the host name of the
159  * selected service to an address. This is a slight optimization
160  * regarding the traffic imposed by this query to the network. By
161  * default, avahi-ui will resolve the host names of selected services. */
162 void aui_service_dialog_set_resolve_host_name(AuiServiceDialog *d, gboolean resolve);
163
164 /** Query the last status of aui_service_dialog_set_resolve_host_name() */
165 gboolean aui_service_dialog_get_resolve_host_name(AuiServiceDialog *d);
166
167 /** @} */
168
169 /** @{ \name Address family */
170
171 /** Select the address family to look for services of. This can be
172 used to look only for IPv6 services or only for IPv4 services. By
173 default avahi-ui will browse for both IPv4 and IPv6 services.*/
174 void aui_service_dialog_set_address_family(AuiServiceDialog *d, AvahiProtocol proto);
175
176 /** Query the address family we're looking for. */
177 AvahiProtocol aui_service_dialog_get_address_family(AuiServiceDialog *d);
178
179 /** @} */
180
181 G_END_DECLS
182
183 #endif