From 3ffc20e4d32a688b0fbd774c93c4114d5e883342 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 17 Jun 2009 21:58:03 -0400 Subject: Add C bindings for properties and clean up docs a bit --- docs/Makefile.am | 22 +- docs/xdg-hostname-1-docs.xml | 479 ++++++++++++++++++++++++++++++++ docs/xdg-hostname-1-sections.txt | 43 +++ docs/xdg-hostname-1.types | 2 + docs/xdg-hostname-docs.xml | 479 -------------------------------- src/xdg-hostname/xdg-hostname-monitor.c | 294 +++++++++++++------- src/xdg-hostname/xdg-hostname-monitor.h | 132 ++++----- 7 files changed, 803 insertions(+), 648 deletions(-) create mode 100644 docs/xdg-hostname-1-docs.xml create mode 100644 docs/xdg-hostname-1-sections.txt create mode 100644 docs/xdg-hostname-1.types delete mode 100644 docs/xdg-hostname-docs.xml diff --git a/docs/Makefile.am b/docs/Makefile.am index e95ccdf..8b820a2 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -6,10 +6,10 @@ NULL = AUTOMAKE_OPTIONS = 1.7 # The name of the module. -DOC_MODULE=xdg-hostname +DOC_MODULE=xdg-hostname-1 # The top-level SGML file. -DOC_MAIN_SGML_FILE=xdg-hostname-docs.xml +DOC_MAIN_SGML_FILE=xdg-hostname-1-docs.xml # Extra options to supply to gtkdoc-scan SCAN_OPTIONS=--ignore-headers=config.h @@ -74,6 +74,24 @@ if ENABLE_GTK_DOC include $(top_srcdir)/gtk-doc.make else EXTRA_DIST = +CLEANFILES = endif EXTRA_DIST += version.xml.in + +CLEANFILES += *~ \ + xdg-hostname-1-scan.* \ + xdg-hostname-1.args \ + xdg-hostname-1.hierarchy \ + xdg-hostname-1.interfaces \ + xdg-hostname-1.prerequisites \ + xdg-hostname-1.signals \ + *.bak \ + xdg-hostname-1-decl-list.txt \ + xdg-hostname-1-decl.txt \ + xdg-hostname-1-overrides.txt \ + xdg-hostname-1-undeclared.txt \ + xdg-hostname-1-undocumented.txt \ + *.stamp \ + -rf html xml \ + $(NULL) diff --git a/docs/xdg-hostname-1-docs.xml b/docs/xdg-hostname-1-docs.xml new file mode 100644 index 0000000..8857b4f --- /dev/null +++ b/docs/xdg-hostname-1-docs.xml @@ -0,0 +1,479 @@ + + +]> + + + xdg-hostname Reference Manual + Version &version; + + + David + Zeuthen + +
+ davidz@redhat.com +
+
+
+
+ + + 2008 + The xdg-hostname Authors + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
+ The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
+
+ + + Many of the names used by companies to distinguish their + products and services are claimed as trademarks. Where those + names appear in any freedesktop.org documentation, and those trademarks + are made aware to the members of the freedesktop.org + Project, the names have been printed in caps or initial caps. + +
+
+ + + Overview + + Introduction + + The xdg-hostname project provides a + mechanism to get, set and monitor changes for hostname + data. Hostname data is defined to include more than just the + regular hostname, it also includes a display hostname, an icon + and possibly more items in the future. Hostname data is + usually a user preference and is stored in a persistent local + database. + + + In addition, the xdg-hostname project + provides a facility for network configuration software to + inject transient hostname data that, according to user + preference, can take precedence over local configuration data. + For example, when a system obtains network configuration + data via + DHCP, + auxiliary data as defined by + RFC 2132 + may specify what hostname to use. + + + The main audience for the xdg-hostname + project include + + + + Desktop environments - for displaying and allowing + the user to configure hostname data. + + + + + Applications exporting named services on the + network. Such applications can consume hostname + data to provide a more useful name for the service + they export. + + + + The main benefit from using hostname data provided by the + xdg-hostname project is the display + hostname. Compared to the traditional hostname (which + normally conforms to section 3.5 of + RFC 1034 + with the hostname being a label: 7 bit ASCII without special characters, + whitespace or dots) the display hostname is UTF-8. + + + Applications can use the display hostname announcing + services via e.g. + DNS-SD. + For example, a file sharing application may use set the service name to + "David's files on Kitchen Computer" (or in Chinese "David' 在厨 + 房计算机上的s文件") instead of the uglier + and less meaningful name "David's files on localhost". + + + In addition, this service introduces the concept of + associating an icon with a system. This is useful for + applications announcing services on the network. For example, + for DNS-SD, a TXT record may be set to the icon name. Icon + names are designed to conform to the freedesktop.org + Icon Theme Specification + and + Icon Naming Specification + specifications. + + + It is important to understand that the display hostname and + hostname are different on a conceptual level; many of the + the observations in section 4.4 of the + DNS-SD + Draft applies here. Specifically, the display hostname is, + among other things, intended to be used for naming services + (e.g. "Recipes on Kitchen Computer") announced via e.g. DNS-SD + and the hostname (e.g. "t41-davidz") is for identifying the + system on which software providing the service runs. One way + to think about this is that the display hostname represents what + the system does while the hostname + represents what the system is. + + + For example, if the system with the hostname "t41-davidz" is + replaced by a another system with the hostname "x61-davidz" it + is useful to keep the display hostname the same ("Kitchen + Computer") such that users on the network consuming services + ("Recipes on Kitchen Computer") won't need to be reconfigured. + + + The display hostname is what should be presented in the user + interface; users (who are not administrators) should never ever + need to see the hostname. + + + + + Reading hostname data + + Hostname data exported by the xdg-hostname + project is available via a D-Bus service on the system message + bus. To access the D-Bus service, use the well-known + name org.freedesktop.Hostname1 on the D-Bus + system message bus and connect to the + interface + + for the + object at the + path /org/freedesktop/hostname1. + + + For reading hostname data, simply read the D-Bus properties, e.g. + display-hostname, + hostname and + icon-name. To listen for changes, + connect to the + Changed() signal. + + + The value of these properties are usually computed using the following algorithm: + + + + For + hostname, + if + use-transient-data + data is TRUE and a live transient data provider + is registered (see ), then + transient-hostname is returned + if the property is not the empty string. + Otherwise + configured-hostname + is returned. + + + + Likewise for the + display-hostname and + icon-name properties. + + + Applications MUST NOT assume this algorithm is used. An + implementation of the org.freedesktop.Hostname1 + D-Bus service MAY use another algorithm to return hostname + data (for example, an implementation may read the hostname + data from e.g. a + LDAP, + another implementation may read it from + Vital Product Data + etc.) + + + + + Configuring hostname data + + System configuration tools should use the methods + SetDisplayHostname(), + SetHostname(), + SetIconName() and + SetUseTransientData(), + method to set data. + + + Graphical user interfaces would also use the + configured-display-hostname, + configured-hostname, + configured-icon-name and + use-transient-data + properties to initialize the user interface with currently configured values. + + + As an example, one user interface could look like this + + + +---------+ + | Icon | Computer Name: [David's Kitchen Computer___________] + | Chooser | + +---------+ + To access this computer from the network use the name + davids-kitchen-computer.local + + [>] Advanced + + [Revert] [Cancel] [Apply] + + + where the hostname is automatically computed from the display + hostname. If the user wants to explicitly set the hostname + he can expand the dialog: + + + +---------+ + | Icon | Computer Name: [David's Kitchen Computer___________] + | Chooser | + +---------+ + To access this computer from the network use the name + x61-davidz.local + + [V] Advanced + + Hostname: [x61-davidz_________________________] + + [ ] Always change hostname if provided by network connections + + [Revert] [Cancel] [Apply] + + + In addition, the "Always change hostname if provided by + network connections" element represents the + use-transient-data + property. + + + + + Providing transient data + + Networking configuration tools should use the + RegisterTransientDataProvider() + method when connecting to a network where a hostname is provided as part of the + connection setup. + + + Using the obtained cookie, the network configuration tool + can invoke methods such as + SetTransientHostname() + to e.g. set the hostname. + If hostname data changes over time (for example, when renewing a DHCP lease), the + network configuration tool can simply call + SetTransientHostname() + again. + + + When disconnecting from the network, the networking configuration tool must call + UnregisterTransientDataProvider(). + + + A provider of transient hostname data should ALWAYS supply + data this way even + if use-transient-data + is FALSE. + + + + + Implementation Details + + This section describes implementation details about the software + shipped as part of the xdg-hostname project. Applications + MUST NOT rely on these implementation details as other software + may provide org.freedesktop.Hostname1 D-Bus service. + This information is provided only to make it easier for vendors + to integrate the xdg-hostname project into + operating system products. + + + The org.freedesktop.Hostname1 D-Bus service + is designed to be implemented by a process launched on demand + using D-Bus system bus activation. In addition, after 30 + seconds of inactivity (e.g. no method calls or transient data providers), the process + providing the D-Bus service will automatically exit and + release resources. The + + daemon is used to provide + the org.freedesktop.Hostname1 D-Bus + service. + + + For easy access to the org.freedesktop.Hostname1 + D-Bus service, the + + program is provided. + In addition to configuring hostname data, this program + provides direct access to the local configuration database + without using D-Bus. This is useful in sitations where no + system bus is available, for example early user space or when + configuring a system or image in + a chroot(1) environment. + + + If the hostname is manually set (e.g. not using the + org.freedesktop.Hostname1 D-Bus service), + the + + program should be used to update the local database of the + xdg-hostname project: + + +xdg-hostname-1 --set-hostname `/bin/hostname` + + + + + If even this doesn't happen, + + will always compare the result + of gethostname(2) + with what's in the local database before every operation + (e.g. setting or returning + hostname and other + properties). + If there's a mismatch it means the hostname was manually changed + without invoking + + as described above. + As a result, + + will update the local database to match the current + hostname as returned by gethostname(2). + The only change is that change notifications on + the D-Bus interface are delayed. + + + Changing the hostname on a UNIX system + can a bit more work than just invoking the + the sethostname(2) system call. + Depending on the operating system, other actions, + such as updating one or more configuration files, may need to + happen. To accommodate this, all executable programs in the + /etc/xdg/hostname-1/run.d + directory with the extension .run + will be invoked (sequentially, in the C locale's alphabetical order) + by + + whenever one of the + display-hostname, + hostname and + icon-name + properties change. Two positional parameters will be supplied, + the first is the name of the property (e.g: display-hostname), + the second being it's value (e.g.: Jukebox ♫♫♫). + The exit code of the programs are ignored. If a program invoked + this way hasn't exited within 5 seconds, it will be silently + killed and an error will be logged. While the .run + programs are being run, + + will not service requests on the D-Bus interface (requests will be queued + up for processing when all the .run programs have run). + + + A number of applications require that the name returned by + gethostname(2) resolves to the local + machine (typically 127.0.0.1). This can be achieved via + either using a .run script in /etc/xdg/hostname-1/run.d that updates + the /etc/hosts file + or through a + GNU C Library + extension such as + nss-myhostname. + + + Typically, when booting a UNIX system the + hostname needs to be set as early as possible. As an implementation + detail, + + will always attempt write the current hostname (e.g. the value + of the + hostname + property) to the /etc/xdg/hostname-1/hostname + file (specifically this file may be a symlink to e.g. the + /etc/hostname file). + Operating system boot scripts may use the contents of this + file to set the hostname when booting. + + + + + + + D-Bus API Reference + + + This part documents the D-Bus interface used to access the + xdg-hostname project. + + + + + + + GObject API Reference + + + This part documents a GObject library used to access the + xdg-hostname project. + + + + + + + + Tools + + + This part presents the tools distributed with the. + xdg-hostname project. + + + + + + + + Index + + + + + + License + +FIXME: MISSING XINCLUDE CONTENT + + +
diff --git a/docs/xdg-hostname-1-sections.txt b/docs/xdg-hostname-1-sections.txt new file mode 100644 index 0000000..92d353f --- /dev/null +++ b/docs/xdg-hostname-1-sections.txt @@ -0,0 +1,43 @@ +
+xdg-hostname-monitor +XdgHostnameMonitor +xdg_hostname_monitor_get +xdg_hostname_monitor_get_display_hostname +xdg_hostname_monitor_get_hostname +xdg_hostname_monitor_get_icon_name +xdg_hostname_monitor_get_use_transient_data +xdg_hostname_monitor_set_display_hostname +xdg_hostname_monitor_set_display_hostname_finish +xdg_hostname_monitor_set_hostname +xdg_hostname_monitor_set_hostname_finish +xdg_hostname_monitor_set_icon_name +xdg_hostname_monitor_set_icon_name_finish +xdg_hostname_monitor_set_use_transient_data +xdg_hostname_monitor_set_use_transient_data_finish +xdg_hostname_monitor_set_display_hostname_sync +xdg_hostname_monitor_set_hostname_sync +xdg_hostname_monitor_set_icon_name_sync +xdg_hostname_monitor_set_use_transient_data_sync +xdg_hostname_monitor_get_configured_display_hostname +xdg_hostname_monitor_get_configured_hostname +xdg_hostname_monitor_get_configured_icon_name +xdg_hostname_monitor_get_transient_display_hostname +xdg_hostname_monitor_get_transient_hostname +xdg_hostname_monitor_get_transient_icon_name + +XDG_HOSTNAME_MONITOR +XDG_IS_HOSTNAME_MONITOR +XDG_TYPE_HOSTNAME_MONITOR +xdg_hostname_monitor_get_type +XDG_HOSTNAME_MONITOR_CLASS +XDG_IS_HOSTNAME_MONITOR_CLASS +XDG_HOSTNAME_MONITOR_GET_CLASS +
+ +
+xdg-hostname-error +XDG_HOSTNAME_TYPE_ERROR +XDG_HOSTNAME_ERROR +XdgHostnameErrorEnum +
+ diff --git a/docs/xdg-hostname-1.types b/docs/xdg-hostname-1.types new file mode 100644 index 0000000..656fd76 --- /dev/null +++ b/docs/xdg-hostname-1.types @@ -0,0 +1,2 @@ +xdg_hostname_error_get_type +xdg_hostname_monitor_get_type diff --git a/docs/xdg-hostname-docs.xml b/docs/xdg-hostname-docs.xml deleted file mode 100644 index 8857b4f..0000000 --- a/docs/xdg-hostname-docs.xml +++ /dev/null @@ -1,479 +0,0 @@ - - -]> - - - xdg-hostname Reference Manual - Version &version; - - - David - Zeuthen - -
- davidz@redhat.com -
-
-
-
- - - 2008 - The xdg-hostname Authors - - - - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free - Documentation License, Version 1.1 or any later - version published by the Free Software Foundation with no - Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. You may obtain a copy of the GNU Free - Documentation License from the Free Software - Foundation by visiting their Web site or by writing - to: - -
- The Free Software Foundation, Inc., - 59 Temple Place - Suite 330, - Boston, MA 02111-1307, - USA -
-
- - - Many of the names used by companies to distinguish their - products and services are claimed as trademarks. Where those - names appear in any freedesktop.org documentation, and those trademarks - are made aware to the members of the freedesktop.org - Project, the names have been printed in caps or initial caps. - -
-
- - - Overview - - Introduction - - The xdg-hostname project provides a - mechanism to get, set and monitor changes for hostname - data. Hostname data is defined to include more than just the - regular hostname, it also includes a display hostname, an icon - and possibly more items in the future. Hostname data is - usually a user preference and is stored in a persistent local - database. - - - In addition, the xdg-hostname project - provides a facility for network configuration software to - inject transient hostname data that, according to user - preference, can take precedence over local configuration data. - For example, when a system obtains network configuration - data via - DHCP, - auxiliary data as defined by - RFC 2132 - may specify what hostname to use. - - - The main audience for the xdg-hostname - project include - - - - Desktop environments - for displaying and allowing - the user to configure hostname data. - - - - - Applications exporting named services on the - network. Such applications can consume hostname - data to provide a more useful name for the service - they export. - - - - The main benefit from using hostname data provided by the - xdg-hostname project is the display - hostname. Compared to the traditional hostname (which - normally conforms to section 3.5 of - RFC 1034 - with the hostname being a label: 7 bit ASCII without special characters, - whitespace or dots) the display hostname is UTF-8. - - - Applications can use the display hostname announcing - services via e.g. - DNS-SD. - For example, a file sharing application may use set the service name to - "David's files on Kitchen Computer" (or in Chinese "David' 在厨 - 房计算机上的s文件") instead of the uglier - and less meaningful name "David's files on localhost". - - - In addition, this service introduces the concept of - associating an icon with a system. This is useful for - applications announcing services on the network. For example, - for DNS-SD, a TXT record may be set to the icon name. Icon - names are designed to conform to the freedesktop.org - Icon Theme Specification - and - Icon Naming Specification - specifications. - - - It is important to understand that the display hostname and - hostname are different on a conceptual level; many of the - the observations in section 4.4 of the - DNS-SD - Draft applies here. Specifically, the display hostname is, - among other things, intended to be used for naming services - (e.g. "Recipes on Kitchen Computer") announced via e.g. DNS-SD - and the hostname (e.g. "t41-davidz") is for identifying the - system on which software providing the service runs. One way - to think about this is that the display hostname represents what - the system does while the hostname - represents what the system is. - - - For example, if the system with the hostname "t41-davidz" is - replaced by a another system with the hostname "x61-davidz" it - is useful to keep the display hostname the same ("Kitchen - Computer") such that users on the network consuming services - ("Recipes on Kitchen Computer") won't need to be reconfigured. - - - The display hostname is what should be presented in the user - interface; users (who are not administrators) should never ever - need to see the hostname. - - - - - Reading hostname data - - Hostname data exported by the xdg-hostname - project is available via a D-Bus service on the system message - bus. To access the D-Bus service, use the well-known - name org.freedesktop.Hostname1 on the D-Bus - system message bus and connect to the - interface - - for the - object at the - path /org/freedesktop/hostname1. - - - For reading hostname data, simply read the D-Bus properties, e.g. - display-hostname, - hostname and - icon-name. To listen for changes, - connect to the - Changed() signal. - - - The value of these properties are usually computed using the following algorithm: - - - - For - hostname, - if - use-transient-data - data is TRUE and a live transient data provider - is registered (see ), then - transient-hostname is returned - if the property is not the empty string. - Otherwise - configured-hostname - is returned. - - - - Likewise for the - display-hostname and - icon-name properties. - - - Applications MUST NOT assume this algorithm is used. An - implementation of the org.freedesktop.Hostname1 - D-Bus service MAY use another algorithm to return hostname - data (for example, an implementation may read the hostname - data from e.g. a - LDAP, - another implementation may read it from - Vital Product Data - etc.) - - - - - Configuring hostname data - - System configuration tools should use the methods - SetDisplayHostname(), - SetHostname(), - SetIconName() and - SetUseTransientData(), - method to set data. - - - Graphical user interfaces would also use the - configured-display-hostname, - configured-hostname, - configured-icon-name and - use-transient-data - properties to initialize the user interface with currently configured values. - - - As an example, one user interface could look like this - - - +---------+ - | Icon | Computer Name: [David's Kitchen Computer___________] - | Chooser | - +---------+ - To access this computer from the network use the name - davids-kitchen-computer.local - - [>] Advanced - - [Revert] [Cancel] [Apply] - - - where the hostname is automatically computed from the display - hostname. If the user wants to explicitly set the hostname - he can expand the dialog: - - - +---------+ - | Icon | Computer Name: [David's Kitchen Computer___________] - | Chooser | - +---------+ - To access this computer from the network use the name - x61-davidz.local - - [V] Advanced - - Hostname: [x61-davidz_________________________] - - [ ] Always change hostname if provided by network connections - - [Revert] [Cancel] [Apply] - - - In addition, the "Always change hostname if provided by - network connections" element represents the - use-transient-data - property. - - - - - Providing transient data - - Networking configuration tools should use the - RegisterTransientDataProvider() - method when connecting to a network where a hostname is provided as part of the - connection setup. - - - Using the obtained cookie, the network configuration tool - can invoke methods such as - SetTransientHostname() - to e.g. set the hostname. - If hostname data changes over time (for example, when renewing a DHCP lease), the - network configuration tool can simply call - SetTransientHostname() - again. - - - When disconnecting from the network, the networking configuration tool must call - UnregisterTransientDataProvider(). - - - A provider of transient hostname data should ALWAYS supply - data this way even - if use-transient-data - is FALSE. - - - - - Implementation Details - - This section describes implementation details about the software - shipped as part of the xdg-hostname project. Applications - MUST NOT rely on these implementation details as other software - may provide org.freedesktop.Hostname1 D-Bus service. - This information is provided only to make it easier for vendors - to integrate the xdg-hostname project into - operating system products. - - - The org.freedesktop.Hostname1 D-Bus service - is designed to be implemented by a process launched on demand - using D-Bus system bus activation. In addition, after 30 - seconds of inactivity (e.g. no method calls or transient data providers), the process - providing the D-Bus service will automatically exit and - release resources. The - - daemon is used to provide - the org.freedesktop.Hostname1 D-Bus - service. - - - For easy access to the org.freedesktop.Hostname1 - D-Bus service, the - - program is provided. - In addition to configuring hostname data, this program - provides direct access to the local configuration database - without using D-Bus. This is useful in sitations where no - system bus is available, for example early user space or when - configuring a system or image in - a chroot(1) environment. - - - If the hostname is manually set (e.g. not using the - org.freedesktop.Hostname1 D-Bus service), - the - - program should be used to update the local database of the - xdg-hostname project: - - -xdg-hostname-1 --set-hostname `/bin/hostname` - - - - - If even this doesn't happen, - - will always compare the result - of gethostname(2) - with what's in the local database before every operation - (e.g. setting or returning - hostname and other - properties). - If there's a mismatch it means the hostname was manually changed - without invoking - - as described above. - As a result, - - will update the local database to match the current - hostname as returned by gethostname(2). - The only change is that change notifications on - the D-Bus interface are delayed. - - - Changing the hostname on a UNIX system - can a bit more work than just invoking the - the sethostname(2) system call. - Depending on the operating system, other actions, - such as updating one or more configuration files, may need to - happen. To accommodate this, all executable programs in the - /etc/xdg/hostname-1/run.d - directory with the extension .run - will be invoked (sequentially, in the C locale's alphabetical order) - by - - whenever one of the - display-hostname, - hostname and - icon-name - properties change. Two positional parameters will be supplied, - the first is the name of the property (e.g: display-hostname), - the second being it's value (e.g.: Jukebox ♫♫♫). - The exit code of the programs are ignored. If a program invoked - this way hasn't exited within 5 seconds, it will be silently - killed and an error will be logged. While the .run - programs are being run, - - will not service requests on the D-Bus interface (requests will be queued - up for processing when all the .run programs have run). - - - A number of applications require that the name returned by - gethostname(2) resolves to the local - machine (typically 127.0.0.1). This can be achieved via - either using a .run script in /etc/xdg/hostname-1/run.d that updates - the /etc/hosts file - or through a - GNU C Library - extension such as - nss-myhostname. - - - Typically, when booting a UNIX system the - hostname needs to be set as early as possible. As an implementation - detail, - - will always attempt write the current hostname (e.g. the value - of the - hostname - property) to the /etc/xdg/hostname-1/hostname - file (specifically this file may be a symlink to e.g. the - /etc/hostname file). - Operating system boot scripts may use the contents of this - file to set the hostname when booting. - - - - - - - D-Bus API Reference - - - This part documents the D-Bus interface used to access the - xdg-hostname project. - - - - - - - GObject API Reference - - - This part documents a GObject library used to access the - xdg-hostname project. - - - - - - - - Tools - - - This part presents the tools distributed with the. - xdg-hostname project. - - - - - - - - Index - - - - - - License - -FIXME: MISSING XINCLUDE CONTENT - - -
diff --git a/src/xdg-hostname/xdg-hostname-monitor.c b/src/xdg-hostname/xdg-hostname-monitor.c index 1900510..52fd118 100644 --- a/src/xdg-hostname/xdg-hostname-monitor.c +++ b/src/xdg-hostname/xdg-hostname-monitor.c @@ -43,19 +43,19 @@ struct _XdgHostnameMonitor { GObject parent_instance; - char *display_hostname; - char *hostname; - char *icon_name; + gchar *display_hostname; + gchar *hostname; + gchar *icon_name; - char *configured_display_hostname; - char *configured_hostname; - char *configured_icon_name; + gchar *configured_display_hostname; + gchar *configured_hostname; + gchar *configured_icon_name; gboolean use_transient_data; - char *transient_display_hostname; - char *transient_hostname; - char *transient_icon_name; + gchar *transient_display_hostname; + gchar *transient_hostname; + gchar *transient_icon_name; DBusGProxy *proxy; DBusGProxy *prop_proxy; @@ -65,7 +65,7 @@ struct _XdgHostnameMonitorClass { GObjectClass parent_class; - void (* changed) (XdgHostnameMonitor *hostname_monitor); + void (* changed) (XdgHostnameMonitor *monitor); }; enum { @@ -97,42 +97,42 @@ G_DEFINE_TYPE (XdgHostnameMonitor, xdg_hostname_monitor, G_TYPE_OBJECT); static void xdg_hostname_monitor_finalize (GObject *object) { - XdgHostnameMonitor *hostname_monitor; + XdgHostnameMonitor *monitor; - hostname_monitor = XDG_HOSTNAME_MONITOR (object); + monitor = XDG_HOSTNAME_MONITOR (object); - if (hostname_monitor->proxy != NULL) - g_object_unref (hostname_monitor->proxy); - if (hostname_monitor->prop_proxy != NULL) - g_object_unref (hostname_monitor->prop_proxy); + if (monitor->proxy != NULL) + g_object_unref (monitor->proxy); + if (monitor->prop_proxy != NULL) + g_object_unref (monitor->prop_proxy); - g_free (hostname_monitor->display_hostname); - g_free (hostname_monitor->hostname); - g_free (hostname_monitor->icon_name); + g_free (monitor->display_hostname); + g_free (monitor->hostname); + g_free (monitor->icon_name); - g_free (hostname_monitor->configured_display_hostname); - g_free (hostname_monitor->configured_hostname); - g_free (hostname_monitor->configured_icon_name); + g_free (monitor->configured_display_hostname); + g_free (monitor->configured_hostname); + g_free (monitor->configured_icon_name); - g_free (hostname_monitor->transient_display_hostname); - g_free (hostname_monitor->transient_hostname); - g_free (hostname_monitor->transient_icon_name); + g_free (monitor->transient_display_hostname); + g_free (monitor->transient_hostname); + g_free (monitor->transient_icon_name); G_OBJECT_CLASS (xdg_hostname_monitor_parent_class)->finalize (object); } static void -xdg_hostname_monitor_init (XdgHostnameMonitor *hostname_monitor) +xdg_hostname_monitor_init (XdgHostnameMonitor *monitor) { } static void xdg_hostname_monitor_constructed (GObject *object) { - XdgHostnameMonitor *hostname_monitor; + XdgHostnameMonitor *monitor; - hostname_monitor = XDG_HOSTNAME_MONITOR (object); + monitor = XDG_HOSTNAME_MONITOR (object); if (G_OBJECT_CLASS (xdg_hostname_monitor_parent_class)->constructed != NULL) G_OBJECT_CLASS (xdg_hostname_monitor_parent_class)->constructed (object); @@ -144,51 +144,51 @@ xdg_hostname_monitor_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - XdgHostnameMonitor *hostname_monitor; + XdgHostnameMonitor *monitor; g_return_if_fail (XDG_IS_HOSTNAME_MONITOR (object)); - hostname_monitor = XDG_HOSTNAME_MONITOR (object); + monitor = XDG_HOSTNAME_MONITOR (object); switch (prop_id) { case PROP_DISPLAY_HOSTNAME: - g_value_set_string (value, hostname_monitor->display_hostname); + g_value_set_string (value, monitor->display_hostname); break; case PROP_HOSTNAME: - g_value_set_string (value, hostname_monitor->hostname); + g_value_set_string (value, monitor->hostname); break; case PROP_ICON_NAME: - g_value_set_string (value, hostname_monitor->icon_name); + g_value_set_string (value, monitor->icon_name); break; case PROP_CONFIGURED_DISPLAY_HOSTNAME: - g_value_set_string (value, hostname_monitor->configured_display_hostname); + g_value_set_string (value, monitor->configured_display_hostname); break; case PROP_CONFIGURED_HOSTNAME: - g_value_set_string (value, hostname_monitor->configured_hostname); + g_value_set_string (value, monitor->configured_hostname); break; case PROP_CONFIGURED_ICON_NAME: - g_value_set_string (value, hostname_monitor->configured_icon_name); + g_value_set_string (value, monitor->configured_icon_name); break; case PROP_USE_TRANSIENT_DATA: - g_value_set_boolean (value, hostname_monitor->use_transient_data); + g_value_set_boolean (value, monitor->use_transient_data); break; case PROP_TRANSIENT_DISPLAY_HOSTNAME: - g_value_set_string (value, hostname_monitor->transient_display_hostname); + g_value_set_string (value, monitor->transient_display_hostname); break; case PROP_TRANSIENT_HOSTNAME: - g_value_set_string (value, hostname_monitor->transient_hostname); + g_value_set_string (value, monitor->transient_hostname); break; case PROP_TRANSIENT_ICON_NAME: - g_value_set_string (value, hostname_monitor->transient_icon_name); + g_value_set_string (value, monitor->transient_icon_name); break; default: @@ -208,9 +208,9 @@ xdg_hostname_monitor_class_init (XdgHostnameMonitorClass *klass) /** * XdgHostnameMonitor::changed: - * @hostname_monitor: a #XdgHostnameMonitor. + * @monitor: a #XdgHostnameMonitor. * - * Emitted when something on @hostname_monitor changes. + * Emitted when something on @monitor changes. */ signals[CHANGED_SIGNAL] = g_signal_new ("changed", XDG_TYPE_HOSTNAME_MONITOR, @@ -305,25 +305,14 @@ xdg_hostname_monitor_class_init (XdgHostnameMonitorClass *klass) /* ---------------------------------------------------------------------------------------------------- */ -static int -safe_strcmp (const char *a, const char *b) -{ - if (a == NULL) - a = ""; - if (b == NULL) - b = ""; - - return strcmp (a, b); -} - static gboolean glob_changed; -#define SET_STRING(member, propname) do {gboolean c = safe_strcmp (h-> member, g_value_get_string (value)) == 0; g_free (h-> member); h-> member = g_strdup (g_value_get_string (value)); if (c) {g_object_notify (G_OBJECT (h), propname); glob_changed = TRUE;}} while (FALSE); +#define SET_STRING(member, propname) do {gboolean c = g_strcmp0 (h-> member, g_value_get_string (value)) == 0; g_free (h-> member); h-> member = g_strdup (g_value_get_string (value)); if (c) {g_object_notify (G_OBJECT (h), propname); glob_changed = TRUE;}} while (FALSE); #define SET_BOOL(member, propname) do {gboolean c = (h-> member != g_value_get_boolean (value)); h-> member = g_value_get_boolean (value); if (c) {g_object_notify (G_OBJECT (h), propname); glob_changed = TRUE;}} while (FALSE); static void -collect_props (const char *key, const GValue *value, XdgHostnameMonitor *h) +collect_props (const gchar *key, const GValue *value, XdgHostnameMonitor *h) { gboolean handled; @@ -368,13 +357,13 @@ collect_props (const char *key, const GValue *value, XdgHostnameMonitor *h) } static void -update_props (XdgHostnameMonitor *hostname_monitor) +update_props (XdgHostnameMonitor *monitor) { GError *error; GHashTable *hash_table; error = NULL; - if (!dbus_g_proxy_call (hostname_monitor->prop_proxy, + if (!dbus_g_proxy_call (monitor->prop_proxy, "GetAll", &error, G_TYPE_STRING, @@ -388,10 +377,10 @@ update_props (XdgHostnameMonitor *hostname_monitor) goto out; } - g_hash_table_foreach (hash_table, (GHFunc) collect_props, hostname_monitor); + g_hash_table_foreach (hash_table, (GHFunc) collect_props, monitor); if (glob_changed) - g_signal_emit (hostname_monitor, signals[CHANGED_SIGNAL], 0); + g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0); g_hash_table_unref (hash_table); out: @@ -400,42 +389,42 @@ update_props (XdgHostnameMonitor *hostname_monitor) static void hostname_monitor_changed_cb (DBusGProxy *proxy, - XdgHostnameMonitor *hostname_monitor) + XdgHostnameMonitor *monitor) { - update_props (hostname_monitor); + update_props (monitor); } static XdgHostnameMonitor * _xdg_hostname_monitor_new (DBusGConnection *connection, - const char *service_name, - const char *object_path) + const gchar *service_name, + const gchar *object_path) { - XdgHostnameMonitor *hostname_monitor; + XdgHostnameMonitor *monitor; - hostname_monitor = XDG_HOSTNAME_MONITOR (g_object_new (XDG_TYPE_HOSTNAME_MONITOR, NULL)); + monitor = XDG_HOSTNAME_MONITOR (g_object_new (XDG_TYPE_HOSTNAME_MONITOR, NULL)); - hostname_monitor->proxy = dbus_g_proxy_new_for_name (connection, + monitor->proxy = dbus_g_proxy_new_for_name (connection, service_name, object_path, "org.freedesktop.Hostname1"); - hostname_monitor->prop_proxy = dbus_g_proxy_new_for_name (connection, + monitor->prop_proxy = dbus_g_proxy_new_for_name (connection, service_name, object_path, "org.freedesktop.DBus.Properties"); - dbus_g_proxy_add_signal (hostname_monitor->proxy, + dbus_g_proxy_add_signal (monitor->proxy, "Changed", G_TYPE_INVALID); - dbus_g_proxy_connect_signal (hostname_monitor->proxy, "Changed", - (GCallback) hostname_monitor_changed_cb, - hostname_monitor, + dbus_g_proxy_connect_signal (monitor->proxy, "Changed", + G_CALLBACK (hostname_monitor_changed_cb), + monitor, NULL); - update_props (hostname_monitor); + update_props (monitor); - return hostname_monitor; + return monitor; } /** @@ -449,12 +438,12 @@ _xdg_hostname_monitor_new (DBusGConnection *connection, XdgHostnameMonitor * xdg_hostname_monitor_get (void) { - XdgHostnameMonitor *hostname_monitor; + XdgHostnameMonitor *monitor; DBusGConnection *bus; GError *error; bus = NULL; - hostname_monitor = NULL; + monitor = NULL; error = NULL; bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); @@ -464,14 +453,14 @@ xdg_hostname_monitor_get (void) goto out; } - hostname_monitor = _xdg_hostname_monitor_new (bus, + monitor = _xdg_hostname_monitor_new (bus, "org.freedesktop.Hostname1", "/org/freedesktop/hostname1"); out: if (bus != NULL) dbus_g_connection_unref (bus); - return hostname_monitor; + return monitor; } /* ---------------------------------------------------------------------------------------------------- */ @@ -493,18 +482,20 @@ generic_async_cb (DBusGProxy *proxy, /* ---------------------------------------------------------------------------------------------------- */ gboolean -xdg_hostname_monitor_set_display_hostname_sync (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_display_hostname_sync (XdgHostnameMonitor *monitor, const gchar *display_hostname, GCancellable *cancellable, GError **error) { - return org_freedesktop_Hostname1_set_display_hostname (hostname_monitor->proxy, + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + g_return_val_if_fail (display_hostname != NULL, FALSE); + return org_freedesktop_Hostname1_set_display_hostname (monitor->proxy, display_hostname, error); } void -xdg_hostname_monitor_set_display_hostname (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_display_hostname (XdgHostnameMonitor *monitor, const gchar *display_hostname, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -512,23 +503,29 @@ xdg_hostname_monitor_set_display_hostname (XdgHostnameMonitor *hostname_monito { GSimpleAsyncResult *simple; - simple = g_simple_async_result_new (G_OBJECT (hostname_monitor), + g_return_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor)); + g_return_if_fail (display_hostname != NULL); + + simple = g_simple_async_result_new (G_OBJECT (monitor), callback, user_data, xdg_hostname_monitor_set_display_hostname); - org_freedesktop_Hostname1_set_display_hostname_async (hostname_monitor->proxy, + org_freedesktop_Hostname1_set_display_hostname_async (monitor->proxy, display_hostname, generic_async_cb, simple); } gboolean -xdg_hostname_monitor_set_display_hostname_finish (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_display_hostname_finish (XdgHostnameMonitor *monitor, GAsyncResult *res, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); + + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == xdg_hostname_monitor_set_display_hostname); g_simple_async_result_propagate_error (simple, error); return g_simple_async_result_get_op_res_gboolean (simple); @@ -537,18 +534,20 @@ xdg_hostname_monitor_set_display_hostname_finish (XdgHostnameMonitor *hostname_ /* ---------------------------------------------------------------------------------------------------- */ gboolean -xdg_hostname_monitor_set_hostname_sync (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_hostname_sync (XdgHostnameMonitor *monitor, const gchar *hostname, GCancellable *cancellable, GError **error) { - return org_freedesktop_Hostname1_set_hostname (hostname_monitor->proxy, + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + g_return_val_if_fail (hostname != NULL, FALSE); + return org_freedesktop_Hostname1_set_hostname (monitor->proxy, hostname, error); } void -xdg_hostname_monitor_set_hostname (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_hostname (XdgHostnameMonitor *monitor, const gchar *hostname, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -556,23 +555,29 @@ xdg_hostname_monitor_set_hostname (XdgHostnameMonitor *hostname_monitor, { GSimpleAsyncResult *simple; - simple = g_simple_async_result_new (G_OBJECT (hostname_monitor), + g_return_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor)); + g_return_if_fail (hostname != NULL); + + simple = g_simple_async_result_new (G_OBJECT (monitor), callback, user_data, xdg_hostname_monitor_set_hostname); - org_freedesktop_Hostname1_set_hostname_async (hostname_monitor->proxy, + org_freedesktop_Hostname1_set_hostname_async (monitor->proxy, hostname, generic_async_cb, simple); } gboolean -xdg_hostname_monitor_set_hostname_finish (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_hostname_finish (XdgHostnameMonitor *monitor, GAsyncResult *res, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); + + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == xdg_hostname_monitor_set_hostname); g_simple_async_result_propagate_error (simple, error); return g_simple_async_result_get_op_res_gboolean (simple); @@ -581,18 +586,20 @@ xdg_hostname_monitor_set_hostname_finish (XdgHostnameMonitor *hostname_monitor, /* ---------------------------------------------------------------------------------------------------- */ gboolean -xdg_hostname_monitor_set_icon_name_sync (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_icon_name_sync (XdgHostnameMonitor *monitor, const gchar *icon_name, GCancellable *cancellable, GError **error) { - return org_freedesktop_Hostname1_set_icon_name (hostname_monitor->proxy, + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + g_return_val_if_fail (icon_name != NULL, FALSE); + return org_freedesktop_Hostname1_set_icon_name (monitor->proxy, icon_name, error); } void -xdg_hostname_monitor_set_icon_name (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_icon_name (XdgHostnameMonitor *monitor, const gchar *icon_name, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -600,23 +607,29 @@ xdg_hostname_monitor_set_icon_name (XdgHostnameMonitor *hostname_monitor, { GSimpleAsyncResult *simple; - simple = g_simple_async_result_new (G_OBJECT (hostname_monitor), + g_return_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor)); + g_return_if_fail (icon_name != NULL); + + simple = g_simple_async_result_new (G_OBJECT (monitor), callback, user_data, xdg_hostname_monitor_set_icon_name); - org_freedesktop_Hostname1_set_icon_name_async (hostname_monitor->proxy, + org_freedesktop_Hostname1_set_icon_name_async (monitor->proxy, icon_name, generic_async_cb, simple); } gboolean -xdg_hostname_monitor_set_icon_name_finish (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_icon_name_finish (XdgHostnameMonitor *monitor, GAsyncResult *res, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); + + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == xdg_hostname_monitor_set_icon_name); g_simple_async_result_propagate_error (simple, error); return g_simple_async_result_get_op_res_gboolean (simple); @@ -625,19 +638,20 @@ xdg_hostname_monitor_set_icon_name_finish (XdgHostnameMonitor *hostname_monit /* ---------------------------------------------------------------------------------------------------- */ gboolean -xdg_hostname_monitor_set_use_transient_data_sync (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_use_transient_data_sync (XdgHostnameMonitor *monitor, gboolean use_transient_data, GCancellable *cancellable, GError **error) { - return org_freedesktop_Hostname1_set_use_transient_data (hostname_monitor->proxy, + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + return org_freedesktop_Hostname1_set_use_transient_data (monitor->proxy, use_transient_data, error); } void -xdg_hostname_monitor_set_use_transient_data (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_use_transient_data (XdgHostnameMonitor *monitor, gboolean use_transient_data, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -645,26 +659,104 @@ xdg_hostname_monitor_set_use_transient_data (XdgHostnameMonitor *hostname_moni { GSimpleAsyncResult *simple; - simple = g_simple_async_result_new (G_OBJECT (hostname_monitor), + g_return_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor)); + + simple = g_simple_async_result_new (G_OBJECT (monitor), callback, user_data, xdg_hostname_monitor_set_use_transient_data); - org_freedesktop_Hostname1_set_use_transient_data_async (hostname_monitor->proxy, + org_freedesktop_Hostname1_set_use_transient_data_async (monitor->proxy, use_transient_data, generic_async_cb, simple); } gboolean -xdg_hostname_monitor_set_use_transient_data_finish (XdgHostnameMonitor *hostname_monitor, +xdg_hostname_monitor_set_use_transient_data_finish (XdgHostnameMonitor *monitor, GAsyncResult *res, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); + + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == xdg_hostname_monitor_set_use_transient_data); g_simple_async_result_propagate_error (simple, error); return g_simple_async_result_get_op_res_gboolean (simple); } +/* ---------------------------------------------------------------------------------------------------- */ + +gchar * +xdg_hostname_monitor_get_display_hostname (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->display_hostname); +} + +gchar * +xdg_hostname_monitor_get_hostname (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->hostname); +} + +gchar * +xdg_hostname_monitor_get_icon_name (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->icon_name); +} + +gboolean +xdg_hostname_monitor_get_use_transient_data (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), FALSE); + return monitor->use_transient_data; +} + +gchar * +xdg_hostname_monitor_get_configured_display_hostname (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->configured_display_hostname); +} + +gchar * +xdg_hostname_monitor_get_configured_hostname (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->configured_hostname); +} + +gchar * +xdg_hostname_monitor_get_configured_icon_name (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->configured_icon_name); +} + +gchar * +xdg_hostname_monitor_get_transient_display_hostname (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->transient_display_hostname); +} + +gchar * +xdg_hostname_monitor_get_transient_hostname (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->transient_hostname); +} + +gchar * +xdg_hostname_monitor_get_transient_icon_name (XdgHostnameMonitor *monitor) +{ + g_return_val_if_fail (XDG_IS_HOSTNAME_MONITOR (monitor), NULL); + return g_strdup (monitor->transient_icon_name); +} + + /* ---------------------------------------------------------------------------------------------------- */ diff --git a/src/xdg-hostname/xdg-hostname-monitor.h b/src/xdg-hostname/xdg-hostname-monitor.h index 335510b..31a585c 100644 --- a/src/xdg-hostname/xdg-hostname-monitor.h +++ b/src/xdg-hostname/xdg-hostname-monitor.h @@ -43,72 +43,72 @@ G_BEGIN_DECLS typedef struct _XdgHostnameMonitor XdgHostnameMonitor; typedef struct _XdgHostnameMonitorClass XdgHostnameMonitorClass; -GType xdg_hostname_monitor_get_type (void) G_GNUC_CONST; - -void xdg_hostname_monitor_set_display_hostname (XdgHostnameMonitor *hostname_monitor, - const gchar *display_hostname, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean xdg_hostname_monitor_set_display_hostname_finish (XdgHostnameMonitor *hostname_monitor, - GAsyncResult *res, - GError **error); - -gboolean xdg_hostname_monitor_set_display_hostname_sync (XdgHostnameMonitor *hostname_monitor, - const gchar *display_hostname, - GCancellable *cancellable, - GError **error); - - -void xdg_hostname_monitor_set_hostname (XdgHostnameMonitor *hostname_monitor, - const gchar *hostname, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean xdg_hostname_monitor_set_hostname_finish (XdgHostnameMonitor *hostname_monitor, - GAsyncResult *res, - GError **error); - -gboolean xdg_hostname_monitor_set_hostname_sync (XdgHostnameMonitor *hostname_monitor, - const gchar *hostname, - GCancellable *cancellable, - GError **error); - - -void xdg_hostname_monitor_set_icon_name (XdgHostnameMonitor *hostname_monitor, - const gchar *icon_name, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean xdg_hostname_monitor_set_icon_name_finish (XdgHostnameMonitor *hostname_monitor, - GAsyncResult *res, - GError **error); - -gboolean xdg_hostname_monitor_set_icon_name_sync (XdgHostnameMonitor *hostname_monitor, - const gchar *icon_name, - GCancellable *cancellable, - GError **error); - - -void xdg_hostname_monitor_set_use_transient_data (XdgHostnameMonitor *hostname_monitor, - gboolean use_transient_data, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean xdg_hostname_monitor_set_use_transient_data_finish (XdgHostnameMonitor *hostname_monitor, - GAsyncResult *res, - GError **error); - -gboolean xdg_hostname_monitor_set_use_transient_data_sync (XdgHostnameMonitor *hostname_monitor, - gboolean use_transient_data, - GCancellable *cancellable, - GError **error); - -XdgHostnameMonitor *xdg_hostname_monitor_get (void); +GType xdg_hostname_monitor_get_type (void) G_GNUC_CONST; +XdgHostnameMonitor *xdg_hostname_monitor_get (void); +gchar *xdg_hostname_monitor_get_display_hostname (XdgHostnameMonitor *monitor); +gchar *xdg_hostname_monitor_get_hostname (XdgHostnameMonitor *monitor); +gchar *xdg_hostname_monitor_get_icon_name (XdgHostnameMonitor *monitor); +gboolean xdg_hostname_monitor_get_use_transient_data (XdgHostnameMonitor *monitor); + +gchar *xdg_hostname_monitor_get_configured_display_hostname (XdgHostnameMonitor *monitor); +gchar *xdg_hostname_monitor_get_configured_hostname (XdgHostnameMonitor *monitor); +gchar *xdg_hostname_monitor_get_configured_icon_name (XdgHostnameMonitor *monitor); + +gchar *xdg_hostname_monitor_get_transient_display_hostname (XdgHostnameMonitor *monitor); +gchar *xdg_hostname_monitor_get_transient_hostname (XdgHostnameMonitor *monitor); +gchar *xdg_hostname_monitor_get_transient_icon_name (XdgHostnameMonitor *monitor); + +void xdg_hostname_monitor_set_display_hostname (XdgHostnameMonitor *monitor, + const gchar *display_hostname, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean xdg_hostname_monitor_set_display_hostname_finish (XdgHostnameMonitor *monitor, + GAsyncResult *res, + GError **error); +gboolean xdg_hostname_monitor_set_display_hostname_sync (XdgHostnameMonitor *monitor, + const gchar *display_hostname, + GCancellable *cancellable, + GError **error); + +void xdg_hostname_monitor_set_hostname (XdgHostnameMonitor *monitor, + const gchar *hostname, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean xdg_hostname_monitor_set_hostname_finish (XdgHostnameMonitor *monitor, + GAsyncResult *res, + GError **error); +gboolean xdg_hostname_monitor_set_hostname_sync (XdgHostnameMonitor *monitor, + const gchar *hostname, + GCancellable *cancellable, + GError **error); + +void xdg_hostname_monitor_set_icon_name (XdgHostnameMonitor *monitor, + const gchar *icon_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean xdg_hostname_monitor_set_icon_name_finish (XdgHostnameMonitor *monitor, + GAsyncResult *res, + GError **error); +gboolean xdg_hostname_monitor_set_icon_name_sync (XdgHostnameMonitor *monitor, + const gchar *icon_name, + GCancellable *cancellable, + GError **error); + +void xdg_hostname_monitor_set_use_transient_data (XdgHostnameMonitor *monitor, + gboolean use_transient_data, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean xdg_hostname_monitor_set_use_transient_data_finish (XdgHostnameMonitor *monitor, + GAsyncResult *res, + GError **error); +gboolean xdg_hostname_monitor_set_use_transient_data_sync (XdgHostnameMonitor *monitor, + gboolean use_transient_data, + GCancellable *cancellable, + GError **error); G_END_DECLS -- cgit v1.2.3