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