diff -Nru libdesktop-agnostic-0.3.90/debian/bzr-builder.manifest libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/bzr-builder.manifest --- libdesktop-agnostic-0.3.90/debian/bzr-builder.manifest 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/bzr-builder.manifest 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1,2 @@ +# bzr-builder format 0.2 deb-version 0.3.91~bzr423+201010132105 +lp:~awn-core/libdesktop-agnostic/various-fixes revid:gilir@ubuntu.com-20101013210044-b6aqdffx15nk9d7w diff -Nru libdesktop-agnostic-0.3.90/debian/changelog libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/changelog --- libdesktop-agnostic-0.3.90/debian/changelog 2010-09-24 00:02:04.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/changelog 2010-10-13 21:05:39.000000000 +0000 @@ -1,87 +1,11 @@ -libdesktop-agnostic (0.3.90-2ubuntu1~ppa2) maverick; urgency=low +libdesktop-agnostic (0.3.91~bzr423+201010132105~maverick1) experimental; urgency=low - * debian/patches/01-keyfile-creation.patch - - Fix unwanted exception during keyfile creation. - * debian/patches/02-vala-compatibility-*.patch - - Fix compatibility with recent Vala version. - * debian/patches/03-python-bindings-leak.patch - - Fix leaks in python bindings. - * debian/patches/04-fix-focus-editor.patch - - Fix focus chain in launcher editor. - * debian/patches/05-theme-selection.patch - - Make theme selection active by default in IconChooserDialog, - support resize, implement lazy pixbuf loading. - * debian/patches/06-fix-FTBFS-thunar.patch - - Fix FTBFS for thunar support. - * debian/patches/07-disable-GI.patch - - Add flag to disable gobject-introspection. - * debian/rules: - - Pass --disable-gi to fix FTBFS with gobject-introspection. + * Auto build. - -- Julien Lavergne Wed, 22 Sep 2010 13:19:14 +0200 + -- Julien Lavergne Wed, 13 Oct 2010 21:05:39 +0000 -libdesktop-agnostic (0.3.90-2) unstable; urgency=low +libdesktop-agnostic (0.0.1-1) experimental; urgency=low - * Upload to unstable. + * Initial release. Closes: #560367 - -- Julien Lavergne Sat, 05 Jun 2010 19:44:09 +0200 - -libdesktop-agnostic (0.3.90-1) experimental; urgency=low - - * Initial upload on Debian (Closes: #560367) - * debian/control: - + Update my email address. - + Bump Standards-Version to 3.8.4 (no change needed). - * debian/rules: Wrap configure flags. - * debian/libdesktop-agnostic0.symbols: Add. - * Remove 01-awn-fixes.patch. - * Add documentation - - debian/control: - + Add build-depends on python-sphinx. - + Add libdesktop-agnostic-doc binary. - - debian/rules: - + Add --enable-docs. - + Add sphinx.pyc to the clean target. - - libdesktop-agnostic-doc.install: Install the documentation. - - libdesktop-agnostic-doc.{links,doc-base}: Add doc-base support. - - -- Julien Lavergne Fri, 30 Apr 2010 22:48:28 +0200 - -libdesktop-agnostic (0.3.90-0ubuntu1) lucid; urgency=low - - * New upstream official release, replacing the patched bzr snapshot. - (LP: #565340) - - Fix support on non-english system. - - Ship generated .c files to avoid breakage with new Vala versions. - * debian/patches/01-awn-fixes.patch: Merged usptream. - - -- Julien Lavergne Sun, 18 Apr 2010 01:46:37 +0200 - -libdesktop-agnostic (0.0.1~bzr383-0ubuntu3) lucid; urgency=low - - * debian/patches/01-awn-fixes.patch: Various fixes from Michal Hruby - - Fix memory leaks - - Fix FTBFS - - Port to Vala 0.7.10 - - Fixes for keyfile backend - - Minor cleanup - * debian/control: - - Build-depends on vala >= 0.7.10 - - Build-depends on gir-repository-dev to retrieve Gdk-2.0.gir. - * Switch to dpkg-source 3.0 (quilt) format - - -- Julien Lavergne Sat, 20 Mar 2010 12:24:33 +0100 - -libdesktop-agnostic (0.0.1~bzr383-0ubuntu2) lucid; urgency=low - - * No-change rebuild against libgnome-desktop-2-17. libgnome-desktop-2-11 is - NBS. - - -- Martin Pitt Mon, 08 Mar 2010 17:11:06 +0100 - -libdesktop-agnostic (0.0.1~bzr383-0ubuntu1) lucid; urgency=low - - * Initial release. LP: #496307 - * Pack upstream snapshot without debian directory. - - -- Julien Lavergne Fri, 01 Jan 2010 23:33:31 +0100 + -- Mark Lee Sat, 02 Jan 2010 17:52:15 +0100 diff -Nru libdesktop-agnostic-0.3.90/debian/control libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/control --- libdesktop-agnostic-0.3.90/debian/control 2010-09-22 12:02:56.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/control 2010-10-13 21:05:39.000000000 +0000 @@ -1,15 +1,18 @@ Source: libdesktop-agnostic Section: libs Priority: extra -Maintainer: Julien Lavergne +Maintainer: Mark Lee Build-Depends: debhelper (>= 7.0.50~), # for waf python, # "real" deps + intltool, valac (>= 0.7.10), gobject-introspection (>= 0.6.3), + gir-repository-dev (>= 0.6.3) | gobject-introspection-glib-2.0, + gir-repository-dev (>= 0.6.3) | gobject-introspection-freedesktop, + gir-repository-dev (>= 0.6.3) | gobject-introspection-repository, libgirepository1.0-dev (>= 0.6.3), - gir-repository-dev (>= 0.6.3), libglib2.0-dev (>= 2.16.0), libgtk2.0-dev, libgladeui-1-dev, @@ -27,7 +30,7 @@ libdbus-glib-1-dev, libgnomevfs2-dev, libgnome-desktop-dev, -Standards-Version: 3.8.4 +Standards-Version: 3.8.3 Homepage: https://launchpad.net/libdesktop-agnostic Package: libdesktop-agnostic0 @@ -172,12 +175,10 @@ . This package contains the development files for the core library. -Package: libdesktop-agnostic-doc +Package: libdesktop-agnostic0-doc Architecture: all -Section: doc Depends: ${shlibs:Depends}, - ${misc:Depends}, - libjs-jquery + ${misc:Depends} Description: Documentation for libdesktop-agnostic This library provides an extensible configuration API, a unified virtual file system API, and a desktop item editor (all with pluggable backends) for @@ -192,6 +193,8 @@ ${misc:Depends}, libdesktop-agnostic0 (= ${binary:Version}) Recommends: gobject-introspection, libdesktop-agnostic-dev +Conflicts: gobject-introspection-libdesktop-agnostic +Replaces: gobject-introspection-libdesktop-agnostic Description: GObject Introspection data for libdesktop-agnostic This library provides an extensible configuration API, a unified virtual file system API, and a desktop item editor (all with pluggable backends) for @@ -223,6 +226,8 @@ libdesktop-agnostic0 (>= ${binary:Version}), ${python:Depends} Provides: ${python:Provides} +Conflicts: python-libdesktop-agnostic +Replaces: python-libdesktop-agnostic XB-Python-Version: ${python:Versions} Description: Python bindings for libdesktop-agnostic This library provides an extensible configuration API, a unified virtual file @@ -237,6 +242,8 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, libdesktop-agnostic0 (>= ${source:Version}) +Conflicts: vala-libdesktop-agnostic +Replaces: vala-libdesktop-agnostic Description: Vala bindings for libdesktop-agnostic This library provides an extensible configuration API, a unified virtual file system API, and a desktop item editor (all with pluggable backends) for diff -Nru libdesktop-agnostic-0.3.90/debian/copyright libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/copyright --- libdesktop-agnostic-0.3.90/debian/copyright 2010-04-30 20:50:09.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/copyright 2010-10-13 21:05:39.000000000 +0000 @@ -38,31 +38,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -Files: waf -Copyright: Thomas Nagy, 2005-2009 -Licence: other - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - Files: debian/* Copyright: 2008-2009 Mark Lee , 2008-2009 Julien Lavergne diff -Nru libdesktop-agnostic-0.3.90/debian/gir1.0-desktopagnostic-1.0.install libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/gir1.0-desktopagnostic-1.0.install --- libdesktop-agnostic-0.3.90/debian/gir1.0-desktopagnostic-1.0.install 2010-09-24 00:11:32.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/gir1.0-desktopagnostic-1.0.install 2010-10-13 21:05:39.000000000 +0000 @@ -1,2 +1,2 @@ -#usr/lib/girepository-1.0 -#usr/share/gir-1.0 +usr/lib/girepository-1.0 +usr/share/gir-1.0 diff -Nru libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic0-doc.install libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic0-doc.install --- libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic0-doc.install 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic0-doc.install 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1 @@ +usr/share/doc/libdesktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic0.install libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic0.install --- libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic0.install 2010-03-20 11:24:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic0.install 2010-10-13 21:05:39.000000000 +0000 @@ -1,4 +1,5 @@ usr/lib/desktop-agnostic/modules/libda-cfg-type-color.so usr/lib/desktop-agnostic/modules/libda-module-guesser.so usr/lib/*.so.0* +usr/share/locale/ usr/etc/xdg etc/ diff -Nru libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic0.symbols libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic0.symbols --- libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic0.symbols 2010-04-18 16:34:07.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic0.symbols 1970-01-01 00:00:00.000000000 +0000 @@ -1,313 +0,0 @@ -libdesktop-agnostic-cfg.so.0 libdesktop-agnostic0 #MINVER# - desktop_agnostic_config_backend_construct@Base 0.3.90 - desktop_agnostic_config_backend_get_backend_metadata_keys@Base 0.3.90 - desktop_agnostic_config_backend_get_bool@Base 0.3.90 - desktop_agnostic_config_backend_get_float@Base 0.3.90 - desktop_agnostic_config_backend_get_float_from_value@Base 0.3.90 - desktop_agnostic_config_backend_get_instance_id@Base 0.3.90 - desktop_agnostic_config_backend_get_int@Base 0.3.90 - desktop_agnostic_config_backend_get_int_from_value@Base 0.3.90 - desktop_agnostic_config_backend_get_list@Base 0.3.90 - desktop_agnostic_config_backend_get_name@Base 0.3.90 - desktop_agnostic_config_backend_get_schema@Base 0.3.90 - desktop_agnostic_config_backend_get_string@Base 0.3.90 - desktop_agnostic_config_backend_get_type@Base 0.3.90 - desktop_agnostic_config_backend_get_value@Base 0.3.90 - desktop_agnostic_config_backend_notify@Base 0.3.90 - desktop_agnostic_config_backend_notify_add@Base 0.3.90 - desktop_agnostic_config_backend_notify_remove@Base 0.3.90 - desktop_agnostic_config_backend_remove@Base 0.3.90 - desktop_agnostic_config_backend_reset@Base 0.3.90 - desktop_agnostic_config_backend_set_bool@Base 0.3.90 - desktop_agnostic_config_backend_set_float@Base 0.3.90 - desktop_agnostic_config_backend_set_int@Base 0.3.90 - desktop_agnostic_config_backend_set_list@Base 0.3.90 - desktop_agnostic_config_backend_set_string@Base 0.3.90 - desktop_agnostic_config_backend_set_value@Base 0.3.90 - desktop_agnostic_config_bind_method_get_type@Base 0.3.90 - desktop_agnostic_config_binding_construct@Base 0.3.90 - desktop_agnostic_config_binding_get_type@Base 0.3.90 - desktop_agnostic_config_binding_list_wrapper_construct@Base 0.3.90 - desktop_agnostic_config_binding_list_wrapper_get_type@Base 0.3.90 - desktop_agnostic_config_binding_list_wrapper_new@Base 0.3.90 - desktop_agnostic_config_binding_new@Base 0.3.90 - desktop_agnostic_config_binding_notifier_construct@Base 0.3.90 - desktop_agnostic_config_binding_notifier_get_type@Base 0.3.90 - desktop_agnostic_config_binding_notifier_new@Base 0.3.90 - desktop_agnostic_config_binding_notifier_on_list_changed@Base 0.3.90 - desktop_agnostic_config_binding_notifier_on_serialized_object_changed@Base 0.3.90 - desktop_agnostic_config_binding_notifier_on_simple_value_changed@Base 0.3.90 - desktop_agnostic_config_bridge_bind@Base 0.3.90 - desktop_agnostic_config_bridge_get_all_bindings@Base 0.3.90 - desktop_agnostic_config_bridge_get_default@Base 0.3.90 - desktop_agnostic_config_bridge_get_property_spec@Base 0.3.90 - desktop_agnostic_config_bridge_get_type@Base 0.3.90 - desktop_agnostic_config_bridge_remove@Base 0.3.90 - desktop_agnostic_config_bridge_remove_all_for_object@Base 0.3.90 - desktop_agnostic_config_client_bind@Base 0.3.90 - desktop_agnostic_config_client_construct@Base 0.3.90 - desktop_agnostic_config_client_construct_for_instance@Base 0.3.90 - desktop_agnostic_config_client_construct_for_schema@Base 0.3.90 - desktop_agnostic_config_client_get_bool@Base 0.3.90 - desktop_agnostic_config_client_get_float@Base 0.3.90 - desktop_agnostic_config_client_get_instance_id@Base 0.3.90 - desktop_agnostic_config_client_get_int@Base 0.3.90 - desktop_agnostic_config_client_get_list@Base 0.3.90 - desktop_agnostic_config_client_get_string@Base 0.3.90 - desktop_agnostic_config_client_get_type@Base 0.3.90 - desktop_agnostic_config_client_get_value@Base 0.3.90 - desktop_agnostic_config_client_new@Base 0.3.90 - desktop_agnostic_config_client_new_for_instance@Base 0.3.90 - desktop_agnostic_config_client_new_for_schema@Base 0.3.90 - desktop_agnostic_config_client_notify@Base 0.3.90 - desktop_agnostic_config_client_notify_add@Base 0.3.90 - desktop_agnostic_config_client_notify_remove@Base 0.3.90 - desktop_agnostic_config_client_remove_instance@Base 0.3.90 - desktop_agnostic_config_client_reset@Base 0.3.90 - desktop_agnostic_config_client_set_bool@Base 0.3.90 - desktop_agnostic_config_client_set_float@Base 0.3.90 - desktop_agnostic_config_client_set_int@Base 0.3.90 - desktop_agnostic_config_client_set_list@Base 0.3.90 - desktop_agnostic_config_client_set_string@Base 0.3.90 - desktop_agnostic_config_client_set_value@Base 0.3.90 - desktop_agnostic_config_client_unbind@Base 0.3.90 - desktop_agnostic_config_client_unbind_all_for_object@Base 0.3.90 - desktop_agnostic_config_error_quark@Base 0.3.90 - desktop_agnostic_config_get_type@Base 0.3.90 - desktop_agnostic_config_module_type@Base 0.3.90 - desktop_agnostic_config_new@Base 0.3.90 - desktop_agnostic_config_new_for_instance@Base 0.3.90 - desktop_agnostic_config_schema_construct@Base 0.3.90 - desktop_agnostic_config_schema_error_quark@Base 0.3.90 - desktop_agnostic_config_schema_exists@Base 0.3.90 - desktop_agnostic_config_schema_find_type@Base 0.3.90 - desktop_agnostic_config_schema_find_type_by_name@Base 0.3.90 - desktop_agnostic_config_schema_get_app_name@Base 0.3.90 - desktop_agnostic_config_schema_get_groups@Base 0.3.90 - desktop_agnostic_config_schema_get_keys@Base 0.3.90 - desktop_agnostic_config_schema_get_metadata_option@Base 0.3.90 - desktop_agnostic_config_schema_get_option@Base 0.3.90 - desktop_agnostic_config_schema_get_type@Base 0.3.90 - desktop_agnostic_config_schema_new@Base 0.3.90 - desktop_agnostic_config_schema_option_construct@Base 0.3.90 - desktop_agnostic_config_schema_option_get_blacklist@Base 0.3.90 - desktop_agnostic_config_schema_option_get_default_value@Base 0.3.90 - desktop_agnostic_config_schema_option_get_description@Base 0.3.90 - desktop_agnostic_config_schema_option_get_list_type@Base 0.3.90 - desktop_agnostic_config_schema_option_get_lower_boundary@Base 0.3.90 - desktop_agnostic_config_schema_option_get_option_type@Base 0.3.90 - desktop_agnostic_config_schema_option_get_per_instance@Base 0.3.90 - desktop_agnostic_config_schema_option_get_summary@Base 0.3.90 - desktop_agnostic_config_schema_option_get_type@Base 0.3.90 - desktop_agnostic_config_schema_option_get_upper_boundary@Base 0.3.90 - desktop_agnostic_config_schema_option_get_whitelist@Base 0.3.90 - desktop_agnostic_config_schema_option_new@Base 0.3.90 - desktop_agnostic_config_schema_register_type@Base 0.3.90 - desktop_agnostic_config_schema_type_construct@Base 0.3.90 - desktop_agnostic_config_schema_type_deserialize@Base 0.3.90 - desktop_agnostic_config_schema_type_get_name@Base 0.3.90 - desktop_agnostic_config_schema_type_get_schema_type@Base 0.3.90 - desktop_agnostic_config_schema_type_get_type@Base 0.3.90 - desktop_agnostic_config_schema_type_parse_default_list_value@Base 0.3.90 - desktop_agnostic_config_schema_type_parse_default_value@Base 0.3.90 - desktop_agnostic_config_schema_type_serialize@Base 0.3.90 -libdesktop-agnostic-fdo.so.0 libdesktop-agnostic0 #MINVER# - desktop_agnostic_fdo_desktop_entry_error_quark@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_exists@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_boolean@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_entry_type@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_file@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_icon@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_keyfile@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_localestring@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_name@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_string@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_string_list@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_get_type@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_key_exists@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_launch@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_launch_flags_get_type@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_new@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_new_for_data@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_new_for_file@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_new_for_keyfile@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_save@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_boolean@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_data@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_entry_type@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_file@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_icon@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_keyfile@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_localestring@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_name@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_string@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_set_string_list@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_type_get_type@Base 0.3.90 - desktop_agnostic_fdo_desktop_entry_type_to_string@Base 0.3.90 - desktop_agnostic_fdo_get_type@Base 0.3.90 - desktop_agnostic_fdo_module_type@Base 0.3.90 -libdesktop-agnostic-ui.so.0 libdesktop-agnostic0 #MINVER# - desktop_agnostic_ui_color_button_construct@Base 0.3.90 - desktop_agnostic_ui_color_button_construct_with_color@Base 0.3.90 - desktop_agnostic_ui_color_button_get_da_color@Base 0.3.90 - desktop_agnostic_ui_color_button_get_type@Base 0.3.90 - desktop_agnostic_ui_color_button_new@Base 0.3.90 - desktop_agnostic_ui_color_button_new_with_color@Base 0.3.90 - desktop_agnostic_ui_color_button_set_alpha@Base 0.3.90 - desktop_agnostic_ui_color_button_set_color@Base 0.3.90 - desktop_agnostic_ui_color_button_set_da_color@Base 0.3.90 - desktop_agnostic_ui_fixed_table_attach_defaults@Base 0.3.90 - desktop_agnostic_ui_fixed_table_attach_fill@Base 0.3.90 - desktop_agnostic_ui_fixed_table_construct@Base 0.3.90 - desktop_agnostic_ui_fixed_table_get_type@Base 0.3.90 - desktop_agnostic_ui_fixed_table_new@Base 0.3.90 - desktop_agnostic_ui_icon_button_construct@Base 0.3.90 - desktop_agnostic_ui_icon_button_get_icon@Base 0.3.90 - desktop_agnostic_ui_icon_button_get_icon_type@Base 0.3.90 - desktop_agnostic_ui_icon_button_get_type@Base 0.3.90 - desktop_agnostic_ui_icon_button_new@Base 0.3.90 - desktop_agnostic_ui_icon_button_set_icon@Base 0.3.90 - desktop_agnostic_ui_icon_chooser_dialog_construct@Base 0.3.90 - desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon@Base 0.3.90 - desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon_type@Base 0.3.90 - desktop_agnostic_ui_icon_chooser_dialog_get_selected_pixbuf@Base 0.3.90 - desktop_agnostic_ui_icon_chooser_dialog_get_type@Base 0.3.90 - desktop_agnostic_ui_icon_chooser_dialog_new@Base 0.3.90 - desktop_agnostic_ui_icon_type_get_type@Base 0.3.90 - desktop_agnostic_ui_launcher_editor_dialog_construct@Base 0.3.90 - desktop_agnostic_ui_launcher_editor_dialog_get_file@Base 0.3.90 - desktop_agnostic_ui_launcher_editor_dialog_get_output@Base 0.3.90 - desktop_agnostic_ui_launcher_editor_dialog_get_type@Base 0.3.90 - desktop_agnostic_ui_launcher_editor_dialog_new@Base 0.3.90 -libdesktop-agnostic-vfs.so.0 libdesktop-agnostic0 #MINVER# - desktop_agnostic_vfs_access_flags_get_type@Base 0.3.90 - desktop_agnostic_vfs_bookmark_construct@Base 0.3.90 - desktop_agnostic_vfs_bookmark_get_alias@Base 0.3.90 - desktop_agnostic_vfs_bookmark_get_file@Base 0.3.90 - desktop_agnostic_vfs_bookmark_get_type@Base 0.3.90 - desktop_agnostic_vfs_bookmark_new@Base 0.3.90 - desktop_agnostic_vfs_bookmark_set_alias@Base 0.3.90 - desktop_agnostic_vfs_bookmark_set_file@Base 0.3.90 - desktop_agnostic_vfs_file_construct@Base 0.3.90 - desktop_agnostic_vfs_file_copy@Base 0.3.90 - desktop_agnostic_vfs_file_enumerate_children@Base 0.3.90 - desktop_agnostic_vfs_file_error_quark@Base 0.3.90 - desktop_agnostic_vfs_file_exists@Base 0.3.90 - desktop_agnostic_vfs_file_get_access_flags@Base 0.3.90 - desktop_agnostic_vfs_file_get_file_type@Base 0.3.90 - desktop_agnostic_vfs_file_get_impl_path@Base 0.3.90 - desktop_agnostic_vfs_file_get_impl_uri@Base 0.3.90 - desktop_agnostic_vfs_file_get_implementation@Base 0.3.90 - desktop_agnostic_vfs_file_get_parent@Base 0.3.90 - desktop_agnostic_vfs_file_get_path@Base 0.3.90 - desktop_agnostic_vfs_file_get_type@Base 0.3.90 - desktop_agnostic_vfs_file_get_uri@Base 0.3.90 - desktop_agnostic_vfs_file_init@Base 0.3.90 - desktop_agnostic_vfs_file_is_executable@Base 0.3.90 - desktop_agnostic_vfs_file_is_readable@Base 0.3.90 - desktop_agnostic_vfs_file_is_writable@Base 0.3.90 - desktop_agnostic_vfs_file_launch@Base 0.3.90 - desktop_agnostic_vfs_file_load_contents@Base 0.3.90 - desktop_agnostic_vfs_file_monitor@Base 0.3.90 - desktop_agnostic_vfs_file_monitor_cancel@Base 0.3.90 - desktop_agnostic_vfs_file_monitor_emit@Base 0.3.90 - desktop_agnostic_vfs_file_monitor_event_get_type@Base 0.3.90 - desktop_agnostic_vfs_file_monitor_get_cancelled@Base 0.3.90 - desktop_agnostic_vfs_file_monitor_get_type@Base 0.3.90 - desktop_agnostic_vfs_file_new_for_path@Base 0.3.90 - desktop_agnostic_vfs_file_new_for_uri@Base 0.3.90 - desktop_agnostic_vfs_file_remove@Base 0.3.90 - desktop_agnostic_vfs_file_replace_contents@Base 0.3.90 - desktop_agnostic_vfs_file_type_get_type@Base 0.3.90 - desktop_agnostic_vfs_files_from_uri_list@Base 0.3.90 - desktop_agnostic_vfs_get_default@Base 0.3.90 - desktop_agnostic_vfs_glob_append@Base 0.3.90 - desktop_agnostic_vfs_glob_construct@Base 0.3.90 - desktop_agnostic_vfs_glob_error_quark@Base 0.3.90 - desktop_agnostic_vfs_glob_execute@Base 0.3.90 - desktop_agnostic_vfs_glob_execute_with_flags@Base 0.3.90 - desktop_agnostic_vfs_glob_get_flags@Base 0.3.90 - desktop_agnostic_vfs_glob_get_offset@Base 0.3.90 - desktop_agnostic_vfs_glob_get_paths@Base 0.3.90 - desktop_agnostic_vfs_glob_get_pattern@Base 0.3.90 - desktop_agnostic_vfs_glob_get_type@Base 0.3.90 - desktop_agnostic_vfs_glob_new@Base 0.3.90 - desktop_agnostic_vfs_glob_set_flags@Base 0.3.90 - desktop_agnostic_vfs_glob_set_pattern@Base 0.3.90 - desktop_agnostic_vfs_gtk_bookmarks_construct@Base 0.3.90 - desktop_agnostic_vfs_gtk_bookmarks_get_bookmarks@Base 0.3.90 - desktop_agnostic_vfs_gtk_bookmarks_get_type@Base 0.3.90 - desktop_agnostic_vfs_gtk_bookmarks_new@Base 0.3.90 - desktop_agnostic_vfs_implementation_files_from_uri_list@Base 0.3.90 - desktop_agnostic_vfs_implementation_get_file_monitor_type@Base 0.3.90 - desktop_agnostic_vfs_implementation_get_file_type@Base 0.3.90 - desktop_agnostic_vfs_implementation_get_name@Base 0.3.90 - desktop_agnostic_vfs_implementation_get_trash_type@Base 0.3.90 - desktop_agnostic_vfs_implementation_get_type@Base 0.3.90 - desktop_agnostic_vfs_implementation_get_volume_type@Base 0.3.90 - desktop_agnostic_vfs_implementation_init@Base 0.3.90 - desktop_agnostic_vfs_implementation_shutdown@Base 0.3.90 - desktop_agnostic_vfs_implementation_volume_monitor_get_default@Base 0.3.90 - desktop_agnostic_vfs_init@Base 0.3.90 - desktop_agnostic_vfs_shutdown@Base 0.3.90 - desktop_agnostic_vfs_trash@Base 0.3.90 - desktop_agnostic_vfs_trash_empty@Base 0.3.90 - desktop_agnostic_vfs_trash_get_default@Base 0.3.90 - desktop_agnostic_vfs_trash_get_file_count@Base 0.3.90 - desktop_agnostic_vfs_trash_get_type@Base 0.3.90 - desktop_agnostic_vfs_trash_send_to_trash@Base 0.3.90 - desktop_agnostic_vfs_vfs@Base 0.3.90 - desktop_agnostic_vfs_volume_can_eject@Base 0.3.90 - desktop_agnostic_vfs_volume_eject@Base 0.3.90 - desktop_agnostic_vfs_volume_eject_finish@Base 0.3.90 - desktop_agnostic_vfs_volume_error_quark@Base 0.3.90 - desktop_agnostic_vfs_volume_get_icon@Base 0.3.90 - desktop_agnostic_vfs_volume_get_name@Base 0.3.90 - desktop_agnostic_vfs_volume_get_type@Base 0.3.90 - desktop_agnostic_vfs_volume_get_uri@Base 0.3.90 - desktop_agnostic_vfs_volume_is_mounted@Base 0.3.90 - desktop_agnostic_vfs_volume_monitor_get_default@Base 0.3.90 - desktop_agnostic_vfs_volume_monitor_get_implementation@Base 0.3.90 - desktop_agnostic_vfs_volume_monitor_get_type@Base 0.3.90 - desktop_agnostic_vfs_volume_monitor_get_volumes@Base 0.3.90 - desktop_agnostic_vfs_volume_mount@Base 0.3.90 - desktop_agnostic_vfs_volume_mount_finish@Base 0.3.90 - desktop_agnostic_vfs_volume_unmount@Base 0.3.90 - desktop_agnostic_vfs_volume_unmount_finish@Base 0.3.90 -libdesktop-agnostic.so.0 libdesktop-agnostic0 #MINVER# - desktop_agnostic_color_cairo_value_to_gdk@Base 0.3.90 - desktop_agnostic_color_construct@Base 0.3.90 - desktop_agnostic_color_construct_from_string@Base 0.3.90 - desktop_agnostic_color_construct_from_values@Base 0.3.90 - desktop_agnostic_color_gdk_value_to_cairo@Base 0.3.90 - desktop_agnostic_color_get_alpha@Base 0.3.90 - desktop_agnostic_color_get_blue@Base 0.3.90 - desktop_agnostic_color_get_cairo_color@Base 0.3.90 - desktop_agnostic_color_get_color@Base 0.3.90 - desktop_agnostic_color_get_green@Base 0.3.90 - desktop_agnostic_color_get_red@Base 0.3.90 - desktop_agnostic_color_get_type@Base 0.3.90 - desktop_agnostic_color_new@Base 0.3.90 - desktop_agnostic_color_new_from_string@Base 0.3.90 - desktop_agnostic_color_new_from_values@Base 0.3.90 - desktop_agnostic_color_parse_error_quark@Base 0.3.90 - desktop_agnostic_color_set_alpha@Base 0.3.90 - desktop_agnostic_color_set_blue@Base 0.3.90 - desktop_agnostic_color_set_cairo_color@Base 0.3.90 - desktop_agnostic_color_set_color@Base 0.3.90 - desktop_agnostic_color_set_green@Base 0.3.90 - desktop_agnostic_color_set_red@Base 0.3.90 - desktop_agnostic_color_to_html_color@Base 0.3.90 - desktop_agnostic_color_to_string@Base 0.3.90 - desktop_agnostic_debug_msg@Base 0.3.90 - desktop_agnostic_get_module_type@Base 0.3.90 - desktop_agnostic_module_config@Base 0.3.90 - desktop_agnostic_module_error_quark@Base 0.3.90 - desktop_agnostic_module_loader_get_default@Base 0.3.90 - desktop_agnostic_module_loader_get_search_paths@Base 0.3.90 - desktop_agnostic_module_loader_get_type@Base 0.3.90 - desktop_agnostic_module_loader_guess_module@Base 0.3.90 - desktop_agnostic_module_loader_is_guess_module_loaded@Base 0.3.90 - desktop_agnostic_module_loader_load@Base 0.3.90 - desktop_agnostic_module_loader_load_from_path@Base 0.3.90 - desktop_agnostic_modules@Base 0.3.90 diff -Nru libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic-doc.doc-base libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic-doc.doc-base --- libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic-doc.doc-base 2010-04-18 16:28:53.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic-doc.doc-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -Document: libdesktop-agnostic -Title: Libdesktop-agnostic Reference Manual -Author: Mark Lee -Abstract: Libdesktop-agnostic provides an extensible configuration API, a unified virtual file system API, and a desktop item editor (all with pluggable backends) for GLib-based projects. It is not tied to any one desktop environment, although there are desktop-specific modules. -Section: Programming/Vala - -Format: HTML -Index: /usr/share/doc/libdesktop-agnostic/index.html -Files: /usr/share/doc/libdesktop-agnostic/*.html diff -Nru libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic-doc.install libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic-doc.install --- libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic-doc.install 2010-04-18 10:46:12.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic-doc.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/share/doc/libdesktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic-doc.links libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic-doc.links --- libdesktop-agnostic-0.3.90/debian/libdesktop-agnostic-doc.links 2010-04-18 16:49:55.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/libdesktop-agnostic-doc.links 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -usr/share/doc/libdesktop-agnostic usr/share/gtk-doc/html/libdesktop-agnostic -usr/share/javascript/jquery/jquery.js usr/share/doc/libdesktop-agnostic/_static/jquery.js diff -Nru libdesktop-agnostic-0.3.90/debian/patches/01-keyfile-creation.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/01-keyfile-creation.patch --- libdesktop-agnostic-0.3.90/debian/patches/01-keyfile-creation.patch 2010-09-22 11:47:02.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/01-keyfile-creation.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 403 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Sun 2010-04-18 23:09:45 +0300 -message: - Fix unwanted exception during keyfile creation ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/config-impl-keyfile.vala' ---- a/libdesktop-agnostic/config-impl-keyfile.vala 2009-10-21 18:48:42 +0000 -+++ b/libdesktop-agnostic/config-impl-keyfile.vala 2010-04-18 20:09:45 +0000 -@@ -697,6 +697,10 @@ - - if (value.n_values == 0) - { -+ if (!this._data.has_group (group)) -+ { -+ return; -+ } - if (this._data.has_key (group, key)) - { - // set_*_list() doesn't like NULL lists, so just unset the key. - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/02-vala-compatibility-1.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/02-vala-compatibility-1.patch --- libdesktop-agnostic-0.3.90/debian/patches/02-vala-compatibility-1.patch 2010-09-22 11:46:56.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/02-vala-compatibility-1.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 404 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Thu 2010-04-22 01:23:38 +0300 -message: - Fix compability with Vala 0.8.1 ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/config-bridge.vala' ---- a/libdesktop-agnostic/config-bridge.vala 2010-03-31 20:31:44 +0000 -+++ b/libdesktop-agnostic/config-bridge.vala 2010-04-21 22:23:38 +0000 -@@ -202,14 +202,13 @@ - string key, ParamSpec spec, - NotifyFuncHandler func) throws GLib.Error - { -- unowned BindingNotifier notifier; -- notifier = (BindingNotifier*) config.get_data ("lda-binding-notifier"); -+ unowned BindingNotifier? notifier; -+ notifier = config.get_data ("lda-binding-notifier"); - if (notifier == null) - { - BindingNotifier new_notifier = new BindingNotifier (config); - notifier = new_notifier; -- config.set_data_full ("lda-binding-notifier", notifier.@ref (), -- Object.unref); -+ config.set_data ("lda-binding-notifier", notifier); - } - - if (spec.value_type == typeof (bool) || -@@ -353,8 +352,7 @@ - uint pos = -1; - string binding_key; - -- unowned BindingListWrapper? obj_bindings = -- (BindingListWrapper*) obj.get_data ("lda-bindings"); -+ unowned BindingListWrapper? obj_bindings = obj.get_data ("lda-bindings"); - binding_key = "%s/%s/%s".printf (config.instance_id, group, key); - bindings_list = this.bindings.get_data (binding_key); - bindings_to_remove = new SList (); - -=== modified file 'libdesktop-agnostic/ui-icon-chooser-dialog.vala' ---- a/libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-02-04 22:24:49 +0000 -+++ b/libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-04-21 22:23:38 +0000 -@@ -160,7 +160,7 @@ - if (this._themed_viewer == null) - { - unowned IconTheme icon_theme; -- unowned List context_list; -+ List context_list; - - this._themed_context = new ComboBox.text (); - this._themed_context.changed.connect (this.on_icon_context_changed); -@@ -246,7 +246,7 @@ - { - unowned ListStore model; - unowned IconTheme icon_theme; -- unowned List icon_list; -+ List icon_list; - - model = this._themed_viewer.model as ListStore; - model.clear (); - -=== modified file 'libdesktop-agnostic/vfs-volume-impl-gio.vala' ---- a/libdesktop-agnostic/vfs-volume-impl-gio.vala 2009-09-24 16:36:40 +0000 -+++ b/libdesktop-agnostic/vfs-volume-impl-gio.vala 2010-04-21 22:23:38 +0000 -@@ -211,7 +211,7 @@ - this.monitor = GLib.VolumeMonitor.get (); - this._volumes = new HashTable (direct_hash, - direct_equal); -- unowned List vols = this.monitor.get_volumes (); -+ List vols = this.monitor.get_volumes (); - foreach (unowned GLib.Volume gvol in vols) - { - VFS.Volume vol = this.create_volume (gvol); - -=== modified file 'libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala' ---- a/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2009-09-24 16:36:40 +0000 -+++ b/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2010-04-21 22:23:38 +0000 -@@ -190,8 +190,7 @@ - this.monitor = GnomeVFS.get_volume_monitor (); - this._volumes = new HashTable (direct_hash, - direct_equal); -- unowned List drives = -- this.monitor.get_connected_drives (); -+ List drives = this.monitor.get_connected_drives (); - foreach (unowned GnomeVFS.Drive drive in drives) - { - VFS.Volume vol = this.create_volume (drive); - -=== modified file 'wscript' ---- a/wscript 2010-04-11 07:26:33 +0000 -+++ b/wscript 2010-04-21 22:23:38 +0000 -@@ -92,7 +92,7 @@ - conf.check_tool('gnu_dirs') - conf.check_tool('compiler_cc misc vala python') - -- MIN_VALA_VERSION = (0, 7, 10) -+ MIN_VALA_VERSION = (0, 8, 1) - - conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE', - atleast_version='2.6.0', mandatory=True, -@@ -135,7 +135,7 @@ - uselib_store='GNOME_DESKTOP', mandatory=True, - args='--cflags --libs') - # make sure we have the proper Vala version -- if conf.env['VALAC_VERSION'] != MIN_VALA_VERSION and \ -+ if conf.env['VALAC_VERSION'] < MIN_VALA_VERSION and \ - not os.path.isdir(os.path.join(conf.curdir, GEN_SRC_DIR)): - conf.fatal('''\ - Your Vala compiler version %s is too old. The project requires - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/02-vala-compatibility-2.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/02-vala-compatibility-2.patch --- libdesktop-agnostic-0.3.90/debian/patches/02-vala-compatibility-2.patch 2010-09-22 11:46:52.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/02-vala-compatibility-2.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 409 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Thu 2010-08-19 01:16:26 +0200 -message: - Fix for recent Vala version ------------------------------------------------------------- -revno: 408 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Thu 2010-08-19 00:12:31 +0200 -message: - Make this actually work... Though it's nasty ------------------------------------------------------------- -revno: 407 -author: onox -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Mon 2010-06-28 15:34:02 +0200 -message: - Fix compability with Vala 0.9.1 ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/config-impl-gconf.vala' ---- a/libdesktop-agnostic/config-impl-gconf.vala 2010-02-04 22:08:30 +0000 -+++ b/libdesktop-agnostic/config-impl-gconf.vala 2010-08-18 22:12:31 +0000 -@@ -654,7 +654,6 @@ - } - } - --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/config-impl-keyfile.vala' ---- a/libdesktop-agnostic/config-impl-keyfile.vala 2010-04-18 20:09:45 +0000 -+++ b/libdesktop-agnostic/config-impl-keyfile.vala 2010-08-18 22:12:31 +0000 -@@ -768,7 +768,6 @@ - } - } - } --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/config-impl-memory.vala' ---- a/libdesktop-agnostic/config-impl-memory.vala 2009-08-15 18:26:33 +0000 -+++ b/libdesktop-agnostic/config-impl-memory.vala 2010-08-18 22:12:31 +0000 -@@ -226,7 +226,6 @@ - } - } - } --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/config-impl-null.vala' ---- a/libdesktop-agnostic/config-impl-null.vala 2009-08-06 06:38:30 +0000 -+++ b/libdesktop-agnostic/config-impl-null.vala 2010-08-18 22:12:31 +0000 -@@ -121,7 +121,6 @@ - } - } - } --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/config-type-color.vala' ---- a/libdesktop-agnostic/config-type-color.vala 2009-07-31 06:50:20 +0000 -+++ b/libdesktop-agnostic/config-type-color.vala 2010-08-18 22:12:31 +0000 -@@ -120,7 +120,6 @@ - dest_value = ct.deserialize ((string)src_value); - } - } --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/desktop-entry-impl-glib.vala' ---- a/libdesktop-agnostic/desktop-entry-impl-glib.vala 2010-03-26 22:45:36 +0000 -+++ b/libdesktop-agnostic/desktop-entry-impl-glib.vala 2010-08-18 22:12:31 +0000 -@@ -614,7 +614,6 @@ - } - } - --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/desktop-entry-impl-gnome.vala' ---- a/libdesktop-agnostic/desktop-entry-impl-gnome.vala 2010-03-26 22:45:36 +0000 -+++ b/libdesktop-agnostic/desktop-entry-impl-gnome.vala 2010-08-18 22:12:31 +0000 -@@ -305,7 +305,6 @@ - } - } - --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/vfs-impl-gio.vala' ---- a/libdesktop-agnostic/vfs-impl-gio.vala 2009-07-18 02:12:37 +0000 -+++ b/libdesktop-agnostic/vfs-impl-gio.vala 2010-08-18 22:12:31 +0000 -@@ -89,7 +89,6 @@ - } - } - } --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/vfs-impl-gnome-vfs.vala' ---- a/libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2009-07-18 02:12:37 +0000 -+++ b/libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2010-08-18 22:12:31 +0000 -@@ -92,7 +92,6 @@ - } - } - } --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/vfs-impl-thunar-vfs.vala' ---- a/libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2009-07-18 02:12:37 +0000 -+++ b/libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2010-08-18 22:12:31 +0000 -@@ -92,7 +92,6 @@ - } - } - } --[ModuleInit] - public Type - register_plugin () - { - -=== modified file 'libdesktop-agnostic/vfs-trash-impl-gio.vala' ---- a/libdesktop-agnostic/vfs-trash-impl-gio.vala 2009-11-02 06:42:05 +0000 -+++ b/libdesktop-agnostic/vfs-trash-impl-gio.vala 2010-08-18 23:16:26 +0000 -@@ -77,7 +77,7 @@ - - try - { -- file_info = dir.query_info_finish (res); -+ file_info = dir.query_info_async.end (res); - this._file_count = file_info.get_attribute_uint32 (FILE_ATTRIBUTE_TRASH_ITEM_COUNT); - this.file_count_changed (); - } - -=== modified file 'libdesktop-agnostic/vfs-volume-impl-gio.vala' ---- a/libdesktop-agnostic/vfs-volume-impl-gio.vala 2010-04-21 22:23:38 +0000 -+++ b/libdesktop-agnostic/vfs-volume-impl-gio.vala 2010-08-18 23:16:26 +0000 -@@ -121,7 +121,7 @@ - bool result = false; - try - { -- result = this.vol.mount_finish (this.async_result); -+ result = this.vol.mount.end (this.async_result); - } - catch (GLib.Error err) - { -@@ -156,7 +156,7 @@ - bool result = false; - try - { -- result = this.vol.get_mount ().unmount_finish (this.async_result); -+ result = this.vol.get_mount ().unmount.end (this.async_result); - } - catch (GLib.Error err) - { -@@ -192,7 +192,7 @@ - bool result = false; - try - { -- result = this.vol.eject_finish (this.async_result); -+ result = this.vol.eject.end (this.async_result); - } - catch (GLib.Error err) - { - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/02-vala-compatibility-3.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/02-vala-compatibility-3.patch --- libdesktop-agnostic-0.3.90/debian/patches/02-vala-compatibility-3.patch 2010-09-22 11:55:40.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/02-vala-compatibility-3.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 411 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Tue 2010-09-07 23:21:08 +0200 -message: - Fix compability with Vala 0.9.7 ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/config-client.vala' ---- a/libdesktop-agnostic/config-client.vala 2010-04-07 22:45:37 +0000 -+++ b/libdesktop-agnostic/config-client.vala 2010-09-07 21:21:08 +0000 -@@ -101,13 +101,12 @@ - // constructors - public Client (string schema_filename) - { -- this.schema_filename = schema_filename; -+ GLib.Object (schema_filename: schema_filename); - } - public Client.for_instance (string schema_filename, - string instance_id) throws GLib.Error - { -- this.schema_filename = schema_filename; -- this.instance_id = instance_id; -+ GLib.Object (schema_filename: schema_filename, instance_id: instance_id); - } - /** - * Auto-determines whether an instance config object should be created. - -=== modified file 'libdesktop-agnostic/config-schema.vala' ---- a/libdesktop-agnostic/config-schema.vala 2009-09-26 20:13:40 +0000 -+++ b/libdesktop-agnostic/config-schema.vala 2010-09-07 21:21:08 +0000 -@@ -188,7 +188,8 @@ - */ - public Schema (string filename) throws GLib.Error - { -- this.filename = filename; -+ GLib.Object (filename: filename); -+ - unowned HashTable backend_metadata_keys; - this.options = Datalist (); - this.keys = new HashTable> (str_hash, str_equal); - -=== modified file 'libdesktop-agnostic/ui-launcher-editor-dialog.vala' ---- a/libdesktop-agnostic/ui-launcher-editor-dialog.vala 2009-10-27 07:36:10 +0000 -+++ b/libdesktop-agnostic/ui-launcher-editor-dialog.vala 2010-09-07 21:21:08 +0000 -@@ -70,20 +70,9 @@ - - public LauncherEditorDialog (VFS.File file, VFS.File? output, bool standalone) - { -- WindowType type; -- -- if (standalone) -- { -- type = WindowType.TOPLEVEL; -- } -- else -- { -- type = WindowType.POPUP; -- } -- this.type = type; -+ GLib.Object (type: standalone ? WindowType.TOPLEVEL : WindowType.POPUP, -+ file: file, output: output); - this._standalone = standalone; -- this.file = file; -- this.output = output; - } - - private override void - -=== modified file 'libdesktop-agnostic/vfs-bookmarks-gtk.vala' ---- a/libdesktop-agnostic/vfs-bookmarks-gtk.vala 2009-07-18 08:06:58 +0000 -+++ b/libdesktop-agnostic/vfs-bookmarks-gtk.vala 2010-09-07 21:21:08 +0000 -@@ -77,7 +77,7 @@ - */ - public GtkBookmarks (File? file = null, bool monitor = true) - { -- this.file = file; -+ GLib.Object (file: file); - if (this._file.exists ()) - { - this.parse (); - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/03-python-bindings-leak.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/03-python-bindings-leak.patch --- libdesktop-agnostic-0.3.90/debian/patches/03-python-bindings-leak.patch 2010-09-22 11:46:41.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/03-python-bindings-leak.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 406 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Tue 2010-06-01 15:17:03 +0200 -message: - Fix leaks in python bindings ------------------------------------------------------------- -=== modified file 'python/desktopagnostic.override' ---- a/python/desktopagnostic.override 2009-08-25 22:11:31 +0000 -+++ b/python/desktopagnostic.override 2010-06-01 13:17:03 +0000 -@@ -98,19 +98,23 @@ - _wrap_desktop_agnostic_color_from_values (PyObject *self, PyObject *args, - PyObject *kwargs) - { -- static char *kwlist[] = { "red", "green", "blue", "alpha", NULL }; -- int red, green, blue, alpha; -- DesktopAgnosticColor *ret; -- -- if (!PyArg_ParseTupleAndKeywords (args, kwargs, -- "iiii:color_new_from_values", kwlist, -- &red, &green, &blue, &alpha)) -- return NULL; -- -- ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha); -- -- /* pygobject_new handles NULL checking */ -- return pygobject_new ((GObject *)ret); -+ static char *kwlist[] = { "red", "green", "blue", "alpha", NULL }; -+ int red, green, blue, alpha; -+ DesktopAgnosticColor *ret; -+ PyObject *py_ret; -+ -+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, -+ "iiii:color_new_from_values", kwlist, -+ &red, &green, &blue, &alpha)) -+ return NULL; -+ -+ ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha); -+ -+ /* pygobject_new handles NULL checking */ -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - %% - define DesktopAgnosticColor.from_string kwargs staticmethod -@@ -122,6 +126,7 @@ - char *spec; - GError *error = NULL; - DesktopAgnosticColor *ret; -+ PyObject *py_ret; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string", - kwlist, &spec)) -@@ -137,7 +142,10 @@ - } - - /* pygobject_new handles NULL checking */ -- return pygobject_new ((GObject *)ret); -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - %% - override-slot DesktopAgnosticColor.tp_str - -=== modified file 'python/fdo.override' ---- a/python/fdo.override 2009-10-06 18:53:45 +0000 -+++ b/python/fdo.override 2010-06-01 13:17:03 +0000 -@@ -197,6 +197,7 @@ - { - DesktopAgnosticFDODesktopEntry *ret; - GError *error = NULL; -+ PyObject *py_ret; - - ret = desktop_agnostic_fdo_desktop_entry_new (&error); - -@@ -206,7 +207,10 @@ - } - - /* pygobject_new handles NULL checking */ -- return pygobject_new ((GObject *)ret); -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - %% - define DesktopAgnosticFDODesktopEntry.for_data kwargs staticmethod -@@ -218,6 +222,7 @@ - static char *kwlist[] = { "data", NULL }; - char *data; - DesktopAgnosticFDODesktopEntry *ret; -+ PyObject *py_ret; - GError *error = NULL; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, -@@ -235,7 +240,10 @@ - } - - /* pygobject_new handles NULL checking */ -- return pygobject_new ((GObject *)ret); -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - %% - define DesktopAgnosticFDODesktopEntry.for_file onearg staticmethod -@@ -244,6 +252,7 @@ - PyGObject *file) - { - DesktopAgnosticFDODesktopEntry *ret; -+ PyObject *py_ret; - GError *error = NULL; - - ret = desktop_agnostic_fdo_desktop_entry_new_for_file (DESKTOP_AGNOSTIC_VFS_FILE(file->obj), -@@ -255,7 +264,10 @@ - } - - /* pygobject_new handles NULL checking */ -- return pygobject_new ((GObject *)ret); -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - %% - define DesktopAgnosticFDODesktopEntry.type_to_string onearg staticmethod - -=== modified file 'python/ui.override' ---- a/python/ui.override 2009-10-21 22:09:04 +0000 -+++ b/python/ui.override 2010-06-01 13:17:03 +0000 -@@ -46,9 +46,13 @@ - PyGObject *color) - { - DesktopAgnosticUIColorButton *ret; -+ PyObject *py_ret; - - ret = desktop_agnostic_ui_color_button_new_with_color (DESKTOP_AGNOSTIC_COLOR(color->obj)); - - /* pygobject_new handles NULL checking */ -- return pygobject_new((GObject *)ret); -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - -=== modified file 'python/vfs.override' ---- a/python/vfs.override 2009-09-08 03:28:50 +0000 -+++ b/python/vfs.override 2010-06-01 13:17:03 +0000 -@@ -117,6 +117,7 @@ - { - char *path; - DesktopAgnosticVFSFile *ret; -+ PyObject *py_ret; - GError *error = NULL; - - if (!PyString_Check (arg)) -@@ -136,16 +137,20 @@ - } - - /* pygobject_new handles NULL checking */ -- return pygobject_new ((GObject *)ret); -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - %% - define DesktopAgnosticVFSFile.for_uri onearg staticmethod - static PyObject * - _wrap_desktop_agnostic_v_f_s_file_for_uri (PyObject *self, PyObject *arg) - { -- char *uri; -- DesktopAgnosticVFSFile *ret; -- GError *error = NULL; -+ char *uri; -+ DesktopAgnosticVFSFile *ret; -+ PyObject *py_ret; -+ GError *error = NULL; - - if (!PyString_Check (arg)) - { -@@ -164,7 +169,10 @@ - } - - /* pygobject_new handles NULL checking */ -- return pygobject_new ((GObject *)ret); -+ py_ret = pygobject_new ((GObject *)ret); -+ if (ret != NULL) -+ g_object_unref (ret); -+ return py_ret; - } - %% - override desktop_agnostic_vfs_file_enumerate_children noargs - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/04-fix-focus-editor.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/04-fix-focus-editor.patch --- libdesktop-agnostic-0.3.90/debian/patches/04-fix-focus-editor.patch 2010-09-22 21:05:42.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/04-fix-focus-editor.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 415 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Wed 2010-09-08 20:48:22 +0200 -message: - Fix focus chain in launcher editor ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/ui-launcher-editor-dialog.vala' ---- a/libdesktop-agnostic/ui-launcher-editor-dialog.vala 2010-09-07 21:21:08 +0000 -+++ b/libdesktop-agnostic/ui-launcher-editor-dialog.vala 2010-09-08 18:48:22 +0000 -@@ -199,6 +199,14 @@ - advanced.add (advanced_vbox); - table.attach_fill (advanced, 0, 3, 3, 4); - -+ List focus_chain_list = new List (); -+ focus_chain_list.append (this._name); -+ focus_chain_list.append (this._desc); -+ focus_chain_list.append (exec_hbox); -+ focus_chain_list.append (this._icon); -+ focus_chain_list.append (advanced); -+ table.set_focus_chain (focus_chain_list); -+ - this.vbox.add (table); - } - - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/05-theme-selection.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/05-theme-selection.patch --- libdesktop-agnostic-0.3.90/debian/patches/05-theme-selection.patch 2010-09-22 21:04:57.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/05-theme-selection.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,337 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 416 -fixes bug(s): https://launchpad.net/bugs/461187 https://launchpad.net/bugs/487099 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Wed 2010-09-08 20:53:51 +0200 -message: - Make theme selection active by default in IconChooserDialog, support resize, implement lazy pixbuf loading ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/ui-icon-chooser-dialog.vala' ---- a/libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-04-21 22:23:38 +0000 -+++ b/libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-09-08 18:53:51 +0000 -@@ -35,13 +35,40 @@ - FILE - } - -+ private class LazyPixbufRenderer : CellRendererPixbuf -+ { -+ public bool item_ready { get; set; default = false; } -+ -+ public signal void prepare_pixbuf (TreePath path); -+ -+ public override void render (Gdk.Window window, -+ Gtk.Widget widget, -+ Gdk.Rectangle background_area, -+ Gdk.Rectangle cell_area, -+ Gdk.Rectangle expose_area, -+ Gtk.CellRendererState flags) -+ { -+ if (!item_ready) -+ { -+ int x, y; -+ var view = widget as Gtk.IconView; -+ x = cell_area.x + cell_area.width / 2; -+ y = cell_area.y + cell_area.height / 2; -+ var path = view.get_path_at_pos (x, y); -+ prepare_pixbuf (path); -+ } -+ base.render (window, widget, -+ background_area, cell_area, expose_area, flags); -+ } -+ } -+ - public class IconChooserDialog : Dialog - { - private RadioButton _file; - private RadioButton _themed; - private FileChooserButton _directory; - private ComboBox _themed_context; -- private IconView _file_viewer; -+ private IconView? _file_viewer = null; - private IconView? _themed_viewer = null; - private unowned IconView _viewer; - public string selected_icon { get; private set; default = null; } -@@ -53,16 +80,26 @@ - PIXBUF, - NAME, - DATA, -+ PIXBUF_READY, - COUNT - } - - public signal void icon_selected (); - -+ private static Gdk.Pixbuf NO_ICON; -+ -+ static construct -+ { -+ var flags = IconLookupFlags.FORCE_SIZE | IconLookupFlags.GENERIC_FALLBACK; -+ NO_ICON = IconTheme.get_default ().load_icon ("gtk-file", 48, flags); -+ } -+ - construct - { - this.response.connect (this.on_response); - this.title = _ ("Select Icon"); - this.icon_name = STOCK_FIND; -+ this.set_default_size (375, 375); - this.create_ui (); - } - -@@ -72,27 +109,17 @@ - HBox choices; - - choices = new HBox (false, 5); -- this._file = new RadioButton.with_mnemonic (null, _ ("From File")); -+ this._themed = new RadioButton.with_mnemonic (null, _ ("From Theme")); -+ choices.add (this._themed); -+ this._file = new RadioButton.with_mnemonic_from_widget (this._themed, -+ _ ("From File")); -+ this._themed.active = true; -+ this._themed.toggled.connect (this.on_icon_type_toggled); - choices.add (this._file); -- this._themed = new RadioButton.with_mnemonic_from_widget (this._file, -- _ ("From Theme")); -- this._themed.active = false; -- this._themed.toggled.connect (this.on_icon_type_toggled); -- choices.add (this._themed); - this.vbox.pack_start (choices, false, false, 5); - choices.show_all (); - -- this._directory = new FileChooserButton (_ ("Select icon folder"), -- FileChooserAction.SELECT_FOLDER); -- this._directory.current_folder_changed.connect (this.on_folder_changed); -- this.vbox.pack_start (this._directory, false, false, 5); -- this._directory.show (); -- -- this.add_icon_viewer (ref this._file_viewer, false); -- this._file_viewer.parent.show_all (); -- this._viewer = this._file_viewer; -- -- this.on_folder_changed (this._directory); -+ this.on_icon_type_toggled (); - - this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, - STOCK_OK, ResponseType.OK); -@@ -115,30 +142,64 @@ - create_icon_viewer (bool themed) - { - IconView viewer; -- CellRendererPixbuf cell_pixbuf; -+ LazyPixbufRenderer cell_pixbuf; - CellRendererText cell_text; - - viewer = new IconView.with_model (this.create_model ()); -- viewer.item_width = 72; -- viewer.columns = 4; -- viewer.column_spacing = 5; -- viewer.set_size_request (325, 300); -- viewer.tooltip_column = Column.DATA; -- cell_pixbuf = new CellRendererPixbuf (); -+ // without this the IconView is not shrinkable after expanding it -+ viewer.set_size_request (108, -1); -+ viewer.set_item_width (108); -+ viewer.set_column_spacing (5); -+ viewer.set_tooltip_column (Column.DATA); -+ -+ cell_pixbuf = new LazyPixbufRenderer (); - cell_pixbuf.xalign = 0.5f; - cell_pixbuf.yalign = 0.5f; - cell_pixbuf.width = 48; -+ - viewer.pack_start (cell_pixbuf, false); - viewer.add_attribute (cell_pixbuf, "pixbuf", Column.PIXBUF); -+ viewer.add_attribute (cell_pixbuf, "item-ready", Column.PIXBUF_READY); -+ -+ cell_pixbuf.prepare_pixbuf.connect ((p) => -+ { -+ TreeIter iter; -+ Value val; -+ var store = this._viewer.model as ListStore; -+ store.get_iter (out iter, p); -+ store.get_value (iter, Column.DATA, out val); -+ -+ string icon_name = val.get_string (); -+ IconTheme icon_theme = IconTheme.get_default (); -+ var info = icon_theme.lookup_icon (icon_name, 48, 0); -+ string? name = info.get_display_name (); -+ if (name == null) -+ { -+ name = icon_name.replace ("-", " "); -+ } -+ try -+ { -+ var pixbuf = info.load_icon (); -+ store.set (iter, Column.NAME, name, Column.PIXBUF, pixbuf, -+ Column.PIXBUF_READY, true, -1); -+ } -+ catch (Error err) -+ { -+ warning ("Could not load %s: %s", icon_name, err.message); -+ store.set (iter, Column.NAME, name, Column.PIXBUF_READY, true, -1); -+ } -+ }); -+ - cell_text = new CellRendererText (); - cell_text.xalign = 0.5f; -- cell_text.yalign = 0; -+ cell_text.yalign = 0.0f; - cell_text.wrap_mode = Pango.WrapMode.WORD; -- cell_text.wrap_width = 72; -- cell_text.width = 72; -- cell_text.ellipsize = Pango.EllipsizeMode.START; -+ int wrap_width = viewer.item_width - viewer.item_padding * 2; -+ cell_text.wrap_width = wrap_width; -+ cell_text.width = wrap_width; -+ cell_text.ellipsize = Pango.EllipsizeMode.MIDDLE; - viewer.pack_start (cell_text, true); -- viewer.add_attribute (cell_text, "text", 1); -+ viewer.add_attribute (cell_text, "text", Column.NAME); - viewer.selection_mode = SelectionMode.SINGLE; - - return viewer; -@@ -148,12 +209,15 @@ - create_model () - { - // icon, name, data -- return new ListStore (Column.COUNT, typeof (Gdk.Pixbuf), typeof (string), -- typeof (string)); -+ return new ListStore (Column.COUNT, -+ typeof (Gdk.Pixbuf), -+ typeof (string), -+ typeof (string), -+ typeof (bool)); - } - - private void -- on_icon_type_toggled (ToggleButton themed) -+ on_icon_type_toggled () - { - if (this._themed.active) - { -@@ -162,6 +226,7 @@ - unowned IconTheme icon_theme; - List context_list; - -+ // "From Theme" widgets -> context combobox + icon view - this._themed_context = new ComboBox.text (); - this._themed_context.changed.connect (this.on_icon_context_changed); - this.vbox.pack_start (this._themed_context, false, false, 5); -@@ -171,21 +236,52 @@ - icon_theme = IconTheme.get_default (); - context_list = icon_theme.list_contexts (); - context_list.sort ((CompareFunc)strcmp); -+ -+ int active_index = 0; -+ int cur_index = 0; - foreach (unowned string context in context_list) - { - this._themed_context.append_text (context); -+ // try to make "Applications" context active by default -+ if (context == "Applications") -+ { -+ active_index = cur_index; -+ } -+ cur_index++; - } -- } -- this._file_viewer.parent.hide (); -- this._directory.hide (); -+ this._themed_context.set_active (active_index); -+ } -+ -+ if (this._file_viewer != null) -+ { -+ this._file_viewer.parent.hide (); -+ this._directory.hide (); -+ } - this._themed_viewer.parent.show (); - this._themed_context.show (); - this._viewer = this._themed_viewer; - } - else - { -- this._themed_viewer.parent.hide (); -- this._themed_context.hide (); -+ if (this._file_viewer == null) -+ { -+ // "From File" widgets -> directory chooser + icon view -+ this._directory = new FileChooserButton (_ ("Select icon folder"), -+ FileChooserAction.SELECT_FOLDER); -+ this._directory.current_folder_changed.connect (this.on_folder_changed); -+ this.vbox.pack_start (this._directory, false, false, 5); -+ this._directory.show (); -+ -+ this.add_icon_viewer (ref this._file_viewer, false); -+ -+ this.on_folder_changed (this._directory); -+ } -+ -+ if (this._themed_viewer != null) -+ { -+ this._themed_viewer.parent.hide (); -+ this._themed_context.hide (); -+ } - this._file_viewer.parent.show (); - this._directory.show (); - this._viewer = this._file_viewer; -@@ -225,7 +321,9 @@ - pixbuf = new Gdk.Pixbuf.from_file_at_scale (path, 48, -1, true); - - model.append (out iter); -- model.set (iter, Column.PIXBUF, pixbuf, -+ model.set (iter, -+ Column.PIXBUF, pixbuf, -+ Column.PIXBUF_READY, true, - Column.NAME, Path.get_basename (path), - Column.DATA, path); - } -@@ -256,29 +354,14 @@ - icon_list.sort ((CompareFunc)strcmp); - foreach (unowned string icon_name in icon_list) - { -- try -- { -- IconInfo info; -- Gdk.Pixbuf pixbuf; -- string? name; -- TreeIter iter; -+ TreeIter iter; - -- info = icon_theme.lookup_icon (icon_name, 48, 0); -- pixbuf = info.load_icon (); -- name = info.get_display_name (); -- if (name == null) -- { -- name = icon_name.replace ("-", " "); -- } -- model.append (out iter); -- model.set (iter, Column.PIXBUF, pixbuf, -- Column.NAME, name, -- Column.DATA, icon_name); -- } -- catch (Error err) -- { -- warning ("Could not load %s: %s", icon_name, err.message); -- } -+ model.append (out iter); -+ model.set (iter, -+ Column.PIXBUF, NO_ICON, -+ Column.PIXBUF_READY, false, -+ Column.NAME, icon_name, -+ Column.DATA, icon_name); - } - } - -@@ -297,7 +380,7 @@ - - msg = _ ("Please select an icon."); - dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR, -- ButtonsType.OK, msg); -+ ButtonsType.OK, "%s", msg); - dialog.title = _ ("Error"); - dialog.run (); - dialog.destroy (); - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/06-fix-FTBFS-thunar.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/06-fix-FTBFS-thunar.patch --- libdesktop-agnostic-0.3.90/debian/patches/06-fix-FTBFS-thunar.patch 2010-09-23 23:50:33.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/06-fix-FTBFS-thunar.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 418 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Thu 2010-09-23 10:06:03 +0200 -message: - Try to fix thunar-vfs compile errors ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala' ---- a/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2009-09-21 17:53:13 +0000 -+++ b/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2010-09-23 08:06:03 +0000 -@@ -53,7 +53,7 @@ - { - Monitor monitor; - this.trash = ThunarVfs.Path.get_for_trash (); -- this.dbus = Bus.get (BusType.SESSION); -+ this.dbus = DBus.Bus.get (DBus.BusType.SESSION); - this.xfce_trash = - (Xfce.Trash)this.dbus.get_object ("org.xfce.Thunar", - "/org/xfce/FileManager"); - -=== modified file 'libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala' ---- a/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2009-09-24 16:36:40 +0000 -+++ b/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2010-09-23 08:06:03 +0000 -@@ -63,7 +63,7 @@ - } - public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl) - { -- this.implementation = impl; -+ GLib.Object (implementation: impl); - } - public bool - is_mounted () - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/07-disable-GI.patch libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/07-disable-GI.patch --- libdesktop-agnostic-0.3.90/debian/patches/07-disable-GI.patch 2010-09-24 00:00:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/07-disable-GI.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -#branch lp:~awn-core/libdesktop-agnostic/various-fixes/ ------------------------------------------------------------- -revno: 410 -committer: Michal Hruby -branch nick: libdesktop-agnostic -timestamp: Tue 2010-09-07 22:59:52 +0200 -message: - Add --disable-gi option to allow building with older GI ------------------------------------------------------------- -=== modified file 'libdesktop-agnostic/wscript' ---- a/libdesktop-agnostic/wscript 2010-04-10 23:17:55 +0000 -+++ b/libdesktop-agnostic/wscript 2010-09-07 20:59:52 +0000 -@@ -113,7 +113,7 @@ - ]) - lib.packages = 'gdk-2.0 gmodule-2.0' - lib.target = 'desktop-agnostic' -- lib.gir = 'DesktopAgnostic-1.0' -+ if bld.env['INTROSPECTION']: lib.gir = 'DesktopAgnostic-1.0' - lib.uselib = 'M GDK GMODULE' - lib.packages_private = 'build' - lib.includes = '..' -@@ -133,7 +133,7 @@ - vfs.packages = 'desktop-agnostic posix' - vfs.target = 'desktop-agnostic-vfs' - vfs.header = 'vfs' -- vfs.gir = 'DesktopAgnosticVFS-1.0' -+ if bld.env['INTROSPECTION']: vfs.gir = 'DesktopAgnosticVFS-1.0' - vfs.uselib_local = 'desktop-agnostic' - vfs.packages_private = 'posix-glob' - vfs.includes = '..' -@@ -152,7 +152,7 @@ - cfg.packages = 'desktop-agnostic-vfs' - cfg.target = 'desktop-agnostic-cfg' - cfg.header = 'config' -- cfg.gir = 'DesktopAgnosticConfig-1.0' -+ if bld.env['INTROSPECTION']: cfg.gir = 'DesktopAgnosticConfig-1.0' - cfg.uselib_local = 'desktop-agnostic-vfs' - cfg.packages_private = 'hashtable-gtype-key' - cfg.includes = '..' -@@ -166,7 +166,7 @@ - fdo.packages = 'desktop-agnostic-vfs' - fdo.target = 'desktop-agnostic-fdo' - fdo.header = 'fdo' -- fdo.gir = 'DesktopAgnosticFDO-1.0' -+ if bld.env['INTROSPECTION']: fdo.gir = 'DesktopAgnosticFDO-1.0' - fdo.uselib_local = 'desktop-agnostic-vfs' - fdo.vapi_dirs = '.' - fdo.includes = '..' -@@ -183,7 +183,7 @@ - ui.packages_private = 'build' - ui.target = 'desktop-agnostic-ui' - ui.header = 'ui' -- ui.gir = 'DesktopAgnosticUI-1.0' -+ if bld.env['INTROSPECTION']: ui.gir = 'DesktopAgnosticUI-1.0' - ui.uselib = 'GTK' - ui.uselib_local = 'desktop-agnostic-fdo' - ui.vapi_dirs = '. ../vapi' - -=== modified file 'wscript' ---- a/wscript 2010-04-21 22:24:16 +0000 -+++ b/wscript 2010-09-07 20:59:52 +0000 -@@ -70,6 +70,8 @@ - dest='profiling', default=False, - help='Enables the library to be built so that it is ' - 'instrumented to measure performance.') -+ opt.add_option('--disable-gi', action='store_true', -+ dest='no_gi', default=False) - - - def configure(conf): -@@ -88,6 +90,7 @@ - conf.env['DEBUG'] = Options.options.debug - conf.env['EXTRA_WARNINGS'] = Options.options.extra_warnings - conf.env['PROFILING'] = Options.options.profiling -+ conf.env['INTROSPECTION'] = not Options.options.no_gi - conf.env['VNUM'] = str(VNUM) - - conf.check_tool('gnu_dirs') - diff -Nru libdesktop-agnostic-0.3.90/debian/patches/series libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/series --- libdesktop-agnostic-0.3.90/debian/patches/series 2010-09-24 00:00:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -01-keyfile-creation.patch -02-vala-compatibility-1.patch -02-vala-compatibility-2.patch -02-vala-compatibility-3.patch -03-python-bindings-leak.patch -04-fix-focus-editor.patch -05-theme-selection.patch -06-fix-FTBFS-thunar.patch -07-disable-GI.patch diff -Nru libdesktop-agnostic-0.3.90/debian/rules libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/rules --- libdesktop-agnostic-0.3.90/debian/rules 2010-09-24 00:01:28.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/rules 2010-10-13 21:05:39.000000000 +0000 @@ -11,14 +11,7 @@ dh $@ override_dh_auto_configure: - LINKFLAGS="${LDFLAGS} -Wl,--as-needed" ./waf --nocache configure --prefix=/usr \ - --enable-debug \ - --config-backends=gconf,keyfile \ - --vfs-backends=gio,gnome-vfs,thunar-vfs \ - --desktop-entry-backends=glib,gnome \ - --with-glade \ - --enable-docs \ - --disable-gi + LINKFLAGS="${LDFLAGS} -Wl,--as-needed" ./waf --nocache configure --prefix=/usr --enable-debug --config-backends=gconf,keyfile --vfs-backends=gio,gnome-vfs,thunar-vfs --desktop-entry-backends=glib,gnome --with-glade --enable-docs ./waf --nocache build override_dh_auto_install: @@ -28,6 +21,6 @@ dh_strip --dbg-package=libdesktop-agnostic0-dbg override_dh_auto_clean: - rm -rf build sphinx.pyc + rm -rf build ./waf --nocache distclean rm -f configure # so dh_auto_configure doesn't try to use this broken fallback diff -Nru libdesktop-agnostic-0.3.90/debian/source/format libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/source/format --- libdesktop-agnostic-0.3.90/debian/source/format 2010-10-13 21:12:37.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/debian/source/format 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -3.0 (quilt) diff -Nru libdesktop-agnostic-0.3.90/docs/install.rst libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/docs/install.rst --- libdesktop-agnostic-0.3.90/docs/install.rst 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/docs/install.rst 2010-10-13 21:05:39.000000000 +0000 @@ -51,6 +51,7 @@ * GObject Introspection 0.6.3 or later (requires the development files, to properly detect the correct version) * Vala 0.7.10 +* intltool Build/Runtime (*required*) ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -Nru libdesktop-agnostic-0.3.90/docs/known-issues.rst libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/docs/known-issues.rst --- libdesktop-agnostic-0.3.90/docs/known-issues.rst 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/docs/known-issues.rst 2010-10-13 21:05:39.000000000 +0000 @@ -19,7 +19,7 @@ config-bridge.vala:164: warning: pointer targets in passing argument 2 of ‘g_object_class_list_properties’ differ in signedness desktop-entry-impl-glib.c:306: warning: pointer targets in passing argument 4 of ‘g_key_file_get_string_list’ differ in signedness -.. [1] See `GNOME Bug #582092`_. +.. [1] See `GNOME Bug #582092`_ (fixed in Vala 0.9.1). .. [2] See `GNOME Bug #529866`_ (fixed in Vala 0.7.6). .. [3] See `GNOME Bug #592108`_ (fixed in Vala 0.7.6). diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/color.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/color.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/color.c 2010-04-11 07:32:10.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/color.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,612 +0,0 @@ -/* color.c generated by valac, the Vala compiler - * generated from color.vala, do not modify */ - -/* - * Extension to Gdk.Color which has support for an alpha channel. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_TYPE_COLOR (desktop_agnostic_color_get_type ()) -#define DESKTOP_AGNOSTIC_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColor)) -#define DESKTOP_AGNOSTIC_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColorClass)) -#define DESKTOP_AGNOSTIC_IS_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR)) -#define DESKTOP_AGNOSTIC_IS_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_TYPE_COLOR)) -#define DESKTOP_AGNOSTIC_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColorClass)) - -typedef struct _DesktopAgnosticColor DesktopAgnosticColor; -typedef struct _DesktopAgnosticColorClass DesktopAgnosticColorClass; -typedef struct _DesktopAgnosticColorPrivate DesktopAgnosticColorPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) - -typedef enum { - DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_INPUT, - DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_ALPHA -} DesktopAgnosticColorParseError; -#define DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR desktop_agnostic_color_parse_error_quark () -struct _DesktopAgnosticColor { - GObject parent_instance; - DesktopAgnosticColorPrivate * priv; -}; - -struct _DesktopAgnosticColorClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticColorPrivate { - GdkColor _color; - gushort _alpha; -}; - - -static gpointer desktop_agnostic_color_parent_class = NULL; - -GQuark desktop_agnostic_color_parse_error_quark (void); -GType desktop_agnostic_color_get_type (void); -#define DESKTOP_AGNOSTIC_COLOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColorPrivate)) -enum { - DESKTOP_AGNOSTIC_COLOR_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_COLOR_COLOR, - DESKTOP_AGNOSTIC_COLOR_RED, - DESKTOP_AGNOSTIC_COLOR_GREEN, - DESKTOP_AGNOSTIC_COLOR_BLUE, - DESKTOP_AGNOSTIC_COLOR_ALPHA -}; -#define DESKTOP_AGNOSTIC_COLOR_HTML_STRING "#%02hx%02hx%02hx%02hx" -#define DESKTOP_AGNOSTIC_COLOR_HTML_SCALE ((gushort) 256) -static gushort desktop_agnostic_color_ushortify (DesktopAgnosticColor* self, guint value, GError** error); -DesktopAgnosticColor* desktop_agnostic_color_new (GdkColor* color, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_construct (GType object_type, GdkColor* color, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_new_from_values (gushort red, gushort green, gushort blue, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_construct_from_values (GType object_type, gushort red, gushort green, gushort blue, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_new_from_string (const char* spec, GError** error); -DesktopAgnosticColor* desktop_agnostic_color_construct_from_string (GType object_type, const char* spec, GError** error); -guint desktop_agnostic_color_get_red (DesktopAgnosticColor* self); -guint desktop_agnostic_color_get_green (DesktopAgnosticColor* self); -guint desktop_agnostic_color_get_blue (DesktopAgnosticColor* self); -char* desktop_agnostic_color_to_html_color (DesktopAgnosticColor* self); -char* desktop_agnostic_color_to_string (DesktopAgnosticColor* self); -double desktop_agnostic_color_gdk_value_to_cairo (gushort value); -void desktop_agnostic_color_get_cairo_color (DesktopAgnosticColor* self, double* red, double* green, double* blue, double* alpha); -gushort desktop_agnostic_color_cairo_value_to_gdk (double value); -void desktop_agnostic_color_set_red (DesktopAgnosticColor* self, guint value); -void desktop_agnostic_color_set_green (DesktopAgnosticColor* self, guint value); -void desktop_agnostic_color_set_blue (DesktopAgnosticColor* self, guint value); -void desktop_agnostic_color_set_cairo_color (DesktopAgnosticColor* self, double red, double green, double blue, double alpha); -void desktop_agnostic_color_get_color (DesktopAgnosticColor* self, GdkColor* result); -void desktop_agnostic_color_set_color (DesktopAgnosticColor* self, GdkColor* value); -guint desktop_agnostic_color_get_alpha (DesktopAgnosticColor* self); -void desktop_agnostic_color_set_alpha (DesktopAgnosticColor* self, guint value); -static void desktop_agnostic_color_finalize (GObject* obj); -static void desktop_agnostic_color_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_color_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); - - - -GQuark desktop_agnostic_color_parse_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_color_parse_error-quark"); -} - - -static gushort desktop_agnostic_color_ushortify (DesktopAgnosticColor* self, guint value, GError** error) { - gushort result; - GError * _inner_error_; - gboolean _tmp0_ = FALSE; - g_return_val_if_fail (self != NULL, 0U); - _inner_error_ = NULL; - if (value < 0) { - _tmp0_ = TRUE; - } else { - _tmp0_ = value > G_MAXUSHORT; - } - if (_tmp0_) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR, DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_INPUT, "RGB values must be between 0 and %hu.", G_MAXUSHORT); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR) { - g_propagate_error (error, _inner_error_); - return 0U; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0U; - } - } - } - result = (gushort) value; - return result; -} - - -DesktopAgnosticColor* desktop_agnostic_color_construct (GType object_type, GdkColor* color, gushort alpha) { - DesktopAgnosticColor * self; - self = (DesktopAgnosticColor*) g_object_new (object_type, NULL); - self->priv->_color = *color; - self->priv->_alpha = alpha; - return self; -} - - -DesktopAgnosticColor* desktop_agnostic_color_new (GdkColor* color, gushort alpha) { - return desktop_agnostic_color_construct (DESKTOP_AGNOSTIC_TYPE_COLOR, color, alpha); -} - - -DesktopAgnosticColor* desktop_agnostic_color_construct_from_values (GType object_type, gushort red, gushort green, gushort blue, gushort alpha) { - DesktopAgnosticColor * self; - GdkColor _tmp0_ = {0}; - self = (DesktopAgnosticColor*) g_object_new (object_type, NULL); - self->priv->_color = (memset (&_tmp0_, 0, sizeof (GdkColor)), _tmp0_); - self->priv->_color.red = (guint16) red; - self->priv->_color.green = (guint16) green; - self->priv->_color.blue = (guint16) blue; - self->priv->_alpha = alpha; - return self; -} - - -DesktopAgnosticColor* desktop_agnostic_color_new_from_values (gushort red, gushort green, gushort blue, gushort alpha) { - return desktop_agnostic_color_construct_from_values (DESKTOP_AGNOSTIC_TYPE_COLOR, red, green, blue, alpha); -} - - -static char* string_substring (const char* self, glong offset, glong len) { - char* result; - glong string_length; - const char* start; - g_return_val_if_fail (self != NULL, NULL); - string_length = g_utf8_strlen (self, -1); - if (offset < 0) { - offset = string_length + offset; - g_return_val_if_fail (offset >= 0, NULL); - } else { - g_return_val_if_fail (offset <= string_length, NULL); - } - if (len < 0) { - len = string_length - offset; - } - g_return_val_if_fail ((offset + len) <= string_length, NULL); - start = g_utf8_offset_to_pointer (self, offset); - result = g_strndup (start, ((gchar*) g_utf8_offset_to_pointer (start, len)) - ((gchar*) start)); - return result; -} - - -DesktopAgnosticColor* desktop_agnostic_color_construct_from_string (GType object_type, const char* spec, GError** error) { - GError * _inner_error_; - DesktopAgnosticColor * self; - GdkColor _tmp0_ = {0}; - char* color_data; - g_return_val_if_fail (spec != NULL, NULL); - _inner_error_ = NULL; - self = (DesktopAgnosticColor*) g_object_new (object_type, NULL); - self->priv->_color = (memset (&_tmp0_, 0, sizeof (GdkColor)), _tmp0_); - self->priv->_alpha = G_MAXUSHORT; - color_data = NULL; - if (g_utf8_get_char (spec) == '#') { - gsize cd_len; - const char* color_hex; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - gsize hex_len; - gsize offset; - char* rgb_hex; - const char* alpha_hex; - char* _tmp5_; - char* _tmp4_; - char* _tmp3_; - gboolean _tmp6_; - gushort bits; - char* _tmp7_; - cd_len = (gsize) 0; - color_hex = g_utf8_offset_to_pointer (spec, (glong) 1); - cd_len = (gsize) strlen (color_hex); - if ((cd_len % 4) != 0) { - _tmp2_ = TRUE; - } else { - _tmp2_ = cd_len < 4; - } - if (_tmp2_) { - _tmp1_ = TRUE; - } else { - _tmp1_ = cd_len > 16; - } - if (_tmp1_) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR, DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_INPUT, "Invalid input size."); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (color_data); - g_object_unref (self); - return NULL; - } else { - _g_free0 (color_data); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - } - hex_len = cd_len / 4; - offset = hex_len * 3; - rgb_hex = string_substring (color_hex, (glong) 0, (glong) offset); - alpha_hex = g_utf8_offset_to_pointer (color_hex, (glong) offset); - if ((_tmp6_ = sscanf (alpha_hex, _tmp5_ = g_strconcat (_tmp4_ = g_strconcat ("%", _tmp3_ = g_strdup_printf ("%zu", hex_len), NULL), "hx", NULL), &self->priv->_alpha) == 0, _g_free0 (_tmp5_), _g_free0 (_tmp4_), _g_free0 (_tmp3_), _tmp6_)) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR, DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_ALPHA, "Could not parse alpha section of input: %s", alpha_hex); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (rgb_hex); - _g_free0 (color_data); - g_object_unref (self); - return NULL; - } else { - _g_free0 (rgb_hex); - _g_free0 (color_data); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - } - bits = (gushort) cd_len; - self->priv->_alpha = (gushort) (self->priv->_alpha << ((gushort) (16 - bits))); - while (TRUE) { - if (!(bits < 16)) { - break; - } - self->priv->_alpha = self->priv->_alpha | (self->priv->_alpha >> bits); - bits = (gushort) (bits * ((gushort) 2)); - } - color_data = (_tmp7_ = g_strconcat ("#", rgb_hex, NULL), _g_free0 (color_data), _tmp7_); - _g_free0 (rgb_hex); - } else { - char* _tmp8_; - color_data = (_tmp8_ = g_strdup (spec), _g_free0 (color_data), _tmp8_); - } - if (!gdk_color_parse (color_data, &self->priv->_color)) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR, DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_INPUT, "Could not parse color string: %s", spec); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (color_data); - g_object_unref (self); - return NULL; - } else { - _g_free0 (color_data); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - } - _g_free0 (color_data); - return self; -} - - -DesktopAgnosticColor* desktop_agnostic_color_new_from_string (const char* spec, GError** error) { - return desktop_agnostic_color_construct_from_string (DESKTOP_AGNOSTIC_TYPE_COLOR, spec, error); -} - - -char* desktop_agnostic_color_to_html_color (DesktopAgnosticColor* self) { - char* result; - g_return_val_if_fail (self != NULL, NULL); - result = g_strdup_printf (DESKTOP_AGNOSTIC_COLOR_HTML_STRING, desktop_agnostic_color_get_red (self) / DESKTOP_AGNOSTIC_COLOR_HTML_SCALE, desktop_agnostic_color_get_green (self) / DESKTOP_AGNOSTIC_COLOR_HTML_SCALE, desktop_agnostic_color_get_blue (self) / DESKTOP_AGNOSTIC_COLOR_HTML_SCALE, self->priv->_alpha / DESKTOP_AGNOSTIC_COLOR_HTML_SCALE); - return result; -} - - -char* desktop_agnostic_color_to_string (DesktopAgnosticColor* self) { - char* result; - char* gdk_str; - g_return_val_if_fail (self != NULL, NULL); - gdk_str = gdk_color_to_string (&self->priv->_color); - result = g_strdup_printf ("%s%04x", gdk_str, (guint) self->priv->_alpha); - _g_free0 (gdk_str); - return result; -} - - -void desktop_agnostic_color_get_cairo_color (DesktopAgnosticColor* self, double* red, double* green, double* blue, double* alpha) { - g_return_if_fail (self != NULL); - if ((red) != NULL) { - *red = desktop_agnostic_color_gdk_value_to_cairo ((gushort) desktop_agnostic_color_get_red (self)); - } - if ((green) != NULL) { - *green = desktop_agnostic_color_gdk_value_to_cairo ((gushort) desktop_agnostic_color_get_green (self)); - } - if ((blue) != NULL) { - *blue = desktop_agnostic_color_gdk_value_to_cairo ((gushort) desktop_agnostic_color_get_blue (self)); - } - if ((alpha) != NULL) { - *alpha = desktop_agnostic_color_gdk_value_to_cairo (self->priv->_alpha); - } -} - - -void desktop_agnostic_color_set_cairo_color (DesktopAgnosticColor* self, double red, double green, double blue, double alpha) { - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - gboolean _tmp3_ = FALSE; - g_return_if_fail (self != NULL); - if (red > 0.0f) { - _tmp0_ = red <= 1.0f; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - desktop_agnostic_color_set_red (self, (guint) desktop_agnostic_color_cairo_value_to_gdk (red)); - } - if (green > 0.0f) { - _tmp1_ = green <= 1.0f; - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - desktop_agnostic_color_set_green (self, (guint) desktop_agnostic_color_cairo_value_to_gdk (green)); - } - if (blue > 0.0f) { - _tmp2_ = blue <= 1.0f; - } else { - _tmp2_ = FALSE; - } - if (_tmp2_) { - desktop_agnostic_color_set_blue (self, (guint) desktop_agnostic_color_cairo_value_to_gdk (blue)); - } - if (alpha > 0.0f) { - _tmp3_ = alpha <= 1.0f; - } else { - _tmp3_ = FALSE; - } - if (_tmp3_) { - self->priv->_alpha = desktop_agnostic_color_cairo_value_to_gdk (alpha); - } -} - - -gushort desktop_agnostic_color_cairo_value_to_gdk (double value) { - gushort result; - result = (gushort) (lround (value * 65536) - 1); - return result; -} - - -double desktop_agnostic_color_gdk_value_to_cairo (gushort value) { - double result; - result = (value + 1) / 65536.0; - return result; -} - - -void desktop_agnostic_color_get_color (DesktopAgnosticColor* self, GdkColor* result) { - g_return_if_fail (self != NULL); - *result = self->priv->_color; - return; -} - - -void desktop_agnostic_color_set_color (DesktopAgnosticColor* self, GdkColor* value) { - g_return_if_fail (self != NULL); - self->priv->_color = *value; - g_object_notify ((GObject *) self, "color"); -} - - -guint desktop_agnostic_color_get_red (DesktopAgnosticColor* self) { - guint result; - g_return_val_if_fail (self != NULL, 0U); - result = (guint) self->priv->_color.red; - return result; -} - - -void desktop_agnostic_color_set_red (DesktopAgnosticColor* self, guint value) { - GError * _inner_error_; - gushort _tmp0_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_color_ushortify (self, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_color.red = (guint16) _tmp0_; - g_object_notify ((GObject *) self, "red"); -} - - -guint desktop_agnostic_color_get_green (DesktopAgnosticColor* self) { - guint result; - g_return_val_if_fail (self != NULL, 0U); - result = (guint) self->priv->_color.green; - return result; -} - - -void desktop_agnostic_color_set_green (DesktopAgnosticColor* self, guint value) { - GError * _inner_error_; - gushort _tmp0_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_color_ushortify (self, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_color.green = (guint16) _tmp0_; - g_object_notify ((GObject *) self, "green"); -} - - -guint desktop_agnostic_color_get_blue (DesktopAgnosticColor* self) { - guint result; - g_return_val_if_fail (self != NULL, 0U); - result = (guint) self->priv->_color.blue; - return result; -} - - -void desktop_agnostic_color_set_blue (DesktopAgnosticColor* self, guint value) { - GError * _inner_error_; - gushort _tmp0_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_color_ushortify (self, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_color.blue = (guint16) _tmp0_; - g_object_notify ((GObject *) self, "blue"); -} - - -guint desktop_agnostic_color_get_alpha (DesktopAgnosticColor* self) { - guint result; - g_return_val_if_fail (self != NULL, 0U); - result = (guint) self->priv->_alpha; - return result; -} - - -void desktop_agnostic_color_set_alpha (DesktopAgnosticColor* self, guint value) { - GError * _inner_error_; - gushort _tmp0_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_color_ushortify (self, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_alpha = _tmp0_; - g_object_notify ((GObject *) self, "alpha"); -} - - -static void desktop_agnostic_color_class_init (DesktopAgnosticColorClass * klass) { - desktop_agnostic_color_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticColorPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_color_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_color_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_color_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_COLOR_COLOR, g_param_spec_boxed ("color", "color", "color", GDK_TYPE_COLOR, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_COLOR_RED, g_param_spec_uint ("red", "red", "red", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_COLOR_GREEN, g_param_spec_uint ("green", "green", "green", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_COLOR_BLUE, g_param_spec_uint ("blue", "blue", "blue", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_COLOR_ALPHA, g_param_spec_uint ("alpha", "alpha", "alpha", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); -} - - -static void desktop_agnostic_color_instance_init (DesktopAgnosticColor * self) { - self->priv = DESKTOP_AGNOSTIC_COLOR_GET_PRIVATE (self); - self->priv->_alpha = G_MAXUSHORT; -} - - -static void desktop_agnostic_color_finalize (GObject* obj) { - DesktopAgnosticColor * self; - self = DESKTOP_AGNOSTIC_COLOR (obj); - G_OBJECT_CLASS (desktop_agnostic_color_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_color_get_type (void) { - static GType desktop_agnostic_color_type_id = 0; - if (desktop_agnostic_color_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticColorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_color_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticColor), 0, (GInstanceInitFunc) desktop_agnostic_color_instance_init, NULL }; - desktop_agnostic_color_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticColor", &g_define_type_info, 0); - } - return desktop_agnostic_color_type_id; -} - - -static void desktop_agnostic_color_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticColor * self; - gpointer boxed; - self = DESKTOP_AGNOSTIC_COLOR (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_COLOR_COLOR: - boxed = g_new0 (GdkColor, 1); - desktop_agnostic_color_get_color (self, boxed); - g_value_take_boxed (value, boxed); - break; - case DESKTOP_AGNOSTIC_COLOR_RED: - g_value_set_uint (value, desktop_agnostic_color_get_red (self)); - break; - case DESKTOP_AGNOSTIC_COLOR_GREEN: - g_value_set_uint (value, desktop_agnostic_color_get_green (self)); - break; - case DESKTOP_AGNOSTIC_COLOR_BLUE: - g_value_set_uint (value, desktop_agnostic_color_get_blue (self)); - break; - case DESKTOP_AGNOSTIC_COLOR_ALPHA: - g_value_set_uint (value, desktop_agnostic_color_get_alpha (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_color_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticColor * self; - self = DESKTOP_AGNOSTIC_COLOR (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_COLOR_COLOR: - desktop_agnostic_color_set_color (self, g_value_get_boxed (value)); - break; - case DESKTOP_AGNOSTIC_COLOR_RED: - desktop_agnostic_color_set_red (self, g_value_get_uint (value)); - break; - case DESKTOP_AGNOSTIC_COLOR_GREEN: - desktop_agnostic_color_set_green (self, g_value_get_uint (value)); - break; - case DESKTOP_AGNOSTIC_COLOR_BLUE: - desktop_agnostic_color_set_blue (self, g_value_get_uint (value)); - break; - case DESKTOP_AGNOSTIC_COLOR_ALPHA: - desktop_agnostic_color_set_alpha (self, g_value_get_uint (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-bridge.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-bridge.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-bridge.c 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-bridge.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1050 +0,0 @@ -/* config-bridge.c generated by valac, the Vala compiler - * generated from config-bridge.vala, do not modify */ - -/* - * Provides a method to bind configuration entries to a GObject. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Neil J. Patel (Original C code) - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_NOTIFIER (desktop_agnostic_config_binding_notifier_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_NOTIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_NOTIFIER, DesktopAgnosticConfigBindingNotifier)) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_NOTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_NOTIFIER, DesktopAgnosticConfigBindingNotifierClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_NOTIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_NOTIFIER)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_NOTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_NOTIFIER)) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_NOTIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_NOTIFIER, DesktopAgnosticConfigBindingNotifierClass)) - -typedef struct _DesktopAgnosticConfigBindingNotifier DesktopAgnosticConfigBindingNotifier; -typedef struct _DesktopAgnosticConfigBindingNotifierClass DesktopAgnosticConfigBindingNotifierClass; -typedef struct _DesktopAgnosticConfigBindingNotifierPrivate DesktopAgnosticConfigBindingNotifierPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND (desktop_agnostic_config_backend_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackend)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) - -typedef struct _DesktopAgnosticConfigBackend DesktopAgnosticConfigBackend; -typedef struct _DesktopAgnosticConfigBackendClass DesktopAgnosticConfigBackendClass; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_LIST_WRAPPER (desktop_agnostic_config_binding_list_wrapper_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_LIST_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_LIST_WRAPPER, DesktopAgnosticConfigBindingListWrapper)) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_LIST_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_LIST_WRAPPER, DesktopAgnosticConfigBindingListWrapperClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_LIST_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_LIST_WRAPPER)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_LIST_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_LIST_WRAPPER)) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_LIST_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_LIST_WRAPPER, DesktopAgnosticConfigBindingListWrapperClass)) - -typedef struct _DesktopAgnosticConfigBindingListWrapper DesktopAgnosticConfigBindingListWrapper; -typedef struct _DesktopAgnosticConfigBindingListWrapperClass DesktopAgnosticConfigBindingListWrapperClass; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE (desktop_agnostic_config_bridge_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridge)) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE)) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass)) - -typedef struct _DesktopAgnosticConfigBridge DesktopAgnosticConfigBridge; -typedef struct _DesktopAgnosticConfigBridgeClass DesktopAgnosticConfigBridgeClass; -#define _g_free0(var) (var = (g_free (var), NULL)) -typedef struct _DesktopAgnosticConfigBindingListWrapperPrivate DesktopAgnosticConfigBindingListWrapperPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING (desktop_agnostic_config_binding_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING, DesktopAgnosticConfigBinding)) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING, DesktopAgnosticConfigBindingClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING)) -#define DESKTOP_AGNOSTIC_CONFIG_BINDING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING, DesktopAgnosticConfigBindingClass)) - -typedef struct _DesktopAgnosticConfigBinding DesktopAgnosticConfigBinding; -typedef struct _DesktopAgnosticConfigBindingClass DesktopAgnosticConfigBindingClass; -typedef struct _DesktopAgnosticConfigBindingPrivate DesktopAgnosticConfigBindingPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE (desktop_agnostic_config_schema_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaType)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) - -typedef struct _DesktopAgnosticConfigSchemaType DesktopAgnosticConfigSchemaType; -typedef struct _DesktopAgnosticConfigSchemaTypeClass DesktopAgnosticConfigSchemaTypeClass; -#define _g_param_spec_unref0(var) ((var == NULL) ? NULL : (var = (g_param_spec_unref (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define __g_list_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_unref (var), NULL))) -typedef struct _DesktopAgnosticConfigBridgePrivate DesktopAgnosticConfigBridgePrivate; -#define _g_slist_free0(var) ((var == NULL) ? NULL : (var = (g_slist_free (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -struct _DesktopAgnosticConfigBindingNotifier { - GObject parent_instance; - DesktopAgnosticConfigBindingNotifierPrivate * priv; - DesktopAgnosticConfigBackend* config; -}; - -struct _DesktopAgnosticConfigBindingNotifierClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigBindingListWrapper { - GObject parent_instance; - DesktopAgnosticConfigBindingListWrapperPrivate * priv; - GList* binding_list; -}; - -struct _DesktopAgnosticConfigBindingListWrapperClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigBinding { - GObject parent_instance; - DesktopAgnosticConfigBindingPrivate * priv; - DesktopAgnosticConfigBackend* cfg; - char* group; - char* key; - GObject* obj; - char* property_name; - gulong notify_id; - gboolean read_only; -}; - -struct _DesktopAgnosticConfigBindingClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigBridge { - GObject parent_instance; - DesktopAgnosticConfigBridgePrivate * priv; -}; - -struct _DesktopAgnosticConfigBridgeClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigBridgePrivate { - GData* bindings; -}; - -typedef void (*DesktopAgnosticConfigNotifyFunc) (const char* group, const char* key, GValue* value, void* user_data); -typedef void (*DesktopAgnosticConfigBridgeNotifyFuncHandler) (DesktopAgnosticConfigBackend* config, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc func, void* func_target, GError** error); -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_ERROR_NO_SCHEMA, - DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_METADATA_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_NOTIFY, - DESKTOP_AGNOSTIC_CONFIG_ERROR_DUPLICATE_BINDING -} DesktopAgnosticConfigError; -#define DESKTOP_AGNOSTIC_CONFIG_ERROR desktop_agnostic_config_error_quark () - -static gpointer desktop_agnostic_config_binding_notifier_parent_class = NULL; -static gpointer desktop_agnostic_config_binding_list_wrapper_parent_class = NULL; -static gpointer desktop_agnostic_config_binding_parent_class = NULL; -static DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_bridge; -static DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_bridge = NULL; -static gpointer desktop_agnostic_config_bridge_parent_class = NULL; - -GType desktop_agnostic_config_binding_notifier_get_type (void); -GType desktop_agnostic_config_backend_get_type (void); -enum { - DESKTOP_AGNOSTIC_CONFIG_BINDING_NOTIFIER_DUMMY_PROPERTY -}; -DesktopAgnosticConfigBindingNotifier* desktop_agnostic_config_binding_notifier_new (DesktopAgnosticConfigBackend* cfg); -DesktopAgnosticConfigBindingNotifier* desktop_agnostic_config_binding_notifier_construct (GType object_type, DesktopAgnosticConfigBackend* cfg); -GType desktop_agnostic_config_binding_list_wrapper_get_type (void); -GType desktop_agnostic_config_bridge_get_type (void); -DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_get_default (void); -const char* desktop_agnostic_config_backend_get_instance_id (DesktopAgnosticConfigBackend* self); -void desktop_agnostic_config_bridge_get_all_bindings (DesktopAgnosticConfigBridge* self, GData** result); -GType desktop_agnostic_config_binding_get_type (void); -void desktop_agnostic_config_binding_notifier_on_simple_value_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value); -void desktop_agnostic_config_binding_notifier_on_list_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value); -GType desktop_agnostic_config_schema_type_get_type (void); -GParamSpec* desktop_agnostic_config_bridge_get_property_spec (GObject* obj, const char* property_name); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type); -void desktop_agnostic_config_binding_notifier_on_serialized_object_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value); -static void desktop_agnostic_config_binding_notifier_finalize (GObject* obj); -enum { - DESKTOP_AGNOSTIC_CONFIG_BINDING_LIST_WRAPPER_DUMMY_PROPERTY -}; -static void _g_list_free_g_object_unref (GList* self); -DesktopAgnosticConfigBindingListWrapper* desktop_agnostic_config_binding_list_wrapper_new (void); -DesktopAgnosticConfigBindingListWrapper* desktop_agnostic_config_binding_list_wrapper_construct (GType object_type); -static void desktop_agnostic_config_binding_list_wrapper_finalize (GObject* obj); -enum { - DESKTOP_AGNOSTIC_CONFIG_BINDING_DUMMY_PROPERTY -}; -DesktopAgnosticConfigBinding* desktop_agnostic_config_binding_new (void); -DesktopAgnosticConfigBinding* desktop_agnostic_config_binding_construct (GType object_type); -static void desktop_agnostic_config_binding_finalize (GObject* obj); -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgePrivate)) -enum { - DESKTOP_AGNOSTIC_CONFIG_BRIDGE_DUMMY_PROPERTY -}; -static DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_new (void); -static DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_construct (GType object_type); -static void desktop_agnostic_config_bridge_handle_notify_func_with_param_spec (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GParamSpec* spec, DesktopAgnosticConfigBridgeNotifyFuncHandler func, GError** error); -static void desktop_agnostic_config_bridge_handle_notify_func (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, DesktopAgnosticConfigBridgeNotifyFuncHandler func, GError** error); -static void _g_object_unref_gdestroy_notify (void* data); -static void _desktop_agnostic_config_binding_notifier_on_simple_value_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self); -static void _desktop_agnostic_config_binding_notifier_on_list_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self); -GQuark desktop_agnostic_config_error_quark (void); -static void _desktop_agnostic_config_binding_notifier_on_serialized_object_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self); -void desktop_agnostic_config_bridge_remove (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, GError** error); -static void desktop_agnostic_config_bridge_cleanup_bindings (DesktopAgnosticConfigBindingListWrapper* obj); -void desktop_agnostic_config_backend_get_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error); -static void desktop_agnostic_config_bridge_on_property_changed (GObject* obj, GParamSpec* spec, DesktopAgnosticConfigBinding* binding); -void desktop_agnostic_config_backend_notify_add (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void _desktop_agnostic_config_backend_notify_add_desktop_agnostic_config_bridge_notify_func_handler (DesktopAgnosticConfigBackend* config, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc func, void* func_target, GError** error); -void desktop_agnostic_config_bridge_bind (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, GError** error); -void desktop_agnostic_config_backend_notify_remove (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void _desktop_agnostic_config_backend_notify_remove_desktop_agnostic_config_bridge_notify_func_handler (DesktopAgnosticConfigBackend* config, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc func, void* func_target, GError** error); -void desktop_agnostic_config_bridge_remove_all_for_object (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, GObject* obj, GError** error); -void desktop_agnostic_config_backend_set_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error); -static void desktop_agnostic_config_bridge_finalize (GObject* obj); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -DesktopAgnosticConfigBindingNotifier* desktop_agnostic_config_binding_notifier_construct (GType object_type, DesktopAgnosticConfigBackend* cfg) { - DesktopAgnosticConfigBindingNotifier * self; - g_return_val_if_fail (cfg != NULL, NULL); - self = (DesktopAgnosticConfigBindingNotifier*) g_object_new (object_type, NULL); - self->config = cfg; - return self; -} - - -DesktopAgnosticConfigBindingNotifier* desktop_agnostic_config_binding_notifier_new (DesktopAgnosticConfigBackend* cfg) { - return desktop_agnostic_config_binding_notifier_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_NOTIFIER, cfg); -} - - -void desktop_agnostic_config_binding_notifier_on_simple_value_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value) { - DesktopAgnosticConfigBindingListWrapper* bindings_list; - char* full_key; - DesktopAgnosticConfigBridge* bridge; - char* _tmp0_; - GData* _tmp2_; - GData* _tmp1_ = {0}; - GObject* _tmp3_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - bindings_list = NULL; - full_key = NULL; - bridge = desktop_agnostic_config_bridge_get_default (); - full_key = (_tmp0_ = g_strdup_printf ("%s/%s/%s", desktop_agnostic_config_backend_get_instance_id (self->config), group, key), _g_free0 (full_key), _tmp0_); - bindings_list = (_tmp3_ = (GObject*) g_datalist_get_data ((_tmp2_ = (desktop_agnostic_config_bridge_get_all_bindings (bridge, &_tmp1_), _tmp1_), &_tmp2_), full_key), DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_LIST_WRAPPER (_tmp3_) ? ((DesktopAgnosticConfigBindingListWrapper*) _tmp3_) : NULL); - g_return_if_fail (bindings_list != NULL); - { - GList* binding_collection; - GList* binding_it; - binding_collection = bindings_list->binding_list; - for (binding_it = binding_collection; binding_it != NULL; binding_it = binding_it->next) { - DesktopAgnosticConfigBinding* binding; - binding = (DesktopAgnosticConfigBinding*) binding_it->data; - { - if (!binding->read_only) { - g_signal_handler_block (binding->obj, binding->notify_id); - } - g_object_set_property (binding->obj, binding->property_name, value); - if (!binding->read_only) { - g_signal_handler_unblock (binding->obj, binding->notify_id); - } - } - } - } - _g_free0 (full_key); -} - - -void desktop_agnostic_config_binding_notifier_on_list_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value) { - DesktopAgnosticConfigBindingListWrapper* bindings_list; - char* full_key; - DesktopAgnosticConfigBridge* bridge; - char* _tmp0_; - GData* _tmp2_; - GData* _tmp1_ = {0}; - GObject* _tmp3_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - bindings_list = NULL; - full_key = NULL; - bridge = desktop_agnostic_config_bridge_get_default (); - full_key = (_tmp0_ = g_strdup_printf ("%s/%s/%s", desktop_agnostic_config_backend_get_instance_id (self->config), group, key), _g_free0 (full_key), _tmp0_); - bindings_list = (_tmp3_ = (GObject*) g_datalist_get_data ((_tmp2_ = (desktop_agnostic_config_bridge_get_all_bindings (bridge, &_tmp1_), _tmp1_), &_tmp2_), full_key), DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_LIST_WRAPPER (_tmp3_) ? ((DesktopAgnosticConfigBindingListWrapper*) _tmp3_) : NULL); - g_return_if_fail (bindings_list != NULL); - { - GList* binding_collection; - GList* binding_it; - binding_collection = bindings_list->binding_list; - for (binding_it = binding_collection; binding_it != NULL; binding_it = binding_it->next) { - DesktopAgnosticConfigBinding* binding; - binding = (DesktopAgnosticConfigBinding*) binding_it->data; - { - if (!binding->read_only) { - g_signal_handler_block (binding->obj, binding->notify_id); - } - g_object_set (binding->obj, binding->property_name, g_value_get_boxed (value), NULL); - if (!binding->read_only) { - g_signal_handler_unblock (binding->obj, binding->notify_id); - } - } - } - } - _g_free0 (full_key); -} - - -static gpointer _g_param_spec_ref0 (gpointer self) { - return self ? g_param_spec_ref (self) : NULL; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -void desktop_agnostic_config_binding_notifier_on_serialized_object_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value) { - DesktopAgnosticConfigBindingListWrapper* bindings_list; - char* full_key; - DesktopAgnosticConfigBridge* bridge; - char* _tmp0_; - GData* _tmp2_; - GData* _tmp1_ = {0}; - GObject* _tmp3_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - bindings_list = NULL; - full_key = NULL; - bridge = desktop_agnostic_config_bridge_get_default (); - full_key = (_tmp0_ = g_strdup_printf ("%s/%s/%s", desktop_agnostic_config_backend_get_instance_id (self->config), group, key), _g_free0 (full_key), _tmp0_); - bindings_list = (_tmp3_ = (GObject*) g_datalist_get_data ((_tmp2_ = (desktop_agnostic_config_bridge_get_all_bindings (bridge, &_tmp1_), _tmp1_), &_tmp2_), full_key), DESKTOP_AGNOSTIC_CONFIG_IS_BINDING_LIST_WRAPPER (_tmp3_) ? ((DesktopAgnosticConfigBindingListWrapper*) _tmp3_) : NULL); - g_return_if_fail (bindings_list != NULL); - { - GList* binding_collection; - GList* binding_it; - binding_collection = bindings_list->binding_list; - for (binding_it = binding_collection; binding_it != NULL; binding_it = binding_it->next) { - DesktopAgnosticConfigBinding* binding; - binding = (DesktopAgnosticConfigBinding*) binding_it->data; - { - GParamSpec* spec; - DesktopAgnosticConfigSchemaType* st; - GParamSpec* _tmp4_; - DesktopAgnosticConfigSchemaType* _tmp5_; - spec = NULL; - st = NULL; - spec = (_tmp4_ = _g_param_spec_ref0 (desktop_agnostic_config_bridge_get_property_spec (binding->obj, binding->property_name)), _g_param_spec_unref0 (spec), _tmp4_); - st = (_tmp5_ = _g_object_ref0 (desktop_agnostic_config_schema_find_type (spec->value_type)), _g_object_unref0 (st), _tmp5_); - if (st != NULL) { - if (!binding->read_only) { - g_signal_handler_block (binding->obj, binding->notify_id); - } - g_object_set_property (binding->obj, binding->property_name, value); - if (!binding->read_only) { - g_signal_handler_unblock (binding->obj, binding->notify_id); - } - } - _g_param_spec_unref0 (spec); - _g_object_unref0 (st); - } - } - } - _g_free0 (full_key); -} - - -static void desktop_agnostic_config_binding_notifier_class_init (DesktopAgnosticConfigBindingNotifierClass * klass) { - desktop_agnostic_config_binding_notifier_parent_class = g_type_class_peek_parent (klass); - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_binding_notifier_finalize; -} - - -static void desktop_agnostic_config_binding_notifier_instance_init (DesktopAgnosticConfigBindingNotifier * self) { -} - - -static void desktop_agnostic_config_binding_notifier_finalize (GObject* obj) { - DesktopAgnosticConfigBindingNotifier * self; - self = DESKTOP_AGNOSTIC_CONFIG_BINDING_NOTIFIER (obj); - G_OBJECT_CLASS (desktop_agnostic_config_binding_notifier_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_binding_notifier_get_type (void) { - static GType desktop_agnostic_config_binding_notifier_type_id = 0; - if (desktop_agnostic_config_binding_notifier_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigBindingNotifierClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_binding_notifier_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigBindingNotifier), 0, (GInstanceInitFunc) desktop_agnostic_config_binding_notifier_instance_init, NULL }; - desktop_agnostic_config_binding_notifier_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBindingNotifier", &g_define_type_info, 0); - } - return desktop_agnostic_config_binding_notifier_type_id; -} - - -static void _g_list_free_g_object_unref (GList* self) { - g_list_foreach (self, (GFunc) g_object_unref, NULL); - g_list_free (self); -} - - -DesktopAgnosticConfigBindingListWrapper* desktop_agnostic_config_binding_list_wrapper_construct (GType object_type) { - DesktopAgnosticConfigBindingListWrapper * self; - self = (DesktopAgnosticConfigBindingListWrapper*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticConfigBindingListWrapper* desktop_agnostic_config_binding_list_wrapper_new (void) { - return desktop_agnostic_config_binding_list_wrapper_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING_LIST_WRAPPER); -} - - -static void desktop_agnostic_config_binding_list_wrapper_class_init (DesktopAgnosticConfigBindingListWrapperClass * klass) { - desktop_agnostic_config_binding_list_wrapper_parent_class = g_type_class_peek_parent (klass); - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_binding_list_wrapper_finalize; -} - - -static void desktop_agnostic_config_binding_list_wrapper_instance_init (DesktopAgnosticConfigBindingListWrapper * self) { - self->binding_list = NULL; -} - - -static void desktop_agnostic_config_binding_list_wrapper_finalize (GObject* obj) { - DesktopAgnosticConfigBindingListWrapper * self; - self = DESKTOP_AGNOSTIC_CONFIG_BINDING_LIST_WRAPPER (obj); - __g_list_free_g_object_unref0 (self->binding_list); - G_OBJECT_CLASS (desktop_agnostic_config_binding_list_wrapper_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_binding_list_wrapper_get_type (void) { - static GType desktop_agnostic_config_binding_list_wrapper_type_id = 0; - if (desktop_agnostic_config_binding_list_wrapper_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigBindingListWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_binding_list_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigBindingListWrapper), 0, (GInstanceInitFunc) desktop_agnostic_config_binding_list_wrapper_instance_init, NULL }; - desktop_agnostic_config_binding_list_wrapper_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBindingListWrapper", &g_define_type_info, 0); - } - return desktop_agnostic_config_binding_list_wrapper_type_id; -} - - -DesktopAgnosticConfigBinding* desktop_agnostic_config_binding_construct (GType object_type) { - DesktopAgnosticConfigBinding * self; - self = (DesktopAgnosticConfigBinding*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticConfigBinding* desktop_agnostic_config_binding_new (void) { - return desktop_agnostic_config_binding_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_BINDING); -} - - -static void desktop_agnostic_config_binding_class_init (DesktopAgnosticConfigBindingClass * klass) { - desktop_agnostic_config_binding_parent_class = g_type_class_peek_parent (klass); - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_binding_finalize; -} - - -static void desktop_agnostic_config_binding_instance_init (DesktopAgnosticConfigBinding * self) { -} - - -static void desktop_agnostic_config_binding_finalize (GObject* obj) { - DesktopAgnosticConfigBinding * self; - self = DESKTOP_AGNOSTIC_CONFIG_BINDING (obj); - { - gboolean _tmp0_ = FALSE; - if (!self->read_only) { - _tmp0_ = g_signal_handler_is_connected (self->obj, self->notify_id); - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - g_signal_handler_disconnect (self->obj, self->notify_id); - } - self->obj = NULL; - } - _g_free0 (self->group); - _g_free0 (self->key); - _g_free0 (self->property_name); - G_OBJECT_CLASS (desktop_agnostic_config_binding_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_binding_get_type (void) { - static GType desktop_agnostic_config_binding_type_id = 0; - if (desktop_agnostic_config_binding_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigBindingClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_binding_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigBinding), 0, (GInstanceInitFunc) desktop_agnostic_config_binding_instance_init, NULL }; - desktop_agnostic_config_binding_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBinding", &g_define_type_info, 0); - } - return desktop_agnostic_config_binding_type_id; -} - - -static DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_construct (GType object_type) { - DesktopAgnosticConfigBridge * self; - GData* _tmp0_ = {0}; - self = (DesktopAgnosticConfigBridge*) g_object_new (object_type, NULL); - self->priv->bindings = (g_datalist_init (&_tmp0_), _tmp0_); - return self; -} - - -static DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_new (void) { - return desktop_agnostic_config_bridge_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE); -} - - -void desktop_agnostic_config_bridge_get_all_bindings (DesktopAgnosticConfigBridge* self, GData** result) { - g_return_if_fail (self != NULL); - *result = self->priv->bindings; - return; -} - - -DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_get_default (void) { - DesktopAgnosticConfigBridge* result; - if (desktop_agnostic_config_bridge_bridge == NULL) { - DesktopAgnosticConfigBridge* _tmp0_; - desktop_agnostic_config_bridge_bridge = (_tmp0_ = desktop_agnostic_config_bridge_new (), _g_object_unref0 (desktop_agnostic_config_bridge_bridge), _tmp0_); - } - result = desktop_agnostic_config_bridge_bridge; - return result; -} - - -GParamSpec* desktop_agnostic_config_bridge_get_property_spec (GObject* obj, const char* property_name) { - GParamSpec* result; - GObjectClass* obj_cls; - g_return_val_if_fail (obj != NULL, NULL); - g_return_val_if_fail (property_name != NULL, NULL); - obj_cls = (GObjectClass*) g_type_class_peek (G_TYPE_FROM_INSTANCE (obj)); - result = g_object_class_find_property (obj_cls, property_name); - return result; -} - - -static void desktop_agnostic_config_bridge_handle_notify_func (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, DesktopAgnosticConfigBridgeNotifyFuncHandler func, GError** error) { - GError * _inner_error_; - GParamSpec* spec; - g_return_if_fail (self != NULL); - g_return_if_fail (config != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (obj != NULL); - g_return_if_fail (property_name != NULL); - _inner_error_ = NULL; - spec = NULL; - spec = desktop_agnostic_config_bridge_get_property_spec (obj, property_name); - if (spec != NULL) { - desktop_agnostic_config_bridge_handle_notify_func_with_param_spec (self, config, group, key, spec, func, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } -} - - -static void _g_object_unref_gdestroy_notify (void* data) { - g_object_unref (data); -} - - -static void _desktop_agnostic_config_binding_notifier_on_simple_value_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self) { - desktop_agnostic_config_binding_notifier_on_simple_value_changed (self, group, key, value); -} - - -static void _desktop_agnostic_config_binding_notifier_on_list_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self) { - desktop_agnostic_config_binding_notifier_on_list_changed (self, group, key, value); -} - - -static void _desktop_agnostic_config_binding_notifier_on_serialized_object_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self) { - desktop_agnostic_config_binding_notifier_on_serialized_object_changed (self, group, key, value); -} - - -static void desktop_agnostic_config_bridge_handle_notify_func_with_param_spec (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GParamSpec* spec, DesktopAgnosticConfigBridgeNotifyFuncHandler func, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigBindingNotifier* notifier; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - gboolean _tmp3_ = FALSE; - gboolean _tmp4_ = FALSE; - gboolean _tmp5_ = FALSE; - g_return_if_fail (self != NULL); - g_return_if_fail (config != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (spec != NULL); - _inner_error_ = NULL; - notifier = NULL; - notifier = (DesktopAgnosticConfigBindingNotifier*) g_object_get_data ((GObject*) config, "lda-binding-notifier"); - if (notifier == NULL) { - DesktopAgnosticConfigBindingNotifier* new_notifier; - new_notifier = desktop_agnostic_config_binding_notifier_new (config); - notifier = new_notifier; - g_object_set_data_full ((GObject*) config, "lda-binding-notifier", g_object_ref ((GObject*) notifier), _g_object_unref_gdestroy_notify); - _g_object_unref0 (new_notifier); - } - if (spec->value_type == G_TYPE_BOOLEAN) { - _tmp5_ = TRUE; - } else { - _tmp5_ = spec->value_type == G_TYPE_FLOAT; - } - if (_tmp5_) { - _tmp4_ = TRUE; - } else { - _tmp4_ = spec->value_type == G_TYPE_DOUBLE; - } - if (_tmp4_) { - _tmp3_ = TRUE; - } else { - _tmp3_ = spec->value_type == G_TYPE_INT; - } - if (_tmp3_) { - _tmp2_ = TRUE; - } else { - _tmp2_ = spec->value_type == G_TYPE_LONG; - } - if (_tmp2_) { - _tmp1_ = TRUE; - } else { - _tmp1_ = G_IS_PARAM_SPEC_ENUM (spec); - } - if (_tmp1_) { - _tmp0_ = TRUE; - } else { - _tmp0_ = spec->value_type == G_TYPE_STRING; - } - if (_tmp0_) { - func (config, group, key, _desktop_agnostic_config_binding_notifier_on_simple_value_changed_desktop_agnostic_config_notify_func, notifier, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } else { - if (spec->value_type == G_TYPE_VALUE_ARRAY) { - func (config, group, key, _desktop_agnostic_config_binding_notifier_on_list_changed_desktop_agnostic_config_notify_func, notifier, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } else { - DesktopAgnosticConfigSchemaType* st; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (spec->value_type)); - if (st == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Invalid property type to bind: %s.", g_type_name (spec->value_type)); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - return; - } - } else { - func (config, group, key, _desktop_agnostic_config_binding_notifier_on_serialized_object_changed_desktop_agnostic_config_notify_func, notifier, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - return; - } - } - _g_object_unref0 (st); - } - } -} - - -static void desktop_agnostic_config_bridge_cleanup_bindings (DesktopAgnosticConfigBindingListWrapper* obj) { - GError * _inner_error_; - DesktopAgnosticConfigBridge* bridge; - g_return_if_fail (obj != NULL); - _inner_error_ = NULL; - bridge = desktop_agnostic_config_bridge_get_default (); - { - GList* b_collection; - GList* b_it; - b_collection = obj->binding_list; - for (b_it = b_collection; b_it != NULL; b_it = b_it->next) { - DesktopAgnosticConfigBinding* b; - b = _g_object_ref0 ((DesktopAgnosticConfigBinding*) b_it->data); - { - desktop_agnostic_config_bridge_remove (bridge, b->cfg, b->group, b->key, b->obj, b->property_name, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (b); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _g_object_unref0 (b); - } - } - } - g_object_unref ((GObject*) obj); -} - - -static void _desktop_agnostic_config_backend_notify_add_desktop_agnostic_config_bridge_notify_func_handler (DesktopAgnosticConfigBackend* config, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc func, void* func_target, GError** error) { - desktop_agnostic_config_backend_notify_add (config, group, key, func, func_target, error); -} - - -void desktop_agnostic_config_bridge_bind (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigBinding* binding; - GParamSpec* spec; - DesktopAgnosticConfigBinding* _tmp0_; - char* _tmp1_; - char* _tmp2_; - g_return_if_fail (self != NULL); - g_return_if_fail (config != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (obj != NULL); - g_return_if_fail (property_name != NULL); - _inner_error_ = NULL; - binding = NULL; - spec = NULL; - binding = (_tmp0_ = desktop_agnostic_config_binding_new (), _g_object_unref0 (binding), _tmp0_); - binding->cfg = config; - binding->group = (_tmp1_ = g_strdup (group), _g_free0 (binding->group), _tmp1_); - binding->key = (_tmp2_ = g_strdup (key), _g_free0 (binding->key), _tmp2_); - binding->obj = obj; - spec = desktop_agnostic_config_bridge_get_property_spec (obj, property_name); - if (spec != NULL) { - char* binding_key; - DesktopAgnosticConfigBindingListWrapper* bindings_list; - char* _tmp3_; - char* _tmp4_; - void* obj_bindings; - GValue _tmp5_ = {0}; - GValue _tmp6_; - GValue _tmp8_; - GValue _tmp7_; - binding_key = NULL; - bindings_list = NULL; - binding->property_name = (_tmp3_ = g_strdup (spec->name), _g_free0 (binding->property_name), _tmp3_); - binding_key = (_tmp4_ = g_strdup_printf ("%s/%s/%s", desktop_agnostic_config_backend_get_instance_id (config), group, key), _g_free0 (binding_key), _tmp4_); - obj_bindings = g_object_get_data (obj, "lda-bindings"); - if (obj_bindings == NULL) { - DesktopAgnosticConfigBindingListWrapper* new_bindings_list; - new_bindings_list = desktop_agnostic_config_binding_list_wrapper_new (); - new_bindings_list->binding_list = g_list_append (new_bindings_list->binding_list, _g_object_ref0 (binding)); - g_object_set_data_full (obj, "lda-bindings", g_object_ref ((GObject*) new_bindings_list), (GDestroyNotify) desktop_agnostic_config_bridge_cleanup_bindings); - _g_object_unref0 (new_bindings_list); - } else { - DesktopAgnosticConfigBindingListWrapper* object_bindings; - object_bindings = DESKTOP_AGNOSTIC_CONFIG_BINDING_LIST_WRAPPER (obj_bindings); - object_bindings->binding_list = g_list_append (object_bindings->binding_list, _g_object_ref0 (binding)); - } - _tmp6_ = (desktop_agnostic_config_backend_get_value (config, group, key, &_tmp5_, &_inner_error_), _tmp5_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (binding_key); - _g_object_unref0 (binding); - return; - } - g_object_set_property (obj, spec->name, (_tmp8_ = _tmp7_ = _tmp6_, &_tmp8_)); - G_IS_VALUE (&_tmp7_) ? (g_value_unset (&_tmp7_), NULL) : NULL; - if (!read_only) { - char* _tmp9_; - binding->notify_id = g_signal_connect (obj, _tmp9_ = g_strdup_printf ("notify::%s", spec->name), (GCallback) desktop_agnostic_config_bridge_on_property_changed, binding); - _g_free0 (_tmp9_); - } - binding->read_only = read_only; - bindings_list = (DesktopAgnosticConfigBindingListWrapper*) g_datalist_get_data (&self->priv->bindings, binding_key); - if (bindings_list == NULL) { - DesktopAgnosticConfigBindingListWrapper* new_bindings_list; - DesktopAgnosticConfigBindingListWrapper* _tmp10_; - new_bindings_list = desktop_agnostic_config_binding_list_wrapper_new (); - new_bindings_list->binding_list = g_list_append (new_bindings_list->binding_list, _g_object_ref0 (binding)); - g_datalist_set_data_full (&self->priv->bindings, binding_key, (_tmp10_ = new_bindings_list, new_bindings_list = NULL, _tmp10_), (GDestroyNotify) g_object_unref); - desktop_agnostic_config_bridge_handle_notify_func_with_param_spec (self, config, group, key, spec, _desktop_agnostic_config_backend_notify_add_desktop_agnostic_config_bridge_notify_func_handler, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (new_bindings_list); - _g_free0 (binding_key); - _g_object_unref0 (binding); - return; - } - _g_object_unref0 (new_bindings_list); - } else { - bindings_list->binding_list = g_list_append (bindings_list->binding_list, _g_object_ref0 (binding)); - } - _g_free0 (binding_key); - } else { - gint properties_size; - gint properties_length1; - GParamSpec** properties; - char* props_str; - GParamSpec** _tmp12_; - guint _tmp11_; - char* _tmp13_; - properties = (properties_length1 = 0, NULL); - props_str = NULL; - properties = (_tmp12_ = g_object_class_list_properties ((GObjectClass*) g_type_class_peek (G_TYPE_FROM_INSTANCE (obj)), &_tmp11_), properties_length1 = _tmp11_, properties_size = properties_length1, _tmp12_); - props_str = (_tmp13_ = g_strdup (""), _g_free0 (props_str), _tmp13_); - { - GParamSpec** property_collection; - int property_collection_length1; - int property_it; - property_collection = properties; - property_collection_length1 = properties_length1; - for (property_it = 0; property_it < properties_length1; property_it = property_it + 1) { - GParamSpec* property; - property = property_collection[property_it]; - { - char* _tmp15_; - if (_vala_strcmp0 (props_str, "") != 0) { - char* _tmp14_; - props_str = (_tmp14_ = g_strconcat (props_str, ", ", NULL), _g_free0 (props_str), _tmp14_); - } - props_str = (_tmp15_ = g_strconcat (props_str, property->name, NULL), _g_free0 (props_str), _tmp15_); - } - } - } - g_warning ("config-bridge.vala:338: Invalid property name for the object (%s). Valid properties (%d): %s", property_name, properties_length1, props_str); - _g_free0 (props_str); - } - _g_object_unref0 (binding); -} - - -static void _desktop_agnostic_config_backend_notify_remove_desktop_agnostic_config_bridge_notify_func_handler (DesktopAgnosticConfigBackend* config, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc func, void* func_target, GError** error) { - desktop_agnostic_config_backend_notify_remove (config, group, key, func, func_target, error); -} - - -void desktop_agnostic_config_bridge_remove (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigBindingListWrapper* bindings_list; - GSList* bindings_to_remove; - guint pos; - char* binding_key; - DesktopAgnosticConfigBindingListWrapper* obj_bindings; - char* _tmp0_; - GSList* _tmp1_; - g_return_if_fail (self != NULL); - g_return_if_fail (config != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (obj != NULL); - g_return_if_fail (property_name != NULL); - _inner_error_ = NULL; - bindings_list = NULL; - bindings_to_remove = NULL; - pos = (guint) (-1); - binding_key = NULL; - obj_bindings = (DesktopAgnosticConfigBindingListWrapper*) g_object_get_data (obj, "lda-bindings"); - binding_key = (_tmp0_ = g_strdup_printf ("%s/%s/%s", desktop_agnostic_config_backend_get_instance_id (config), group, key), _g_free0 (binding_key), _tmp0_); - bindings_list = (DesktopAgnosticConfigBindingListWrapper*) g_datalist_get_data (&self->priv->bindings, binding_key); - bindings_to_remove = (_tmp1_ = NULL, _g_slist_free0 (bindings_to_remove), _tmp1_); - if (bindings_list == NULL) { - _g_slist_free0 (bindings_to_remove); - _g_free0 (binding_key); - return; - } - { - GList* binding_collection; - GList* binding_it; - binding_collection = bindings_list->binding_list; - for (binding_it = binding_collection; binding_it != NULL; binding_it = binding_it->next) { - DesktopAgnosticConfigBinding* binding; - binding = (DesktopAgnosticConfigBinding*) binding_it->data; - { - pos++; - if (binding->obj == obj) { - bindings_to_remove = g_slist_prepend (bindings_to_remove, GUINT_TO_POINTER (pos)); - if (obj_bindings != NULL) { - GList* node; - node = NULL; - node = g_list_find (obj_bindings->binding_list, binding); - if (node != NULL) { - DesktopAgnosticConfigBinding* _tmp2_; - node->data = (_tmp2_ = NULL, _g_object_unref0 (node->data), _tmp2_); - obj_bindings->binding_list = g_list_delete_link (obj_bindings->binding_list, node); - } - } - } - } - } - } - { - GSList* binding_pos_collection; - GSList* binding_pos_it; - binding_pos_collection = bindings_to_remove; - for (binding_pos_it = binding_pos_collection; binding_pos_it != NULL; binding_pos_it = binding_pos_it->next) { - guint binding_pos; - binding_pos = GPOINTER_TO_UINT (binding_pos_it->data); - { - GList* node; - DesktopAgnosticConfigBinding* _tmp3_; - node = NULL; - node = g_list_nth (bindings_list->binding_list, binding_pos); - node->data = (_tmp3_ = NULL, _g_object_unref0 (node->data), _tmp3_); - bindings_list->binding_list = g_list_delete_link (bindings_list->binding_list, node); - } - } - } - if (g_list_length (bindings_list->binding_list) == 0) { - desktop_agnostic_config_bridge_handle_notify_func (self, config, group, key, obj, property_name, _desktop_agnostic_config_backend_notify_remove_desktop_agnostic_config_bridge_notify_func_handler, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_slist_free0 (bindings_to_remove); - _g_free0 (binding_key); - return; - } - g_datalist_remove_data (&self->priv->bindings, binding_key); - } - _g_slist_free0 (bindings_to_remove); - _g_free0 (binding_key); -} - - -void desktop_agnostic_config_bridge_remove_all_for_object (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, GObject* obj, GError** error) { - GError * _inner_error_; - void* data; - g_return_if_fail (self != NULL); - g_return_if_fail (obj != NULL); - _inner_error_ = NULL; - data = g_object_steal_data (obj, "lda-bindings"); - if (data != NULL) { - DesktopAgnosticConfigBindingListWrapper* obj_bindings; - obj_bindings = DESKTOP_AGNOSTIC_CONFIG_BINDING_LIST_WRAPPER (data); - { - GList* b_collection; - GList* b_it; - b_collection = obj_bindings->binding_list; - for (b_it = b_collection; b_it != NULL; b_it = b_it->next) { - DesktopAgnosticConfigBinding* b; - b = _g_object_ref0 ((DesktopAgnosticConfigBinding*) b_it->data); - { - desktop_agnostic_config_bridge_remove (self, b->cfg, b->group, b->key, obj, b->property_name, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (b); - return; - } - _g_object_unref0 (b); - } - } - } - g_object_unref ((GObject*) obj_bindings); - } -} - - -static void desktop_agnostic_config_bridge_on_property_changed (GObject* obj, GParamSpec* spec, DesktopAgnosticConfigBinding* binding) { - GError * _inner_error_; - g_return_if_fail (obj != NULL); - g_return_if_fail (spec != NULL); - g_return_if_fail (binding != NULL); - _inner_error_ = NULL; - { - GValue _tmp0_ = {0}; - GValue val; - val = (g_value_init (&_tmp0_, spec->value_type), _tmp0_); - g_object_get_property (obj, spec->name, &val); - desktop_agnostic_config_backend_set_value (binding->cfg, binding->group, binding->key, &val, &_inner_error_); - if (_inner_error_ != NULL) { - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - goto __catch0_g_error; - } - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("config-bridge.vala:437: Configuration error: %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } -} - - -static void desktop_agnostic_config_bridge_class_init (DesktopAgnosticConfigBridgeClass * klass) { - desktop_agnostic_config_bridge_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticConfigBridgePrivate)); - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_bridge_finalize; -} - - -static void desktop_agnostic_config_bridge_instance_init (DesktopAgnosticConfigBridge * self) { - self->priv = DESKTOP_AGNOSTIC_CONFIG_BRIDGE_GET_PRIVATE (self); -} - - -static void desktop_agnostic_config_bridge_finalize (GObject* obj) { - DesktopAgnosticConfigBridge * self; - self = DESKTOP_AGNOSTIC_CONFIG_BRIDGE (obj); - G_OBJECT_CLASS (desktop_agnostic_config_bridge_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_bridge_get_type (void) { - static GType desktop_agnostic_config_bridge_type_id = 0; - if (desktop_agnostic_config_bridge_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigBridgeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_bridge_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigBridge), 0, (GInstanceInitFunc) desktop_agnostic_config_bridge_instance_init, NULL }; - desktop_agnostic_config_bridge_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBridge", &g_define_type_info, 0); - } - return desktop_agnostic_config_bridge_type_id; -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config.c 2010-04-11 07:32:22.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,812 +0,0 @@ -/* config.c generated by valac, the Vala compiler - * generated from config.vala, do not modify */ - -/* - * Interface for the configuration implementations. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND (desktop_agnostic_config_backend_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackend)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) - -typedef struct _DesktopAgnosticConfigBackend DesktopAgnosticConfigBackend; -typedef struct _DesktopAgnosticConfigBackendClass DesktopAgnosticConfigBackendClass; -typedef struct _DesktopAgnosticConfigBackendPrivate DesktopAgnosticConfigBackendPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA (desktop_agnostic_config_schema_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchema)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) - -typedef struct _DesktopAgnosticConfigSchema DesktopAgnosticConfigSchema; -typedef struct _DesktopAgnosticConfigSchemaClass DesktopAgnosticConfigSchemaClass; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION (desktop_agnostic_config_schema_option_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOption)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) - -typedef struct _DesktopAgnosticConfigSchemaOption DesktopAgnosticConfigSchemaOption; -typedef struct _DesktopAgnosticConfigSchemaOptionClass DesktopAgnosticConfigSchemaOptionClass; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE (desktop_agnostic_config_schema_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaType)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) - -typedef struct _DesktopAgnosticConfigSchemaType DesktopAgnosticConfigSchemaType; -typedef struct _DesktopAgnosticConfigSchemaTypeClass DesktopAgnosticConfigSchemaTypeClass; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_ERROR_NO_SCHEMA, - DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_METADATA_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_NOTIFY, - DESKTOP_AGNOSTIC_CONFIG_ERROR_DUPLICATE_BINDING -} DesktopAgnosticConfigError; -#define DESKTOP_AGNOSTIC_CONFIG_ERROR desktop_agnostic_config_error_quark () -typedef void (*DesktopAgnosticConfigNotifyFunc) (const char* group, const char* key, GValue* value, void* user_data); -struct _DesktopAgnosticConfigBackend { - GObject parent_instance; - DesktopAgnosticConfigBackendPrivate * priv; -}; - -struct _DesktopAgnosticConfigBackendClass { - GObjectClass parent_class; - void (*reset) (DesktopAgnosticConfigBackend* self, GError** error); - void (*remove) (DesktopAgnosticConfigBackend* self, GError** error); - void (*notify_add) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); - void (*notify) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*notify_remove) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); - void (*get_value) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error); - void (*set_value) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error); - gboolean (*get_bool) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_bool) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error); - float (*get_float) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_float) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error); - gint (*get_int) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_int) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error); - char* (*get_string) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_string) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error); - GValueArray* (*get_list) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_list) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error); - char* (*get_name) (DesktopAgnosticConfigBackend* self); -}; - -struct _DesktopAgnosticConfigBackendPrivate { - DesktopAgnosticConfigSchema* _schema; - char* _instance_id; -}; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS -} DesktopAgnosticConfigSchemaError; -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR desktop_agnostic_config_schema_error_quark () - -static GHashTable* desktop_agnostic_config_backend__backend_metadata_keys; -static GHashTable* desktop_agnostic_config_backend__backend_metadata_keys = NULL; -static gpointer desktop_agnostic_config_backend_parent_class = NULL; -extern GType* desktop_agnostic_config_module_type; -GType* desktop_agnostic_config_module_type = NULL; - -GQuark desktop_agnostic_config_error_quark (void); -#define DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT "DEFAULT" -GType desktop_agnostic_config_backend_get_type (void); -GType desktop_agnostic_config_schema_get_type (void); -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendPrivate)) -enum { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_BACKEND_NAME, - DESKTOP_AGNOSTIC_CONFIG_BACKEND_SCHEMA, - DESKTOP_AGNOSTIC_CONFIG_BACKEND_INSTANCE_ID -}; -GHashTable* desktop_agnostic_config_backend_get_backend_metadata_keys (void); -void desktop_agnostic_config_backend_reset (DesktopAgnosticConfigBackend* self, GError** error); -static void desktop_agnostic_config_backend_real_reset (DesktopAgnosticConfigBackend* self, GError** error); -void desktop_agnostic_config_backend_remove (DesktopAgnosticConfigBackend* self, GError** error); -static void desktop_agnostic_config_backend_real_remove (DesktopAgnosticConfigBackend* self, GError** error); -void desktop_agnostic_config_backend_notify_add (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void desktop_agnostic_config_backend_real_notify_add (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_backend_notify (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_backend_real_notify (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_notify_remove (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void desktop_agnostic_config_backend_real_notify_remove (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_backend_get_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error); -static void desktop_agnostic_config_backend_real_get_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error); -GType desktop_agnostic_config_schema_option_get_type (void); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_get_option (DesktopAgnosticConfigSchema* self, const char* group, const char* key); -GType desktop_agnostic_config_schema_option_get_option_type (DesktopAgnosticConfigSchemaOption* self); -void desktop_agnostic_config_backend_set_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error); -float desktop_agnostic_config_backend_get_float_from_value (GValue* value, GError** error); -void desktop_agnostic_config_backend_set_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error); -gint desktop_agnostic_config_backend_get_int_from_value (GValue* value, GError** error); -void desktop_agnostic_config_backend_set_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error); -void desktop_agnostic_config_backend_set_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error); -void desktop_agnostic_config_backend_set_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error); -DesktopAgnosticConfigSchema* desktop_agnostic_config_backend_get_schema (DesktopAgnosticConfigBackend* self); -GType desktop_agnostic_config_schema_type_get_type (void); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type); -GQuark desktop_agnostic_config_schema_error_quark (void); -char* desktop_agnostic_config_schema_type_serialize (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error); -void desktop_agnostic_config_backend_set_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error); -static void desktop_agnostic_config_backend_real_set_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error); -gboolean desktop_agnostic_config_backend_get_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static gboolean desktop_agnostic_config_backend_real_get_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_backend_real_set_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error); -float desktop_agnostic_config_backend_get_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static float desktop_agnostic_config_backend_real_get_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_backend_real_set_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error); -gint desktop_agnostic_config_backend_get_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static gint desktop_agnostic_config_backend_real_get_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_backend_real_set_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error); -char* desktop_agnostic_config_backend_get_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static char* desktop_agnostic_config_backend_real_get_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_backend_real_set_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error); -GValueArray* desktop_agnostic_config_backend_get_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static GValueArray* desktop_agnostic_config_backend_real_get_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_backend_real_set_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_backend_construct (GType object_type); -char* desktop_agnostic_config_backend_get_name (DesktopAgnosticConfigBackend* self); -static void desktop_agnostic_config_backend_set_schema (DesktopAgnosticConfigBackend* self, DesktopAgnosticConfigSchema* value); -const char* desktop_agnostic_config_backend_get_instance_id (DesktopAgnosticConfigBackend* self); -static void desktop_agnostic_config_backend_set_instance_id (DesktopAgnosticConfigBackend* self, const char* value); -static void desktop_agnostic_config_backend_finalize (GObject* obj); -static void desktop_agnostic_config_backend_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_config_backend_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -static GType* _g_type_dup (GType* self); -GType desktop_agnostic_config_get_type (GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_new (DesktopAgnosticConfigSchema* schema, GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_new_for_instance (const char* instance_id, DesktopAgnosticConfigSchema* schema, GError** error); - - - -GQuark desktop_agnostic_config_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_config_error-quark"); -} - - -GHashTable* desktop_agnostic_config_backend_get_backend_metadata_keys (void) { - GHashTable* result; - if (desktop_agnostic_config_backend__backend_metadata_keys == NULL) { - GHashTable* _tmp0_; - desktop_agnostic_config_backend__backend_metadata_keys = (_tmp0_ = g_hash_table_new (g_str_hash, g_str_equal), _g_hash_table_unref0 (desktop_agnostic_config_backend__backend_metadata_keys), _tmp0_); - } - result = desktop_agnostic_config_backend__backend_metadata_keys; - return result; -} - - -static void desktop_agnostic_config_backend_real_reset (DesktopAgnosticConfigBackend* self, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_reset'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_reset (DesktopAgnosticConfigBackend* self, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->reset (self, error); -} - - -static void desktop_agnostic_config_backend_real_remove (DesktopAgnosticConfigBackend* self, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_remove'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_remove (DesktopAgnosticConfigBackend* self, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->remove (self, error); -} - - -static void desktop_agnostic_config_backend_real_notify_add (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_notify_add'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_notify_add (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->notify_add (self, group, key, callback, callback_target, error); -} - - -static void desktop_agnostic_config_backend_real_notify (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_notify'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_notify (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->notify (self, group, key, error); -} - - -static void desktop_agnostic_config_backend_real_notify_remove (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_notify_remove'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_notify_remove (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->notify_remove (self, group, key, callback, callback_target, error); -} - - -static void desktop_agnostic_config_backend_real_get_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_get_value'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_get_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->get_value (self, group, key, result, error); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_config_backend_real_set_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigSchemaOption* option; - GType option_type = 0UL; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - option = _g_object_ref0 (desktop_agnostic_config_schema_get_option (self->priv->_schema, group, key)); - if (option == NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, "Could not find group and/or key in schema."); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } - option_type = desktop_agnostic_config_schema_option_get_option_type (option); - if (option_type == G_TYPE_BOOLEAN) { - desktop_agnostic_config_backend_set_bool (self, group, key, g_value_get_boolean (value), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - if (option_type == G_TYPE_FLOAT) { - float _tmp0_; - _tmp0_ = desktop_agnostic_config_backend_get_float_from_value (value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - desktop_agnostic_config_backend_set_float (self, group, key, _tmp0_, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - if (option_type == G_TYPE_INT) { - gint _tmp1_; - _tmp1_ = desktop_agnostic_config_backend_get_int_from_value (value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - desktop_agnostic_config_backend_set_int (self, group, key, _tmp1_, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - if (option_type == G_TYPE_STRING) { - desktop_agnostic_config_backend_set_string (self, group, key, g_value_get_string (value), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - if (option_type == G_TYPE_VALUE_ARRAY) { - desktop_agnostic_config_backend_set_list (self, group, key, g_value_get_boxed (value), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - DesktopAgnosticConfigSchemaType* st; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (option_type)); - if (st == NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Invalid config value type."); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (option); - return; - } - } else { - char* _tmp2_; - char* _tmp3_; - _tmp2_ = desktop_agnostic_config_schema_type_serialize (st, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (option); - return; - } - desktop_agnostic_config_backend_set_string (self, group, key, _tmp3_ = _tmp2_, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (option); - return; - } - _g_free0 (_tmp3_); - } - _g_object_unref0 (st); - } - } - } - } - } - _g_object_unref0 (option); -} - - -void desktop_agnostic_config_backend_set_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->set_value (self, group, key, value, error); -} - - -static gboolean desktop_agnostic_config_backend_real_get_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - g_return_val_if_fail (self != NULL, FALSE); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_get_bool'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return FALSE; -} - - -gboolean desktop_agnostic_config_backend_get_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - return DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->get_bool (self, group, key, error); -} - - -static void desktop_agnostic_config_backend_real_set_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_set_bool'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_set_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->set_bool (self, group, key, value, error); -} - - -static float desktop_agnostic_config_backend_real_get_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - g_return_val_if_fail (self != NULL, 0.0F); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_get_float'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return 0.0F; -} - - -float desktop_agnostic_config_backend_get_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - return DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->get_float (self, group, key, error); -} - - -static void desktop_agnostic_config_backend_real_set_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_set_float'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_set_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->set_float (self, group, key, value, error); -} - - -static gint desktop_agnostic_config_backend_real_get_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - g_return_val_if_fail (self != NULL, 0); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_get_int'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return 0; -} - - -gint desktop_agnostic_config_backend_get_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - return DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->get_int (self, group, key, error); -} - - -static void desktop_agnostic_config_backend_real_set_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_set_int'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_set_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->set_int (self, group, key, value, error); -} - - -static char* desktop_agnostic_config_backend_real_get_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - g_return_val_if_fail (self != NULL, NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_get_string'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return NULL; -} - - -char* desktop_agnostic_config_backend_get_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - return DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->get_string (self, group, key, error); -} - - -static void desktop_agnostic_config_backend_real_set_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_set_string'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_set_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->set_string (self, group, key, value, error); -} - - -static GValueArray* desktop_agnostic_config_backend_real_get_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - g_return_val_if_fail (self != NULL, NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_get_list'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return NULL; -} - - -GValueArray* desktop_agnostic_config_backend_get_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error) { - return DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->get_list (self, group, key, error); -} - - -static void desktop_agnostic_config_backend_real_set_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_backend_set_list'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_backend_set_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->set_list (self, group, key, value, error); -} - - -float desktop_agnostic_config_backend_get_float_from_value (GValue* value, GError** error) { - float result; - GError * _inner_error_; - _inner_error_ = NULL; - if (G_VALUE_HOLDS (value, G_TYPE_FLOAT)) { - result = g_value_get_float (value); - return result; - } else { - if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_FLOAT)) { - GValue _tmp0_ = {0}; - GValue converted; - converted = (g_value_init (&_tmp0_, G_TYPE_FLOAT), _tmp0_); - g_value_transform (value, &converted); - result = g_value_get_float (&converted); - G_IS_VALUE (&converted) ? (g_value_unset (&converted), NULL) : NULL; - return result; - } else { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Value given cannot be converted to a float: %s.", g_type_name (G_VALUE_TYPE (value))); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - return 0.0F; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0.0F; - } - } - } - } -} - - -gint desktop_agnostic_config_backend_get_int_from_value (GValue* value, GError** error) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - if (G_VALUE_HOLDS (value, G_TYPE_INT)) { - result = g_value_get_int (value); - return result; - } else { - if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_INT)) { - GValue _tmp0_ = {0}; - GValue converted; - converted = (g_value_init (&_tmp0_, G_TYPE_INT), _tmp0_); - g_value_transform (value, &converted); - result = g_value_get_int (&converted); - G_IS_VALUE (&converted) ? (g_value_unset (&converted), NULL) : NULL; - return result; - } else { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Value given cannot be converted to an integer: %s.", g_type_name (G_VALUE_TYPE (value))); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - return 0; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - } - } - } -} - - -DesktopAgnosticConfigBackend* desktop_agnostic_config_backend_construct (GType object_type) { - DesktopAgnosticConfigBackend * self; - self = (DesktopAgnosticConfigBackend*) g_object_new (object_type, NULL); - return self; -} - - -char* desktop_agnostic_config_backend_get_name (DesktopAgnosticConfigBackend* self) { - return DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS (self)->get_name (self); -} - - -DesktopAgnosticConfigSchema* desktop_agnostic_config_backend_get_schema (DesktopAgnosticConfigBackend* self) { - DesktopAgnosticConfigSchema* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_schema; - return result; -} - - -static void desktop_agnostic_config_backend_set_schema (DesktopAgnosticConfigBackend* self, DesktopAgnosticConfigSchema* value) { - DesktopAgnosticConfigSchema* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_schema = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_schema), _tmp0_); - g_object_notify ((GObject *) self, "schema"); -} - - -const char* desktop_agnostic_config_backend_get_instance_id (DesktopAgnosticConfigBackend* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_instance_id; - return result; -} - - -static void desktop_agnostic_config_backend_set_instance_id (DesktopAgnosticConfigBackend* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_instance_id = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_instance_id), _tmp0_); - g_object_notify ((GObject *) self, "instance-id"); -} - - -static void desktop_agnostic_config_backend_class_init (DesktopAgnosticConfigBackendClass * klass) { - desktop_agnostic_config_backend_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticConfigBackendPrivate)); - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->reset = desktop_agnostic_config_backend_real_reset; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->remove = desktop_agnostic_config_backend_real_remove; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify_add = desktop_agnostic_config_backend_real_notify_add; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify = desktop_agnostic_config_backend_real_notify; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify_remove = desktop_agnostic_config_backend_real_notify_remove; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_value = desktop_agnostic_config_backend_real_get_value; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_value = desktop_agnostic_config_backend_real_set_value; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_bool = desktop_agnostic_config_backend_real_get_bool; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_bool = desktop_agnostic_config_backend_real_set_bool; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_float = desktop_agnostic_config_backend_real_get_float; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_float = desktop_agnostic_config_backend_real_set_float; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_int = desktop_agnostic_config_backend_real_get_int; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_int = desktop_agnostic_config_backend_real_set_int; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_string = desktop_agnostic_config_backend_real_get_string; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_string = desktop_agnostic_config_backend_real_set_string; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_list = desktop_agnostic_config_backend_real_get_list; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_list = desktop_agnostic_config_backend_real_set_list; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_backend_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_config_backend_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_backend_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_BACKEND_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_BACKEND_SCHEMA, g_param_spec_object ("schema", "schema", "schema", DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_BACKEND_INSTANCE_ID, g_param_spec_string ("instance-id", "instance-id", "instance-id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); -} - - -static void desktop_agnostic_config_backend_instance_init (DesktopAgnosticConfigBackend * self) { - self->priv = DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_PRIVATE (self); - self->priv->_schema = NULL; -} - - -static void desktop_agnostic_config_backend_finalize (GObject* obj) { - DesktopAgnosticConfigBackend * self; - self = DESKTOP_AGNOSTIC_CONFIG_BACKEND (obj); - _g_object_unref0 (self->priv->_schema); - _g_free0 (self->priv->_instance_id); - G_OBJECT_CLASS (desktop_agnostic_config_backend_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_backend_get_type (void) { - static GType desktop_agnostic_config_backend_type_id = 0; - if (desktop_agnostic_config_backend_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigBackendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_backend_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigBackend), 0, (GInstanceInitFunc) desktop_agnostic_config_backend_instance_init, NULL }; - desktop_agnostic_config_backend_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBackend", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); - } - return desktop_agnostic_config_backend_type_id; -} - - -static void desktop_agnostic_config_backend_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigBackend * self; - self = DESKTOP_AGNOSTIC_CONFIG_BACKEND (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_BACKEND_SCHEMA: - g_value_set_object (value, desktop_agnostic_config_backend_get_schema (self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_BACKEND_INSTANCE_ID: - g_value_set_string (value, desktop_agnostic_config_backend_get_instance_id (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_config_backend_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigBackend * self; - self = DESKTOP_AGNOSTIC_CONFIG_BACKEND (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_BACKEND_SCHEMA: - desktop_agnostic_config_backend_set_schema (self, g_value_get_object (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_BACKEND_INSTANCE_ID: - desktop_agnostic_config_backend_set_instance_id (self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static GType* _g_type_dup (GType* self) { - GType* dup; - dup = g_new0 (GType, 1); - memcpy (dup, self, sizeof (GType)); - return dup; -} - - -static gpointer __g_type_dup0 (gpointer self) { - return self ? _g_type_dup (self) : NULL; -} - - -GType desktop_agnostic_config_get_type (GError** error) { - GType result; - GError * _inner_error_; - _inner_error_ = NULL; - if (desktop_agnostic_config_module_type == NULL) { - GType _tmp0_; - GType* _tmp1_; - _tmp0_ = desktop_agnostic_get_module_type ("cfg", "config", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return 0UL; - } - desktop_agnostic_config_module_type = (_tmp1_ = __g_type_dup0 (&_tmp0_), _g_free0 (desktop_agnostic_config_module_type), _tmp1_); - } - result = *desktop_agnostic_config_module_type; - return result; -} - - -DesktopAgnosticConfigBackend* desktop_agnostic_config_new (DesktopAgnosticConfigSchema* schema, GError** error) { - DesktopAgnosticConfigBackend* result; - GError * _inner_error_; - GType type; - g_return_val_if_fail (schema != NULL, NULL); - _inner_error_ = NULL; - type = desktop_agnostic_config_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (type == G_TYPE_INVALID) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_CONFIG_BACKEND (g_object_new (type, "schema", schema, NULL)); - return result; - } -} - - -DesktopAgnosticConfigBackend* desktop_agnostic_config_new_for_instance (const char* instance_id, DesktopAgnosticConfigSchema* schema, GError** error) { - DesktopAgnosticConfigBackend* result; - GError * _inner_error_; - GType type; - g_return_val_if_fail (instance_id != NULL, NULL); - g_return_val_if_fail (schema != NULL, NULL); - _inner_error_ = NULL; - type = desktop_agnostic_config_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (type == G_TYPE_INVALID) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_CONFIG_BACKEND (g_object_new (type, "schema", schema, "instance_id", instance_id, NULL)); - return result; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-client.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-client.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-client.c 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-client.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1104 +0,0 @@ -/* config-client.c generated by valac, the Vala compiler - * generated from config-client.vala, do not modify */ - -/* - * Desktop Agnostic Library: Configuration frontend. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BIND_METHOD (desktop_agnostic_config_bind_method_get_type ()) - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT (desktop_agnostic_config_client_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, DesktopAgnosticConfigClient)) -#define DESKTOP_AGNOSTIC_CONFIG_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, DesktopAgnosticConfigClientClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT)) -#define DESKTOP_AGNOSTIC_CONFIG_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, DesktopAgnosticConfigClientClass)) - -typedef struct _DesktopAgnosticConfigClient DesktopAgnosticConfigClient; -typedef struct _DesktopAgnosticConfigClientClass DesktopAgnosticConfigClientClass; -typedef struct _DesktopAgnosticConfigClientPrivate DesktopAgnosticConfigClientPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA (desktop_agnostic_config_schema_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchema)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) - -typedef struct _DesktopAgnosticConfigSchema DesktopAgnosticConfigSchema; -typedef struct _DesktopAgnosticConfigSchemaClass DesktopAgnosticConfigSchemaClass; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND (desktop_agnostic_config_backend_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackend)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) - -typedef struct _DesktopAgnosticConfigBackend DesktopAgnosticConfigBackend; -typedef struct _DesktopAgnosticConfigBackendClass DesktopAgnosticConfigBackendClass; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL))) - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION (desktop_agnostic_config_schema_option_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOption)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) - -typedef struct _DesktopAgnosticConfigSchemaOption DesktopAgnosticConfigSchemaOption; -typedef struct _DesktopAgnosticConfigSchemaOptionClass DesktopAgnosticConfigSchemaOptionClass; -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE (desktop_agnostic_config_bridge_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridge)) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE)) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass)) - -typedef struct _DesktopAgnosticConfigBridge DesktopAgnosticConfigBridge; -typedef struct _DesktopAgnosticConfigBridgeClass DesktopAgnosticConfigBridgeClass; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_GLOBAL, - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_INSTANCE, - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH -} DesktopAgnosticConfigBindMethod; - -struct _DesktopAgnosticConfigClient { - GObject parent_instance; - DesktopAgnosticConfigClientPrivate * priv; -}; - -struct _DesktopAgnosticConfigClientClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigClientPrivate { - DesktopAgnosticConfigSchema* _schema; - DesktopAgnosticConfigBackend* global; - DesktopAgnosticConfigBackend* instance; -}; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS -} DesktopAgnosticConfigSchemaError; -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR desktop_agnostic_config_schema_error_quark () -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_ERROR_NO_SCHEMA, - DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_METADATA_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_NOTIFY, - DESKTOP_AGNOSTIC_CONFIG_ERROR_DUPLICATE_BINDING -} DesktopAgnosticConfigError; -#define DESKTOP_AGNOSTIC_CONFIG_ERROR desktop_agnostic_config_error_quark () -typedef void (*DesktopAgnosticConfigNotifyFunc) (const char* group, const char* key, GValue* value, void* user_data); - -static gpointer desktop_agnostic_config_client_parent_class = NULL; - -GType desktop_agnostic_config_bind_method_get_type (void); -GType desktop_agnostic_config_client_get_type (void); -GType desktop_agnostic_config_schema_get_type (void); -GType desktop_agnostic_config_backend_get_type (void); -#define DESKTOP_AGNOSTIC_CONFIG_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, DesktopAgnosticConfigClientPrivate)) -enum { - DESKTOP_AGNOSTIC_CONFIG_CLIENT_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_CLIENT_INSTANCE_ID, - DESKTOP_AGNOSTIC_CONFIG_CLIENT_SCHEMA_FILENAME -}; -static void desktop_agnostic_config_client_set_schema_filename (DesktopAgnosticConfigClient* self, const char* value); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new (const char* schema_filename); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct (GType object_type, const char* schema_filename); -static void desktop_agnostic_config_client_set_instance_id (DesktopAgnosticConfigClient* self, const char* value); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new_for_instance (const char* schema_filename, const char* instance_id, GError** error); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct_for_instance (GType object_type, const char* schema_filename, const char* instance_id, GError** error); -static void desktop_agnostic_config_client_create_global_config (DesktopAgnosticConfigClient* self); -static gboolean desktop_agnostic_config_client_create_instance_config (DesktopAgnosticConfigClient* self, const char* instance_id, GError** error); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new_for_schema (DesktopAgnosticConfigSchema* schema, const char* instance_id, GError** error); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct_for_schema (GType object_type, DesktopAgnosticConfigSchema* schema, const char* instance_id, GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_new (DesktopAgnosticConfigSchema* schema, GError** error); -GQuark desktop_agnostic_config_schema_error_quark (void); -GValue* desktop_agnostic_config_schema_get_metadata_option (DesktopAgnosticConfigSchema* self, const char* name, GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_new_for_instance (const char* instance_id, DesktopAgnosticConfigSchema* schema, GError** error); -GType desktop_agnostic_config_schema_option_get_type (void); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_get_option (DesktopAgnosticConfigSchema* self, const char* group, const char* key); -gboolean desktop_agnostic_config_schema_option_get_per_instance (DesktopAgnosticConfigSchemaOption* self); -static DesktopAgnosticConfigBackend* desktop_agnostic_config_client_get_backend (DesktopAgnosticConfigClient* self, const char* group, const char* key); -gboolean desktop_agnostic_config_backend_get_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -gboolean desktop_agnostic_config_client_get_bool (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error); -void desktop_agnostic_config_client_set_bool (DesktopAgnosticConfigClient* self, const char* group, const char* key, gboolean value, GError** error); -gint desktop_agnostic_config_backend_get_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -gint desktop_agnostic_config_client_get_int (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error); -void desktop_agnostic_config_client_set_int (DesktopAgnosticConfigClient* self, const char* group, const char* key, gint value, GError** error); -float desktop_agnostic_config_backend_get_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -float desktop_agnostic_config_client_get_float (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error); -void desktop_agnostic_config_client_set_float (DesktopAgnosticConfigClient* self, const char* group, const char* key, float value, GError** error); -char* desktop_agnostic_config_backend_get_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -char* desktop_agnostic_config_client_get_string (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error); -void desktop_agnostic_config_client_set_string (DesktopAgnosticConfigClient* self, const char* group, const char* key, const char* value, GError** error); -GValueArray* desktop_agnostic_config_backend_get_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -GValueArray* desktop_agnostic_config_client_get_list (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error); -void desktop_agnostic_config_client_set_list (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValueArray* value, GError** error); -void desktop_agnostic_config_backend_get_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error); -static GValue* _g_value_dup (GValue* self); -GQuark desktop_agnostic_config_error_quark (void); -void desktop_agnostic_config_client_get_value (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValue* result, GError** error); -void desktop_agnostic_config_backend_set_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error); -void desktop_agnostic_config_client_set_value (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValue* value, GError** error); -void desktop_agnostic_config_backend_notify_add (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_client_notify_add (DesktopAgnosticConfigClient* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_backend_notify (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_client_notify (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_notify_remove (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_client_notify_remove (DesktopAgnosticConfigClient* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_client_remove_instance (DesktopAgnosticConfigClient* self); -void desktop_agnostic_config_backend_reset (DesktopAgnosticConfigBackend* self, GError** error); -void desktop_agnostic_config_client_reset (DesktopAgnosticConfigClient* self, gboolean instance_only, GError** error); -GType desktop_agnostic_config_bridge_get_type (void); -DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_get_default (void); -void desktop_agnostic_config_bridge_bind (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, GError** error); -void desktop_agnostic_config_client_bind (DesktopAgnosticConfigClient* self, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, DesktopAgnosticConfigBindMethod method, GError** error); -void desktop_agnostic_config_bridge_remove (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, GError** error); -void desktop_agnostic_config_client_unbind (DesktopAgnosticConfigClient* self, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, DesktopAgnosticConfigBindMethod method, GError** error); -void desktop_agnostic_config_bridge_remove_all_for_object (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, GObject* obj, GError** error); -void desktop_agnostic_config_client_unbind_all_for_object (DesktopAgnosticConfigClient* self, GObject* obj, GError** error); -const char* desktop_agnostic_config_backend_get_instance_id (DesktopAgnosticConfigBackend* self); -const char* desktop_agnostic_config_client_get_instance_id (DesktopAgnosticConfigClient* self); -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_new (const char* filename, GError** error); -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_construct (GType object_type, const char* filename, GError** error); -static void desktop_agnostic_config_client_finalize (GObject* obj); -static void desktop_agnostic_config_client_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_config_client_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); - - - - -GType desktop_agnostic_config_bind_method_get_type (void) { - static GType desktop_agnostic_config_bind_method_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_config_bind_method_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_GLOBAL, "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_GLOBAL", "global"}, {DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_INSTANCE, "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_INSTANCE", "instance"}, {DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK", "fallback"}, {DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH, "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH", "both"}, {0, NULL, NULL}}; - desktop_agnostic_config_bind_method_type_id = g_enum_register_static ("DesktopAgnosticConfigBindMethod", values); - } - return desktop_agnostic_config_bind_method_type_id; -} - - -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct (GType object_type, const char* schema_filename) { - GParameter * __params; - GParameter * __params_it; - DesktopAgnosticConfigClient * self; - g_return_val_if_fail (schema_filename != NULL, NULL); - __params = g_new0 (GParameter, 1); - __params_it = __params; - __params_it->name = "schema-filename"; - g_value_init (&__params_it->value, G_TYPE_STRING); - g_value_set_string (&__params_it->value, schema_filename); - __params_it++; - self = g_object_newv (object_type, __params_it - __params, __params); - while (__params_it > __params) { - --__params_it; - g_value_unset (&__params_it->value); - } - g_free (__params); - return self; -} - - -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new (const char* schema_filename) { - return desktop_agnostic_config_client_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, schema_filename); -} - - -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct_for_instance (GType object_type, const char* schema_filename, const char* instance_id, GError** error) { - GParameter * __params; - GParameter * __params_it; - DesktopAgnosticConfigClient * self; - g_return_val_if_fail (schema_filename != NULL, NULL); - g_return_val_if_fail (instance_id != NULL, NULL); - __params = g_new0 (GParameter, 2); - __params_it = __params; - __params_it->name = "schema-filename"; - g_value_init (&__params_it->value, G_TYPE_STRING); - g_value_set_string (&__params_it->value, schema_filename); - __params_it++; - __params_it->name = "instance-id"; - g_value_init (&__params_it->value, G_TYPE_STRING); - g_value_set_string (&__params_it->value, instance_id); - __params_it++; - self = g_object_newv (object_type, __params_it - __params, __params); - while (__params_it > __params) { - --__params_it; - g_value_unset (&__params_it->value); - } - g_free (__params); - return self; -} - - -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new_for_instance (const char* schema_filename, const char* instance_id, GError** error) { - return desktop_agnostic_config_client_construct_for_instance (DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, schema_filename, instance_id, error); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct_for_schema (GType object_type, DesktopAgnosticConfigSchema* schema, const char* instance_id, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigClient * self; - DesktopAgnosticConfigSchema* _tmp0_; - g_return_val_if_fail (schema != NULL, NULL); - _inner_error_ = NULL; - self = (DesktopAgnosticConfigClient*) g_object_new (object_type, NULL); - self->priv->_schema = (_tmp0_ = _g_object_ref0 (schema), _g_object_unref0 (self->priv->_schema), _tmp0_); - desktop_agnostic_config_client_create_global_config (self); - if (instance_id != NULL) { - desktop_agnostic_config_client_create_instance_config (self, instance_id, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - g_object_unref (self); - return NULL; - } - } - return self; -} - - -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new_for_schema (DesktopAgnosticConfigSchema* schema, const char* instance_id, GError** error) { - return desktop_agnostic_config_client_construct_for_schema (DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, schema, instance_id, error); -} - - -static void desktop_agnostic_config_client_create_global_config (DesktopAgnosticConfigClient* self) { - GError * _inner_error_; - DesktopAgnosticConfigBackend* _tmp0_; - DesktopAgnosticConfigBackend* _tmp1_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_config_new (self->priv->_schema, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->global = (_tmp1_ = _tmp0_, _g_object_unref0 (self->priv->global), _tmp1_); -} - - -static gboolean desktop_agnostic_config_client_create_instance_config (DesktopAgnosticConfigClient* self, const char* instance_id, GError** error) { - gboolean result; - GError * _inner_error_; - GValue _tmp1_ = {0}; - GValue* _tmp0_; - GValue _tmp2_; - GValue single_instance; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (instance_id != NULL, FALSE); - _inner_error_ = NULL; - single_instance = (_tmp2_ = G_IS_VALUE (_tmp0_ = desktop_agnostic_config_schema_get_metadata_option (self->priv->_schema, "single_instance", &_inner_error_)) ? (g_value_init (&_tmp1_, G_VALUE_TYPE (_tmp0_ = desktop_agnostic_config_schema_get_metadata_option (self->priv->_schema, "single_instance", &_inner_error_))), g_value_copy (_tmp0_ = desktop_agnostic_config_schema_get_metadata_option (self->priv->_schema, "single_instance", &_inner_error_), &_tmp1_), _tmp1_) : (*(_tmp0_ = desktop_agnostic_config_schema_get_metadata_option (self->priv->_schema, "single_instance", &_inner_error_))), _g_free0 (_tmp0_), _tmp2_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - if (g_value_get_boolean (&single_instance)) { - result = FALSE; - G_IS_VALUE (&single_instance) ? (g_value_unset (&single_instance), NULL) : NULL; - return result; - } else { - DesktopAgnosticConfigBackend* _tmp3_; - DesktopAgnosticConfigBackend* _tmp4_; - _tmp3_ = desktop_agnostic_config_new_for_instance (instance_id, self->priv->_schema, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&single_instance) ? (g_value_unset (&single_instance), NULL) : NULL; - return FALSE; - } - self->priv->instance = (_tmp4_ = _tmp3_, _g_object_unref0 (self->priv->instance), _tmp4_); - result = TRUE; - G_IS_VALUE (&single_instance) ? (g_value_unset (&single_instance), NULL) : NULL; - return result; - } - G_IS_VALUE (&single_instance) ? (g_value_unset (&single_instance), NULL) : NULL; -} - - -static DesktopAgnosticConfigBackend* desktop_agnostic_config_client_get_backend (DesktopAgnosticConfigClient* self, const char* group, const char* key) { - DesktopAgnosticConfigBackend* result; - gboolean _tmp0_ = FALSE; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - if (self->priv->instance == NULL) { - _tmp0_ = TRUE; - } else { - _tmp0_ = !desktop_agnostic_config_schema_option_get_per_instance (desktop_agnostic_config_schema_get_option (self->priv->_schema, group, key)); - } - if (_tmp0_) { - result = self->priv->global; - return result; - } else { - result = self->priv->instance; - return result; - } -} - - -gboolean desktop_agnostic_config_client_get_bool (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error) { - gboolean result; - GError * _inner_error_; - gboolean _tmp0_; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (group != NULL, FALSE); - g_return_val_if_fail (key != NULL, FALSE); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_config_backend_get_bool (desktop_agnostic_config_client_get_backend (self, group, key), group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - result = _tmp0_; - return result; -} - - -void desktop_agnostic_config_client_set_bool (DesktopAgnosticConfigClient* self, const char* group, const char* key, gboolean value, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_set_bool (desktop_agnostic_config_client_get_backend (self, group, key), group, key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -gint desktop_agnostic_config_client_get_int (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error) { - gint result; - GError * _inner_error_; - gint _tmp0_; - g_return_val_if_fail (self != NULL, 0); - g_return_val_if_fail (group != NULL, 0); - g_return_val_if_fail (key != NULL, 0); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_config_backend_get_int (desktop_agnostic_config_client_get_backend (self, group, key), group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return 0; - } - result = _tmp0_; - return result; -} - - -void desktop_agnostic_config_client_set_int (DesktopAgnosticConfigClient* self, const char* group, const char* key, gint value, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_set_int (desktop_agnostic_config_client_get_backend (self, group, key), group, key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -float desktop_agnostic_config_client_get_float (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error) { - float result; - GError * _inner_error_; - float _tmp0_; - g_return_val_if_fail (self != NULL, 0.0F); - g_return_val_if_fail (group != NULL, 0.0F); - g_return_val_if_fail (key != NULL, 0.0F); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_config_backend_get_float (desktop_agnostic_config_client_get_backend (self, group, key), group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return 0.0F; - } - result = _tmp0_; - return result; -} - - -void desktop_agnostic_config_client_set_float (DesktopAgnosticConfigClient* self, const char* group, const char* key, float value, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_set_float (desktop_agnostic_config_client_get_backend (self, group, key), group, key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -char* desktop_agnostic_config_client_get_string (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error) { - char* result; - GError * _inner_error_; - char* _tmp0_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_config_backend_get_string (desktop_agnostic_config_client_get_backend (self, group, key), group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - result = _tmp0_; - return result; -} - - -void desktop_agnostic_config_client_set_string (DesktopAgnosticConfigClient* self, const char* group, const char* key, const char* value, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_set_string (desktop_agnostic_config_client_get_backend (self, group, key), group, key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -GValueArray* desktop_agnostic_config_client_get_list (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error) { - GValueArray* result; - GError * _inner_error_; - GValueArray* _tmp0_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - _tmp0_ = desktop_agnostic_config_backend_get_list (desktop_agnostic_config_client_get_backend (self, group, key), group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - result = _tmp0_; - return result; -} - - -void desktop_agnostic_config_client_set_list (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValueArray* value, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_set_list (desktop_agnostic_config_client_get_backend (self, group, key), group, key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -static GValue* _g_value_dup (GValue* self) { - return g_boxed_copy (G_TYPE_VALUE, self); -} - - -static gpointer __g_value_dup0 (gpointer self) { - return self ? _g_value_dup (self) : NULL; -} - - -static gpointer _g_error_copy0 (gpointer self) { - return self ? g_error_copy (self) : NULL; -} - - -void desktop_agnostic_config_client_get_value (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValue* result, GError** error) { - GError * _inner_error_; - GValue* temp_val; - GValue val = {0}; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - temp_val = NULL; - { - gboolean _tmp0_ = FALSE; - if (self->priv->instance != NULL) { - _tmp0_ = desktop_agnostic_config_schema_option_get_per_instance (desktop_agnostic_config_schema_get_option (self->priv->_schema, group, key)); - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - GValue _tmp1_ = {0}; - GValue _tmp2_; - GValue* _tmp5_; - GValue _tmp4_; - GValue _tmp3_; - _tmp2_ = (desktop_agnostic_config_backend_get_value (self->priv->instance, group, key, &_tmp1_, &_inner_error_), _tmp1_); - if (_inner_error_ != NULL) { - goto __catch1_g_error; - } - temp_val = (_tmp5_ = __g_value_dup0 ((_tmp4_ = _tmp3_ = _tmp2_, &_tmp4_)), _g_free0 (temp_val), _tmp5_); - G_IS_VALUE (&_tmp3_) ? (g_value_unset (&_tmp3_), NULL) : NULL; - } - } - goto __finally1; - __catch1_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - if (!g_error_matches (err, DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND)) { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - _g_free0 (temp_val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - goto __finally1; - } - } - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (temp_val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - return; - } - if (temp_val == NULL) { - GValue _tmp6_ = {0}; - GValue _tmp7_; - GValue _tmp8_; - _tmp7_ = (desktop_agnostic_config_backend_get_value (self->priv->global, group, key, &_tmp6_, &_inner_error_), _tmp6_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (temp_val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - return; - } - val = (_tmp8_ = _tmp7_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp8_); - } else { - GValue _tmp10_; - GValue _tmp9_ = {0}; - val = (_tmp10_ = G_IS_VALUE (temp_val) ? (g_value_init (&_tmp9_, G_VALUE_TYPE (temp_val)), g_value_copy (temp_val, &_tmp9_), _tmp9_) : (*temp_val), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp10_); - } - *result = val; - _g_free0 (temp_val); - return; -} - - -void desktop_agnostic_config_client_set_value (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValue* value, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_set_value (desktop_agnostic_config_client_get_backend (self, group, key), group, key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -void desktop_agnostic_config_client_notify_add (DesktopAgnosticConfigClient* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_notify_add (desktop_agnostic_config_client_get_backend (self, group, key), group, key, callback, callback_target, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -void desktop_agnostic_config_client_notify (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_notify (desktop_agnostic_config_client_get_backend (self, group, key), group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -void desktop_agnostic_config_client_notify_remove (DesktopAgnosticConfigClient* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_notify_remove (desktop_agnostic_config_client_get_backend (self, group, key), group, key, callback, callback_target, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -void desktop_agnostic_config_client_remove_instance (DesktopAgnosticConfigClient* self) { - DesktopAgnosticConfigBackend* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->instance = (_tmp0_ = NULL, _g_object_unref0 (self->priv->instance), _tmp0_); -} - - -void desktop_agnostic_config_client_reset (DesktopAgnosticConfigClient* self, gboolean instance_only, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (self->priv->instance != NULL) { - desktop_agnostic_config_backend_reset (self->priv->instance, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } - if (!instance_only) { - desktop_agnostic_config_backend_reset (self->priv->global, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } -} - - -void desktop_agnostic_config_client_bind (DesktopAgnosticConfigClient* self, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, DesktopAgnosticConfigBindMethod method, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigBridge* bridge; - DesktopAgnosticConfigSchemaOption* option; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp6_ = FALSE; - gboolean _tmp7_ = FALSE; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (obj != NULL); - g_return_if_fail (property_name != NULL); - _inner_error_ = NULL; - bridge = desktop_agnostic_config_bridge_get_default (); - option = desktop_agnostic_config_schema_get_option (self->priv->_schema, group, key); - if (option == NULL) { - g_warning ("config-client.vala:310: Could not find the schema option for %s/%s, not binding.", group, key); - return; - } - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_GLOBAL) { - _tmp1_ = TRUE; - } else { - _tmp1_ = method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH; - } - if (_tmp1_) { - _tmp0_ = TRUE; - } else { - gboolean _tmp2_ = FALSE; - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK) { - gboolean _tmp3_ = FALSE; - if (self->priv->instance == NULL) { - _tmp3_ = TRUE; - } else { - _tmp3_ = !desktop_agnostic_config_schema_option_get_per_instance (option); - } - _tmp2_ = _tmp3_; - } else { - _tmp2_ = FALSE; - } - _tmp0_ = _tmp2_; - } - if (_tmp0_) { - char* global_prop; - global_prop = NULL; - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH) { - char* _tmp4_; - global_prop = (_tmp4_ = g_strdup_printf ("%s-base", property_name), _g_free0 (global_prop), _tmp4_); - } else { - char* _tmp5_; - global_prop = (_tmp5_ = g_strdup (property_name), _g_free0 (global_prop), _tmp5_); - } - desktop_agnostic_config_bridge_bind (bridge, self->priv->global, group, key, obj, global_prop, read_only, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (global_prop); - return; - } else { - _g_free0 (global_prop); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - _g_free0 (global_prop); - } - if (self->priv->instance != NULL) { - _tmp7_ = desktop_agnostic_config_schema_option_get_per_instance (option); - } else { - _tmp7_ = FALSE; - } - if (_tmp7_) { - gboolean _tmp8_ = FALSE; - gboolean _tmp9_ = FALSE; - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_INSTANCE) { - _tmp9_ = TRUE; - } else { - _tmp9_ = method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH; - } - if (_tmp9_) { - _tmp8_ = TRUE; - } else { - _tmp8_ = method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK; - } - _tmp6_ = _tmp8_; - } else { - _tmp6_ = FALSE; - } - if (_tmp6_) { - desktop_agnostic_config_bridge_bind (bridge, self->priv->instance, group, key, obj, property_name, read_only, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } -} - - -void desktop_agnostic_config_client_unbind (DesktopAgnosticConfigClient* self, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, DesktopAgnosticConfigBindMethod method, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigBridge* bridge; - DesktopAgnosticConfigSchemaOption* option; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp6_ = FALSE; - gboolean _tmp7_ = FALSE; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (obj != NULL); - g_return_if_fail (property_name != NULL); - _inner_error_ = NULL; - bridge = desktop_agnostic_config_bridge_get_default (); - option = desktop_agnostic_config_schema_get_option (self->priv->_schema, group, key); - if (option == NULL) { - g_warning ("config-client.vala:353: Could not find the schema option for %s/%s, not binding.", group, key); - return; - } - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_GLOBAL) { - _tmp1_ = TRUE; - } else { - _tmp1_ = method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH; - } - if (_tmp1_) { - _tmp0_ = TRUE; - } else { - gboolean _tmp2_ = FALSE; - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK) { - gboolean _tmp3_ = FALSE; - if (self->priv->instance == NULL) { - _tmp3_ = TRUE; - } else { - _tmp3_ = !desktop_agnostic_config_schema_option_get_per_instance (option); - } - _tmp2_ = _tmp3_; - } else { - _tmp2_ = FALSE; - } - _tmp0_ = _tmp2_; - } - if (_tmp0_) { - char* global_prop; - global_prop = NULL; - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH) { - char* _tmp4_; - global_prop = (_tmp4_ = g_strdup_printf ("%s-base", property_name), _g_free0 (global_prop), _tmp4_); - } else { - char* _tmp5_; - global_prop = (_tmp5_ = g_strdup (property_name), _g_free0 (global_prop), _tmp5_); - } - desktop_agnostic_config_bridge_remove (bridge, self->priv->global, group, key, obj, global_prop, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (global_prop); - return; - } else { - _g_free0 (global_prop); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - _g_free0 (global_prop); - } - if (self->priv->instance != NULL) { - _tmp7_ = desktop_agnostic_config_schema_option_get_per_instance (option); - } else { - _tmp7_ = FALSE; - } - if (_tmp7_) { - gboolean _tmp8_ = FALSE; - gboolean _tmp9_ = FALSE; - if (method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_INSTANCE) { - _tmp9_ = TRUE; - } else { - _tmp9_ = method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH; - } - if (_tmp9_) { - _tmp8_ = TRUE; - } else { - _tmp8_ = method == DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK; - } - _tmp6_ = _tmp8_; - } else { - _tmp6_ = FALSE; - } - if (_tmp6_) { - desktop_agnostic_config_bridge_remove (bridge, self->priv->instance, group, key, obj, property_name, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } -} - - -void desktop_agnostic_config_client_unbind_all_for_object (DesktopAgnosticConfigClient* self, GObject* obj, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigBridge* bridge; - g_return_if_fail (self != NULL); - g_return_if_fail (obj != NULL); - _inner_error_ = NULL; - bridge = desktop_agnostic_config_bridge_get_default (); - if (self->priv->instance != NULL) { - desktop_agnostic_config_bridge_remove_all_for_object (bridge, self->priv->instance, obj, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } - desktop_agnostic_config_bridge_remove_all_for_object (bridge, self->priv->global, obj, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -const char* desktop_agnostic_config_client_get_instance_id (DesktopAgnosticConfigClient* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - if (self->priv->instance == NULL) { - result = NULL; - return result; - } else { - result = desktop_agnostic_config_backend_get_instance_id (self->priv->instance); - return result; - } -} - - -static void desktop_agnostic_config_client_set_instance_id (DesktopAgnosticConfigClient* self, const char* value) { - GError * _inner_error_; - gboolean _tmp0_ = FALSE; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (value != NULL) { - gboolean _tmp1_; - _tmp1_ = desktop_agnostic_config_client_create_instance_config (self, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _tmp0_ = !_tmp1_; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - g_warning ("config-client.vala:78: The configuration schema has declared that there can only be a single configuration instance."); - g_warning ("config-client.vala:79: Not creating an instance config object."); - } - g_object_notify ((GObject *) self, "instance-id"); -} - - -static void desktop_agnostic_config_client_set_schema_filename (DesktopAgnosticConfigClient* self, const char* value) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (value != NULL) { - { - DesktopAgnosticConfigSchema* _tmp0_; - DesktopAgnosticConfigSchema* _tmp1_; - _tmp0_ = desktop_agnostic_config_schema_new (value, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch2_g_error; - } - self->priv->_schema = (_tmp1_ = _tmp0_, _g_object_unref0 (self->priv->_schema), _tmp1_); - desktop_agnostic_config_client_create_global_config (self); - } - goto __finally2; - __catch2_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("config-client.vala:96: Config error: %s", err->message); - _g_error_free0 (err); - } - } - __finally2: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - g_object_notify ((GObject *) self, "schema-filename"); -} - - -static void desktop_agnostic_config_client_class_init (DesktopAgnosticConfigClientClass * klass) { - desktop_agnostic_config_client_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticConfigClientPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_client_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_config_client_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_client_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_CLIENT_INSTANCE_ID, g_param_spec_string ("instance-id", "instance-id", "instance-id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_CLIENT_SCHEMA_FILENAME, g_param_spec_string ("schema-filename", "schema-filename", "schema-filename", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); -} - - -static void desktop_agnostic_config_client_instance_init (DesktopAgnosticConfigClient * self) { - self->priv = DESKTOP_AGNOSTIC_CONFIG_CLIENT_GET_PRIVATE (self); -} - - -static void desktop_agnostic_config_client_finalize (GObject* obj) { - DesktopAgnosticConfigClient * self; - self = DESKTOP_AGNOSTIC_CONFIG_CLIENT (obj); - _g_object_unref0 (self->priv->_schema); - _g_object_unref0 (self->priv->global); - _g_object_unref0 (self->priv->instance); - G_OBJECT_CLASS (desktop_agnostic_config_client_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_client_get_type (void) { - static GType desktop_agnostic_config_client_type_id = 0; - if (desktop_agnostic_config_client_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigClient), 0, (GInstanceInitFunc) desktop_agnostic_config_client_instance_init, NULL }; - desktop_agnostic_config_client_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigClient", &g_define_type_info, 0); - } - return desktop_agnostic_config_client_type_id; -} - - -static void desktop_agnostic_config_client_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigClient * self; - self = DESKTOP_AGNOSTIC_CONFIG_CLIENT (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_CLIENT_INSTANCE_ID: - g_value_set_string (value, desktop_agnostic_config_client_get_instance_id (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_config_client_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigClient * self; - self = DESKTOP_AGNOSTIC_CONFIG_CLIENT (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_CLIENT_INSTANCE_ID: - desktop_agnostic_config_client_set_instance_id (self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_CLIENT_SCHEMA_FILENAME: - desktop_agnostic_config_client_set_schema_filename (self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config.h 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,295 +0,0 @@ -/* config.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_CONFIG_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_CONFIG_H__ - -#include -#include -#include -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND (desktop_agnostic_config_backend_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackend)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, DesktopAgnosticConfigBackendClass)) - -typedef struct _DesktopAgnosticConfigBackend DesktopAgnosticConfigBackend; -typedef struct _DesktopAgnosticConfigBackendClass DesktopAgnosticConfigBackendClass; -typedef struct _DesktopAgnosticConfigBackendPrivate DesktopAgnosticConfigBackendPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA (desktop_agnostic_config_schema_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchema)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) - -typedef struct _DesktopAgnosticConfigSchema DesktopAgnosticConfigSchema; -typedef struct _DesktopAgnosticConfigSchemaClass DesktopAgnosticConfigSchemaClass; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE (desktop_agnostic_config_bridge_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridge)) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE)) -#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass)) - -typedef struct _DesktopAgnosticConfigBridge DesktopAgnosticConfigBridge; -typedef struct _DesktopAgnosticConfigBridgeClass DesktopAgnosticConfigBridgeClass; -typedef struct _DesktopAgnosticConfigBridgePrivate DesktopAgnosticConfigBridgePrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BIND_METHOD (desktop_agnostic_config_bind_method_get_type ()) - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT (desktop_agnostic_config_client_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, DesktopAgnosticConfigClient)) -#define DESKTOP_AGNOSTIC_CONFIG_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, DesktopAgnosticConfigClientClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT)) -#define DESKTOP_AGNOSTIC_CONFIG_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT, DesktopAgnosticConfigClientClass)) - -typedef struct _DesktopAgnosticConfigClient DesktopAgnosticConfigClient; -typedef struct _DesktopAgnosticConfigClientClass DesktopAgnosticConfigClientClass; -typedef struct _DesktopAgnosticConfigClientPrivate DesktopAgnosticConfigClientPrivate; -typedef struct _DesktopAgnosticConfigSchemaPrivate DesktopAgnosticConfigSchemaPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION (desktop_agnostic_config_schema_option_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOption)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) - -typedef struct _DesktopAgnosticConfigSchemaOption DesktopAgnosticConfigSchemaOption; -typedef struct _DesktopAgnosticConfigSchemaOptionClass DesktopAgnosticConfigSchemaOptionClass; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE (desktop_agnostic_config_schema_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaType)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) - -typedef struct _DesktopAgnosticConfigSchemaType DesktopAgnosticConfigSchemaType; -typedef struct _DesktopAgnosticConfigSchemaTypeClass DesktopAgnosticConfigSchemaTypeClass; -typedef struct _DesktopAgnosticConfigSchemaOptionPrivate DesktopAgnosticConfigSchemaOptionPrivate; -typedef struct _DesktopAgnosticConfigSchemaTypePrivate DesktopAgnosticConfigSchemaTypePrivate; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_ERROR_NO_SCHEMA, - DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_METADATA_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_NOTIFY, - DESKTOP_AGNOSTIC_CONFIG_ERROR_DUPLICATE_BINDING -} DesktopAgnosticConfigError; -#define DESKTOP_AGNOSTIC_CONFIG_ERROR desktop_agnostic_config_error_quark () -typedef void (*DesktopAgnosticConfigNotifyFunc) (const char* group, const char* key, GValue* value, void* user_data); -struct _DesktopAgnosticConfigBackend { - GObject parent_instance; - DesktopAgnosticConfigBackendPrivate * priv; -}; - -struct _DesktopAgnosticConfigBackendClass { - GObjectClass parent_class; - void (*reset) (DesktopAgnosticConfigBackend* self, GError** error); - void (*remove) (DesktopAgnosticConfigBackend* self, GError** error); - void (*notify_add) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); - void (*notify) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*notify_remove) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); - void (*get_value) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error); - void (*set_value) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error); - gboolean (*get_bool) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_bool) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error); - float (*get_float) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_float) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error); - gint (*get_int) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_int) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error); - char* (*get_string) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_string) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error); - GValueArray* (*get_list) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); - void (*set_list) (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error); - char* (*get_name) (DesktopAgnosticConfigBackend* self); -}; - -struct _DesktopAgnosticConfigBridge { - GObject parent_instance; - DesktopAgnosticConfigBridgePrivate * priv; -}; - -struct _DesktopAgnosticConfigBridgeClass { - GObjectClass parent_class; -}; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_GLOBAL, - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_INSTANCE, - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH -} DesktopAgnosticConfigBindMethod; - -struct _DesktopAgnosticConfigClient { - GObject parent_instance; - DesktopAgnosticConfigClientPrivate * priv; -}; - -struct _DesktopAgnosticConfigClientClass { - GObjectClass parent_class; -}; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS -} DesktopAgnosticConfigSchemaError; -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR desktop_agnostic_config_schema_error_quark () -struct _DesktopAgnosticConfigSchema { - GObject parent_instance; - DesktopAgnosticConfigSchemaPrivate * priv; -}; - -struct _DesktopAgnosticConfigSchemaClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigSchemaOption { - GObject parent_instance; - DesktopAgnosticConfigSchemaOptionPrivate * priv; -}; - -struct _DesktopAgnosticConfigSchemaOptionClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigSchemaType { - GObject parent_instance; - DesktopAgnosticConfigSchemaTypePrivate * priv; -}; - -struct _DesktopAgnosticConfigSchemaTypeClass { - GObjectClass parent_class; - char* (*serialize) (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error); - void (*deserialize) (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error); - void (*parse_default_value) (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GValue* result, GError** error); - GValueArray* (*parse_default_list_value) (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GError** error); - char* (*get_name) (DesktopAgnosticConfigSchemaType* self); - GType (*get_schema_type) (DesktopAgnosticConfigSchemaType* self); -}; - - -GQuark desktop_agnostic_config_error_quark (void); -#define DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT "DEFAULT" -GType desktop_agnostic_config_backend_get_type (void); -GHashTable* desktop_agnostic_config_backend_get_backend_metadata_keys (void); -void desktop_agnostic_config_backend_reset (DesktopAgnosticConfigBackend* self, GError** error); -void desktop_agnostic_config_backend_remove (DesktopAgnosticConfigBackend* self, GError** error); -void desktop_agnostic_config_backend_notify_add (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_backend_notify (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_notify_remove (DesktopAgnosticConfigBackend* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_backend_get_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* result, GError** error); -void desktop_agnostic_config_backend_set_value (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValue* value, GError** error); -gboolean desktop_agnostic_config_backend_get_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_bool (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gboolean value, GError** error); -float desktop_agnostic_config_backend_get_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_float (DesktopAgnosticConfigBackend* self, const char* group, const char* key, float value, GError** error); -gint desktop_agnostic_config_backend_get_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_int (DesktopAgnosticConfigBackend* self, const char* group, const char* key, gint value, GError** error); -char* desktop_agnostic_config_backend_get_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_string (DesktopAgnosticConfigBackend* self, const char* group, const char* key, const char* value, GError** error); -GValueArray* desktop_agnostic_config_backend_get_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_backend_set_list (DesktopAgnosticConfigBackend* self, const char* group, const char* key, GValueArray* value, GError** error); -float desktop_agnostic_config_backend_get_float_from_value (GValue* value, GError** error); -gint desktop_agnostic_config_backend_get_int_from_value (GValue* value, GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_backend_construct (GType object_type); -char* desktop_agnostic_config_backend_get_name (DesktopAgnosticConfigBackend* self); -GType desktop_agnostic_config_schema_get_type (void); -DesktopAgnosticConfigSchema* desktop_agnostic_config_backend_get_schema (DesktopAgnosticConfigBackend* self); -const char* desktop_agnostic_config_backend_get_instance_id (DesktopAgnosticConfigBackend* self); -GType desktop_agnostic_config_get_type (GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_new (DesktopAgnosticConfigSchema* schema, GError** error); -DesktopAgnosticConfigBackend* desktop_agnostic_config_new_for_instance (const char* instance_id, DesktopAgnosticConfigSchema* schema, GError** error); -GType desktop_agnostic_config_bridge_get_type (void); -void desktop_agnostic_config_bridge_get_all_bindings (DesktopAgnosticConfigBridge* self, GData** result); -DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_get_default (void); -GParamSpec* desktop_agnostic_config_bridge_get_property_spec (GObject* obj, const char* property_name); -void desktop_agnostic_config_bridge_bind (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, GError** error); -void desktop_agnostic_config_bridge_remove (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, GError** error); -void desktop_agnostic_config_bridge_remove_all_for_object (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, GObject* obj, GError** error); -GType desktop_agnostic_config_bind_method_get_type (void); -GType desktop_agnostic_config_client_get_type (void); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new (const char* schema_filename); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct (GType object_type, const char* schema_filename); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new_for_instance (const char* schema_filename, const char* instance_id, GError** error); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct_for_instance (GType object_type, const char* schema_filename, const char* instance_id, GError** error); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_new_for_schema (DesktopAgnosticConfigSchema* schema, const char* instance_id, GError** error); -DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct_for_schema (GType object_type, DesktopAgnosticConfigSchema* schema, const char* instance_id, GError** error); -gboolean desktop_agnostic_config_client_get_bool (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_client_set_bool (DesktopAgnosticConfigClient* self, const char* group, const char* key, gboolean value, GError** error); -gint desktop_agnostic_config_client_get_int (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_client_set_int (DesktopAgnosticConfigClient* self, const char* group, const char* key, gint value, GError** error); -float desktop_agnostic_config_client_get_float (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_client_set_float (DesktopAgnosticConfigClient* self, const char* group, const char* key, float value, GError** error); -char* desktop_agnostic_config_client_get_string (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_client_set_string (DesktopAgnosticConfigClient* self, const char* group, const char* key, const char* value, GError** error); -GValueArray* desktop_agnostic_config_client_get_list (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_client_set_list (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValueArray* value, GError** error); -void desktop_agnostic_config_client_get_value (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValue* result, GError** error); -void desktop_agnostic_config_client_set_value (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValue* value, GError** error); -void desktop_agnostic_config_client_notify_add (DesktopAgnosticConfigClient* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_client_notify (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); -void desktop_agnostic_config_client_notify_remove (DesktopAgnosticConfigClient* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -void desktop_agnostic_config_client_remove_instance (DesktopAgnosticConfigClient* self); -void desktop_agnostic_config_client_reset (DesktopAgnosticConfigClient* self, gboolean instance_only, GError** error); -void desktop_agnostic_config_client_bind (DesktopAgnosticConfigClient* self, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, DesktopAgnosticConfigBindMethod method, GError** error); -void desktop_agnostic_config_client_unbind (DesktopAgnosticConfigClient* self, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, DesktopAgnosticConfigBindMethod method, GError** error); -void desktop_agnostic_config_client_unbind_all_for_object (DesktopAgnosticConfigClient* self, GObject* obj, GError** error); -const char* desktop_agnostic_config_client_get_instance_id (DesktopAgnosticConfigClient* self); -GQuark desktop_agnostic_config_schema_error_quark (void); -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_new (const char* filename, GError** error); -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_construct (GType object_type, const char* filename, GError** error); -GList* desktop_agnostic_config_schema_get_groups (DesktopAgnosticConfigSchema* self); -GList* desktop_agnostic_config_schema_get_keys (DesktopAgnosticConfigSchema* self, const char* group); -gboolean desktop_agnostic_config_schema_exists (DesktopAgnosticConfigSchema* self, const char* group, const char* key); -GType desktop_agnostic_config_schema_option_get_type (void); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_get_option (DesktopAgnosticConfigSchema* self, const char* group, const char* key); -GValue* desktop_agnostic_config_schema_get_metadata_option (DesktopAgnosticConfigSchema* self, const char* name, GError** error); -GType desktop_agnostic_config_schema_type_get_type (void); -void desktop_agnostic_config_schema_register_type (DesktopAgnosticConfigSchemaType* st, GError** error); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type_by_name (const char* name); -const char* desktop_agnostic_config_schema_get_app_name (DesktopAgnosticConfigSchema* self); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_new (GKeyFile** schema, const char* group, const char* key, GError** error); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_construct (GType object_type, GKeyFile** schema, const char* group, const char* key, GError** error); -GType desktop_agnostic_config_schema_option_get_option_type (DesktopAgnosticConfigSchemaOption* self); -GType desktop_agnostic_config_schema_option_get_list_type (DesktopAgnosticConfigSchemaOption* self); -void desktop_agnostic_config_schema_option_get_default_value (DesktopAgnosticConfigSchemaOption* self, GValue* result); -const char* desktop_agnostic_config_schema_option_get_description (DesktopAgnosticConfigSchemaOption* self); -const char* desktop_agnostic_config_schema_option_get_summary (DesktopAgnosticConfigSchemaOption* self); -GValue* desktop_agnostic_config_schema_option_get_lower_boundary (DesktopAgnosticConfigSchemaOption* self); -GValue* desktop_agnostic_config_schema_option_get_upper_boundary (DesktopAgnosticConfigSchemaOption* self); -GValueArray* desktop_agnostic_config_schema_option_get_whitelist (DesktopAgnosticConfigSchemaOption* self); -GValueArray* desktop_agnostic_config_schema_option_get_blacklist (DesktopAgnosticConfigSchemaOption* self); -gboolean desktop_agnostic_config_schema_option_get_per_instance (DesktopAgnosticConfigSchemaOption* self); -char* desktop_agnostic_config_schema_type_serialize (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error); -void desktop_agnostic_config_schema_type_deserialize (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error); -void desktop_agnostic_config_schema_type_parse_default_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GValue* result, GError** error); -GValueArray* desktop_agnostic_config_schema_type_parse_default_list_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GError** error); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_type_construct (GType object_type); -char* desktop_agnostic_config_schema_type_get_name (DesktopAgnosticConfigSchemaType* self); -GType desktop_agnostic_config_schema_type_get_schema_type (DesktopAgnosticConfigSchemaType* self); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-impl-gconf.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-impl-gconf.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-impl-gconf.c 2010-04-11 07:32:38.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-impl-gconf.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1825 +0,0 @@ -/* config-impl-gconf.c generated by valac, the Vala compiler - * generated from config-impl-gconf.vala, do not modify */ - -/* - * GConf implementation of the configuration interface. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND (desktop_agnostic_config_gconf_backend_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND, DesktopAgnosticConfigGConfBackend)) -#define DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND, DesktopAgnosticConfigGConfBackendClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GCONF_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GCONF_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND, DesktopAgnosticConfigGConfBackendClass)) - -typedef struct _DesktopAgnosticConfigGConfBackend DesktopAgnosticConfigGConfBackend; -typedef struct _DesktopAgnosticConfigGConfBackendClass DesktopAgnosticConfigGConfBackendClass; -typedef struct _DesktopAgnosticConfigGConfBackendPrivate DesktopAgnosticConfigGConfBackendPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define __g_slist_free_gconf_entry_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_gconf_entry_unref (var), NULL))) -#define __g_slist_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_free (var), NULL))) -#define _gconf_entry_unref0(var) ((var == NULL) ? NULL : (var = (gconf_entry_unref (var), NULL))) -#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL))) -#define _desktop_agnostic_config_notify_delegate_free0(var) ((var == NULL) ? NULL : (var = (desktop_agnostic_config_notify_delegate_free (var), NULL))) -#define _gconf_value_free0(var) ((var == NULL) ? NULL : (var = (gconf_value_free (var), NULL))) -#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) -#define __g_slist_free_gconf_value_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_gconf_value_free (var), NULL))) - -struct _DesktopAgnosticConfigGConfBackend { - DesktopAgnosticConfigBackend parent_instance; - DesktopAgnosticConfigGConfBackendPrivate * priv; -}; - -struct _DesktopAgnosticConfigGConfBackendClass { - DesktopAgnosticConfigBackendClass parent_class; -}; - -struct _DesktopAgnosticConfigGConfBackendPrivate { - char* schema_path; - char* path; - GConfClient* client; - guint connection_id; - GData* _notifiers; -}; - - -static gpointer desktop_agnostic_config_gconf_backend_parent_class = NULL; - -#define DESKTOP_AGNOSTIC_CONFIG_BACKEND_NAME "GConf" -GType desktop_agnostic_config_gconf_backend_get_type (void); -#define DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND, DesktopAgnosticConfigGConfBackendPrivate)) -enum { - DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_NAME -}; -static void desktop_agnostic_config_gconf_backend_associate_schemas_in_dir (DesktopAgnosticConfigGConfBackend* self, const char* schema_dir, const char* pref_dir, GError** error); -static void desktop_agnostic_config_gconf_backend_notify_proxy (DesktopAgnosticConfigGConfBackend* self, GConfClient* client, guint cnxn_id, GConfEntry* entry); -static void _desktop_agnostic_config_gconf_backend_notify_proxy_gconf_client_notify_func (GConfClient* client, guint cnxn_id, GConfEntry* entry, gpointer self); -static void desktop_agnostic_config_gconf_backend_real_constructed (GObject* base); -static void _g_slist_free_gconf_entry_unref (GSList* self); -static void _g_slist_free_g_free (GSList* self); -static void desktop_agnostic_config_gconf_backend_parse_group_and_key (DesktopAgnosticConfigGConfBackend* self, const char* full_key, char** group, char** key); -static char* desktop_agnostic_config_gconf_backend_generate_key (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key); -static GConfValueType desktop_agnostic_config_gconf_backend_type_to_valuetype (DesktopAgnosticConfigGConfBackend* self, GType type); -static GValueArray* desktop_agnostic_config_gconf_backend_slist_to_valuearray (DesktopAgnosticConfigGConfBackend* self, GSList* list, GType type, GError** error); -static void desktop_agnostic_config_gconf_backend_gconfvalue_to_gvalue (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key, GConfValue* gc_val, GValue* result, GError** error); -static void _desktop_agnostic_config_gconf_backend_ensure_key_exists (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gconf_backend_real_remove (DesktopAgnosticConfigBackend* base, GError** error); -static void desktop_agnostic_config_gconf_backend_real_notify_add (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void desktop_agnostic_config_gconf_backend_real_notify (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gconf_backend_real_notify_remove (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void desktop_agnostic_config_gconf_backend_real_reset (DesktopAgnosticConfigBackend* base, GError** error); -static void desktop_agnostic_config_gconf_backend_real_get_value (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValue* result, GError** error); -static gboolean desktop_agnostic_config_gconf_backend_real_get_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gconf_backend_real_set_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gboolean value, GError** error); -static float desktop_agnostic_config_gconf_backend_real_get_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gconf_backend_real_set_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, float value, GError** error); -static gint desktop_agnostic_config_gconf_backend_real_get_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gconf_backend_real_set_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gint value, GError** error); -static char* desktop_agnostic_config_gconf_backend_real_get_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gconf_backend_real_set_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, const char* value, GError** error); -static GValueArray* desktop_agnostic_config_gconf_backend_real_get_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void _g_slist_free_gconf_value_free (GSList* self); -static void desktop_agnostic_config_gconf_backend_real_set_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValueArray* value, GError** error); -DesktopAgnosticConfigGConfBackend* desktop_agnostic_config_gconf_backend_new (void); -DesktopAgnosticConfigGConfBackend* desktop_agnostic_config_gconf_backend_construct (GType object_type); -static GObject * desktop_agnostic_config_gconf_backend_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_config_gconf_backend_finalize (GObject* obj); -static void desktop_agnostic_config_gconf_backend_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static GValue* _g_value_dup (GValue* self); -GType register_plugin (void); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static char* string_replace (const char* self, const char* old, const char* replacement) { - char* result; - GError * _inner_error_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (old != NULL, NULL); - g_return_val_if_fail (replacement != NULL, NULL); - _inner_error_ = NULL; - { - char* _tmp0_; - GRegex* _tmp1_; - GRegex* regex; - char* _tmp2_; - regex = (_tmp1_ = g_regex_new (_tmp0_ = g_regex_escape_string (old, -1), 0, 0, &_inner_error_), _g_free0 (_tmp0_), _tmp1_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch0_g_regex_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - _tmp2_ = g_regex_replace_literal (regex, self, (gssize) (-1), 0, replacement, 0, &_inner_error_); - if (_inner_error_ != NULL) { - _g_regex_unref0 (regex); - if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch0_g_regex_error; - } - _g_regex_unref0 (regex); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - result = _tmp2_; - _g_regex_unref0 (regex); - return result; - } - goto __finally0; - __catch0_g_regex_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_assert_not_reached (); - _g_error_free0 (e); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } -} - - -static void _desktop_agnostic_config_gconf_backend_notify_proxy_gconf_client_notify_func (GConfClient* client, guint cnxn_id, GConfEntry* entry, gpointer self) { - desktop_agnostic_config_gconf_backend_notify_proxy (self, client, cnxn_id, entry); -} - - -static void desktop_agnostic_config_gconf_backend_real_constructed (GObject* base) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* _tmp0_; - char* _tmp1_; - char* opt_prefix; - char* base_path; - DesktopAgnosticConfigSchema* schema; - GData* _tmp2_ = {0}; - char* _tmp3_; - GValue* _tmp4_; - GValue* _tmp5_; - char* _tmp7_; - GValue* _tmp6_; - char* _tmp8_; - self = (DesktopAgnosticConfigGConfBackend*) base; - _inner_error_ = NULL; - opt_prefix = (_tmp1_ = g_strconcat (_tmp0_ = desktop_agnostic_config_backend_get_name ((DesktopAgnosticConfigBackend*) self), ".", NULL), _g_free0 (_tmp0_), _tmp1_); - base_path = NULL; - schema = _g_object_ref0 (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self)); - self->priv->connection_id = (guint) 0; - self->priv->_notifiers = (g_datalist_init (&_tmp2_), _tmp2_); - _tmp5_ = (_tmp4_ = desktop_agnostic_config_schema_get_metadata_option (schema, _tmp3_ = g_strconcat (opt_prefix, "base_path", NULL), &_inner_error_), _g_free0 (_tmp3_), _tmp4_); - if (_inner_error_ != NULL) { - _g_free0 (opt_prefix); - _g_free0 (base_path); - _g_object_unref0 (schema); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - base_path = (_tmp7_ = g_strdup (g_value_get_string (_tmp6_ = _tmp5_)), _g_free0 (base_path), _tmp7_); - _g_free0 (_tmp6_); - self->priv->schema_path = (_tmp8_ = g_strdup_printf ("/schemas%s/%s", base_path, desktop_agnostic_config_schema_get_app_name (schema)), _g_free0 (self->priv->schema_path), _tmp8_); - if (desktop_agnostic_config_backend_get_instance_id ((DesktopAgnosticConfigBackend*) self) == NULL) { - char* _tmp9_; - self->priv->path = (_tmp9_ = g_strdup_printf ("%s/%s", base_path, desktop_agnostic_config_schema_get_app_name (schema)), _g_free0 (self->priv->path), _tmp9_); - } else { - char* _tmp10_; - GValue* _tmp11_; - GValue* _tmp12_; - GValue* _tmp13_; - char* _tmp14_; - char* option; - char* _tmp16_; - char* _tmp15_; - _tmp12_ = (_tmp11_ = desktop_agnostic_config_schema_get_metadata_option (schema, _tmp10_ = g_strconcat (opt_prefix, "base_instance_path", NULL), &_inner_error_), _g_free0 (_tmp10_), _tmp11_); - if (_inner_error_ != NULL) { - _g_free0 (opt_prefix); - _g_free0 (base_path); - _g_object_unref0 (schema); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - option = (_tmp14_ = g_strdup (g_value_get_string (_tmp13_ = _tmp12_)), _g_free0 (_tmp13_), _tmp14_); - self->priv->path = (_tmp16_ = g_strdup_printf ("%s/%s/%s", _tmp15_ = string_replace (option, "${base_path}", base_path), desktop_agnostic_config_schema_get_app_name (schema), desktop_agnostic_config_backend_get_instance_id ((DesktopAgnosticConfigBackend*) self)), _g_free0 (self->priv->path), _tmp16_); - _g_free0 (_tmp15_); - { - desktop_agnostic_config_gconf_backend_associate_schemas_in_dir (self, self->priv->schema_path, self->priv->path, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch1_g_error; - } - } - goto __finally1; - __catch1_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("config-impl-gconf.vala:78: Error associating instance with schema: %s", err->message); - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - _g_free0 (option); - _g_free0 (opt_prefix); - _g_free0 (base_path); - _g_object_unref0 (schema); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _g_free0 (option); - } - { - guint _tmp17_; - gconf_client_add_dir (self->priv->client, self->priv->path, GCONF_CLIENT_PRELOAD_RECURSIVE, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch2_g_error; - } - _tmp17_ = gconf_client_notify_add (self->priv->client, self->priv->path, _desktop_agnostic_config_gconf_backend_notify_proxy_gconf_client_notify_func, g_object_ref (self), g_object_unref, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch2_g_error; - } - self->priv->connection_id = _tmp17_; - } - goto __finally2; - __catch2_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("config-impl-gconf.vala:91: Config (GConf) error: %s", err->message); - _g_error_free0 (err); - } - } - __finally2: - if (_inner_error_ != NULL) { - _g_free0 (opt_prefix); - _g_free0 (base_path); - _g_object_unref0 (schema); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _g_free0 (opt_prefix); - _g_free0 (base_path); - _g_object_unref0 (schema); -} - - -static void _g_slist_free_gconf_entry_unref (GSList* self) { - g_slist_foreach (self, (GFunc) gconf_entry_unref, NULL); - g_slist_free (self); -} - - -static void _g_slist_free_g_free (GSList* self) { - g_slist_foreach (self, (GFunc) g_free, NULL); - g_slist_free (self); -} - - -static void desktop_agnostic_config_gconf_backend_associate_schemas_in_dir (DesktopAgnosticConfigGConfBackend* self, const char* schema_dir, const char* pref_dir, GError** error) { - GError * _inner_error_; - GSList* entries; - GSList* subdirs; - GSList* _tmp0_; - GSList* _tmp1_; - GSList* _tmp18_; - GSList* _tmp19_; - g_return_if_fail (self != NULL); - g_return_if_fail (schema_dir != NULL); - g_return_if_fail (pref_dir != NULL); - _inner_error_ = NULL; - entries = NULL; - subdirs = NULL; - _tmp0_ = gconf_client_all_entries (self->priv->client, schema_dir, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_gconf_entry_unref0 (entries); - __g_slist_free_g_free0 (subdirs); - return; - } - entries = (_tmp1_ = _tmp0_, __g_slist_free_gconf_entry_unref0 (entries), _tmp1_); - { - GSList* entry_collection; - GSList* entry_it; - entry_collection = entries; - for (entry_it = entry_collection; entry_it != NULL; entry_it = entry_it->next) { - GConfEntry* _tmp17_; - GConfEntry* entry; - entry = (_tmp17_ = (GConfEntry*) entry_it->data, (_tmp17_ == NULL) ? NULL : gconf_entry_ref (_tmp17_), _tmp17_); - { - char* schema_key; - char* key; - GConfEntry* pref_entry; - char* pref_schema_key; - char* cgroup; - char* ckey; - DesktopAgnosticConfigSchemaOption* option; - char* _tmp2_; - char* _tmp4_; - char* _tmp3_; - GConfEntry* _tmp5_; - GConfEntry* _tmp6_; - char* _tmp10_; - char* _tmp9_ = NULL; - char* _tmp8_; - char* _tmp7_ = NULL; - DesktopAgnosticConfigSchemaOption* _tmp11_; - gboolean _tmp12_ = FALSE; - schema_key = NULL; - key = NULL; - pref_entry = NULL; - pref_schema_key = NULL; - cgroup = NULL; - ckey = NULL; - option = NULL; - schema_key = (_tmp2_ = g_strdup (gconf_entry_get_key (entry)), _g_free0 (schema_key), _tmp2_); - key = (_tmp4_ = g_strdup_printf ("%s/%s", pref_dir, _tmp3_ = g_path_get_basename (schema_key)), _g_free0 (key), _tmp4_); - _g_free0 (_tmp3_); - _tmp5_ = gconf_client_get_entry (self->priv->client, key, NULL, TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gconf_entry_unref0 (entry); - _g_free0 (schema_key); - _g_free0 (key); - _gconf_entry_unref0 (pref_entry); - _g_free0 (pref_schema_key); - _g_free0 (cgroup); - _g_free0 (ckey); - _g_object_unref0 (option); - __g_slist_free_gconf_entry_unref0 (entries); - __g_slist_free_g_free0 (subdirs); - return; - } - pref_entry = (_tmp6_ = _tmp5_, _gconf_entry_unref0 (pref_entry), _tmp6_); - (desktop_agnostic_config_gconf_backend_parse_group_and_key (self, key, &_tmp7_, &_tmp9_), cgroup = (_tmp8_ = _tmp7_, _g_free0 (cgroup), _tmp8_)); - ckey = (_tmp10_ = _tmp9_, _g_free0 (ckey), _tmp10_); - option = (_tmp11_ = _g_object_ref0 (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), cgroup, ckey)), _g_object_unref0 (option), _tmp11_); - if (option == NULL) { - _tmp12_ = TRUE; - } else { - _tmp12_ = !desktop_agnostic_config_schema_option_get_per_instance (option); - } - if (_tmp12_) { - _gconf_entry_unref0 (entry); - _g_free0 (schema_key); - _g_free0 (key); - _gconf_entry_unref0 (pref_entry); - _g_free0 (pref_schema_key); - _g_free0 (cgroup); - _g_free0 (ckey); - _g_object_unref0 (option); - continue; - } - if (pref_entry == NULL) { - char* _tmp13_; - pref_schema_key = (_tmp13_ = NULL, _g_free0 (pref_schema_key), _tmp13_); - } else { - char* _tmp14_; - pref_schema_key = (_tmp14_ = g_strdup (gconf_entry_get_schema_name (pref_entry)), _g_free0 (pref_schema_key), _tmp14_); - } - if (_vala_strcmp0 (schema_key, pref_schema_key) != 0) { - gboolean _tmp15_ = FALSE; - gboolean _tmp16_ = FALSE; - gconf_engine_associate_schema (self->priv->client->engine, key, schema_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gconf_entry_unref0 (entry); - _g_free0 (schema_key); - _g_free0 (key); - _gconf_entry_unref0 (pref_entry); - _g_free0 (pref_schema_key); - _g_free0 (cgroup); - _g_free0 (ckey); - _g_object_unref0 (option); - __g_slist_free_gconf_entry_unref0 (entries); - __g_slist_free_g_free0 (subdirs); - return; - } - if (pref_entry == NULL) { - _tmp16_ = TRUE; - } else { - _tmp16_ = gconf_entry_get_value (pref_entry) == NULL; - } - if (_tmp16_) { - _tmp15_ = TRUE; - } else { - _tmp15_ = gconf_entry_get_is_default (pref_entry); - } - if (_tmp15_) { - gconf_client_unset (self->priv->client, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gconf_entry_unref0 (entry); - _g_free0 (schema_key); - _g_free0 (key); - _gconf_entry_unref0 (pref_entry); - _g_free0 (pref_schema_key); - _g_free0 (cgroup); - _g_free0 (ckey); - _g_object_unref0 (option); - __g_slist_free_gconf_entry_unref0 (entries); - __g_slist_free_g_free0 (subdirs); - return; - } - } - } - _gconf_entry_unref0 (entry); - _g_free0 (schema_key); - _g_free0 (key); - _gconf_entry_unref0 (pref_entry); - _g_free0 (pref_schema_key); - _g_free0 (cgroup); - _g_free0 (ckey); - _g_object_unref0 (option); - } - } - } - _tmp18_ = gconf_client_all_dirs (self->priv->client, schema_dir, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_gconf_entry_unref0 (entries); - __g_slist_free_g_free0 (subdirs); - return; - } - subdirs = (_tmp19_ = _tmp18_, __g_slist_free_g_free0 (subdirs), _tmp19_); - { - GSList* dir_collection; - GSList* dir_it; - dir_collection = subdirs; - for (dir_it = dir_collection; dir_it != NULL; dir_it = dir_it->next) { - const char* dir; - dir = (const char*) dir_it->data; - { - char* base_key; - char* schema_subdir; - char* pref_subdir; - char* _tmp20_; - char* _tmp21_; - char* _tmp22_; - base_key = NULL; - schema_subdir = NULL; - pref_subdir = NULL; - base_key = (_tmp20_ = g_path_get_basename (dir), _g_free0 (base_key), _tmp20_); - schema_subdir = (_tmp21_ = g_strdup_printf ("%s/%s", schema_dir, base_key), _g_free0 (schema_subdir), _tmp21_); - pref_subdir = (_tmp22_ = g_strdup_printf ("%s/%s", pref_dir, base_key), _g_free0 (pref_subdir), _tmp22_); - desktop_agnostic_config_gconf_backend_associate_schemas_in_dir (self, schema_subdir, pref_subdir, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (base_key); - _g_free0 (schema_subdir); - _g_free0 (pref_subdir); - __g_slist_free_gconf_entry_unref0 (entries); - __g_slist_free_g_free0 (subdirs); - return; - } - _g_free0 (base_key); - _g_free0 (schema_subdir); - _g_free0 (pref_subdir); - } - } - } - __g_slist_free_gconf_entry_unref0 (entries); - __g_slist_free_g_free0 (subdirs); -} - - -static char* desktop_agnostic_config_gconf_backend_generate_key (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key) { - char* result; - char* full_key; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - full_key = NULL; - if (key == NULL) { - if (_vala_strcmp0 (group, DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT) == 0) { - char* _tmp0_; - full_key = (_tmp0_ = g_strdup (self->priv->path), _g_free0 (full_key), _tmp0_); - } else { - char* _tmp1_; - full_key = (_tmp1_ = g_strdup_printf ("%s/%s", self->priv->path, group), _g_free0 (full_key), _tmp1_); - } - } else { - if (_vala_strcmp0 (group, DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT) == 0) { - char* _tmp2_; - full_key = (_tmp2_ = g_strdup_printf ("%s/%s", self->priv->path, key), _g_free0 (full_key), _tmp2_); - } else { - char* _tmp3_; - full_key = (_tmp3_ = g_strdup_printf ("%s/%s/%s", self->priv->path, group, key), _g_free0 (full_key), _tmp3_); - } - } - result = full_key; - return result; -} - - -static glong string_get_length (const char* self) { - glong result; - g_return_val_if_fail (self != NULL, 0L); - result = g_utf8_strlen (self, -1); - return result; -} - - -static char* string_substring (const char* self, glong offset, glong len) { - char* result; - glong string_length; - const char* start; - g_return_val_if_fail (self != NULL, NULL); - string_length = g_utf8_strlen (self, -1); - if (offset < 0) { - offset = string_length + offset; - g_return_val_if_fail (offset >= 0, NULL); - } else { - g_return_val_if_fail (offset <= string_length, NULL); - } - if (len < 0) { - len = string_length - offset; - } - g_return_val_if_fail ((offset + len) <= string_length, NULL); - start = g_utf8_offset_to_pointer (self, offset); - result = g_strndup (start, ((gchar*) g_utf8_offset_to_pointer (start, len)) - ((gchar*) start)); - return result; -} - - -static void desktop_agnostic_config_gconf_backend_parse_group_and_key (DesktopAgnosticConfigGConfBackend* self, const char* full_key, char** group, char** key) { - const char* key_to_parse; - const char* last_slash; - g_return_if_fail (self != NULL); - g_return_if_fail (full_key != NULL); - if (group != NULL) { - *group = NULL; - } - if (key != NULL) { - *key = NULL; - } - key_to_parse = g_utf8_offset_to_pointer (full_key, string_get_length (self->priv->path) + 1); - last_slash = g_utf8_strrchr (key_to_parse, (gssize) string_get_length (key_to_parse), (gunichar) '/'); - if (last_slash == NULL) { - char* _tmp0_; - char* _tmp1_; - *group = (_tmp0_ = g_strdup (DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT), _g_free0 (*group), _tmp0_); - *key = (_tmp1_ = g_strdup (key_to_parse), _g_free0 (*key), _tmp1_); - } else { - glong offset; - char* _tmp2_; - char* _tmp3_; - offset = g_utf8_pointer_to_offset (key_to_parse, last_slash); - *group = (_tmp2_ = string_substring (key_to_parse, (glong) 0, offset), _g_free0 (*group), _tmp2_); - *key = (_tmp3_ = g_strdup (g_utf8_offset_to_pointer (key_to_parse, offset + 1)), _g_free0 (*key), _tmp3_); - } -} - - -static GConfValueType desktop_agnostic_config_gconf_backend_type_to_valuetype (DesktopAgnosticConfigGConfBackend* self, GType type) { - GConfValueType result; - GConfValueType vt = 0; - g_return_val_if_fail (self != NULL, 0); - if (type == G_TYPE_BOOLEAN) { - vt = GCONF_VALUE_BOOL; - } else { - if (type == G_TYPE_FLOAT) { - vt = GCONF_VALUE_FLOAT; - } else { - if (type == G_TYPE_INT) { - vt = GCONF_VALUE_INT; - } else { - if (type == G_TYPE_STRING) { - vt = GCONF_VALUE_STRING; - } else { - if (type == G_TYPE_VALUE_ARRAY) { - vt = GCONF_VALUE_LIST; - } else { - if (desktop_agnostic_config_schema_find_type (type) != NULL) { - vt = GCONF_VALUE_STRING; - } else { - vt = GCONF_VALUE_INVALID; - } - } - } - } - } - } - result = vt; - return result; -} - - -static void desktop_agnostic_config_gconf_backend_gconfvalue_to_gvalue (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key, GConfValue* gc_val, GValue* result, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigSchemaOption* schema_option; - GType type = 0UL; - GValue value = {0}; - DesktopAgnosticConfigSchemaOption* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (gc_val != NULL); - _inner_error_ = NULL; - schema_option = NULL; - schema_option = (_tmp0_ = _g_object_ref0 (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), group, key)), _g_object_unref0 (schema_option), _tmp0_); - if (schema_option == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, "The config key '%s/%s' does not exist in the schema.", group, key); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - return; - } else { - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - type = desktop_agnostic_config_schema_option_get_option_type (schema_option); - if (type == G_TYPE_BOOLEAN) { - GValue _tmp2_; - GValue _tmp1_ = {0}; - value = (_tmp2_ = (g_value_init (&_tmp1_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp1_, gconf_value_get_bool (gc_val)), _tmp1_), G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp2_); - } else { - if (type == G_TYPE_FLOAT) { - GValue _tmp4_; - GValue _tmp3_ = {0}; - value = (_tmp4_ = (g_value_init (&_tmp3_, G_TYPE_FLOAT), g_value_set_float (&_tmp3_, (float) gconf_value_get_float (gc_val)), _tmp3_), G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp4_); - } else { - if (type == G_TYPE_INT) { - GValue _tmp6_; - GValue _tmp5_ = {0}; - value = (_tmp6_ = (g_value_init (&_tmp5_, G_TYPE_INT), g_value_set_int (&_tmp5_, gconf_value_get_int (gc_val)), _tmp5_), G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp6_); - } else { - if (type == G_TYPE_STRING) { - GValue _tmp8_; - GValue _tmp7_ = {0}; - value = (_tmp8_ = (g_value_init (&_tmp7_, G_TYPE_STRING), g_value_set_string (&_tmp7_, gconf_value_get_string (gc_val)), _tmp7_), G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp8_); - } else { - if (type == G_TYPE_VALUE_ARRAY) { - GType list_type = 0UL; - GValueArray* array; - GValue _tmp10_; - GValue _tmp9_ = {0}; - GValueArray* _tmp11_; - GValueArray* _tmp12_; - GValueArray* _tmp14_; - GValueArray* _tmp13_; - array = NULL; - value = (_tmp10_ = (g_value_init (&_tmp9_, type), _tmp9_), G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp10_); - list_type = desktop_agnostic_config_schema_option_get_list_type (schema_option); - _tmp11_ = desktop_agnostic_config_gconf_backend_slist_to_valuearray (self, gconf_value_get_list (gc_val), list_type, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (array); - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - return; - } else { - _g_value_array_free0 (array); - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - array = (_tmp12_ = _tmp11_, _g_value_array_free0 (array), _tmp12_); - g_value_set_boxed (&value, _tmp14_ = (_tmp13_ = array, array = NULL, _tmp13_)); - _g_value_array_free0 (_tmp14_); - _g_value_array_free0 (array); - } else { - DesktopAgnosticConfigSchemaType* st; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (type)); - if (st == NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Invalid config value type."); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - return; - } else { - _g_object_unref0 (st); - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } else { - GValue _tmp15_ = {0}; - GValue _tmp16_; - GValue _tmp17_; - _tmp16_ = (desktop_agnostic_config_schema_type_deserialize (st, gconf_value_get_string (gc_val), &_tmp15_, &_inner_error_), _tmp15_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - return; - } else { - _g_object_unref0 (st); - _g_object_unref0 (schema_option); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - value = (_tmp17_ = _tmp16_, G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp17_); - } - _g_object_unref0 (st); - } - } - } - } - } - *result = value; - _g_object_unref0 (schema_option); - return; -} - - -static GValueArray* desktop_agnostic_config_gconf_backend_slist_to_valuearray (DesktopAgnosticConfigGConfBackend* self, GSList* list, GType type, GError** error) { - GValueArray* result; - GError * _inner_error_; - GValueArray* arr; - g_return_val_if_fail (self != NULL, NULL); - _inner_error_ = NULL; - arr = g_value_array_new (g_slist_length (list)); - { - GSList* gc_val_collection; - GSList* gc_val_it; - gc_val_collection = list; - for (gc_val_it = gc_val_collection; gc_val_it != NULL; gc_val_it = gc_val_it->next) { - GConfValue* gc_val; - gc_val = (GConfValue*) gc_val_it->data; - { - GValue val = {0}; - if (type == G_TYPE_BOOLEAN) { - GValue _tmp1_; - GValue _tmp0_ = {0}; - val = (_tmp1_ = (g_value_init (&_tmp0_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp0_, gconf_value_get_bool (gc_val)), _tmp0_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp1_); - } else { - if (type == G_TYPE_FLOAT) { - GValue _tmp3_; - GValue _tmp2_ = {0}; - val = (_tmp3_ = (g_value_init (&_tmp2_, G_TYPE_FLOAT), g_value_set_float (&_tmp2_, (float) gconf_value_get_float (gc_val)), _tmp2_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp3_); - } else { - if (type == G_TYPE_INT) { - GValue _tmp5_; - GValue _tmp4_ = {0}; - val = (_tmp5_ = (g_value_init (&_tmp4_, G_TYPE_INT), g_value_set_int (&_tmp4_, gconf_value_get_int (gc_val)), _tmp4_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp5_); - } else { - if (type == G_TYPE_STRING) { - GValue _tmp7_; - GValue _tmp6_ = {0}; - val = (_tmp7_ = (g_value_init (&_tmp6_, G_TYPE_STRING), g_value_set_string (&_tmp6_, gconf_value_get_string (gc_val)), _tmp6_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp7_); - } else { - DesktopAgnosticConfigSchemaType* st; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (type)); - if (st == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Invalid config value type: %s.", g_type_name (type)); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_value_array_free0 (arr); - return NULL; - } else { - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_value_array_free0 (arr); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - } else { - GValue _tmp8_ = {0}; - GValue _tmp9_; - GValue _tmp10_; - _tmp9_ = (desktop_agnostic_config_schema_type_deserialize (st, gconf_value_get_string (gc_val), &_tmp8_, &_inner_error_), _tmp8_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_value_array_free0 (arr); - return NULL; - } else { - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_value_array_free0 (arr); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - val = (_tmp10_ = _tmp9_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp10_); - } - _g_object_unref0 (st); - } - } - } - } - g_value_array_append (arr, &val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - } - } - result = arr; - return result; -} - - -static void desktop_agnostic_config_gconf_backend_notify_proxy (DesktopAgnosticConfigGConfBackend* self, GConfClient* client, guint cnxn_id, GConfEntry* entry) { - GError * _inner_error_; - char* full_key; - char* group; - char* key; - GValue value = {0}; - char* _tmp3_; - char* _tmp2_ = NULL; - char* _tmp1_; - char* _tmp0_ = NULL; - GValue _tmp4_ = {0}; - GValue _tmp5_; - GValue _tmp6_; - GSList* notify_func_list; - g_return_if_fail (self != NULL); - g_return_if_fail (client != NULL); - g_return_if_fail (entry != NULL); - _inner_error_ = NULL; - full_key = g_strdup (gconf_entry_get_key (entry)); - group = NULL; - key = NULL; - (desktop_agnostic_config_gconf_backend_parse_group_and_key (self, full_key, &_tmp0_, &_tmp2_), group = (_tmp1_ = _tmp0_, _g_free0 (group), _tmp1_)); - key = (_tmp3_ = _tmp2_, _g_free0 (key), _tmp3_); - _tmp5_ = (desktop_agnostic_config_gconf_backend_gconfvalue_to_gvalue (self, group, key, gconf_entry_get_value (entry), &_tmp4_, &_inner_error_), _tmp4_); - if (_inner_error_ != NULL) { - _g_free0 (full_key); - _g_free0 (group); - _g_free0 (key); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - value = (_tmp6_ = _tmp5_, G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp6_); - notify_func_list = (GSList*) g_datalist_get_data (&self->priv->_notifiers, full_key); - { - GSList* notify_func_collection; - GSList* notify_func_it; - notify_func_collection = notify_func_list; - for (notify_func_it = notify_func_collection; notify_func_it != NULL; notify_func_it = notify_func_it->next) { - DesktopAgnosticConfigNotifyDelegate* notify_func; - notify_func = (DesktopAgnosticConfigNotifyDelegate*) notify_func_it->data; - { - desktop_agnostic_config_notify_delegate_execute (notify_func, group, key, &value); - } - } - } - _g_free0 (full_key); - _g_free0 (group); - _g_free0 (key); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; -} - - -static void _desktop_agnostic_config_gconf_backend_ensure_key_exists (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - if (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), group, key) == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, "The config key '%s/%s' does not exist in the schema.", group, key); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } -} - - -static void desktop_agnostic_config_gconf_backend_real_remove (DesktopAgnosticConfigBackend* base, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - self = (DesktopAgnosticConfigGConfBackend*) base; - _inner_error_ = NULL; - gconf_client_recursive_unset (self->priv->client, self->priv->path, 0, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -static void desktop_agnostic_config_gconf_backend_real_notify_add (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - DesktopAgnosticConfigNotifyDelegate* notify; - char* full_key; - GSList* callbacks; - DesktopAgnosticConfigNotifyDelegate* _tmp0_; - char* _tmp1_; - DesktopAgnosticConfigNotifyDelegate* _tmp2_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - notify = NULL; - full_key = NULL; - callbacks = NULL; - notify = (_tmp0_ = desktop_agnostic_config_notify_delegate_new (callback, callback_target), _desktop_agnostic_config_notify_delegate_free0 (notify), _tmp0_); - full_key = (_tmp1_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp1_); - callbacks = (GSList*) g_datalist_get_data (&self->priv->_notifiers, full_key); - callbacks = g_slist_append (callbacks, (_tmp2_ = notify, notify = NULL, _tmp2_)); - g_datalist_set_data (&self->priv->_notifiers, full_key, callbacks); - _desktop_agnostic_config_notify_delegate_free0 (notify); - _g_free0 (full_key); -} - - -static void desktop_agnostic_config_gconf_backend_real_notify (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* full_key; - GSList* notifications; - GValue value = {0}; - GValue _tmp0_ = {0}; - GValue _tmp1_; - GValue _tmp2_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - full_key = desktop_agnostic_config_gconf_backend_generate_key (self, group, key); - notifications = NULL; - notifications = (GSList*) g_datalist_get_data (&self->priv->_notifiers, full_key); - _tmp1_ = (desktop_agnostic_config_backend_get_value ((DesktopAgnosticConfigBackend*) self, group, key, &_tmp0_, &_inner_error_), _tmp0_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; - return; - } - value = (_tmp2_ = _tmp1_, G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp2_); - { - GSList* notify_collection; - GSList* notify_it; - notify_collection = notifications; - for (notify_it = notify_collection; notify_it != NULL; notify_it = notify_it->next) { - DesktopAgnosticConfigNotifyDelegate* notify; - notify = (DesktopAgnosticConfigNotifyDelegate*) notify_it->data; - { - desktop_agnostic_config_notify_delegate_execute (notify, group, key, &value); - } - } - } - _g_free0 (full_key); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; -} - - -static void desktop_agnostic_config_gconf_backend_real_notify_remove (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - char* full_key; - GSList* funcs; - DesktopAgnosticConfigNotifyDelegate* ndata; - GSList* node; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - full_key = desktop_agnostic_config_gconf_backend_generate_key (self, group, key); - funcs = (GSList*) g_datalist_get_data (&self->priv->_notifiers, full_key); - ndata = desktop_agnostic_config_notify_delegate_new (callback, callback_target); - node = NULL; - node = g_slist_find_custom (funcs, ndata, (GCompareFunc) desktop_agnostic_config_notify_delegate_compare); - if (node != NULL) { - DesktopAgnosticConfigNotifyDelegate* _tmp0_; - node->data = (_tmp0_ = NULL, _desktop_agnostic_config_notify_delegate_free0 (node->data), _tmp0_); - funcs = g_slist_delete_link (funcs, node); - g_datalist_set_data (&self->priv->_notifiers, full_key, funcs); - } - _g_free0 (full_key); - _desktop_agnostic_config_notify_delegate_free0 (ndata); -} - - -static void desktop_agnostic_config_gconf_backend_real_reset (DesktopAgnosticConfigBackend* base, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - DesktopAgnosticConfigSchema* schema; - self = (DesktopAgnosticConfigGConfBackend*) base; - _inner_error_ = NULL; - schema = _g_object_ref0 (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self)); - { - GList* group_collection; - GList* group_it; - group_collection = desktop_agnostic_config_schema_get_groups (schema); - for (group_it = group_collection; group_it != NULL; group_it = group_it->next) { - const char* group; - group = (const char*) group_it->data; - { - { - GList* key_collection; - GList* key_it; - key_collection = desktop_agnostic_config_schema_get_keys (schema, group); - for (key_it = key_collection; key_it != NULL; key_it = key_it->next) { - const char* key; - key = (const char*) key_it->data; - { - char* full_key; - GConfValue* val; - char* _tmp0_; - GConfValue* _tmp1_; - GConfValue* _tmp2_; - full_key = NULL; - val = NULL; - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - _tmp1_ = gconf_client_get_default_from_schema (self->priv->client, full_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_value_free0 (val); - _g_list_free0 (group_collection); - _g_object_unref0 (schema); - return; - } - val = (_tmp2_ = _tmp1_, _gconf_value_free0 (val), _tmp2_); - gconf_client_set (self->priv->client, full_key, val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_value_free0 (val); - _g_list_free0 (group_collection); - _g_object_unref0 (schema); - return; - } - _g_free0 (full_key); - _gconf_value_free0 (val); - } - } - } - } - } - _g_list_free0 (group_collection); - } - _g_object_unref0 (schema); -} - - -static void desktop_agnostic_config_gconf_backend_real_get_value (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValue* result, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* full_key; - GConfValue* gc_val; - GConfEntry* entry; - GValue val = {0}; - char* _tmp0_; - GConfEntry* _tmp1_; - GConfEntry* _tmp2_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - full_key = NULL; - gc_val = NULL; - entry = NULL; - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - _tmp1_ = gconf_client_get_entry (self->priv->client, full_key, NULL, TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_entry_unref0 (entry); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - return; - } - entry = (_tmp2_ = _tmp1_, _gconf_entry_unref0 (entry), _tmp2_); - gc_val = gconf_entry_get_value (entry); - if (gc_val == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, "Could not find the key specified: %s.", full_key); - { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_entry_unref0 (entry); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - return; - } - } else { - GValue _tmp3_ = {0}; - GValue _tmp4_; - GValue _tmp5_; - _tmp4_ = (desktop_agnostic_config_gconf_backend_gconfvalue_to_gvalue (self, group, key, gc_val, &_tmp3_, &_inner_error_), _tmp3_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_entry_unref0 (entry); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - return; - } - val = (_tmp5_ = _tmp4_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp5_); - } - *result = val; - _g_free0 (full_key); - _gconf_entry_unref0 (entry); - return; -} - - -static gboolean desktop_agnostic_config_gconf_backend_real_get_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - gboolean result; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - gboolean _tmp1_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_val_if_fail (group != NULL, FALSE); - g_return_val_if_fail (key != NULL, FALSE); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return FALSE; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - _tmp1_ = gconf_client_get_bool (self->priv->client, full_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return FALSE; - } - result = _tmp1_; - _g_free0 (full_key); - return result; -} - - -static void desktop_agnostic_config_gconf_backend_real_set_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gboolean value, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - gconf_client_set_bool (self->priv->client, full_key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - _g_free0 (full_key); -} - - -static float desktop_agnostic_config_gconf_backend_real_get_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - float result; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - double _tmp1_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_val_if_fail (group != NULL, 0.0F); - g_return_val_if_fail (key != NULL, 0.0F); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return 0.0F; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - _tmp1_ = gconf_client_get_float (self->priv->client, full_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return 0.0F; - } - result = (float) _tmp1_; - _g_free0 (full_key); - return result; -} - - -static void desktop_agnostic_config_gconf_backend_real_set_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, float value, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - gconf_client_set_float (self->priv->client, full_key, (double) value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - _g_free0 (full_key); -} - - -static gint desktop_agnostic_config_gconf_backend_real_get_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - gint result; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - gint _tmp1_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_val_if_fail (group != NULL, 0); - g_return_val_if_fail (key != NULL, 0); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return 0; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - _tmp1_ = gconf_client_get_int (self->priv->client, full_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return 0; - } - result = _tmp1_; - _g_free0 (full_key); - return result; -} - - -static void desktop_agnostic_config_gconf_backend_real_set_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gint value, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - gconf_client_set_int (self->priv->client, full_key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - _g_free0 (full_key); -} - - -static char* desktop_agnostic_config_gconf_backend_real_get_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - char* result; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - char* _tmp1_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return NULL; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - _tmp1_ = gconf_client_get_string (self->priv->client, full_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return NULL; - } - result = _tmp1_; - _g_free0 (full_key); - return result; -} - - -static void desktop_agnostic_config_gconf_backend_real_set_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, const char* value, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* full_key; - char* _tmp0_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - gconf_client_set_string (self->priv->client, full_key, value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - _g_free0 (full_key); -} - - -static GValueArray* desktop_agnostic_config_gconf_backend_real_get_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GValueArray* result; - GError * _inner_error_; - char* full_key; - GType list_type = 0UL; - GConfValue* gc_val; - char* _tmp0_; - GConfValue* _tmp1_; - GConfValue* _tmp2_; - GValueArray* _tmp3_; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - full_key = NULL; - gc_val = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_value_free0 (gc_val); - return NULL; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - list_type = desktop_agnostic_config_schema_option_get_list_type (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), group, key)); - _tmp1_ = gconf_client_get (self->priv->client, full_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_value_free0 (gc_val); - return NULL; - } - gc_val = (_tmp2_ = _tmp1_, _gconf_value_free0 (gc_val), _tmp2_); - _tmp3_ = desktop_agnostic_config_gconf_backend_slist_to_valuearray (self, gconf_value_get_list (gc_val), list_type, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - _gconf_value_free0 (gc_val); - return NULL; - } - result = _tmp3_; - _g_free0 (full_key); - _gconf_value_free0 (gc_val); - return result; -} - - -static void _g_slist_free_gconf_value_free (GSList* self) { - g_slist_foreach (self, (GFunc) gconf_value_free, NULL); - g_slist_free (self); -} - - -static void desktop_agnostic_config_gconf_backend_real_set_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValueArray* value, GError** error) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - char* full_key; - GType type = 0UL; - char* _tmp0_; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - self = (DesktopAgnosticConfigGConfBackend*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - _inner_error_ = NULL; - full_key = NULL; - _desktop_agnostic_config_gconf_backend_ensure_key_exists (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - full_key = (_tmp0_ = desktop_agnostic_config_gconf_backend_generate_key (self, group, key), _g_free0 (full_key), _tmp0_); - type = desktop_agnostic_config_schema_option_get_list_type (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), group, key)); - if (type == G_TYPE_BOOLEAN) { - _tmp2_ = TRUE; - } else { - _tmp2_ = type == G_TYPE_FLOAT; - } - if (_tmp2_) { - _tmp1_ = TRUE; - } else { - _tmp1_ = type == G_TYPE_INT; - } - if (_tmp1_) { - GSList* list; - GConfValue* val; - GConfValueType gc_type; - GSList* _tmp3_; - GConfValue* _tmp8_; - list = NULL; - val = NULL; - gc_type = desktop_agnostic_config_gconf_backend_type_to_valuetype (self, type); - list = (_tmp3_ = NULL, __g_slist_free_gconf_value_free0 (list), _tmp3_); - { - GValueArray* list_val_collection; - guint list_val_index; - list_val_collection = value; - for (list_val_index = 0; list_val_index < list_val_collection->n_values; list_val_index = list_val_index + 1) { - GValue list_val; - list_val = *g_value_array_get_nth (list_val_collection, list_val_index); - { - GConfValue* gc_val; - GConfValue* _tmp4_; - GConfValue* _tmp7_; - gc_val = NULL; - gc_val = (_tmp4_ = gconf_value_new (gc_type), _gconf_value_free0 (gc_val), _tmp4_); - if (type == G_TYPE_BOOLEAN) { - gconf_value_set_bool (gc_val, g_value_get_boolean (&list_val)); - } else { - if (type == G_TYPE_FLOAT) { - float _tmp5_; - _tmp5_ = desktop_agnostic_config_backend_get_float_from_value (&list_val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gconf_value_free0 (gc_val); - __g_slist_free_gconf_value_free0 (list); - _gconf_value_free0 (val); - _g_free0 (full_key); - return; - } - gconf_value_set_float (gc_val, (double) _tmp5_); - } else { - if (type == G_TYPE_INT) { - gint _tmp6_; - _tmp6_ = desktop_agnostic_config_backend_get_int_from_value (&list_val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gconf_value_free0 (gc_val); - __g_slist_free_gconf_value_free0 (list); - _gconf_value_free0 (val); - _g_free0 (full_key); - return; - } - gconf_value_set_int (gc_val, _tmp6_); - } else { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Invalid config value type: %s.", g_type_name (type)); - { - g_propagate_error (error, _inner_error_); - _gconf_value_free0 (gc_val); - __g_slist_free_gconf_value_free0 (list); - _gconf_value_free0 (val); - _g_free0 (full_key); - return; - } - } - } - } - list = g_slist_append (list, (_tmp7_ = gc_val, gc_val = NULL, _tmp7_)); - _gconf_value_free0 (gc_val); - } - } - } - val = (_tmp8_ = gconf_value_new (GCONF_VALUE_LIST), _gconf_value_free0 (val), _tmp8_); - gconf_value_set_list_type (val, gc_type); - gconf_value_set_list (val, list); - gconf_client_set (self->priv->client, full_key, val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_gconf_value_free0 (list); - _gconf_value_free0 (val); - _g_free0 (full_key); - return; - } - __g_slist_free_gconf_value_free0 (list); - _gconf_value_free0 (val); - } else { - DesktopAgnosticConfigSchemaType* st; - GSList* list; - GSList* _tmp10_; - st = NULL; - list = NULL; - if (type != G_TYPE_STRING) { - DesktopAgnosticConfigSchemaType* _tmp9_; - st = (_tmp9_ = _g_object_ref0 (desktop_agnostic_config_schema_find_type (type)), _g_object_unref0 (st), _tmp9_); - if (st == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "Invalid config value type: %s.", g_type_name (type)); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - __g_slist_free_g_free0 (list); - _g_free0 (full_key); - return; - } - } - } - list = (_tmp10_ = NULL, __g_slist_free_g_free0 (list), _tmp10_); - { - GValueArray* list_val_collection; - guint list_val_index; - list_val_collection = value; - for (list_val_index = 0; list_val_index < list_val_collection->n_values; list_val_index = list_val_index + 1) { - GValue list_val; - list_val = *g_value_array_get_nth (list_val_collection, list_val_index); - { - if (st == NULL) { - list = g_slist_append (list, g_strdup (g_value_get_string (&list_val))); - } else { - char* _tmp11_; - _tmp11_ = desktop_agnostic_config_schema_type_serialize (st, &list_val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - __g_slist_free_g_free0 (list); - _g_free0 (full_key); - return; - } - list = g_slist_append (list, _tmp11_); - } - } - } - } - gconf_client_set_list (self->priv->client, full_key, GCONF_VALUE_STRING, list, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - __g_slist_free_g_free0 (list); - _g_free0 (full_key); - return; - } - _g_object_unref0 (st); - __g_slist_free_g_free0 (list); - } - _g_free0 (full_key); -} - - -DesktopAgnosticConfigGConfBackend* desktop_agnostic_config_gconf_backend_construct (GType object_type) { - DesktopAgnosticConfigGConfBackend * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticConfigGConfBackend* desktop_agnostic_config_gconf_backend_new (void) { - return desktop_agnostic_config_gconf_backend_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND); -} - - -static char* desktop_agnostic_config_gconf_backend_real_get_name (DesktopAgnosticConfigBackend* base) { - char* result; - DesktopAgnosticConfigGConfBackend* self; - self = (DesktopAgnosticConfigGConfBackend*) base; - result = g_strdup (DESKTOP_AGNOSTIC_CONFIG_BACKEND_NAME); - return result; -} - - -static GObject * desktop_agnostic_config_gconf_backend_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticConfigGConfBackend * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_config_gconf_backend_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND (obj); - { - self->priv->client = gconf_client_get_default (); - } - return obj; -} - - -static void desktop_agnostic_config_gconf_backend_class_init (DesktopAgnosticConfigGConfBackendClass * klass) { - desktop_agnostic_config_gconf_backend_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticConfigGConfBackendPrivate)); - G_OBJECT_CLASS (klass)->constructed = desktop_agnostic_config_gconf_backend_real_constructed; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->remove = desktop_agnostic_config_gconf_backend_real_remove; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify_add = desktop_agnostic_config_gconf_backend_real_notify_add; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify = desktop_agnostic_config_gconf_backend_real_notify; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify_remove = desktop_agnostic_config_gconf_backend_real_notify_remove; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->reset = desktop_agnostic_config_gconf_backend_real_reset; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_value = desktop_agnostic_config_gconf_backend_real_get_value; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_bool = desktop_agnostic_config_gconf_backend_real_get_bool; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_bool = desktop_agnostic_config_gconf_backend_real_set_bool; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_float = desktop_agnostic_config_gconf_backend_real_get_float; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_float = desktop_agnostic_config_gconf_backend_real_set_float; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_int = desktop_agnostic_config_gconf_backend_real_get_int; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_int = desktop_agnostic_config_gconf_backend_real_set_int; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_string = desktop_agnostic_config_gconf_backend_real_get_string; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_string = desktop_agnostic_config_gconf_backend_real_set_string; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_list = desktop_agnostic_config_gconf_backend_real_get_list; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_list = desktop_agnostic_config_gconf_backend_real_set_list; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_name = desktop_agnostic_config_gconf_backend_real_get_name; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_gconf_backend_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_config_gconf_backend_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_gconf_backend_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_NAME, "name"); -} - - -static void desktop_agnostic_config_gconf_backend_instance_init (DesktopAgnosticConfigGConfBackend * self) { - self->priv = DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_GET_PRIVATE (self); -} - - -static void desktop_agnostic_config_gconf_backend_finalize (GObject* obj) { - DesktopAgnosticConfigGConfBackend * self; - GError * _inner_error_; - self = DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND (obj); - _inner_error_ = NULL; - { - { - gconf_client_notify_remove (self->priv->client, self->priv->connection_id); - gconf_client_remove_dir (self->priv->client, self->priv->path, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch3_g_error; - } - } - goto __finally3; - __catch3_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("config-impl-gconf.vala:104: Config (GConf) error: %s", err->message); - _g_error_free0 (err); - } - } - __finally3: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - } - _g_free0 (self->priv->schema_path); - _g_free0 (self->priv->path); - G_OBJECT_CLASS (desktop_agnostic_config_gconf_backend_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_gconf_backend_get_type (void) { - static GType desktop_agnostic_config_gconf_backend_type_id = 0; - if (desktop_agnostic_config_gconf_backend_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigGConfBackendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_gconf_backend_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigGConfBackend), 0, (GInstanceInitFunc) desktop_agnostic_config_gconf_backend_instance_init, NULL }; - desktop_agnostic_config_gconf_backend_type_id = g_type_register_static (DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, "DesktopAgnosticConfigGConfBackend", &g_define_type_info, 0); - } - return desktop_agnostic_config_gconf_backend_type_id; -} - - -static void desktop_agnostic_config_gconf_backend_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigGConfBackend * self; - self = DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_NAME: - g_value_set_string (value, desktop_agnostic_config_backend_get_name ((DesktopAgnosticConfigBackend*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static GValue* _g_value_dup (GValue* self) { - return g_boxed_copy (G_TYPE_VALUE, self); -} - - -static gpointer __g_value_dup0 (gpointer self) { - return self ? _g_value_dup (self) : NULL; -} - - -GType register_plugin (void) { - GType result; - GValue val = {0}; - GHashTable* backend_metadata_keys; - GValue _tmp1_; - GValue _tmp0_ = {0}; - GValue _tmp3_; - GValue _tmp2_ = {0}; - backend_metadata_keys = NULL; - val = (_tmp1_ = (g_value_init (&_tmp0_, G_TYPE_STRING), g_value_set_string (&_tmp0_, "/apps"), _tmp0_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp1_); - backend_metadata_keys = desktop_agnostic_config_backend_get_backend_metadata_keys (); - g_hash_table_insert (backend_metadata_keys, g_strdup_printf ("%s.base_path", DESKTOP_AGNOSTIC_CONFIG_BACKEND_NAME), __g_value_dup0 (&val)); - val = (_tmp3_ = (g_value_init (&_tmp2_, G_TYPE_STRING), g_value_set_string (&_tmp2_, "${base_path}/instances"), _tmp2_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp3_); - g_hash_table_insert (backend_metadata_keys, g_strdup_printf ("%s.base_instance_path", DESKTOP_AGNOSTIC_CONFIG_BACKEND_NAME), __g_value_dup0 (&val)); - result = DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND; - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - return result; -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-impl-keyfile.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-impl-keyfile.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-impl-keyfile.c 2010-04-11 07:32:35.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-impl-keyfile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2206 +0,0 @@ -/* config-impl-keyfile.c generated by valac, the Vala compiler - * generated from config-impl-keyfile.vala, do not modify */ - -/* - * A GKeyFile-based implementation of the Config interface. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE (desktop_agnostic_config_gkey_file_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE, DesktopAgnosticConfigGKeyFile)) -#define DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE, DesktopAgnosticConfigGKeyFileClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GKEY_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GKEY_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE)) -#define DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE, DesktopAgnosticConfigGKeyFileClass)) - -typedef struct _DesktopAgnosticConfigGKeyFile DesktopAgnosticConfigGKeyFile; -typedef struct _DesktopAgnosticConfigGKeyFileClass DesktopAgnosticConfigGKeyFileClass; -typedef struct _DesktopAgnosticConfigGKeyFilePrivate DesktopAgnosticConfigGKeyFilePrivate; -#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL))) -#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _desktop_agnostic_config_notify_delegate_free0(var) ((var == NULL) ? NULL : (var = (desktop_agnostic_config_notify_delegate_free (var), NULL))) - -struct _DesktopAgnosticConfigGKeyFile { - DesktopAgnosticConfigBackend parent_instance; - DesktopAgnosticConfigGKeyFilePrivate * priv; -}; - -struct _DesktopAgnosticConfigGKeyFileClass { - DesktopAgnosticConfigBackendClass parent_class; -}; - -struct _DesktopAgnosticConfigGKeyFilePrivate { - GKeyFile* _data; - DesktopAgnosticVFSFile* _keyfile; - DesktopAgnosticVFSFileMonitor* _keyfile_monitor; - gulong _monitor_changed_id; - char* _checksum; - gboolean _autosave; - GData* _notifiers; -}; - - -static gpointer desktop_agnostic_config_gkey_file_parent_class = NULL; - -GType desktop_agnostic_config_gkey_file_get_type (void); -#define DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE, DesktopAgnosticConfigGKeyFilePrivate)) -enum { - DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_NAME -}; -static void desktop_agnostic_config_gkey_file_save_config (DesktopAgnosticConfigGKeyFile* self, GError** error); -static void desktop_agnostic_config_gkey_file_update_config (DesktopAgnosticConfigGKeyFile* self, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_get_data_from_file (DesktopAgnosticConfigGKeyFile* self, DesktopAgnosticVFSFile* file, char** contents, gsize* length, char** checksum, GError** error); -static void desktop_agnostic_config_gkey_file_load_data (DesktopAgnosticConfigGKeyFile* self, DesktopAgnosticVFSFile* file, GError** error); -static GValueArray* desktop_agnostic_config_gkey_file_generate_valuearray_from_keyfile (DesktopAgnosticConfigGKeyFile* self, GKeyFile* keyfile, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_set_value_from_keyfile (DesktopAgnosticConfigGKeyFile* self, GKeyFile* keyfile, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_on_keyfile_changed (DesktopAgnosticConfigGKeyFile* self, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, DesktopAgnosticVFSFileMonitor* monitor); -static void desktop_agnostic_config_gkey_file_ensure_directory (DesktopAgnosticConfigGKeyFile* self, const char* path); -static gboolean desktop_agnostic_config_gkey_file_create_file_monitor (DesktopAgnosticConfigGKeyFile* self); -static gboolean _desktop_agnostic_config_gkey_file_create_file_monitor_gsource_func (gpointer self); -static void desktop_agnostic_config_gkey_file_real_constructed (GObject* base); -static void desktop_agnostic_config_gkey_file_real_reset (DesktopAgnosticConfigBackend* base, GError** error); -static void desktop_agnostic_config_gkey_file_real_notify_add (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void desktop_agnostic_config_gkey_file_real_notify (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_real_notify_remove (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error); -static void desktop_agnostic_config_gkey_file_real_remove (DesktopAgnosticConfigBackend* base, GError** error); -static void desktop_agnostic_config_gkey_file_real_get_value (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValue* result, GError** error); -static gboolean desktop_agnostic_config_gkey_file_real_get_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_real_set_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gboolean value, GError** error); -static float desktop_agnostic_config_gkey_file_real_get_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_real_set_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, float value, GError** error); -static gint desktop_agnostic_config_gkey_file_real_get_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_real_set_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gint value, GError** error); -static char* desktop_agnostic_config_gkey_file_real_get_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_gkey_file_real_set_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, const char* value, GError** error); -static GValueArray* desktop_agnostic_config_gkey_file_real_get_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error); -static void _vala_array_add1 (gboolean** array, int* length, int* size, gboolean value); -static void _vala_array_add2 (gint** array, int* length, int* size, gint value); -static void _vala_array_add3 (double** array, int* length, int* size, double value); -static void _vala_array_add4 (char*** array, int* length, int* size, char* value); -static void _vala_array_add5 (char*** array, int* length, int* size, char* value); -static void desktop_agnostic_config_gkey_file_real_set_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValueArray* value, GError** error); -DesktopAgnosticConfigGKeyFile* desktop_agnostic_config_gkey_file_new (void); -DesktopAgnosticConfigGKeyFile* desktop_agnostic_config_gkey_file_construct (GType object_type); -static GObject * desktop_agnostic_config_gkey_file_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_config_gkey_file_finalize (GObject* obj); -static void desktop_agnostic_config_gkey_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -GType register_plugin (void); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -static void desktop_agnostic_config_gkey_file_save_config (DesktopAgnosticConfigGKeyFile* self, GError** error) { - GError * _inner_error_; - char* data; - gsize length = 0UL; - char* _tmp0_; - char* _tmp1_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - data = NULL; - data = (_tmp0_ = g_key_file_to_data (self->priv->_data, &length, NULL), _g_free0 (data), _tmp0_); - self->priv->_checksum = (_tmp1_ = g_compute_checksum_for_string (G_CHECKSUM_SHA256, data, length), _g_free0 (self->priv->_checksum), _tmp1_); - if (self->priv->_monitor_changed_id != 0) { - g_signal_handler_block (self->priv->_keyfile_monitor, self->priv->_monitor_changed_id); - } - desktop_agnostic_vfs_file_replace_contents (self->priv->_keyfile, data, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (data); - return; - } - if (self->priv->_monitor_changed_id != 0) { - g_signal_handler_unblock (self->priv->_keyfile_monitor, self->priv->_monitor_changed_id); - } - _g_free0 (data); -} - - -static void desktop_agnostic_config_gkey_file_update_config (DesktopAgnosticConfigGKeyFile* self, const char* group, const char* key, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - if (self->priv->_autosave) { - desktop_agnostic_config_gkey_file_save_config (self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } - desktop_agnostic_config_backend_notify ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -static void desktop_agnostic_config_gkey_file_get_data_from_file (DesktopAgnosticConfigGKeyFile* self, DesktopAgnosticVFSFile* file, char** contents, gsize* length, char** checksum, GError** error) { - GError * _inner_error_; - char* _tmp2_; - gboolean _tmp1_; - char* _tmp0_ = NULL; - char* _tmp3_; - g_return_if_fail (self != NULL); - g_return_if_fail (file != NULL); - if (contents != NULL) { - *contents = NULL; - } - if (checksum != NULL) { - *checksum = NULL; - } - _inner_error_ = NULL; - _tmp1_ = desktop_agnostic_vfs_file_load_contents (file, &_tmp0_, length, &_inner_error_); - *contents = (_tmp2_ = _tmp0_, _g_free0 (*contents), _tmp2_); - _tmp1_; - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - *checksum = (_tmp3_ = g_compute_checksum_for_string (G_CHECKSUM_SHA256, *contents, *length), _g_free0 (*checksum), _tmp3_); -} - - -static void desktop_agnostic_config_gkey_file_load_data (DesktopAgnosticConfigGKeyFile* self, DesktopAgnosticVFSFile* file, GError** error) { - GError * _inner_error_; - char* data; - gsize length = 0UL; - char* _tmp3_; - char* _tmp2_ = NULL; - char* _tmp1_; - char* _tmp0_ = NULL; - g_return_if_fail (self != NULL); - g_return_if_fail (file != NULL); - _inner_error_ = NULL; - data = NULL; - (desktop_agnostic_config_gkey_file_get_data_from_file (self, file, &_tmp0_, &length, &_tmp2_, &_inner_error_), data = (_tmp1_ = _tmp0_, _g_free0 (data), _tmp1_)); - self->priv->_checksum = (_tmp3_ = _tmp2_, _g_free0 (self->priv->_checksum), _tmp3_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (data); - return; - } - g_key_file_load_from_data (self->priv->_data, data, (gsize) ((gulong) length), G_KEY_FILE_NONE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (data); - return; - } - _g_free0 (data); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_config_gkey_file_set_value_from_keyfile (DesktopAgnosticConfigGKeyFile* self, GKeyFile* keyfile, const char* group, const char* key, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigSchemaOption* option; - GType type; - g_return_if_fail (self != NULL); - g_return_if_fail (keyfile != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - option = _g_object_ref0 (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), group, key)); - type = desktop_agnostic_config_schema_option_get_option_type (option); - if (type == G_TYPE_BOOLEAN) { - gboolean _tmp0_; - _tmp0_ = g_key_file_get_boolean (keyfile, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - desktop_agnostic_config_backend_set_bool ((DesktopAgnosticConfigBackend*) self, group, key, _tmp0_, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - if (type == G_TYPE_INT) { - gint _tmp1_; - _tmp1_ = g_key_file_get_integer (keyfile, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - desktop_agnostic_config_backend_set_int ((DesktopAgnosticConfigBackend*) self, group, key, _tmp1_, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - if (type == G_TYPE_FLOAT) { - double _tmp2_; - _tmp2_ = g_key_file_get_double (keyfile, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - desktop_agnostic_config_backend_set_float ((DesktopAgnosticConfigBackend*) self, group, key, (float) _tmp2_, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } else { - if (type == G_TYPE_STRING) { - char* _tmp3_; - char* _tmp4_; - _tmp3_ = g_key_file_get_string (keyfile, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - desktop_agnostic_config_backend_set_string ((DesktopAgnosticConfigBackend*) self, group, key, _tmp4_ = _tmp3_, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - _g_free0 (_tmp4_); - } else { - if (type == G_TYPE_VALUE_ARRAY) { - GValueArray* arr; - GValueArray* _tmp5_; - GValueArray* _tmp6_; - arr = NULL; - _tmp5_ = desktop_agnostic_config_gkey_file_generate_valuearray_from_keyfile (self, keyfile, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (arr); - _g_object_unref0 (option); - return; - } - arr = (_tmp6_ = _tmp5_, _g_value_array_free0 (arr), _tmp6_); - desktop_agnostic_config_backend_set_list ((DesktopAgnosticConfigBackend*) self, group, key, arr, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (arr); - _g_object_unref0 (option); - return; - } - _g_value_array_free0 (arr); - } else { - DesktopAgnosticConfigSchemaType* st; - GValue val = {0}; - char* _tmp7_; - GValue _tmp9_ = {0}; - char* _tmp8_; - GValue _tmp10_; - GValue _tmp11_; - GValue _tmp12_; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (type)); - if (st == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "'%s' is an invalid config type.", g_type_name (type)); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (option); - return; - } - } - _tmp7_ = g_key_file_get_string (keyfile, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_object_unref0 (option); - return; - } - _tmp11_ = (_tmp10_ = (desktop_agnostic_config_schema_type_deserialize (st, _tmp8_ = _tmp7_, &_tmp9_, &_inner_error_), _tmp9_), _g_free0 (_tmp8_), _tmp10_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_object_unref0 (option); - return; - } - val = (_tmp12_ = _tmp11_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp12_); - desktop_agnostic_config_backend_set_value ((DesktopAgnosticConfigBackend*) self, group, key, &val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_object_unref0 (option); - return; - } - _g_object_unref0 (st); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - } - } - } - } - _g_object_unref0 (option); -} - - -static GValueArray* desktop_agnostic_config_gkey_file_generate_valuearray_from_keyfile (DesktopAgnosticConfigGKeyFile* self, GKeyFile* keyfile, const char* group, const char* key, GError** error) { - GValueArray* result; - GError * _inner_error_; - DesktopAgnosticConfigSchemaOption* option; - GType list_type = 0UL; - GValueArray* arr; - DesktopAgnosticConfigSchemaOption* _tmp0_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (keyfile != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - option = NULL; - arr = NULL; - option = (_tmp0_ = _g_object_ref0 (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), group, key)), _g_object_unref0 (option), _tmp0_); - if (option == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, "The key %s/%s is invalid.", group, key); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - } else { - gboolean _tmp1_; - _tmp1_ = g_key_file_has_key (keyfile, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - if (!_tmp1_) { - result = g_value_array_new ((guint) 0); - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return result; - } - } - list_type = desktop_agnostic_config_schema_option_get_list_type (option); - if (list_type == G_TYPE_BOOLEAN) { - gint list_data_size; - gint list_data_length1; - gboolean* list_data; - GValue val = {0}; - gboolean* _tmp4_; - gint _tmp3__size; - gint _tmp3__length1; - gsize _tmp2_; - gboolean* _tmp3_; - gboolean* _tmp5_; - GValueArray* _tmp6_; - list_data = (list_data_length1 = 0, NULL); - _tmp3_ = (_tmp4_ = g_key_file_get_boolean_list (keyfile, group, key, &_tmp2_, &_inner_error_), _tmp3__length1 = _tmp2_, _tmp3__size = _tmp3__length1, _tmp4_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - list_data = (g_free (list_data), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - list_data = (_tmp5_ = _tmp3_, list_data = (g_free (list_data), NULL), list_data_length1 = _tmp3__length1, list_data_size = list_data_length1, _tmp5_); - arr = (_tmp6_ = g_value_array_new ((guint) list_data_length1), _g_value_array_free0 (arr), _tmp6_); - { - gboolean* item_collection; - int item_collection_length1; - int item_it; - item_collection = list_data; - item_collection_length1 = list_data_length1; - for (item_it = 0; item_it < list_data_length1; item_it = item_it + 1) { - gboolean item; - item = item_collection[item_it]; - { - GValue _tmp8_; - GValue _tmp7_ = {0}; - val = (_tmp8_ = (g_value_init (&_tmp7_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp7_, item), _tmp7_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp8_); - g_value_array_append (arr, &val); - } - } - } - list_data = (g_free (list_data), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } else { - if (list_type == G_TYPE_INT) { - gint list_data_size; - gint list_data_length1; - gint* list_data; - GValue val = {0}; - gint* _tmp11_; - gint _tmp10__size; - gint _tmp10__length1; - gsize _tmp9_; - gint* _tmp10_; - gint* _tmp12_; - GValueArray* _tmp13_; - list_data = (list_data_length1 = 0, NULL); - _tmp10_ = (_tmp11_ = g_key_file_get_integer_list (keyfile, group, key, &_tmp9_, &_inner_error_), _tmp10__length1 = _tmp9_, _tmp10__size = _tmp10__length1, _tmp11_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - list_data = (g_free (list_data), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - list_data = (_tmp12_ = _tmp10_, list_data = (g_free (list_data), NULL), list_data_length1 = _tmp10__length1, list_data_size = list_data_length1, _tmp12_); - arr = (_tmp13_ = g_value_array_new ((guint) list_data_length1), _g_value_array_free0 (arr), _tmp13_); - { - gint* item_collection; - int item_collection_length1; - int item_it; - item_collection = list_data; - item_collection_length1 = list_data_length1; - for (item_it = 0; item_it < list_data_length1; item_it = item_it + 1) { - gint item; - item = item_collection[item_it]; - { - GValue _tmp15_; - GValue _tmp14_ = {0}; - val = (_tmp15_ = (g_value_init (&_tmp14_, G_TYPE_INT), g_value_set_int (&_tmp14_, item), _tmp14_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp15_); - g_value_array_append (arr, &val); - } - } - } - list_data = (g_free (list_data), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } else { - if (list_type == G_TYPE_FLOAT) { - gint list_data_size; - gint list_data_length1; - double* list_data; - GValue val = {0}; - double* _tmp18_; - gint _tmp17__size; - gint _tmp17__length1; - gsize _tmp16_; - double* _tmp17_; - double* _tmp19_; - GValueArray* _tmp20_; - list_data = (list_data_length1 = 0, NULL); - _tmp17_ = (_tmp18_ = g_key_file_get_double_list (keyfile, group, key, &_tmp16_, &_inner_error_), _tmp17__length1 = _tmp16_, _tmp17__size = _tmp17__length1, _tmp18_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - list_data = (g_free (list_data), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - list_data = (_tmp19_ = (double*) _tmp17_, list_data = (g_free (list_data), NULL), list_data_length1 = _tmp17__length1, list_data_size = list_data_length1, _tmp19_); - arr = (_tmp20_ = g_value_array_new ((guint) list_data_length1), _g_value_array_free0 (arr), _tmp20_); - { - double* item_collection; - int item_collection_length1; - int item_it; - item_collection = list_data; - item_collection_length1 = list_data_length1; - for (item_it = 0; item_it < list_data_length1; item_it = item_it + 1) { - double item; - item = item_collection[item_it]; - { - GValue _tmp22_; - GValue _tmp21_ = {0}; - val = (_tmp22_ = (g_value_init (&_tmp21_, G_TYPE_FLOAT), g_value_set_float (&_tmp21_, (float) item), _tmp21_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp22_); - g_value_array_append (arr, &val); - } - } - } - list_data = (g_free (list_data), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } else { - if (list_type == G_TYPE_STRING) { - gint list_data_size; - gint list_data_length1; - char** list_data; - GValue val = {0}; - char** _tmp25_; - gint _tmp24__size; - gint _tmp24__length1; - gsize _tmp23_; - char** _tmp24_; - char** _tmp26_; - GValueArray* _tmp27_; - list_data = (list_data_length1 = 0, NULL); - _tmp24_ = (_tmp25_ = g_key_file_get_string_list (keyfile, group, key, &_tmp23_, &_inner_error_), _tmp24__length1 = _tmp23_, _tmp24__size = _tmp24__length1, _tmp25_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - list_data = (_tmp26_ = _tmp24_, list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL), list_data_length1 = _tmp24__length1, list_data_size = list_data_length1, _tmp26_); - arr = (_tmp27_ = g_value_array_new ((guint) list_data_length1), _g_value_array_free0 (arr), _tmp27_); - { - char** item_collection; - int item_collection_length1; - int item_it; - item_collection = list_data; - item_collection_length1 = list_data_length1; - for (item_it = 0; item_it < list_data_length1; item_it = item_it + 1) { - char* item; - item = g_strdup (item_collection[item_it]); - { - GValue _tmp29_; - GValue _tmp28_ = {0}; - val = (_tmp29_ = (g_value_init (&_tmp28_, G_TYPE_STRING), g_value_set_string (&_tmp28_, item), _tmp28_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp29_); - g_value_array_append (arr, &val); - _g_free0 (item); - } - } - } - list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } else { - DesktopAgnosticConfigSchemaType* st; - gint list_data_size; - gint list_data_length1; - char** list_data; - char** _tmp32_; - gint _tmp31__size; - gint _tmp31__length1; - gsize _tmp30_; - char** _tmp31_; - char** _tmp33_; - GValueArray* _tmp34_; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (list_type)); - if (st == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "'%s' is an invalid config type.", g_type_name (list_type)); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - } - list_data = (list_data_length1 = 0, NULL); - _tmp31_ = (_tmp32_ = g_key_file_get_string_list (keyfile, group, key, &_tmp30_, &_inner_error_), _tmp31__length1 = _tmp30_, _tmp31__size = _tmp31__length1, _tmp32_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - list_data = (_tmp33_ = _tmp31_, list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL), list_data_length1 = _tmp31__length1, list_data_size = list_data_length1, _tmp33_); - arr = (_tmp34_ = g_value_array_new ((guint) list_data_length1), _g_value_array_free0 (arr), _tmp34_); - { - char** item_collection; - int item_collection_length1; - int item_it; - item_collection = list_data; - item_collection_length1 = list_data_length1; - for (item_it = 0; item_it < list_data_length1; item_it = item_it + 1) { - char* item; - item = g_strdup (item_collection[item_it]); - { - GValue _tmp35_ = {0}; - GValue _tmp36_; - GValue _tmp38_; - GValue _tmp37_; - _tmp36_ = (desktop_agnostic_config_schema_type_deserialize (st, item, &_tmp35_, &_inner_error_), _tmp35_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (item); - _g_object_unref0 (st); - list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); - _g_object_unref0 (option); - _g_value_array_free0 (arr); - return NULL; - } - g_value_array_append (arr, (_tmp38_ = _tmp37_ = _tmp36_, &_tmp38_)); - G_IS_VALUE (&_tmp37_) ? (g_value_unset (&_tmp37_), NULL) : NULL; - _g_free0 (item); - } - } - } - _g_object_unref0 (st); - list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); - } - } - } - } - result = arr; - _g_object_unref0 (option); - return result; -} - - -static void desktop_agnostic_config_gkey_file_on_keyfile_changed (DesktopAgnosticConfigGKeyFile* self, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, DesktopAgnosticVFSFileMonitor* monitor) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (file != NULL); - g_return_if_fail (monitor != NULL); - _inner_error_ = NULL; - switch (event) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED: - { - desktop_agnostic_config_gkey_file_load_data (self, file, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED: - { - char* data; - gsize length = 0UL; - char* checksum; - char* _tmp3_; - char* _tmp2_ = NULL; - char* _tmp1_; - char* _tmp0_ = NULL; - data = NULL; - checksum = NULL; - (desktop_agnostic_config_gkey_file_get_data_from_file (self, file, &_tmp0_, &length, &_tmp2_, &_inner_error_), data = (_tmp1_ = _tmp0_, _g_free0 (data), _tmp1_)); - checksum = (_tmp3_ = _tmp2_, _g_free0 (checksum), _tmp3_); - if (_inner_error_ != NULL) { - _g_free0 (data); - _g_free0 (checksum); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - if (_vala_strcmp0 (self->priv->_checksum, checksum) != 0) { - DesktopAgnosticConfigSchema* schema; - GKeyFile* new_data; - schema = desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self); - new_data = g_key_file_new (); - g_key_file_load_from_data (new_data, data, length, G_KEY_FILE_NONE, &_inner_error_); - if (_inner_error_ != NULL) { - _g_key_file_free0 (new_data); - _g_free0 (data); - _g_free0 (checksum); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_autosave = FALSE; - { - GList* group_collection; - GList* group_it; - group_collection = desktop_agnostic_config_schema_get_groups (schema); - for (group_it = group_collection; group_it != NULL; group_it = group_it->next) { - const char* group; - group = (const char*) group_it->data; - { - { - GList* key_collection; - GList* key_it; - key_collection = desktop_agnostic_config_schema_get_keys (schema, group); - for (key_it = key_collection; key_it != NULL; key_it = key_it->next) { - const char* key; - key = (const char*) key_it->data; - { - if (g_key_file_has_group (self->priv->_data, group)) { - gboolean _tmp4_ = FALSE; - gboolean _tmp5_ = FALSE; - gboolean _tmp6_; - _tmp6_ = g_key_file_has_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - _g_list_free0 (group_collection); - _g_key_file_free0 (new_data); - _g_free0 (data); - _g_free0 (checksum); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - if (_tmp6_) { - char* _tmp7_; - char* _tmp8_; - char* _tmp10_; - char* _tmp9_; - _tmp7_ = g_key_file_get_value (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - _g_list_free0 (group_collection); - _g_key_file_free0 (new_data); - _g_free0 (data); - _g_free0 (checksum); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _tmp8_ = g_key_file_get_value (new_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - _g_list_free0 (group_collection); - _g_key_file_free0 (new_data); - _g_free0 (data); - _g_free0 (checksum); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _tmp5_ = _vala_strcmp0 (_tmp9_ = _tmp7_, _tmp10_ = _tmp8_) != 0; - _g_free0 (_tmp10_); - _g_free0 (_tmp9_); - } else { - _tmp5_ = FALSE; - } - if (_tmp5_) { - _tmp4_ = TRUE; - } else { - _tmp4_ = desktop_agnostic_config_schema_option_get_option_type (desktop_agnostic_config_schema_get_option (schema, group, key)) == G_TYPE_VALUE_ARRAY; - } - if (_tmp4_) { - desktop_agnostic_config_gkey_file_set_value_from_keyfile (self, new_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - _g_list_free0 (group_collection); - _g_key_file_free0 (new_data); - _g_free0 (data); - _g_free0 (checksum); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - } - } - } - } - } - _g_list_free0 (group_collection); - } - self->priv->_autosave = TRUE; - _g_key_file_free0 (new_data); - } - _g_free0 (data); - _g_free0 (checksum); - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED: - { - desktop_agnostic_config_backend_reset ((DesktopAgnosticConfigBackend*) self, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - break; - } - default: - { - break; - } - } -} - - -static void desktop_agnostic_config_gkey_file_ensure_directory (DesktopAgnosticConfigGKeyFile* self, const char* path) { - g_return_if_fail (self != NULL); - g_return_if_fail (path != NULL); - if (!g_file_test (path, G_FILE_TEST_EXISTS)) { - gint d_errno; - d_errno = g_mkdir_with_parents (path, 0755); - if (d_errno != 0) { - g_critical ("config-impl-keyfile.vala:315: Config file error: %s", g_strerror (d_errno)); - } - } -} - - -static gboolean desktop_agnostic_config_gkey_file_create_file_monitor (DesktopAgnosticConfigGKeyFile* self) { - gboolean result; - DesktopAgnosticVFSFileMonitor* _tmp0_; - g_return_val_if_fail (self != NULL, FALSE); - self->priv->_keyfile_monitor = (_tmp0_ = desktop_agnostic_vfs_file_monitor (self->priv->_keyfile), _g_object_unref0 (self->priv->_keyfile_monitor), _tmp0_); - self->priv->_monitor_changed_id = g_signal_connect_swapped (self->priv->_keyfile_monitor, "changed", (GCallback) desktop_agnostic_config_gkey_file_on_keyfile_changed, self); - result = FALSE; - return result; -} - - -static gboolean _desktop_agnostic_config_gkey_file_create_file_monitor_gsource_func (gpointer self) { - return desktop_agnostic_config_gkey_file_create_file_monitor (self); -} - - -static void desktop_agnostic_config_gkey_file_real_constructed (GObject* base) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - char* base_path; - char* path; - DesktopAgnosticConfigSchema* schema; - char* _tmp0_; - DesktopAgnosticVFSFile* _tmp5_; - DesktopAgnosticVFSFile* _tmp6_; - self = (DesktopAgnosticConfigGKeyFile*) base; - _inner_error_ = NULL; - base_path = NULL; - path = NULL; - schema = _g_object_ref0 (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self)); - base_path = (_tmp0_ = g_build_filename (g_get_user_config_dir (), "desktop-agnostic", NULL), _g_free0 (base_path), _tmp0_); - if (desktop_agnostic_config_backend_get_instance_id ((DesktopAgnosticConfigBackend*) self) == NULL) { - char* _tmp2_; - char* _tmp1_; - path = (_tmp2_ = g_build_filename (base_path, _tmp1_ = g_strdup_printf ("%s.ini", desktop_agnostic_config_schema_get_app_name (schema)), NULL), _g_free0 (path), _tmp2_); - _g_free0 (_tmp1_); - } else { - char* _tmp4_; - char* _tmp3_; - path = (_tmp4_ = g_build_filename (base_path, "instances", _tmp3_ = g_strdup_printf ("%s-%s.ini", desktop_agnostic_config_schema_get_app_name (schema), desktop_agnostic_config_backend_get_instance_id ((DesktopAgnosticConfigBackend*) self)), NULL), _g_free0 (path), _tmp4_); - _g_free0 (_tmp3_); - } - _tmp5_ = desktop_agnostic_vfs_file_new_for_path (path, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (base_path); - _g_free0 (path); - _g_object_unref0 (schema); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_keyfile = (_tmp6_ = _tmp5_, _g_object_unref0 (self->priv->_keyfile), _tmp6_); - { - if (desktop_agnostic_vfs_file_exists (self->priv->_keyfile)) { - desktop_agnostic_config_gkey_file_load_data (self, self->priv->_keyfile, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - } else { - char* _tmp7_; - desktop_agnostic_config_gkey_file_ensure_directory (self, _tmp7_ = g_path_get_dirname (path)); - _g_free0 (_tmp7_); - desktop_agnostic_config_backend_reset ((DesktopAgnosticConfigBackend*) self, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("config-impl-keyfile.vala:369: Config error: %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_free0 (base_path); - _g_free0 (path); - _g_object_unref0 (schema); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _desktop_agnostic_config_gkey_file_create_file_monitor_gsource_func, g_object_ref (self), g_object_unref); - _g_free0 (base_path); - _g_free0 (path); - _g_object_unref0 (schema); -} - - -static void desktop_agnostic_config_gkey_file_real_reset (DesktopAgnosticConfigBackend* base, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - DesktopAgnosticConfigSchema* schema; - self = (DesktopAgnosticConfigGKeyFile*) base; - _inner_error_ = NULL; - schema = desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self); - if (schema == NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_NO_SCHEMA, "The schema was not loaded."); - { - g_propagate_error (error, _inner_error_); - return; - } - } - self->priv->_autosave = FALSE; - { - GList* group_collection; - GList* group_it; - group_collection = desktop_agnostic_config_schema_get_groups (schema); - for (group_it = group_collection; group_it != NULL; group_it = group_it->next) { - const char* group; - group = (const char*) group_it->data; - { - { - GList* key_collection; - GList* key_it; - key_collection = desktop_agnostic_config_schema_get_keys (schema, group); - for (key_it = key_collection; key_it != NULL; key_it = key_it->next) { - const char* key; - key = (const char*) key_it->data; - { - DesktopAgnosticConfigSchemaOption* option; - gboolean _tmp0_ = FALSE; - option = _g_object_ref0 (desktop_agnostic_config_schema_get_option (schema, group, key)); - if (desktop_agnostic_config_backend_get_instance_id ((DesktopAgnosticConfigBackend*) self) == NULL) { - _tmp0_ = TRUE; - } else { - _tmp0_ = desktop_agnostic_config_schema_option_get_per_instance (option); - } - if (_tmp0_) { - GValue _tmp2_; - GValue _tmp1_ = {0}; - desktop_agnostic_config_backend_set_value ((DesktopAgnosticConfigBackend*) self, group, key, (_tmp2_ = (desktop_agnostic_config_schema_option_get_default_value (option, &_tmp1_), _tmp1_), &_tmp2_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - _g_list_free0 (group_collection); - return; - } - } - _g_object_unref0 (option); - } - } - } - } - } - _g_list_free0 (group_collection); - } - self->priv->_autosave = TRUE; - desktop_agnostic_config_gkey_file_save_config (self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -static void desktop_agnostic_config_gkey_file_real_notify_add (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - char* full_key; - GSList* funcs; - DesktopAgnosticConfigNotifyDelegate* data; - DesktopAgnosticConfigNotifyDelegate* _tmp0_; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - full_key = g_strdup_printf ("%s/%s", group, key); - funcs = (GSList*) g_datalist_get_data (&self->priv->_notifiers, full_key); - data = desktop_agnostic_config_notify_delegate_new (callback, callback_target); - funcs = g_slist_append (funcs, (_tmp0_ = data, data = NULL, _tmp0_)); - g_datalist_set_data (&self->priv->_notifiers, full_key, funcs); - _g_free0 (full_key); - _desktop_agnostic_config_notify_delegate_free0 (data); -} - - -static void desktop_agnostic_config_gkey_file_real_notify (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - char* full_key; - GValue _tmp0_ = {0}; - GValue value; - GSList* funcs; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - full_key = g_strdup_printf ("%s/%s", group, key); - value = (desktop_agnostic_config_backend_get_value ((DesktopAgnosticConfigBackend*) self, group, key, &_tmp0_, &_inner_error_), _tmp0_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - return; - } - funcs = (GSList*) g_datalist_get_data (&self->priv->_notifiers, full_key); - { - GSList* data_collection; - GSList* data_it; - data_collection = funcs; - for (data_it = data_collection; data_it != NULL; data_it = data_it->next) { - DesktopAgnosticConfigNotifyDelegate* data; - data = (DesktopAgnosticConfigNotifyDelegate*) data_it->data; - { - gboolean _tmp1_ = FALSE; - if (data != NULL) { - _tmp1_ = data->callback != NULL; - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - desktop_agnostic_config_notify_delegate_execute (data, group, key, &value); - } - } - } - } - _g_free0 (full_key); - G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; -} - - -static void desktop_agnostic_config_gkey_file_real_notify_remove (DesktopAgnosticConfigBackend* base, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - char* full_key; - GSList* funcs; - DesktopAgnosticConfigNotifyDelegate* ndata; - GSList* node; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - full_key = g_strdup_printf ("%s/%s", group, key); - funcs = (GSList*) g_datalist_get_data (&self->priv->_notifiers, full_key); - ndata = desktop_agnostic_config_notify_delegate_new (callback, callback_target); - node = NULL; - node = g_slist_find_custom (funcs, ndata, (GCompareFunc) desktop_agnostic_config_notify_delegate_compare); - if (node != NULL) { - DesktopAgnosticConfigNotifyDelegate* _tmp0_; - node->data = (_tmp0_ = NULL, _desktop_agnostic_config_notify_delegate_free0 (node->data), _tmp0_); - funcs = g_slist_delete_link (funcs, node); - g_datalist_set_data (&self->priv->_notifiers, full_key, funcs); - } - _g_free0 (full_key); - _desktop_agnostic_config_notify_delegate_free0 (ndata); -} - - -static void desktop_agnostic_config_gkey_file_real_remove (DesktopAgnosticConfigBackend* base, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - self = (DesktopAgnosticConfigGKeyFile*) base; - _inner_error_ = NULL; - desktop_agnostic_vfs_file_remove (self->priv->_keyfile, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - desktop_agnostic_config_backend_reset ((DesktopAgnosticConfigBackend*) self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -static void desktop_agnostic_config_gkey_file_real_get_value (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValue* result, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - DesktopAgnosticConfigSchema* schema; - DesktopAgnosticConfigSchemaOption* option; - GType option_type = 0UL; - GValue _result_ = {0}; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - schema = _g_object_ref0 (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self)); - option = _g_object_ref0 (desktop_agnostic_config_schema_get_option (schema, group, key)); - if (option == NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, "Could not find group and/or key in schema."); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - } - option_type = desktop_agnostic_config_schema_option_get_option_type (option); - if (option_type == G_TYPE_BOOLEAN) { - gboolean _tmp0_; - GValue _tmp2_; - GValue _tmp1_ = {0}; - _tmp0_ = desktop_agnostic_config_backend_get_bool ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - _result_ = (_tmp2_ = (g_value_init (&_tmp1_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp1_, _tmp0_), _tmp1_), G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp2_); - } else { - if (option_type == G_TYPE_FLOAT) { - float _tmp3_; - GValue _tmp5_; - GValue _tmp4_ = {0}; - _tmp3_ = desktop_agnostic_config_backend_get_float ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - _result_ = (_tmp5_ = (g_value_init (&_tmp4_, G_TYPE_FLOAT), g_value_set_float (&_tmp4_, _tmp3_), _tmp4_), G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp5_); - } else { - if (option_type == G_TYPE_INT) { - gint _tmp6_; - GValue _tmp8_; - GValue _tmp7_ = {0}; - _tmp6_ = desktop_agnostic_config_backend_get_int ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - _result_ = (_tmp8_ = (g_value_init (&_tmp7_, G_TYPE_INT), g_value_set_int (&_tmp7_, _tmp6_), _tmp7_), G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp8_); - } else { - if (option_type == G_TYPE_STRING) { - char* _tmp9_; - GValue _tmp12_; - GValue _tmp11_ = {0}; - char* _tmp10_; - _tmp9_ = desktop_agnostic_config_backend_get_string ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - _result_ = (_tmp12_ = (g_value_init (&_tmp11_, G_TYPE_STRING), g_value_set_string (&_tmp11_, _tmp10_ = _tmp9_), _tmp11_), G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp12_); - _g_free0 (_tmp10_); - } else { - if (option_type == G_TYPE_VALUE_ARRAY) { - GValueArray* _tmp13_; - GValue _tmp16_; - GValue _tmp15_ = {0}; - GValueArray* _tmp14_; - _tmp13_ = desktop_agnostic_config_backend_get_list ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - _result_ = (_tmp16_ = (g_value_init (&_tmp15_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp15_, _tmp14_ = _tmp13_), _tmp15_), G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp16_); - _g_value_array_free0 (_tmp14_); - } else { - DesktopAgnosticConfigSchemaType* st; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (option_type)); - if (st == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "'%s' is an invalid config type.", g_type_name (option_type)); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - } else { - char* _tmp17_; - GValue _tmp19_ = {0}; - char* _tmp18_; - GValue _tmp20_; - GValue _tmp21_; - GValue _tmp22_; - _tmp17_ = desktop_agnostic_config_backend_get_string ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - _tmp21_ = (_tmp20_ = (desktop_agnostic_config_schema_type_deserialize (st, _tmp18_ = _tmp17_, &_tmp19_, &_inner_error_), _tmp19_), _g_free0 (_tmp18_), _tmp20_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (schema); - _g_object_unref0 (option); - G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; - return; - } - _result_ = (_tmp22_ = _tmp21_, G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp22_); - } - _g_object_unref0 (st); - } - } - } - } - } - *result = _result_; - _g_object_unref0 (schema); - _g_object_unref0 (option); - return; -} - - -static gpointer _g_error_copy0 (gpointer self) { - return self ? g_error_copy (self) : NULL; -} - - -static gboolean desktop_agnostic_config_gkey_file_real_get_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - gboolean result; - GError * _inner_error_; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_val_if_fail (group != NULL, FALSE); - g_return_val_if_fail (key != NULL, FALSE); - _inner_error_ = NULL; - { - gboolean _tmp0_; - _tmp0_ = g_key_file_get_boolean (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch1_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - result = _tmp0_; - return result; - } - goto __finally1; - __catch1_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - gboolean _tmp1_ = FALSE; - if (g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) { - _tmp1_ = TRUE; - } else { - _tmp1_ = g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); - } - if (_tmp1_) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, err->message); - { - _g_error_free0 (err); - goto __finally1; - } - } else { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - goto __finally1; - } - } - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } -} - - -static void desktop_agnostic_config_gkey_file_real_set_bool (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gboolean value, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - if (!g_key_file_has_group (self->priv->_data, group)) { - _tmp1_ = TRUE; - } else { - gboolean _tmp2_; - _tmp2_ = g_key_file_has_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp1_ = !_tmp2_; - } - if (_tmp1_) { - _tmp0_ = TRUE; - } else { - gboolean _tmp3_; - _tmp3_ = desktop_agnostic_config_backend_get_bool ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp0_ = _tmp3_ != value; - } - if (_tmp0_) { - g_key_file_set_boolean (self->priv->_data, group, key, value); - desktop_agnostic_config_gkey_file_update_config (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } -} - - -static float desktop_agnostic_config_gkey_file_real_get_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - float result; - GError * _inner_error_; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_val_if_fail (group != NULL, 0.0F); - g_return_val_if_fail (key != NULL, 0.0F); - _inner_error_ = NULL; - { - double _tmp0_; - _tmp0_ = g_key_file_get_double (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch2_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0.0F; - } - result = (float) _tmp0_; - return result; - } - goto __finally2; - __catch2_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - gboolean _tmp1_ = FALSE; - if (g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) { - _tmp1_ = TRUE; - } else { - _tmp1_ = g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); - } - if (_tmp1_) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, err->message); - { - _g_error_free0 (err); - goto __finally2; - } - } else { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - goto __finally2; - } - } - _g_error_free0 (err); - } - } - __finally2: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_ERROR) { - g_propagate_error (error, _inner_error_); - return 0.0F; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0.0F; - } - } -} - - -static void desktop_agnostic_config_gkey_file_real_set_float (DesktopAgnosticConfigBackend* base, const char* group, const char* key, float value, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - if (!g_key_file_has_group (self->priv->_data, group)) { - _tmp1_ = TRUE; - } else { - gboolean _tmp2_; - _tmp2_ = g_key_file_has_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp1_ = !_tmp2_; - } - if (_tmp1_) { - _tmp0_ = TRUE; - } else { - float _tmp3_; - _tmp3_ = desktop_agnostic_config_backend_get_float ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp0_ = _tmp3_ != value; - } - if (_tmp0_) { - g_key_file_set_double (self->priv->_data, group, key, (double) value); - desktop_agnostic_config_gkey_file_update_config (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } -} - - -static gint desktop_agnostic_config_gkey_file_real_get_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - gint result; - GError * _inner_error_; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_val_if_fail (group != NULL, 0); - g_return_val_if_fail (key != NULL, 0); - _inner_error_ = NULL; - { - gint _tmp0_; - _tmp0_ = g_key_file_get_integer (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch3_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = _tmp0_; - return result; - } - goto __finally3; - __catch3_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - gboolean _tmp1_ = FALSE; - if (g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) { - _tmp1_ = TRUE; - } else { - _tmp1_ = g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); - } - if (_tmp1_) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, err->message); - { - _g_error_free0 (err); - goto __finally3; - } - } else { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - goto __finally3; - } - } - _g_error_free0 (err); - } - } - __finally3: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return 0; - } -} - - -static void desktop_agnostic_config_gkey_file_real_set_int (DesktopAgnosticConfigBackend* base, const char* group, const char* key, gint value, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - if (!g_key_file_has_group (self->priv->_data, group)) { - _tmp1_ = TRUE; - } else { - gboolean _tmp2_; - _tmp2_ = g_key_file_has_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp1_ = !_tmp2_; - } - if (_tmp1_) { - _tmp0_ = TRUE; - } else { - gint _tmp3_; - _tmp3_ = desktop_agnostic_config_backend_get_int ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp0_ = _tmp3_ != value; - } - if (_tmp0_) { - g_key_file_set_integer (self->priv->_data, group, key, value); - desktop_agnostic_config_gkey_file_update_config (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } -} - - -static char* desktop_agnostic_config_gkey_file_real_get_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - char* result; - GError * _inner_error_; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - { - char* _tmp0_; - _tmp0_ = g_key_file_get_string (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch4_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - result = _tmp0_; - return result; - } - goto __finally4; - __catch4_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - gboolean _tmp1_ = FALSE; - if (g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) { - _tmp1_ = TRUE; - } else { - _tmp1_ = g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); - } - if (_tmp1_) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, err->message); - { - _g_error_free0 (err); - goto __finally4; - } - } else { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - goto __finally4; - } - } - _g_error_free0 (err); - } - } - __finally4: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } -} - - -static void desktop_agnostic_config_gkey_file_real_set_string (DesktopAgnosticConfigBackend* base, const char* group, const char* key, const char* value, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - _inner_error_ = NULL; - if (!g_key_file_has_group (self->priv->_data, group)) { - _tmp1_ = TRUE; - } else { - gboolean _tmp2_; - _tmp2_ = g_key_file_has_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp1_ = !_tmp2_; - } - if (_tmp1_) { - _tmp0_ = TRUE; - } else { - char* _tmp3_; - char* _tmp4_; - _tmp3_ = desktop_agnostic_config_backend_get_string ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp0_ = _vala_strcmp0 (_tmp4_ = _tmp3_, value) != 0; - _g_free0 (_tmp4_); - } - if (_tmp0_) { - g_key_file_set_string (self->priv->_data, group, key, value); - desktop_agnostic_config_gkey_file_update_config (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } -} - - -static GValueArray* desktop_agnostic_config_gkey_file_real_get_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GValueArray* result; - GError * _inner_error_; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - { - GValueArray* _tmp0_; - _tmp0_ = desktop_agnostic_config_gkey_file_generate_valuearray_from_keyfile (self, self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch5_g_key_file_error; - } - goto __finally5; - } - result = _tmp0_; - return result; - } - goto __finally5; - __catch5_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - gboolean _tmp1_ = FALSE; - if (g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) { - _tmp1_ = TRUE; - } else { - _tmp1_ = g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); - } - if (_tmp1_) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, err->message); - { - _g_error_free0 (err); - goto __finally5; - } - } else { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - goto __finally5; - } - } - _g_error_free0 (err); - } - } - __finally5: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } -} - - -static void _vala_array_add1 (gboolean** array, int* length, int* size, gboolean value) { - if ((*length) == (*size)) { - *size = (*size) ? (2 * (*size)) : 4; - *array = g_renew (gboolean, *array, *size); - } - (*array)[(*length)++] = value; -} - - -static void _vala_array_add2 (gint** array, int* length, int* size, gint value) { - if ((*length) == (*size)) { - *size = (*size) ? (2 * (*size)) : 4; - *array = g_renew (gint, *array, *size); - } - (*array)[(*length)++] = value; -} - - -static void _vala_array_add3 (double** array, int* length, int* size, double value) { - if ((*length) == (*size)) { - *size = (*size) ? (2 * (*size)) : 4; - *array = g_renew (double, *array, *size); - } - (*array)[(*length)++] = value; -} - - -static void _vala_array_add4 (char*** array, int* length, int* size, char* value) { - if ((*length) == (*size)) { - *size = (*size) ? (2 * (*size)) : 4; - *array = g_renew (char*, *array, (*size) + 1); - } - (*array)[(*length)++] = value; - (*array)[*length] = NULL; -} - - -static void _vala_array_add5 (char*** array, int* length, int* size, char* value) { - if ((*length) == (*size)) { - *size = (*size) ? (2 * (*size)) : 4; - *array = g_renew (char*, *array, (*size) + 1); - } - (*array)[(*length)++] = value; - (*array)[*length] = NULL; -} - - -static void desktop_agnostic_config_gkey_file_real_set_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValueArray* value, GError** error) { - DesktopAgnosticConfigGKeyFile * self; - GError * _inner_error_; - DesktopAgnosticConfigSchemaOption* option; - GType list_type; - gboolean _tmp0_ = FALSE; - self = (DesktopAgnosticConfigGKeyFile*) base; - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - _inner_error_ = NULL; - option = _g_object_ref0 (desktop_agnostic_config_schema_get_option (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self), group, key)); - list_type = desktop_agnostic_config_schema_option_get_list_type (option); - if (g_key_file_has_group (self->priv->_data, group)) { - gboolean _tmp1_; - _tmp1_ = g_key_file_has_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - _tmp0_ = _tmp1_; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - GValueArray* old_value; - GValueArray* _tmp2_; - GValueArray* _tmp3_; - old_value = NULL; - _tmp2_ = desktop_agnostic_config_backend_get_list ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_object_unref0 (option); - return; - } - old_value = (_tmp3_ = _tmp2_, _g_value_array_free0 (old_value), _tmp3_); - if (old_value->n_values == value->n_values) { - gboolean is_equal; - is_equal = TRUE; - { - guint i; - i = (guint) 0; - { - gboolean _tmp4_; - _tmp4_ = TRUE; - while (TRUE) { - GValue old_val = {0}; - GValue new_val = {0}; - gboolean _tmp5_ = FALSE; - if (!_tmp4_) { - i++; - } - _tmp4_ = FALSE; - if (!(i < value->n_values)) { - break; - } - old_val = *g_value_array_get_nth (old_value, i); - new_val = *g_value_array_get_nth (value, i); - if (G_VALUE_TYPE (&old_val) != G_VALUE_TYPE (&new_val)) { - _tmp5_ = TRUE; - } else { - char* _tmp7_; - char* _tmp6_; - _tmp5_ = _vala_strcmp0 (_tmp6_ = g_strdup_value_contents (&old_val), _tmp7_ = g_strdup_value_contents (&new_val)) != 0; - _g_free0 (_tmp7_); - _g_free0 (_tmp6_); - } - if (_tmp5_) { - is_equal = FALSE; - break; - } - } - } - } - if (is_equal) { - _g_value_array_free0 (old_value); - _g_object_unref0 (option); - return; - } - } - _g_value_array_free0 (old_value); - } - if (value->n_values == 0) { - gboolean _tmp8_; - _tmp8_ = g_key_file_has_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - if (_tmp8_) { - g_key_file_remove_key (self->priv->_data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - } - } else { - if (list_type == G_TYPE_BOOLEAN) { - gboolean* _tmp10_; - gint list_size; - gint list_length1; - gboolean* _tmp9_ = NULL; - gboolean* list; - list = (_tmp10_ = (_tmp9_ = g_new0 (gboolean, 0), _tmp9_), list_length1 = 0, list_size = list_length1, _tmp10_); - { - GValueArray* val_collection; - guint val_index; - val_collection = value; - for (val_index = 0; val_index < val_collection->n_values; val_index = val_index + 1) { - GValue val; - val = *g_value_array_get_nth (val_collection, val_index); - { - _vala_array_add1 (&list, &list_length1, &list_size, g_value_get_boolean (&val)); - } - } - } - g_key_file_set_boolean_list (self->priv->_data, group, key, list, list_length1); - list = (g_free (list), NULL); - } else { - if (list_type == G_TYPE_INT) { - gint* _tmp12_; - gint list_size; - gint list_length1; - gint* _tmp11_ = NULL; - gint* list; - list = (_tmp12_ = (_tmp11_ = g_new0 (gint, 0), _tmp11_), list_length1 = 0, list_size = list_length1, _tmp12_); - { - GValueArray* val_collection; - guint val_index; - val_collection = value; - for (val_index = 0; val_index < val_collection->n_values; val_index = val_index + 1) { - GValue val; - val = *g_value_array_get_nth (val_collection, val_index); - { - gint _tmp13_; - _tmp13_ = desktop_agnostic_config_backend_get_int_from_value (&val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - list = (g_free (list), NULL); - _g_object_unref0 (option); - return; - } - _vala_array_add2 (&list, &list_length1, &list_size, _tmp13_); - } - } - } - g_key_file_set_integer_list (self->priv->_data, group, key, list, list_length1); - list = (g_free (list), NULL); - } else { - if (list_type == G_TYPE_FLOAT) { - double* _tmp15_; - gint list_size; - gint list_length1; - double* _tmp14_ = NULL; - double* list; - list = (_tmp15_ = (_tmp14_ = g_new0 (double, 0), _tmp14_), list_length1 = 0, list_size = list_length1, _tmp15_); - { - GValueArray* val_collection; - guint val_index; - val_collection = value; - for (val_index = 0; val_index < val_collection->n_values; val_index = val_index + 1) { - GValue val; - val = *g_value_array_get_nth (val_collection, val_index); - { - float _tmp16_; - _tmp16_ = desktop_agnostic_config_backend_get_float_from_value (&val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - list = (g_free (list), NULL); - _g_object_unref0 (option); - return; - } - _vala_array_add3 (&list, &list_length1, &list_size, (double) _tmp16_); - } - } - } - g_key_file_set_double_list (self->priv->_data, group, key, list, list_length1); - list = (g_free (list), NULL); - } else { - if (list_type == G_TYPE_STRING) { - char** _tmp18_; - gint list_size; - gint list_length1; - char** _tmp17_ = NULL; - char** list; - list = (_tmp18_ = (_tmp17_ = g_new0 (char*, 0 + 1), _tmp17_), list_length1 = 0, list_size = list_length1, _tmp18_); - { - GValueArray* val_collection; - guint val_index; - val_collection = value; - for (val_index = 0; val_index < val_collection->n_values; val_index = val_index + 1) { - GValue val; - val = *g_value_array_get_nth (val_collection, val_index); - { - _vala_array_add4 (&list, &list_length1, &list_size, g_strdup (g_value_get_string (&val))); - } - } - } - g_key_file_set_string_list (self->priv->_data, group, key, list, list_length1); - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - } else { - DesktopAgnosticConfigSchemaType* st; - char** _tmp20_; - gint list_size; - gint list_length1; - char** _tmp19_ = NULL; - char** list; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (list_type)); - if (st == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, "'%s' is an invalid config type.", g_type_name (list_type)); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - _g_object_unref0 (option); - return; - } - } - list = (_tmp20_ = (_tmp19_ = g_new0 (char*, 0 + 1), _tmp19_), list_length1 = 0, list_size = list_length1, _tmp20_); - { - GValueArray* val_collection; - guint val_index; - val_collection = value; - for (val_index = 0; val_index < val_collection->n_values; val_index = val_index + 1) { - GValue val; - val = *g_value_array_get_nth (val_collection, val_index); - { - char* _tmp21_; - _tmp21_ = desktop_agnostic_config_schema_type_serialize (st, &val, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (st); - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - _g_object_unref0 (option); - return; - } - _vala_array_add5 (&list, &list_length1, &list_size, _tmp21_); - } - } - } - g_key_file_set_string_list (self->priv->_data, group, key, list, list_length1); - _g_object_unref0 (st); - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - } - } - } - } - } - desktop_agnostic_config_gkey_file_update_config (self, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (option); - return; - } - _g_object_unref0 (option); -} - - -DesktopAgnosticConfigGKeyFile* desktop_agnostic_config_gkey_file_construct (GType object_type) { - DesktopAgnosticConfigGKeyFile * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticConfigGKeyFile* desktop_agnostic_config_gkey_file_new (void) { - return desktop_agnostic_config_gkey_file_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE); -} - - -static char* desktop_agnostic_config_gkey_file_real_get_name (DesktopAgnosticConfigBackend* base) { - char* result; - DesktopAgnosticConfigGKeyFile* self; - self = (DesktopAgnosticConfigGKeyFile*) base; - result = g_strdup ("GKeyFile"); - return result; -} - - -static GObject * desktop_agnostic_config_gkey_file_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticConfigGKeyFile * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_config_gkey_file_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE (obj); - { - self->priv->_autosave = TRUE; - self->priv->_monitor_changed_id = (gulong) 0; - if (desktop_agnostic_config_backend_get_schema ((DesktopAgnosticConfigBackend*) self) != NULL) { - GKeyFile* _tmp0_; - GData* _tmp1_ = {0}; - self->priv->_data = (_tmp0_ = g_key_file_new (), _g_key_file_free0 (self->priv->_data), _tmp0_); - self->priv->_notifiers = (g_datalist_init (&_tmp1_), _tmp1_); - } - } - return obj; -} - - -static void desktop_agnostic_config_gkey_file_class_init (DesktopAgnosticConfigGKeyFileClass * klass) { - desktop_agnostic_config_gkey_file_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticConfigGKeyFilePrivate)); - G_OBJECT_CLASS (klass)->constructed = desktop_agnostic_config_gkey_file_real_constructed; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->reset = desktop_agnostic_config_gkey_file_real_reset; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify_add = desktop_agnostic_config_gkey_file_real_notify_add; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify = desktop_agnostic_config_gkey_file_real_notify; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->notify_remove = desktop_agnostic_config_gkey_file_real_notify_remove; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->remove = desktop_agnostic_config_gkey_file_real_remove; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_value = desktop_agnostic_config_gkey_file_real_get_value; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_bool = desktop_agnostic_config_gkey_file_real_get_bool; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_bool = desktop_agnostic_config_gkey_file_real_set_bool; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_float = desktop_agnostic_config_gkey_file_real_get_float; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_float = desktop_agnostic_config_gkey_file_real_set_float; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_int = desktop_agnostic_config_gkey_file_real_get_int; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_int = desktop_agnostic_config_gkey_file_real_set_int; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_string = desktop_agnostic_config_gkey_file_real_get_string; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_string = desktop_agnostic_config_gkey_file_real_set_string; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_list = desktop_agnostic_config_gkey_file_real_get_list; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->set_list = desktop_agnostic_config_gkey_file_real_set_list; - DESKTOP_AGNOSTIC_CONFIG_BACKEND_CLASS (klass)->get_name = desktop_agnostic_config_gkey_file_real_get_name; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_gkey_file_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_config_gkey_file_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_gkey_file_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_NAME, "name"); -} - - -static void desktop_agnostic_config_gkey_file_instance_init (DesktopAgnosticConfigGKeyFile * self) { - self->priv = DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_GET_PRIVATE (self); -} - - -static void desktop_agnostic_config_gkey_file_finalize (GObject* obj) { - DesktopAgnosticConfigGKeyFile * self; - self = DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE (obj); - { - desktop_agnostic_vfs_file_monitor_cancel (self->priv->_keyfile_monitor); - g_signal_handler_disconnect (self->priv->_keyfile_monitor, self->priv->_monitor_changed_id); - } - _g_key_file_free0 (self->priv->_data); - _g_object_unref0 (self->priv->_keyfile); - _g_object_unref0 (self->priv->_keyfile_monitor); - _g_free0 (self->priv->_checksum); - G_OBJECT_CLASS (desktop_agnostic_config_gkey_file_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_gkey_file_get_type (void) { - static GType desktop_agnostic_config_gkey_file_type_id = 0; - if (desktop_agnostic_config_gkey_file_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigGKeyFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_gkey_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigGKeyFile), 0, (GInstanceInitFunc) desktop_agnostic_config_gkey_file_instance_init, NULL }; - desktop_agnostic_config_gkey_file_type_id = g_type_register_static (DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, "DesktopAgnosticConfigGKeyFile", &g_define_type_info, 0); - } - return desktop_agnostic_config_gkey_file_type_id; -} - - -static void desktop_agnostic_config_gkey_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigGKeyFile * self; - self = DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_NAME: - g_value_set_string (value, desktop_agnostic_config_backend_get_name ((DesktopAgnosticConfigBackend*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -GType register_plugin (void) { - GType result; - result = DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE; - return result; -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-schema.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-schema.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-schema.c 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-schema.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1028 +0,0 @@ -/* config-schema.c generated by valac, the Vala compiler - * generated from config-schema.vala, do not modify */ - -/* - * Desktop Agnostic Library: Configuration Schema. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA (desktop_agnostic_config_schema_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchema)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaClass)) - -typedef struct _DesktopAgnosticConfigSchema DesktopAgnosticConfigSchema; -typedef struct _DesktopAgnosticConfigSchemaClass DesktopAgnosticConfigSchemaClass; -typedef struct _DesktopAgnosticConfigSchemaPrivate DesktopAgnosticConfigSchemaPrivate; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION (desktop_agnostic_config_schema_option_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOption)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) - -typedef struct _DesktopAgnosticConfigSchemaOption DesktopAgnosticConfigSchemaOption; -typedef struct _DesktopAgnosticConfigSchemaOptionClass DesktopAgnosticConfigSchemaOptionClass; - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE (desktop_agnostic_config_schema_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaType)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) - -typedef struct _DesktopAgnosticConfigSchemaType DesktopAgnosticConfigSchemaType; -typedef struct _DesktopAgnosticConfigSchemaTypeClass DesktopAgnosticConfigSchemaTypeClass; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) -#define __g_list_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_free (var), NULL))) -#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) -#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define __g_slist_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_free (var), NULL))) - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS -} DesktopAgnosticConfigSchemaError; -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR desktop_agnostic_config_schema_error_quark () -struct _DesktopAgnosticConfigSchema { - GObject parent_instance; - DesktopAgnosticConfigSchemaPrivate * priv; -}; - -struct _DesktopAgnosticConfigSchemaClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigSchemaPrivate { - char* _filename; - char* _app_name; - GData* options; - GHashTable* keys; - GList* valid_metadata_keys; - GData* metadata_options; -}; - - -static GHashTable* desktop_agnostic_config_schema_type_registry; -static GHashTable* desktop_agnostic_config_schema_type_registry = NULL; -static GHashTable* desktop_agnostic_config_schema_name_registry; -static GHashTable* desktop_agnostic_config_schema_name_registry = NULL; -static GHashTable* desktop_agnostic_config_schema_common_metadata_keys; -static GHashTable* desktop_agnostic_config_schema_common_metadata_keys = NULL; -static gpointer desktop_agnostic_config_schema_parent_class = NULL; - -GQuark desktop_agnostic_config_schema_error_quark (void); -GType desktop_agnostic_config_schema_get_type (void); -GType desktop_agnostic_config_schema_option_get_type (void); -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, DesktopAgnosticConfigSchemaPrivate)) -enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_FILENAME, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_APP_NAME -}; -GType desktop_agnostic_config_schema_type_get_type (void); -static void _g_list_free_g_free (GList* self); -static void desktop_agnostic_config_schema_set_filename (DesktopAgnosticConfigSchema* self, const char* value); -static GValue* _g_value_dup (GValue* self); -GHashTable* desktop_agnostic_config_backend_get_backend_metadata_keys (void); -static void desktop_agnostic_config_schema_parse (DesktopAgnosticConfigSchema* self, GError** error); -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_new (const char* filename, GError** error); -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_construct (GType object_type, const char* filename, GError** error); -gboolean desktop_agnostic_config_schema_exists (DesktopAgnosticConfigSchema* self, const char* group, const char* key); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_new (GKeyFile** schema, const char* group, const char* key, GError** error); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_construct (GType object_type, GKeyFile** schema, const char* group, const char* key, GError** error); -#define DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT "DEFAULT" -GList* desktop_agnostic_config_schema_get_groups (DesktopAgnosticConfigSchema* self); -GList* desktop_agnostic_config_schema_get_keys (DesktopAgnosticConfigSchema* self, const char* group); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_get_option (DesktopAgnosticConfigSchema* self, const char* group, const char* key); -GValue* desktop_agnostic_config_schema_get_metadata_option (DesktopAgnosticConfigSchema* self, const char* name, GError** error); -GType desktop_agnostic_config_schema_type_get_schema_type (DesktopAgnosticConfigSchemaType* self); -char* desktop_agnostic_config_schema_type_get_name (DesktopAgnosticConfigSchemaType* self); -void desktop_agnostic_config_schema_register_type (DesktopAgnosticConfigSchemaType* st, GError** error); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type_by_name (const char* name); -static void desktop_agnostic_config_schema_set_app_name (DesktopAgnosticConfigSchema* self, const char* value); -const char* desktop_agnostic_config_schema_get_app_name (DesktopAgnosticConfigSchema* self); -GType desktop_agnostic_config_get_type (GError** error); -static void _g_slist_free_g_free (GSList* self); -static void desktop_agnostic_config_schema_finalize (GObject* obj); -static void desktop_agnostic_config_schema_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_config_schema_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -GQuark desktop_agnostic_config_schema_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_config_schema_error-quark"); -} - - -static void _g_list_free_g_free (GList* self) { - g_list_foreach (self, (GFunc) g_free, NULL); - g_list_free (self); -} - - -static GValue* _g_value_dup (GValue* self) { - return g_boxed_copy (G_TYPE_VALUE, self); -} - - -static gpointer __g_value_dup0 (gpointer self) { - return self ? _g_value_dup (self) : NULL; -} - - -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_construct (GType object_type, const char* filename, GError** error) { - GError * _inner_error_; - GParameter * __params; - GParameter * __params_it; - DesktopAgnosticConfigSchema * self; - GHashTable* backend_metadata_keys; - GData* _tmp0_ = {0}; - GHashTable* _tmp1_; - GList* _tmp2_; - GData* _tmp3_ = {0}; - g_return_val_if_fail (filename != NULL, NULL); - _inner_error_ = NULL; - __params = g_new0 (GParameter, 1); - __params_it = __params; - __params_it->name = "filename"; - g_value_init (&__params_it->value, G_TYPE_STRING); - g_value_set_string (&__params_it->value, filename); - __params_it++; - self = g_object_newv (object_type, __params_it - __params, __params); - backend_metadata_keys = NULL; - self->priv->options = (g_datalist_init (&_tmp0_), _tmp0_); - self->priv->keys = (_tmp1_ = g_hash_table_new (g_str_hash, g_str_equal), _g_hash_table_unref0 (self->priv->keys), _tmp1_); - self->priv->valid_metadata_keys = (_tmp2_ = NULL, __g_list_free_g_free0 (self->priv->valid_metadata_keys), _tmp2_); - self->priv->metadata_options = (g_datalist_init (&_tmp3_), _tmp3_); - { - GList* key_collection; - GList* key_it; - key_collection = g_hash_table_get_keys (desktop_agnostic_config_schema_common_metadata_keys); - for (key_it = key_collection; key_it != NULL; key_it = key_it->next) { - const char* key; - key = (const char*) key_it->data; - { - self->priv->valid_metadata_keys = g_list_append (self->priv->valid_metadata_keys, g_strdup (key)); - g_datalist_set_data (&self->priv->metadata_options, key, __g_value_dup0 ((GValue*) g_hash_table_lookup (desktop_agnostic_config_schema_common_metadata_keys, key))); - } - } - _g_list_free0 (key_collection); - } - backend_metadata_keys = desktop_agnostic_config_backend_get_backend_metadata_keys (); - { - GList* key_collection; - GList* key_it; - key_collection = g_hash_table_get_keys (backend_metadata_keys); - for (key_it = key_collection; key_it != NULL; key_it = key_it->next) { - const char* key; - key = (const char*) key_it->data; - { - self->priv->valid_metadata_keys = g_list_append (self->priv->valid_metadata_keys, g_strdup (key)); - g_datalist_set_data (&self->priv->metadata_options, key, __g_value_dup0 ((GValue*) g_hash_table_lookup (backend_metadata_keys, key))); - } - } - _g_list_free0 (key_collection); - } - desktop_agnostic_config_schema_parse (self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - g_object_unref (self); - return NULL; - } - while (__params_it > __params) { - --__params_it; - g_value_unset (&__params_it->value); - } - g_free (__params); - return self; -} - - -DesktopAgnosticConfigSchema* desktop_agnostic_config_schema_new (const char* filename, GError** error) { - return desktop_agnostic_config_schema_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA, filename, error); -} - - -static gboolean string_contains (const char* self, const char* needle) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (needle != NULL, FALSE); - result = strstr (self, needle) != NULL; - return result; -} - - -static glong string_get_length (const char* self) { - glong result; - g_return_val_if_fail (self != NULL, 0L); - result = g_utf8_strlen (self, -1); - return result; -} - - -static char* string_substring (const char* self, glong offset, glong len) { - char* result; - glong string_length; - const char* start; - g_return_val_if_fail (self != NULL, NULL); - string_length = g_utf8_strlen (self, -1); - if (offset < 0) { - offset = string_length + offset; - g_return_val_if_fail (offset >= 0, NULL); - } else { - g_return_val_if_fail (offset <= string_length, NULL); - } - if (len < 0) { - len = string_length - offset; - } - g_return_val_if_fail ((offset + len) <= string_length, NULL); - start = g_utf8_offset_to_pointer (self, offset); - result = g_strndup (start, ((gchar*) g_utf8_offset_to_pointer (start, len)) - ((gchar*) start)); - return result; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_config_schema_parse (DesktopAgnosticConfigSchema* self, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (self->priv->_filename == NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, "A (valid) schema file was not given."); - { - g_propagate_error (error, _inner_error_); - return; - } - } else { - GKeyFile* data; - data = g_key_file_new (); - g_key_file_load_from_file (data, self->priv->_filename, G_KEY_FILE_KEEP_TRANSLATIONS, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_key_file_free0 (data); - return; - } - { - gsize _tmp0_; - char** group_collection; - int group_collection_length1; - int group_it; - group_collection = g_key_file_get_groups (data, &_tmp0_); - group_collection_length1 = _tmp0_; - for (group_it = 0; group_it < _tmp0_; group_it = group_it + 1) { - const char* group; - group = group_collection[group_it]; - { - if (string_contains (group, "/")) { - const char* last_slash; - glong offset; - char* option_group; - const char* option_key; - GList* list; - DesktopAgnosticConfigSchemaOption* option; - last_slash = g_utf8_strrchr (group, (gssize) string_get_length (group), (gunichar) '/'); - offset = g_utf8_pointer_to_offset (group, last_slash); - option_group = string_substring (group, (glong) 0, offset); - option_key = g_utf8_offset_to_pointer (group, offset + 1); - list = (GList*) g_hash_table_lookup (self->priv->keys, option_group); - if (list == NULL) { - GList* key_list; - GList* _tmp1_; - key_list = NULL; - key_list = g_list_append (key_list, g_strdup (option_key)); - g_hash_table_insert (self->priv->keys, g_strdup (option_group), (_tmp1_ = key_list, key_list = NULL, _tmp1_)); - __g_list_free_g_free0 (key_list); - } else { - if (!desktop_agnostic_config_schema_exists (self, option_group, option_key)) { - list = g_list_append (list, g_strdup (option_key)); - } else { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, "Duplicate key found in '%s': %s", option_group, option_key); - { - g_propagate_error (error, _inner_error_); - _g_free0 (option_group); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - } - } - option = desktop_agnostic_config_schema_option_new (&data, option_group, option_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (option_group); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - g_datalist_set_data (&self->priv->options, group, _g_object_ref0 (option)); - _g_free0 (option_group); - _g_object_unref0 (option); - } else { - if (_vala_strcmp0 (group, DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT) == 0) { - char** _tmp4_; - gint _tmp3__size; - gint _tmp3__length1; - gsize _tmp2_; - char** _tmp3_; - _tmp3_ = (_tmp4_ = g_key_file_get_keys (data, group, &_tmp2_, &_inner_error_), _tmp3__length1 = _tmp2_, _tmp3__size = _tmp3__length1, _tmp4_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - { - char** key_collection; - int key_collection_length1; - int key_it; - key_collection = _tmp3_; - key_collection_length1 = _tmp3__length1; - for (key_it = 0; key_it < _tmp3__length1; key_it = key_it + 1) { - const char* key; - key = key_collection[key_it]; - { - if (g_list_find_custom (self->priv->valid_metadata_keys, key, (GCompareFunc) strcmp) == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, "The option '%s' is not a registered metadata option.", key); - { - g_propagate_error (error, _inner_error_); - key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - } else { - GValue cur_val = {0}; - GValue new_val = {0}; - GType cur_val_type = 0UL; - GValue _tmp6_; - GValue _tmp5_ = {0}; - GValue _tmp8_; - GValue _tmp7_ = {0}; - cur_val = (_tmp6_ = G_IS_VALUE ((GValue*) g_datalist_get_data (&self->priv->metadata_options, key)) ? (g_value_init (&_tmp5_, G_VALUE_TYPE ((GValue*) g_datalist_get_data (&self->priv->metadata_options, key))), g_value_copy ((GValue*) g_datalist_get_data (&self->priv->metadata_options, key), &_tmp5_), _tmp5_) : (*((GValue*) g_datalist_get_data (&self->priv->metadata_options, key))), G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_val), NULL) : NULL, _tmp6_); - cur_val_type = G_VALUE_TYPE (&cur_val); - new_val = (_tmp8_ = (g_value_init (&_tmp7_, cur_val_type), _tmp7_), G_IS_VALUE (&new_val) ? (g_value_unset (&new_val), NULL) : NULL, _tmp8_); - if (cur_val_type == G_TYPE_BOOLEAN) { - gboolean _tmp9_; - _tmp9_ = g_key_file_get_boolean (data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_val), NULL) : NULL; - G_IS_VALUE (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; - key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - g_value_set_boolean (&new_val, _tmp9_); - } else { - if (cur_val_type == G_TYPE_INT) { - gint _tmp10_; - _tmp10_ = g_key_file_get_integer (data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_val), NULL) : NULL; - G_IS_VALUE (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; - key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - g_value_set_int (&new_val, _tmp10_); - } else { - if (cur_val_type == G_TYPE_FLOAT) { - double _tmp11_; - _tmp11_ = g_key_file_get_double (data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_val), NULL) : NULL; - G_IS_VALUE (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; - key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - g_value_set_float (&new_val, (float) _tmp11_); - } else { - if (cur_val_type == G_TYPE_STRING) { - char* _tmp12_; - char* _tmp13_; - _tmp12_ = g_key_file_get_string (data, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_val), NULL) : NULL; - G_IS_VALUE (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; - key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - g_value_set_string (&new_val, _tmp13_ = _tmp12_); - _g_free0 (_tmp13_); - } else { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE, "The metadata option type can only be a simple type."); - { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_val), NULL) : NULL; - G_IS_VALUE (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; - key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - } - } - } - } - g_datalist_set_data (&self->priv->metadata_options, key, __g_value_dup0 (&new_val)); - G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_val), NULL) : NULL; - G_IS_VALUE (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; - } - } - } - key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); - } - } else { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, "Invalid section in schema ('%s'), there is no group name: %s", self->priv->_filename, group); - { - g_propagate_error (error, _inner_error_); - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - _g_key_file_free0 (data); - return; - } - } - } - } - } - group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL); - } - _g_key_file_free0 (data); - } -} - - -GList* desktop_agnostic_config_schema_get_groups (DesktopAgnosticConfigSchema* self) { - GList* result; - g_return_val_if_fail (self != NULL, NULL); - result = g_hash_table_get_keys (self->priv->keys); - return result; -} - - -GList* desktop_agnostic_config_schema_get_keys (DesktopAgnosticConfigSchema* self, const char* group) { - GList* result; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - result = (GList*) g_hash_table_lookup (self->priv->keys, group); - return result; -} - - -gboolean desktop_agnostic_config_schema_exists (DesktopAgnosticConfigSchema* self, const char* group, const char* key) { - gboolean result; - GList* group_keys; - gboolean _tmp0_ = FALSE; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (group != NULL, FALSE); - g_return_val_if_fail (key != NULL, FALSE); - group_keys = (GList*) g_hash_table_lookup (self->priv->keys, group); - if (group_keys != NULL) { - _tmp0_ = g_list_find_custom (group_keys, key, (GCompareFunc) strcmp) != NULL; - } else { - _tmp0_ = FALSE; - } - result = _tmp0_; - return result; -} - - -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_get_option (DesktopAgnosticConfigSchema* self, const char* group, const char* key) { - DesktopAgnosticConfigSchemaOption* result; - char* _tmp0_; - char* _tmp1_; - char* full_key; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - full_key = (_tmp1_ = g_strconcat (_tmp0_ = g_strconcat (group, "/", NULL), key, NULL), _g_free0 (_tmp0_), _tmp1_); - result = (DesktopAgnosticConfigSchemaOption*) g_datalist_get_data (&self->priv->options, full_key); - _g_free0 (full_key); - return result; -} - - -GValue* desktop_agnostic_config_schema_get_metadata_option (DesktopAgnosticConfigSchema* self, const char* name, GError** error) { - GValue* result; - GError * _inner_error_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); - _inner_error_ = NULL; - if (g_list_find_custom (self->priv->valid_metadata_keys, name, (GCompareFunc) strcmp) == NULL) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, "The option '%s' is not a registered metadata option.", name); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - g_propagate_error (error, _inner_error_); - return NULL; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - } else { - result = __g_value_dup0 ((GValue*) g_datalist_get_data (&self->priv->metadata_options, name)); - return result; - } -} - - -void desktop_agnostic_config_schema_register_type (DesktopAgnosticConfigSchemaType* st, GError** error) { - GError * _inner_error_; - g_return_if_fail (st != NULL); - _inner_error_ = NULL; - if (((DesktopAgnosticConfigSchemaType*) g_hash_table_lookup (desktop_agnostic_config_schema_type_registry, GINT_TO_POINTER (desktop_agnostic_config_schema_type_get_schema_type (st)))) != NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS, "The GType associated with the SchemaType is already registered."); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } else { - char* _tmp0_; - gboolean _tmp1_; - if ((_tmp1_ = ((DesktopAgnosticConfigSchemaType*) g_hash_table_lookup (desktop_agnostic_config_schema_name_registry, _tmp0_ = desktop_agnostic_config_schema_type_get_name (st))) != NULL, _g_free0 (_tmp0_), _tmp1_)) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS, "The name associated with the SchemaType is already registered."); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } else { - g_hash_table_insert (desktop_agnostic_config_schema_type_registry, GINT_TO_POINTER (desktop_agnostic_config_schema_type_get_schema_type (st)), _g_object_ref0 (st)); - g_hash_table_insert (desktop_agnostic_config_schema_name_registry, desktop_agnostic_config_schema_type_get_name (st), _g_object_ref0 (st)); - } - } -} - - -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type) { - DesktopAgnosticConfigSchemaType* result; - result = (DesktopAgnosticConfigSchemaType*) g_hash_table_lookup (desktop_agnostic_config_schema_type_registry, GINT_TO_POINTER (type)); - return result; -} - - -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type_by_name (const char* name) { - DesktopAgnosticConfigSchemaType* result; - g_return_val_if_fail (name != NULL, NULL); - result = (DesktopAgnosticConfigSchemaType*) g_hash_table_lookup (desktop_agnostic_config_schema_name_registry, name); - return result; -} - - -static void desktop_agnostic_config_schema_set_filename (DesktopAgnosticConfigSchema* self, const char* value) { - char* basename; - char* _tmp0_; - char* _tmp1_; - char* _tmp2_; - g_return_if_fail (self != NULL); - basename = NULL; - if (!g_str_has_suffix (value, ".schema-ini")) { - g_critical ("config-schema.vala:166: Schema files MUST have the extension '.schema-ini'."); - _g_free0 (basename); - return; - } - if (!g_file_test (value, G_FILE_TEST_EXISTS)) { - g_critical ("config-schema.vala:171: The file '%s' could not be found.", value); - _g_free0 (basename); - return; - } - self->priv->_filename = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_filename), _tmp0_); - basename = (_tmp1_ = g_path_get_basename (value), _g_free0 (basename), _tmp1_); - desktop_agnostic_config_schema_set_app_name (self, _tmp2_ = string_substring (basename, (glong) 0, string_get_length (basename) - 11)); - _g_free0 (_tmp2_); - _g_free0 (basename); - g_object_notify ((GObject *) self, "filename"); -} - - -const char* desktop_agnostic_config_schema_get_app_name (DesktopAgnosticConfigSchema* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_app_name; - return result; -} - - -static void desktop_agnostic_config_schema_set_app_name (DesktopAgnosticConfigSchema* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_app_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_app_name), _tmp0_); - g_object_notify ((GObject *) self, "app-name"); -} - - -static void _g_slist_free_g_free (GSList* self) { - g_slist_foreach (self, (GFunc) g_free, NULL); - g_slist_free (self); -} - - -static void desktop_agnostic_config_schema_class_init (DesktopAgnosticConfigSchemaClass * klass) { - GError * _inner_error_; - desktop_agnostic_config_schema_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticConfigSchemaPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_schema_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_config_schema_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_schema_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_FILENAME, g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_APP_NAME, g_param_spec_string ("app-name", "Application name", "The name of the application associated with the schema", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - desktop_agnostic_config_schema_type_registry = g_hash_table_new ((GHashFunc) desktop_agnostic_config_gtype_hash, (GEqualFunc) desktop_agnostic_config_gtype_equal); - desktop_agnostic_config_schema_name_registry = g_hash_table_new (g_str_hash, g_str_equal); - desktop_agnostic_config_schema_common_metadata_keys = g_hash_table_new (g_str_hash, g_str_equal); - _inner_error_ = NULL; - { - GList* type_modules; - gint paths_size; - gint paths_length1; - char** paths; - GSList* search_paths; - GList* _tmp0_; - char** _tmp2_; - gint _tmp1_; - GSList* _tmp3_; - GValue _tmp11_ = {0}; - GValue val; - type_modules = NULL; - paths = (paths_length1 = 0, NULL); - search_paths = NULL; - type_modules = (_tmp0_ = NULL, __g_list_free_g_free0 (type_modules), _tmp0_); - desktop_agnostic_module_loader_get_default (); - { - desktop_agnostic_config_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch3_g_error; - } - } - goto __finally3; - __catch3_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _g_error_free0 (err); - } - } - __finally3: - if (_inner_error_ != NULL) { - __g_list_free_g_free0 (type_modules); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - __g_slist_free_g_free0 (search_paths); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - paths = (_tmp2_ = desktop_agnostic_module_loader_get_search_paths (&_tmp1_), paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL), paths_length1 = _tmp1_, paths_size = paths_length1, _tmp2_); - search_paths = (_tmp3_ = NULL, __g_slist_free_g_free0 (search_paths), _tmp3_); - { - char** path_collection; - int path_collection_length1; - int path_it; - path_collection = paths; - path_collection_length1 = paths_length1; - for (path_it = 0; path_it < paths_length1; path_it = path_it + 1) { - const char* path; - path = path_collection[path_it]; - { - if (path != NULL) { - search_paths = g_slist_append (search_paths, g_strdup (path)); - } - } - } - } - search_paths = g_slist_append (search_paths, g_get_current_dir ()); - { - GSList* path_collection; - GSList* path_it; - path_collection = search_paths; - for (path_it = path_collection; path_it != NULL; path_it = path_it->next) { - const char* path; - path = (const char*) path_it->data; - { - char* module_glob; - if (!g_file_test (path, G_FILE_TEST_IS_DIR)) { - continue; - } - module_glob = g_build_filename (path, "libda-cfg-type-*", NULL); - { - DesktopAgnosticVFSGlob* found_modules; - gint modules_paths_size; - gint modules_paths_length1; - char** modules_paths; - DesktopAgnosticVFSGlob* _tmp4_; - DesktopAgnosticVFSGlob* _tmp5_; - char** _tmp7_; - gint _tmp6_; - found_modules = NULL; - modules_paths = (modules_paths_length1 = 0, NULL); - _tmp4_ = desktop_agnostic_vfs_glob_execute (module_glob, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (found_modules); - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - goto __catch4_desktop_agnostic_vfs_glob_error; - } - _g_object_unref0 (found_modules); - _g_free0 (module_glob); - __g_list_free_g_free0 (type_modules); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - __g_slist_free_g_free0 (search_paths); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - found_modules = (_tmp5_ = _tmp4_, _g_object_unref0 (found_modules), _tmp5_); - modules_paths = (_tmp7_ = desktop_agnostic_vfs_glob_get_paths (found_modules, &_tmp6_), modules_paths_length1 = _tmp6_, modules_paths_size = modules_paths_length1, _tmp7_); - { - char** module_collection; - int module_collection_length1; - int module_it; - module_collection = modules_paths; - module_collection_length1 = modules_paths_length1; - for (module_it = 0; module_it < modules_paths_length1; module_it = module_it + 1) { - const char* module; - module = module_collection[module_it]; - { - if (g_list_find (type_modules, module) == NULL) { - GType type = 0UL; - DesktopAgnosticModuleLoader* loader; - char* _tmp8_; - loader = desktop_agnostic_module_loader_get_default (); - type = desktop_agnostic_module_loader_load_from_path (loader, _tmp8_ = g_path_get_basename (module), module); - _g_free0 (_tmp8_); - if (type != G_TYPE_INVALID) { - { - GObject* obj; - DesktopAgnosticConfigSchemaType* _tmp10_; - GObject* _tmp9_; - obj = g_object_new (type, NULL); - desktop_agnostic_config_schema_register_type (_tmp10_ = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE ((_tmp9_ = obj, obj = NULL, _tmp9_)), &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (obj); - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - goto __catch5_desktop_agnostic_config_schema_error; - } - _g_object_unref0 (obj); - _g_object_unref0 (found_modules); - _g_free0 (module_glob); - __g_list_free_g_free0 (type_modules); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - __g_slist_free_g_free0 (search_paths); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - _g_object_unref0 (_tmp10_); - type_modules = g_list_append (type_modules, g_strdup (module)); - _g_object_unref0 (obj); - } - goto __finally5; - __catch5_desktop_agnostic_config_schema_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("config-schema.vala:120: Schema error: %s", err->message); - _g_error_free0 (err); - } - } - __finally5: - if (_inner_error_ != NULL) { - _g_object_unref0 (found_modules); - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - goto __catch4_desktop_agnostic_vfs_glob_error; - } - _g_object_unref0 (found_modules); - _g_free0 (module_glob); - __g_list_free_g_free0 (type_modules); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - __g_slist_free_g_free0 (search_paths); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - } else { - g_warning ("config-schema.vala:125: Could not load the config type module: %s", module); - } - } - } - } - } - _g_object_unref0 (found_modules); - } - goto __finally4; - __catch4_desktop_agnostic_vfs_glob_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - if (!g_error_matches (err, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOMATCH)) { - g_warning ("config-schema.vala:134: Glob-related error: %s", err->message); - } - _g_error_free0 (err); - } - } - __finally4: - if (_inner_error_ != NULL) { - _g_free0 (module_glob); - __g_list_free_g_free0 (type_modules); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - __g_slist_free_g_free0 (search_paths); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - _g_free0 (module_glob); - } - } - } - val = (g_value_init (&_tmp11_, G_TYPE_BOOLEAN), _tmp11_); - g_value_set_boolean (&val, TRUE); - g_hash_table_insert (desktop_agnostic_config_schema_common_metadata_keys, g_strdup ("single_instance"), __g_value_dup0 (&val)); - { - desktop_agnostic_config_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch6_g_error; - } - } - goto __finally6; - __catch6_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("config-schema.vala:149: Config error: %s", err->message); - _g_error_free0 (err); - } - } - __finally6: - if (_inner_error_ != NULL) { - __g_list_free_g_free0 (type_modules); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - __g_slist_free_g_free0 (search_paths); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - __g_list_free_g_free0 (type_modules); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - __g_slist_free_g_free0 (search_paths); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } -} - - -static void desktop_agnostic_config_schema_instance_init (DesktopAgnosticConfigSchema * self) { - self->priv = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_GET_PRIVATE (self); -} - - -static void desktop_agnostic_config_schema_finalize (GObject* obj) { - DesktopAgnosticConfigSchema * self; - self = DESKTOP_AGNOSTIC_CONFIG_SCHEMA (obj); - _g_free0 (self->priv->_filename); - _g_free0 (self->priv->_app_name); - _g_hash_table_unref0 (self->priv->keys); - __g_list_free_g_free0 (self->priv->valid_metadata_keys); - G_OBJECT_CLASS (desktop_agnostic_config_schema_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_schema_get_type (void) { - static GType desktop_agnostic_config_schema_type_id = 0; - if (desktop_agnostic_config_schema_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigSchemaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_schema_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigSchema), 0, (GInstanceInitFunc) desktop_agnostic_config_schema_instance_init, NULL }; - desktop_agnostic_config_schema_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigSchema", &g_define_type_info, 0); - } - return desktop_agnostic_config_schema_type_id; -} - - -static void desktop_agnostic_config_schema_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigSchema * self; - self = DESKTOP_AGNOSTIC_CONFIG_SCHEMA (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_APP_NAME: - g_value_set_string (value, desktop_agnostic_config_schema_get_app_name (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_config_schema_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigSchema * self; - self = DESKTOP_AGNOSTIC_CONFIG_SCHEMA (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_FILENAME: - desktop_agnostic_config_schema_set_filename (self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_APP_NAME: - desktop_agnostic_config_schema_set_app_name (self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-schema-option.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-schema-option.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-schema-option.c 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-schema-option.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1161 +0,0 @@ -/* config-schema-option.c generated by valac, the Vala compiler - * generated from config-schema-option.vala, do not modify */ - -/* - * Desktop Agnostic Library: Configuration Schema Abstract Type. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION (desktop_agnostic_config_schema_option_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOption)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionClass)) - -typedef struct _DesktopAgnosticConfigSchemaOption DesktopAgnosticConfigSchemaOption; -typedef struct _DesktopAgnosticConfigSchemaOptionClass DesktopAgnosticConfigSchemaOptionClass; -typedef struct _DesktopAgnosticConfigSchemaOptionPrivate DesktopAgnosticConfigSchemaOptionPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL))) - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE (desktop_agnostic_config_schema_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaType)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) - -typedef struct _DesktopAgnosticConfigSchemaType DesktopAgnosticConfigSchemaType; -typedef struct _DesktopAgnosticConfigSchemaTypeClass DesktopAgnosticConfigSchemaTypeClass; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -struct _DesktopAgnosticConfigSchemaOption { - GObject parent_instance; - DesktopAgnosticConfigSchemaOptionPrivate * priv; -}; - -struct _DesktopAgnosticConfigSchemaOptionClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticConfigSchemaOptionPrivate { - GType _option_type; - GType _list_type; - GValue _default_value; - char* _description; - char* _summary; - GValue* _lower_boundary; - GValue* _upper_boundary; - GValueArray* _whitelist; - GValueArray* _blacklist; - gboolean _per_instance; -}; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS -} DesktopAgnosticConfigSchemaError; -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR desktop_agnostic_config_schema_error_quark () -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_ERROR_NO_SCHEMA, - DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_METADATA_NOT_FOUND, - DESKTOP_AGNOSTIC_CONFIG_ERROR_NOTIFY, - DESKTOP_AGNOSTIC_CONFIG_ERROR_DUPLICATE_BINDING -} DesktopAgnosticConfigError; -#define DESKTOP_AGNOSTIC_CONFIG_ERROR desktop_agnostic_config_error_quark () - -static gpointer desktop_agnostic_config_schema_option_parent_class = NULL; - -GType desktop_agnostic_config_schema_option_get_type (void); -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, DesktopAgnosticConfigSchemaOptionPrivate)) -enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_OPTION_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_LIST_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DEFAULT_VALUE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DESCRIPTION, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_SUMMARY, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_WHITELIST, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_BLACKLIST, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_PER_INSTANCE -}; -static void desktop_agnostic_config_schema_option_parse_type (DesktopAgnosticConfigSchemaOption* self, const char* serialized); -static void desktop_agnostic_config_schema_option_parse_default_value (DesktopAgnosticConfigSchemaOption* self, GKeyFile* schema, const char* group, GError** error); -static char* desktop_agnostic_config_schema_option_parse_localized_value (DesktopAgnosticConfigSchemaOption* self, GKeyFile* schema, const char* group, const char* key, gboolean mandatory, GError** error); -static void desktop_agnostic_config_schema_option_set_per_instance (DesktopAgnosticConfigSchemaOption* self, gboolean value); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_new (GKeyFile** schema, const char* group, const char* key, GError** error); -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_construct (GType object_type, GKeyFile** schema, const char* group, const char* key, GError** error); -static void desktop_agnostic_config_schema_option_set_option_type (DesktopAgnosticConfigSchemaOption* self, GType value); -static GType desktop_agnostic_config_schema_option_parse_simple_type_from_string (DesktopAgnosticConfigSchemaOption* self, const char* serialized); -static void desktop_agnostic_config_schema_option_set_list_type (DesktopAgnosticConfigSchemaOption* self, GType value); -GType desktop_agnostic_config_schema_type_get_type (void); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type_by_name (const char* name); -GType desktop_agnostic_config_schema_type_get_schema_type (DesktopAgnosticConfigSchemaType* self); -GType desktop_agnostic_config_schema_option_get_option_type (DesktopAgnosticConfigSchemaOption* self); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type); -GQuark desktop_agnostic_config_schema_error_quark (void); -void desktop_agnostic_config_schema_type_deserialize (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error); -GType desktop_agnostic_config_schema_option_get_list_type (DesktopAgnosticConfigSchemaOption* self); -GQuark desktop_agnostic_config_error_quark (void); -void desktop_agnostic_config_schema_option_get_default_value (DesktopAgnosticConfigSchemaOption* self, GValue* result); -static void desktop_agnostic_config_schema_option_set_default_value (DesktopAgnosticConfigSchemaOption* self, GValue* value); -const char* desktop_agnostic_config_schema_option_get_description (DesktopAgnosticConfigSchemaOption* self); -static void desktop_agnostic_config_schema_option_set_description (DesktopAgnosticConfigSchemaOption* self, const char* value); -const char* desktop_agnostic_config_schema_option_get_summary (DesktopAgnosticConfigSchemaOption* self); -static void desktop_agnostic_config_schema_option_set_summary (DesktopAgnosticConfigSchemaOption* self, const char* value); -GValue* desktop_agnostic_config_schema_option_get_lower_boundary (DesktopAgnosticConfigSchemaOption* self); -static GValue* _g_value_dup (GValue* self); -static void desktop_agnostic_config_schema_option_set_lower_boundary (DesktopAgnosticConfigSchemaOption* self, GValue* value); -GValue* desktop_agnostic_config_schema_option_get_upper_boundary (DesktopAgnosticConfigSchemaOption* self); -static void desktop_agnostic_config_schema_option_set_upper_boundary (DesktopAgnosticConfigSchemaOption* self, GValue* value); -GValueArray* desktop_agnostic_config_schema_option_get_whitelist (DesktopAgnosticConfigSchemaOption* self); -GValueArray* desktop_agnostic_config_schema_option_get_blacklist (DesktopAgnosticConfigSchemaOption* self); -gboolean desktop_agnostic_config_schema_option_get_per_instance (DesktopAgnosticConfigSchemaOption* self); -static void desktop_agnostic_config_schema_option_finalize (GObject* obj); -static void desktop_agnostic_config_schema_option_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_config_schema_option_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static gint _vala_array_length (gpointer array); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_construct (GType object_type, GKeyFile** schema, const char* group, const char* key, GError** error) { - GError * _inner_error_; - DesktopAgnosticConfigSchemaOption * self; - char* _tmp0_; - char* _tmp1_; - char* full_key; - char* _tmp2_; - char* _tmp3_; - char* _tmp4_; - char* _tmp5_; - char* _tmp6_; - char* _tmp7_; - gboolean _tmp8_; - g_return_val_if_fail (schema != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - self = (DesktopAgnosticConfigSchemaOption*) g_object_new (object_type, NULL); - full_key = (_tmp1_ = g_strconcat (_tmp0_ = g_strconcat (group, "/", NULL), key, NULL), _g_free0 (_tmp0_), _tmp1_); - _tmp2_ = g_key_file_get_value (*schema, full_key, "type", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - g_object_unref (self); - return NULL; - } - desktop_agnostic_config_schema_option_parse_type (self, _tmp3_ = _tmp2_); - _g_free0 (_tmp3_); - desktop_agnostic_config_schema_option_parse_default_value (self, *schema, full_key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - g_object_unref (self); - return NULL; - } - _tmp4_ = desktop_agnostic_config_schema_option_parse_localized_value (self, *schema, full_key, "description", TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - g_object_unref (self); - return NULL; - } - self->priv->_description = (_tmp5_ = _tmp4_, _g_free0 (self->priv->_description), _tmp5_); - _tmp6_ = desktop_agnostic_config_schema_option_parse_localized_value (self, *schema, full_key, "summary", FALSE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - g_object_unref (self); - return NULL; - } - self->priv->_summary = (_tmp7_ = _tmp6_, _g_free0 (self->priv->_summary), _tmp7_); - _tmp8_ = g_key_file_has_key (*schema, full_key, "per_instance", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - g_object_unref (self); - return NULL; - } - if (_tmp8_) { - gboolean _tmp9_; - _tmp9_ = g_key_file_get_boolean (*schema, full_key, "per_instance", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_key); - g_object_unref (self); - return NULL; - } - desktop_agnostic_config_schema_option_set_per_instance (self, _tmp9_); - } - _g_free0 (full_key); - return self; -} - - -DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_new (GKeyFile** schema, const char* group, const char* key, GError** error) { - return desktop_agnostic_config_schema_option_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_OPTION, schema, group, key, error); -} - - -static void desktop_agnostic_config_schema_option_parse_type (DesktopAgnosticConfigSchemaOption* self, const char* serialized) { - g_return_if_fail (self != NULL); - g_return_if_fail (serialized != NULL); - if (g_str_has_prefix (serialized, "list-")) { - const char* subtype; - desktop_agnostic_config_schema_option_set_option_type (self, G_TYPE_VALUE_ARRAY); - subtype = g_utf8_offset_to_pointer (serialized, (glong) 5); - desktop_agnostic_config_schema_option_set_list_type (self, desktop_agnostic_config_schema_option_parse_simple_type_from_string (self, subtype)); - } else { - desktop_agnostic_config_schema_option_set_option_type (self, desktop_agnostic_config_schema_option_parse_simple_type_from_string (self, serialized)); - desktop_agnostic_config_schema_option_set_list_type (self, G_TYPE_INVALID); - } -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static GType desktop_agnostic_config_schema_option_parse_simple_type_from_string (DesktopAgnosticConfigSchemaOption* self, const char* serialized) { - GType result; - GType type = 0UL; - GQuark _tmp1_; - const char* _tmp0_; - static GQuark _tmp1__label0 = 0; - static GQuark _tmp1__label1 = 0; - static GQuark _tmp1__label2 = 0; - static GQuark _tmp1__label3 = 0; - g_return_val_if_fail (self != NULL, 0UL); - g_return_val_if_fail (serialized != NULL, 0UL); - _tmp0_ = serialized; - _tmp1_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_); - if (_tmp1_ == ((0 != _tmp1__label0) ? _tmp1__label0 : (_tmp1__label0 = g_quark_from_static_string ("boolean")))) - do { - type = G_TYPE_BOOLEAN; - break; - } while (0); else if (_tmp1_ == ((0 != _tmp1__label1) ? _tmp1__label1 : (_tmp1__label1 = g_quark_from_static_string ("integer")))) - do { - type = G_TYPE_INT; - break; - } while (0); else if (_tmp1_ == ((0 != _tmp1__label2) ? _tmp1__label2 : (_tmp1__label2 = g_quark_from_static_string ("float")))) - do { - type = G_TYPE_FLOAT; - break; - } while (0); else if (_tmp1_ == ((0 != _tmp1__label3) ? _tmp1__label3 : (_tmp1__label3 = g_quark_from_static_string ("string")))) - do { - type = G_TYPE_STRING; - break; - } while (0); else - do { - DesktopAgnosticConfigSchemaType* st; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type_by_name (serialized)); - if (st == NULL) { - type = G_TYPE_INVALID; - } else { - type = desktop_agnostic_config_schema_type_get_schema_type (st); - } - _g_object_unref0 (st); - break; - } while (0); - result = type; - return result; -} - - -static gpointer _g_error_copy0 (gpointer self) { - return self ? g_error_copy (self) : NULL; -} - - -static void desktop_agnostic_config_schema_option_parse_default_value (DesktopAgnosticConfigSchemaOption* self, GKeyFile* schema, const char* group, GError** error) { - GError * _inner_error_; - char* key; - g_return_if_fail (self != NULL); - g_return_if_fail (schema != NULL); - g_return_if_fail (group != NULL); - _inner_error_ = NULL; - key = g_strdup ("default"); - { - if (self->priv->_option_type == G_TYPE_BOOLEAN) { - gboolean _tmp0_; - GValue _tmp2_; - GValue _tmp1_ = {0}; - _tmp0_ = g_key_file_get_boolean (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_default_value = (_tmp2_ = (g_value_init (&_tmp1_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp1_, _tmp0_), _tmp1_), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp2_); - } else { - if (self->priv->_option_type == G_TYPE_INT) { - gint _tmp3_; - GValue _tmp5_; - GValue _tmp4_ = {0}; - _tmp3_ = g_key_file_get_integer (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_default_value = (_tmp5_ = (g_value_init (&_tmp4_, G_TYPE_INT), g_value_set_int (&_tmp4_, _tmp3_), _tmp4_), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp5_); - } else { - if (self->priv->_option_type == G_TYPE_FLOAT) { - double _tmp6_; - GValue _tmp8_; - GValue _tmp7_ = {0}; - _tmp6_ = g_key_file_get_double (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_default_value = (_tmp8_ = (g_value_init (&_tmp7_, G_TYPE_FLOAT), g_value_set_float (&_tmp7_, (float) _tmp6_), _tmp7_), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp8_); - } else { - if (self->priv->_option_type == G_TYPE_STRING) { - char* _tmp9_; - GValue _tmp12_; - GValue _tmp11_ = {0}; - char* _tmp10_; - _tmp9_ = g_key_file_get_string (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_default_value = (_tmp12_ = (g_value_init (&_tmp11_, G_TYPE_STRING), g_value_set_string (&_tmp11_, _tmp10_ = _tmp9_), _tmp11_), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp12_); - _g_free0 (_tmp10_); - } else { - DesktopAgnosticConfigSchemaType* st; - st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (self->priv->_option_type)); - if (st != NULL) { - char* _tmp13_; - GValue _tmp15_ = {0}; - char* _tmp14_; - GValue _tmp16_; - GValue _tmp17_; - GValue _tmp18_; - _tmp13_ = g_key_file_get_string (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _tmp17_ = (_tmp16_ = (desktop_agnostic_config_schema_type_deserialize (st, _tmp14_ = _tmp13_, &_tmp15_, &_inner_error_), _tmp15_), _g_free0 (_tmp14_), _tmp16_); - if (_inner_error_ != NULL) { - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - goto __finally7; - } - self->priv->_default_value = (_tmp18_ = _tmp17_, G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp18_); - } else { - if (self->priv->_option_type == G_TYPE_VALUE_ARRAY) { - GValueArray* array; - char* _tmp19_; - char* _tmp20_; - gboolean _tmp21_; - GValue _tmp55_; - GValue _tmp54_ = {0}; - array = NULL; - _tmp19_ = g_key_file_get_value (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_value_array_free0 (array); - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - if ((_tmp21_ = _vala_strcmp0 (_tmp20_ = _tmp19_, "") == 0, _g_free0 (_tmp20_), _tmp21_)) { - GValueArray* _tmp22_; - array = (_tmp22_ = g_value_array_new ((guint) 0), _g_value_array_free0 (array), _tmp22_); - } else { - if (self->priv->_list_type == G_TYPE_BOOLEAN) { - gboolean* _tmp24_; - gint list_size; - gint list_length1; - gsize _tmp23_; - gboolean* list; - GValueArray* _tmp25_; - list = (_tmp24_ = g_key_file_get_boolean_list (schema, group, key, &_tmp23_, &_inner_error_), list_length1 = _tmp23_, list_size = list_length1, _tmp24_); - if (_inner_error_ != NULL) { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_value_array_free0 (array); - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - array = (_tmp25_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp25_); - { - gboolean* item_collection; - int item_collection_length1; - int item_it; - item_collection = list; - item_collection_length1 = list_length1; - for (item_it = 0; item_it < list_length1; item_it = item_it + 1) { - gboolean item; - item = item_collection[item_it]; - { - GValue val = {0}; - GValue _tmp27_; - GValue _tmp26_ = {0}; - val = (_tmp27_ = (g_value_init (&_tmp26_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp26_, item), _tmp26_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp27_); - g_value_array_append (array, &val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - } - } - list = (g_free (list), NULL); - } else { - if (self->priv->_list_type == G_TYPE_INT) { - gint* _tmp29_; - gint list_size; - gint list_length1; - gsize _tmp28_; - gint* list; - GValueArray* _tmp30_; - list = (_tmp29_ = g_key_file_get_integer_list (schema, group, key, &_tmp28_, &_inner_error_), list_length1 = _tmp28_, list_size = list_length1, _tmp29_); - if (_inner_error_ != NULL) { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_value_array_free0 (array); - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - array = (_tmp30_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp30_); - { - gint* item_collection; - int item_collection_length1; - int item_it; - item_collection = list; - item_collection_length1 = list_length1; - for (item_it = 0; item_it < list_length1; item_it = item_it + 1) { - gint item; - item = item_collection[item_it]; - { - GValue val = {0}; - GValue _tmp32_; - GValue _tmp31_ = {0}; - val = (_tmp32_ = (g_value_init (&_tmp31_, G_TYPE_INT), g_value_set_int (&_tmp31_, item), _tmp31_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp32_); - g_value_array_append (array, &val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - } - } - list = (g_free (list), NULL); - } else { - if (self->priv->_list_type == G_TYPE_FLOAT) { - double* _tmp34_; - gint list_size; - gint list_length1; - gsize _tmp33_; - double* list; - GValueArray* _tmp35_; - list = (_tmp34_ = g_key_file_get_double_list (schema, group, key, &_tmp33_, &_inner_error_), list_length1 = _tmp33_, list_size = list_length1, _tmp34_); - if (_inner_error_ != NULL) { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_value_array_free0 (array); - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - array = (_tmp35_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp35_); - { - double* item_collection; - int item_collection_length1; - int item_it; - item_collection = list; - item_collection_length1 = list_length1; - for (item_it = 0; item_it < list_length1; item_it = item_it + 1) { - double item; - item = item_collection[item_it]; - { - GValue val = {0}; - GValue _tmp37_; - GValue _tmp36_ = {0}; - val = (_tmp37_ = (g_value_init (&_tmp36_, G_TYPE_FLOAT), g_value_set_float (&_tmp36_, (float) item), _tmp36_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp37_); - g_value_array_append (array, &val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - } - } - list = (g_free (list), NULL); - } else { - if (self->priv->_list_type == G_TYPE_STRING) { - char** _tmp39_; - gint list_size; - gint list_length1; - gsize _tmp38_; - char** list; - GValueArray* _tmp40_; - list = (_tmp39_ = g_key_file_get_string_list (schema, group, key, &_tmp38_, &_inner_error_), list_length1 = _tmp38_, list_size = list_length1, _tmp39_); - if (_inner_error_ != NULL) { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_value_array_free0 (array); - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - array = (_tmp40_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp40_); - { - char** item_collection; - int item_collection_length1; - int item_it; - item_collection = list; - item_collection_length1 = list_length1; - for (item_it = 0; item_it < list_length1; item_it = item_it + 1) { - const char* item; - item = item_collection[item_it]; - { - GValue val = {0}; - GValue _tmp42_; - GValue _tmp41_ = {0}; - val = (_tmp42_ = (g_value_init (&_tmp41_, G_TYPE_STRING), g_value_set_string (&_tmp41_, item), _tmp41_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp42_); - g_value_array_append (array, &val); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - } - } - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - } else { - DesktopAgnosticConfigSchemaType* _tmp43_; - st = (_tmp43_ = _g_object_ref0 (desktop_agnostic_config_schema_find_type (self->priv->_list_type)), _g_object_unref0 (st), _tmp43_); - if (st == NULL) { - char* _tmp44_; - char* _tmp45_; - GError* _tmp46_; - _tmp44_ = g_key_file_get_value (schema, group, "type", &_inner_error_); - if (_inner_error_ != NULL) { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_value_array_free0 (array); - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _inner_error_ = (_tmp46_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE, "Invalid option list type for %s: %s (given: '%s').", group, g_type_name (self->priv->_list_type), _tmp45_ = _tmp44_), _g_free0 (_tmp45_), _tmp46_); - { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - goto __finally7; - } - } else { - char** _tmp48_; - gint list_size; - gint list_length1; - gsize _tmp47_; - char** list; - GValueArray* _tmp49_; - list = (_tmp48_ = g_key_file_get_string_list (schema, group, key, &_tmp47_, &_inner_error_), list_length1 = _tmp47_, list_size = list_length1, _tmp48_); - if (_inner_error_ != NULL) { - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_value_array_free0 (array); - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - array = (_tmp49_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp49_); - { - char** item_collection; - int item_collection_length1; - int item_it; - item_collection = list; - item_collection_length1 = list_length1; - for (item_it = 0; item_it < list_length1; item_it = item_it + 1) { - const char* item; - item = item_collection[item_it]; - { - GValue _tmp50_ = {0}; - GValue _tmp51_; - GValue _tmp53_; - GValue _tmp52_; - _tmp51_ = (desktop_agnostic_config_schema_type_deserialize (st, item, &_tmp50_, &_inner_error_), _tmp50_); - if (_inner_error_ != NULL) { - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - _g_value_array_free0 (array); - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - goto __finally7; - } - g_value_array_append (array, (_tmp53_ = _tmp52_ = _tmp51_, &_tmp53_)); - G_IS_VALUE (&_tmp52_) ? (g_value_unset (&_tmp52_), NULL) : NULL; - } - } - } - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - } - } - } - } - } - } - self->priv->_default_value = (_tmp55_ = (g_value_init (&_tmp54_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp54_, array), _tmp54_), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp55_); - _g_value_array_free0 (array); - } else { - char* _tmp56_; - char* _tmp57_; - GError* _tmp58_; - _tmp56_ = g_key_file_get_value (schema, group, "type", &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - _g_object_unref0 (st); - _g_free0 (key); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _inner_error_ = (_tmp58_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE, "Invalid option type for %s: %s (given: '%s').", group, g_type_name (self->priv->_option_type), _tmp57_ = _tmp56_), _g_free0 (_tmp57_), _tmp58_); - { - _g_object_unref0 (st); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch7_g_key_file_error; - } - goto __finally7; - } - } - } - _g_object_unref0 (st); - } - } - } - } - } - goto __finally7; - __catch7_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - if (g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE)) { - _inner_error_ = g_error_new (G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE, "%s (key: %s)", err->message, group); - { - _g_error_free0 (err); - _g_free0 (key); - goto __finally7; - } - } else { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - _g_free0 (key); - goto __finally7; - } - } - _g_error_free0 (err); - } - } - __finally7: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (key); - return; - } - _g_free0 (key); -} - - -static char* desktop_agnostic_config_schema_option_parse_localized_value (DesktopAgnosticConfigSchemaOption* self, GKeyFile* schema, const char* group, const char* key, gboolean mandatory, GError** error) { - char* result; - GError * _inner_error_; - char* _result_; - gboolean _tmp0_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (schema != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - _result_ = NULL; - _tmp0_ = g_key_file_has_key (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (_result_); - return NULL; - } - if (_tmp0_) { - { - char** _tmp1_; - char** locale_collection; - int locale_collection_length1; - int locale_it; - locale_collection = _tmp1_ = g_get_language_names (); - locale_collection_length1 = _vala_array_length (_tmp1_); - for (locale_it = 0; locale_it < _vala_array_length (_tmp1_); locale_it = locale_it + 1) { - const char* locale; - locale = locale_collection[locale_it]; - { - if (_vala_strcmp0 (locale, "C") == 0) { - char* _tmp2_; - char* _tmp3_; - _tmp2_ = g_key_file_get_string (schema, group, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (_result_); - return NULL; - } - _result_ = (_tmp3_ = _tmp2_, _g_free0 (_result_), _tmp3_); - break; - } - { - char* _tmp4_; - char* _tmp5_; - _tmp4_ = g_key_file_get_locale_string (schema, group, key, locale, &_inner_error_); - if (_inner_error_ != NULL) { - if (g_error_matches (_inner_error_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) { - goto __catch8_g_key_file_error_key_not_found; - } - goto __finally8; - } - _result_ = (_tmp5_ = _tmp4_, _g_free0 (_result_), _tmp5_); - break; - } - goto __finally8; - __catch8_g_key_file_error_key_not_found: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _g_error_free0 (err); - } - } - __finally8: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (_result_); - return NULL; - } - } - } - } - } else { - if (mandatory) { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_METADATA_NOT_FOUND, "The metadata value '%s' for the config key '%s' was not found.", key, group); - { - g_propagate_error (error, _inner_error_); - _g_free0 (_result_); - return NULL; - } - } - } - result = _result_; - return result; -} - - -GType desktop_agnostic_config_schema_option_get_option_type (DesktopAgnosticConfigSchemaOption* self) { - GType result; - g_return_val_if_fail (self != NULL, 0UL); - result = self->priv->_option_type; - return result; -} - - -static void desktop_agnostic_config_schema_option_set_option_type (DesktopAgnosticConfigSchemaOption* self, GType value) { - g_return_if_fail (self != NULL); - self->priv->_option_type = value; - g_object_notify ((GObject *) self, "option-type"); -} - - -GType desktop_agnostic_config_schema_option_get_list_type (DesktopAgnosticConfigSchemaOption* self) { - GType result; - g_return_val_if_fail (self != NULL, 0UL); - result = self->priv->_list_type; - return result; -} - - -static void desktop_agnostic_config_schema_option_set_list_type (DesktopAgnosticConfigSchemaOption* self, GType value) { - g_return_if_fail (self != NULL); - self->priv->_list_type = value; - g_object_notify ((GObject *) self, "list-type"); -} - - -void desktop_agnostic_config_schema_option_get_default_value (DesktopAgnosticConfigSchemaOption* self, GValue* result) { - g_return_if_fail (self != NULL); - *result = self->priv->_default_value; - return; -} - - -static void desktop_agnostic_config_schema_option_set_default_value (DesktopAgnosticConfigSchemaOption* self, GValue* value) { - GValue _tmp1_; - GValue _tmp0_ = {0}; - g_return_if_fail (self != NULL); - self->priv->_default_value = (_tmp1_ = G_IS_VALUE (value) ? (g_value_init (&_tmp0_, G_VALUE_TYPE (value)), g_value_copy (value, &_tmp0_), _tmp0_) : (*value), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp1_); - g_object_notify ((GObject *) self, "default-value"); -} - - -const char* desktop_agnostic_config_schema_option_get_description (DesktopAgnosticConfigSchemaOption* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_description; - return result; -} - - -static void desktop_agnostic_config_schema_option_set_description (DesktopAgnosticConfigSchemaOption* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_description = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_description), _tmp0_); - g_object_notify ((GObject *) self, "description"); -} - - -const char* desktop_agnostic_config_schema_option_get_summary (DesktopAgnosticConfigSchemaOption* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_summary; - return result; -} - - -static void desktop_agnostic_config_schema_option_set_summary (DesktopAgnosticConfigSchemaOption* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_summary = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_summary), _tmp0_); - g_object_notify ((GObject *) self, "summary"); -} - - -GValue* desktop_agnostic_config_schema_option_get_lower_boundary (DesktopAgnosticConfigSchemaOption* self) { - GValue* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_lower_boundary; - return result; -} - - -static GValue* _g_value_dup (GValue* self) { - return g_boxed_copy (G_TYPE_VALUE, self); -} - - -static gpointer __g_value_dup0 (gpointer self) { - return self ? _g_value_dup (self) : NULL; -} - - -static void desktop_agnostic_config_schema_option_set_lower_boundary (DesktopAgnosticConfigSchemaOption* self, GValue* value) { - GValue* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_lower_boundary = (_tmp0_ = __g_value_dup0 (value), _g_free0 (self->priv->_lower_boundary), _tmp0_); -} - - -GValue* desktop_agnostic_config_schema_option_get_upper_boundary (DesktopAgnosticConfigSchemaOption* self) { - GValue* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_upper_boundary; - return result; -} - - -static void desktop_agnostic_config_schema_option_set_upper_boundary (DesktopAgnosticConfigSchemaOption* self, GValue* value) { - GValue* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_upper_boundary = (_tmp0_ = __g_value_dup0 (value), _g_free0 (self->priv->_upper_boundary), _tmp0_); -} - - -GValueArray* desktop_agnostic_config_schema_option_get_whitelist (DesktopAgnosticConfigSchemaOption* self) { - GValueArray* result; - g_return_val_if_fail (self != NULL, NULL); - result = g_value_array_copy (self->priv->_whitelist); - return result; -} - - -GValueArray* desktop_agnostic_config_schema_option_get_blacklist (DesktopAgnosticConfigSchemaOption* self) { - GValueArray* result; - g_return_val_if_fail (self != NULL, NULL); - result = g_value_array_copy (self->priv->_blacklist); - return result; -} - - -gboolean desktop_agnostic_config_schema_option_get_per_instance (DesktopAgnosticConfigSchemaOption* self) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->_per_instance; - return result; -} - - -static void desktop_agnostic_config_schema_option_set_per_instance (DesktopAgnosticConfigSchemaOption* self, gboolean value) { - g_return_if_fail (self != NULL); - self->priv->_per_instance = value; - g_object_notify ((GObject *) self, "per-instance"); -} - - -static void desktop_agnostic_config_schema_option_class_init (DesktopAgnosticConfigSchemaOptionClass * klass) { - desktop_agnostic_config_schema_option_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticConfigSchemaOptionPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_schema_option_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_config_schema_option_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_config_schema_option_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_OPTION_TYPE, g_param_spec_gtype ("option-type", "option-type", "option-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_LIST_TYPE, g_param_spec_gtype ("list-type", "list-type", "list-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DEFAULT_VALUE, g_param_spec_boxed ("default-value", "default-value", "default-value", G_TYPE_VALUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_SUMMARY, g_param_spec_string ("summary", "summary", "summary", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_WHITELIST, g_param_spec_boxed ("whitelist", "whitelist", "whitelist", G_TYPE_VALUE_ARRAY, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_BLACKLIST, g_param_spec_boxed ("blacklist", "blacklist", "blacklist", G_TYPE_VALUE_ARRAY, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_PER_INSTANCE, g_param_spec_boolean ("per-instance", "per-instance", "per-instance", TRUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -} - - -static void desktop_agnostic_config_schema_option_instance_init (DesktopAgnosticConfigSchemaOption * self) { - self->priv = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_GET_PRIVATE (self); - self->priv->_per_instance = TRUE; -} - - -static void desktop_agnostic_config_schema_option_finalize (GObject* obj) { - DesktopAgnosticConfigSchemaOption * self; - self = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION (obj); - G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL; - _g_free0 (self->priv->_description); - _g_free0 (self->priv->_summary); - _g_free0 (self->priv->_lower_boundary); - _g_free0 (self->priv->_upper_boundary); - _g_value_array_free0 (self->priv->_whitelist); - _g_value_array_free0 (self->priv->_blacklist); - G_OBJECT_CLASS (desktop_agnostic_config_schema_option_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_config_schema_option_get_type (void) { - static GType desktop_agnostic_config_schema_option_type_id = 0; - if (desktop_agnostic_config_schema_option_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigSchemaOptionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_schema_option_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigSchemaOption), 0, (GInstanceInitFunc) desktop_agnostic_config_schema_option_instance_init, NULL }; - desktop_agnostic_config_schema_option_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigSchemaOption", &g_define_type_info, 0); - } - return desktop_agnostic_config_schema_option_type_id; -} - - -static void desktop_agnostic_config_schema_option_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigSchemaOption * self; - gpointer boxed; - self = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_OPTION_TYPE: - g_value_set_gtype (value, desktop_agnostic_config_schema_option_get_option_type (self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_LIST_TYPE: - g_value_set_gtype (value, desktop_agnostic_config_schema_option_get_list_type (self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DEFAULT_VALUE: - boxed = g_new0 (GValue, 1); - desktop_agnostic_config_schema_option_get_default_value (self, boxed); - g_value_take_boxed (value, boxed); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DESCRIPTION: - g_value_set_string (value, desktop_agnostic_config_schema_option_get_description (self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_SUMMARY: - g_value_set_string (value, desktop_agnostic_config_schema_option_get_summary (self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_WHITELIST: - g_value_set_boxed (value, desktop_agnostic_config_schema_option_get_whitelist (self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_BLACKLIST: - g_value_set_boxed (value, desktop_agnostic_config_schema_option_get_blacklist (self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_PER_INSTANCE: - g_value_set_boolean (value, desktop_agnostic_config_schema_option_get_per_instance (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_config_schema_option_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigSchemaOption * self; - self = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_OPTION_TYPE: - desktop_agnostic_config_schema_option_set_option_type (self, g_value_get_gtype (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_LIST_TYPE: - desktop_agnostic_config_schema_option_set_list_type (self, g_value_get_gtype (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DEFAULT_VALUE: - desktop_agnostic_config_schema_option_set_default_value (self, g_value_get_boxed (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_DESCRIPTION: - desktop_agnostic_config_schema_option_set_description (self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_SUMMARY: - desktop_agnostic_config_schema_option_set_summary (self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_PER_INSTANCE: - desktop_agnostic_config_schema_option_set_per_instance (self, g_value_get_boolean (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static gint _vala_array_length (gpointer array) { - int length; - length = 0; - if (array) { - while (((gpointer*) array)[length]) { - length++; - } - } - return length; -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-schema-type.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-schema-type.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-schema-type.c 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-schema-type.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,196 +0,0 @@ -/* config-schema-type.c generated by valac, the Vala compiler - * generated from config-schema-type.vala, do not modify */ - -/* - * Desktop Agnostic Library: Configuration Schema Abstract Type. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE (desktop_agnostic_config_schema_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaType)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_SCHEMA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, DesktopAgnosticConfigSchemaTypeClass)) - -typedef struct _DesktopAgnosticConfigSchemaType DesktopAgnosticConfigSchemaType; -typedef struct _DesktopAgnosticConfigSchemaTypeClass DesktopAgnosticConfigSchemaTypeClass; -typedef struct _DesktopAgnosticConfigSchemaTypePrivate DesktopAgnosticConfigSchemaTypePrivate; - -typedef enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS -} DesktopAgnosticConfigSchemaError; -#define DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR desktop_agnostic_config_schema_error_quark () -struct _DesktopAgnosticConfigSchemaType { - GObject parent_instance; - DesktopAgnosticConfigSchemaTypePrivate * priv; -}; - -struct _DesktopAgnosticConfigSchemaTypeClass { - GObjectClass parent_class; - char* (*serialize) (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error); - void (*deserialize) (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error); - void (*parse_default_value) (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GValue* result, GError** error); - GValueArray* (*parse_default_list_value) (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GError** error); - char* (*get_name) (DesktopAgnosticConfigSchemaType* self); - GType (*get_schema_type) (DesktopAgnosticConfigSchemaType* self); -}; - - -static gpointer desktop_agnostic_config_schema_type_parent_class = NULL; - -GType desktop_agnostic_config_schema_type_get_type (void); -GQuark desktop_agnostic_config_schema_error_quark (void); -enum { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_NAME, - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_SCHEMA_TYPE -}; -char* desktop_agnostic_config_schema_type_serialize (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error); -static char* desktop_agnostic_config_schema_type_real_serialize (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error); -void desktop_agnostic_config_schema_type_deserialize (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error); -static void desktop_agnostic_config_schema_type_real_deserialize (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error); -void desktop_agnostic_config_schema_type_parse_default_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GValue* result, GError** error); -static void desktop_agnostic_config_schema_type_real_parse_default_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GValue* result, GError** error); -GValueArray* desktop_agnostic_config_schema_type_parse_default_list_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GError** error); -static GValueArray* desktop_agnostic_config_schema_type_real_parse_default_list_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GError** error); -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_type_construct (GType object_type); -char* desktop_agnostic_config_schema_type_get_name (DesktopAgnosticConfigSchemaType* self); -GType desktop_agnostic_config_schema_type_get_schema_type (DesktopAgnosticConfigSchemaType* self); -static void desktop_agnostic_config_schema_type_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static char* desktop_agnostic_config_schema_type_real_serialize (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error) { - g_return_val_if_fail (self != NULL, NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_schema_type_serialize'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return NULL; -} - - -char* desktop_agnostic_config_schema_type_serialize (DesktopAgnosticConfigSchemaType* self, GValue* val, GError** error) { - return DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS (self)->serialize (self, val, error); -} - - -static void desktop_agnostic_config_schema_type_real_deserialize (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_schema_type_deserialize'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_schema_type_deserialize (DesktopAgnosticConfigSchemaType* self, const char* serialized, GValue* result, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS (self)->deserialize (self, serialized, result, error); -} - - -static void desktop_agnostic_config_schema_type_real_parse_default_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GValue* result, GError** error) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_schema_type_parse_default_value'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_config_schema_type_parse_default_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GValue* result, GError** error) { - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS (self)->parse_default_value (self, schema, group, result, error); -} - - -static GValueArray* desktop_agnostic_config_schema_type_real_parse_default_list_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GError** error) { - g_return_val_if_fail (self != NULL, NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_config_schema_type_parse_default_list_value'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return NULL; -} - - -GValueArray* desktop_agnostic_config_schema_type_parse_default_list_value (DesktopAgnosticConfigSchemaType* self, GKeyFile* schema, const char* group, GError** error) { - return DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS (self)->parse_default_list_value (self, schema, group, error); -} - - -DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_type_construct (GType object_type) { - DesktopAgnosticConfigSchemaType * self; - self = (DesktopAgnosticConfigSchemaType*) g_object_new (object_type, NULL); - return self; -} - - -char* desktop_agnostic_config_schema_type_get_name (DesktopAgnosticConfigSchemaType* self) { - return DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS (self)->get_name (self); -} - - -GType desktop_agnostic_config_schema_type_get_schema_type (DesktopAgnosticConfigSchemaType* self) { - return DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_GET_CLASS (self)->get_schema_type (self); -} - - -static void desktop_agnostic_config_schema_type_class_init (DesktopAgnosticConfigSchemaTypeClass * klass) { - desktop_agnostic_config_schema_type_parent_class = g_type_class_peek_parent (klass); - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->serialize = desktop_agnostic_config_schema_type_real_serialize; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->deserialize = desktop_agnostic_config_schema_type_real_deserialize; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->parse_default_value = desktop_agnostic_config_schema_type_real_parse_default_value; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->parse_default_list_value = desktop_agnostic_config_schema_type_real_parse_default_list_value; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_schema_type_get_property; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_SCHEMA_TYPE, g_param_spec_gtype ("schema-type", "schema-type", "schema-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -} - - -static void desktop_agnostic_config_schema_type_instance_init (DesktopAgnosticConfigSchemaType * self) { -} - - -GType desktop_agnostic_config_schema_type_get_type (void) { - static GType desktop_agnostic_config_schema_type_type_id = 0; - if (desktop_agnostic_config_schema_type_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigSchemaTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_schema_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigSchemaType), 0, (GInstanceInitFunc) desktop_agnostic_config_schema_type_instance_init, NULL }; - desktop_agnostic_config_schema_type_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigSchemaType", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); - } - return desktop_agnostic_config_schema_type_type_id; -} - - -static void desktop_agnostic_config_schema_type_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigSchemaType * self; - self = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE (object); - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-type-color.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-type-color.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/config-type-color.c 2010-04-11 07:32:36.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/config-type-color.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,468 +0,0 @@ -/* config-type-color.c generated by valac, the Vala compiler - * generated from config-type-color.vala, do not modify */ - -/* - * Registers DesktopAgnostic.Color as a valid configuration type. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE (desktop_agnostic_config_color_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE, DesktopAgnosticConfigColorType)) -#define DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE, DesktopAgnosticConfigColorTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_COLOR_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_COLOR_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE, DesktopAgnosticConfigColorTypeClass)) - -typedef struct _DesktopAgnosticConfigColorType DesktopAgnosticConfigColorType; -typedef struct _DesktopAgnosticConfigColorTypeClass DesktopAgnosticConfigColorTypeClass; -typedef struct _DesktopAgnosticConfigColorTypePrivate DesktopAgnosticConfigColorTypePrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL))) - -struct _DesktopAgnosticConfigColorType { - DesktopAgnosticConfigSchemaType parent_instance; - DesktopAgnosticConfigColorTypePrivate * priv; -}; - -struct _DesktopAgnosticConfigColorTypeClass { - DesktopAgnosticConfigSchemaTypeClass parent_class; -}; - - -static gpointer desktop_agnostic_config_color_type_parent_class = NULL; - -GType desktop_agnostic_config_color_type_get_type (void); -enum { - DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_NAME, - DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_SCHEMA_TYPE -}; -#define DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_DEFAULT_KEY "default" -static char* desktop_agnostic_config_color_type_real_serialize (DesktopAgnosticConfigSchemaType* base, GValue* val, GError** error); -static void desktop_agnostic_config_color_type_real_deserialize (DesktopAgnosticConfigSchemaType* base, const char* serialized, GValue* result, GError** error); -static void desktop_agnostic_config_color_type_real_parse_default_value (DesktopAgnosticConfigSchemaType* base, GKeyFile* schema, const char* group, GValue* result, GError** error); -static GValueArray* desktop_agnostic_config_color_type_real_parse_default_list_value (DesktopAgnosticConfigSchemaType* base, GKeyFile* schema, const char* group, GError** error); -DesktopAgnosticConfigColorType* desktop_agnostic_config_color_type_new (void); -DesktopAgnosticConfigColorType* desktop_agnostic_config_color_type_construct (GType object_type); -static void desktop_agnostic_config_color_type_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -void desktop_agnostic_config_color_to_string (GValue* src_value, GValue* dest_value); -void desktop_agnostic_config_string_to_color (GValue* src_value, GValue* dest_value); -static void _desktop_agnostic_config_color_to_string_gvalue_transform (GValue* src_value, GValue* dest_value); -static void _desktop_agnostic_config_string_to_color_gvalue_transform (GValue* src_value, GValue* dest_value); -GType register_plugin (void); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -static char* desktop_agnostic_config_color_type_real_serialize (DesktopAgnosticConfigSchemaType* base, GValue* val, GError** error) { - DesktopAgnosticConfigColorType * self; - char* result; - DesktopAgnosticColor* color; - self = (DesktopAgnosticConfigColorType*) base; - color = g_value_get_object (val); - if (color == NULL) { - result = g_strdup (""); - return result; - } else { - result = desktop_agnostic_color_to_string (color); - return result; - } -} - - -static void desktop_agnostic_config_color_type_real_deserialize (DesktopAgnosticConfigSchemaType* base, const char* serialized, GValue* result, GError** error) { - DesktopAgnosticConfigColorType * self; - GError * _inner_error_; - GValue val = {0}; - self = (DesktopAgnosticConfigColorType*) base; - g_return_if_fail (serialized != NULL); - _inner_error_ = NULL; - if (_vala_strcmp0 (serialized, "") == 0) { - GValue _tmp1_; - GValue _tmp0_ = {0}; - val = (_tmp1_ = (g_value_init (&_tmp0_, G_TYPE_OBJECT), g_value_set_object (&_tmp0_, G_OBJECT (NULL)), _tmp0_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp1_); - *result = val; - return; - } - { - DesktopAgnosticColor* color; - GValue _tmp5_; - GValue _tmp4_ = {0}; - DesktopAgnosticColor* _tmp3_; - DesktopAgnosticColor* _tmp2_; - color = desktop_agnostic_color_new_from_string (serialized, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR) { - goto __catch0_desktop_agnostic_color_parse_error; - } - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - val = (_tmp5_ = (g_value_init (&_tmp4_, DESKTOP_AGNOSTIC_TYPE_COLOR), g_value_set_object (&_tmp4_, _tmp3_ = (_tmp2_ = color, color = NULL, _tmp2_)), _tmp4_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp5_); - _g_object_unref0 (_tmp3_); - *result = val; - _g_object_unref0 (color); - return; - } - goto __finally0; - __catch0_desktop_agnostic_color_parse_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, "Could not deserialize value: %s", err->message); - { - _g_error_free0 (err); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - goto __finally0; - } - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - return; - } else { - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; -} - - -static void desktop_agnostic_config_color_type_real_parse_default_value (DesktopAgnosticConfigSchemaType* base, GKeyFile* schema, const char* group, GValue* result, GError** error) { - DesktopAgnosticConfigColorType * self; - GError * _inner_error_; - char* _tmp0_; - GValue _tmp2_ = {0}; - char* _tmp1_; - GValue _tmp3_; - GValue _tmp4_; - self = (DesktopAgnosticConfigColorType*) base; - g_return_if_fail (schema != NULL); - g_return_if_fail (group != NULL); - _inner_error_ = NULL; - _tmp0_ = g_key_file_get_string (schema, group, DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_DEFAULT_KEY, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - _tmp4_ = (_tmp3_ = (desktop_agnostic_config_schema_type_deserialize ((DesktopAgnosticConfigSchemaType*) self, _tmp1_ = _tmp0_, &_tmp2_, &_inner_error_), _tmp2_), _g_free0 (_tmp1_), _tmp3_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - *result = _tmp4_; - return; -} - - -static GValueArray* desktop_agnostic_config_color_type_real_parse_default_list_value (DesktopAgnosticConfigSchemaType* base, GKeyFile* schema, const char* group, GError** error) { - DesktopAgnosticConfigColorType * self; - GValueArray* result; - GError * _inner_error_; - GValueArray* array; - self = (DesktopAgnosticConfigColorType*) base; - g_return_val_if_fail (schema != NULL, NULL); - g_return_val_if_fail (group != NULL, NULL); - _inner_error_ = NULL; - array = NULL; - { - char** _tmp1_; - gint list_size; - gint list_length1; - gsize _tmp0_; - char** list; - GValueArray* _tmp2_; - list = (_tmp1_ = g_key_file_get_string_list (schema, group, DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_DEFAULT_KEY, &_tmp0_, &_inner_error_), list_length1 = _tmp0_, list_size = list_length1, _tmp1_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch1_g_key_file_error; - } - _g_value_array_free0 (array); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - array = (_tmp2_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp2_); - { - char** item_collection; - int item_collection_length1; - int item_it; - item_collection = list; - item_collection_length1 = list_length1; - for (item_it = 0; item_it < list_length1; item_it = item_it + 1) { - const char* item; - item = item_collection[item_it]; - { - GValue _tmp3_ = {0}; - GValue _tmp4_; - GValue _tmp6_; - GValue _tmp5_; - _tmp4_ = (desktop_agnostic_config_schema_type_deserialize ((DesktopAgnosticConfigSchemaType*) self, item, &_tmp3_, &_inner_error_), _tmp3_); - if (_inner_error_ != NULL) { - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch1_g_key_file_error; - } - goto __finally1; - } - g_value_array_append (array, (_tmp6_ = _tmp5_ = _tmp4_, &_tmp6_)); - G_IS_VALUE (&_tmp5_) ? (g_value_unset (&_tmp5_), NULL) : NULL; - } - } - } - result = array; - list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); - return result; - } - goto __finally1; - __catch1_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR, DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE, "Could not parse the default list value: %s", err->message); - { - _g_error_free0 (err); - _g_value_array_free0 (array); - goto __finally1; - } - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (array); - return NULL; - } else { - _g_value_array_free0 (array); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - _g_value_array_free0 (array); -} - - -DesktopAgnosticConfigColorType* desktop_agnostic_config_color_type_construct (GType object_type) { - DesktopAgnosticConfigColorType * self; - self = (DesktopAgnosticConfigColorType*) desktop_agnostic_config_schema_type_construct (object_type); - return self; -} - - -DesktopAgnosticConfigColorType* desktop_agnostic_config_color_type_new (void) { - return desktop_agnostic_config_color_type_construct (DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE); -} - - -static char* desktop_agnostic_config_color_type_real_get_name (DesktopAgnosticConfigSchemaType* base) { - char* result; - DesktopAgnosticConfigColorType* self; - self = (DesktopAgnosticConfigColorType*) base; - result = g_strdup ("color"); - return result; -} - - -static GType desktop_agnostic_config_color_type_real_get_schema_type (DesktopAgnosticConfigSchemaType* base) { - GType result; - DesktopAgnosticConfigColorType* self; - self = (DesktopAgnosticConfigColorType*) base; - result = DESKTOP_AGNOSTIC_TYPE_COLOR; - return result; -} - - -static void desktop_agnostic_config_color_type_class_init (DesktopAgnosticConfigColorTypeClass * klass) { - desktop_agnostic_config_color_type_parent_class = g_type_class_peek_parent (klass); - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->serialize = desktop_agnostic_config_color_type_real_serialize; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->deserialize = desktop_agnostic_config_color_type_real_deserialize; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->parse_default_value = desktop_agnostic_config_color_type_real_parse_default_value; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->parse_default_list_value = desktop_agnostic_config_color_type_real_parse_default_list_value; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->get_name = desktop_agnostic_config_color_type_real_get_name; - DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE_CLASS (klass)->get_schema_type = desktop_agnostic_config_color_type_real_get_schema_type; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_config_color_type_get_property; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_SCHEMA_TYPE, "schema-type"); -} - - -static void desktop_agnostic_config_color_type_instance_init (DesktopAgnosticConfigColorType * self) { -} - - -GType desktop_agnostic_config_color_type_get_type (void) { - static GType desktop_agnostic_config_color_type_type_id = 0; - if (desktop_agnostic_config_color_type_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticConfigColorTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_config_color_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticConfigColorType), 0, (GInstanceInitFunc) desktop_agnostic_config_color_type_instance_init, NULL }; - desktop_agnostic_config_color_type_type_id = g_type_register_static (DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, "DesktopAgnosticConfigColorType", &g_define_type_info, 0); - } - return desktop_agnostic_config_color_type_type_id; -} - - -static void desktop_agnostic_config_color_type_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticConfigColorType * self; - self = DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_NAME: - g_value_set_string (value, desktop_agnostic_config_schema_type_get_name ((DesktopAgnosticConfigSchemaType*) self)); - break; - case DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_SCHEMA_TYPE: - g_value_set_gtype (value, desktop_agnostic_config_schema_type_get_schema_type ((DesktopAgnosticConfigSchemaType*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -void desktop_agnostic_config_color_to_string (GValue* src_value, GValue* dest_value) { - GError * _inner_error_; - DesktopAgnosticConfigColorType* ct; - char* _tmp0_; - GValue _tmp3_; - GValue _tmp2_ = {0}; - char* _tmp1_; - _inner_error_ = NULL; - ct = desktop_agnostic_config_color_type_new (); - _tmp0_ = desktop_agnostic_config_schema_type_serialize ((DesktopAgnosticConfigSchemaType*) ct, src_value, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (ct); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - *dest_value = (_tmp3_ = (g_value_init (&_tmp2_, G_TYPE_STRING), g_value_set_string (&_tmp2_, _tmp1_ = _tmp0_), _tmp2_), G_IS_VALUE (dest_value) ? (g_value_unset (dest_value), NULL) : NULL, _tmp3_); - _g_free0 (_tmp1_); - _g_object_unref0 (ct); -} - - -void desktop_agnostic_config_string_to_color (GValue* src_value, GValue* dest_value) { - GError * _inner_error_; - DesktopAgnosticConfigColorType* ct; - GValue _tmp0_ = {0}; - GValue _tmp1_; - GValue _tmp2_; - _inner_error_ = NULL; - ct = desktop_agnostic_config_color_type_new (); - _tmp1_ = (desktop_agnostic_config_schema_type_deserialize ((DesktopAgnosticConfigSchemaType*) ct, g_value_get_string (src_value), &_tmp0_, &_inner_error_), _tmp0_); - if (_inner_error_ != NULL) { - _g_object_unref0 (ct); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - *dest_value = (_tmp2_ = _tmp1_, G_IS_VALUE (dest_value) ? (g_value_unset (dest_value), NULL) : NULL, _tmp2_); - _g_object_unref0 (ct); -} - - -static void _desktop_agnostic_config_color_to_string_gvalue_transform (GValue* src_value, GValue* dest_value) { - desktop_agnostic_config_color_to_string (src_value, dest_value); -} - - -static void _desktop_agnostic_config_string_to_color_gvalue_transform (GValue* src_value, GValue* dest_value) { - desktop_agnostic_config_string_to_color (src_value, dest_value); -} - - -GType register_plugin (void) { - GType result; - g_value_register_transform_func (DESKTOP_AGNOSTIC_TYPE_COLOR, G_TYPE_STRING, _desktop_agnostic_config_color_to_string_gvalue_transform); - g_value_register_transform_func (G_TYPE_STRING, DESKTOP_AGNOSTIC_TYPE_COLOR, _desktop_agnostic_config_string_to_color_gvalue_transform); - result = DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE; - return result; -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-gconf.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-gconf.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-gconf.deps 2010-04-11 07:32:38.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-gconf.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -gconf-2.0 -desktop-agnostic-cfg -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-gconf.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-gconf.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-gconf.h 2010-04-11 07:32:38.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-gconf.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* da-cfg-gconf.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_CFG_GCONF_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_CFG_GCONF_H__ - -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND (desktop_agnostic_config_gconf_backend_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND, DesktopAgnosticConfigGConfBackend)) -#define DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND, DesktopAgnosticConfigGConfBackendClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GCONF_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GCONF_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND)) -#define DESKTOP_AGNOSTIC_CONFIG_GCONF_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GCONF_BACKEND, DesktopAgnosticConfigGConfBackendClass)) - -typedef struct _DesktopAgnosticConfigGConfBackend DesktopAgnosticConfigGConfBackend; -typedef struct _DesktopAgnosticConfigGConfBackendClass DesktopAgnosticConfigGConfBackendClass; -typedef struct _DesktopAgnosticConfigGConfBackendPrivate DesktopAgnosticConfigGConfBackendPrivate; - -struct _DesktopAgnosticConfigGConfBackend { - DesktopAgnosticConfigBackend parent_instance; - DesktopAgnosticConfigGConfBackendPrivate * priv; -}; - -struct _DesktopAgnosticConfigGConfBackendClass { - DesktopAgnosticConfigBackendClass parent_class; -}; - - -GType desktop_agnostic_config_gconf_backend_get_type (void); -DesktopAgnosticConfigGConfBackend* desktop_agnostic_config_gconf_backend_new (void); -DesktopAgnosticConfigGConfBackend* desktop_agnostic_config_gconf_backend_construct (GType object_type); -GType register_plugin (void); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-gconf.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-gconf.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-gconf.vapi 2010-04-11 07:32:38.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-gconf.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* da-cfg-gconf.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] - namespace Config { - [CCode (cheader_filename = "libdesktop-agnostic/da-cfg-gconf.h")] - public class GConfBackend : DesktopAgnostic.Config.Backend { - public GConfBackend (); - public override void constructed (); - public override bool get_bool (string group, string key) throws GLib.Error; - public override float get_float (string group, string key) throws GLib.Error; - public override int get_int (string group, string key) throws GLib.Error; - public override GLib.ValueArray get_list (string group, string key) throws GLib.Error; - public override string get_string (string group, string key) throws GLib.Error; - public override GLib.Value get_value (string group, string key) throws GLib.Error; - public override void notify (string group, string key) throws GLib.Error; - public override void notify_add (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public override void notify_remove (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public override void remove () throws GLib.Error; - public override void reset () throws GLib.Error; - public override void set_bool (string group, string key, bool value) throws GLib.Error; - public override void set_float (string group, string key, float value) throws GLib.Error; - public override void set_int (string group, string key, int value) throws GLib.Error; - public override void set_list (string group, string key, GLib.ValueArray value) throws GLib.Error; - public override void set_string (string group, string key, string value) throws GLib.Error; - public override string name { owned get; } - } - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-cfg-gconf.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-keyfile.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-keyfile.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-keyfile.deps 2010-04-11 07:32:35.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-keyfile.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -desktop-agnostic-cfg -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-keyfile.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-keyfile.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-keyfile.h 2010-04-11 07:32:35.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-keyfile.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* da-cfg-keyfile.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_CFG_KEYFILE_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_CFG_KEYFILE_H__ - -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE (desktop_agnostic_config_gkey_file_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE, DesktopAgnosticConfigGKeyFile)) -#define DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE, DesktopAgnosticConfigGKeyFileClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GKEY_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_GKEY_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE)) -#define DESKTOP_AGNOSTIC_CONFIG_GKEY_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_GKEY_FILE, DesktopAgnosticConfigGKeyFileClass)) - -typedef struct _DesktopAgnosticConfigGKeyFile DesktopAgnosticConfigGKeyFile; -typedef struct _DesktopAgnosticConfigGKeyFileClass DesktopAgnosticConfigGKeyFileClass; -typedef struct _DesktopAgnosticConfigGKeyFilePrivate DesktopAgnosticConfigGKeyFilePrivate; - -struct _DesktopAgnosticConfigGKeyFile { - DesktopAgnosticConfigBackend parent_instance; - DesktopAgnosticConfigGKeyFilePrivate * priv; -}; - -struct _DesktopAgnosticConfigGKeyFileClass { - DesktopAgnosticConfigBackendClass parent_class; -}; - - -GType desktop_agnostic_config_gkey_file_get_type (void); -DesktopAgnosticConfigGKeyFile* desktop_agnostic_config_gkey_file_new (void); -DesktopAgnosticConfigGKeyFile* desktop_agnostic_config_gkey_file_construct (GType object_type); -GType register_plugin (void); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-keyfile.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-keyfile.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-keyfile.vapi 2010-04-11 07:32:35.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-keyfile.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* da-cfg-keyfile.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] - namespace Config { - [CCode (cheader_filename = "libdesktop-agnostic/da-cfg-keyfile.h")] - public class GKeyFile : DesktopAgnostic.Config.Backend { - public GKeyFile (); - public override void constructed (); - public override bool get_bool (string group, string key) throws GLib.Error; - public override float get_float (string group, string key) throws DesktopAgnostic.Config.Error; - public override int get_int (string group, string key) throws GLib.Error; - public override GLib.ValueArray get_list (string group, string key) throws GLib.Error; - public override string get_string (string group, string key) throws GLib.Error; - public override GLib.Value get_value (string group, string key) throws GLib.Error; - public override void notify (string group, string key) throws GLib.Error; - public override void notify_add (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public override void notify_remove (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public override void remove () throws GLib.Error; - public override void reset () throws GLib.Error; - public override void set_bool (string group, string key, bool value) throws GLib.Error; - public override void set_float (string group, string key, float value) throws GLib.Error; - public override void set_int (string group, string key, int value) throws GLib.Error; - public override void set_list (string group, string key, GLib.ValueArray value) throws GLib.Error; - public override void set_string (string group, string key, string value) throws GLib.Error; - public override string name { owned get; } - } - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-cfg-keyfile.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-type-color.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-type-color.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-type-color.deps 2010-04-11 07:32:36.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-type-color.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -desktop-agnostic-cfg -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-type-color.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-type-color.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-type-color.h 2010-04-11 07:32:36.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-type-color.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* da-cfg-type-color.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_CFG_TYPE_COLOR_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_CFG_TYPE_COLOR_H__ - -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE (desktop_agnostic_config_color_type_get_type ()) -#define DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE, DesktopAgnosticConfigColorType)) -#define DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE, DesktopAgnosticConfigColorTypeClass)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_COLOR_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_IS_COLOR_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE)) -#define DESKTOP_AGNOSTIC_CONFIG_COLOR_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_COLOR_TYPE, DesktopAgnosticConfigColorTypeClass)) - -typedef struct _DesktopAgnosticConfigColorType DesktopAgnosticConfigColorType; -typedef struct _DesktopAgnosticConfigColorTypeClass DesktopAgnosticConfigColorTypeClass; -typedef struct _DesktopAgnosticConfigColorTypePrivate DesktopAgnosticConfigColorTypePrivate; - -struct _DesktopAgnosticConfigColorType { - DesktopAgnosticConfigSchemaType parent_instance; - DesktopAgnosticConfigColorTypePrivate * priv; -}; - -struct _DesktopAgnosticConfigColorTypeClass { - DesktopAgnosticConfigSchemaTypeClass parent_class; -}; - - -GType desktop_agnostic_config_color_type_get_type (void); -DesktopAgnosticConfigColorType* desktop_agnostic_config_color_type_new (void); -DesktopAgnosticConfigColorType* desktop_agnostic_config_color_type_construct (GType object_type); -void desktop_agnostic_config_color_to_string (GValue* src_value, GValue* dest_value); -void desktop_agnostic_config_string_to_color (GValue* src_value, GValue* dest_value); -GType register_plugin (void); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-type-color.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-type-color.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-cfg-type-color.vapi 2010-04-11 07:32:36.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-cfg-type-color.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -/* da-cfg-type-color.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] - namespace Config { - [CCode (cheader_filename = "libdesktop-agnostic/da-cfg-type-color.h")] - public class ColorType : DesktopAgnostic.Config.SchemaType { - public ColorType (); - public override GLib.Value deserialize (string serialized) throws DesktopAgnostic.Config.SchemaError; - public override GLib.ValueArray parse_default_list_value (GLib.KeyFile schema, string group) throws DesktopAgnostic.Config.SchemaError; - public override GLib.Value parse_default_value (GLib.KeyFile schema, string group) throws DesktopAgnostic.Config.SchemaError; - public override string serialize (GLib.Value val) throws DesktopAgnostic.Config.SchemaError; - public override string name { owned get; } - public override GLib.Type schema_type { get; } - } - [CCode (cheader_filename = "libdesktop-agnostic/da-cfg-type-color.h")] - public static void color_to_string (GLib.Value src_value, out GLib.Value dest_value); - [CCode (cheader_filename = "libdesktop-agnostic/da-cfg-type-color.h")] - public static void string_to_color (GLib.Value src_value, out GLib.Value dest_value); - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-cfg-type-color.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-glib.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-glib.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-glib.deps 2010-04-11 07:32:30.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-glib.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -desktop-agnostic-fdo -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-glib.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-glib.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-glib.h 2010-04-11 07:32:30.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-glib.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* da-fdo-glib.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_FDO_GLIB_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_FDO_GLIB_H__ - -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB (desktop_agnostic_fdo_desktop_entry_glib_get_type ()) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB, DesktopAgnosticFDODesktopEntryGLib)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB, DesktopAgnosticFDODesktopEntryGLibClass)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GLIB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GLIB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB, DesktopAgnosticFDODesktopEntryGLibClass)) - -typedef struct _DesktopAgnosticFDODesktopEntryGLib DesktopAgnosticFDODesktopEntryGLib; -typedef struct _DesktopAgnosticFDODesktopEntryGLibClass DesktopAgnosticFDODesktopEntryGLibClass; -typedef struct _DesktopAgnosticFDODesktopEntryGLibPrivate DesktopAgnosticFDODesktopEntryGLibPrivate; - -struct _DesktopAgnosticFDODesktopEntryGLib { - GObject parent_instance; - DesktopAgnosticFDODesktopEntryGLibPrivate * priv; -}; - -struct _DesktopAgnosticFDODesktopEntryGLibClass { - GObjectClass parent_class; -}; - - -GType desktop_agnostic_fdo_desktop_entry_glib_get_type (void); -DesktopAgnosticFDODesktopEntryGLib* desktop_agnostic_fdo_desktop_entry_glib_new (void); -DesktopAgnosticFDODesktopEntryGLib* desktop_agnostic_fdo_desktop_entry_glib_construct (GType object_type); -GType register_plugin (void); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-glib.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-glib.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-glib.vapi 2010-04-11 07:32:30.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-glib.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -/* da-fdo-glib.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticFDO", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticFDO", lower_case_cprefix = "desktop_agnostic_fdo_", gir_namespace = "DesktopAgnosticFDO", gir_version = "1.0")] - namespace FDO { - [CCode (cheader_filename = "libdesktop-agnostic/da-fdo-glib.h")] - public class DesktopEntryGLib : DesktopAgnostic.FDO.DesktopEntry, GLib.Object { - public DesktopEntryGLib (); - } - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-fdo-glib.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-gnome.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-gnome.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-gnome.deps 2010-04-11 07:32:28.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-gnome.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -gnome-desktop-2.0 -desktop-agnostic-fdo -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-gnome.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-gnome.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-gnome.h 2010-04-11 07:32:28.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-gnome.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* da-fdo-gnome.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_FDO_GNOME_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_FDO_GNOME_H__ - -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME (desktop_agnostic_fdo_desktop_entry_gnome_get_type ()) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME, DesktopAgnosticFDODesktopEntryGNOME)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME, DesktopAgnosticFDODesktopEntryGNOMEClass)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GNOME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GNOME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME, DesktopAgnosticFDODesktopEntryGNOMEClass)) - -typedef struct _DesktopAgnosticFDODesktopEntryGNOME DesktopAgnosticFDODesktopEntryGNOME; -typedef struct _DesktopAgnosticFDODesktopEntryGNOMEClass DesktopAgnosticFDODesktopEntryGNOMEClass; -typedef struct _DesktopAgnosticFDODesktopEntryGNOMEPrivate DesktopAgnosticFDODesktopEntryGNOMEPrivate; - -struct _DesktopAgnosticFDODesktopEntryGNOME { - GObject parent_instance; - DesktopAgnosticFDODesktopEntryGNOMEPrivate * priv; -}; - -struct _DesktopAgnosticFDODesktopEntryGNOMEClass { - GObjectClass parent_class; -}; - - -GType desktop_agnostic_fdo_desktop_entry_gnome_get_type (void); -DesktopAgnosticFDODesktopEntryGNOME* desktop_agnostic_fdo_desktop_entry_gnome_new (void); -DesktopAgnosticFDODesktopEntryGNOME* desktop_agnostic_fdo_desktop_entry_gnome_construct (GType object_type); -GType register_plugin (void); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-gnome.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-gnome.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-fdo-gnome.vapi 2010-04-11 07:32:28.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-fdo-gnome.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -/* da-fdo-gnome.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticFDO", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticFDO", lower_case_cprefix = "desktop_agnostic_fdo_", gir_namespace = "DesktopAgnosticFDO", gir_version = "1.0")] - namespace FDO { - [CCode (cheader_filename = "libdesktop-agnostic/da-fdo-gnome.h")] - public class DesktopEntryGNOME : DesktopAgnostic.FDO.DesktopEntry, GLib.Object { - public DesktopEntryGNOME (); - } - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-fdo-gnome.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-module-guesser.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-module-guesser.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-module-guesser.deps 2010-04-11 07:32:22.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-module-guesser.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-module-guesser.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-module-guesser.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-module-guesser.h 2010-04-11 07:32:22.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-module-guesser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -/* da-module-guesser.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_MODULE_GUESSER_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_MODULE_GUESSER_H__ - -#include -#include -#include -#include - -G_BEGIN_DECLS - - - -GType guess_module (DesktopAgnosticModuleLoader* loader, const char* library_prefix); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-module-guesser.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-module-guesser.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-module-guesser.vapi 2010-04-11 07:32:22.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-module-guesser.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -/* da-module-guesser.vapi generated by valac, do not modify. */ - -[CCode (cheader_filename = "libdesktop-agnostic/da-module-guesser.h")] -public static GLib.Type guess_module (DesktopAgnostic.ModuleLoader loader, string library_prefix); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gio.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gio.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gio.deps 2010-04-11 07:32:16.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gio.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -gio-2.0 -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gio.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gio.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gio.h 2010-04-11 07:32:16.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gio.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* da-vfs-gio.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_VFS_GIO_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_VFS_GIO_H__ - -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION (desktop_agnostic_vfs_gio_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION, DesktopAgnosticVFSGIOImplementation)) -#define DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION, DesktopAgnosticVFSGIOImplementationClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GIO_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IS_GIO_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION, DesktopAgnosticVFSGIOImplementationClass)) - -typedef struct _DesktopAgnosticVFSGIOImplementation DesktopAgnosticVFSGIOImplementation; -typedef struct _DesktopAgnosticVFSGIOImplementationClass DesktopAgnosticVFSGIOImplementationClass; -typedef struct _DesktopAgnosticVFSGIOImplementationPrivate DesktopAgnosticVFSGIOImplementationPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO (desktop_agnostic_vfs_file_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) - -typedef struct _DesktopAgnosticVFSFileGIO DesktopAgnosticVFSFileGIO; -typedef struct _DesktopAgnosticVFSFileGIOClass DesktopAgnosticVFSFileGIOClass; -typedef struct _DesktopAgnosticVFSFileGIOPrivate DesktopAgnosticVFSFileGIOPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO (desktop_agnostic_vfs_file_monitor_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGIO DesktopAgnosticVFSFileMonitorGIO; -typedef struct _DesktopAgnosticVFSFileMonitorGIOClass DesktopAgnosticVFSFileMonitorGIOClass; -typedef struct _DesktopAgnosticVFSFileMonitorGIOPrivate DesktopAgnosticVFSFileMonitorGIOPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO (desktop_agnostic_vfs_trash_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIO)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIOClass)) - -typedef struct _DesktopAgnosticVFSTrashGIO DesktopAgnosticVFSTrashGIO; -typedef struct _DesktopAgnosticVFSTrashGIOClass DesktopAgnosticVFSTrashGIOClass; -typedef struct _DesktopAgnosticVFSTrashGIOPrivate DesktopAgnosticVFSTrashGIOPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO (desktop_agnostic_vfs_volume_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIOClass)) - -typedef struct _DesktopAgnosticVFSVolumeGIO DesktopAgnosticVFSVolumeGIO; -typedef struct _DesktopAgnosticVFSVolumeGIOClass DesktopAgnosticVFSVolumeGIOClass; -typedef struct _DesktopAgnosticVFSVolumeGIOPrivate DesktopAgnosticVFSVolumeGIOPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO (desktop_agnostic_vfs_volume_monitor_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIOClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorGIO DesktopAgnosticVFSVolumeMonitorGIO; -typedef struct _DesktopAgnosticVFSVolumeMonitorGIOClass DesktopAgnosticVFSVolumeMonitorGIOClass; -typedef struct _DesktopAgnosticVFSVolumeMonitorGIOPrivate DesktopAgnosticVFSVolumeMonitorGIOPrivate; - -struct _DesktopAgnosticVFSGIOImplementation { - GObject parent_instance; - DesktopAgnosticVFSGIOImplementationPrivate * priv; -}; - -struct _DesktopAgnosticVFSGIOImplementationClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSFileGIO { - DesktopAgnosticVFSFile parent_instance; - DesktopAgnosticVFSFileGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileGIOClass { - DesktopAgnosticVFSFileClass parent_class; -}; - -struct _DesktopAgnosticVFSFileMonitorGIO { - GObject parent_instance; - DesktopAgnosticVFSFileMonitorGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileMonitorGIOClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSTrashGIO { - GObject parent_instance; - DesktopAgnosticVFSTrashGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSTrashGIOClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeGIO { - GObject parent_instance; - DesktopAgnosticVFSVolumeGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeGIOClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGIO { - GObject parent_instance; - DesktopAgnosticVFSVolumeMonitorGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGIOClass { - GObjectClass parent_class; -}; - - -GType desktop_agnostic_vfs_gio_implementation_get_type (void); -DesktopAgnosticVFSGIOImplementation* desktop_agnostic_vfs_gio_implementation_new (void); -DesktopAgnosticVFSGIOImplementation* desktop_agnostic_vfs_gio_implementation_construct (GType object_type); -GType register_plugin (void); -GType desktop_agnostic_vfs_file_gio_get_type (void); -DesktopAgnosticVFSFileGIO* desktop_agnostic_vfs_file_gio_new (void); -DesktopAgnosticVFSFileGIO* desktop_agnostic_vfs_file_gio_construct (GType object_type); -GType desktop_agnostic_vfs_file_monitor_gio_get_type (void); -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_new (DesktopAgnosticVFSFileGIO* file); -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_construct (GType object_type, DesktopAgnosticVFSFileGIO* file); -GType desktop_agnostic_vfs_trash_gio_get_type (void); -DesktopAgnosticVFSTrashGIO* desktop_agnostic_vfs_trash_gio_new (void); -DesktopAgnosticVFSTrashGIO* desktop_agnostic_vfs_trash_gio_construct (GType object_type); -GType desktop_agnostic_vfs_volume_gio_get_type (void); -DesktopAgnosticVFSVolumeGIO* desktop_agnostic_vfs_volume_gio_new (void); -DesktopAgnosticVFSVolumeGIO* desktop_agnostic_vfs_volume_gio_construct (GType object_type); -GType desktop_agnostic_vfs_volume_monitor_gio_get_type (void); -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_new (void); -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_construct (GType object_type); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gio.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gio.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gio.vapi 2010-04-11 07:32:16.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gio.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* da-vfs-gio.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] - namespace VFS { - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gio.h")] - public class FileGIO : DesktopAgnostic.VFS.File { - public FileGIO (); - public override bool copy (DesktopAgnostic.VFS.File destination, bool overwrite) throws GLib.Error; - public override GLib.SList enumerate_children () throws GLib.Error; - public override bool exists (); - protected override void init (string uri); - public override bool launch () throws GLib.Error; - public override bool load_contents (out string contents, out size_t length) throws GLib.Error; - public override DesktopAgnostic.VFS.FileMonitor monitor (); - public override bool remove () throws GLib.Error; - public override bool replace_contents (string contents) throws GLib.Error; - public override DesktopAgnostic.VFS.AccessFlags access_flags { get; } - public override DesktopAgnostic.VFS.FileType file_type { get; } - protected override string? impl_path { owned get; } - protected override string impl_uri { owned get; } - public override void* implementation { get; } - public override DesktopAgnostic.VFS.File? parent { owned get; } - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gio.h")] - public class FileMonitorGIO : GLib.Object, DesktopAgnostic.VFS.FileMonitor { - public FileMonitorGIO (DesktopAgnostic.VFS.FileGIO file); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gio.h")] - public class GIOImplementation : GLib.Object, DesktopAgnostic.VFS.Implementation { - public GIOImplementation (); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gio.h")] - public class TrashGIO : DesktopAgnostic.VFS.Trash, GLib.Object { - public TrashGIO (); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gio.h")] - public class VolumeGIO : GLib.Object, DesktopAgnostic.VFS.Volume { - public VolumeGIO (); - public GLib.Volume implementation { construct; } - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gio.h")] - public class VolumeMonitorGIO : GLib.Object, DesktopAgnostic.VFS.VolumeMonitor { - public VolumeMonitorGIO (); - } - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gio.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.deps 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -gnome-vfs-2.0 -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.h 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -/* da-vfs-gnome-vfs.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_VFS_GNOME_VFS_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_VFS_GNOME_VFS_H__ - -#include -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION (desktop_agnostic_vfs_gnome_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION, DesktopAgnosticVFSGnomeVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION, DesktopAgnosticVFSGnomeVFSImplementationClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GNOME_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IS_GNOME_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION, DesktopAgnosticVFSGnomeVFSImplementationClass)) - -typedef struct _DesktopAgnosticVFSGnomeVFSImplementation DesktopAgnosticVFSGnomeVFSImplementation; -typedef struct _DesktopAgnosticVFSGnomeVFSImplementationClass DesktopAgnosticVFSGnomeVFSImplementationClass; -typedef struct _DesktopAgnosticVFSGnomeVFSImplementationPrivate DesktopAgnosticVFSGnomeVFSImplementationPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS (desktop_agnostic_vfs_file_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileGnomeVFS DesktopAgnosticVFSFileGnomeVFS; -typedef struct _DesktopAgnosticVFSFileGnomeVFSClass DesktopAgnosticVFSFileGnomeVFSClass; -typedef struct _DesktopAgnosticVFSFileGnomeVFSPrivate DesktopAgnosticVFSFileGnomeVFSPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS (desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFS DesktopAgnosticVFSFileMonitorGnomeVFS; -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFSClass DesktopAgnosticVFSFileMonitorGnomeVFSClass; -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFSPrivate DesktopAgnosticVFSFileMonitorGnomeVFSPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS (desktop_agnostic_vfs_trash_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSTrashGnomeVFS DesktopAgnosticVFSTrashGnomeVFS; -typedef struct _DesktopAgnosticVFSTrashGnomeVFSClass DesktopAgnosticVFSTrashGnomeVFSClass; -typedef struct _DesktopAgnosticVFSTrashGnomeVFSPrivate DesktopAgnosticVFSTrashGnomeVFSPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME (desktop_agnostic_vfs_trash_volume_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, DesktopAgnosticVFSTrashVolume)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, DesktopAgnosticVFSTrashVolumeClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, DesktopAgnosticVFSTrashVolumeClass)) - -typedef struct _DesktopAgnosticVFSTrashVolume DesktopAgnosticVFSTrashVolume; -typedef struct _DesktopAgnosticVFSTrashVolumeClass DesktopAgnosticVFSTrashVolumeClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS (desktop_agnostic_vfs_volume_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeGnomeVFS DesktopAgnosticVFSVolumeGnomeVFS; -typedef struct _DesktopAgnosticVFSVolumeGnomeVFSClass DesktopAgnosticVFSVolumeGnomeVFSClass; -typedef struct _DesktopAgnosticVFSVolumeGnomeVFSPrivate DesktopAgnosticVFSVolumeGnomeVFSPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS (desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFS DesktopAgnosticVFSVolumeMonitorGnomeVFS; -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSClass DesktopAgnosticVFSVolumeMonitorGnomeVFSClass; -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate; - -struct _DesktopAgnosticVFSGnomeVFSImplementation { - GObject parent_instance; - DesktopAgnosticVFSGnomeVFSImplementationPrivate * priv; -}; - -struct _DesktopAgnosticVFSGnomeVFSImplementationClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSFileGnomeVFS { - DesktopAgnosticVFSFile parent_instance; - DesktopAgnosticVFSFileGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileGnomeVFSClass { - DesktopAgnosticVFSFileClass parent_class; -}; - -struct _DesktopAgnosticVFSFileMonitorGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSFileMonitorGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileMonitorGnomeVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSTrashGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSTrashGnomeVFSPrivate * priv; - GHashTable* trash_dirs; -}; - -struct _DesktopAgnosticVFSTrashGnomeVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeGnomeVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSClass { - GObjectClass parent_class; -}; - - -GType desktop_agnostic_vfs_gnome_vfs_implementation_get_type (void); -DesktopAgnosticVFSGnomeVFSImplementation* desktop_agnostic_vfs_gnome_vfs_implementation_new (void); -DesktopAgnosticVFSGnomeVFSImplementation* desktop_agnostic_vfs_gnome_vfs_implementation_construct (GType object_type); -GType register_plugin (void); -GType desktop_agnostic_vfs_file_gnome_vfs_get_type (void); -DesktopAgnosticVFSFileGnomeVFS* desktop_agnostic_vfs_file_gnome_vfs_new (void); -DesktopAgnosticVFSFileGnomeVFS* desktop_agnostic_vfs_file_gnome_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type (void); -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_new (DesktopAgnosticVFSFileGnomeVFS* file); -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_construct (GType object_type, DesktopAgnosticVFSFileGnomeVFS* file); -GType desktop_agnostic_vfs_trash_gnome_vfs_get_type (void); -GType desktop_agnostic_vfs_trash_volume_get_type (void); -DesktopAgnosticVFSTrashGnomeVFS* desktop_agnostic_vfs_trash_gnome_vfs_new (void); -DesktopAgnosticVFSTrashGnomeVFS* desktop_agnostic_vfs_trash_gnome_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_volume_gnome_vfs_get_type (void); -DesktopAgnosticVFSVolumeGnomeVFS* desktop_agnostic_vfs_volume_gnome_vfs_new (void); -DesktopAgnosticVFSVolumeGnomeVFS* desktop_agnostic_vfs_volume_gnome_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_type (void); -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_new (void); -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_construct (GType object_type); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.vapi 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* da-vfs-gnome-vfs.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] - namespace VFS { - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gnome-vfs.h")] - public class FileGnomeVFS : DesktopAgnostic.VFS.File { - public FileGnomeVFS (); - public override bool copy (DesktopAgnostic.VFS.File destination, bool overwrite) throws GLib.Error; - public override GLib.SList enumerate_children () throws GLib.Error; - public override bool exists (); - protected override void init (string uri); - public override bool launch () throws GLib.Error; - public override bool load_contents (out string contents, out size_t length) throws GLib.Error; - public override DesktopAgnostic.VFS.FileMonitor monitor (); - public override bool remove () throws GLib.Error; - public override bool replace_contents (string contents) throws GLib.Error; - public override DesktopAgnostic.VFS.AccessFlags access_flags { get; } - public override DesktopAgnostic.VFS.FileType file_type { get; } - protected override string? impl_path { owned get; } - protected override string impl_uri { owned get; } - public override void* implementation { get; } - public override DesktopAgnostic.VFS.File? parent { owned get; } - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gnome-vfs.h")] - public class FileMonitorGnomeVFS : GLib.Object, DesktopAgnostic.VFS.FileMonitor { - public FileMonitorGnomeVFS (DesktopAgnostic.VFS.FileGnomeVFS file); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gnome-vfs.h")] - public class GnomeVFSImplementation : GLib.Object, DesktopAgnostic.VFS.Implementation { - public GnomeVFSImplementation (); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gnome-vfs.h")] - public class TrashGnomeVFS : DesktopAgnostic.VFS.Trash, GLib.Object { - protected GLib.HashTable trash_dirs; - public TrashGnomeVFS (); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gnome-vfs.h")] - public class VolumeGnomeVFS : GLib.Object, DesktopAgnostic.VFS.Volume { - public VolumeGnomeVFS (); - public GnomeVFS.Drive implementation { construct; } - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gnome-vfs.h")] - public class VolumeMonitorGnomeVFS : GLib.Object, DesktopAgnostic.VFS.VolumeMonitor { - public VolumeMonitorGnomeVFS (); - } - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-vfs-gnome-vfs.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.deps 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -thunar-vfs-1 -dbus-glib-1 -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.h 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/* da-vfs-thunar-vfs.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_VFS_THUNAR_VFS_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_VFS_THUNAR_VFS_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION (desktop_agnostic_vfs_thunar_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION, DesktopAgnosticVFSThunarVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION, DesktopAgnosticVFSThunarVFSImplementationClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_THUNAR_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IS_THUNAR_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION, DesktopAgnosticVFSThunarVFSImplementationClass)) - -typedef struct _DesktopAgnosticVFSThunarVFSImplementation DesktopAgnosticVFSThunarVFSImplementation; -typedef struct _DesktopAgnosticVFSThunarVFSImplementationClass DesktopAgnosticVFSThunarVFSImplementationClass; -typedef struct _DesktopAgnosticVFSThunarVFSImplementationPrivate DesktopAgnosticVFSThunarVFSImplementationPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS (desktop_agnostic_vfs_file_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileThunarVFS DesktopAgnosticVFSFileThunarVFS; -typedef struct _DesktopAgnosticVFSFileThunarVFSClass DesktopAgnosticVFSFileThunarVFSClass; -typedef struct _DesktopAgnosticVFSFileThunarVFSPrivate DesktopAgnosticVFSFileThunarVFSPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS (desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFS DesktopAgnosticVFSFileMonitorThunarVFS; -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFSClass DesktopAgnosticVFSFileMonitorThunarVFSClass; -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFSPrivate DesktopAgnosticVFSFileMonitorThunarVFSPrivate; - -#define XFCE_TYPE_TRASH (xfce_trash_get_type ()) -#define XFCE_TRASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TRASH, XfceTrash)) -#define XFCE_IS_TRASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_TRASH)) -#define XFCE_TRASH_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), XFCE_TYPE_TRASH, XfceTrashIface)) - -typedef struct _XfceTrash XfceTrash; -typedef struct _XfceTrashIface XfceTrashIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS (desktop_agnostic_vfs_trash_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSTrashThunarVFS DesktopAgnosticVFSTrashThunarVFS; -typedef struct _DesktopAgnosticVFSTrashThunarVFSClass DesktopAgnosticVFSTrashThunarVFSClass; -typedef struct _DesktopAgnosticVFSTrashThunarVFSPrivate DesktopAgnosticVFSTrashThunarVFSPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS (desktop_agnostic_vfs_volume_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeThunarVFS DesktopAgnosticVFSVolumeThunarVFS; -typedef struct _DesktopAgnosticVFSVolumeThunarVFSClass DesktopAgnosticVFSVolumeThunarVFSClass; -typedef struct _DesktopAgnosticVFSVolumeThunarVFSPrivate DesktopAgnosticVFSVolumeThunarVFSPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS (desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFS DesktopAgnosticVFSVolumeMonitorThunarVFS; -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFSClass DesktopAgnosticVFSVolumeMonitorThunarVFSClass; -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate; - -struct _DesktopAgnosticVFSThunarVFSImplementation { - GObject parent_instance; - DesktopAgnosticVFSThunarVFSImplementationPrivate * priv; -}; - -struct _DesktopAgnosticVFSThunarVFSImplementationClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSFileThunarVFS { - DesktopAgnosticVFSFile parent_instance; - DesktopAgnosticVFSFileThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileThunarVFSClass { - DesktopAgnosticVFSFileClass parent_class; -}; - -struct _DesktopAgnosticVFSFileMonitorThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSFileMonitorThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileMonitorThunarVFSClass { - GObjectClass parent_class; -}; - -struct _XfceTrashIface { - GTypeInterface parent_iface; - void (*DisplayTrash) (XfceTrash* self, const char* display, GError** error); - void (*EmptyTrash) (XfceTrash* self, const char* display, GError** error); - void (*MoveToTrash) (XfceTrash* self, char** uris, int uris_length1, const char* display, GError** error); - gboolean (*QueryTrash) (XfceTrash* self, GError** error); -}; - -struct _DesktopAgnosticVFSTrashThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSTrashThunarVFSPrivate * priv; - ThunarVfsPath* trash; -}; - -struct _DesktopAgnosticVFSTrashThunarVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeThunarVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeMonitorThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeMonitorThunarVFSClass { - GObjectClass parent_class; -}; - - -GType desktop_agnostic_vfs_thunar_vfs_implementation_get_type (void); -DesktopAgnosticVFSThunarVFSImplementation* desktop_agnostic_vfs_thunar_vfs_implementation_new (void); -DesktopAgnosticVFSThunarVFSImplementation* desktop_agnostic_vfs_thunar_vfs_implementation_construct (GType object_type); -GType register_plugin (void); -GType desktop_agnostic_vfs_file_thunar_vfs_get_type (void); -DesktopAgnosticVFSFileThunarVFS* desktop_agnostic_vfs_file_thunar_vfs_new (void); -DesktopAgnosticVFSFileThunarVFS* desktop_agnostic_vfs_file_thunar_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type (void); -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_new (DesktopAgnosticVFSFileThunarVFS* file); -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_construct (GType object_type, DesktopAgnosticVFSFileThunarVFS* file); -GType xfce_trash_get_type (void); -void xfce_trash_DisplayTrash (XfceTrash* self, const char* display, GError** error); -void xfce_trash_EmptyTrash (XfceTrash* self, const char* display, GError** error); -void xfce_trash_MoveToTrash (XfceTrash* self, char** uris, int uris_length1, const char* display, GError** error); -gboolean xfce_trash_QueryTrash (XfceTrash* self, GError** error); -GType desktop_agnostic_vfs_trash_thunar_vfs_get_type (void); -DesktopAgnosticVFSTrashThunarVFS* desktop_agnostic_vfs_trash_thunar_vfs_new (void); -DesktopAgnosticVFSTrashThunarVFS* desktop_agnostic_vfs_trash_thunar_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_volume_thunar_vfs_get_type (void); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_new_for_implementation (ThunarVfsVolume* impl); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_construct_for_implementation (GType object_type, ThunarVfsVolume* impl); -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_mount (DesktopAgnosticVFSVolumeThunarVFS* self); -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_unmount (DesktopAgnosticVFSVolumeThunarVFS* self); -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_eject (DesktopAgnosticVFSVolumeThunarVFS* self); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_new (void); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_type (void); -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_new (void); -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_construct (GType object_type); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.vapi 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* da-vfs-thunar-vfs.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] - namespace VFS { - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] - public class FileMonitorThunarVFS : GLib.Object, DesktopAgnostic.VFS.FileMonitor { - public FileMonitorThunarVFS (DesktopAgnostic.VFS.FileThunarVFS file); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] - public class FileThunarVFS : DesktopAgnostic.VFS.File { - public FileThunarVFS (); - public override bool copy (DesktopAgnostic.VFS.File destination, bool overwrite) throws GLib.Error; - public override GLib.SList enumerate_children () throws GLib.Error; - public override bool exists (); - protected override void init (string uri); - public override bool launch () throws GLib.Error; - public override bool load_contents (out string contents, out size_t length) throws GLib.Error; - public override DesktopAgnostic.VFS.FileMonitor monitor (); - public override bool remove () throws GLib.Error; - public override bool replace_contents (string contents) throws GLib.Error; - public override DesktopAgnostic.VFS.FileType file_type { get; } - protected override string? impl_path { owned get; } - protected override string impl_uri { owned get; } - public override void* implementation { get; } - public override DesktopAgnostic.VFS.File? parent { owned get; } - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] - public class ThunarVFSImplementation : GLib.Object, DesktopAgnostic.VFS.Implementation { - public ThunarVFSImplementation (); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] - public class TrashThunarVFS : DesktopAgnostic.VFS.Trash, GLib.Object { - protected weak ThunarVfs.Path trash; - public TrashThunarVFS (); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] - public class VolumeMonitorThunarVFS : GLib.Object, DesktopAgnostic.VFS.VolumeMonitor { - public VolumeMonitorThunarVFS (); - } - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] - public class VolumeThunarVFS : GLib.Object, DesktopAgnostic.VFS.Volume { - public VolumeThunarVFS (); - public bool do_eject (); - public bool do_mount (); - public bool do_unmount (); - public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl); - public ThunarVfs.Volume implementation { construct; } - } - } -} -[CCode (cprefix = "Xfce", lower_case_cprefix = "xfce_")] -namespace Xfce { - [CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] - [DBus (name = "org.xfce.Trash")] - public interface Trash : DBus.Object { - public abstract void DisplayTrash (string display) throws DBus.Error; - public abstract void EmptyTrash (string display) throws DBus.Error; - public abstract void MoveToTrash (string[] uris, string display) throws DBus.Error; - public abstract bool QueryTrash () throws DBus.Error; - public signal void TrashChanged (bool full); - } -} -[CCode (cheader_filename = "libdesktop-agnostic/da-vfs-thunar-vfs.h")] -public static GLib.Type register_plugin (); diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnostic-1.0.gir libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnostic-1.0.gir --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnostic-1.0.gir 2010-04-11 07:32:10.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnostic-1.0.gir 1970-01-01 00:00:00.000000000 +0000 @@ -1,240 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.deps 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.vapi 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -/* desktop-agnostic-cfg.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_", gir_namespace = "DesktopAgnosticConfig", gir_version = "1.0")] - namespace Config { - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public abstract class Backend : GLib.Object { - public Backend (); - public static unowned GLib.HashTable get_backend_metadata_keys (); - public abstract bool get_bool (string group, string key) throws GLib.Error; - public abstract float get_float (string group, string key) throws GLib.Error; - public static float get_float_from_value (GLib.Value value) throws DesktopAgnostic.Config.Error; - public abstract int get_int (string group, string key) throws GLib.Error; - public static int get_int_from_value (GLib.Value value) throws DesktopAgnostic.Config.Error; - public abstract GLib.ValueArray get_list (string group, string key) throws GLib.Error; - public abstract string get_string (string group, string key) throws GLib.Error; - public abstract GLib.Value get_value (string group, string key) throws GLib.Error; - public abstract void notify (string group, string key) throws GLib.Error; - public abstract void notify_add (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public abstract void notify_remove (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public abstract void remove () throws GLib.Error; - public abstract void reset () throws GLib.Error; - public abstract void set_bool (string group, string key, bool value) throws GLib.Error; - public abstract void set_float (string group, string key, float value) throws GLib.Error; - public abstract void set_int (string group, string key, int value) throws GLib.Error; - public abstract void set_list (string group, string key, GLib.ValueArray value) throws GLib.Error; - public abstract void set_string (string group, string key, string value) throws GLib.Error; - public virtual void set_value (string group, string key, GLib.Value value) throws GLib.Error; - public string? instance_id { get; construct; } - public abstract string name { owned get; } - public DesktopAgnostic.Config.Schema? schema { get; construct; } - } - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public class Bridge : GLib.Object { - public void bind (DesktopAgnostic.Config.Backend config, string group, string key, GLib.Object obj, string property_name, bool read_only) throws GLib.Error; - public GLib.Datalist get_all_bindings (); - public static unowned DesktopAgnostic.Config.Bridge get_default (); - public static unowned GLib.ParamSpec? get_property_spec (GLib.Object obj, string property_name); - public void remove (DesktopAgnostic.Config.Backend config, string group, string key, GLib.Object obj, string property_name) throws GLib.Error; - public void remove_all_for_object (DesktopAgnostic.Config.Backend? config, GLib.Object obj) throws GLib.Error; - } - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public class Client : GLib.Object { - public Client (string schema_filename); - public void bind (string group, string key, GLib.Object obj, string property_name, bool read_only, DesktopAgnostic.Config.BindMethod method) throws DesktopAgnostic.Config.Error; - public Client.for_instance (string schema_filename, string instance_id) throws GLib.Error; - public Client.for_schema (DesktopAgnostic.Config.Schema schema, string? instance_id) throws GLib.Error; - public bool get_bool (string group, string key) throws GLib.Error; - public float get_float (string group, string key) throws GLib.Error; - public int get_int (string group, string key) throws GLib.Error; - public GLib.ValueArray get_list (string group, string key) throws GLib.Error; - public string get_string (string group, string key) throws GLib.Error; - public GLib.Value get_value (string group, string key) throws GLib.Error; - public void notify (string group, string key) throws GLib.Error; - public void notify_add (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public void notify_remove (string group, string key, DesktopAgnostic.Config.NotifyFunc callback) throws GLib.Error; - public void remove_instance (); - public void reset (bool instance_only) throws GLib.Error; - public void set_bool (string group, string key, bool value) throws GLib.Error; - public void set_float (string group, string key, float value) throws GLib.Error; - public void set_int (string group, string key, int value) throws GLib.Error; - public void set_list (string group, string key, GLib.ValueArray value) throws GLib.Error; - public void set_string (string group, string key, string value) throws GLib.Error; - public void set_value (string group, string key, GLib.Value value) throws GLib.Error; - public void unbind (string group, string key, GLib.Object obj, string property_name, bool read_only, DesktopAgnostic.Config.BindMethod method) throws DesktopAgnostic.Config.Error; - public void unbind_all_for_object (GLib.Object obj) throws GLib.Error; - public string? instance_id { get; construct; } - public string schema_filename { construct; } - } - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public class Schema : GLib.Object { - public Schema (string filename) throws GLib.Error; - public bool exists (string group, string key); - public static unowned DesktopAgnostic.Config.SchemaType? find_type (GLib.Type type); - public static unowned DesktopAgnostic.Config.SchemaType? find_type_by_name (string name); - public GLib.List? get_groups (); - public unowned GLib.List? get_keys (string group); - public GLib.Value? get_metadata_option (string name) throws DesktopAgnostic.Config.SchemaError; - public unowned DesktopAgnostic.Config.SchemaOption get_option (string group, string key); - public static void register_type (DesktopAgnostic.Config.SchemaType st) throws DesktopAgnostic.Config.SchemaError; - public string app_name { get; set; } - public string filename { construct; } - } - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public class SchemaOption : GLib.Object { - public SchemaOption (ref GLib.KeyFile schema, string group, string key) throws GLib.Error; - public GLib.ValueArray? blacklist { owned get; } - public GLib.Value default_value { get; set; } - public string description { get; set; } - public GLib.Type list_type { get; set; } - public GLib.Value? lower_boundary { get; set; } - public GLib.Type option_type { get; set; } - public bool per_instance { get; set; } - public string? summary { get; set; } - public GLib.Value? upper_boundary { get; set; } - public GLib.ValueArray? whitelist { owned get; } - } - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public abstract class SchemaType : GLib.Object { - public SchemaType (); - public abstract GLib.Value deserialize (string serialized) throws DesktopAgnostic.Config.SchemaError; - public abstract GLib.ValueArray parse_default_list_value (GLib.KeyFile schema, string group) throws DesktopAgnostic.Config.SchemaError; - public abstract GLib.Value parse_default_value (GLib.KeyFile schema, string group) throws DesktopAgnostic.Config.SchemaError; - public abstract string serialize (GLib.Value val) throws DesktopAgnostic.Config.SchemaError; - public abstract string name { owned get; } - public abstract GLib.Type schema_type { get; } - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_", cheader_filename = "libdesktop-agnostic/config.h")] - public enum BindMethod { - GLOBAL, - INSTANCE, - FALLBACK, - BOTH - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_CONFIG_ERROR_", cheader_filename = "libdesktop-agnostic/config.h")] - public errordomain Error { - NO_SCHEMA, - INVALID_TYPE, - KEY_NOT_FOUND, - METADATA_NOT_FOUND, - NOTIFY, - DUPLICATE_BINDING, - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_", cheader_filename = "libdesktop-agnostic/config.h")] - public errordomain SchemaError { - PARSE, - INVALID_METADATA_OPTION, - INVALID_METADATA_TYPE, - INVALID_TYPE, - INVALID_LIST_TYPE, - TYPE_NAME_EXISTS, - TYPE_GTYPE_EXISTS, - } - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public delegate void NotifyFunc (string group, string key, GLib.Value value); - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public const string GROUP_DEFAULT; - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public static GLib.Type get_type () throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public static DesktopAgnostic.Config.Backend? @new (DesktopAgnostic.Config.Schema schema) throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/config.h")] - public static DesktopAgnostic.Config.Backend? new_for_instance (string instance_id, DesktopAgnostic.Config.Schema schema) throws GLib.Error; - } -} diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticConfig-1.0.gir libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticConfig-1.0.gir --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticConfig-1.0.gir 2010-04-11 07:32:23.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticConfig-1.0.gir 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - - - - - - - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic.deps 2010-04-11 07:32:10.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -gdk-2.0 -gmodule-2.0 diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticFDO-1.0.gir libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticFDO-1.0.gir --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticFDO-1.0.gir 2010-04-11 07:32:15.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticFDO-1.0.gir 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.deps 2010-04-11 07:32:15.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.vapi 2010-04-11 07:32:15.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/* desktop-agnostic-fdo.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticFDO", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticFDO", lower_case_cprefix = "desktop_agnostic_fdo_", gir_namespace = "DesktopAgnosticFDO", gir_version = "1.0")] - namespace FDO { - [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] - public interface DesktopEntry : GLib.Object { - public abstract bool exists (); - public abstract bool get_boolean (string key); - public abstract string? get_localestring (string key, string? locale); - public abstract string? get_string (string key); - [CCode (array_length = false, array_null_terminated = true)] - public abstract string[]? get_string_list (string key); - public abstract bool key_exists (string key); - public abstract GLib.Pid launch (DesktopAgnostic.FDO.DesktopEntryLaunchFlags flags, GLib.SList? documents) throws GLib.Error; - public abstract void save (DesktopAgnostic.VFS.File? new_file) throws GLib.Error; - public abstract void set_boolean (string key, bool value); - public abstract void set_localestring (string key, string locale, string value); - public abstract void set_string (string key, string value); - public abstract void set_string_list (string key, [CCode (array_length = false)] string[] value); - public abstract string data { set construct; } - public abstract DesktopAgnostic.FDO.DesktopEntryType entry_type { get; set; } - public abstract DesktopAgnostic.VFS.File? file { get; set construct; } - public abstract string? icon { owned get; set; } - public abstract GLib.KeyFile keyfile { get; set construct; } - public abstract string name { owned get; set; } - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_", cheader_filename = "libdesktop-agnostic/fdo.h")] - public enum DesktopEntryLaunchFlags { - ONLY_ONE, - USE_CWD, - DO_NOT_REAP_CHILD - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_", cheader_filename = "libdesktop-agnostic/fdo.h")] - public enum DesktopEntryType { - UNKNOWN, - APPLICATION, - LINK, - DIRECTORY - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_", cheader_filename = "libdesktop-agnostic/fdo.h")] - public errordomain DesktopEntryError { - INVALID_FILE, - NOT_LAUNCHABLE, - } - [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] - public static DesktopAgnostic.FDO.DesktopEntry? desktop_entry_new () throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] - public static DesktopAgnostic.FDO.DesktopEntry? desktop_entry_new_for_data (string data) throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] - public static DesktopAgnostic.FDO.DesktopEntry? desktop_entry_new_for_file (DesktopAgnostic.VFS.File file) throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] - public static DesktopAgnostic.FDO.DesktopEntry? desktop_entry_new_for_keyfile (GLib.KeyFile keyfile) throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] - public static string desktop_entry_type_to_string (DesktopAgnostic.FDO.DesktopEntryType entry_type); - [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] - public static GLib.Type get_type () throws GLib.Error; - } -} diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic.h 2010-04-11 07:32:10.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/* desktop-agnostic.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DESKTOP_AGNOSTIC_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_DESKTOP_AGNOSTIC_H__ - -#include -#include -#include -#include -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_TYPE_COLOR (desktop_agnostic_color_get_type ()) -#define DESKTOP_AGNOSTIC_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColor)) -#define DESKTOP_AGNOSTIC_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColorClass)) -#define DESKTOP_AGNOSTIC_IS_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR)) -#define DESKTOP_AGNOSTIC_IS_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_TYPE_COLOR)) -#define DESKTOP_AGNOSTIC_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColorClass)) - -typedef struct _DesktopAgnosticColor DesktopAgnosticColor; -typedef struct _DesktopAgnosticColorClass DesktopAgnosticColorClass; -typedef struct _DesktopAgnosticColorPrivate DesktopAgnosticColorPrivate; - -#define DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER (desktop_agnostic_module_loader_get_type ()) -#define DESKTOP_AGNOSTIC_MODULE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER, DesktopAgnosticModuleLoader)) -#define DESKTOP_AGNOSTIC_MODULE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER, DesktopAgnosticModuleLoaderClass)) -#define DESKTOP_AGNOSTIC_IS_MODULE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER)) -#define DESKTOP_AGNOSTIC_IS_MODULE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER)) -#define DESKTOP_AGNOSTIC_MODULE_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER, DesktopAgnosticModuleLoaderClass)) - -typedef struct _DesktopAgnosticModuleLoader DesktopAgnosticModuleLoader; -typedef struct _DesktopAgnosticModuleLoaderClass DesktopAgnosticModuleLoaderClass; -typedef struct _DesktopAgnosticModuleLoaderPrivate DesktopAgnosticModuleLoaderPrivate; - -typedef enum { - DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_INPUT, - DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_ALPHA -} DesktopAgnosticColorParseError; -#define DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR desktop_agnostic_color_parse_error_quark () -struct _DesktopAgnosticColor { - GObject parent_instance; - DesktopAgnosticColorPrivate * priv; -}; - -struct _DesktopAgnosticColorClass { - GObjectClass parent_class; -}; - -typedef enum { - DESKTOP_AGNOSTIC_MODULE_ERROR_NO_GMODULE -} DesktopAgnosticModuleError; -#define DESKTOP_AGNOSTIC_MODULE_ERROR desktop_agnostic_module_error_quark () -struct _DesktopAgnosticModuleLoader { - GObject parent_instance; - DesktopAgnosticModuleLoaderPrivate * priv; -}; - -struct _DesktopAgnosticModuleLoaderClass { - GObjectClass parent_class; -}; - - -GQuark desktop_agnostic_color_parse_error_quark (void); -GType desktop_agnostic_color_get_type (void); -DesktopAgnosticColor* desktop_agnostic_color_new (GdkColor* color, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_construct (GType object_type, GdkColor* color, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_new_from_values (gushort red, gushort green, gushort blue, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_construct_from_values (GType object_type, gushort red, gushort green, gushort blue, gushort alpha); -DesktopAgnosticColor* desktop_agnostic_color_new_from_string (const char* spec, GError** error); -DesktopAgnosticColor* desktop_agnostic_color_construct_from_string (GType object_type, const char* spec, GError** error); -char* desktop_agnostic_color_to_html_color (DesktopAgnosticColor* self); -char* desktop_agnostic_color_to_string (DesktopAgnosticColor* self); -void desktop_agnostic_color_get_cairo_color (DesktopAgnosticColor* self, double* red, double* green, double* blue, double* alpha); -void desktop_agnostic_color_set_cairo_color (DesktopAgnosticColor* self, double red, double green, double blue, double alpha); -gushort desktop_agnostic_color_cairo_value_to_gdk (double value); -double desktop_agnostic_color_gdk_value_to_cairo (gushort value); -void desktop_agnostic_color_get_color (DesktopAgnosticColor* self, GdkColor* result); -void desktop_agnostic_color_set_color (DesktopAgnosticColor* self, GdkColor* value); -guint desktop_agnostic_color_get_red (DesktopAgnosticColor* self); -void desktop_agnostic_color_set_red (DesktopAgnosticColor* self, guint value); -guint desktop_agnostic_color_get_green (DesktopAgnosticColor* self); -void desktop_agnostic_color_set_green (DesktopAgnosticColor* self, guint value); -guint desktop_agnostic_color_get_blue (DesktopAgnosticColor* self); -void desktop_agnostic_color_set_blue (DesktopAgnosticColor* self, guint value); -guint desktop_agnostic_color_get_alpha (DesktopAgnosticColor* self); -void desktop_agnostic_color_set_alpha (DesktopAgnosticColor* self, guint value); -GQuark desktop_agnostic_module_error_quark (void); -GType desktop_agnostic_module_loader_get_type (void); -DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_get_default (void); -char** desktop_agnostic_module_loader_get_search_paths (int* result_length1); -GType desktop_agnostic_module_loader_load_from_path (DesktopAgnosticModuleLoader* self, const char* name, const char* path); -GType desktop_agnostic_module_loader_load (DesktopAgnosticModuleLoader* self, const char* name); -gboolean desktop_agnostic_module_loader_is_guess_module_loaded (DesktopAgnosticModuleLoader* self); -GType desktop_agnostic_module_loader_guess_module (DesktopAgnosticModuleLoader* self, const char* library_prefix); -GType desktop_agnostic_get_module_type (const char* prefix, const char* key, GError** error); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticUI-1.0.gir libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticUI-1.0.gir --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticUI-1.0.gir 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticUI-1.0.gir 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - - - - - - - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-ui.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-ui.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-ui.deps 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-ui.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -desktop-agnostic-fdo -gtk+-2.0 -desktop-agnostic-vfs -desktop-agnostic diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-ui.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-ui.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-ui.vapi 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-ui.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* desktop-agnostic-ui.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticUI", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticUI", lower_case_cprefix = "desktop_agnostic_ui_", gir_namespace = "DesktopAgnosticUI", gir_version = "1.0")] - namespace UI { - [CCode (cheader_filename = "libdesktop-agnostic/ui.h")] - public class ColorButton : Gtk.ColorButton { - public ColorButton (); - public void set_alpha (uint16 alpha); - public void set_color (Gdk.Color color); - public ColorButton.with_color (DesktopAgnostic.Color color); - public DesktopAgnostic.Color da_color { get; set; } - } - [CCode (cheader_filename = "libdesktop-agnostic/ui.h")] - public class IconButton : Gtk.Button { - public IconButton (string icon); - public string icon { get; set; } - public DesktopAgnostic.UI.IconType icon_type { get; } - public signal void icon_selected (); - } - [CCode (cheader_filename = "libdesktop-agnostic/ui.h")] - public class IconChooserDialog : Gtk.Dialog { - public IconChooserDialog (); - public string selected_icon { get; set; } - public DesktopAgnostic.UI.IconType selected_icon_type { get; set; } - public Gdk.Pixbuf selected_pixbuf { get; set; } - public signal void icon_selected (); - } - [CCode (cheader_filename = "libdesktop-agnostic/ui.h")] - public class LauncherEditorDialog : Gtk.Dialog { - public LauncherEditorDialog (DesktopAgnostic.VFS.File file, DesktopAgnostic.VFS.File? output, bool standalone); - public DesktopAgnostic.VFS.File file { get; construct; } - public DesktopAgnostic.VFS.File? output { get; construct; } - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_UI_ICON_TYPE_", cheader_filename = "libdesktop-agnostic/ui.h")] - public enum IconType { - NONE, - THEMED, - FILE - } - } -} diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic.vapi 2010-04-11 07:32:10.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* desktop-agnostic.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnostic", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cheader_filename = "libdesktop-agnostic/desktop-agnostic.h")] - public class Color : GLib.Object { - public Color (Gdk.Color color, ushort alpha); - public static ushort cairo_value_to_gdk (double value); - public Color.from_string (string spec) throws DesktopAgnostic.ColorParseError; - public Color.from_values (ushort red, ushort green, ushort blue, ushort alpha); - public static double gdk_value_to_cairo (ushort value); - public void get_cairo_color (out double red = null, out double green = null, out double blue = null, out double alpha = null); - public void set_cairo_color (double red, double green, double blue, double alpha); - public string to_html_color (); - public string to_string (); - public uint alpha { get; set; } - public uint blue { get; set; } - public Gdk.Color color { get; set; } - public uint green { get; set; } - public uint red { get; set; } - } - [CCode (cheader_filename = "libdesktop-agnostic/desktop-agnostic.h")] - public class ModuleLoader : GLib.Object { - public static unowned DesktopAgnostic.ModuleLoader get_default (); - public static string[] get_search_paths (); - public GLib.Type guess_module (string library_prefix); - public bool is_guess_module_loaded (); - public GLib.Type load (string name); - public GLib.Type load_from_path (string name, string path); - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_", cheader_filename = "libdesktop-agnostic/desktop-agnostic.h")] - public errordomain ColorParseError { - INVALID_INPUT, - INVALID_ALPHA, - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_MODULE_ERROR_", cheader_filename = "libdesktop-agnostic/desktop-agnostic.h")] - public errordomain ModuleError { - NO_GMODULE, - } - [CCode (cheader_filename = "libdesktop-agnostic/desktop-agnostic.h")] - public static GLib.Type get_module_type (string prefix, string key) throws GLib.Error; -} diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticVFS-1.0.gir libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticVFS-1.0.gir --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/DesktopAgnosticVFS-1.0.gir 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/DesktopAgnosticVFS-1.0.gir 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.deps libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.deps --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.deps 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -desktop-agnostic -posix diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.vapi libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.vapi --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.vapi 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,165 +0,0 @@ -/* desktop-agnostic-vfs.vapi generated by valac, do not modify. */ - -[CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] -namespace DesktopAgnostic { - [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_", gir_namespace = "DesktopAgnosticVFS", gir_version = "1.0")] - namespace VFS { - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public class Bookmark : GLib.Object { - public Bookmark (); - public string? alias { get; set; } - public DesktopAgnostic.VFS.File file { get; set; } - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public abstract class File : GLib.Object { - public File (); - public abstract bool copy (DesktopAgnostic.VFS.File destination, bool overwrite) throws GLib.Error; - public abstract GLib.SList enumerate_children () throws GLib.Error; - public abstract bool exists (); - protected abstract void init (string uri); - public bool is_executable (); - public bool is_readable (); - public bool is_writable (); - public abstract bool launch () throws GLib.Error; - public abstract bool load_contents (out string contents, out size_t length) throws GLib.Error; - public abstract DesktopAgnostic.VFS.FileMonitor monitor (); - public abstract bool remove () throws GLib.Error; - public abstract bool replace_contents (string contents) throws GLib.Error; - public abstract DesktopAgnostic.VFS.AccessFlags access_flags { get; } - public abstract DesktopAgnostic.VFS.FileType file_type { get; } - protected abstract string? impl_path { owned get; } - protected abstract string impl_uri { owned get; } - public abstract void* implementation { get; } - public abstract DesktopAgnostic.VFS.File? parent { owned get; } - public string? path { owned get; construct; } - public string uri { owned get; construct; } - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public class Glob : GLib.Object { - public Glob (); - public void append (string pattern) throws DesktopAgnostic.VFS.GlobError; - public static DesktopAgnostic.VFS.Glob execute (string pattern) throws DesktopAgnostic.VFS.GlobError; - public static DesktopAgnostic.VFS.Glob execute_with_flags (string pattern, int flags) throws DesktopAgnostic.VFS.GlobError; - public unowned string[]? get_paths (); - public int flags { get; set; } - public size_t offset { get; } - public string pattern { get; set; } - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public class GtkBookmarks : GLib.Object { - public GtkBookmarks (DesktopAgnostic.VFS.File? file = null, bool monitor = true); - public GLib.SList? bookmarks { get; } - public DesktopAgnostic.VFS.File? file { construct; } - public signal void changed (); - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public interface FileMonitor : GLib.Object { - public abstract bool cancel (); - public abstract void emit (DesktopAgnostic.VFS.File? other, DesktopAgnostic.VFS.FileMonitorEvent event); - public abstract bool cancelled { get; } - public signal void changed (DesktopAgnostic.VFS.File file, DesktopAgnostic.VFS.File? other, DesktopAgnostic.VFS.FileMonitorEvent event); - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public interface Implementation : GLib.Object { - public abstract GLib.SList files_from_uri_list (string uri_list) throws GLib.Error; - public abstract void init (); - public abstract void shutdown (); - public abstract unowned DesktopAgnostic.VFS.VolumeMonitor volume_monitor_get_default (); - public abstract GLib.Type file_monitor_type { get; } - public abstract GLib.Type file_type { get; } - public abstract string name { get; } - public abstract GLib.Type trash_type { get; } - public abstract GLib.Type volume_type { get; } - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public interface Trash : GLib.Object { - public abstract void empty (); - public abstract void send_to_trash (DesktopAgnostic.VFS.File file) throws GLib.Error; - public abstract uint file_count { get; } - public signal void file_count_changed (); - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public interface Volume : GLib.Object { - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public delegate void Callback (); - public abstract bool can_eject (); - public abstract void eject (DesktopAgnostic.VFS.Volume.Callback callback); - public abstract bool eject_finish () throws DesktopAgnostic.VFS.VolumeError; - public abstract bool is_mounted (); - public abstract void mount (DesktopAgnostic.VFS.Volume.Callback callback); - public abstract bool mount_finish () throws DesktopAgnostic.VFS.VolumeError; - public abstract void unmount (DesktopAgnostic.VFS.Volume.Callback callback); - public abstract bool unmount_finish () throws DesktopAgnostic.VFS.VolumeError; - public abstract string? icon { owned get; } - public abstract string name { get; } - public abstract DesktopAgnostic.VFS.File uri { get; } - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public interface VolumeMonitor : GLib.Object { - public abstract void* implementation { get; } - public abstract GLib.List volumes { owned get; } - public signal void volume_mounted (DesktopAgnostic.VFS.Volume volume); - public signal void volume_unmounted (DesktopAgnostic.VFS.Volume volume); - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_", cheader_filename = "libdesktop-agnostic/vfs.h")] - public enum AccessFlags { - NONE, - READ, - WRITE, - EXECUTE - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_", cheader_filename = "libdesktop-agnostic/vfs.h")] - public enum FileMonitorEvent { - UNKNOWN, - CHANGED, - CREATED, - DELETED, - ATTRIBUTE_CHANGED - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_", cheader_filename = "libdesktop-agnostic/vfs.h")] - public enum FileType { - UNKNOWN, - REGULAR, - DIRECTORY, - SYMBOLIC_LINK, - SPECIAL - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_VFS_FILE_ERROR_", cheader_filename = "libdesktop-agnostic/vfs.h")] - public errordomain FileError { - FILE_NOT_FOUND, - EXISTS, - INVALID_TYPE, - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_", cheader_filename = "libdesktop-agnostic/vfs.h")] - public errordomain GlobError { - NOSPACE, - ABORTED, - NOMATCH, - BAD_PATTERN, - BAD_FLAGS, - ERRNO, - } - [CCode (cprefix = "DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_", cheader_filename = "libdesktop-agnostic/vfs.h")] - public errordomain VolumeError { - MOUNT, - UNMOUNT, - EJECT, - } - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static DesktopAgnostic.VFS.File? file_new_for_path (string path) throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static DesktopAgnostic.VFS.File? file_new_for_uri (string uri) throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static GLib.SList? files_from_uri_list (string uri_list) throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static unowned DesktopAgnostic.VFS.Implementation? get_default () throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static void init () throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static void shutdown () throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static unowned DesktopAgnostic.VFS.Trash trash_get_default () throws GLib.Error; - [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] - public static unowned DesktopAgnostic.VFS.VolumeMonitor? volume_monitor_get_default () throws GLib.Error; - } -} diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-entry.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-entry.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-entry.c 2010-04-11 07:32:15.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-entry.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,443 +0,0 @@ -/* desktop-entry.c generated by valac, the Vala compiler - * generated from desktop-entry.vala, do not modify */ - -/* - * Desktop Agnostic Library: Desktop Entry interface. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_LAUNCH_FLAGS (desktop_agnostic_fdo_desktop_entry_launch_flags_get_type ()) - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_TYPE (desktop_agnostic_fdo_desktop_entry_type_get_type ()) - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY (desktop_agnostic_fdo_desktop_entry_get_type ()) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY, DesktopAgnosticFDODesktopEntry)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY, DesktopAgnosticFDODesktopEntryIface)) - -typedef struct _DesktopAgnosticFDODesktopEntry DesktopAgnosticFDODesktopEntry; -typedef struct _DesktopAgnosticFDODesktopEntryIface DesktopAgnosticFDODesktopEntryIface; -#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL))) - -typedef enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_ONLY_ONE = 1 << 0, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_USE_CWD = 1 << 1, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_DO_NOT_REAP_CHILD = 1 << 2 -} DesktopAgnosticFDODesktopEntryLaunchFlags; - -typedef enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN = 0, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY -} DesktopAgnosticFDODesktopEntryType; - -typedef enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_INVALID_FILE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE -} DesktopAgnosticFDODesktopEntryError; -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR desktop_agnostic_fdo_desktop_entry_error_quark () -struct _DesktopAgnosticFDODesktopEntryIface { - GTypeInterface parent_iface; - gboolean (*key_exists) (DesktopAgnosticFDODesktopEntry* self, const char* key); - gboolean (*get_boolean) (DesktopAgnosticFDODesktopEntry* self, const char* key); - void (*set_boolean) (DesktopAgnosticFDODesktopEntry* self, const char* key, gboolean value); - char* (*get_string) (DesktopAgnosticFDODesktopEntry* self, const char* key); - void (*set_string) (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* value); - char* (*get_localestring) (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale); - void (*set_localestring) (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale, const char* value); - char** (*get_string_list) (DesktopAgnosticFDODesktopEntry* self, const char* key); - void (*set_string_list) (DesktopAgnosticFDODesktopEntry* self, const char* key, char** value); - gboolean (*exists) (DesktopAgnosticFDODesktopEntry* self); - GPid (*launch) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); - void (*save) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* new_file, GError** error); - DesktopAgnosticVFSFile* (*get_file) (DesktopAgnosticFDODesktopEntry* self); - void (*set_file) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* value); - GKeyFile* (*get_keyfile) (DesktopAgnosticFDODesktopEntry* self); - void (*set_keyfile) (DesktopAgnosticFDODesktopEntry* self, GKeyFile* value); - void (*set_data) (DesktopAgnosticFDODesktopEntry* self, const char* value); - DesktopAgnosticFDODesktopEntryType (*get_entry_type) (DesktopAgnosticFDODesktopEntry* self); - void (*set_entry_type) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryType value); - char* (*get_name) (DesktopAgnosticFDODesktopEntry* self); - void (*set_name) (DesktopAgnosticFDODesktopEntry* self, const char* value); - char* (*get_icon) (DesktopAgnosticFDODesktopEntry* self); - void (*set_icon) (DesktopAgnosticFDODesktopEntry* self, const char* value); -}; - - -extern GType* desktop_agnostic_fdo_module_type; -GType* desktop_agnostic_fdo_module_type = NULL; - -GType desktop_agnostic_fdo_desktop_entry_launch_flags_get_type (void); -GType desktop_agnostic_fdo_desktop_entry_type_get_type (void); -GQuark desktop_agnostic_fdo_desktop_entry_error_quark (void); -char* desktop_agnostic_fdo_desktop_entry_type_to_string (DesktopAgnosticFDODesktopEntryType entry_type); -GType desktop_agnostic_fdo_desktop_entry_get_type (void); -gboolean desktop_agnostic_fdo_desktop_entry_key_exists (DesktopAgnosticFDODesktopEntry* self, const char* key); -gboolean desktop_agnostic_fdo_desktop_entry_get_boolean (DesktopAgnosticFDODesktopEntry* self, const char* key); -void desktop_agnostic_fdo_desktop_entry_set_boolean (DesktopAgnosticFDODesktopEntry* self, const char* key, gboolean value); -char* desktop_agnostic_fdo_desktop_entry_get_string (DesktopAgnosticFDODesktopEntry* self, const char* key); -void desktop_agnostic_fdo_desktop_entry_set_string (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* value); -char* desktop_agnostic_fdo_desktop_entry_get_localestring (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale); -void desktop_agnostic_fdo_desktop_entry_set_localestring (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale, const char* value); -char** desktop_agnostic_fdo_desktop_entry_get_string_list (DesktopAgnosticFDODesktopEntry* self, const char* key); -void desktop_agnostic_fdo_desktop_entry_set_string_list (DesktopAgnosticFDODesktopEntry* self, const char* key, char** value); -gboolean desktop_agnostic_fdo_desktop_entry_exists (DesktopAgnosticFDODesktopEntry* self); -GPid desktop_agnostic_fdo_desktop_entry_launch (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); -void desktop_agnostic_fdo_desktop_entry_save (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* new_file, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_fdo_desktop_entry_get_file (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_file (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* value); -GKeyFile* desktop_agnostic_fdo_desktop_entry_get_keyfile (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_keyfile (DesktopAgnosticFDODesktopEntry* self, GKeyFile* value); -void desktop_agnostic_fdo_desktop_entry_set_data (DesktopAgnosticFDODesktopEntry* self, const char* value); -DesktopAgnosticFDODesktopEntryType desktop_agnostic_fdo_desktop_entry_get_entry_type (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_entry_type (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryType value); -char* desktop_agnostic_fdo_desktop_entry_get_name (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_name (DesktopAgnosticFDODesktopEntry* self, const char* value); -char* desktop_agnostic_fdo_desktop_entry_get_icon (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_icon (DesktopAgnosticFDODesktopEntry* self, const char* value); -static GType* _g_type_dup (GType* self); -GType desktop_agnostic_fdo_get_type (GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new (GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_file (DesktopAgnosticVFSFile* file, GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_keyfile (GKeyFile* keyfile, GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_data (const char* data, GError** error); - - - - -GType desktop_agnostic_fdo_desktop_entry_launch_flags_get_type (void) { - static GType desktop_agnostic_fdo_desktop_entry_launch_flags_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_fdo_desktop_entry_launch_flags_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_ONLY_ONE, "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_ONLY_ONE", "only-one"}, {DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_USE_CWD, "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_USE_CWD", "use-cwd"}, {DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_DO_NOT_REAP_CHILD, "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_DO_NOT_REAP_CHILD", "do-not-reap-child"}, {0, NULL, NULL}}; - desktop_agnostic_fdo_desktop_entry_launch_flags_type_id = g_enum_register_static ("DesktopAgnosticFDODesktopEntryLaunchFlags", values); - } - return desktop_agnostic_fdo_desktop_entry_launch_flags_type_id; -} - - - -GType desktop_agnostic_fdo_desktop_entry_type_get_type (void) { - static GType desktop_agnostic_fdo_desktop_entry_type_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_fdo_desktop_entry_type_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN, "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN", "unknown"}, {DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION, "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION", "application"}, {DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK, "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK", "link"}, {DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY, "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY", "directory"}, {0, NULL, NULL}}; - desktop_agnostic_fdo_desktop_entry_type_type_id = g_enum_register_static ("DesktopAgnosticFDODesktopEntryType", values); - } - return desktop_agnostic_fdo_desktop_entry_type_type_id; -} - - -GQuark desktop_agnostic_fdo_desktop_entry_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_fdo_desktop_entry_error-quark"); -} - - -char* desktop_agnostic_fdo_desktop_entry_type_to_string (DesktopAgnosticFDODesktopEntryType entry_type) { - char* result; - switch (entry_type) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: - { - result = g_strdup ("Application"); - return result; - } - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK: - { - result = g_strdup ("Link"); - return result; - } - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY: - { - result = g_strdup ("Directory"); - return result; - } - default: - { - result = g_strdup ("Unknown"); - return result; - } - } -} - - -gboolean desktop_agnostic_fdo_desktop_entry_key_exists (DesktopAgnosticFDODesktopEntry* self, const char* key) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->key_exists (self, key); -} - - -gboolean desktop_agnostic_fdo_desktop_entry_get_boolean (DesktopAgnosticFDODesktopEntry* self, const char* key) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_boolean (self, key); -} - - -void desktop_agnostic_fdo_desktop_entry_set_boolean (DesktopAgnosticFDODesktopEntry* self, const char* key, gboolean value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_boolean (self, key, value); -} - - -char* desktop_agnostic_fdo_desktop_entry_get_string (DesktopAgnosticFDODesktopEntry* self, const char* key) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_string (self, key); -} - - -void desktop_agnostic_fdo_desktop_entry_set_string (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_string (self, key, value); -} - - -char* desktop_agnostic_fdo_desktop_entry_get_localestring (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_localestring (self, key, locale); -} - - -void desktop_agnostic_fdo_desktop_entry_set_localestring (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale, const char* value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_localestring (self, key, locale, value); -} - - -char** desktop_agnostic_fdo_desktop_entry_get_string_list (DesktopAgnosticFDODesktopEntry* self, const char* key) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_string_list (self, key); -} - - -void desktop_agnostic_fdo_desktop_entry_set_string_list (DesktopAgnosticFDODesktopEntry* self, const char* key, char** value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_string_list (self, key, value); -} - - -gboolean desktop_agnostic_fdo_desktop_entry_exists (DesktopAgnosticFDODesktopEntry* self) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->exists (self); -} - - -GPid desktop_agnostic_fdo_desktop_entry_launch (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->launch (self, flags, documents, error); -} - - -void desktop_agnostic_fdo_desktop_entry_save (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* new_file, GError** error) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->save (self, new_file, error); -} - - -DesktopAgnosticVFSFile* desktop_agnostic_fdo_desktop_entry_get_file (DesktopAgnosticFDODesktopEntry* self) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_file (self); -} - - -void desktop_agnostic_fdo_desktop_entry_set_file (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_file (self, value); -} - - -GKeyFile* desktop_agnostic_fdo_desktop_entry_get_keyfile (DesktopAgnosticFDODesktopEntry* self) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_keyfile (self); -} - - -void desktop_agnostic_fdo_desktop_entry_set_keyfile (DesktopAgnosticFDODesktopEntry* self, GKeyFile* value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_keyfile (self, value); -} - - -void desktop_agnostic_fdo_desktop_entry_set_data (DesktopAgnosticFDODesktopEntry* self, const char* value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_data (self, value); -} - - -DesktopAgnosticFDODesktopEntryType desktop_agnostic_fdo_desktop_entry_get_entry_type (DesktopAgnosticFDODesktopEntry* self) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_entry_type (self); -} - - -void desktop_agnostic_fdo_desktop_entry_set_entry_type (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryType value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_entry_type (self, value); -} - - -char* desktop_agnostic_fdo_desktop_entry_get_name (DesktopAgnosticFDODesktopEntry* self) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_name (self); -} - - -void desktop_agnostic_fdo_desktop_entry_set_name (DesktopAgnosticFDODesktopEntry* self, const char* value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_name (self, value); -} - - -char* desktop_agnostic_fdo_desktop_entry_get_icon (DesktopAgnosticFDODesktopEntry* self) { - return DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->get_icon (self); -} - - -void desktop_agnostic_fdo_desktop_entry_set_icon (DesktopAgnosticFDODesktopEntry* self, const char* value) { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE (self)->set_icon (self, value); -} - - -static void desktop_agnostic_fdo_desktop_entry_base_init (DesktopAgnosticFDODesktopEntryIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_object_interface_install_property (iface, g_param_spec_object ("file", "file", "file", DESKTOP_AGNOSTIC_VFS_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); - g_object_interface_install_property (iface, g_param_spec_pointer ("keyfile", "keyfile", "keyfile", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); - g_object_interface_install_property (iface, g_param_spec_string ("data", "data", "data", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); - g_object_interface_install_property (iface, g_param_spec_enum ("entry-type", "entry-type", "entry-type", DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_TYPE, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_interface_install_property (iface, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_interface_install_property (iface, g_param_spec_string ("icon", "icon", "icon", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - } -} - - -GType desktop_agnostic_fdo_desktop_entry_get_type (void) { - static GType desktop_agnostic_fdo_desktop_entry_type_id = 0; - if (desktop_agnostic_fdo_desktop_entry_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticFDODesktopEntryIface), (GBaseInitFunc) desktop_agnostic_fdo_desktop_entry_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - desktop_agnostic_fdo_desktop_entry_type_id = g_type_register_static (G_TYPE_INTERFACE, "DesktopAgnosticFDODesktopEntry", &g_define_type_info, 0); - g_type_interface_add_prerequisite (desktop_agnostic_fdo_desktop_entry_type_id, G_TYPE_OBJECT); - } - return desktop_agnostic_fdo_desktop_entry_type_id; -} - - -static GType* _g_type_dup (GType* self) { - GType* dup; - dup = g_new0 (GType, 1); - memcpy (dup, self, sizeof (GType)); - return dup; -} - - -static gpointer __g_type_dup0 (gpointer self) { - return self ? _g_type_dup (self) : NULL; -} - - -GType desktop_agnostic_fdo_get_type (GError** error) { - GType result; - GError * _inner_error_; - _inner_error_ = NULL; - if (desktop_agnostic_fdo_module_type == NULL) { - GType _tmp0_; - GType* _tmp1_; - _tmp0_ = desktop_agnostic_get_module_type ("fdo", "desktop-entry", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return 0UL; - } - desktop_agnostic_fdo_module_type = (_tmp1_ = __g_type_dup0 (&_tmp0_), _g_free0 (desktop_agnostic_fdo_module_type), _tmp1_); - } - result = *desktop_agnostic_fdo_module_type; - return result; -} - - -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new (GError** error) { - DesktopAgnosticFDODesktopEntry* result; - GError * _inner_error_; - GType type; - _inner_error_ = NULL; - type = desktop_agnostic_fdo_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (type == G_TYPE_INVALID) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY (g_object_new (type, NULL)); - return result; - } -} - - -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_file (DesktopAgnosticVFSFile* file, GError** error) { - DesktopAgnosticFDODesktopEntry* result; - GError * _inner_error_; - GType type; - g_return_val_if_fail (file != NULL, NULL); - _inner_error_ = NULL; - type = desktop_agnostic_fdo_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (type == G_TYPE_INVALID) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY (g_object_new (type, "file", file, NULL)); - return result; - } -} - - -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_keyfile (GKeyFile* keyfile, GError** error) { - DesktopAgnosticFDODesktopEntry* result; - GError * _inner_error_; - GType type; - g_return_val_if_fail (keyfile != NULL, NULL); - _inner_error_ = NULL; - type = desktop_agnostic_fdo_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (type == G_TYPE_INVALID) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY (g_object_new (type, "keyfile", keyfile, NULL)); - return result; - } -} - - -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_data (const char* data, GError** error) { - DesktopAgnosticFDODesktopEntry* result; - GError * _inner_error_; - GType type; - g_return_val_if_fail (data != NULL, NULL); - _inner_error_ = NULL; - type = desktop_agnostic_fdo_get_type (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (type == G_TYPE_INVALID) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY (g_object_new (type, "data", data, NULL)); - return result; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-entry-impl-glib.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-entry-impl-glib.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-entry-impl-glib.c 2010-04-11 07:32:30.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-entry-impl-glib.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1460 +0,0 @@ -/* desktop-entry-impl-glib.c generated by valac, the Vala compiler - * generated from desktop-entry-impl-glib.vala, do not modify */ - -/* - * Desktop Agnostic Library: Desktop Entry implementation using GLib. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB (desktop_agnostic_fdo_desktop_entry_glib_get_type ()) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB, DesktopAgnosticFDODesktopEntryGLib)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB, DesktopAgnosticFDODesktopEntryGLibClass)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GLIB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GLIB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB, DesktopAgnosticFDODesktopEntryGLibClass)) - -typedef struct _DesktopAgnosticFDODesktopEntryGLib DesktopAgnosticFDODesktopEntryGLib; -typedef struct _DesktopAgnosticFDODesktopEntryGLibClass DesktopAgnosticFDODesktopEntryGLibClass; -typedef struct _DesktopAgnosticFDODesktopEntryGLibPrivate DesktopAgnosticFDODesktopEntryGLibPrivate; -#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define __g_slist_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_free (var), NULL))) - -struct _DesktopAgnosticFDODesktopEntryGLib { - GObject parent_instance; - DesktopAgnosticFDODesktopEntryGLibPrivate * priv; -}; - -struct _DesktopAgnosticFDODesktopEntryGLibClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticFDODesktopEntryGLibPrivate { - GKeyFile* _keyfile; - gboolean loaded; - DesktopAgnosticVFSFile* _file; -}; - - -static gpointer desktop_agnostic_fdo_desktop_entry_glib_parent_class = NULL; -static DesktopAgnosticFDODesktopEntryIface* desktop_agnostic_fdo_desktop_entry_glib_desktop_agnostic_fdo_desktop_entry_parent_iface = NULL; - -#define DESKTOP_AGNOSTIC_FDO_GROUP "Desktop Entry" -GType desktop_agnostic_fdo_desktop_entry_glib_get_type (void); -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB, DesktopAgnosticFDODesktopEntryGLibPrivate)) -enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_FILE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_KEYFILE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_DATA, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ENTRY_TYPE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_NAME, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ICON -}; -static gboolean desktop_agnostic_fdo_desktop_entry_glib_real_key_exists (DesktopAgnosticFDODesktopEntry* base, const char* key); -static gboolean desktop_agnostic_fdo_desktop_entry_glib_real_get_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key); -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key, gboolean value); -static char* desktop_agnostic_fdo_desktop_entry_glib_real_get_string (DesktopAgnosticFDODesktopEntry* base, const char* key); -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_string (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* value); -static char* desktop_agnostic_fdo_desktop_entry_glib_real_get_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale); -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale, const char* value); -static char** desktop_agnostic_fdo_desktop_entry_glib_real_get_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key); -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key, char** value); -static gboolean desktop_agnostic_fdo_desktop_entry_glib_real_exists (DesktopAgnosticFDODesktopEntry* base); -static char* desktop_agnostic_fdo_desktop_entry_glib_get_quoted_word (DesktopAgnosticFDODesktopEntryGLib* self, const char* word, gboolean in_single_quotes, gboolean in_double_quotes); -static char* desktop_agnostic_fdo_desktop_entry_glib_do_percent_subst (DesktopAgnosticFDODesktopEntryGLib* self, const char* code, GSList* documents, gboolean in_single_quotes, gboolean in_double_quotes); -static char* desktop_agnostic_fdo_desktop_entry_glib_parse_exec (DesktopAgnosticFDODesktopEntryGLib* self, GSList* documents); -static GPid desktop_agnostic_fdo_desktop_entry_glib_do_app_launch (DesktopAgnosticFDODesktopEntryGLib* self, const char* working_dir, GSpawnFlags flags, GSList* documents, GError** error); -static void _g_slist_free_g_free (GSList* self); -static GPid desktop_agnostic_fdo_desktop_entry_glib_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); -static void desktop_agnostic_fdo_desktop_entry_glib_real_save (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* new_file, GError** error); -DesktopAgnosticFDODesktopEntryGLib* desktop_agnostic_fdo_desktop_entry_glib_new (void); -DesktopAgnosticFDODesktopEntryGLib* desktop_agnostic_fdo_desktop_entry_glib_construct (GType object_type); -static void desktop_agnostic_fdo_desktop_entry_glib_finalize (GObject* obj); -static void desktop_agnostic_fdo_desktop_entry_glib_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_fdo_desktop_entry_glib_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType register_plugin (void); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static gint _vala_array_length (gpointer array); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -static gboolean desktop_agnostic_fdo_desktop_entry_glib_real_key_exists (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGLib * self; - gboolean result; - GError * _inner_error_; - gboolean _tmp0_ = FALSE; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_val_if_fail (key != NULL, FALSE); - _inner_error_ = NULL; - if (g_key_file_has_group (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP)) { - gboolean _tmp1_; - _tmp1_ = g_key_file_has_key (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - _tmp0_ = _tmp1_; - } else { - _tmp0_ = FALSE; - } - result = _tmp0_; - return result; -} - - -static gboolean desktop_agnostic_fdo_desktop_entry_glib_real_get_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGLib * self; - gboolean result; - GError * _inner_error_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_val_if_fail (key != NULL, FALSE); - _inner_error_ = NULL; - { - gboolean _tmp0_; - _tmp0_ = g_key_file_get_boolean (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch0_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - result = _tmp0_; - return result; - } - goto __finally0; - __catch0_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("desktop-entry-impl-glib.vala:204: Error trying to retrieve '%s': %s", key, err->message); - result = FALSE; - _g_error_free0 (err); - return result; - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key, gboolean value) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_if_fail (key != NULL); - g_key_file_set_boolean (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, value); -} - - -static char* desktop_agnostic_fdo_desktop_entry_glib_real_get_string (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGLib * self; - char* result; - GError * _inner_error_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - { - char* _tmp0_; - _tmp0_ = g_key_file_get_string (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch1_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - result = _tmp0_; - return result; - } - goto __finally1; - __catch1_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("desktop-entry-impl-glib.vala:224: Error trying to retrieve '%s': %s", key, err->message); - result = NULL; - _g_error_free0 (err); - return result; - } - } - __finally1: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_string (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* value) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - g_key_file_set_string (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, value); -} - - -static char* desktop_agnostic_fdo_desktop_entry_glib_real_get_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale) { - DesktopAgnosticFDODesktopEntryGLib * self; - char* result; - GError * _inner_error_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - { - char* _tmp0_; - _tmp0_ = g_key_file_get_locale_string (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, locale, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch2_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - result = _tmp0_; - return result; - } - goto __finally2; - __catch2_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("desktop-entry-impl-glib.vala:244: Error trying to retrieve '%s[%s]': %s", key, locale, err->message); - result = NULL; - _g_error_free0 (err); - return result; - } - } - __finally2: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale, const char* value) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_if_fail (key != NULL); - g_return_if_fail (locale != NULL); - g_return_if_fail (value != NULL); - g_key_file_set_locale_string (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, locale, value); -} - - -static char** desktop_agnostic_fdo_desktop_entry_glib_real_get_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGLib * self; - char** result; - GError * _inner_error_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_val_if_fail (key != NULL, NULL); - _inner_error_ = NULL; - { - char** _tmp2_; - gint _tmp1__size; - gint _tmp1__length1; - gsize _tmp0_; - char** _tmp1_; - _tmp1_ = (_tmp2_ = g_key_file_get_string_list (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, &_tmp0_, &_inner_error_), _tmp1__length1 = _tmp0_, _tmp1__size = _tmp1__length1, _tmp2_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch3_g_key_file_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - result = _tmp1_; - return result; - } - goto __finally3; - __catch3_g_key_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("desktop-entry-impl-glib.vala:266: Error trying to retrieve '%s': %s", key, err->message); - result = NULL; - _g_error_free0 (err); - return result; - } - } - __finally3: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key, char** value) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - g_return_if_fail (key != NULL); - g_key_file_set_string_list (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, value, _vala_array_length (value)); -} - - -static gboolean desktop_agnostic_fdo_desktop_entry_glib_real_exists (DesktopAgnosticFDODesktopEntry* base) { - DesktopAgnosticFDODesktopEntryGLib * self; - gboolean result; - GError * _inner_error_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - _inner_error_ = NULL; - switch (desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: - { - gboolean _tmp0_; - char* exec; - char** _tmp4_; - gint argv_size; - gint argv_length1; - char** argv; - char* _tmp5_; - gboolean _tmp6_ = FALSE; - char* _tmp8_; - gboolean _tmp9_; - _tmp0_ = g_key_file_has_key (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, "TryExec", &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - if (_tmp0_) { - char* _tmp2_; - char* _tmp1_; - gboolean _tmp3_; - if ((_tmp3_ = (_tmp2_ = g_find_program_in_path (_tmp1_ = desktop_agnostic_fdo_desktop_entry_get_string ((DesktopAgnosticFDODesktopEntry*) self, "TryExec"))) != NULL, _g_free0 (_tmp2_), _g_free0 (_tmp1_), _tmp3_)) { - result = TRUE; - return result; - } - } - exec = NULL; - argv = (_tmp4_ = NULL, argv_length1 = 0, argv_size = argv_length1, _tmp4_); - ; - exec = (_tmp5_ = desktop_agnostic_fdo_desktop_entry_get_string ((DesktopAgnosticFDODesktopEntry*) self, "Exec"), _g_free0 (exec), _tmp5_); - if (exec == NULL) { - _tmp6_ = TRUE; - } else { - gboolean _tmp7_; - _tmp7_ = g_shell_parse_argv (exec, &argv_length1, &argv, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (exec); - argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - _tmp6_ = !_tmp7_; - } - if (_tmp6_) { - result = FALSE; - _g_free0 (exec); - argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); - return result; - } - result = (_tmp9_ = (_tmp8_ = g_find_program_in_path (argv[0])) != NULL, _g_free0 (_tmp8_), _tmp9_); - _g_free0 (exec); - argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); - return result; - } - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK: - { - gboolean _tmp10_; - _tmp10_ = g_key_file_has_key (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, "URL", &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - if (_tmp10_) { - char* uri; - DesktopAgnosticVFSFile* file; - uri = g_key_file_get_string (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, "URL", &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - file = desktop_agnostic_vfs_file_new_for_uri (uri, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (uri); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - result = desktop_agnostic_vfs_file_exists (file); - _g_free0 (uri); - _g_object_unref0 (file); - return result; - } else { - result = FALSE; - return result; - } - } - default: - { - result = FALSE; - return result; - } - } -} - - -static gboolean string_contains (const char* self, const char* needle) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (needle != NULL, FALSE); - result = strstr (self, needle) != NULL; - return result; -} - - -static char* string_substring (const char* self, glong offset, glong len) { - char* result; - glong string_length; - const char* start; - g_return_val_if_fail (self != NULL, NULL); - string_length = g_utf8_strlen (self, -1); - if (offset < 0) { - offset = string_length + offset; - g_return_val_if_fail (offset >= 0, NULL); - } else { - g_return_val_if_fail (offset <= string_length, NULL); - } - if (len < 0) { - len = string_length - offset; - } - g_return_val_if_fail ((offset + len) <= string_length, NULL); - start = g_utf8_offset_to_pointer (self, offset); - result = g_strndup (start, ((gchar*) g_utf8_offset_to_pointer (start, len)) - ((gchar*) start)); - return result; -} - - -static char* desktop_agnostic_fdo_desktop_entry_glib_get_quoted_word (DesktopAgnosticFDODesktopEntryGLib* self, const char* word, gboolean in_single_quotes, gboolean in_double_quotes) { - char* result; - char* _result_; - gboolean _tmp0_ = FALSE; - gboolean _tmp10_ = FALSE; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (word != NULL, NULL); - _result_ = g_strdup (""); - if (!in_single_quotes) { - _tmp0_ = !in_double_quotes; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - char* _tmp1_; - _result_ = (_tmp1_ = g_strconcat (_result_, "'", NULL), _g_free0 (_result_), _tmp1_); - } else { - gboolean _tmp2_ = FALSE; - if (!in_single_quotes) { - _tmp2_ = in_double_quotes; - } else { - _tmp2_ = FALSE; - } - if (_tmp2_) { - char* _tmp3_; - _result_ = (_tmp3_ = g_strconcat (_result_, "\"'", NULL), _g_free0 (_result_), _tmp3_); - } - } - if (string_contains (word, "'")) { - { - char* s; - s = g_strdup (word); - { - gboolean _tmp4_; - _tmp4_ = TRUE; - while (TRUE) { - gboolean _tmp6_ = FALSE; - char* chr; - if (!_tmp4_) { - char* _tmp5_; - s = (_tmp5_ = g_strdup (g_utf8_next_char (s)), _g_free0 (s), _tmp5_); - } - _tmp4_ = FALSE; - if (s != NULL) { - _tmp6_ = g_utf8_strlen (s, -1) > 0; - } else { - _tmp6_ = FALSE; - } - if (!_tmp6_) { - break; - } - chr = string_substring (s, (glong) 0, (glong) 1); - if (_vala_strcmp0 (chr, "'") == 0) { - char* _tmp7_; - _result_ = (_tmp7_ = g_strconcat (_result_, "'\\''", NULL), _g_free0 (_result_), _tmp7_); - } else { - char* _tmp8_; - _result_ = (_tmp8_ = g_strconcat (_result_, chr, NULL), _g_free0 (_result_), _tmp8_); - } - _g_free0 (chr); - } - } - _g_free0 (s); - } - } else { - char* _tmp9_; - _result_ = (_tmp9_ = g_strconcat (_result_, word, NULL), _g_free0 (_result_), _tmp9_); - } - if (!in_single_quotes) { - _tmp10_ = !in_double_quotes; - } else { - _tmp10_ = FALSE; - } - if (_tmp10_) { - char* _tmp11_; - _result_ = (_tmp11_ = g_strconcat (_result_, "'", NULL), _g_free0 (_result_), _tmp11_); - } else { - gboolean _tmp12_ = FALSE; - if (!in_single_quotes) { - _tmp12_ = in_double_quotes; - } else { - _tmp12_ = FALSE; - } - if (_tmp12_) { - char* _tmp13_; - _result_ = (_tmp13_ = g_strconcat (_result_, "'\"", NULL), _g_free0 (_result_), _tmp13_); - } - } - result = _result_; - return result; -} - - -static char* desktop_agnostic_fdo_desktop_entry_glib_do_percent_subst (DesktopAgnosticFDODesktopEntryGLib* self, const char* code, GSList* documents, gboolean in_single_quotes, gboolean in_double_quotes) { - char* result; - GQuark _tmp8_; - const char* _tmp7_; - static GQuark _tmp8__label0 = 0; - static GQuark _tmp8__label1 = 0; - static GQuark _tmp8__label2 = 0; - static GQuark _tmp8__label3 = 0; - static GQuark _tmp8__label4 = 0; - static GQuark _tmp8__label5 = 0; - static GQuark _tmp8__label6 = 0; - static GQuark _tmp8__label7 = 0; - static GQuark _tmp8__label8 = 0; - static GQuark _tmp8__label9 = 0; - static GQuark _tmp8__label10 = 0; - static GQuark _tmp8__label11 = 0; - static GQuark _tmp8__label12 = 0; - static GQuark _tmp8__label13 = 0; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (code != NULL, NULL); - _tmp7_ = code; - _tmp8_ = (NULL == _tmp7_) ? 0 : g_quark_from_string (_tmp7_); - if (_tmp8_ == ((0 != _tmp8__label0) ? _tmp8__label0 : (_tmp8__label0 = g_quark_from_static_string ("%")))) - do { - result = g_strdup ("%"); - return result; - } while (0); else if ((_tmp8_ == ((0 != _tmp8__label1) ? _tmp8__label1 : (_tmp8__label1 = g_quark_from_static_string ("F")))) || (_tmp8_ == ((0 != _tmp8__label2) ? _tmp8__label2 : (_tmp8__label2 = g_quark_from_static_string ("U"))))) - do { - char* _result_; - _result_ = g_strdup (""); - { - GSList* doc_collection; - GSList* doc_it; - doc_collection = documents; - for (doc_it = doc_collection; doc_it != NULL; doc_it = doc_it->next) { - const char* doc; - doc = (const char*) doc_it->data; - { - char* _tmp2_; - char* _tmp1_; - char* _tmp0_; - _result_ = (_tmp2_ = g_strconcat (_result_, _tmp1_ = g_strconcat (" ", _tmp0_ = desktop_agnostic_fdo_desktop_entry_glib_get_quoted_word (self, doc, in_single_quotes, in_double_quotes), NULL), NULL), _g_free0 (_result_), _tmp2_); - _g_free0 (_tmp1_); - _g_free0 (_tmp0_); - } - } - } - result = _result_; - return result; - } while (0); else if ((_tmp8_ == ((0 != _tmp8__label3) ? _tmp8__label3 : (_tmp8__label3 = g_quark_from_static_string ("f")))) || (_tmp8_ == ((0 != _tmp8__label4) ? _tmp8__label4 : (_tmp8__label4 = g_quark_from_static_string ("u"))))) - do { - if (documents == NULL) { - result = g_strdup (""); - return result; - } else { - char* _tmp3_; - char* _tmp4_; - result = (_tmp4_ = g_strconcat (" ", _tmp3_ = desktop_agnostic_fdo_desktop_entry_glib_get_quoted_word (self, (const char*) documents->data, in_single_quotes, in_double_quotes), NULL), _g_free0 (_tmp3_), _tmp4_); - return result; - } - } while (0); else if (_tmp8_ == ((0 != _tmp8__label5) ? _tmp8__label5 : (_tmp8__label5 = g_quark_from_static_string ("i")))) - do { - char* icon; - icon = desktop_agnostic_fdo_desktop_entry_get_icon ((DesktopAgnosticFDODesktopEntry*) self); - if (icon == NULL) { - result = g_strdup (""); - _g_free0 (icon); - return result; - } else { - char* _tmp5_; - char* _tmp6_; - result = (_tmp6_ = g_strconcat ("--icon ", _tmp5_ = desktop_agnostic_fdo_desktop_entry_glib_get_quoted_word (self, icon, in_single_quotes, in_double_quotes), NULL), _g_free0 (_tmp5_), _tmp6_); - _g_free0 (icon); - return result; - } - } while (0); else if (_tmp8_ == ((0 != _tmp8__label6) ? _tmp8__label6 : (_tmp8__label6 = g_quark_from_static_string ("c")))) - do { - char* name; - name = desktop_agnostic_fdo_desktop_entry_get_name ((DesktopAgnosticFDODesktopEntry*) self); - if (name == NULL) { - result = g_strdup (""); - _g_free0 (name); - return result; - } else { - result = desktop_agnostic_fdo_desktop_entry_glib_get_quoted_word (self, name, in_single_quotes, in_double_quotes); - _g_free0 (name); - return result; - } - } while (0); else if (_tmp8_ == ((0 != _tmp8__label7) ? _tmp8__label7 : (_tmp8__label7 = g_quark_from_static_string ("k")))) - do { - if (self->priv->_file == NULL) { - result = g_strdup (""); - return result; - } else { - result = desktop_agnostic_vfs_file_get_uri (self->priv->_file); - return result; - } - } while (0); else if ((((((_tmp8_ == ((0 != _tmp8__label8) ? _tmp8__label8 : (_tmp8__label8 = g_quark_from_static_string ("D")))) || (_tmp8_ == ((0 != _tmp8__label9) ? _tmp8__label9 : (_tmp8__label9 = g_quark_from_static_string ("N"))))) || (_tmp8_ == ((0 != _tmp8__label10) ? _tmp8__label10 : (_tmp8__label10 = g_quark_from_static_string ("d"))))) || (_tmp8_ == ((0 != _tmp8__label11) ? _tmp8__label11 : (_tmp8__label11 = g_quark_from_static_string ("n"))))) || (_tmp8_ == ((0 != _tmp8__label12) ? _tmp8__label12 : (_tmp8__label12 = g_quark_from_static_string ("v"))))) || (_tmp8_ == ((0 != _tmp8__label13) ? _tmp8__label13 : (_tmp8__label13 = g_quark_from_static_string ("m"))))) - do { - result = g_strdup (""); - return result; - } while (0); else - do { - g_warning ("desktop-entry-impl-glib.vala:436: Unrecognized %%-code '%%%s' in Exec.", code); - result = g_strdup (""); - return result; - } while (0); -} - - -static char* desktop_agnostic_fdo_desktop_entry_glib_parse_exec (DesktopAgnosticFDODesktopEntryGLib* self, GSList* documents) { - char* result; - GError * _inner_error_; - char* exec; - char* command; - gboolean escape = FALSE; - gboolean single_quot = FALSE; - gboolean double_quot = FALSE; - gboolean _tmp0_; - char* _tmp1_; - g_return_val_if_fail (self != NULL, NULL); - _inner_error_ = NULL; - exec = NULL; - command = g_strdup (""); - _tmp0_ = g_key_file_has_key (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, "Exec", &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (exec); - _g_free0 (command); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - if (!_tmp0_) { - result = NULL; - _g_free0 (exec); - _g_free0 (command); - return result; - } - exec = (_tmp1_ = desktop_agnostic_fdo_desktop_entry_get_string ((DesktopAgnosticFDODesktopEntry*) self, "Exec"), _g_free0 (exec), _tmp1_); - escape = single_quot = double_quot = FALSE; - { - char* s; - s = g_strdup (exec); - { - gboolean _tmp2_; - _tmp2_ = TRUE; - while (TRUE) { - gboolean _tmp4_ = FALSE; - char* chr; - if (!_tmp2_) { - char* _tmp3_; - s = (_tmp3_ = g_strdup (g_utf8_next_char (s)), _g_free0 (s), _tmp3_); - } - _tmp2_ = FALSE; - if (s != NULL) { - _tmp4_ = g_utf8_strlen (s, -1) > 0; - } else { - _tmp4_ = FALSE; - } - if (!_tmp4_) { - break; - } - chr = string_substring (s, (glong) 0, (glong) 1); - if (escape) { - char* _tmp5_; - escape = FALSE; - command = (_tmp5_ = g_strconcat (command, chr, NULL), _g_free0 (command), _tmp5_); - } else { - if (_vala_strcmp0 (chr, "\\") == 0) { - char* _tmp6_; - if (!single_quot) { - escape = TRUE; - } - command = (_tmp6_ = g_strconcat (command, chr, NULL), _g_free0 (command), _tmp6_); - } else { - if (_vala_strcmp0 (chr, "'") == 0) { - char* _tmp7_; - gboolean _tmp8_ = FALSE; - command = (_tmp7_ = g_strconcat (command, chr, NULL), _g_free0 (command), _tmp7_); - if (!single_quot) { - _tmp8_ = !double_quot; - } else { - _tmp8_ = FALSE; - } - if (_tmp8_) { - single_quot = TRUE; - } else { - if (single_quot) { - single_quot = FALSE; - } - } - } else { - if (_vala_strcmp0 (chr, "\"") == 0) { - char* _tmp9_; - gboolean _tmp10_ = FALSE; - command = (_tmp9_ = g_strconcat (command, chr, NULL), _g_free0 (command), _tmp9_); - if (!single_quot) { - _tmp10_ = !double_quot; - } else { - _tmp10_ = FALSE; - } - if (_tmp10_) { - double_quot = TRUE; - } else { - if (double_quot) { - double_quot = FALSE; - } - } - } else { - if (_vala_strcmp0 (chr, "%") == 0) { - char* pchr; - pchr = string_substring (s, (glong) 1, (glong) 1); - if (pchr == NULL) { - char* _tmp11_; - command = (_tmp11_ = g_strconcat (command, chr, NULL), _g_free0 (command), _tmp11_); - } else { - char* _tmp13_; - char* _tmp12_; - char* _tmp14_; - command = (_tmp13_ = g_strconcat (command, _tmp12_ = desktop_agnostic_fdo_desktop_entry_glib_do_percent_subst (self, pchr, documents, single_quot, double_quot), NULL), _g_free0 (command), _tmp13_); - _g_free0 (_tmp12_); - s = (_tmp14_ = g_strdup (g_utf8_next_char (s)), _g_free0 (s), _tmp14_); - } - _g_free0 (pchr); - } else { - char* _tmp15_; - command = (_tmp15_ = g_strconcat (command, chr, NULL), _g_free0 (command), _tmp15_); - } - } - } - } - } - _g_free0 (chr); - } - } - _g_free0 (s); - } - result = command; - _g_free0 (exec); - return result; -} - - -static GPid desktop_agnostic_fdo_desktop_entry_glib_do_app_launch (DesktopAgnosticFDODesktopEntryGLib* self, const char* working_dir, GSpawnFlags flags, GSList* documents, GError** error) { - GPid result; - GError * _inner_error_; - gint argv_size; - gint argv_length1; - char** argv; - GPid pid = 0; - char* _tmp0_; - gboolean _tmp1_; - gboolean _tmp2_; - g_return_val_if_fail (self != NULL, 0); - _inner_error_ = NULL; - argv = (argv_length1 = 0, NULL); - _tmp2_ = (_tmp1_ = g_shell_parse_argv (_tmp0_ = desktop_agnostic_fdo_desktop_entry_glib_parse_exec (self, documents), &argv_length1, &argv, &_inner_error_), _g_free0 (_tmp0_), _tmp1_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); - return 0; - } - if (!_tmp2_) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE, "Could not parse Exec key."); - { - g_propagate_error (error, _inner_error_); - argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); - return 0; - } - } - g_spawn_async_with_pipes (working_dir, argv, NULL, flags, NULL, NULL, &pid, NULL, NULL, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); - return 0; - } - result = pid; - argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); - return result; -} - - -static void _g_slist_free_g_free (GSList* self) { - g_slist_foreach (self, (GFunc) g_free, NULL); - g_slist_free (self); -} - - -static GPid desktop_agnostic_fdo_desktop_entry_glib_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error) { - DesktopAgnosticFDODesktopEntryGLib * self; - GPid result; - GError * _inner_error_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - _inner_error_ = NULL; - switch (desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: - { - GSpawnFlags sflags; - char* working_dir; - GPid pid = 0; - gboolean _tmp2_ = FALSE; - sflags = G_SPAWN_SEARCH_PATH; - working_dir = NULL; - if ((flags & DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_DO_NOT_REAP_CHILD) != 0) { - sflags = sflags | G_SPAWN_DO_NOT_REAP_CHILD; - } - if ((flags & DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_USE_CWD) != 0) { - char* _tmp0_; - working_dir = (_tmp0_ = g_get_current_dir (), _g_free0 (working_dir), _tmp0_); - } else { - char* _tmp1_; - working_dir = (_tmp1_ = g_strdup (g_get_home_dir ()), _g_free0 (working_dir), _tmp1_); - } - if ((flags & DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_ONLY_ONE) == 0) { - _tmp2_ = documents != NULL; - } else { - _tmp2_ = FALSE; - } - if (_tmp2_) { - pid = (GPid) 0; - { - GSList* doc_collection; - GSList* doc_it; - doc_collection = documents; - for (doc_it = doc_collection; doc_it != NULL; doc_it = doc_it->next) { - const char* doc; - doc = (const char*) doc_it->data; - { - GSList* docs; - GPid _tmp3_; - docs = NULL; - docs = g_slist_append (docs, g_strdup (doc)); - _tmp3_ = desktop_agnostic_fdo_desktop_entry_glib_do_app_launch (self, working_dir, sflags, docs, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_free0 (docs); - _g_free0 (working_dir); - return 0; - } - pid = _tmp3_; - __g_slist_free_g_free0 (docs); - } - } - } - } else { - GPid _tmp4_; - _tmp4_ = desktop_agnostic_fdo_desktop_entry_glib_do_app_launch (self, working_dir, sflags, documents, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (working_dir); - return 0; - } - pid = _tmp4_; - } - result = pid; - _g_free0 (working_dir); - return result; - } - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK: - { - char* uri; - DesktopAgnosticVFSFile* file; - if (documents != NULL) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE, "Cannot pass documents to a 'Link' desktop entry."); - { - g_propagate_error (error, _inner_error_); - return 0; - } - } - uri = g_key_file_get_string (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, "URL", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return 0; - } - file = desktop_agnostic_vfs_file_new_for_uri (uri, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (uri); - return 0; - } - desktop_agnostic_vfs_file_launch (file, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (uri); - _g_object_unref0 (file); - return 0; - } - result = (GPid) 0; - _g_free0 (uri); - _g_object_unref0 (file); - return result; - } - default: - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE, "The desktop entry is unlaunchable."); - { - g_propagate_error (error, _inner_error_); - return 0; - } - } - } -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_save (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* new_file, GError** error) { - DesktopAgnosticFDODesktopEntryGLib * self; - GError * _inner_error_; - DesktopAgnosticVFSFile* file; - char* _tmp2_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - _inner_error_ = NULL; - file = NULL; - if (new_file != NULL) { - DesktopAgnosticVFSFile* _tmp0_; - file = (_tmp0_ = _g_object_ref0 (new_file), _g_object_unref0 (file), _tmp0_); - } else { - if (self->priv->_file != NULL) { - DesktopAgnosticVFSFile* _tmp1_; - file = (_tmp1_ = _g_object_ref0 (self->priv->_file), _g_object_unref0 (file), _tmp1_); - } else { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_INVALID_FILE, "No filename specified."); - { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (file); - return; - } - } - } - desktop_agnostic_vfs_file_replace_contents (file, _tmp2_ = g_key_file_to_data (self->priv->_keyfile, NULL, NULL), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (file); - return; - } - _g_free0 (_tmp2_); - _g_object_unref0 (file); -} - - -DesktopAgnosticFDODesktopEntryGLib* desktop_agnostic_fdo_desktop_entry_glib_construct (GType object_type) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = (DesktopAgnosticFDODesktopEntryGLib*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticFDODesktopEntryGLib* desktop_agnostic_fdo_desktop_entry_glib_new (void) { - return desktop_agnostic_fdo_desktop_entry_glib_construct (DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB); -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_fdo_desktop_entry_glib_real_get_file (DesktopAgnosticFDODesktopEntry* base) { - DesktopAgnosticVFSFile* result; - DesktopAgnosticFDODesktopEntryGLib* self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - result = self->priv->_file; - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_file (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* value) { - GError * _inner_error_; - DesktopAgnosticFDODesktopEntryGLib* self; - _inner_error_ = NULL; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - if (value != NULL) { - if (self->priv->loaded) { - g_warning ("desktop-entry-impl-glib.vala:46: The desktop entry has already been initialized."); - } else { - if (desktop_agnostic_vfs_file_exists (value)) { - char* path; - DesktopAgnosticVFSFile* _tmp0_; - char* _tmp1_; - path = NULL; - self->priv->_file = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_file), _tmp0_); - path = (_tmp1_ = desktop_agnostic_vfs_file_get_path (value), _g_free0 (path), _tmp1_); - if (path == NULL) { - char* data; - gsize data_len = 0UL; - char* _tmp4_; - gboolean _tmp3_; - char* _tmp2_ = NULL; - data = NULL; - _tmp3_ = desktop_agnostic_vfs_file_load_contents (self->priv->_file, &_tmp2_, &data_len, &_inner_error_); - data = (_tmp4_ = _tmp2_, _g_free0 (data), _tmp4_); - _tmp3_; - if (_inner_error_ != NULL) { - _g_free0 (data); - _g_free0 (path); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - g_key_file_load_from_data (self->priv->_keyfile, data, data_len, G_KEY_FILE_KEEP_TRANSLATIONS, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (data); - _g_free0 (path); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _g_free0 (data); - } else { - g_key_file_load_from_file (self->priv->_keyfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (path); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - self->priv->loaded = TRUE; - _g_free0 (path); - } - } - } - g_object_notify ((GObject *) self, "file"); -} - - -static GKeyFile* desktop_agnostic_fdo_desktop_entry_glib_real_get_keyfile (DesktopAgnosticFDODesktopEntry* base) { - GKeyFile* result; - DesktopAgnosticFDODesktopEntryGLib* self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - result = self->priv->_keyfile; - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_keyfile (DesktopAgnosticFDODesktopEntry* base, GKeyFile* value) { - GError * _inner_error_; - DesktopAgnosticFDODesktopEntryGLib* self; - _inner_error_ = NULL; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - if (value != NULL) { - if (self->priv->loaded) { - g_warning ("desktop-entry-impl-glib.vala:85: The desktop entry has already been initialized."); - } else { - char* data; - gsize length = 0UL; - char* _tmp0_; - data = NULL; - data = (_tmp0_ = g_key_file_to_data (value, &length, NULL), _g_free0 (data), _tmp0_); - g_key_file_load_from_data (self->priv->_keyfile, data, length, G_KEY_FILE_KEEP_TRANSLATIONS, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (data); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->loaded = TRUE; - _g_free0 (data); - } - } - g_object_notify ((GObject *) self, "keyfile"); -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_data (DesktopAgnosticFDODesktopEntry* base, const char* value) { - GError * _inner_error_; - DesktopAgnosticFDODesktopEntryGLib* self; - gboolean _tmp0_ = FALSE; - _inner_error_ = NULL; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - if (value != NULL) { - _tmp0_ = _vala_strcmp0 (value, "") != 0; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - if (self->priv->loaded) { - g_warning ("desktop-entry-impl-glib.vala:109: The desktop entry has already been initialized."); - } else { - g_key_file_load_from_data (self->priv->_keyfile, value, strlen (value), G_KEY_FILE_KEEP_TRANSLATIONS, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->loaded = TRUE; - } - } - g_object_notify ((GObject *) self, "data"); -} - - -static DesktopAgnosticFDODesktopEntryType desktop_agnostic_fdo_desktop_entry_glib_real_get_entry_type (DesktopAgnosticFDODesktopEntry* base) { - DesktopAgnosticFDODesktopEntryType result; - DesktopAgnosticFDODesktopEntryGLib* self; - char* type; - GQuark _tmp1_; - const char* _tmp0_; - static GQuark _tmp1__label0 = 0; - static GQuark _tmp1__label1 = 0; - static GQuark _tmp1__label2 = 0; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - type = desktop_agnostic_fdo_desktop_entry_get_string ((DesktopAgnosticFDODesktopEntry*) self, "Type"); - _tmp0_ = type; - _tmp1_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_); - if (_tmp1_ == ((0 != _tmp1__label0) ? _tmp1__label0 : (_tmp1__label0 = g_quark_from_static_string ("Application")))) - do { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION; - _g_free0 (type); - return result; - } while (0); else if (_tmp1_ == ((0 != _tmp1__label1) ? _tmp1__label1 : (_tmp1__label1 = g_quark_from_static_string ("Link")))) - do { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK; - _g_free0 (type); - return result; - } while (0); else if (_tmp1_ == ((0 != _tmp1__label2) ? _tmp1__label2 : (_tmp1__label2 = g_quark_from_static_string ("Directory")))) - do { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY; - _g_free0 (type); - return result; - } while (0); else - do { - result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN; - _g_free0 (type); - return result; - } while (0); - _g_free0 (type); -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_entry_type (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryType value) { - DesktopAgnosticFDODesktopEntryGLib* self; - char* _tmp2_; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - desktop_agnostic_fdo_desktop_entry_set_string ((DesktopAgnosticFDODesktopEntry*) self, "Type", _tmp2_ = desktop_agnostic_fdo_desktop_entry_type_to_string (value)); - _g_free0 (_tmp2_); - g_object_notify ((GObject *) self, "entry-type"); -} - - -static char* desktop_agnostic_fdo_desktop_entry_glib_real_get_name (DesktopAgnosticFDODesktopEntry* base) { - char* result; - DesktopAgnosticFDODesktopEntryGLib* self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - result = desktop_agnostic_fdo_desktop_entry_get_string ((DesktopAgnosticFDODesktopEntry*) self, "Name"); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_name (DesktopAgnosticFDODesktopEntry* base, const char* value) { - DesktopAgnosticFDODesktopEntryGLib* self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - desktop_agnostic_fdo_desktop_entry_set_string ((DesktopAgnosticFDODesktopEntry*) self, "Name", value); - g_object_notify ((GObject *) self, "name"); -} - - -static char* desktop_agnostic_fdo_desktop_entry_glib_real_get_icon (DesktopAgnosticFDODesktopEntry* base) { - char* result; - DesktopAgnosticFDODesktopEntryGLib* self; - char* icon_name; - gboolean _tmp0_ = FALSE; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - icon_name = desktop_agnostic_fdo_desktop_entry_get_string ((DesktopAgnosticFDODesktopEntry*) self, "Icon"); - if (icon_name != NULL) { - char* _tmp1_; - _tmp0_ = _vala_strcmp0 (_tmp1_ = g_path_get_basename (icon_name), icon_name) == 0; - _g_free0 (_tmp1_); - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - char* _tmp4_; - gint _tmp3__length1; - char** _tmp3_; - char** _tmp2_; - char* _tmp7_; - gint _tmp6__length1; - char** _tmp6_; - char** _tmp5_; - char* _tmp10_; - gint _tmp9__length1; - char** _tmp9_; - char** _tmp8_; - icon_name = (_tmp4_ = g_strdup ((_tmp3_ = _tmp2_ = g_strsplit (icon_name, ".png", 2), _tmp3__length1 = _vala_array_length (_tmp2_), _tmp3_)[0]), _g_free0 (icon_name), _tmp4_); - _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL); - icon_name = (_tmp7_ = g_strdup ((_tmp6_ = _tmp5_ = g_strsplit (icon_name, ".svg", 2), _tmp6__length1 = _vala_array_length (_tmp5_), _tmp6_)[0]), _g_free0 (icon_name), _tmp7_); - _tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL); - icon_name = (_tmp10_ = g_strdup ((_tmp9_ = _tmp8_ = g_strsplit (icon_name, ".xpm", 2), _tmp9__length1 = _vala_array_length (_tmp8_), _tmp9_)[0]), _g_free0 (icon_name), _tmp10_); - _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL); - } - result = icon_name; - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_real_set_icon (DesktopAgnosticFDODesktopEntry* base, const char* value) { - DesktopAgnosticFDODesktopEntryGLib* self; - self = (DesktopAgnosticFDODesktopEntryGLib*) base; - if (value == NULL) { - g_warning ("desktop-entry-impl-glib.vala:179: Cannot set a NULL value for 'Icon'."); - } else { - desktop_agnostic_fdo_desktop_entry_set_string ((DesktopAgnosticFDODesktopEntry*) self, "Icon", value); - } - g_object_notify ((GObject *) self, "icon"); -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_class_init (DesktopAgnosticFDODesktopEntryGLibClass * klass) { - desktop_agnostic_fdo_desktop_entry_glib_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticFDODesktopEntryGLibPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_fdo_desktop_entry_glib_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_fdo_desktop_entry_glib_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_fdo_desktop_entry_glib_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_FILE, "file"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_KEYFILE, "keyfile"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_DATA, "data"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ENTRY_TYPE, "entry-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ICON, "icon"); -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_desktop_agnostic_fdo_desktop_entry_interface_init (DesktopAgnosticFDODesktopEntryIface * iface) { - desktop_agnostic_fdo_desktop_entry_glib_desktop_agnostic_fdo_desktop_entry_parent_iface = g_type_interface_peek_parent (iface); - iface->key_exists = desktop_agnostic_fdo_desktop_entry_glib_real_key_exists; - iface->get_boolean = desktop_agnostic_fdo_desktop_entry_glib_real_get_boolean; - iface->set_boolean = desktop_agnostic_fdo_desktop_entry_glib_real_set_boolean; - iface->get_string = desktop_agnostic_fdo_desktop_entry_glib_real_get_string; - iface->set_string = desktop_agnostic_fdo_desktop_entry_glib_real_set_string; - iface->get_localestring = desktop_agnostic_fdo_desktop_entry_glib_real_get_localestring; - iface->set_localestring = desktop_agnostic_fdo_desktop_entry_glib_real_set_localestring; - iface->get_string_list = desktop_agnostic_fdo_desktop_entry_glib_real_get_string_list; - iface->set_string_list = desktop_agnostic_fdo_desktop_entry_glib_real_set_string_list; - iface->exists = desktop_agnostic_fdo_desktop_entry_glib_real_exists; - iface->launch = desktop_agnostic_fdo_desktop_entry_glib_real_launch; - iface->save = desktop_agnostic_fdo_desktop_entry_glib_real_save; - iface->get_file = desktop_agnostic_fdo_desktop_entry_glib_real_get_file; - iface->set_file = desktop_agnostic_fdo_desktop_entry_glib_real_set_file; - iface->get_keyfile = desktop_agnostic_fdo_desktop_entry_glib_real_get_keyfile; - iface->set_keyfile = desktop_agnostic_fdo_desktop_entry_glib_real_set_keyfile; - iface->set_data = desktop_agnostic_fdo_desktop_entry_glib_real_set_data; - iface->get_entry_type = desktop_agnostic_fdo_desktop_entry_glib_real_get_entry_type; - iface->set_entry_type = desktop_agnostic_fdo_desktop_entry_glib_real_set_entry_type; - iface->get_name = desktop_agnostic_fdo_desktop_entry_glib_real_get_name; - iface->set_name = desktop_agnostic_fdo_desktop_entry_glib_real_set_name; - iface->get_icon = desktop_agnostic_fdo_desktop_entry_glib_real_get_icon; - iface->set_icon = desktop_agnostic_fdo_desktop_entry_glib_real_set_icon; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_instance_init (DesktopAgnosticFDODesktopEntryGLib * self) { - self->priv = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_GET_PRIVATE (self); - self->priv->_keyfile = g_key_file_new (); - self->priv->loaded = FALSE; - self->priv->_file = NULL; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_finalize (GObject* obj) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB (obj); - _g_key_file_free0 (self->priv->_keyfile); - _g_object_unref0 (self->priv->_file); - G_OBJECT_CLASS (desktop_agnostic_fdo_desktop_entry_glib_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_fdo_desktop_entry_glib_get_type (void) { - static GType desktop_agnostic_fdo_desktop_entry_glib_type_id = 0; - if (desktop_agnostic_fdo_desktop_entry_glib_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticFDODesktopEntryGLibClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_fdo_desktop_entry_glib_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticFDODesktopEntryGLib), 0, (GInstanceInitFunc) desktop_agnostic_fdo_desktop_entry_glib_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_fdo_desktop_entry_info = { (GInterfaceInitFunc) desktop_agnostic_fdo_desktop_entry_glib_desktop_agnostic_fdo_desktop_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_fdo_desktop_entry_glib_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticFDODesktopEntryGLib", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_fdo_desktop_entry_glib_type_id, DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY, &desktop_agnostic_fdo_desktop_entry_info); - } - return desktop_agnostic_fdo_desktop_entry_glib_type_id; -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_FILE: - g_value_set_object (value, desktop_agnostic_fdo_desktop_entry_get_file ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_KEYFILE: - g_value_set_pointer (value, desktop_agnostic_fdo_desktop_entry_get_keyfile ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ENTRY_TYPE: - g_value_set_enum (value, desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_NAME: - g_value_set_string (value, desktop_agnostic_fdo_desktop_entry_get_name ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ICON: - g_value_set_string (value, desktop_agnostic_fdo_desktop_entry_get_icon ((DesktopAgnosticFDODesktopEntry*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_fdo_desktop_entry_glib_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticFDODesktopEntryGLib * self; - self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_FILE: - desktop_agnostic_fdo_desktop_entry_set_file ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_object (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_KEYFILE: - desktop_agnostic_fdo_desktop_entry_set_keyfile ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_pointer (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_DATA: - desktop_agnostic_fdo_desktop_entry_set_data ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ENTRY_TYPE: - desktop_agnostic_fdo_desktop_entry_set_entry_type ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_enum (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_NAME: - desktop_agnostic_fdo_desktop_entry_set_name ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ICON: - desktop_agnostic_fdo_desktop_entry_set_icon ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -GType register_plugin (void) { - GType result; - result = DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GLIB; - return result; -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static gint _vala_array_length (gpointer array) { - int length; - length = 0; - if (array) { - while (((gpointer*) array)[length]) { - length++; - } - } - return length; -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-entry-impl-gnome.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-entry-impl-gnome.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/desktop-entry-impl-gnome.c 2010-04-11 07:32:28.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/desktop-entry-impl-gnome.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,714 +0,0 @@ -/* desktop-entry-impl-gnome.c generated by valac, the Vala compiler - * generated from desktop-entry-impl-gnome.vala, do not modify */ - -/* - * Desktop Agnostic Library: Desktop Entry implementation using GNOME. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME (desktop_agnostic_fdo_desktop_entry_gnome_get_type ()) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME, DesktopAgnosticFDODesktopEntryGNOME)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME, DesktopAgnosticFDODesktopEntryGNOMEClass)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GNOME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GNOME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME, DesktopAgnosticFDODesktopEntryGNOMEClass)) - -typedef struct _DesktopAgnosticFDODesktopEntryGNOME DesktopAgnosticFDODesktopEntryGNOME; -typedef struct _DesktopAgnosticFDODesktopEntryGNOMEClass DesktopAgnosticFDODesktopEntryGNOMEClass; -typedef struct _DesktopAgnosticFDODesktopEntryGNOMEPrivate DesktopAgnosticFDODesktopEntryGNOMEPrivate; -#define _gnome_desktop_item_unref0(var) ((var == NULL) ? NULL : (var = (gnome_desktop_item_unref (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define __g_list_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_free (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) - -struct _DesktopAgnosticFDODesktopEntryGNOME { - GObject parent_instance; - DesktopAgnosticFDODesktopEntryGNOMEPrivate * priv; -}; - -struct _DesktopAgnosticFDODesktopEntryGNOMEClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticFDODesktopEntryGNOMEPrivate { - GnomeDesktopItem* item; - DesktopAgnosticVFSFile* _file; - GKeyFile* _keyfile; -}; - - -static gpointer desktop_agnostic_fdo_desktop_entry_gnome_parent_class = NULL; -static DesktopAgnosticFDODesktopEntryIface* desktop_agnostic_fdo_desktop_entry_gnome_desktop_agnostic_fdo_desktop_entry_parent_iface = NULL; - -GType desktop_agnostic_fdo_desktop_entry_gnome_get_type (void); -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME, DesktopAgnosticFDODesktopEntryGNOMEPrivate)) -enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_FILE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_KEYFILE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_DATA, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ENTRY_TYPE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_NAME, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ICON -}; -static void desktop_agnostic_fdo_desktop_entry_gnome_real_constructed (GObject* base); -static gboolean desktop_agnostic_fdo_desktop_entry_gnome_real_key_exists (DesktopAgnosticFDODesktopEntry* base, const char* key); -static gboolean desktop_agnostic_fdo_desktop_entry_gnome_real_get_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key); -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key, gboolean value); -static char* desktop_agnostic_fdo_desktop_entry_gnome_real_get_string (DesktopAgnosticFDODesktopEntry* base, const char* key); -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_string (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* value); -static char* desktop_agnostic_fdo_desktop_entry_gnome_real_get_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale); -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale, const char* value); -static char** _vala_array_dup1 (char** self, int length); -static char** desktop_agnostic_fdo_desktop_entry_gnome_real_get_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key); -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key, char** value); -static gboolean desktop_agnostic_fdo_desktop_entry_gnome_real_exists (DesktopAgnosticFDODesktopEntry* base); -static void _g_list_free_g_free (GList* self); -static GPid desktop_agnostic_fdo_desktop_entry_gnome_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); -static void desktop_agnostic_fdo_desktop_entry_gnome_real_save (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* new_file, GError** error); -DesktopAgnosticFDODesktopEntryGNOME* desktop_agnostic_fdo_desktop_entry_gnome_new (void); -DesktopAgnosticFDODesktopEntryGNOME* desktop_agnostic_fdo_desktop_entry_gnome_construct (GType object_type); -static void desktop_agnostic_fdo_desktop_entry_gnome_finalize (GObject* obj); -static void desktop_agnostic_fdo_desktop_entry_gnome_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_fdo_desktop_entry_gnome_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType register_plugin (void); -static gint _vala_array_length (gpointer array); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_constructed (GObject* base) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - if (self->priv->item == NULL) { - GnomeDesktopItem* _tmp0_; - self->priv->item = (_tmp0_ = gnome_desktop_item_new (), _gnome_desktop_item_unref0 (self->priv->item), _tmp0_); - } -} - - -static gboolean desktop_agnostic_fdo_desktop_entry_gnome_real_key_exists (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGNOME * self; - gboolean result; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_val_if_fail (key != NULL, FALSE); - result = gnome_desktop_item_attr_exists (self->priv->item, key); - return result; -} - - -static gboolean desktop_agnostic_fdo_desktop_entry_gnome_real_get_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGNOME * self; - gboolean result; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_val_if_fail (key != NULL, FALSE); - result = gnome_desktop_item_get_boolean (self->priv->item, key); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key, gboolean value) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_if_fail (key != NULL); - gnome_desktop_item_set_boolean (self->priv->item, key, value); -} - - -static char* desktop_agnostic_fdo_desktop_entry_gnome_real_get_string (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGNOME * self; - char* result; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_val_if_fail (key != NULL, NULL); - result = g_strdup (gnome_desktop_item_get_string (self->priv->item, key)); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_string (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* value) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - gnome_desktop_item_set_string (self->priv->item, key, value); -} - - -static char* desktop_agnostic_fdo_desktop_entry_gnome_real_get_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale) { - DesktopAgnosticFDODesktopEntryGNOME * self; - char* result; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_val_if_fail (key != NULL, NULL); - if (locale == NULL) { - result = g_strdup (gnome_desktop_item_get_localestring (self->priv->item, key)); - return result; - } - result = g_strdup (gnome_desktop_item_get_localestring_lang (self->priv->item, key, locale)); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale, const char* value) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_if_fail (key != NULL); - g_return_if_fail (locale != NULL); - g_return_if_fail (value != NULL); - gnome_desktop_item_set_localestring_lang (self->priv->item, key, locale, value); -} - - -static char** _vala_array_dup1 (char** self, int length) { - char** result; - int i; - char** _tmp0_; - result = g_new0 (char*, length + 1); - for (i = 0; i < length; i++) { - result[i] = g_strdup (self[i]); - } - return result; -} - - -static char** desktop_agnostic_fdo_desktop_entry_gnome_real_get_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key) { - DesktopAgnosticFDODesktopEntryGNOME * self; - char** result; - char** _tmp1_; - char** _tmp0_; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_val_if_fail (key != NULL, NULL); - result = (_tmp1_ = (char**) (_tmp0_ = gnome_desktop_item_get_strings (self->priv->item, key)), (_tmp1_ == NULL) ? ((gpointer) _tmp1_) : _vala_array_dup1 (_tmp1_, _vala_array_length (_tmp0_))); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key, char** value) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - g_return_if_fail (key != NULL); - gnome_desktop_item_set_strings (self->priv->item, key, value); -} - - -static gboolean desktop_agnostic_fdo_desktop_entry_gnome_real_exists (DesktopAgnosticFDODesktopEntry* base) { - DesktopAgnosticFDODesktopEntryGNOME * self; - gboolean result; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - result = gnome_desktop_item_exists (self->priv->item); - return result; -} - - -static void _g_list_free_g_free (GList* self) { - g_list_foreach (self, (GFunc) g_free, NULL); - g_list_free (self); -} - - -static GPid desktop_agnostic_fdo_desktop_entry_gnome_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error) { - DesktopAgnosticFDODesktopEntryGNOME * self; - GPid result; - GError * _inner_error_; - GList* file_list; - GnomeDesktopItemLaunchFlags lflags; - gint _tmp0_; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - _inner_error_ = NULL; - file_list = NULL; - lflags = 0; - { - GSList* document_collection; - GSList* document_it; - document_collection = documents; - for (document_it = document_collection; document_it != NULL; document_it = document_it->next) { - const char* document; - document = (const char*) document_it->data; - { - file_list = g_list_append (file_list, g_strdup (document)); - } - } - } - if ((flags & DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_ONLY_ONE) != 0) { - lflags = lflags | GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE; - } - if ((flags & DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_USE_CWD) != 0) { - lflags = lflags | GNOME_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR; - } - if ((flags & DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_DO_NOT_REAP_CHILD) != 0) { - lflags = lflags | GNOME_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD; - } - _tmp0_ = gnome_desktop_item_launch (self->priv->item, file_list, lflags, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_list_free_g_free0 (file_list); - return 0; - } - result = (GPid) _tmp0_; - __g_list_free_g_free0 (file_list); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_save (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* new_file, GError** error) { - DesktopAgnosticFDODesktopEntryGNOME * self; - GError * _inner_error_; - char* uri; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - _inner_error_ = NULL; - uri = NULL; - if (new_file != NULL) { - char* _tmp0_; - uri = (_tmp0_ = desktop_agnostic_vfs_file_get_uri (new_file), _g_free0 (uri), _tmp0_); - } else { - if (self->priv->_file != NULL) { - char* _tmp1_; - uri = (_tmp1_ = desktop_agnostic_vfs_file_get_uri (self->priv->_file), _g_free0 (uri), _tmp1_); - } else { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_INVALID_FILE, "No filename specified."); - { - g_propagate_error (error, _inner_error_); - _g_free0 (uri); - return; - } - } - } - gnome_desktop_item_save (self->priv->item, uri, FALSE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (uri); - return; - } - _g_free0 (uri); -} - - -DesktopAgnosticFDODesktopEntryGNOME* desktop_agnostic_fdo_desktop_entry_gnome_construct (GType object_type) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticFDODesktopEntryGNOME* desktop_agnostic_fdo_desktop_entry_gnome_new (void) { - return desktop_agnostic_fdo_desktop_entry_gnome_construct (DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME); -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_fdo_desktop_entry_gnome_real_get_file (DesktopAgnosticFDODesktopEntry* base) { - DesktopAgnosticVFSFile* result; - DesktopAgnosticFDODesktopEntryGNOME* self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - result = self->priv->_file; - return result; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_file (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* value) { - GError * _inner_error_; - DesktopAgnosticFDODesktopEntryGNOME* self; - _inner_error_ = NULL; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - if (value != NULL) { - if (self->priv->item == NULL) { - char* path; - DesktopAgnosticVFSFile* _tmp0_; - char* _tmp1_; - path = NULL; - self->priv->_file = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_file), _tmp0_); - path = (_tmp1_ = desktop_agnostic_vfs_file_get_path (value), _g_free0 (path), _tmp1_); - if (path == NULL) { - char* _tmp2_; - GnomeDesktopItem* _tmp3_; - GnomeDesktopItem* _tmp4_; - GnomeDesktopItem* _tmp5_; - _tmp4_ = (_tmp3_ = gnome_desktop_item_new_from_uri (_tmp2_ = desktop_agnostic_vfs_file_get_uri (value), 0, &_inner_error_), _g_free0 (_tmp2_), _tmp3_); - if (_inner_error_ != NULL) { - _g_free0 (path); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->item = (_tmp5_ = _tmp4_, _gnome_desktop_item_unref0 (self->priv->item), _tmp5_); - } else { - GnomeDesktopItem* _tmp6_; - GnomeDesktopItem* _tmp7_; - _tmp6_ = gnome_desktop_item_new_from_file (path, 0, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (path); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->item = (_tmp7_ = _tmp6_, _gnome_desktop_item_unref0 (self->priv->item), _tmp7_); - } - _g_free0 (path); - } else { - g_warning ("desktop-entry-impl-gnome.vala:60: The desktop entry has already been initialized."); - } - } - g_object_notify ((GObject *) self, "file"); -} - - -static GKeyFile* desktop_agnostic_fdo_desktop_entry_gnome_real_get_keyfile (DesktopAgnosticFDODesktopEntry* base) { - GKeyFile* result; - DesktopAgnosticFDODesktopEntryGNOME* self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - result = self->priv->_keyfile; - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_keyfile (DesktopAgnosticFDODesktopEntry* base, GKeyFile* value) { - GError * _inner_error_; - DesktopAgnosticFDODesktopEntryGNOME* self; - _inner_error_ = NULL; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - if (value != NULL) { - if (self->priv->item == NULL) { - char* data; - gsize length = 0UL; - char* _tmp0_; - GnomeDesktopItem* _tmp1_; - GnomeDesktopItem* _tmp2_; - data = NULL; - self->priv->_keyfile = value; - data = (_tmp0_ = g_key_file_to_data (value, &length, NULL), _g_free0 (data), _tmp0_); - _tmp1_ = gnome_desktop_item_new_from_string ("", data, (gssize) length, 0, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (data); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->item = (_tmp2_ = _tmp1_, _gnome_desktop_item_unref0 (self->priv->item), _tmp2_); - _g_free0 (data); - } else { - g_warning ("desktop-entry-impl-gnome.vala:89: The desktop entry has already been initialized."); - } - } - g_object_notify ((GObject *) self, "keyfile"); -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_data (DesktopAgnosticFDODesktopEntry* base, const char* value) { - GError * _inner_error_; - DesktopAgnosticFDODesktopEntryGNOME* self; - gboolean _tmp0_ = FALSE; - _inner_error_ = NULL; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - if (value != NULL) { - _tmp0_ = _vala_strcmp0 (value, "") != 0; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - if (self->priv->item == NULL) { - GnomeDesktopItem* _tmp1_; - GnomeDesktopItem* _tmp2_; - _tmp1_ = gnome_desktop_item_new_from_string ("", value, (gssize) (-1), 0, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->item = (_tmp2_ = _tmp1_, _gnome_desktop_item_unref0 (self->priv->item), _tmp2_); - } else { - g_warning ("desktop-entry-impl-gnome.vala:108: The desktop entry has already been initialized."); - } - } - g_object_notify ((GObject *) self, "data"); -} - - -static DesktopAgnosticFDODesktopEntryType desktop_agnostic_fdo_desktop_entry_gnome_real_get_entry_type (DesktopAgnosticFDODesktopEntry* base) { - DesktopAgnosticFDODesktopEntryType result; - DesktopAgnosticFDODesktopEntryGNOME* self; - DesktopAgnosticFDODesktopEntryType _result_ = 0; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - switch (gnome_desktop_item_get_entry_type (self->priv->item)) { - case GNOME_DESKTOP_ITEM_TYPE_APPLICATION: - { - _result_ = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION; - break; - } - case GNOME_DESKTOP_ITEM_TYPE_LINK: - { - _result_ = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK; - break; - } - case GNOME_DESKTOP_ITEM_TYPE_DIRECTORY: - { - _result_ = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY; - break; - } - default: - { - _result_ = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN; - break; - } - } - result = _result_; - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_entry_type (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryType value) { - DesktopAgnosticFDODesktopEntryGNOME* self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - switch (value) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN: - { - gnome_desktop_item_set_entry_type (self->priv->item, GNOME_DESKTOP_ITEM_TYPE_OTHER); - break; - } - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: - { - gnome_desktop_item_set_entry_type (self->priv->item, GNOME_DESKTOP_ITEM_TYPE_APPLICATION); - break; - } - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK: - { - gnome_desktop_item_set_entry_type (self->priv->item, GNOME_DESKTOP_ITEM_TYPE_LINK); - break; - } - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY: - { - gnome_desktop_item_set_entry_type (self->priv->item, GNOME_DESKTOP_ITEM_TYPE_DIRECTORY); - break; - } - } - g_object_notify ((GObject *) self, "entry-type"); -} - - -static char* desktop_agnostic_fdo_desktop_entry_gnome_real_get_name (DesktopAgnosticFDODesktopEntry* base) { - char* result; - DesktopAgnosticFDODesktopEntryGNOME* self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - result = g_strdup (gnome_desktop_item_get_string (self->priv->item, GNOME_DESKTOP_ITEM_NAME)); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_name (DesktopAgnosticFDODesktopEntry* base, const char* value) { - DesktopAgnosticFDODesktopEntryGNOME* self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - gnome_desktop_item_set_string (self->priv->item, GNOME_DESKTOP_ITEM_NAME, value); - g_object_notify ((GObject *) self, "name"); -} - - -static char* desktop_agnostic_fdo_desktop_entry_gnome_real_get_icon (DesktopAgnosticFDODesktopEntry* base) { - char* result; - DesktopAgnosticFDODesktopEntryGNOME* self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - result = g_strdup (gnome_desktop_item_get_icon (self->priv->item, gtk_icon_theme_get_default ())); - return result; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_icon (DesktopAgnosticFDODesktopEntry* base, const char* value) { - DesktopAgnosticFDODesktopEntryGNOME* self; - self = (DesktopAgnosticFDODesktopEntryGNOME*) base; - if (value == NULL) { - g_warning ("desktop-entry-impl-gnome.vala:179: Cannot set a NULL value for 'Icon'."); - } else { - gnome_desktop_item_set_string (self->priv->item, GNOME_DESKTOP_ITEM_ICON, value); - } - g_object_notify ((GObject *) self, "icon"); -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_class_init (DesktopAgnosticFDODesktopEntryGNOMEClass * klass) { - desktop_agnostic_fdo_desktop_entry_gnome_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticFDODesktopEntryGNOMEPrivate)); - G_OBJECT_CLASS (klass)->constructed = desktop_agnostic_fdo_desktop_entry_gnome_real_constructed; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_fdo_desktop_entry_gnome_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_fdo_desktop_entry_gnome_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_fdo_desktop_entry_gnome_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_FILE, "file"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_KEYFILE, "keyfile"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_DATA, "data"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ENTRY_TYPE, "entry-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ICON, "icon"); -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_desktop_agnostic_fdo_desktop_entry_interface_init (DesktopAgnosticFDODesktopEntryIface * iface) { - desktop_agnostic_fdo_desktop_entry_gnome_desktop_agnostic_fdo_desktop_entry_parent_iface = g_type_interface_peek_parent (iface); - iface->key_exists = desktop_agnostic_fdo_desktop_entry_gnome_real_key_exists; - iface->get_boolean = desktop_agnostic_fdo_desktop_entry_gnome_real_get_boolean; - iface->set_boolean = desktop_agnostic_fdo_desktop_entry_gnome_real_set_boolean; - iface->get_string = desktop_agnostic_fdo_desktop_entry_gnome_real_get_string; - iface->set_string = desktop_agnostic_fdo_desktop_entry_gnome_real_set_string; - iface->get_localestring = desktop_agnostic_fdo_desktop_entry_gnome_real_get_localestring; - iface->set_localestring = desktop_agnostic_fdo_desktop_entry_gnome_real_set_localestring; - iface->get_string_list = desktop_agnostic_fdo_desktop_entry_gnome_real_get_string_list; - iface->set_string_list = desktop_agnostic_fdo_desktop_entry_gnome_real_set_string_list; - iface->exists = desktop_agnostic_fdo_desktop_entry_gnome_real_exists; - iface->launch = desktop_agnostic_fdo_desktop_entry_gnome_real_launch; - iface->save = desktop_agnostic_fdo_desktop_entry_gnome_real_save; - iface->get_file = desktop_agnostic_fdo_desktop_entry_gnome_real_get_file; - iface->set_file = desktop_agnostic_fdo_desktop_entry_gnome_real_set_file; - iface->get_keyfile = desktop_agnostic_fdo_desktop_entry_gnome_real_get_keyfile; - iface->set_keyfile = desktop_agnostic_fdo_desktop_entry_gnome_real_set_keyfile; - iface->set_data = desktop_agnostic_fdo_desktop_entry_gnome_real_set_data; - iface->get_entry_type = desktop_agnostic_fdo_desktop_entry_gnome_real_get_entry_type; - iface->set_entry_type = desktop_agnostic_fdo_desktop_entry_gnome_real_set_entry_type; - iface->get_name = desktop_agnostic_fdo_desktop_entry_gnome_real_get_name; - iface->set_name = desktop_agnostic_fdo_desktop_entry_gnome_real_set_name; - iface->get_icon = desktop_agnostic_fdo_desktop_entry_gnome_real_get_icon; - iface->set_icon = desktop_agnostic_fdo_desktop_entry_gnome_real_set_icon; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_instance_init (DesktopAgnosticFDODesktopEntryGNOME * self) { - self->priv = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_GET_PRIVATE (self); - self->priv->item = NULL; - self->priv->_file = NULL; - self->priv->_keyfile = NULL; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_finalize (GObject* obj) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME (obj); - _gnome_desktop_item_unref0 (self->priv->item); - _g_object_unref0 (self->priv->_file); - G_OBJECT_CLASS (desktop_agnostic_fdo_desktop_entry_gnome_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_fdo_desktop_entry_gnome_get_type (void) { - static GType desktop_agnostic_fdo_desktop_entry_gnome_type_id = 0; - if (desktop_agnostic_fdo_desktop_entry_gnome_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticFDODesktopEntryGNOMEClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_fdo_desktop_entry_gnome_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticFDODesktopEntryGNOME), 0, (GInstanceInitFunc) desktop_agnostic_fdo_desktop_entry_gnome_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_fdo_desktop_entry_info = { (GInterfaceInitFunc) desktop_agnostic_fdo_desktop_entry_gnome_desktop_agnostic_fdo_desktop_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_fdo_desktop_entry_gnome_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticFDODesktopEntryGNOME", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_fdo_desktop_entry_gnome_type_id, DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY, &desktop_agnostic_fdo_desktop_entry_info); - } - return desktop_agnostic_fdo_desktop_entry_gnome_type_id; -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_FILE: - g_value_set_object (value, desktop_agnostic_fdo_desktop_entry_get_file ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_KEYFILE: - g_value_set_pointer (value, desktop_agnostic_fdo_desktop_entry_get_keyfile ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ENTRY_TYPE: - g_value_set_enum (value, desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_NAME: - g_value_set_string (value, desktop_agnostic_fdo_desktop_entry_get_name ((DesktopAgnosticFDODesktopEntry*) self)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ICON: - g_value_set_string (value, desktop_agnostic_fdo_desktop_entry_get_icon ((DesktopAgnosticFDODesktopEntry*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_fdo_desktop_entry_gnome_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticFDODesktopEntryGNOME * self; - self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_FILE: - desktop_agnostic_fdo_desktop_entry_set_file ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_object (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_KEYFILE: - desktop_agnostic_fdo_desktop_entry_set_keyfile ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_pointer (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_DATA: - desktop_agnostic_fdo_desktop_entry_set_data ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ENTRY_TYPE: - desktop_agnostic_fdo_desktop_entry_set_entry_type ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_enum (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_NAME: - desktop_agnostic_fdo_desktop_entry_set_name ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ICON: - desktop_agnostic_fdo_desktop_entry_set_icon ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -GType register_plugin (void) { - GType result; - result = DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GNOME; - return result; -} - - -static gint _vala_array_length (gpointer array) { - int length; - length = 0; - if (array) { - while (((gpointer*) array)[length]) { - length++; - } - } - return length; -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/fdo.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/fdo.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/fdo.h 2010-04-11 07:32:15.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/fdo.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/* fdo.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_FDO_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_FDO_H__ - -#include -#include -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_LAUNCH_FLAGS (desktop_agnostic_fdo_desktop_entry_launch_flags_get_type ()) - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_TYPE (desktop_agnostic_fdo_desktop_entry_type_get_type ()) - -#define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY (desktop_agnostic_fdo_desktop_entry_get_type ()) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY, DesktopAgnosticFDODesktopEntry)) -#define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY)) -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY, DesktopAgnosticFDODesktopEntryIface)) - -typedef struct _DesktopAgnosticFDODesktopEntry DesktopAgnosticFDODesktopEntry; -typedef struct _DesktopAgnosticFDODesktopEntryIface DesktopAgnosticFDODesktopEntryIface; - -typedef enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_ONLY_ONE = 1 << 0, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_USE_CWD = 1 << 1, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_DO_NOT_REAP_CHILD = 1 << 2 -} DesktopAgnosticFDODesktopEntryLaunchFlags; - -typedef enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN = 0, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY -} DesktopAgnosticFDODesktopEntryType; - -typedef enum { - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_INVALID_FILE, - DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE -} DesktopAgnosticFDODesktopEntryError; -#define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR desktop_agnostic_fdo_desktop_entry_error_quark () -struct _DesktopAgnosticFDODesktopEntryIface { - GTypeInterface parent_iface; - gboolean (*key_exists) (DesktopAgnosticFDODesktopEntry* self, const char* key); - gboolean (*get_boolean) (DesktopAgnosticFDODesktopEntry* self, const char* key); - void (*set_boolean) (DesktopAgnosticFDODesktopEntry* self, const char* key, gboolean value); - char* (*get_string) (DesktopAgnosticFDODesktopEntry* self, const char* key); - void (*set_string) (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* value); - char* (*get_localestring) (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale); - void (*set_localestring) (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale, const char* value); - char** (*get_string_list) (DesktopAgnosticFDODesktopEntry* self, const char* key); - void (*set_string_list) (DesktopAgnosticFDODesktopEntry* self, const char* key, char** value); - gboolean (*exists) (DesktopAgnosticFDODesktopEntry* self); - GPid (*launch) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); - void (*save) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* new_file, GError** error); - DesktopAgnosticVFSFile* (*get_file) (DesktopAgnosticFDODesktopEntry* self); - void (*set_file) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* value); - GKeyFile* (*get_keyfile) (DesktopAgnosticFDODesktopEntry* self); - void (*set_keyfile) (DesktopAgnosticFDODesktopEntry* self, GKeyFile* value); - void (*set_data) (DesktopAgnosticFDODesktopEntry* self, const char* value); - DesktopAgnosticFDODesktopEntryType (*get_entry_type) (DesktopAgnosticFDODesktopEntry* self); - void (*set_entry_type) (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryType value); - char* (*get_name) (DesktopAgnosticFDODesktopEntry* self); - void (*set_name) (DesktopAgnosticFDODesktopEntry* self, const char* value); - char* (*get_icon) (DesktopAgnosticFDODesktopEntry* self); - void (*set_icon) (DesktopAgnosticFDODesktopEntry* self, const char* value); -}; - - -GType desktop_agnostic_fdo_desktop_entry_launch_flags_get_type (void); -GType desktop_agnostic_fdo_desktop_entry_type_get_type (void); -GQuark desktop_agnostic_fdo_desktop_entry_error_quark (void); -char* desktop_agnostic_fdo_desktop_entry_type_to_string (DesktopAgnosticFDODesktopEntryType entry_type); -GType desktop_agnostic_fdo_desktop_entry_get_type (void); -gboolean desktop_agnostic_fdo_desktop_entry_key_exists (DesktopAgnosticFDODesktopEntry* self, const char* key); -gboolean desktop_agnostic_fdo_desktop_entry_get_boolean (DesktopAgnosticFDODesktopEntry* self, const char* key); -void desktop_agnostic_fdo_desktop_entry_set_boolean (DesktopAgnosticFDODesktopEntry* self, const char* key, gboolean value); -char* desktop_agnostic_fdo_desktop_entry_get_string (DesktopAgnosticFDODesktopEntry* self, const char* key); -void desktop_agnostic_fdo_desktop_entry_set_string (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* value); -char* desktop_agnostic_fdo_desktop_entry_get_localestring (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale); -void desktop_agnostic_fdo_desktop_entry_set_localestring (DesktopAgnosticFDODesktopEntry* self, const char* key, const char* locale, const char* value); -char** desktop_agnostic_fdo_desktop_entry_get_string_list (DesktopAgnosticFDODesktopEntry* self, const char* key); -void desktop_agnostic_fdo_desktop_entry_set_string_list (DesktopAgnosticFDODesktopEntry* self, const char* key, char** value); -gboolean desktop_agnostic_fdo_desktop_entry_exists (DesktopAgnosticFDODesktopEntry* self); -GPid desktop_agnostic_fdo_desktop_entry_launch (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); -void desktop_agnostic_fdo_desktop_entry_save (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* new_file, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_fdo_desktop_entry_get_file (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_file (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticVFSFile* value); -GKeyFile* desktop_agnostic_fdo_desktop_entry_get_keyfile (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_keyfile (DesktopAgnosticFDODesktopEntry* self, GKeyFile* value); -void desktop_agnostic_fdo_desktop_entry_set_data (DesktopAgnosticFDODesktopEntry* self, const char* value); -DesktopAgnosticFDODesktopEntryType desktop_agnostic_fdo_desktop_entry_get_entry_type (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_entry_type (DesktopAgnosticFDODesktopEntry* self, DesktopAgnosticFDODesktopEntryType value); -char* desktop_agnostic_fdo_desktop_entry_get_name (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_name (DesktopAgnosticFDODesktopEntry* self, const char* value); -char* desktop_agnostic_fdo_desktop_entry_get_icon (DesktopAgnosticFDODesktopEntry* self); -void desktop_agnostic_fdo_desktop_entry_set_icon (DesktopAgnosticFDODesktopEntry* self, const char* value); -GType desktop_agnostic_fdo_get_type (GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new (GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_file (DesktopAgnosticVFSFile* file, GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_keyfile (GKeyFile* keyfile, GError** error); -DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_data (const char* data, GError** error); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/module.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/module.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/module.c 2010-04-11 07:32:10.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/module.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,540 +0,0 @@ -/* module.c generated by valac, the Vala compiler - * generated from module.vala, do not modify */ - -/* - * Init function for the library. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER (desktop_agnostic_module_loader_get_type ()) -#define DESKTOP_AGNOSTIC_MODULE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER, DesktopAgnosticModuleLoader)) -#define DESKTOP_AGNOSTIC_MODULE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER, DesktopAgnosticModuleLoaderClass)) -#define DESKTOP_AGNOSTIC_IS_MODULE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER)) -#define DESKTOP_AGNOSTIC_IS_MODULE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER)) -#define DESKTOP_AGNOSTIC_MODULE_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER, DesktopAgnosticModuleLoaderClass)) - -typedef struct _DesktopAgnosticModuleLoader DesktopAgnosticModuleLoader; -typedef struct _DesktopAgnosticModuleLoaderClass DesktopAgnosticModuleLoaderClass; -typedef struct _DesktopAgnosticModuleLoaderPrivate DesktopAgnosticModuleLoaderPrivate; -#define _g_module_close0(var) ((var == NULL) ? NULL : (var = (g_module_close (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -typedef enum { - DESKTOP_AGNOSTIC_MODULE_ERROR_NO_GMODULE -} DesktopAgnosticModuleError; -#define DESKTOP_AGNOSTIC_MODULE_ERROR desktop_agnostic_module_error_quark () -struct _DesktopAgnosticModuleLoader { - GObject parent_instance; - DesktopAgnosticModuleLoaderPrivate * priv; -}; - -struct _DesktopAgnosticModuleLoaderClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticModuleLoaderPrivate { - GModule* module_guesser; -}; - -typedef GType (*DesktopAgnosticModuleLoaderRegisterModuleFunction) (); -typedef GType (*DesktopAgnosticModuleLoaderGuessModuleFunction) (DesktopAgnosticModuleLoader* loader, const char* library_prefix); - -extern GData* desktop_agnostic_modules; -GData* desktop_agnostic_modules = {0}; -static char** desktop_agnostic_module_loader_paths; -static gint desktop_agnostic_module_loader_paths_length1; -static char** desktop_agnostic_module_loader_paths = NULL; -static gint desktop_agnostic_module_loader_paths_length1 = 0; -static gint desktop_agnostic_module_loader_paths_size = 0; -static DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_module_loader; -static DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_module_loader = NULL; -static gpointer desktop_agnostic_module_loader_parent_class = NULL; -extern GKeyFile* desktop_agnostic_module_config; -GKeyFile* desktop_agnostic_module_config = NULL; - -GQuark desktop_agnostic_module_error_quark (void); -void desktop_agnostic_debug_msg (const char* message); -GType desktop_agnostic_module_loader_get_type (void); -#define DESKTOP_AGNOSTIC_MODULE_LOADER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER, DesktopAgnosticModuleLoaderPrivate)) -enum { - DESKTOP_AGNOSTIC_MODULE_LOADER_DUMMY_PROPERTY -}; -static DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_new (void); -static DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_construct (GType object_type); -DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_get_default (void); -static char** _vala_array_dup1 (char** self, int length); -char** desktop_agnostic_module_loader_get_search_paths (int* result_length1); -GType desktop_agnostic_module_loader_load_from_path (DesktopAgnosticModuleLoader* self, const char* name, const char* path); -GType desktop_agnostic_module_loader_load (DesktopAgnosticModuleLoader* self, const char* name); -gboolean desktop_agnostic_module_loader_is_guess_module_loaded (DesktopAgnosticModuleLoader* self); -static GModule* desktop_agnostic_module_loader_try_load_guess_module (DesktopAgnosticModuleLoader* self, const char* prefix); -GType desktop_agnostic_module_loader_guess_module (DesktopAgnosticModuleLoader* self, const char* library_prefix); -static void desktop_agnostic_module_loader_finalize (GObject* obj); -GType desktop_agnostic_get_module_type (const char* prefix, const char* key, GError** error); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); - - - -GQuark desktop_agnostic_module_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_module_error-quark"); -} - - -void desktop_agnostic_debug_msg (const char* message) { - g_return_if_fail (message != NULL); - if (g_getenv ("DESKTOP_AGNOSTIC_MODULE_DEBUG") != NULL) { - g_debug ("module.vala:35: %s", message); - } -} - - -static DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_construct (GType object_type) { - DesktopAgnosticModuleLoader * self; - GModule* _tmp0_; - self = (DesktopAgnosticModuleLoader*) g_object_new (object_type, NULL); - g_assert (g_module_supported ()); - self->priv->module_guesser = (_tmp0_ = NULL, _g_module_close0 (self->priv->module_guesser), _tmp0_); - return self; -} - - -static DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_new (void) { - return desktop_agnostic_module_loader_construct (DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER); -} - - -DesktopAgnosticModuleLoader* desktop_agnostic_module_loader_get_default (void) { - DesktopAgnosticModuleLoader* result; - if (desktop_agnostic_module_loader_module_loader == NULL) { - DesktopAgnosticModuleLoader* _tmp0_; - desktop_agnostic_module_loader_module_loader = (_tmp0_ = desktop_agnostic_module_loader_new (), _g_object_unref0 (desktop_agnostic_module_loader_module_loader), _tmp0_); - } - result = desktop_agnostic_module_loader_module_loader; - return result; -} - - -static char** _vala_array_dup1 (char** self, int length) { - char** result; - int i; - result = g_new0 (char*, length + 1); - for (i = 0; i < length; i++) { - result[i] = g_strdup (self[i]); - } - return result; -} - - -char** desktop_agnostic_module_loader_get_search_paths (int* result_length1) { - char** result; - char** _tmp0_; - char** _tmp1_; - result = (_tmp1_ = (_tmp0_ = desktop_agnostic_module_loader_paths, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup1 (_tmp0_, desktop_agnostic_module_loader_paths_length1)), *result_length1 = desktop_agnostic_module_loader_paths_length1, _tmp1_); - return result; -} - - -GType desktop_agnostic_module_loader_load_from_path (DesktopAgnosticModuleLoader* self, const char* name, const char* path) { - GType result; - GModule* module; - char* _tmp0_; - GModule* _tmp1_; - g_return_val_if_fail (self != NULL, 0UL); - g_return_val_if_fail (name != NULL, 0UL); - g_return_val_if_fail (path != NULL, 0UL); - module = NULL; - desktop_agnostic_debug_msg (_tmp0_ = g_strdup_printf ("Loading plugin with path: '%s'", path)); - _g_free0 (_tmp0_); - module = (_tmp1_ = g_module_open (path, G_MODULE_BIND_LAZY), _g_module_close0 (module), _tmp1_); - if (module == NULL) { - g_critical ("module.vala:99: Could not load the module '%s': %s", path, g_module_error ()); - result = G_TYPE_INVALID; - _g_module_close0 (module); - return result; - } else { - void* function; - function = NULL; - g_module_symbol (module, "register_plugin", &function); - if (function == NULL) { - g_critical ("module.vala:110: Could not find entry function for '%s'.", path); - result = G_TYPE_INVALID; - _g_module_close0 (module); - return result; - } else { - DesktopAgnosticModuleLoaderRegisterModuleFunction register_plugin = NULL; - GModule* _tmp2_; - register_plugin = (DesktopAgnosticModuleLoaderRegisterModuleFunction) function; - g_datalist_set_data (&desktop_agnostic_modules, name, (_tmp2_ = module, module = NULL, _tmp2_)); - result = register_plugin (); - _g_module_close0 (module); - return result; - } - } - _g_module_close0 (module); -} - - -GType desktop_agnostic_module_loader_load (DesktopAgnosticModuleLoader* self, const char* name) { - GType result; - char* path; - GType module_type; - g_return_val_if_fail (self != NULL, 0UL); - g_return_val_if_fail (name != NULL, 0UL); - path = NULL; - module_type = G_TYPE_INVALID; - { - char** prefix_collection; - int prefix_collection_length1; - int prefix_it; - prefix_collection = desktop_agnostic_module_loader_paths; - prefix_collection_length1 = desktop_agnostic_module_loader_paths_length1; - for (prefix_it = 0; prefix_it < desktop_agnostic_module_loader_paths_length1; prefix_it = prefix_it + 1) { - const char* prefix; - prefix = prefix_collection[prefix_it]; - { - gboolean _tmp0_ = FALSE; - char* _tmp4_; - char* _tmp3_; - char* _tmp2_; - char* _tmp1_; - char* _tmp5_; - if (prefix == NULL) { - _tmp0_ = TRUE; - } else { - _tmp0_ = !g_file_test (prefix, G_FILE_TEST_IS_DIR); - } - if (_tmp0_) { - continue; - } - path = (_tmp4_ = g_module_build_path (_tmp2_ = g_build_filename (prefix, _tmp1_ = g_path_get_dirname (name), NULL), _tmp3_ = g_path_get_basename (name)), _g_free0 (path), _tmp4_); - _g_free0 (_tmp3_); - _g_free0 (_tmp2_); - _g_free0 (_tmp1_); - module_type = desktop_agnostic_module_loader_load_from_path (self, name, path); - desktop_agnostic_debug_msg (_tmp5_ = g_strdup_printf ("Plugin type: %s", g_type_name (module_type))); - _g_free0 (_tmp5_); - if (module_type != G_TYPE_INVALID) { - break; - } - } - } - } - if (module_type == G_TYPE_INVALID) { - char* _tmp8_; - char* _tmp7_; - char* _tmp6_; - path = (_tmp8_ = g_module_build_path (_tmp6_ = g_get_current_dir (), _tmp7_ = g_path_get_basename (name)), _g_free0 (path), _tmp8_); - _g_free0 (_tmp7_); - _g_free0 (_tmp6_); - module_type = desktop_agnostic_module_loader_load_from_path (self, name, path); - if (module_type == G_TYPE_INVALID) { - g_warning ("module.vala:155: Could not locate the plugin '%s'.", name); - } - } - result = module_type; - _g_free0 (path); - return result; -} - - -gboolean desktop_agnostic_module_loader_is_guess_module_loaded (DesktopAgnosticModuleLoader* self) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->module_guesser != NULL; - return result; -} - - -static GModule* desktop_agnostic_module_loader_try_load_guess_module (DesktopAgnosticModuleLoader* self, const char* prefix) { - GModule* result; - char* library; - char* path; - char* _tmp0_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (prefix != NULL, NULL); - library = g_strdup ("libda-module-guesser"); - path = NULL; - path = (_tmp0_ = g_module_build_path (prefix, library), _g_free0 (path), _tmp0_); - result = g_module_open (path, G_MODULE_BIND_LAZY); - _g_free0 (library); - _g_free0 (path); - return result; -} - - -GType desktop_agnostic_module_loader_guess_module (DesktopAgnosticModuleLoader* self, const char* library_prefix) { - GType result; - void* function = NULL; - DesktopAgnosticModuleLoaderGuessModuleFunction guess_module = NULL; - g_return_val_if_fail (self != NULL, 0UL); - g_return_val_if_fail (library_prefix != NULL, 0UL); - if (self->priv->module_guesser == NULL) { - { - char** prefix_collection; - int prefix_collection_length1; - int prefix_it; - prefix_collection = desktop_agnostic_module_loader_paths; - prefix_collection_length1 = desktop_agnostic_module_loader_paths_length1; - for (prefix_it = 0; prefix_it < desktop_agnostic_module_loader_paths_length1; prefix_it = prefix_it + 1) { - const char* prefix; - prefix = prefix_collection[prefix_it]; - { - gboolean _tmp0_ = FALSE; - GModule* _tmp1_; - if (prefix == NULL) { - _tmp0_ = TRUE; - } else { - _tmp0_ = !g_file_test (prefix, G_FILE_TEST_IS_DIR); - } - if (_tmp0_) { - continue; - } - self->priv->module_guesser = (_tmp1_ = desktop_agnostic_module_loader_try_load_guess_module (self, prefix), _g_module_close0 (self->priv->module_guesser), _tmp1_); - if (self->priv->module_guesser != NULL) { - break; - } - } - } - } - if (self->priv->module_guesser == NULL) { - GModule* _tmp3_; - char* _tmp2_; - self->priv->module_guesser = (_tmp3_ = desktop_agnostic_module_loader_try_load_guess_module (self, _tmp2_ = g_get_current_dir ()), _g_module_close0 (self->priv->module_guesser), _tmp3_); - _g_free0 (_tmp2_); - } - } - g_assert (self->priv->module_guesser != NULL); - g_module_symbol (self->priv->module_guesser, "guess_module", &function); - guess_module = (DesktopAgnosticModuleLoaderGuessModuleFunction) function; - result = guess_module (self, library_prefix); - return result; -} - - -static void desktop_agnostic_module_loader_class_init (DesktopAgnosticModuleLoaderClass * klass) { - desktop_agnostic_module_loader_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticModuleLoaderPrivate)); - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_module_loader_finalize; - { - char** _tmp1_; - char** _tmp0_ = NULL; - GData* _tmp2_ = {0}; - desktop_agnostic_module_loader_paths = (_tmp1_ = (_tmp0_ = g_new0 (char*, 3 + 1), _tmp0_[0] = g_strdup (g_getenv ("DESKTOP_AGNOSTIC_MODULE_DIR")), _tmp0_[1] = g_build_filename (LIBDIR, "desktop-agnostic", "modules", NULL), _tmp0_[2] = g_build_filename (g_get_home_dir (), ".local", "lib", "desktop-agnostic", NULL), _tmp0_), desktop_agnostic_module_loader_paths = (_vala_array_free (desktop_agnostic_module_loader_paths, desktop_agnostic_module_loader_paths_length1, (GDestroyNotify) g_free), NULL), desktop_agnostic_module_loader_paths_length1 = 3, desktop_agnostic_module_loader_paths_size = desktop_agnostic_module_loader_paths_length1, _tmp1_); - desktop_agnostic_modules = (g_datalist_init (&_tmp2_), _tmp2_); - } -} - - -static void desktop_agnostic_module_loader_instance_init (DesktopAgnosticModuleLoader * self) { - self->priv = DESKTOP_AGNOSTIC_MODULE_LOADER_GET_PRIVATE (self); -} - - -static void desktop_agnostic_module_loader_finalize (GObject* obj) { - DesktopAgnosticModuleLoader * self; - self = DESKTOP_AGNOSTIC_MODULE_LOADER (obj); - _g_module_close0 (self->priv->module_guesser); - G_OBJECT_CLASS (desktop_agnostic_module_loader_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_module_loader_get_type (void) { - static GType desktop_agnostic_module_loader_type_id = 0; - if (desktop_agnostic_module_loader_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticModuleLoaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_module_loader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticModuleLoader), 0, (GInstanceInitFunc) desktop_agnostic_module_loader_instance_init, NULL }; - desktop_agnostic_module_loader_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticModuleLoader", &g_define_type_info, 0); - } - return desktop_agnostic_module_loader_type_id; -} - - -GType desktop_agnostic_get_module_type (const char* prefix, const char* key, GError** error) { - GType result; - GError * _inner_error_; - DesktopAgnosticModuleLoader* loader; - char* cfg_file; - gboolean _tmp0_ = FALSE; - g_return_val_if_fail (prefix != NULL, 0UL); - g_return_val_if_fail (key != NULL, 0UL); - _inner_error_ = NULL; - loader = NULL; - cfg_file = g_strdup ("desktop-agnostic.ini"); - if (!g_module_supported ()) { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_MODULE_ERROR, DESKTOP_AGNOSTIC_MODULE_ERROR_NO_GMODULE, "libdesktop-agnostic requires GModule support."); - { - g_propagate_error (error, _inner_error_); - _g_free0 (cfg_file); - return 0UL; - } - } - loader = desktop_agnostic_module_loader_get_default (); - if (desktop_agnostic_module_config == NULL) { - _tmp0_ = !desktop_agnostic_module_loader_is_guess_module_loaded (loader); - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - gboolean loaded_config; - char* system_path; - char* user_path; - GKeyFile* _tmp1_; - char* _tmp2_; - char* _tmp5_; - loaded_config = FALSE; - system_path = NULL; - user_path = NULL; - desktop_agnostic_module_config = (_tmp1_ = g_key_file_new (), _g_key_file_free0 (desktop_agnostic_module_config), _tmp1_); - system_path = (_tmp2_ = g_build_filename (SYSCONFDIR, "xdg", "libdesktop-agnostic", cfg_file, NULL), _g_free0 (system_path), _tmp2_); - { - if (g_file_test (system_path, G_FILE_TEST_EXISTS)) { - char* _tmp3_; - gboolean _tmp4_; - desktop_agnostic_debug_msg (_tmp3_ = g_strdup_printf ("Loading module config from the system: '%s'", system_path)); - _g_free0 (_tmp3_); - _tmp4_ = g_key_file_load_from_file (desktop_agnostic_module_config, system_path, G_KEY_FILE_NONE, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch0_g_key_file_error; - } - goto __finally0; - } - loaded_config = _tmp4_; - } - } - goto __finally0; - __catch0_g_key_file_error: - { - GError * _error_; - _error_ = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("module.vala:246: KeyFile error: %s", _error_->message); - _g_error_free0 (_error_); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (system_path); - _g_free0 (user_path); - _g_free0 (cfg_file); - return 0UL; - } - user_path = (_tmp5_ = g_build_filename (g_get_user_config_dir (), cfg_file, NULL), _g_free0 (user_path), _tmp5_); - { - if (g_file_test (user_path, G_FILE_TEST_EXISTS)) { - char* _tmp6_; - gboolean _tmp7_; - desktop_agnostic_debug_msg (_tmp6_ = g_strdup_printf ("Loading module config from the user directory: '%s'", user_path)); - _g_free0 (_tmp6_); - _tmp7_ = g_key_file_load_from_file (desktop_agnostic_module_config, user_path, G_KEY_FILE_NONE, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch1_g_key_file_error; - } - goto __finally1; - } - loaded_config = loaded_config | _tmp7_; - } - } - goto __finally1; - __catch1_g_key_file_error: - { - GError * _error_; - _error_ = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("module.vala:261: KeyFile error: %s", _error_->message); - _g_error_free0 (_error_); - } - } - __finally1: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (system_path); - _g_free0 (user_path); - _g_free0 (cfg_file); - return 0UL; - } - _g_free0 (system_path); - _g_free0 (user_path); - } - if (g_key_file_has_group (desktop_agnostic_module_config, "DEFAULT")) { - char* _tmp8_; - char* _tmp9_; - char* _tmp10_; - char* library; - _tmp8_ = g_key_file_get_string (desktop_agnostic_module_config, "DEFAULT", key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (cfg_file); - return 0UL; - } - library = (_tmp10_ = g_strdup_printf ("libda-%s-%s", prefix, _tmp9_ = _tmp8_), _g_free0 (_tmp9_), _tmp10_); - result = desktop_agnostic_module_loader_load (loader, library); - _g_free0 (library); - _g_free0 (cfg_file); - return result; - } else { - char* library_prefix; - desktop_agnostic_debug_msg ("No module config files found, falling back to guessing."); - library_prefix = g_strdup_printf ("libda-%s-", prefix); - result = desktop_agnostic_module_loader_guess_module (loader, library_prefix); - _g_free0 (library_prefix); - _g_free0 (cfg_file); - return result; - } - _g_free0 (cfg_file); -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/module-guesser.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/module-guesser.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/module-guesser.c 2010-04-11 07:32:22.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/module-guesser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,185 +0,0 @@ -/* module-guesser.c generated by valac, the Vala compiler - * generated from module-guesser.vala, do not modify */ - -/* - * Desktop Agnostic Module guesser function. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -GType guess_module (DesktopAgnosticModuleLoader* loader, const char* library_prefix); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); - - - -GType guess_module (DesktopAgnosticModuleLoader* loader, const char* library_prefix) { - GType result; - GError * _inner_error_; - char** _tmp1_; - gint paths_size; - gint paths_length1; - gint _tmp0_; - char** paths; - char* module_glob_suffix; - GType _result_; - g_return_val_if_fail (loader != NULL, 0UL); - g_return_val_if_fail (library_prefix != NULL, 0UL); - _inner_error_ = NULL; - paths = (_tmp1_ = desktop_agnostic_module_loader_get_search_paths (&_tmp0_), paths_length1 = _tmp0_, paths_size = paths_length1, _tmp1_); - module_glob_suffix = g_strdup_printf ("%s*", library_prefix); - _result_ = G_TYPE_INVALID; - { - char** path_prefix_collection; - int path_prefix_collection_length1; - int path_prefix_it; - path_prefix_collection = paths; - path_prefix_collection_length1 = paths_length1; - for (path_prefix_it = 0; path_prefix_it < paths_length1; path_prefix_it = path_prefix_it + 1) { - const char* path_prefix; - path_prefix = path_prefix_collection[path_prefix_it]; - { - gboolean _tmp2_ = FALSE; - char* module_glob; - if (path_prefix == NULL) { - _tmp2_ = TRUE; - } else { - _tmp2_ = !g_file_test (path_prefix, G_FILE_TEST_IS_DIR); - } - if (_tmp2_) { - continue; - } - module_glob = g_build_filename (path_prefix, module_glob_suffix, NULL); - { - DesktopAgnosticVFSGlob* found_modules; - gint modules_paths_size; - gint modules_paths_length1; - char** modules_paths; - DesktopAgnosticVFSGlob* _tmp3_; - DesktopAgnosticVFSGlob* _tmp4_; - char** _tmp6_; - gint _tmp5_; - found_modules = NULL; - modules_paths = (modules_paths_length1 = 0, NULL); - _tmp3_ = desktop_agnostic_vfs_glob_execute (module_glob, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (found_modules); - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - goto __catch0_desktop_agnostic_vfs_glob_error; - } - _g_object_unref0 (found_modules); - _g_free0 (module_glob); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - _g_free0 (module_glob_suffix); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0UL; - } - found_modules = (_tmp4_ = _tmp3_, _g_object_unref0 (found_modules), _tmp4_); - modules_paths = (_tmp6_ = desktop_agnostic_vfs_glob_get_paths (found_modules, &_tmp5_), modules_paths_length1 = _tmp5_, modules_paths_size = modules_paths_length1, _tmp6_); - { - char** module_collection; - int module_collection_length1; - int module_it; - module_collection = modules_paths; - module_collection_length1 = modules_paths_length1; - for (module_it = 0; module_it < modules_paths_length1; module_it = module_it + 1) { - const char* module; - module = module_collection[module_it]; - { - _result_ = desktop_agnostic_module_loader_load_from_path (loader, path_prefix, module); - if (_result_ != G_TYPE_INVALID) { - break; - } - } - } - } - _g_object_unref0 (found_modules); - } - goto __finally0; - __catch0_desktop_agnostic_vfs_glob_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - if (!g_error_matches (err, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOMATCH)) { - g_warning ("module-guesser.vala:65: Glob-related eror: %s", err->message); - } - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_free0 (module_glob); - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - _g_free0 (module_glob_suffix); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0UL; - } - if (_result_ != G_TYPE_INVALID) { - _g_free0 (module_glob); - break; - } - _g_free0 (module_glob); - } - } - } - result = _result_; - paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); - _g_free0 (module_glob_suffix); - return result; -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-color-button.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-color-button.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-color-button.c 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-color-button.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,306 +0,0 @@ -/* ui-color-button.c generated by valac, the Vala compiler - * generated from ui-color-button.vala, do not modify */ - -/* - * Convenience class for GtkColorButton. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON (desktop_agnostic_ui_color_button_get_type ()) -#define DESKTOP_AGNOSTIC_UI_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, DesktopAgnosticUIColorButton)) -#define DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, DesktopAgnosticUIColorButtonClass)) -#define DESKTOP_AGNOSTIC_UI_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, DesktopAgnosticUIColorButtonClass)) - -typedef struct _DesktopAgnosticUIColorButton DesktopAgnosticUIColorButton; -typedef struct _DesktopAgnosticUIColorButtonClass DesktopAgnosticUIColorButtonClass; -typedef struct _DesktopAgnosticUIColorButtonPrivate DesktopAgnosticUIColorButtonPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -struct _DesktopAgnosticUIColorButton { - GtkColorButton parent_instance; - DesktopAgnosticUIColorButtonPrivate * priv; -}; - -struct _DesktopAgnosticUIColorButtonClass { - GtkColorButtonClass parent_class; -}; - -struct _DesktopAgnosticUIColorButtonPrivate { - gulong da_color_signal; - DesktopAgnosticColor* _da_color; -}; - - -static DesktopAgnosticColor* desktop_agnostic_ui_color_button_ZERO; -static DesktopAgnosticColor* desktop_agnostic_ui_color_button_ZERO = NULL; -static gpointer desktop_agnostic_ui_color_button_parent_class = NULL; - -GType desktop_agnostic_ui_color_button_get_type (void); -#define DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, DesktopAgnosticUIColorButtonPrivate)) -enum { - DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_DA_COLOR -}; -static void desktop_agnostic_ui_color_button_on_color_set (DesktopAgnosticUIColorButton* self); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_new_with_color (DesktopAgnosticColor* color); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_construct_with_color (GType object_type, DesktopAgnosticColor* color); -static void desktop_agnostic_ui_color_button_on_da_color_changed (DesktopAgnosticUIColorButton* self, GParamSpec* pspec); -static void _desktop_agnostic_ui_color_button_on_color_set_gtk_color_button_color_set (GtkColorButton* _sender, gpointer self); -static void desktop_agnostic_ui_color_button_real_constructed (GObject* base); -DesktopAgnosticColor* desktop_agnostic_ui_color_button_get_da_color (DesktopAgnosticUIColorButton* self); -static void desktop_agnostic_ui_color_button_da_color_notify (DesktopAgnosticUIColorButton* self); -void desktop_agnostic_ui_color_button_set_color (DesktopAgnosticUIColorButton* self, GdkColor* color); -void desktop_agnostic_ui_color_button_set_alpha (DesktopAgnosticUIColorButton* self, guint16 alpha); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_new (void); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_construct (GType object_type); -void desktop_agnostic_ui_color_button_set_da_color (DesktopAgnosticUIColorButton* self, DesktopAgnosticColor* value); -static void desktop_agnostic_ui_color_button_finalize (GObject* obj); -static void desktop_agnostic_ui_color_button_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_ui_color_button_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); - - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_construct_with_color (GType object_type, DesktopAgnosticColor* color) { - DesktopAgnosticUIColorButton * self; - GdkColor _tmp0_ = {0}; - GdkColor _tmp1_; - g_return_val_if_fail (color != NULL, NULL); - self = g_object_newv (object_type, 0, NULL); - gtk_color_button_set_color ((GtkColorButton*) self, (_tmp1_ = (desktop_agnostic_color_get_color (color, &_tmp0_), _tmp0_), &_tmp1_)); - gtk_color_button_set_alpha ((GtkColorButton*) self, desktop_agnostic_color_get_alpha (color)); - desktop_agnostic_ui_color_button_on_color_set (self); - return self; -} - - -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_new_with_color (DesktopAgnosticColor* color) { - return desktop_agnostic_ui_color_button_construct_with_color (DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, color); -} - - -static void _desktop_agnostic_ui_color_button_on_color_set_gtk_color_button_color_set (GtkColorButton* _sender, gpointer self) { - desktop_agnostic_ui_color_button_on_color_set (self); -} - - -static void desktop_agnostic_ui_color_button_real_constructed (GObject* base) { - DesktopAgnosticUIColorButton * self; - self = (DesktopAgnosticUIColorButton*) base; - gtk_color_button_set_use_alpha ((GtkColorButton*) self, TRUE); - self->priv->da_color_signal = g_signal_connect (self, "notify::da-color", (GCallback) desktop_agnostic_ui_color_button_on_da_color_changed, NULL); - g_signal_connect_object ((GtkColorButton*) self, "color-set", (GCallback) _desktop_agnostic_ui_color_button_on_color_set_gtk_color_button_color_set, self, 0); -} - - -static void desktop_agnostic_ui_color_button_on_da_color_changed (DesktopAgnosticUIColorButton* self, GParamSpec* pspec) { - g_return_if_fail (self != NULL); - g_return_if_fail (pspec != NULL); - if (self->priv->_da_color == NULL) { - GdkColor _tmp0_ = {0}; - GdkColor _tmp1_; - gtk_color_button_set_color ((GtkColorButton*) self, (_tmp1_ = (desktop_agnostic_color_get_color (desktop_agnostic_ui_color_button_ZERO, &_tmp0_), _tmp0_), &_tmp1_)); - gtk_color_button_set_alpha ((GtkColorButton*) self, desktop_agnostic_color_get_alpha (desktop_agnostic_ui_color_button_ZERO)); - } else { - GdkColor _tmp2_ = {0}; - GdkColor _tmp3_; - gtk_color_button_set_color ((GtkColorButton*) self, (_tmp3_ = (desktop_agnostic_color_get_color (self->priv->_da_color, &_tmp2_), _tmp2_), &_tmp3_)); - gtk_color_button_set_alpha ((GtkColorButton*) self, desktop_agnostic_color_get_alpha (self->priv->_da_color)); - } -} - - -static void desktop_agnostic_ui_color_button_da_color_notify (DesktopAgnosticUIColorButton* self) { - g_return_if_fail (self != NULL); - g_signal_handler_block (self, self->priv->da_color_signal); - g_object_notify ((GObject*) self, "da-color"); - g_signal_handler_unblock (self, self->priv->da_color_signal); -} - - -static void desktop_agnostic_ui_color_button_on_color_set (DesktopAgnosticUIColorButton* self) { - gboolean _tmp0_ = FALSE; - g_return_if_fail (self != NULL); - if (self->priv->_da_color == NULL) { - _tmp0_ = TRUE; - } else { - _tmp0_ = self->priv->_da_color == desktop_agnostic_ui_color_button_ZERO; - } - if (_tmp0_) { - DesktopAgnosticColor* _tmp3_; - GdkColor _tmp2_; - GdkColor _tmp1_ = {0}; - self->priv->_da_color = (_tmp3_ = desktop_agnostic_color_new ((_tmp2_ = (gtk_color_button_get_color ((GtkColorButton*) self, &_tmp1_), _tmp1_), &_tmp2_), (gushort) gtk_color_button_get_alpha ((GtkColorButton*) self)), _g_object_unref0 (self->priv->_da_color), _tmp3_); - } else { - GdkColor _tmp4_ = {0}; - GdkColor _tmp5_; - desktop_agnostic_color_set_color (self->priv->_da_color, (_tmp5_ = (gtk_color_button_get_color ((GtkColorButton*) self, &_tmp4_), _tmp4_), &_tmp5_)); - desktop_agnostic_color_set_alpha (self->priv->_da_color, gtk_color_button_get_alpha ((GtkColorButton*) self)); - } - desktop_agnostic_ui_color_button_da_color_notify (self); -} - - -void desktop_agnostic_ui_color_button_set_color (DesktopAgnosticUIColorButton* self, GdkColor* color) { - gboolean _tmp0_ = FALSE; - g_return_if_fail (self != NULL); - if (self->priv->_da_color == NULL) { - _tmp0_ = TRUE; - } else { - _tmp0_ = self->priv->_da_color == desktop_agnostic_ui_color_button_ZERO; - } - if (_tmp0_) { - DesktopAgnosticColor* _tmp1_; - self->priv->_da_color = (_tmp1_ = desktop_agnostic_color_new (color, G_MAXUSHORT), _g_object_unref0 (self->priv->_da_color), _tmp1_); - } else { - desktop_agnostic_color_set_alpha (self->priv->_da_color, gtk_color_button_get_alpha ((GtkColorButton*) self)); - } - desktop_agnostic_ui_color_button_da_color_notify (self); -} - - -void desktop_agnostic_ui_color_button_set_alpha (DesktopAgnosticUIColorButton* self, guint16 alpha) { - gboolean _tmp0_ = FALSE; - g_return_if_fail (self != NULL); - if (self->priv->_da_color == NULL) { - _tmp0_ = TRUE; - } else { - _tmp0_ = self->priv->_da_color == desktop_agnostic_ui_color_button_ZERO; - } - if (_tmp0_) { - DesktopAgnosticColor* _tmp3_; - GdkColor _tmp2_; - GdkColor _tmp1_ = {0}; - self->priv->_da_color = (_tmp3_ = desktop_agnostic_color_new ((_tmp2_ = (desktop_agnostic_color_get_color (desktop_agnostic_ui_color_button_ZERO, &_tmp1_), _tmp1_), &_tmp2_), (gushort) alpha), _g_object_unref0 (self->priv->_da_color), _tmp3_); - } else { - desktop_agnostic_color_set_alpha (self->priv->_da_color, (guint) alpha); - } - desktop_agnostic_ui_color_button_da_color_notify (self); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (self), alpha); -} - - -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_construct (GType object_type) { - DesktopAgnosticUIColorButton * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_new (void) { - return desktop_agnostic_ui_color_button_construct (DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON); -} - - -DesktopAgnosticColor* desktop_agnostic_ui_color_button_get_da_color (DesktopAgnosticUIColorButton* self) { - DesktopAgnosticColor* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_da_color; - return result; -} - - -void desktop_agnostic_ui_color_button_set_da_color (DesktopAgnosticUIColorButton* self, DesktopAgnosticColor* value) { - DesktopAgnosticColor* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_da_color = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_da_color), _tmp0_); - g_object_notify ((GObject *) self, "da-color"); -} - - -static void desktop_agnostic_ui_color_button_class_init (DesktopAgnosticUIColorButtonClass * klass) { - desktop_agnostic_ui_color_button_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticUIColorButtonPrivate)); - G_OBJECT_CLASS (klass)->constructed = desktop_agnostic_ui_color_button_real_constructed; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_ui_color_button_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_ui_color_button_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_ui_color_button_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_DA_COLOR, g_param_spec_object ("da-color", "da-color", "da-color", DESKTOP_AGNOSTIC_TYPE_COLOR, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - desktop_agnostic_ui_color_button_ZERO = desktop_agnostic_color_new_from_values ((gushort) 0, (gushort) 0, (gushort) 0, G_MAXUSHORT); -} - - -static void desktop_agnostic_ui_color_button_instance_init (DesktopAgnosticUIColorButton * self) { - self->priv = DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_GET_PRIVATE (self); - self->priv->_da_color = _g_object_ref0 (desktop_agnostic_ui_color_button_ZERO); -} - - -static void desktop_agnostic_ui_color_button_finalize (GObject* obj) { - DesktopAgnosticUIColorButton * self; - self = DESKTOP_AGNOSTIC_UI_COLOR_BUTTON (obj); - _g_object_unref0 (self->priv->_da_color); - G_OBJECT_CLASS (desktop_agnostic_ui_color_button_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_ui_color_button_get_type (void) { - static GType desktop_agnostic_ui_color_button_type_id = 0; - if (desktop_agnostic_ui_color_button_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticUIColorButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_ui_color_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticUIColorButton), 0, (GInstanceInitFunc) desktop_agnostic_ui_color_button_instance_init, NULL }; - desktop_agnostic_ui_color_button_type_id = g_type_register_static (GTK_TYPE_COLOR_BUTTON, "DesktopAgnosticUIColorButton", &g_define_type_info, 0); - } - return desktop_agnostic_ui_color_button_type_id; -} - - -static void desktop_agnostic_ui_color_button_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticUIColorButton * self; - self = DESKTOP_AGNOSTIC_UI_COLOR_BUTTON (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_DA_COLOR: - g_value_set_object (value, desktop_agnostic_ui_color_button_get_da_color (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_ui_color_button_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticUIColorButton * self; - self = DESKTOP_AGNOSTIC_UI_COLOR_BUTTON (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_DA_COLOR: - desktop_agnostic_ui_color_button_set_da_color (self, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui.h 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/* ui.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_UI_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_UI_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON (desktop_agnostic_ui_color_button_get_type ()) -#define DESKTOP_AGNOSTIC_UI_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, DesktopAgnosticUIColorButton)) -#define DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, DesktopAgnosticUIColorButtonClass)) -#define DESKTOP_AGNOSTIC_UI_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON, DesktopAgnosticUIColorButtonClass)) - -typedef struct _DesktopAgnosticUIColorButton DesktopAgnosticUIColorButton; -typedef struct _DesktopAgnosticUIColorButtonClass DesktopAgnosticUIColorButtonClass; -typedef struct _DesktopAgnosticUIColorButtonPrivate DesktopAgnosticUIColorButtonPrivate; - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON (desktop_agnostic_ui_icon_button_get_type ()) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButton)) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButtonClass)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButtonClass)) - -typedef struct _DesktopAgnosticUIIconButton DesktopAgnosticUIIconButton; -typedef struct _DesktopAgnosticUIIconButtonClass DesktopAgnosticUIIconButtonClass; -typedef struct _DesktopAgnosticUIIconButtonPrivate DesktopAgnosticUIIconButtonPrivate; - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_TYPE (desktop_agnostic_ui_icon_type_get_type ()) - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG (desktop_agnostic_ui_icon_chooser_dialog_get_type ()) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialog)) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialogClass)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialogClass)) - -typedef struct _DesktopAgnosticUIIconChooserDialog DesktopAgnosticUIIconChooserDialog; -typedef struct _DesktopAgnosticUIIconChooserDialogClass DesktopAgnosticUIIconChooserDialogClass; -typedef struct _DesktopAgnosticUIIconChooserDialogPrivate DesktopAgnosticUIIconChooserDialogPrivate; - -#define DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG (desktop_agnostic_ui_launcher_editor_dialog_get_type ()) -#define DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, DesktopAgnosticUILauncherEditorDialog)) -#define DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, DesktopAgnosticUILauncherEditorDialogClass)) -#define DESKTOP_AGNOSTIC_UI_IS_LAUNCHER_EDITOR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_IS_LAUNCHER_EDITOR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, DesktopAgnosticUILauncherEditorDialogClass)) - -typedef struct _DesktopAgnosticUILauncherEditorDialog DesktopAgnosticUILauncherEditorDialog; -typedef struct _DesktopAgnosticUILauncherEditorDialogClass DesktopAgnosticUILauncherEditorDialogClass; -typedef struct _DesktopAgnosticUILauncherEditorDialogPrivate DesktopAgnosticUILauncherEditorDialogPrivate; - -struct _DesktopAgnosticUIColorButton { - GtkColorButton parent_instance; - DesktopAgnosticUIColorButtonPrivate * priv; -}; - -struct _DesktopAgnosticUIColorButtonClass { - GtkColorButtonClass parent_class; -}; - -struct _DesktopAgnosticUIIconButton { - GtkButton parent_instance; - DesktopAgnosticUIIconButtonPrivate * priv; -}; - -struct _DesktopAgnosticUIIconButtonClass { - GtkButtonClass parent_class; -}; - -typedef enum { - DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE, - DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED, - DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE -} DesktopAgnosticUIIconType; - -struct _DesktopAgnosticUIIconChooserDialog { - GtkDialog parent_instance; - DesktopAgnosticUIIconChooserDialogPrivate * priv; -}; - -struct _DesktopAgnosticUIIconChooserDialogClass { - GtkDialogClass parent_class; -}; - -struct _DesktopAgnosticUILauncherEditorDialog { - GtkDialog parent_instance; - DesktopAgnosticUILauncherEditorDialogPrivate * priv; -}; - -struct _DesktopAgnosticUILauncherEditorDialogClass { - GtkDialogClass parent_class; -}; - - -GType desktop_agnostic_ui_color_button_get_type (void); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_new_with_color (DesktopAgnosticColor* color); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_construct_with_color (GType object_type, DesktopAgnosticColor* color); -void desktop_agnostic_ui_color_button_set_color (DesktopAgnosticUIColorButton* self, GdkColor* color); -void desktop_agnostic_ui_color_button_set_alpha (DesktopAgnosticUIColorButton* self, guint16 alpha); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_new (void); -DesktopAgnosticUIColorButton* desktop_agnostic_ui_color_button_construct (GType object_type); -DesktopAgnosticColor* desktop_agnostic_ui_color_button_get_da_color (DesktopAgnosticUIColorButton* self); -void desktop_agnostic_ui_color_button_set_da_color (DesktopAgnosticUIColorButton* self, DesktopAgnosticColor* value); -GType desktop_agnostic_ui_icon_button_get_type (void); -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_new (const char* icon); -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_construct (GType object_type, const char* icon); -const char* desktop_agnostic_ui_icon_button_get_icon (DesktopAgnosticUIIconButton* self); -void desktop_agnostic_ui_icon_button_set_icon (DesktopAgnosticUIIconButton* self, const char* value); -GType desktop_agnostic_ui_icon_type_get_type (void); -DesktopAgnosticUIIconType desktop_agnostic_ui_icon_button_get_icon_type (DesktopAgnosticUIIconButton* self); -GType desktop_agnostic_ui_icon_chooser_dialog_get_type (void); -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_new (void); -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_construct (GType object_type); -const char* desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon (DesktopAgnosticUIIconChooserDialog* self); -GdkPixbuf* desktop_agnostic_ui_icon_chooser_dialog_get_selected_pixbuf (DesktopAgnosticUIIconChooserDialog* self); -DesktopAgnosticUIIconType desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon_type (DesktopAgnosticUIIconChooserDialog* self); -GType desktop_agnostic_ui_launcher_editor_dialog_get_type (void); -DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_new (DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean standalone); -DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_construct (GType object_type, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean standalone); -DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_file (DesktopAgnosticUILauncherEditorDialog* self); -DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_output (DesktopAgnosticUILauncherEditorDialog* self); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-icon-button.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-icon-button.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-icon-button.c 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-icon-button.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,299 +0,0 @@ -/* ui-icon-button.c generated by valac, the Vala compiler - * generated from ui-icon-button.vala, do not modify */ - -/* - * Desktop Agnostic Library: Icon chooser button. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON (desktop_agnostic_ui_icon_button_get_type ()) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButton)) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButtonClass)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButtonClass)) - -typedef struct _DesktopAgnosticUIIconButton DesktopAgnosticUIIconButton; -typedef struct _DesktopAgnosticUIIconButtonClass DesktopAgnosticUIIconButtonClass; -typedef struct _DesktopAgnosticUIIconButtonPrivate DesktopAgnosticUIIconButtonPrivate; - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_TYPE (desktop_agnostic_ui_icon_type_get_type ()) - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG (desktop_agnostic_ui_icon_chooser_dialog_get_type ()) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialog)) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialogClass)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialogClass)) - -typedef struct _DesktopAgnosticUIIconChooserDialog DesktopAgnosticUIIconChooserDialog; -typedef struct _DesktopAgnosticUIIconChooserDialogClass DesktopAgnosticUIIconChooserDialogClass; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -struct _DesktopAgnosticUIIconButton { - GtkButton parent_instance; - DesktopAgnosticUIIconButtonPrivate * priv; -}; - -struct _DesktopAgnosticUIIconButtonClass { - GtkButtonClass parent_class; -}; - -typedef enum { - DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE, - DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED, - DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE -} DesktopAgnosticUIIconType; - -struct _DesktopAgnosticUIIconButtonPrivate { - char* _icon; - DesktopAgnosticUIIconType _icon_type; - DesktopAgnosticUIIconChooserDialog* _dialog; -}; - - -static gpointer desktop_agnostic_ui_icon_button_parent_class = NULL; - -GType desktop_agnostic_ui_icon_button_get_type (void); -GType desktop_agnostic_ui_icon_type_get_type (void); -GType desktop_agnostic_ui_icon_chooser_dialog_get_type (void); -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButtonPrivate)) -enum { - DESKTOP_AGNOSTIC_UI_ICON_BUTTON_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_UI_ICON_BUTTON_ICON, - DESKTOP_AGNOSTIC_UI_ICON_BUTTON_ICON_TYPE -}; -void desktop_agnostic_ui_icon_button_set_icon (DesktopAgnosticUIIconButton* self, const char* value); -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_new (const char* icon); -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_construct (GType object_type, const char* icon); -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_new (void); -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_construct (GType object_type); -static void desktop_agnostic_ui_icon_button_on_icon_selected (DesktopAgnosticUIIconButton* self, DesktopAgnosticUIIconChooserDialog* dialog); -static void _desktop_agnostic_ui_icon_button_on_icon_selected_desktop_agnostic_ui_icon_chooser_dialog_icon_selected (DesktopAgnosticUIIconChooserDialog* _sender, gpointer self); -static void desktop_agnostic_ui_icon_button_on_clicked (DesktopAgnosticUIIconButton* self); -GdkPixbuf* desktop_agnostic_ui_icon_chooser_dialog_get_selected_pixbuf (DesktopAgnosticUIIconChooserDialog* self); -const char* desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon (DesktopAgnosticUIIconChooserDialog* self); -DesktopAgnosticUIIconType desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon_type (DesktopAgnosticUIIconChooserDialog* self); -const char* desktop_agnostic_ui_icon_button_get_icon (DesktopAgnosticUIIconButton* self); -DesktopAgnosticUIIconType desktop_agnostic_ui_icon_button_get_icon_type (DesktopAgnosticUIIconButton* self); -static void _desktop_agnostic_ui_icon_button_on_clicked_gtk_button_clicked (GtkButton* _sender, gpointer self); -static GObject * desktop_agnostic_ui_icon_button_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_ui_icon_button_finalize (GObject* obj); -static void desktop_agnostic_ui_icon_button_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_ui_icon_button_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); - - - -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_construct (GType object_type, const char* icon) { - DesktopAgnosticUIIconButton * self; - g_return_val_if_fail (icon != NULL, NULL); - self = g_object_newv (object_type, 0, NULL); - desktop_agnostic_ui_icon_button_set_icon (self, icon); - return self; -} - - -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_new (const char* icon) { - return desktop_agnostic_ui_icon_button_construct (DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, icon); -} - - -static void _desktop_agnostic_ui_icon_button_on_icon_selected_desktop_agnostic_ui_icon_chooser_dialog_icon_selected (DesktopAgnosticUIIconChooserDialog* _sender, gpointer self) { - desktop_agnostic_ui_icon_button_on_icon_selected (self, _sender); -} - - -static void desktop_agnostic_ui_icon_button_on_clicked (DesktopAgnosticUIIconButton* self) { - g_return_if_fail (self != NULL); - if (self->priv->_dialog == NULL) { - GtkWidget* parent; - DesktopAgnosticUIIconChooserDialog* _tmp0_; - gboolean _tmp1_ = FALSE; - parent = NULL; - parent = gtk_widget_get_toplevel ((GtkWidget*) self); - self->priv->_dialog = (_tmp0_ = g_object_ref_sink (desktop_agnostic_ui_icon_chooser_dialog_new ()), _g_object_unref0 (self->priv->_dialog), _tmp0_); - g_signal_connect_object (self->priv->_dialog, "icon-selected", (GCallback) _desktop_agnostic_ui_icon_button_on_icon_selected_desktop_agnostic_ui_icon_chooser_dialog_icon_selected, self, 0); - if (GTK_WIDGET_TOPLEVEL (parent)) { - _tmp1_ = GTK_IS_WINDOW (parent); - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - GtkWindow* parent_window; - GtkWidget* _tmp2_; - parent_window = NULL; - parent_window = (_tmp2_ = parent, GTK_IS_WINDOW (_tmp2_) ? ((GtkWindow*) _tmp2_) : NULL); - if (parent_window != gtk_window_get_transient_for ((GtkWindow*) self->priv->_dialog)) { - gtk_window_set_transient_for ((GtkWindow*) self->priv->_dialog, parent_window); - } - gtk_window_set_modal ((GtkWindow*) self->priv->_dialog, gtk_window_get_modal (parent_window)); - } - } - gtk_window_present ((GtkWindow*) self->priv->_dialog); -} - - -static void desktop_agnostic_ui_icon_button_on_icon_selected (DesktopAgnosticUIIconButton* self, DesktopAgnosticUIIconChooserDialog* dialog) { - GtkWidget* _tmp0_; - char* _tmp1_; - g_return_if_fail (self != NULL); - g_return_if_fail (dialog != NULL); - gtk_image_set_from_pixbuf ((_tmp0_ = gtk_button_get_image ((GtkButton*) self), GTK_IS_IMAGE (_tmp0_) ? ((GtkImage*) _tmp0_) : NULL), desktop_agnostic_ui_icon_chooser_dialog_get_selected_pixbuf (dialog)); - self->priv->_icon = (_tmp1_ = g_strdup (desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon (dialog)), _g_free0 (self->priv->_icon), _tmp1_); - self->priv->_icon_type = desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon_type (dialog); - g_signal_emit_by_name (self, "icon-selected"); -} - - -const char* desktop_agnostic_ui_icon_button_get_icon (DesktopAgnosticUIIconButton* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_icon; - return result; -} - - -void desktop_agnostic_ui_icon_button_set_icon (DesktopAgnosticUIIconButton* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_icon = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_icon), _tmp0_); - if (g_path_is_absolute (value)) { - GtkImage* _tmp1_; - self->priv->_icon_type = DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE; - gtk_button_set_image ((GtkButton*) self, (GtkWidget*) (_tmp1_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_file (value)))); - _g_object_unref0 (_tmp1_); - } else { - GtkImage* _tmp2_; - self->priv->_icon_type = DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED; - gtk_button_set_image ((GtkButton*) self, (GtkWidget*) (_tmp2_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name (value, GTK_ICON_SIZE_DIALOG)))); - _g_object_unref0 (_tmp2_); - } - g_object_notify ((GObject *) self, "icon"); -} - - -DesktopAgnosticUIIconType desktop_agnostic_ui_icon_button_get_icon_type (DesktopAgnosticUIIconButton* self) { - DesktopAgnosticUIIconType result; - g_return_val_if_fail (self != NULL, 0); - result = self->priv->_icon_type; - return result; -} - - -static void _desktop_agnostic_ui_icon_button_on_clicked_gtk_button_clicked (GtkButton* _sender, gpointer self) { - desktop_agnostic_ui_icon_button_on_clicked (self); -} - - -static GObject * desktop_agnostic_ui_icon_button_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticUIIconButton * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_ui_icon_button_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_UI_ICON_BUTTON (obj); - { - g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) _desktop_agnostic_ui_icon_button_on_clicked_gtk_button_clicked, self, 0); - } - return obj; -} - - -static void desktop_agnostic_ui_icon_button_class_init (DesktopAgnosticUIIconButtonClass * klass) { - desktop_agnostic_ui_icon_button_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticUIIconButtonPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_ui_icon_button_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_ui_icon_button_set_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_ui_icon_button_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_ui_icon_button_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_ICON_BUTTON_ICON, g_param_spec_string ("icon", "icon", "icon", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_ICON_BUTTON_ICON_TYPE, g_param_spec_enum ("icon-type", "icon-type", "icon-type", DESKTOP_AGNOSTIC_UI_TYPE_ICON_TYPE, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_signal_new ("icon_selected", DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); -} - - -static void desktop_agnostic_ui_icon_button_instance_init (DesktopAgnosticUIIconButton * self) { - self->priv = DESKTOP_AGNOSTIC_UI_ICON_BUTTON_GET_PRIVATE (self); - self->priv->_icon_type = DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE; - self->priv->_dialog = NULL; -} - - -static void desktop_agnostic_ui_icon_button_finalize (GObject* obj) { - DesktopAgnosticUIIconButton * self; - self = DESKTOP_AGNOSTIC_UI_ICON_BUTTON (obj); - _g_free0 (self->priv->_icon); - _g_object_unref0 (self->priv->_dialog); - G_OBJECT_CLASS (desktop_agnostic_ui_icon_button_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_ui_icon_button_get_type (void) { - static GType desktop_agnostic_ui_icon_button_type_id = 0; - if (desktop_agnostic_ui_icon_button_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticUIIconButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_ui_icon_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticUIIconButton), 0, (GInstanceInitFunc) desktop_agnostic_ui_icon_button_instance_init, NULL }; - desktop_agnostic_ui_icon_button_type_id = g_type_register_static (GTK_TYPE_BUTTON, "DesktopAgnosticUIIconButton", &g_define_type_info, 0); - } - return desktop_agnostic_ui_icon_button_type_id; -} - - -static void desktop_agnostic_ui_icon_button_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticUIIconButton * self; - self = DESKTOP_AGNOSTIC_UI_ICON_BUTTON (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_ICON_BUTTON_ICON: - g_value_set_string (value, desktop_agnostic_ui_icon_button_get_icon (self)); - break; - case DESKTOP_AGNOSTIC_UI_ICON_BUTTON_ICON_TYPE: - g_value_set_enum (value, desktop_agnostic_ui_icon_button_get_icon_type (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_ui_icon_button_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticUIIconButton * self; - self = DESKTOP_AGNOSTIC_UI_ICON_BUTTON (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_ICON_BUTTON_ICON: - desktop_agnostic_ui_icon_button_set_icon (self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-icon-chooser-dialog.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-icon-chooser-dialog.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-icon-chooser-dialog.c 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-icon-chooser-dialog.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,865 +0,0 @@ -/* ui-icon-chooser-dialog.c generated by valac, the Vala compiler - * generated from ui-icon-chooser-dialog.vala, do not modify */ - -/* - * Desktop Agnostic Library: Icon chooser dialog. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_TYPE (desktop_agnostic_ui_icon_type_get_type ()) - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG (desktop_agnostic_ui_icon_chooser_dialog_get_type ()) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialog)) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialogClass)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialogClass)) - -typedef struct _DesktopAgnosticUIIconChooserDialog DesktopAgnosticUIIconChooserDialog; -typedef struct _DesktopAgnosticUIIconChooserDialogClass DesktopAgnosticUIIconChooserDialogClass; -typedef struct _DesktopAgnosticUIIconChooserDialogPrivate DesktopAgnosticUIIconChooserDialogPrivate; - -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_TYPE_COLUMN (desktop_agnostic_ui_icon_chooser_dialog_column_get_type ()) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _gtk_icon_info_free0(var) ((var == NULL) ? NULL : (var = (gtk_icon_info_free (var), NULL))) -#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL))) -#define __g_list_free_gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (_g_list_free_gtk_tree_path_free (var), NULL))) -#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL))) - -typedef enum { - DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE, - DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED, - DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE -} DesktopAgnosticUIIconType; - -struct _DesktopAgnosticUIIconChooserDialog { - GtkDialog parent_instance; - DesktopAgnosticUIIconChooserDialogPrivate * priv; -}; - -struct _DesktopAgnosticUIIconChooserDialogClass { - GtkDialogClass parent_class; -}; - -struct _DesktopAgnosticUIIconChooserDialogPrivate { - GtkRadioButton* _file; - GtkRadioButton* _themed; - GtkFileChooserButton* _directory; - GtkComboBox* _themed_context; - GtkIconView* _file_viewer; - GtkIconView* _themed_viewer; - GtkIconView* _viewer; - char* _selected_icon; - GdkPixbuf* _selected_pixbuf; - DesktopAgnosticUIIconType _selected_icon_type; -}; - -typedef enum { - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF, - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME, - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA, - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_COUNT -} DesktopAgnosticUIIconChooserDialogColumn; - - -static gpointer desktop_agnostic_ui_icon_chooser_dialog_parent_class = NULL; - -#define ICON_I18N_PACKAGE GETTEXT_PACKAGE -GType desktop_agnostic_ui_icon_type_get_type (void); -GType desktop_agnostic_ui_icon_chooser_dialog_get_type (void); -#define DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, DesktopAgnosticUIIconChooserDialogPrivate)) -enum { - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON, - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_PIXBUF, - DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON_TYPE -}; -static GType desktop_agnostic_ui_icon_chooser_dialog_column_get_type (void); -static void desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled (DesktopAgnosticUIIconChooserDialog* self, GtkToggleButton* themed); -static void _desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self); -static void desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed (DesktopAgnosticUIIconChooserDialog* self, GtkFileChooser* chooser); -static void _desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed_gtk_file_chooser_current_folder_changed (GtkFileChooser* _sender, gpointer self); -static void desktop_agnostic_ui_icon_chooser_dialog_add_icon_viewer (DesktopAgnosticUIIconChooserDialog* self, GtkIconView** viewer, gboolean themed); -static void desktop_agnostic_ui_icon_chooser_dialog_create_ui (DesktopAgnosticUIIconChooserDialog* self); -static GtkIconView* desktop_agnostic_ui_icon_chooser_dialog_create_icon_viewer (DesktopAgnosticUIIconChooserDialog* self, gboolean themed); -static GtkListStore* desktop_agnostic_ui_icon_chooser_dialog_create_model (DesktopAgnosticUIIconChooserDialog* self); -static void desktop_agnostic_ui_icon_chooser_dialog_on_icon_context_changed (DesktopAgnosticUIIconChooserDialog* self, GtkComboBox* box); -static void _desktop_agnostic_ui_icon_chooser_dialog_on_icon_context_changed_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self); -static void _g_slist_free_g_object_unref (GSList* self); -static void _g_list_free_gtk_tree_path_free (GList* self); -static void desktop_agnostic_ui_icon_chooser_dialog_set_selected_pixbuf (DesktopAgnosticUIIconChooserDialog* self, GdkPixbuf* value); -static void desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon (DesktopAgnosticUIIconChooserDialog* self, const char* value); -static void desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon_type (DesktopAgnosticUIIconChooserDialog* self, DesktopAgnosticUIIconType value); -static void desktop_agnostic_ui_icon_chooser_dialog_on_response (DesktopAgnosticUIIconChooserDialog* self, gint response); -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_new (void); -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_construct (GType object_type); -const char* desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon (DesktopAgnosticUIIconChooserDialog* self); -GdkPixbuf* desktop_agnostic_ui_icon_chooser_dialog_get_selected_pixbuf (DesktopAgnosticUIIconChooserDialog* self); -DesktopAgnosticUIIconType desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon_type (DesktopAgnosticUIIconChooserDialog* self); -static void _desktop_agnostic_ui_icon_chooser_dialog_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self); -static GObject * desktop_agnostic_ui_icon_chooser_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_ui_icon_chooser_dialog_finalize (GObject* obj); -static void desktop_agnostic_ui_icon_chooser_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_ui_icon_chooser_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); - - - - -GType desktop_agnostic_ui_icon_type_get_type (void) { - static GType desktop_agnostic_ui_icon_type_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_ui_icon_type_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE, "DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE", "none"}, {DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED, "DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED", "themed"}, {DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE, "DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE", "file"}, {0, NULL, NULL}}; - desktop_agnostic_ui_icon_type_type_id = g_enum_register_static ("DesktopAgnosticUIIconType", values); - } - return desktop_agnostic_ui_icon_type_type_id; -} - - - -static GType desktop_agnostic_ui_icon_chooser_dialog_column_get_type (void) { - static GType desktop_agnostic_ui_icon_chooser_dialog_column_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_ui_icon_chooser_dialog_column_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF, "DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF", "pixbuf"}, {DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME, "DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME", "name"}, {DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA, "DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA", "data"}, {DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_COUNT, "DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_COUNT", "count"}, {0, NULL, NULL}}; - desktop_agnostic_ui_icon_chooser_dialog_column_type_id = g_enum_register_static ("DesktopAgnosticUIIconChooserDialogColumn", values); - } - return desktop_agnostic_ui_icon_chooser_dialog_column_type_id; -} - - -static void _desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) { - desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled (self, _sender); -} - - -static void _desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed_gtk_file_chooser_current_folder_changed (GtkFileChooser* _sender, gpointer self) { - desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed (self, _sender); -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_create_ui (DesktopAgnosticUIIconChooserDialog* self) { - GtkHBox* choices; - GtkHBox* _tmp0_; - GtkRadioButton* _tmp1_; - GtkRadioButton* _tmp2_; - GtkFileChooserButton* _tmp3_; - g_return_if_fail (self != NULL); - choices = NULL; - choices = (_tmp0_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 5)), _g_object_unref0 (choices), _tmp0_); - self->priv->_file = (_tmp1_ = g_object_ref_sink ((GtkRadioButton*) gtk_radio_button_new_with_mnemonic (NULL, _ ("From File"))), _g_object_unref0 (self->priv->_file), _tmp1_); - gtk_container_add ((GtkContainer*) choices, (GtkWidget*) self->priv->_file); - self->priv->_themed = (_tmp2_ = g_object_ref_sink ((GtkRadioButton*) gtk_radio_button_new_with_mnemonic_from_widget (self->priv->_file, _ ("From Theme"))), _g_object_unref0 (self->priv->_themed), _tmp2_); - gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->_themed, FALSE); - g_signal_connect_object ((GtkToggleButton*) self->priv->_themed, "toggled", (GCallback) _desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled_gtk_toggle_button_toggled, self, 0); - gtk_container_add ((GtkContainer*) choices, (GtkWidget*) self->priv->_themed); - gtk_box_pack_start ((GtkBox*) ((GtkDialog*) self)->vbox, (GtkWidget*) choices, FALSE, FALSE, (guint) 5); - gtk_widget_show_all ((GtkWidget*) choices); - self->priv->_directory = (_tmp3_ = g_object_ref_sink ((GtkFileChooserButton*) gtk_file_chooser_button_new (_ ("Select icon folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)), _g_object_unref0 (self->priv->_directory), _tmp3_); - g_signal_connect_object ((GtkFileChooser*) self->priv->_directory, "current-folder-changed", (GCallback) _desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed_gtk_file_chooser_current_folder_changed, self, 0); - gtk_box_pack_start ((GtkBox*) ((GtkDialog*) self)->vbox, (GtkWidget*) self->priv->_directory, FALSE, FALSE, (guint) 5); - gtk_widget_show ((GtkWidget*) self->priv->_directory); - desktop_agnostic_ui_icon_chooser_dialog_add_icon_viewer (self, &self->priv->_file_viewer, FALSE); - gtk_widget_show_all ((GtkWidget*) gtk_widget_get_parent ((GtkWidget*) self->priv->_file_viewer)); - self->priv->_viewer = self->priv->_file_viewer; - desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed (self, (GtkFileChooser*) self->priv->_directory); - gtk_dialog_add_buttons ((GtkDialog*) self, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - _g_object_unref0 (choices); -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_add_icon_viewer (DesktopAgnosticUIIconChooserDialog* self, GtkIconView** viewer, gboolean themed) { - GtkScrolledWindow* scrolled; - GtkScrolledWindow* _tmp0_; - GtkIconView* _tmp1_; - g_return_if_fail (self != NULL); - g_return_if_fail (viewer != NULL); - scrolled = NULL; - scrolled = (_tmp0_ = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL)), _g_object_unref0 (scrolled), _tmp0_); - gtk_scrolled_window_set_policy (scrolled, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - *viewer = (_tmp1_ = desktop_agnostic_ui_icon_chooser_dialog_create_icon_viewer (self, themed), _g_object_unref0 (*viewer), _tmp1_); - gtk_widget_show ((GtkWidget*) (*viewer)); - gtk_container_add ((GtkContainer*) scrolled, (GtkWidget*) (*viewer)); - gtk_box_pack_start ((GtkBox*) ((GtkDialog*) self)->vbox, (GtkWidget*) scrolled, TRUE, TRUE, (guint) 5); - _g_object_unref0 (scrolled); -} - - -static GtkIconView* desktop_agnostic_ui_icon_chooser_dialog_create_icon_viewer (DesktopAgnosticUIIconChooserDialog* self, gboolean themed) { - GtkIconView* result; - GtkIconView* viewer; - GtkCellRendererPixbuf* cell_pixbuf; - GtkCellRendererText* cell_text; - GtkIconView* _tmp1_; - GtkListStore* _tmp0_; - GtkCellRendererPixbuf* _tmp2_; - GtkCellRendererText* _tmp3_; - g_return_val_if_fail (self != NULL, NULL); - viewer = NULL; - cell_pixbuf = NULL; - cell_text = NULL; - viewer = (_tmp1_ = g_object_ref_sink ((GtkIconView*) gtk_icon_view_new_with_model ((GtkTreeModel*) (_tmp0_ = desktop_agnostic_ui_icon_chooser_dialog_create_model (self)))), _g_object_unref0 (viewer), _tmp1_); - _g_object_unref0 (_tmp0_); - gtk_icon_view_set_item_width (viewer, 72); - gtk_icon_view_set_columns (viewer, 4); - gtk_icon_view_set_column_spacing (viewer, 5); - gtk_widget_set_size_request ((GtkWidget*) viewer, 325, 300); - gtk_icon_view_set_tooltip_column (viewer, (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA); - cell_pixbuf = (_tmp2_ = g_object_ref_sink ((GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new ()), _g_object_unref0 (cell_pixbuf), _tmp2_); - g_object_set ((GtkCellRenderer*) cell_pixbuf, "xalign", 0.5f, NULL); - g_object_set ((GtkCellRenderer*) cell_pixbuf, "yalign", 0.5f, NULL); - g_object_set ((GtkCellRenderer*) cell_pixbuf, "width", 48, NULL); - gtk_cell_layout_pack_start ((GtkCellLayout*) viewer, (GtkCellRenderer*) cell_pixbuf, FALSE); - gtk_cell_layout_add_attribute ((GtkCellLayout*) viewer, (GtkCellRenderer*) cell_pixbuf, "pixbuf", (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF); - cell_text = (_tmp3_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ()), _g_object_unref0 (cell_text), _tmp3_); - g_object_set ((GtkCellRenderer*) cell_text, "xalign", 0.5f, NULL); - g_object_set ((GtkCellRenderer*) cell_text, "yalign", (float) 0, NULL); - g_object_set (cell_text, "wrap-mode", PANGO_WRAP_WORD, NULL); - g_object_set (cell_text, "wrap-width", 72, NULL); - g_object_set ((GtkCellRenderer*) cell_text, "width", 72, NULL); - g_object_set (cell_text, "ellipsize", PANGO_ELLIPSIZE_START, NULL); - gtk_cell_layout_pack_start ((GtkCellLayout*) viewer, (GtkCellRenderer*) cell_text, TRUE); - gtk_cell_layout_add_attribute ((GtkCellLayout*) viewer, (GtkCellRenderer*) cell_text, "text", 1); - gtk_icon_view_set_selection_mode (viewer, GTK_SELECTION_SINGLE); - result = viewer; - _g_object_unref0 (cell_pixbuf); - _g_object_unref0 (cell_text); - return result; -} - - -static GtkListStore* desktop_agnostic_ui_icon_chooser_dialog_create_model (DesktopAgnosticUIIconChooserDialog* self) { - GtkListStore* result; - g_return_val_if_fail (self != NULL, NULL); - result = gtk_list_store_new ((gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, NULL); - return result; -} - - -static void _desktop_agnostic_ui_icon_chooser_dialog_on_icon_context_changed_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) { - desktop_agnostic_ui_icon_chooser_dialog_on_icon_context_changed (self, _sender); -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled (DesktopAgnosticUIIconChooserDialog* self, GtkToggleButton* themed) { - g_return_if_fail (self != NULL); - g_return_if_fail (themed != NULL); - if (gtk_toggle_button_get_active ((GtkToggleButton*) self->priv->_themed)) { - if (self->priv->_themed_viewer == NULL) { - GtkIconTheme* icon_theme; - GList* context_list; - GtkComboBox* _tmp0_; - icon_theme = NULL; - context_list = NULL; - self->priv->_themed_context = (_tmp0_ = g_object_ref_sink ((GtkComboBox*) gtk_combo_box_new_text ()), _g_object_unref0 (self->priv->_themed_context), _tmp0_); - g_signal_connect_object (self->priv->_themed_context, "changed", (GCallback) _desktop_agnostic_ui_icon_chooser_dialog_on_icon_context_changed_gtk_combo_box_changed, self, 0); - gtk_box_pack_start ((GtkBox*) ((GtkDialog*) self)->vbox, (GtkWidget*) self->priv->_themed_context, FALSE, FALSE, (guint) 5); - desktop_agnostic_ui_icon_chooser_dialog_add_icon_viewer (self, &self->priv->_themed_viewer, TRUE); - icon_theme = gtk_icon_theme_get_default (); - context_list = gtk_icon_theme_list_contexts (icon_theme); - context_list = g_list_sort (context_list, (GCompareFunc) strcmp); - { - GList* context_collection; - GList* context_it; - context_collection = context_list; - for (context_it = context_collection; context_it != NULL; context_it = context_it->next) { - const char* context; - context = (const char*) context_it->data; - { - gtk_combo_box_append_text (self->priv->_themed_context, context); - } - } - } - } - gtk_widget_hide ((GtkWidget*) gtk_widget_get_parent ((GtkWidget*) self->priv->_file_viewer)); - gtk_widget_hide ((GtkWidget*) self->priv->_directory); - gtk_widget_show ((GtkWidget*) gtk_widget_get_parent ((GtkWidget*) self->priv->_themed_viewer)); - gtk_widget_show ((GtkWidget*) self->priv->_themed_context); - self->priv->_viewer = self->priv->_themed_viewer; - } else { - gtk_widget_hide ((GtkWidget*) gtk_widget_get_parent ((GtkWidget*) self->priv->_themed_viewer)); - gtk_widget_hide ((GtkWidget*) self->priv->_themed_context); - gtk_widget_show ((GtkWidget*) gtk_widget_get_parent ((GtkWidget*) self->priv->_file_viewer)); - gtk_widget_show ((GtkWidget*) self->priv->_directory); - self->priv->_viewer = self->priv->_file_viewer; - } -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed (DesktopAgnosticUIIconChooserDialog* self, GtkFileChooser* chooser) { - GError * _inner_error_; - GtkListStore* model; - char* uri; - DesktopAgnosticVFSFile* directory; - GSList* children; - GtkTreeModel* _tmp0_; - char* _tmp1_; - DesktopAgnosticVFSFile* _tmp2_; - DesktopAgnosticVFSFile* _tmp3_; - GSList* _tmp4_; - GSList* _tmp5_; - g_return_if_fail (self != NULL); - g_return_if_fail (chooser != NULL); - _inner_error_ = NULL; - model = NULL; - uri = NULL; - directory = NULL; - children = NULL; - model = (_tmp0_ = gtk_icon_view_get_model (self->priv->_file_viewer), GTK_IS_LIST_STORE (_tmp0_) ? ((GtkListStore*) _tmp0_) : NULL); - gtk_list_store_clear (model); - uri = (_tmp1_ = gtk_file_chooser_get_uri (chooser), _g_free0 (uri), _tmp1_); - _tmp2_ = desktop_agnostic_vfs_file_new_for_uri (uri, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (uri); - _g_object_unref0 (directory); - __g_slist_free_g_object_unref0 (children); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - directory = (_tmp3_ = _tmp2_, _g_object_unref0 (directory), _tmp3_); - _tmp4_ = desktop_agnostic_vfs_file_enumerate_children (directory, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (uri); - _g_object_unref0 (directory); - __g_slist_free_g_object_unref0 (children); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - children = (_tmp5_ = _tmp4_, __g_slist_free_g_object_unref0 (children), _tmp5_); - { - GSList* child_collection; - GSList* child_it; - child_collection = children; - for (child_it = child_collection; child_it != NULL; child_it = child_it->next) { - DesktopAgnosticVFSFile* child; - child = (DesktopAgnosticVFSFile*) child_it->data; - { - char* path; - char* path_down; - char* _tmp6_; - char* _tmp7_; - gboolean _tmp8_ = FALSE; - gboolean _tmp9_ = FALSE; - gboolean _tmp10_ = FALSE; - gboolean _tmp11_ = FALSE; - path = NULL; - path_down = NULL; - path = (_tmp6_ = desktop_agnostic_vfs_file_get_path (child), _g_free0 (path), _tmp6_); - path_down = (_tmp7_ = g_utf8_strdown (path, -1), _g_free0 (path_down), _tmp7_); - if (g_str_has_suffix (path_down, ".png")) { - _tmp11_ = TRUE; - } else { - _tmp11_ = g_str_has_suffix (path_down, ".svg"); - } - if (_tmp11_) { - _tmp10_ = TRUE; - } else { - _tmp10_ = g_str_has_suffix (path_down, ".jpg"); - } - if (_tmp10_) { - _tmp9_ = TRUE; - } else { - _tmp9_ = g_str_has_suffix (path_down, ".jpeg"); - } - if (_tmp9_) { - _tmp8_ = TRUE; - } else { - _tmp8_ = g_str_has_suffix (path_down, ".xpm"); - } - if (_tmp8_) { - { - GtkTreeIter iter = {0}; - GdkPixbuf* pixbuf; - GdkPixbuf* _tmp12_; - GdkPixbuf* _tmp13_; - char* _tmp14_; - pixbuf = NULL; - _tmp12_ = gdk_pixbuf_new_from_file_at_scale (path, 48, -1, TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (pixbuf); - if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch0_g_file_error; - } - goto __catch0_g_error; - } - pixbuf = (_tmp13_ = _tmp12_, _g_object_unref0 (pixbuf), _tmp13_); - gtk_list_store_append (model, &iter); - gtk_list_store_set (model, &iter, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF, pixbuf, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME, _tmp14_ = g_path_get_basename (path), DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA, path, -1); - _g_free0 (_tmp14_); - _g_object_unref0 (pixbuf); - } - goto __finally0; - __catch0_g_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _g_error_free0 (err); - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("ui-icon-chooser-dialog.vala:238: GDK Pixbuf error (%s): %s", path, err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_free0 (path); - _g_free0 (path_down); - _g_free0 (uri); - _g_object_unref0 (directory); - __g_slist_free_g_object_unref0 (children); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - _g_free0 (path); - _g_free0 (path_down); - } - } - } - _g_free0 (uri); - _g_object_unref0 (directory); - __g_slist_free_g_object_unref0 (children); -} - - -static char* string_replace (const char* self, const char* old, const char* replacement) { - char* result; - GError * _inner_error_; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (old != NULL, NULL); - g_return_val_if_fail (replacement != NULL, NULL); - _inner_error_ = NULL; - { - char* _tmp0_; - GRegex* _tmp1_; - GRegex* regex; - char* _tmp2_; - regex = (_tmp1_ = g_regex_new (_tmp0_ = g_regex_escape_string (old, -1), 0, 0, &_inner_error_), _g_free0 (_tmp0_), _tmp1_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch2_g_regex_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - _tmp2_ = g_regex_replace_literal (regex, self, (gssize) (-1), 0, replacement, 0, &_inner_error_); - if (_inner_error_ != NULL) { - _g_regex_unref0 (regex); - if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch2_g_regex_error; - } - _g_regex_unref0 (regex); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - result = _tmp2_; - _g_regex_unref0 (regex); - return result; - } - goto __finally2; - __catch2_g_regex_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_assert_not_reached (); - _g_error_free0 (e); - } - } - __finally2: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_on_icon_context_changed (DesktopAgnosticUIIconChooserDialog* self, GtkComboBox* box) { - GError * _inner_error_; - GtkListStore* model; - GtkIconTheme* icon_theme; - GList* icon_list; - GtkTreeModel* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (box != NULL); - _inner_error_ = NULL; - model = NULL; - icon_theme = NULL; - icon_list = NULL; - model = (_tmp0_ = gtk_icon_view_get_model (self->priv->_themed_viewer), GTK_IS_LIST_STORE (_tmp0_) ? ((GtkListStore*) _tmp0_) : NULL); - gtk_list_store_clear (model); - icon_theme = gtk_icon_theme_get_default (); - icon_list = gtk_icon_theme_list_icons (icon_theme, gtk_combo_box_get_active_text (box)); - icon_list = g_list_sort (icon_list, (GCompareFunc) strcmp); - { - GList* icon_name_collection; - GList* icon_name_it; - icon_name_collection = icon_list; - for (icon_name_it = icon_name_collection; icon_name_it != NULL; icon_name_it = icon_name_it->next) { - const char* icon_name; - icon_name = (const char*) icon_name_it->data; - { - { - GtkIconInfo* info; - GdkPixbuf* pixbuf; - char* name; - GtkTreeIter iter = {0}; - GtkIconInfo* _tmp1_; - GdkPixbuf* _tmp2_; - GdkPixbuf* _tmp3_; - char* _tmp4_; - info = NULL; - pixbuf = NULL; - name = NULL; - info = (_tmp1_ = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, 0), _gtk_icon_info_free0 (info), _tmp1_); - _tmp2_ = gtk_icon_info_load_icon (info, &_inner_error_); - if (_inner_error_ != NULL) { - _gtk_icon_info_free0 (info); - _g_object_unref0 (pixbuf); - _g_free0 (name); - goto __catch1_g_error; - } - pixbuf = (_tmp3_ = _tmp2_, _g_object_unref0 (pixbuf), _tmp3_); - name = (_tmp4_ = g_strdup (gtk_icon_info_get_display_name (info)), _g_free0 (name), _tmp4_); - if (name == NULL) { - char* _tmp5_; - name = (_tmp5_ = string_replace (icon_name, "-", " "), _g_free0 (name), _tmp5_); - } - gtk_list_store_append (model, &iter); - gtk_list_store_set (model, &iter, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF, pixbuf, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME, name, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA, icon_name, -1); - _gtk_icon_info_free0 (info); - _g_object_unref0 (pixbuf); - _g_free0 (name); - } - goto __finally1; - __catch1_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("ui-icon-chooser-dialog.vala:280: Could not load %s: %s", icon_name, err->message); - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - } -} - - -static void _g_list_free_gtk_tree_path_free (GList* self) { - g_list_foreach (self, (GFunc) gtk_tree_path_free, NULL); - g_list_free (self); -} - - -static gpointer _gtk_tree_path_copy0 (gpointer self) { - return self ? gtk_tree_path_copy (self) : NULL; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_on_response (DesktopAgnosticUIIconChooserDialog* self, gint response) { - g_return_if_fail (self != NULL); - if (response == GTK_RESPONSE_OK) { - GList* item; - GList* _tmp0_; - item = NULL; - item = (_tmp0_ = gtk_icon_view_get_selected_items (self->priv->_viewer), __g_list_free_gtk_tree_path_free0 (item), _tmp0_); - if (item == NULL) { - char* msg; - GtkMessageDialog* dialog; - char* _tmp1_; - GtkMessageDialog* _tmp2_; - msg = NULL; - dialog = NULL; - msg = (_tmp1_ = g_strdup (_ ("Please select an icon.")), _g_free0 (msg), _tmp1_); - dialog = (_tmp2_ = g_object_ref_sink ((GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg)), _g_object_unref0 (dialog), _tmp2_); - gtk_window_set_title ((GtkWindow*) dialog, _ ("Error")); - gtk_dialog_run ((GtkDialog*) dialog); - gtk_object_destroy ((GtkObject*) dialog); - _g_free0 (msg); - _g_object_unref0 (dialog); - __g_list_free_gtk_tree_path_free0 (item); - return; - } else { - GtkTreePath* path; - GtkTreeModel* model; - gboolean res = FALSE; - GtkTreeIter iter = {0}; - GtkTreePath* _tmp3_; - GtkTreeModel* _tmp4_; - path = NULL; - model = NULL; - path = (_tmp3_ = _gtk_tree_path_copy0 ((GtkTreePath*) item->data), _gtk_tree_path_free0 (path), _tmp3_); - model = (_tmp4_ = _g_object_ref0 (gtk_icon_view_get_model (self->priv->_viewer)), _g_object_unref0 (model), _tmp4_); - res = gtk_tree_model_get_iter (model, &iter, path); - if (res) { - GValue pixbuf = {0}; - GValue data = {0}; - GValue _tmp6_; - GValue _tmp5_ = {0}; - GValue _tmp8_; - GValue _tmp7_ = {0}; - gtk_tree_model_get_value (model, &iter, (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF, &_tmp5_); - pixbuf = (_tmp6_ = _tmp5_, G_IS_VALUE (&pixbuf) ? (g_value_unset (&pixbuf), NULL) : NULL, _tmp6_); - gtk_tree_model_get_value (model, &iter, (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA, &_tmp7_); - data = (_tmp8_ = _tmp7_, G_IS_VALUE (&data) ? (g_value_unset (&data), NULL) : NULL, _tmp8_); - desktop_agnostic_ui_icon_chooser_dialog_set_selected_pixbuf (self, g_value_get_object (&pixbuf)); - desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon (self, g_value_get_string (&data)); - if (self->priv->_viewer == self->priv->_file_viewer) { - desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon_type (self, DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE); - } else { - desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon_type (self, DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED); - } - g_signal_emit_by_name (self, "icon-selected"); - G_IS_VALUE (&pixbuf) ? (g_value_unset (&pixbuf), NULL) : NULL; - G_IS_VALUE (&data) ? (g_value_unset (&data), NULL) : NULL; - } else { - g_warning ("ui-icon-chooser-dialog.vala:340: Something wrong happened when converting tree path -> iter."); - } - _gtk_tree_path_free0 (path); - _g_object_unref0 (model); - } - __g_list_free_gtk_tree_path_free0 (item); - } - gtk_widget_hide ((GtkWidget*) self); -} - - -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_construct (GType object_type) { - DesktopAgnosticUIIconChooserDialog * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticUIIconChooserDialog* desktop_agnostic_ui_icon_chooser_dialog_new (void) { - return desktop_agnostic_ui_icon_chooser_dialog_construct (DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG); -} - - -const char* desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon (DesktopAgnosticUIIconChooserDialog* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_selected_icon; - return result; -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon (DesktopAgnosticUIIconChooserDialog* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_selected_icon = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_selected_icon), _tmp0_); - g_object_notify ((GObject *) self, "selected-icon"); -} - - -GdkPixbuf* desktop_agnostic_ui_icon_chooser_dialog_get_selected_pixbuf (DesktopAgnosticUIIconChooserDialog* self) { - GdkPixbuf* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_selected_pixbuf; - return result; -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_set_selected_pixbuf (DesktopAgnosticUIIconChooserDialog* self, GdkPixbuf* value) { - GdkPixbuf* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_selected_pixbuf = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_selected_pixbuf), _tmp0_); - g_object_notify ((GObject *) self, "selected-pixbuf"); -} - - -DesktopAgnosticUIIconType desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon_type (DesktopAgnosticUIIconChooserDialog* self) { - DesktopAgnosticUIIconType result; - g_return_val_if_fail (self != NULL, 0); - result = self->priv->_selected_icon_type; - return result; -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon_type (DesktopAgnosticUIIconChooserDialog* self, DesktopAgnosticUIIconType value) { - g_return_if_fail (self != NULL); - self->priv->_selected_icon_type = value; - g_object_notify ((GObject *) self, "selected-icon-type"); -} - - -static void _desktop_agnostic_ui_icon_chooser_dialog_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) { - desktop_agnostic_ui_icon_chooser_dialog_on_response (self, response_id); -} - - -static GObject * desktop_agnostic_ui_icon_chooser_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticUIIconChooserDialog * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_ui_icon_chooser_dialog_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG (obj); - { - g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _desktop_agnostic_ui_icon_chooser_dialog_on_response_gtk_dialog_response, self, 0); - gtk_window_set_title ((GtkWindow*) self, _ ("Select Icon")); - gtk_window_set_icon_name ((GtkWindow*) self, GTK_STOCK_FIND); - desktop_agnostic_ui_icon_chooser_dialog_create_ui (self); - } - return obj; -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_class_init (DesktopAgnosticUIIconChooserDialogClass * klass) { - desktop_agnostic_ui_icon_chooser_dialog_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticUIIconChooserDialogPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_ui_icon_chooser_dialog_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_ui_icon_chooser_dialog_set_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_ui_icon_chooser_dialog_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_ui_icon_chooser_dialog_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON, g_param_spec_string ("selected-icon", "selected-icon", "selected-icon", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_PIXBUF, g_param_spec_object ("selected-pixbuf", "selected-pixbuf", "selected-pixbuf", GDK_TYPE_PIXBUF, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON_TYPE, g_param_spec_enum ("selected-icon-type", "selected-icon-type", "selected-icon-type", DESKTOP_AGNOSTIC_UI_TYPE_ICON_TYPE, DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_signal_new ("icon_selected", DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_instance_init (DesktopAgnosticUIIconChooserDialog * self) { - self->priv = DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_GET_PRIVATE (self); - self->priv->_themed_viewer = NULL; - self->priv->_selected_icon = NULL; - self->priv->_selected_pixbuf = NULL; - self->priv->_selected_icon_type = DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE; -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_finalize (GObject* obj) { - DesktopAgnosticUIIconChooserDialog * self; - self = DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG (obj); - _g_object_unref0 (self->priv->_file); - _g_object_unref0 (self->priv->_themed); - _g_object_unref0 (self->priv->_directory); - _g_object_unref0 (self->priv->_themed_context); - _g_object_unref0 (self->priv->_file_viewer); - _g_object_unref0 (self->priv->_themed_viewer); - _g_free0 (self->priv->_selected_icon); - _g_object_unref0 (self->priv->_selected_pixbuf); - G_OBJECT_CLASS (desktop_agnostic_ui_icon_chooser_dialog_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_ui_icon_chooser_dialog_get_type (void) { - static GType desktop_agnostic_ui_icon_chooser_dialog_type_id = 0; - if (desktop_agnostic_ui_icon_chooser_dialog_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticUIIconChooserDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_ui_icon_chooser_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticUIIconChooserDialog), 0, (GInstanceInitFunc) desktop_agnostic_ui_icon_chooser_dialog_instance_init, NULL }; - desktop_agnostic_ui_icon_chooser_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "DesktopAgnosticUIIconChooserDialog", &g_define_type_info, 0); - } - return desktop_agnostic_ui_icon_chooser_dialog_type_id; -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticUIIconChooserDialog * self; - self = DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON: - g_value_set_string (value, desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon (self)); - break; - case DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_PIXBUF: - g_value_set_object (value, desktop_agnostic_ui_icon_chooser_dialog_get_selected_pixbuf (self)); - break; - case DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON_TYPE: - g_value_set_enum (value, desktop_agnostic_ui_icon_chooser_dialog_get_selected_icon_type (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_ui_icon_chooser_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticUIIconChooserDialog * self; - self = DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON: - desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon (self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_PIXBUF: - desktop_agnostic_ui_icon_chooser_dialog_set_selected_pixbuf (self, g_value_get_object (value)); - break; - case DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_SELECTED_ICON_TYPE: - desktop_agnostic_ui_icon_chooser_dialog_set_selected_icon_type (self, g_value_get_enum (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-launcher-editor-dialog.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-launcher-editor-dialog.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/ui-launcher-editor-dialog.c 2010-04-11 07:32:31.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/ui-launcher-editor-dialog.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,747 +0,0 @@ -/* ui-launcher-editor-dialog.c generated by valac, the Vala compiler - * generated from ui-launcher-editor-dialog.vala, do not modify */ - -/* - * Desktop Agnostic Library: Icon chooser dialog. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_UI_TYPE_FIXED_TABLE (desktop_agnostic_ui_fixed_table_get_type ()) -#define DESKTOP_AGNOSTIC_UI_FIXED_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_FIXED_TABLE, DesktopAgnosticUIFixedTable)) -#define DESKTOP_AGNOSTIC_UI_FIXED_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_FIXED_TABLE, DesktopAgnosticUIFixedTableClass)) -#define DESKTOP_AGNOSTIC_UI_IS_FIXED_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_FIXED_TABLE)) -#define DESKTOP_AGNOSTIC_UI_IS_FIXED_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_FIXED_TABLE)) -#define DESKTOP_AGNOSTIC_UI_FIXED_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_FIXED_TABLE, DesktopAgnosticUIFixedTableClass)) - -typedef struct _DesktopAgnosticUIFixedTable DesktopAgnosticUIFixedTable; -typedef struct _DesktopAgnosticUIFixedTableClass DesktopAgnosticUIFixedTableClass; -typedef struct _DesktopAgnosticUIFixedTablePrivate DesktopAgnosticUIFixedTablePrivate; - -#define DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG (desktop_agnostic_ui_launcher_editor_dialog_get_type ()) -#define DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, DesktopAgnosticUILauncherEditorDialog)) -#define DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, DesktopAgnosticUILauncherEditorDialogClass)) -#define DESKTOP_AGNOSTIC_UI_IS_LAUNCHER_EDITOR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_IS_LAUNCHER_EDITOR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG)) -#define DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, DesktopAgnosticUILauncherEditorDialogClass)) - -typedef struct _DesktopAgnosticUILauncherEditorDialog DesktopAgnosticUILauncherEditorDialog; -typedef struct _DesktopAgnosticUILauncherEditorDialogClass DesktopAgnosticUILauncherEditorDialogClass; -typedef struct _DesktopAgnosticUILauncherEditorDialogPrivate DesktopAgnosticUILauncherEditorDialogPrivate; - -#define DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON (desktop_agnostic_ui_icon_button_get_type ()) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButton)) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButtonClass)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_IS_ICON_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON)) -#define DESKTOP_AGNOSTIC_UI_ICON_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON, DesktopAgnosticUIIconButtonClass)) - -typedef struct _DesktopAgnosticUIIconButton DesktopAgnosticUIIconButton; -typedef struct _DesktopAgnosticUIIconButtonClass DesktopAgnosticUIIconButtonClass; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -struct _DesktopAgnosticUIFixedTable { - GtkTable parent_instance; - DesktopAgnosticUIFixedTablePrivate * priv; -}; - -struct _DesktopAgnosticUIFixedTableClass { - GtkTableClass parent_class; -}; - -struct _DesktopAgnosticUILauncherEditorDialog { - GtkDialog parent_instance; - DesktopAgnosticUILauncherEditorDialogPrivate * priv; -}; - -struct _DesktopAgnosticUILauncherEditorDialogClass { - GtkDialogClass parent_class; -}; - -struct _DesktopAgnosticUILauncherEditorDialogPrivate { - DesktopAgnosticUIIconButton* _icon; - GtkEntry* _name; - GtkEntry* _desc; - GtkEntry* _exec; - GtkCheckButton* _terminal; - GtkCheckButton* _startup_notification; - DesktopAgnosticVFSFile* _file; - DesktopAgnosticVFSFile* _output; - gboolean _standalone; - DesktopAgnosticFDODesktopEntry* _entry; -}; - - -static gpointer desktop_agnostic_ui_fixed_table_parent_class = NULL; -static gpointer desktop_agnostic_ui_launcher_editor_dialog_parent_class = NULL; - -#define LAUNCHER_I18N_PACKAGE GETTEXT_PACKAGE -GType desktop_agnostic_ui_fixed_table_get_type (void); -enum { - DESKTOP_AGNOSTIC_UI_FIXED_TABLE_DUMMY_PROPERTY -}; -DesktopAgnosticUIFixedTable* desktop_agnostic_ui_fixed_table_new (guint columns, guint rows); -DesktopAgnosticUIFixedTable* desktop_agnostic_ui_fixed_table_construct (GType object_type, guint columns, guint rows); -void desktop_agnostic_ui_fixed_table_attach_defaults (DesktopAgnosticUIFixedTable* self, GtkWidget* widget, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach); -void desktop_agnostic_ui_fixed_table_attach_fill (DesktopAgnosticUIFixedTable* self, GtkWidget* widget, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach); -GType desktop_agnostic_ui_launcher_editor_dialog_get_type (void); -GType desktop_agnostic_ui_icon_button_get_type (void); -#define DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, DesktopAgnosticUILauncherEditorDialogPrivate)) -enum { - DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_FILE, - DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_OUTPUT -}; -static void desktop_agnostic_ui_launcher_editor_dialog_set_file (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticVFSFile* value); -static void desktop_agnostic_ui_launcher_editor_dialog_set_output (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticVFSFile* value); -DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_new (DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean standalone); -DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_construct (GType object_type, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean standalone); -static gboolean _lambda0_ (GtkWidget* widget, GdkEvent* event, DesktopAgnosticUILauncherEditorDialog* self); -static gboolean __lambda0__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_file (DesktopAgnosticUILauncherEditorDialog* self); -static void desktop_agnostic_ui_launcher_editor_dialog_build_ui (DesktopAgnosticUILauncherEditorDialog* self); -static void desktop_agnostic_ui_launcher_editor_dialog_real_constructed (GObject* base); -static void desktop_agnostic_ui_launcher_editor_dialog_on_response (DesktopAgnosticUILauncherEditorDialog* self, gint response_id); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self); -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_new (const char* icon); -DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_construct (GType object_type, const char* icon); -static void desktop_agnostic_ui_launcher_editor_dialog_on_icon_changed (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticUIIconButton* button); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_icon_changed_desktop_agnostic_ui_icon_button_icon_selected (DesktopAgnosticUIIconButton* _sender, gpointer self); -static void desktop_agnostic_ui_launcher_editor_dialog_on_name_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkEditable* editable); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_name_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self); -static void desktop_agnostic_ui_launcher_editor_dialog_on_desc_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkEditable* editable); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_desc_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self); -static void desktop_agnostic_ui_launcher_editor_dialog_on_exec_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkEditable* editable); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_exec_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self); -static void desktop_agnostic_ui_launcher_editor_dialog_on_exec_browse (DesktopAgnosticUILauncherEditorDialog* self, GtkButton* btn); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_exec_browse_gtk_button_clicked (GtkButton* _sender, gpointer self); -static void desktop_agnostic_ui_launcher_editor_dialog_on_terminal_toggled (DesktopAgnosticUILauncherEditorDialog* self, GtkToggleButton* button); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_terminal_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self); -static void desktop_agnostic_ui_launcher_editor_dialog_on_startup_notification_toggled (DesktopAgnosticUILauncherEditorDialog* self, GtkToggleButton* button); -static void _desktop_agnostic_ui_launcher_editor_dialog_on_startup_notification_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self); -const char* desktop_agnostic_ui_icon_button_get_icon (DesktopAgnosticUIIconButton* self); -static gboolean desktop_agnostic_ui_launcher_editor_dialog_change_output_file_prompt (DesktopAgnosticUILauncherEditorDialog* self); -DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_output (DesktopAgnosticUILauncherEditorDialog* self); -static void desktop_agnostic_ui_launcher_editor_dialog_finalize (GObject* obj); -static void desktop_agnostic_ui_launcher_editor_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_ui_launcher_editor_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); - - - -DesktopAgnosticUIFixedTable* desktop_agnostic_ui_fixed_table_construct (GType object_type, guint columns, guint rows) { - DesktopAgnosticUIFixedTable * self; - self = g_object_newv (object_type, 0, NULL); - g_object_set ((GtkTable*) self, "n-columns", columns, NULL); - g_object_set ((GtkTable*) self, "n-rows", rows, NULL); - gtk_table_set_homogeneous ((GtkTable*) self, FALSE); - return self; -} - - -DesktopAgnosticUIFixedTable* desktop_agnostic_ui_fixed_table_new (guint columns, guint rows) { - return desktop_agnostic_ui_fixed_table_construct (DESKTOP_AGNOSTIC_UI_TYPE_FIXED_TABLE, columns, rows); -} - - -void desktop_agnostic_ui_fixed_table_attach_defaults (DesktopAgnosticUIFixedTable* self, GtkWidget* widget, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach) { - g_return_if_fail (self != NULL); - g_return_if_fail (widget != NULL); - gtk_table_attach ((GtkTable*) self, widget, left_attach, right_attach, top_attach, bottom_attach, GTK_FILL, GTK_SHRINK, (guint) 0, (guint) 0); -} - - -void desktop_agnostic_ui_fixed_table_attach_fill (DesktopAgnosticUIFixedTable* self, GtkWidget* widget, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach) { - g_return_if_fail (self != NULL); - g_return_if_fail (widget != NULL); - gtk_table_attach ((GtkTable*) self, widget, left_attach, right_attach, top_attach, bottom_attach, GTK_FILL, 0, (guint) 0, (guint) 0); -} - - -static void desktop_agnostic_ui_fixed_table_class_init (DesktopAgnosticUIFixedTableClass * klass) { - desktop_agnostic_ui_fixed_table_parent_class = g_type_class_peek_parent (klass); -} - - -static void desktop_agnostic_ui_fixed_table_instance_init (DesktopAgnosticUIFixedTable * self) { -} - - -GType desktop_agnostic_ui_fixed_table_get_type (void) { - static GType desktop_agnostic_ui_fixed_table_type_id = 0; - if (desktop_agnostic_ui_fixed_table_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticUIFixedTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_ui_fixed_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticUIFixedTable), 0, (GInstanceInitFunc) desktop_agnostic_ui_fixed_table_instance_init, NULL }; - desktop_agnostic_ui_fixed_table_type_id = g_type_register_static (GTK_TYPE_TABLE, "DesktopAgnosticUIFixedTable", &g_define_type_info, 0); - } - return desktop_agnostic_ui_fixed_table_type_id; -} - - -DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_construct (GType object_type, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean standalone) { - GParameter * __params; - GParameter * __params_it; - GtkWindowType type = 0; - DesktopAgnosticUILauncherEditorDialog * self; - g_return_val_if_fail (file != NULL, NULL); - __params = g_new0 (GParameter, 3); - __params_it = __params; - if (standalone) { - type = GTK_WINDOW_TOPLEVEL; - } else { - type = GTK_WINDOW_POPUP; - } - __params_it->name = "type"; - g_value_init (&__params_it->value, GTK_TYPE_WINDOW_TYPE); - g_value_set_enum (&__params_it->value, type); - __params_it++; - self->priv->_standalone = standalone; - __params_it->name = "file"; - g_value_init (&__params_it->value, DESKTOP_AGNOSTIC_VFS_TYPE_FILE); - g_value_set_object (&__params_it->value, file); - __params_it++; - __params_it->name = "output"; - g_value_init (&__params_it->value, DESKTOP_AGNOSTIC_VFS_TYPE_FILE); - g_value_set_object (&__params_it->value, output); - __params_it++; - self = g_object_newv (object_type, __params_it - __params, __params); - while (__params_it > __params) { - --__params_it; - g_value_unset (&__params_it->value); - } - g_free (__params); - return self; -} - - -DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_new (DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean standalone) { - return desktop_agnostic_ui_launcher_editor_dialog_construct (DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, file, output, standalone); -} - - -static gboolean _lambda0_ (GtkWidget* widget, GdkEvent* event, DesktopAgnosticUILauncherEditorDialog* self) { - gboolean result; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (event != NULL, FALSE); - gtk_main_quit (); - result = TRUE; - return result; -} - - -static gboolean __lambda0__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { - return _lambda0_ (_sender, event, self); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_real_constructed (GObject* base) { - DesktopAgnosticUILauncherEditorDialog * self; - GError * _inner_error_; - DesktopAgnosticFDODesktopEntry* _tmp1_; - DesktopAgnosticFDODesktopEntry* _tmp2_; - self = (DesktopAgnosticUILauncherEditorDialog*) base; - _inner_error_ = NULL; - gtk_window_set_title ((GtkWindow*) self, _ ("Desktop Entry Editor")); - gtk_window_set_icon_name ((GtkWindow*) self, "gtk-preferences"); - if (self->priv->_standalone) { - g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda0__gtk_widget_delete_event, self, 0); - } - if (self->priv->_output == NULL) { - DesktopAgnosticVFSFile* _tmp0_; - self->priv->_output = (_tmp0_ = _g_object_ref0 (self->priv->_file), _g_object_unref0 (self->priv->_output), _tmp0_); - } - _tmp1_ = desktop_agnostic_fdo_desktop_entry_new_for_file (self->priv->_file, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_entry = (_tmp2_ = _tmp1_, _g_object_unref0 (self->priv->_entry), _tmp2_); - desktop_agnostic_ui_launcher_editor_dialog_build_ui (self); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_response (self, response_id); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_icon_changed_desktop_agnostic_ui_icon_button_icon_selected (DesktopAgnosticUIIconButton* _sender, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_icon_changed (self, _sender); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_name_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_name_changed (self, _sender); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_desc_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_desc_changed (self, _sender); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_exec_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_exec_changed (self, _sender); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_exec_browse_gtk_button_clicked (GtkButton* _sender, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_exec_browse (self, _sender); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_terminal_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_terminal_toggled (self, _sender); -} - - -static void _desktop_agnostic_ui_launcher_editor_dialog_on_startup_notification_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) { - desktop_agnostic_ui_launcher_editor_dialog_on_startup_notification_toggled (self, _sender); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_build_ui (DesktopAgnosticUILauncherEditorDialog* self) { - DesktopAgnosticUIFixedTable* table; - char* icon; - GtkButton* exec_button; - GtkImage* exec_image; - GtkLabel* name_label; - GtkLabel* desc_label; - GtkLabel* exec_label; - GtkHBox* exec_hbox; - GtkExpander* advanced; - GtkVBox* advanced_vbox; - DesktopAgnosticUIFixedTable* _tmp0_; - DesktopAgnosticUIIconButton* _tmp3_; - GtkLabel* _tmp4_; - GtkEntry* _tmp5_; - GtkLabel* _tmp7_; - GtkEntry* _tmp8_; - GtkLabel* _tmp10_; - GtkHBox* _tmp11_; - GtkEntry* _tmp12_; - GtkButton* _tmp14_; - GtkImage* _tmp15_; - GtkExpander* _tmp16_; - GtkVBox* _tmp17_; - GtkCheckButton* _tmp18_; - GtkCheckButton* _tmp19_; - g_return_if_fail (self != NULL); - table = NULL; - icon = NULL; - exec_button = NULL; - exec_image = NULL; - name_label = NULL; - desc_label = NULL; - exec_label = NULL; - exec_hbox = NULL; - advanced = NULL; - advanced_vbox = NULL; - gtk_dialog_add_buttons ((GtkDialog*) self, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_APPLY, NULL); - gtk_dialog_set_default_response ((GtkDialog*) self, (gint) GTK_RESPONSE_CANCEL); - g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_response_gtk_dialog_response, self, 0); - table = (_tmp0_ = g_object_ref_sink (desktop_agnostic_ui_fixed_table_new ((guint) 4, (guint) 3)), _g_object_unref0 (table), _tmp0_); - gtk_table_set_row_spacings ((GtkTable*) table, (guint) 5); - g_object_set ((GtkTable*) table, "column-spacing", (guint) 5, NULL); - if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Icon")) { - char* _tmp1_; - icon = (_tmp1_ = desktop_agnostic_fdo_desktop_entry_get_icon (self->priv->_entry), _g_free0 (icon), _tmp1_); - } else { - char* _tmp2_; - icon = (_tmp2_ = g_strdup (GTK_STOCK_MISSING_IMAGE), _g_free0 (icon), _tmp2_); - } - self->priv->_icon = (_tmp3_ = g_object_ref_sink (desktop_agnostic_ui_icon_button_new (icon)), _g_object_unref0 (self->priv->_icon), _tmp3_); - g_signal_connect_object (self->priv->_icon, "icon-selected", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_icon_changed_desktop_agnostic_ui_icon_button_icon_selected, self, 0); - desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) self->priv->_icon, (guint) 0, (guint) 1, (guint) 0, (guint) 3); - name_label = (_tmp4_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic (_ ("_Name:"))), _g_object_unref0 (name_label), _tmp4_); - desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) name_label, (guint) 1, (guint) 2, (guint) 0, (guint) 1); - self->priv->_name = (_tmp5_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), _g_object_unref0 (self->priv->_name), _tmp5_); - gtk_label_set_mnemonic_widget (name_label, (GtkWidget*) self->priv->_name); - if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Name")) { - char* _tmp6_; - gtk_entry_set_text (self->priv->_name, _tmp6_ = desktop_agnostic_fdo_desktop_entry_get_name (self->priv->_entry)); - _g_free0 (_tmp6_); - } - g_signal_connect_object ((GtkEditable*) self->priv->_name, "changed", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_name_changed_gtk_editable_changed, self, 0); - desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) self->priv->_name, (guint) 2, (guint) 3, (guint) 0, (guint) 1); - desc_label = (_tmp7_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic (_ ("_Description:"))), _g_object_unref0 (desc_label), _tmp7_); - desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) desc_label, (guint) 1, (guint) 2, (guint) 1, (guint) 2); - self->priv->_desc = (_tmp8_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), _g_object_unref0 (self->priv->_desc), _tmp8_); - gtk_label_set_mnemonic_widget (desc_label, (GtkWidget*) self->priv->_desc); - if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Comment")) { - char* _tmp9_; - gtk_entry_set_text (self->priv->_desc, _tmp9_ = desktop_agnostic_fdo_desktop_entry_get_string (self->priv->_entry, "Comment")); - _g_free0 (_tmp9_); - } - g_signal_connect_object ((GtkEditable*) self->priv->_desc, "changed", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_desc_changed_gtk_editable_changed, self, 0); - desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) self->priv->_desc, (guint) 2, (guint) 3, (guint) 1, (guint) 2); - exec_label = (_tmp10_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic (_ ("_Command:"))), _g_object_unref0 (exec_label), _tmp10_); - desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) exec_label, (guint) 1, (guint) 2, (guint) 2, (guint) 3); - exec_hbox = (_tmp11_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 5)), _g_object_unref0 (exec_hbox), _tmp11_); - self->priv->_exec = (_tmp12_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), _g_object_unref0 (self->priv->_exec), _tmp12_); - gtk_label_set_mnemonic_widget (exec_label, (GtkWidget*) self->priv->_exec); - if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Exec")) { - char* _tmp13_; - gtk_entry_set_text (self->priv->_exec, _tmp13_ = desktop_agnostic_fdo_desktop_entry_get_string (self->priv->_entry, "Exec")); - _g_free0 (_tmp13_); - } - g_signal_connect_object ((GtkEditable*) self->priv->_exec, "changed", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_exec_changed_gtk_editable_changed, self, 0); - gtk_container_add ((GtkContainer*) exec_hbox, (GtkWidget*) self->priv->_exec); - exec_button = (_tmp14_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_mnemonic (_ ("_Browse..."))), _g_object_unref0 (exec_button), _tmp14_); - exec_image = (_tmp15_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON)), _g_object_unref0 (exec_image), _tmp15_); - gtk_button_set_image (exec_button, (GtkWidget*) exec_image); - g_signal_connect_object (exec_button, "clicked", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_exec_browse_gtk_button_clicked, self, 0); - gtk_container_add ((GtkContainer*) exec_hbox, (GtkWidget*) exec_button); - desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) exec_hbox, (guint) 2, (guint) 3, (guint) 2, (guint) 3); - advanced = (_tmp16_ = g_object_ref_sink ((GtkExpander*) gtk_expander_new_with_mnemonic (_ ("_Advanced"))), _g_object_unref0 (advanced), _tmp16_); - advanced_vbox = (_tmp17_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 5)), _g_object_unref0 (advanced_vbox), _tmp17_); - self->priv->_terminal = (_tmp18_ = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Run in _terminal"))), _g_object_unref0 (self->priv->_terminal), _tmp18_); - if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Terminal")) { - gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->_terminal, desktop_agnostic_fdo_desktop_entry_get_boolean (self->priv->_entry, "Terminal")); - } - g_signal_connect_object ((GtkToggleButton*) self->priv->_terminal, "toggled", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_terminal_toggled_gtk_toggle_button_toggled, self, 0); - gtk_container_add ((GtkContainer*) advanced_vbox, (GtkWidget*) self->priv->_terminal); - self->priv->_startup_notification = (_tmp19_ = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Use _startup notification"))), _g_object_unref0 (self->priv->_startup_notification), _tmp19_); - if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "StartupNotify")) { - gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->_startup_notification, desktop_agnostic_fdo_desktop_entry_get_boolean (self->priv->_entry, "StartupNotify")); - } - g_signal_connect_object ((GtkToggleButton*) self->priv->_startup_notification, "toggled", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_startup_notification_toggled_gtk_toggle_button_toggled, self, 0); - gtk_container_add ((GtkContainer*) advanced_vbox, (GtkWidget*) self->priv->_startup_notification); - gtk_container_add ((GtkContainer*) advanced, (GtkWidget*) advanced_vbox); - desktop_agnostic_ui_fixed_table_attach_fill (table, (GtkWidget*) advanced, (guint) 0, (guint) 3, (guint) 3, (guint) 4); - gtk_container_add ((GtkContainer*) ((GtkDialog*) self)->vbox, (GtkWidget*) table); - _g_object_unref0 (table); - _g_free0 (icon); - _g_object_unref0 (exec_button); - _g_object_unref0 (exec_image); - _g_object_unref0 (name_label); - _g_object_unref0 (desc_label); - _g_object_unref0 (exec_label); - _g_object_unref0 (exec_hbox); - _g_object_unref0 (advanced); - _g_object_unref0 (advanced_vbox); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_icon_changed (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticUIIconButton* button) { - g_return_if_fail (self != NULL); - g_return_if_fail (button != NULL); - desktop_agnostic_fdo_desktop_entry_set_icon (self->priv->_entry, desktop_agnostic_ui_icon_button_get_icon (button)); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_name_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkEditable* editable) { - GtkEditable* _tmp0_; - GtkEntry* entry; - g_return_if_fail (self != NULL); - g_return_if_fail (editable != NULL); - entry = _g_object_ref0 ((_tmp0_ = editable, GTK_IS_ENTRY (_tmp0_) ? ((GtkEntry*) _tmp0_) : NULL)); - desktop_agnostic_fdo_desktop_entry_set_name (self->priv->_entry, gtk_entry_get_text (entry)); - _g_object_unref0 (entry); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_desc_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkEditable* editable) { - GtkEditable* _tmp0_; - GtkEntry* entry; - g_return_if_fail (self != NULL); - g_return_if_fail (editable != NULL); - entry = _g_object_ref0 ((_tmp0_ = editable, GTK_IS_ENTRY (_tmp0_) ? ((GtkEntry*) _tmp0_) : NULL)); - desktop_agnostic_fdo_desktop_entry_set_string (self->priv->_entry, "Comment", gtk_entry_get_text (entry)); - _g_object_unref0 (entry); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_exec_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkEditable* editable) { - GtkEditable* _tmp0_; - GtkEntry* entry; - g_return_if_fail (self != NULL); - g_return_if_fail (editable != NULL); - entry = _g_object_ref0 ((_tmp0_ = editable, GTK_IS_ENTRY (_tmp0_) ? ((GtkEntry*) _tmp0_) : NULL)); - desktop_agnostic_fdo_desktop_entry_set_string (self->priv->_entry, "Exec", gtk_entry_get_text (entry)); - _g_object_unref0 (entry); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_exec_browse (DesktopAgnosticUILauncherEditorDialog* self, GtkButton* btn) { - GtkFileChooserDialog* dialog; - gint response = 0; - GtkFileChooserDialog* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (btn != NULL); - dialog = NULL; - dialog = (_tmp0_ = g_object_ref_sink ((GtkFileChooserDialog*) gtk_file_chooser_dialog_new (_ ("Locate Command"), (GtkWindow*) self, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL)), _g_object_unref0 (dialog), _tmp0_); - response = gtk_dialog_run ((GtkDialog*) dialog); - if (response == GTK_RESPONSE_OK) { - char* _tmp1_; - gtk_entry_set_text (self->priv->_exec, _tmp1_ = gtk_file_chooser_get_filename ((GtkFileChooser*) dialog)); - _g_free0 (_tmp1_); - } - gtk_object_destroy ((GtkObject*) dialog); - _g_object_unref0 (dialog); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_terminal_toggled (DesktopAgnosticUILauncherEditorDialog* self, GtkToggleButton* button) { - g_return_if_fail (self != NULL); - g_return_if_fail (button != NULL); - desktop_agnostic_fdo_desktop_entry_set_boolean (self->priv->_entry, "Terminal", gtk_toggle_button_get_active (button)); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_startup_notification_toggled (DesktopAgnosticUILauncherEditorDialog* self, GtkToggleButton* button) { - g_return_if_fail (self != NULL); - g_return_if_fail (button != NULL); - desktop_agnostic_fdo_desktop_entry_set_boolean (self->priv->_entry, "StartupNotify", gtk_toggle_button_get_active (button)); -} - - -static gboolean desktop_agnostic_ui_launcher_editor_dialog_change_output_file_prompt (DesktopAgnosticUILauncherEditorDialog* self) { - gboolean result; - GError * _inner_error_; - GtkFileChooserDialog* dialog; - gint response = 0; - gboolean try_to_save = FALSE; - GtkFileChooserDialog* _tmp0_; - g_return_val_if_fail (self != NULL, FALSE); - _inner_error_ = NULL; - dialog = NULL; - dialog = (_tmp0_ = g_object_ref_sink ((GtkFileChooserDialog*) gtk_file_chooser_dialog_new (_ ("Save As"), (GtkWindow*) self, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE_AS, GTK_RESPONSE_ACCEPT, NULL)), _g_object_unref0 (dialog), _tmp0_); - response = gtk_dialog_run ((GtkDialog*) dialog); - if (response == GTK_RESPONSE_ACCEPT) { - char* _tmp1_; - DesktopAgnosticVFSFile* _tmp2_; - DesktopAgnosticVFSFile* _tmp3_; - DesktopAgnosticVFSFile* _tmp4_; - _tmp3_ = (_tmp2_ = desktop_agnostic_vfs_file_new_for_uri (_tmp1_ = gtk_file_chooser_get_uri ((GtkFileChooser*) dialog), &_inner_error_), _g_free0 (_tmp1_), _tmp2_); - if (_inner_error_ != NULL) { - _g_object_unref0 (dialog); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - self->priv->_output = (_tmp4_ = _tmp3_, _g_object_unref0 (self->priv->_output), _tmp4_); - try_to_save = TRUE; - } else { - try_to_save = FALSE; - } - gtk_object_destroy ((GtkObject*) dialog); - result = try_to_save; - _g_object_unref0 (dialog); - return result; -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_on_response (DesktopAgnosticUILauncherEditorDialog* self, gint response_id) { - GError * _inner_error_; - gboolean try_to_save; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - try_to_save = TRUE; - if (response_id == GTK_RESPONSE_APPLY) { - if (desktop_agnostic_vfs_file_exists (self->priv->_output)) { - if (!desktop_agnostic_vfs_file_is_writable (self->priv->_output)) { - try_to_save = desktop_agnostic_ui_launcher_editor_dialog_change_output_file_prompt (self); - } - } else { - DesktopAgnosticVFSFile* directory; - DesktopAgnosticVFSFile* _tmp0_; - gboolean _tmp1_ = FALSE; - directory = NULL; - directory = (_tmp0_ = desktop_agnostic_vfs_file_get_parent (self->priv->_output), _g_object_unref0 (directory), _tmp0_); - if (directory == NULL) { - _tmp1_ = TRUE; - } else { - _tmp1_ = !desktop_agnostic_vfs_file_is_writable (directory); - } - if (_tmp1_) { - try_to_save = desktop_agnostic_ui_launcher_editor_dialog_change_output_file_prompt (self); - } - _g_object_unref0 (directory); - } - if (try_to_save) { - if (desktop_agnostic_fdo_desktop_entry_get_entry_type (self->priv->_entry) == DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN) { - desktop_agnostic_fdo_desktop_entry_set_entry_type (self->priv->_entry, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION); - } - { - desktop_agnostic_fdo_desktop_entry_save (self->priv->_entry, self->priv->_output, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch3_g_error; - } - } - goto __finally3; - __catch3_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - GtkMessageDialog* dialog; - GtkMessageDialog* _tmp2_; - dialog = NULL; - dialog = (_tmp2_ = g_object_ref_sink ((GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _ ("An error occurred while trying to save the desktop entry:\n\n%s"), err->message)), _g_object_unref0 (dialog), _tmp2_); - gtk_dialog_run ((GtkDialog*) dialog); - gtk_object_destroy ((GtkObject*) dialog); - _g_error_free0 (err); - _g_object_unref0 (dialog); - } - } - __finally3: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - if (self->priv->_standalone) { - gtk_main_quit (); - } else { - gtk_widget_hide ((GtkWidget*) self); - } -} - - -DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_file (DesktopAgnosticUILauncherEditorDialog* self) { - DesktopAgnosticVFSFile* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_file; - return result; -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_set_file (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticVFSFile* value) { - g_return_if_fail (self != NULL); - self->priv->_file = value; - g_object_notify ((GObject *) self, "file"); -} - - -DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_output (DesktopAgnosticUILauncherEditorDialog* self) { - DesktopAgnosticVFSFile* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_output; - return result; -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_set_output (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticVFSFile* value) { - DesktopAgnosticVFSFile* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_output = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_output), _tmp0_); - g_object_notify ((GObject *) self, "output"); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_class_init (DesktopAgnosticUILauncherEditorDialogClass * klass) { - desktop_agnostic_ui_launcher_editor_dialog_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticUILauncherEditorDialogPrivate)); - G_OBJECT_CLASS (klass)->constructed = desktop_agnostic_ui_launcher_editor_dialog_real_constructed; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_ui_launcher_editor_dialog_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_ui_launcher_editor_dialog_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_ui_launcher_editor_dialog_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_FILE, g_param_spec_object ("file", "file", "file", DESKTOP_AGNOSTIC_VFS_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_OUTPUT, g_param_spec_object ("output", "output", "output", DESKTOP_AGNOSTIC_VFS_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_instance_init (DesktopAgnosticUILauncherEditorDialog * self) { - self->priv = DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_GET_PRIVATE (self); -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_finalize (GObject* obj) { - DesktopAgnosticUILauncherEditorDialog * self; - self = DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG (obj); - _g_object_unref0 (self->priv->_icon); - _g_object_unref0 (self->priv->_name); - _g_object_unref0 (self->priv->_desc); - _g_object_unref0 (self->priv->_exec); - _g_object_unref0 (self->priv->_terminal); - _g_object_unref0 (self->priv->_startup_notification); - _g_object_unref0 (self->priv->_output); - _g_object_unref0 (self->priv->_entry); - G_OBJECT_CLASS (desktop_agnostic_ui_launcher_editor_dialog_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_ui_launcher_editor_dialog_get_type (void) { - static GType desktop_agnostic_ui_launcher_editor_dialog_type_id = 0; - if (desktop_agnostic_ui_launcher_editor_dialog_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticUILauncherEditorDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_ui_launcher_editor_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticUILauncherEditorDialog), 0, (GInstanceInitFunc) desktop_agnostic_ui_launcher_editor_dialog_instance_init, NULL }; - desktop_agnostic_ui_launcher_editor_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "DesktopAgnosticUILauncherEditorDialog", &g_define_type_info, 0); - } - return desktop_agnostic_ui_launcher_editor_dialog_type_id; -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticUILauncherEditorDialog * self; - self = DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_FILE: - g_value_set_object (value, desktop_agnostic_ui_launcher_editor_dialog_get_file (self)); - break; - case DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_OUTPUT: - g_value_set_object (value, desktop_agnostic_ui_launcher_editor_dialog_get_output (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_ui_launcher_editor_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticUILauncherEditorDialog * self; - self = DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_FILE: - desktop_agnostic_ui_launcher_editor_dialog_set_file (self, g_value_get_object (value)); - break; - case DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_OUTPUT: - desktop_agnostic_ui_launcher_editor_dialog_set_output (self, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-bookmarks-gtk.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-bookmarks-gtk.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-bookmarks-gtk.c 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-bookmarks-gtk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,635 +0,0 @@ -/* vfs-bookmarks-gtk.c generated by valac, the Vala compiler - * generated from vfs-bookmarks-gtk.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS GTK+ Bookmarks Parser. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - * - * Based on the code from the Awn Places applet, author Rodney Cryderman - * . - */ - -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK (desktop_agnostic_vfs_bookmark_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK, DesktopAgnosticVFSBookmark)) -#define DESKTOP_AGNOSTIC_VFS_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK, DesktopAgnosticVFSBookmarkClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK)) -#define DESKTOP_AGNOSTIC_VFS_IS_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK)) -#define DESKTOP_AGNOSTIC_VFS_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK, DesktopAgnosticVFSBookmarkClass)) - -typedef struct _DesktopAgnosticVFSBookmark DesktopAgnosticVFSBookmark; -typedef struct _DesktopAgnosticVFSBookmarkClass DesktopAgnosticVFSBookmarkClass; -typedef struct _DesktopAgnosticVFSBookmarkPrivate DesktopAgnosticVFSBookmarkPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE (desktop_agnostic_vfs_file_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFile)) -#define DESKTOP_AGNOSTIC_VFS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) - -typedef struct _DesktopAgnosticVFSFile DesktopAgnosticVFSFile; -typedef struct _DesktopAgnosticVFSFileClass DesktopAgnosticVFSFileClass; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS (desktop_agnostic_vfs_gtk_bookmarks_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, DesktopAgnosticVFSGtkBookmarks)) -#define DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, DesktopAgnosticVFSGtkBookmarksClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GTK_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS)) -#define DESKTOP_AGNOSTIC_VFS_IS_GTK_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS)) -#define DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, DesktopAgnosticVFSGtkBookmarksClass)) - -typedef struct _DesktopAgnosticVFSGtkBookmarks DesktopAgnosticVFSGtkBookmarks; -typedef struct _DesktopAgnosticVFSGtkBookmarksClass DesktopAgnosticVFSGtkBookmarksClass; -typedef struct _DesktopAgnosticVFSGtkBookmarksPrivate DesktopAgnosticVFSGtkBookmarksPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR (desktop_agnostic_vfs_file_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitorIface)) - -typedef struct _DesktopAgnosticVFSFileMonitor DesktopAgnosticVFSFileMonitor; -typedef struct _DesktopAgnosticVFSFileMonitorIface DesktopAgnosticVFSFileMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_EVENT (desktop_agnostic_vfs_file_monitor_event_get_type ()) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -struct _DesktopAgnosticVFSBookmark { - GObject parent_instance; - DesktopAgnosticVFSBookmarkPrivate * priv; -}; - -struct _DesktopAgnosticVFSBookmarkClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSBookmarkPrivate { - DesktopAgnosticVFSFile* _file; - char* _alias; -}; - -struct _DesktopAgnosticVFSGtkBookmarks { - GObject parent_instance; - DesktopAgnosticVFSGtkBookmarksPrivate * priv; -}; - -struct _DesktopAgnosticVFSGtkBookmarksClass { - GObjectClass parent_class; -}; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN = 0, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED -} DesktopAgnosticVFSFileMonitorEvent; - -struct _DesktopAgnosticVFSFileMonitorIface { - GTypeInterface parent_iface; - void (*emit) (DesktopAgnosticVFSFileMonitor* self, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); - gboolean (*cancel) (DesktopAgnosticVFSFileMonitor* self); - gboolean (*get_cancelled) (DesktopAgnosticVFSFileMonitor* self); -}; - -struct _DesktopAgnosticVFSGtkBookmarksPrivate { - DesktopAgnosticVFSFile* _file; - DesktopAgnosticVFSFileMonitor* _monitor; - GSList* _bookmarks; -}; - - -static gpointer desktop_agnostic_vfs_bookmark_parent_class = NULL; -static gpointer desktop_agnostic_vfs_gtk_bookmarks_parent_class = NULL; - -GType desktop_agnostic_vfs_bookmark_get_type (void); -GType desktop_agnostic_vfs_file_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_BOOKMARK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK, DesktopAgnosticVFSBookmarkPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_BOOKMARK_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_BOOKMARK_FILE, - DESKTOP_AGNOSTIC_VFS_BOOKMARK_ALIAS -}; -DesktopAgnosticVFSBookmark* desktop_agnostic_vfs_bookmark_new (void); -DesktopAgnosticVFSBookmark* desktop_agnostic_vfs_bookmark_construct (GType object_type); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_bookmark_get_file (DesktopAgnosticVFSBookmark* self); -void desktop_agnostic_vfs_bookmark_set_file (DesktopAgnosticVFSBookmark* self, DesktopAgnosticVFSFile* value); -const char* desktop_agnostic_vfs_bookmark_get_alias (DesktopAgnosticVFSBookmark* self); -void desktop_agnostic_vfs_bookmark_set_alias (DesktopAgnosticVFSBookmark* self, const char* value); -static void desktop_agnostic_vfs_bookmark_finalize (GObject* obj); -static void desktop_agnostic_vfs_bookmark_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_bookmark_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType desktop_agnostic_vfs_gtk_bookmarks_get_type (void); -GType desktop_agnostic_vfs_file_monitor_event_get_type (void); -GType desktop_agnostic_vfs_file_monitor_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, DesktopAgnosticVFSGtkBookmarksPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_FILE, - DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_BOOKMARKS -}; -static void _g_slist_free_g_object_unref (GSList* self); -static void desktop_agnostic_vfs_gtk_bookmarks_set_file (DesktopAgnosticVFSGtkBookmarks* self, DesktopAgnosticVFSFile* value); -gboolean desktop_agnostic_vfs_file_exists (DesktopAgnosticVFSFile* self); -static void desktop_agnostic_vfs_gtk_bookmarks_parse (DesktopAgnosticVFSGtkBookmarks* self); -DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_monitor (DesktopAgnosticVFSFile* self); -static void desktop_agnostic_vfs_gtk_bookmarks_on_file_changed (DesktopAgnosticVFSGtkBookmarks* self, DesktopAgnosticVFSFileMonitor* monitor, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); -static void _desktop_agnostic_vfs_gtk_bookmarks_on_file_changed_desktop_agnostic_vfs_file_monitor_changed (DesktopAgnosticVFSFileMonitor* _sender, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, gpointer self); -DesktopAgnosticVFSGtkBookmarks* desktop_agnostic_vfs_gtk_bookmarks_new (DesktopAgnosticVFSFile* file, gboolean monitor); -DesktopAgnosticVFSGtkBookmarks* desktop_agnostic_vfs_gtk_bookmarks_construct (GType object_type, DesktopAgnosticVFSFile* file, gboolean monitor); -gboolean desktop_agnostic_vfs_file_load_contents (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_uri (const char* uri, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_path (const char* path, GError** error); -GSList* desktop_agnostic_vfs_gtk_bookmarks_get_bookmarks (DesktopAgnosticVFSGtkBookmarks* self); -static void desktop_agnostic_vfs_gtk_bookmarks_finalize (GObject* obj); -static void desktop_agnostic_vfs_gtk_bookmarks_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_gtk_bookmarks_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static gint _vala_array_length (gpointer array); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -DesktopAgnosticVFSBookmark* desktop_agnostic_vfs_bookmark_construct (GType object_type) { - DesktopAgnosticVFSBookmark * self; - self = (DesktopAgnosticVFSBookmark*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSBookmark* desktop_agnostic_vfs_bookmark_new (void) { - return desktop_agnostic_vfs_bookmark_construct (DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK); -} - - -DesktopAgnosticVFSFile* desktop_agnostic_vfs_bookmark_get_file (DesktopAgnosticVFSBookmark* self) { - DesktopAgnosticVFSFile* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_file; - return result; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -void desktop_agnostic_vfs_bookmark_set_file (DesktopAgnosticVFSBookmark* self, DesktopAgnosticVFSFile* value) { - DesktopAgnosticVFSFile* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_file = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_file), _tmp0_); - g_object_notify ((GObject *) self, "file"); -} - - -const char* desktop_agnostic_vfs_bookmark_get_alias (DesktopAgnosticVFSBookmark* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_alias; - return result; -} - - -void desktop_agnostic_vfs_bookmark_set_alias (DesktopAgnosticVFSBookmark* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_alias = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_alias), _tmp0_); - g_object_notify ((GObject *) self, "alias"); -} - - -static void desktop_agnostic_vfs_bookmark_class_init (DesktopAgnosticVFSBookmarkClass * klass) { - desktop_agnostic_vfs_bookmark_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSBookmarkPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_bookmark_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_bookmark_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_bookmark_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_BOOKMARK_FILE, g_param_spec_object ("file", "file", "file", DESKTOP_AGNOSTIC_VFS_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_BOOKMARK_ALIAS, g_param_spec_string ("alias", "alias", "alias", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); -} - - -static void desktop_agnostic_vfs_bookmark_instance_init (DesktopAgnosticVFSBookmark * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_BOOKMARK_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_bookmark_finalize (GObject* obj) { - DesktopAgnosticVFSBookmark * self; - self = DESKTOP_AGNOSTIC_VFS_BOOKMARK (obj); - _g_object_unref0 (self->priv->_file); - _g_free0 (self->priv->_alias); - G_OBJECT_CLASS (desktop_agnostic_vfs_bookmark_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_bookmark_get_type (void) { - static GType desktop_agnostic_vfs_bookmark_type_id = 0; - if (desktop_agnostic_vfs_bookmark_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSBookmarkClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_bookmark_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSBookmark), 0, (GInstanceInitFunc) desktop_agnostic_vfs_bookmark_instance_init, NULL }; - desktop_agnostic_vfs_bookmark_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSBookmark", &g_define_type_info, 0); - } - return desktop_agnostic_vfs_bookmark_type_id; -} - - -static void desktop_agnostic_vfs_bookmark_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSBookmark * self; - self = DESKTOP_AGNOSTIC_VFS_BOOKMARK (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_BOOKMARK_FILE: - g_value_set_object (value, desktop_agnostic_vfs_bookmark_get_file (self)); - break; - case DESKTOP_AGNOSTIC_VFS_BOOKMARK_ALIAS: - g_value_set_string (value, desktop_agnostic_vfs_bookmark_get_alias (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_bookmark_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSBookmark * self; - self = DESKTOP_AGNOSTIC_VFS_BOOKMARK (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_BOOKMARK_FILE: - desktop_agnostic_vfs_bookmark_set_file (self, g_value_get_object (value)); - break; - case DESKTOP_AGNOSTIC_VFS_BOOKMARK_ALIAS: - desktop_agnostic_vfs_bookmark_set_alias (self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static void _desktop_agnostic_vfs_gtk_bookmarks_on_file_changed_desktop_agnostic_vfs_file_monitor_changed (DesktopAgnosticVFSFileMonitor* _sender, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, gpointer self) { - desktop_agnostic_vfs_gtk_bookmarks_on_file_changed (self, _sender, file, other, event); -} - - -DesktopAgnosticVFSGtkBookmarks* desktop_agnostic_vfs_gtk_bookmarks_construct (GType object_type, DesktopAgnosticVFSFile* file, gboolean monitor) { - GParameter * __params; - GParameter * __params_it; - DesktopAgnosticVFSGtkBookmarks * self; - __params = g_new0 (GParameter, 1); - __params_it = __params; - __params_it->name = "file"; - g_value_init (&__params_it->value, DESKTOP_AGNOSTIC_VFS_TYPE_FILE); - g_value_set_object (&__params_it->value, file); - __params_it++; - self = g_object_newv (object_type, __params_it - __params, __params); - if (desktop_agnostic_vfs_file_exists (self->priv->_file)) { - desktop_agnostic_vfs_gtk_bookmarks_parse (self); - } - if (monitor) { - DesktopAgnosticVFSFileMonitor* _tmp0_; - self->priv->_monitor = (_tmp0_ = desktop_agnostic_vfs_file_monitor (self->priv->_file), _g_object_unref0 (self->priv->_monitor), _tmp0_); - g_signal_connect_object (self->priv->_monitor, "changed", (GCallback) _desktop_agnostic_vfs_gtk_bookmarks_on_file_changed_desktop_agnostic_vfs_file_monitor_changed, self, 0); - } - while (__params_it > __params) { - --__params_it; - g_value_unset (&__params_it->value); - } - g_free (__params); - return self; -} - - -DesktopAgnosticVFSGtkBookmarks* desktop_agnostic_vfs_gtk_bookmarks_new (DesktopAgnosticVFSFile* file, gboolean monitor) { - return desktop_agnostic_vfs_gtk_bookmarks_construct (DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, file, monitor); -} - - -static char* string_strip (const char* self) { - char* result; - char* _result_; - g_return_val_if_fail (self != NULL, NULL); - _result_ = g_strdup (self); - g_strstrip (_result_); - result = _result_; - return result; -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_parse (DesktopAgnosticVFSGtkBookmarks* self) { - GError * _inner_error_; - GSList* _tmp0_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - self->priv->_bookmarks = (_tmp0_ = NULL, __g_slist_free_g_object_unref0 (self->priv->_bookmarks), _tmp0_); - { - char* contents; - gsize length = 0UL; - gint lines_size; - gint lines_length1; - char** lines; - char* _tmp3_; - gboolean _tmp2_; - char* _tmp1_ = NULL; - char** _tmp5_; - char** _tmp4_; - contents = NULL; - lines = (lines_length1 = 0, NULL); - _tmp2_ = desktop_agnostic_vfs_file_load_contents (self->priv->_file, &_tmp1_, &length, &_inner_error_); - contents = (_tmp3_ = _tmp1_, _g_free0 (contents), _tmp3_); - _tmp2_; - if (_inner_error_ != NULL) { - _g_free0 (contents); - lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL); - goto __catch0_g_error; - } - lines = (_tmp5_ = _tmp4_ = g_strsplit (contents, "\n", 0), lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL), lines_length1 = _vala_array_length (_tmp4_), lines_size = lines_length1, _tmp5_); - { - char** line_collection; - int line_collection_length1; - int line_it; - line_collection = lines; - line_collection_length1 = lines_length1; - for (line_it = 0; line_it < lines_length1; line_it = line_it + 1) { - const char* line; - line = line_collection[line_it]; - { - gint tokens_size; - gint tokens_length1; - char** tokens; - char** _tmp7_; - char** _tmp6_; - gboolean _tmp8_ = FALSE; - tokens = (tokens_length1 = 0, NULL); - if (_vala_strcmp0 (line, "") == 0) { - tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); - continue; - } - tokens = (_tmp7_ = _tmp6_ = g_strsplit (line, " ", 2), tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL), tokens_length1 = _vala_array_length (_tmp6_), tokens_size = tokens_length1, _tmp7_); - if (tokens != NULL) { - _tmp8_ = tokens[0] != NULL; - } else { - _tmp8_ = FALSE; - } - if (_tmp8_) { - DesktopAgnosticVFSBookmark* bookmark; - char* _tmp9_; - DesktopAgnosticVFSFile* _tmp10_; - DesktopAgnosticVFSFile* _tmp11_; - DesktopAgnosticVFSBookmark* _tmp13_; - bookmark = desktop_agnostic_vfs_bookmark_new (); - _tmp9_ = string_strip (tokens[0]); - _g_free0 (_tmp9_); - _tmp10_ = desktop_agnostic_vfs_file_new_for_uri (tokens[0], &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (bookmark); - tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); - _g_free0 (contents); - lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL); - goto __catch0_g_error; - } - desktop_agnostic_vfs_bookmark_set_file (bookmark, _tmp11_ = _tmp10_); - _g_object_unref0 (_tmp11_); - if (tokens[1] == NULL) { - desktop_agnostic_vfs_bookmark_set_alias (bookmark, NULL); - } else { - char* _tmp12_; - _tmp12_ = string_strip (tokens[1]); - _g_free0 (_tmp12_); - desktop_agnostic_vfs_bookmark_set_alias (bookmark, tokens[1]); - } - self->priv->_bookmarks = g_slist_append (self->priv->_bookmarks, (_tmp13_ = bookmark, bookmark = NULL, _tmp13_)); - _g_object_unref0 (bookmark); - } - tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); - } - } - } - _g_free0 (contents); - lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL); - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - GSList* _tmp14_; - g_critical ("vfs-bookmarks-gtk.vala:134: Could not load/parse GTK bookmarks file: %s", err->message); - self->priv->_bookmarks = (_tmp14_ = NULL, __g_slist_free_g_object_unref0 (self->priv->_bookmarks), _tmp14_); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_on_file_changed (DesktopAgnosticVFSGtkBookmarks* self, DesktopAgnosticVFSFileMonitor* monitor, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event) { - g_return_if_fail (self != NULL); - g_return_if_fail (monitor != NULL); - g_return_if_fail (file != NULL); - switch (event) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED: - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED: - { - desktop_agnostic_vfs_gtk_bookmarks_parse (self); - g_signal_emit_by_name (self, "changed"); - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED: - { - GSList* _tmp0_; - self->priv->_bookmarks = (_tmp0_ = NULL, __g_slist_free_g_object_unref0 (self->priv->_bookmarks), _tmp0_); - g_signal_emit_by_name (self, "changed"); - break; - } - default: - { - break; - } - } -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_set_file (DesktopAgnosticVFSGtkBookmarks* self, DesktopAgnosticVFSFile* value) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (value == NULL) { - char* fname; - char* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - DesktopAgnosticVFSFile* _tmp2_; - fname = NULL; - fname = (_tmp0_ = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL), _g_free0 (fname), _tmp0_); - _tmp1_ = desktop_agnostic_vfs_file_new_for_path (fname, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (fname); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - self->priv->_file = (_tmp2_ = _tmp1_, _g_object_unref0 (self->priv->_file), _tmp2_); - _g_free0 (fname); - } else { - DesktopAgnosticVFSFile* _tmp3_; - self->priv->_file = (_tmp3_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_file), _tmp3_); - } - g_object_notify ((GObject *) self, "file"); -} - - -GSList* desktop_agnostic_vfs_gtk_bookmarks_get_bookmarks (DesktopAgnosticVFSGtkBookmarks* self) { - GSList* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_bookmarks; - return result; -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_class_init (DesktopAgnosticVFSGtkBookmarksClass * klass) { - desktop_agnostic_vfs_gtk_bookmarks_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSGtkBookmarksPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_gtk_bookmarks_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_gtk_bookmarks_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_gtk_bookmarks_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_FILE, g_param_spec_object ("file", "file", "file", DESKTOP_AGNOSTIC_VFS_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_BOOKMARKS, g_param_spec_pointer ("bookmarks", "bookmarks", "bookmarks", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_signal_new ("changed", DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_instance_init (DesktopAgnosticVFSGtkBookmarks * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_finalize (GObject* obj) { - DesktopAgnosticVFSGtkBookmarks * self; - self = DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS (obj); - _g_object_unref0 (self->priv->_file); - _g_object_unref0 (self->priv->_monitor); - __g_slist_free_g_object_unref0 (self->priv->_bookmarks); - G_OBJECT_CLASS (desktop_agnostic_vfs_gtk_bookmarks_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_gtk_bookmarks_get_type (void) { - static GType desktop_agnostic_vfs_gtk_bookmarks_type_id = 0; - if (desktop_agnostic_vfs_gtk_bookmarks_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSGtkBookmarksClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_gtk_bookmarks_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSGtkBookmarks), 0, (GInstanceInitFunc) desktop_agnostic_vfs_gtk_bookmarks_instance_init, NULL }; - desktop_agnostic_vfs_gtk_bookmarks_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSGtkBookmarks", &g_define_type_info, 0); - } - return desktop_agnostic_vfs_gtk_bookmarks_type_id; -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSGtkBookmarks * self; - self = DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_BOOKMARKS: - g_value_set_pointer (value, desktop_agnostic_vfs_gtk_bookmarks_get_bookmarks (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_gtk_bookmarks_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSGtkBookmarks * self; - self = DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_FILE: - desktop_agnostic_vfs_gtk_bookmarks_set_file (self, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static gint _vala_array_length (gpointer array) { - int length; - length = 0; - if (array) { - while (((gpointer*) array)[length]) { - length++; - } - } - return length; -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs.c 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,285 +0,0 @@ -/* vfs.c generated by valac, the Vala compiler - * generated from vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS implementation interface. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION (desktop_agnostic_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_IS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementationIface)) - -typedef struct _DesktopAgnosticVFSImplementation DesktopAgnosticVFSImplementation; -typedef struct _DesktopAgnosticVFSImplementationIface DesktopAgnosticVFSImplementationIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE (desktop_agnostic_vfs_file_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFile)) -#define DESKTOP_AGNOSTIC_VFS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) - -typedef struct _DesktopAgnosticVFSFile DesktopAgnosticVFSFile; -typedef struct _DesktopAgnosticVFSFileClass DesktopAgnosticVFSFileClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR (desktop_agnostic_vfs_volume_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitorIface)) - -typedef struct _DesktopAgnosticVFSVolumeMonitor DesktopAgnosticVFSVolumeMonitor; -typedef struct _DesktopAgnosticVFSVolumeMonitorIface DesktopAgnosticVFSVolumeMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME (desktop_agnostic_vfs_volume_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolume)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolumeIface)) - -typedef struct _DesktopAgnosticVFSVolume DesktopAgnosticVFSVolume; -typedef struct _DesktopAgnosticVFSVolumeIface DesktopAgnosticVFSVolumeIface; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -typedef void (*DesktopAgnosticVFSVolumeCallback) (void* user_data); -typedef enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT -} DesktopAgnosticVFSVolumeError; -#define DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR desktop_agnostic_vfs_volume_error_quark () -struct _DesktopAgnosticVFSVolumeIface { - GTypeInterface parent_iface; - gboolean (*is_mounted) (DesktopAgnosticVFSVolume* self); - void (*mount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*mount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - void (*unmount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*unmount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - gboolean (*can_eject) (DesktopAgnosticVFSVolume* self); - void (*eject) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*eject_finish) (DesktopAgnosticVFSVolume* self, GError** error); - const char* (*get_name) (DesktopAgnosticVFSVolume* self); - DesktopAgnosticVFSFile* (*get_uri) (DesktopAgnosticVFSVolume* self); - char* (*get_icon) (DesktopAgnosticVFSVolume* self); -}; - -struct _DesktopAgnosticVFSVolumeMonitorIface { - GTypeInterface parent_iface; - void* (*get_implementation) (DesktopAgnosticVFSVolumeMonitor* self); - GList* (*get_volumes) (DesktopAgnosticVFSVolumeMonitor* self); -}; - -struct _DesktopAgnosticVFSImplementationIface { - GTypeInterface parent_iface; - void (*init) (DesktopAgnosticVFSImplementation* self); - GSList* (*files_from_uri_list) (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error); - DesktopAgnosticVFSVolumeMonitor* (*volume_monitor_get_default) (DesktopAgnosticVFSImplementation* self); - void (*shutdown) (DesktopAgnosticVFSImplementation* self); - const char* (*get_name) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_monitor_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_trash_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_volume_type) (DesktopAgnosticVFSImplementation* self); -}; - - -extern DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_vfs; -DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_vfs = NULL; - -GType desktop_agnostic_vfs_file_get_type (void); -GQuark desktop_agnostic_vfs_volume_error_quark (void); -GType desktop_agnostic_vfs_volume_get_type (void); -GType desktop_agnostic_vfs_volume_monitor_get_type (void); -GType desktop_agnostic_vfs_implementation_get_type (void); -void desktop_agnostic_vfs_implementation_init (DesktopAgnosticVFSImplementation* self); -GSList* desktop_agnostic_vfs_implementation_files_from_uri_list (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error); -DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_implementation_volume_monitor_get_default (DesktopAgnosticVFSImplementation* self); -void desktop_agnostic_vfs_implementation_shutdown (DesktopAgnosticVFSImplementation* self); -const char* desktop_agnostic_vfs_implementation_get_name (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_file_type (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_file_monitor_type (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_trash_type (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_volume_type (DesktopAgnosticVFSImplementation* self); -DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error); -void desktop_agnostic_vfs_init (GError** error); -void desktop_agnostic_vfs_shutdown (GError** error); -GSList* desktop_agnostic_vfs_files_from_uri_list (const char* uri_list, GError** error); - - - -void desktop_agnostic_vfs_implementation_init (DesktopAgnosticVFSImplementation* self) { - DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->init (self); -} - - -GSList* desktop_agnostic_vfs_implementation_files_from_uri_list (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error) { - return DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->files_from_uri_list (self, uri_list, error); -} - - -DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_implementation_volume_monitor_get_default (DesktopAgnosticVFSImplementation* self) { - return DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->volume_monitor_get_default (self); -} - - -void desktop_agnostic_vfs_implementation_shutdown (DesktopAgnosticVFSImplementation* self) { - DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->shutdown (self); -} - - -const char* desktop_agnostic_vfs_implementation_get_name (DesktopAgnosticVFSImplementation* self) { - return DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->get_name (self); -} - - -GType desktop_agnostic_vfs_implementation_get_file_type (DesktopAgnosticVFSImplementation* self) { - return DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->get_file_type (self); -} - - -GType desktop_agnostic_vfs_implementation_get_file_monitor_type (DesktopAgnosticVFSImplementation* self) { - return DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->get_file_monitor_type (self); -} - - -GType desktop_agnostic_vfs_implementation_get_trash_type (DesktopAgnosticVFSImplementation* self) { - return DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->get_trash_type (self); -} - - -GType desktop_agnostic_vfs_implementation_get_volume_type (DesktopAgnosticVFSImplementation* self) { - return DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE (self)->get_volume_type (self); -} - - -static void desktop_agnostic_vfs_implementation_base_init (DesktopAgnosticVFSImplementationIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_object_interface_install_property (iface, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_interface_install_property (iface, g_param_spec_gtype ("file-type", "file-type", "file-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_interface_install_property (iface, g_param_spec_gtype ("file-monitor-type", "file-monitor-type", "file-monitor-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_interface_install_property (iface, g_param_spec_gtype ("trash-type", "trash-type", "trash-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_interface_install_property (iface, g_param_spec_gtype ("volume-type", "volume-type", "volume-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - } -} - - -GType desktop_agnostic_vfs_implementation_get_type (void) { - static GType desktop_agnostic_vfs_implementation_type_id = 0; - if (desktop_agnostic_vfs_implementation_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSImplementationIface), (GBaseInitFunc) desktop_agnostic_vfs_implementation_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - desktop_agnostic_vfs_implementation_type_id = g_type_register_static (G_TYPE_INTERFACE, "DesktopAgnosticVFSImplementation", &g_define_type_info, 0); - g_type_interface_add_prerequisite (desktop_agnostic_vfs_implementation_type_id, G_TYPE_OBJECT); - } - return desktop_agnostic_vfs_implementation_type_id; -} - - -DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error) { - DesktopAgnosticVFSImplementation* result; - GError * _inner_error_; - _inner_error_ = NULL; - if (desktop_agnostic_vfs_vfs == NULL) { - GType type; - type = desktop_agnostic_get_module_type ("vfs", "vfs", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (type == G_TYPE_INVALID) { - result = NULL; - return result; - } else { - DesktopAgnosticVFSImplementation* _tmp0_; - desktop_agnostic_vfs_vfs = (_tmp0_ = DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION (g_object_new (type, NULL)), _g_object_unref0 (desktop_agnostic_vfs_vfs), _tmp0_); - } - } - result = desktop_agnostic_vfs_vfs; - return result; -} - - -void desktop_agnostic_vfs_init (GError** error) { - GError * _inner_error_; - DesktopAgnosticVFSImplementation* vfs; - _inner_error_ = NULL; - vfs = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - if (vfs != NULL) { - desktop_agnostic_vfs_implementation_init (vfs); - } -} - - -void desktop_agnostic_vfs_shutdown (GError** error) { - GError * _inner_error_; - DesktopAgnosticVFSImplementation* vfs; - _inner_error_ = NULL; - vfs = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - if (vfs != NULL) { - desktop_agnostic_vfs_implementation_shutdown (vfs); - } -} - - -GSList* desktop_agnostic_vfs_files_from_uri_list (const char* uri_list, GError** error) { - GSList* result; - GError * _inner_error_; - DesktopAgnosticVFSImplementation* vfs; - g_return_val_if_fail (uri_list != NULL, NULL); - _inner_error_ = NULL; - vfs = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (vfs == NULL) { - result = NULL; - return result; - } else { - GSList* _tmp0_; - _tmp0_ = desktop_agnostic_vfs_implementation_files_from_uri_list (vfs, uri_list, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - result = _tmp0_; - return result; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file.c 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,595 +0,0 @@ -/* vfs-file.c generated by valac, the Vala compiler - * generated from vfs-file.vala, do not modify */ - -/* - * Desktop Agnostic Library: File interface (similar to GFile). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_TYPE (desktop_agnostic_vfs_file_type_get_type ()) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_ACCESS_FLAGS (desktop_agnostic_vfs_access_flags_get_type ()) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE (desktop_agnostic_vfs_file_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFile)) -#define DESKTOP_AGNOSTIC_VFS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) - -typedef struct _DesktopAgnosticVFSFile DesktopAgnosticVFSFile; -typedef struct _DesktopAgnosticVFSFileClass DesktopAgnosticVFSFileClass; -typedef struct _DesktopAgnosticVFSFilePrivate DesktopAgnosticVFSFilePrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR (desktop_agnostic_vfs_file_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitorIface)) - -typedef struct _DesktopAgnosticVFSFileMonitor DesktopAgnosticVFSFileMonitor; -typedef struct _DesktopAgnosticVFSFileMonitorIface DesktopAgnosticVFSFileMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_EVENT (desktop_agnostic_vfs_file_monitor_event_get_type ()) -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION (desktop_agnostic_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_IS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementationIface)) - -typedef struct _DesktopAgnosticVFSImplementation DesktopAgnosticVFSImplementation; -typedef struct _DesktopAgnosticVFSImplementationIface DesktopAgnosticVFSImplementationIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR (desktop_agnostic_vfs_volume_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitorIface)) - -typedef struct _DesktopAgnosticVFSVolumeMonitor DesktopAgnosticVFSVolumeMonitor; -typedef struct _DesktopAgnosticVFSVolumeMonitorIface DesktopAgnosticVFSVolumeMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME (desktop_agnostic_vfs_volume_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolume)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolumeIface)) - -typedef struct _DesktopAgnosticVFSVolume DesktopAgnosticVFSVolume; -typedef struct _DesktopAgnosticVFSVolumeIface DesktopAgnosticVFSVolumeIface; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_ERROR_FILE_NOT_FOUND, - DESKTOP_AGNOSTIC_VFS_FILE_ERROR_EXISTS, - DESKTOP_AGNOSTIC_VFS_FILE_ERROR_INVALID_TYPE -} DesktopAgnosticVFSFileError; -#define DESKTOP_AGNOSTIC_VFS_FILE_ERROR desktop_agnostic_vfs_file_error_quark () -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN = 0, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL -} DesktopAgnosticVFSFileType; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE = 0, - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ = 1 << 0, - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE = 1 << 1, - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE = 1 << 2 -} DesktopAgnosticVFSAccessFlags; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN = 0, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED -} DesktopAgnosticVFSFileMonitorEvent; - -struct _DesktopAgnosticVFSFileMonitorIface { - GTypeInterface parent_iface; - void (*emit) (DesktopAgnosticVFSFileMonitor* self, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); - gboolean (*cancel) (DesktopAgnosticVFSFileMonitor* self); - gboolean (*get_cancelled) (DesktopAgnosticVFSFileMonitor* self); -}; - -struct _DesktopAgnosticVFSFile { - GObject parent_instance; - DesktopAgnosticVFSFilePrivate * priv; -}; - -struct _DesktopAgnosticVFSFileClass { - GObjectClass parent_class; - void (*init) (DesktopAgnosticVFSFile* self, const char* uri); - gboolean (*exists) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSFileMonitor* (*monitor) (DesktopAgnosticVFSFile* self); - gboolean (*load_contents) (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error); - gboolean (*replace_contents) (DesktopAgnosticVFSFile* self, const char* contents, GError** error); - gboolean (*launch) (DesktopAgnosticVFSFile* self, GError** error); - GSList* (*enumerate_children) (DesktopAgnosticVFSFile* self, GError** error); - gboolean (*copy) (DesktopAgnosticVFSFile* self, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); - gboolean (*remove) (DesktopAgnosticVFSFile* self, GError** error); - void* (*get_implementation) (DesktopAgnosticVFSFile* self); - char* (*get_impl_uri) (DesktopAgnosticVFSFile* self); - char* (*get_impl_path) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSFileType (*get_file_type) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSAccessFlags (*get_access_flags) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSFile* (*get_parent) (DesktopAgnosticVFSFile* self); -}; - -typedef void (*DesktopAgnosticVFSVolumeCallback) (void* user_data); -typedef enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT -} DesktopAgnosticVFSVolumeError; -#define DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR desktop_agnostic_vfs_volume_error_quark () -struct _DesktopAgnosticVFSVolumeIface { - GTypeInterface parent_iface; - gboolean (*is_mounted) (DesktopAgnosticVFSVolume* self); - void (*mount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*mount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - void (*unmount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*unmount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - gboolean (*can_eject) (DesktopAgnosticVFSVolume* self); - void (*eject) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*eject_finish) (DesktopAgnosticVFSVolume* self, GError** error); - const char* (*get_name) (DesktopAgnosticVFSVolume* self); - DesktopAgnosticVFSFile* (*get_uri) (DesktopAgnosticVFSVolume* self); - char* (*get_icon) (DesktopAgnosticVFSVolume* self); -}; - -struct _DesktopAgnosticVFSVolumeMonitorIface { - GTypeInterface parent_iface; - void* (*get_implementation) (DesktopAgnosticVFSVolumeMonitor* self); - GList* (*get_volumes) (DesktopAgnosticVFSVolumeMonitor* self); -}; - -struct _DesktopAgnosticVFSImplementationIface { - GTypeInterface parent_iface; - void (*init) (DesktopAgnosticVFSImplementation* self); - GSList* (*files_from_uri_list) (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error); - DesktopAgnosticVFSVolumeMonitor* (*volume_monitor_get_default) (DesktopAgnosticVFSImplementation* self); - void (*shutdown) (DesktopAgnosticVFSImplementation* self); - const char* (*get_name) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_monitor_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_trash_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_volume_type) (DesktopAgnosticVFSImplementation* self); -}; - - -static gpointer desktop_agnostic_vfs_file_parent_class = NULL; - -GQuark desktop_agnostic_vfs_file_error_quark (void); -GType desktop_agnostic_vfs_file_type_get_type (void); -GType desktop_agnostic_vfs_access_flags_get_type (void); -GType desktop_agnostic_vfs_file_get_type (void); -GType desktop_agnostic_vfs_file_monitor_event_get_type (void); -GType desktop_agnostic_vfs_file_monitor_get_type (void); -enum { - DESKTOP_AGNOSTIC_VFS_FILE_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_FILE_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_FILE_IMPL_URI, - DESKTOP_AGNOSTIC_VFS_FILE_URI, - DESKTOP_AGNOSTIC_VFS_FILE_IMPL_PATH, - DESKTOP_AGNOSTIC_VFS_FILE_PATH, - DESKTOP_AGNOSTIC_VFS_FILE_FILE_TYPE, - DESKTOP_AGNOSTIC_VFS_FILE_ACCESS_FLAGS, - DESKTOP_AGNOSTIC_VFS_FILE_PARENT -}; -void desktop_agnostic_vfs_file_init (DesktopAgnosticVFSFile* self, const char* uri); -static void desktop_agnostic_vfs_file_real_init (DesktopAgnosticVFSFile* self, const char* uri); -gboolean desktop_agnostic_vfs_file_exists (DesktopAgnosticVFSFile* self); -static gboolean desktop_agnostic_vfs_file_real_exists (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_get_access_flags (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_is_readable (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_is_writable (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_is_executable (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_monitor (DesktopAgnosticVFSFile* self); -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_real_monitor (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_load_contents (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error); -static gboolean desktop_agnostic_vfs_file_real_load_contents (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error); -gboolean desktop_agnostic_vfs_file_replace_contents (DesktopAgnosticVFSFile* self, const char* contents, GError** error); -static gboolean desktop_agnostic_vfs_file_real_replace_contents (DesktopAgnosticVFSFile* self, const char* contents, GError** error); -gboolean desktop_agnostic_vfs_file_launch (DesktopAgnosticVFSFile* self, GError** error); -static gboolean desktop_agnostic_vfs_file_real_launch (DesktopAgnosticVFSFile* self, GError** error); -GSList* desktop_agnostic_vfs_file_enumerate_children (DesktopAgnosticVFSFile* self, GError** error); -static GSList* desktop_agnostic_vfs_file_real_enumerate_children (DesktopAgnosticVFSFile* self, GError** error); -gboolean desktop_agnostic_vfs_file_copy (DesktopAgnosticVFSFile* self, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); -static gboolean desktop_agnostic_vfs_file_real_copy (DesktopAgnosticVFSFile* self, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); -gboolean desktop_agnostic_vfs_file_remove (DesktopAgnosticVFSFile* self, GError** error); -static gboolean desktop_agnostic_vfs_file_real_remove (DesktopAgnosticVFSFile* self, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_construct (GType object_type); -void* desktop_agnostic_vfs_file_get_implementation (DesktopAgnosticVFSFile* self); -char* desktop_agnostic_vfs_file_get_impl_uri (DesktopAgnosticVFSFile* self); -char* desktop_agnostic_vfs_file_get_uri (DesktopAgnosticVFSFile* self); -static void desktop_agnostic_vfs_file_set_uri (DesktopAgnosticVFSFile* self, const char* value); -char* desktop_agnostic_vfs_file_get_impl_path (DesktopAgnosticVFSFile* self); -char* desktop_agnostic_vfs_file_get_path (DesktopAgnosticVFSFile* self); -static void desktop_agnostic_vfs_file_set_path (DesktopAgnosticVFSFile* self, const char* value); -DesktopAgnosticVFSFileType desktop_agnostic_vfs_file_get_file_type (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_get_parent (DesktopAgnosticVFSFile* self); -static void desktop_agnostic_vfs_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_file_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GQuark desktop_agnostic_vfs_volume_error_quark (void); -GType desktop_agnostic_vfs_volume_get_type (void); -GType desktop_agnostic_vfs_volume_monitor_get_type (void); -GType desktop_agnostic_vfs_implementation_get_type (void); -DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error); -GType desktop_agnostic_vfs_implementation_get_file_type (DesktopAgnosticVFSImplementation* self); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_path (const char* path, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_uri (const char* uri, GError** error); - - - -GQuark desktop_agnostic_vfs_file_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_vfs_file_error-quark"); -} - - - -GType desktop_agnostic_vfs_file_type_get_type (void) { - static GType desktop_agnostic_vfs_file_type_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_vfs_file_type_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN, "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN", "unknown"}, {DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR, "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR", "regular"}, {DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY, "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY", "directory"}, {DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK, "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK", "symbolic-link"}, {DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL, "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL", "special"}, {0, NULL, NULL}}; - desktop_agnostic_vfs_file_type_type_id = g_enum_register_static ("DesktopAgnosticVFSFileType", values); - } - return desktop_agnostic_vfs_file_type_type_id; -} - - - -GType desktop_agnostic_vfs_access_flags_get_type (void) { - static GType desktop_agnostic_vfs_access_flags_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_vfs_access_flags_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE, "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE", "none"}, {DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ, "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ", "read"}, {DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE, "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE", "write"}, {DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE, "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE", "execute"}, {0, NULL, NULL}}; - desktop_agnostic_vfs_access_flags_type_id = g_enum_register_static ("DesktopAgnosticVFSAccessFlags", values); - } - return desktop_agnostic_vfs_access_flags_type_id; -} - - -static void desktop_agnostic_vfs_file_real_init (DesktopAgnosticVFSFile* self, const char* uri) { - g_return_if_fail (self != NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_init'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return; -} - - -void desktop_agnostic_vfs_file_init (DesktopAgnosticVFSFile* self, const char* uri) { - DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->init (self, uri); -} - - -static gboolean desktop_agnostic_vfs_file_real_exists (DesktopAgnosticVFSFile* self) { - g_return_val_if_fail (self != NULL, FALSE); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_exists'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return FALSE; -} - - -gboolean desktop_agnostic_vfs_file_exists (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->exists (self); -} - - -gboolean desktop_agnostic_vfs_file_is_readable (DesktopAgnosticVFSFile* self) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - result = (desktop_agnostic_vfs_file_get_access_flags (self) & DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ) != 0; - return result; -} - - -gboolean desktop_agnostic_vfs_file_is_writable (DesktopAgnosticVFSFile* self) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - result = (desktop_agnostic_vfs_file_get_access_flags (self) & DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE) != 0; - return result; -} - - -gboolean desktop_agnostic_vfs_file_is_executable (DesktopAgnosticVFSFile* self) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - result = (desktop_agnostic_vfs_file_get_access_flags (self) & DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE) != 0; - return result; -} - - -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_real_monitor (DesktopAgnosticVFSFile* self) { - g_return_val_if_fail (self != NULL, NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_monitor'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return NULL; -} - - -DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_monitor (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->monitor (self); -} - - -static gboolean desktop_agnostic_vfs_file_real_load_contents (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error) { - g_return_val_if_fail (self != NULL, FALSE); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_load_contents'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return FALSE; -} - - -gboolean desktop_agnostic_vfs_file_load_contents (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->load_contents (self, contents, length, error); -} - - -static gboolean desktop_agnostic_vfs_file_real_replace_contents (DesktopAgnosticVFSFile* self, const char* contents, GError** error) { - g_return_val_if_fail (self != NULL, FALSE); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_replace_contents'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return FALSE; -} - - -gboolean desktop_agnostic_vfs_file_replace_contents (DesktopAgnosticVFSFile* self, const char* contents, GError** error) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->replace_contents (self, contents, error); -} - - -static gboolean desktop_agnostic_vfs_file_real_launch (DesktopAgnosticVFSFile* self, GError** error) { - g_return_val_if_fail (self != NULL, FALSE); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_launch'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return FALSE; -} - - -gboolean desktop_agnostic_vfs_file_launch (DesktopAgnosticVFSFile* self, GError** error) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->launch (self, error); -} - - -static GSList* desktop_agnostic_vfs_file_real_enumerate_children (DesktopAgnosticVFSFile* self, GError** error) { - g_return_val_if_fail (self != NULL, NULL); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_enumerate_children'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return NULL; -} - - -GSList* desktop_agnostic_vfs_file_enumerate_children (DesktopAgnosticVFSFile* self, GError** error) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->enumerate_children (self, error); -} - - -static gboolean desktop_agnostic_vfs_file_real_copy (DesktopAgnosticVFSFile* self, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error) { - g_return_val_if_fail (self != NULL, FALSE); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_copy'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return FALSE; -} - - -gboolean desktop_agnostic_vfs_file_copy (DesktopAgnosticVFSFile* self, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->copy (self, destination, overwrite, error); -} - - -static gboolean desktop_agnostic_vfs_file_real_remove (DesktopAgnosticVFSFile* self, GError** error) { - g_return_val_if_fail (self != NULL, FALSE); - g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_remove'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return FALSE; -} - - -gboolean desktop_agnostic_vfs_file_remove (DesktopAgnosticVFSFile* self, GError** error) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->remove (self, error); -} - - -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_construct (GType object_type) { - DesktopAgnosticVFSFile * self; - self = (DesktopAgnosticVFSFile*) g_object_new (object_type, NULL); - return self; -} - - -void* desktop_agnostic_vfs_file_get_implementation (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_implementation (self); -} - - -char* desktop_agnostic_vfs_file_get_impl_uri (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_impl_uri (self); -} - - -char* desktop_agnostic_vfs_file_get_uri (DesktopAgnosticVFSFile* self) { - char* result; - g_return_val_if_fail (self != NULL, NULL); - result = desktop_agnostic_vfs_file_get_impl_uri (self); - return result; -} - - -static void desktop_agnostic_vfs_file_set_uri (DesktopAgnosticVFSFile* self, const char* value) { - g_return_if_fail (self != NULL); - if (value != NULL) { - desktop_agnostic_vfs_file_init (self, value); - } - g_object_notify ((GObject *) self, "uri"); -} - - -char* desktop_agnostic_vfs_file_get_impl_path (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_impl_path (self); -} - - -char* desktop_agnostic_vfs_file_get_path (DesktopAgnosticVFSFile* self) { - char* result; - g_return_val_if_fail (self != NULL, NULL); - result = desktop_agnostic_vfs_file_get_impl_path (self); - return result; -} - - -static void desktop_agnostic_vfs_file_set_path (DesktopAgnosticVFSFile* self, const char* value) { - g_return_if_fail (self != NULL); - if (value != NULL) { - char* _tmp0_; - desktop_agnostic_vfs_file_init (self, _tmp0_ = g_strconcat ("file://", value, NULL)); - _g_free0 (_tmp0_); - } - g_object_notify ((GObject *) self, "path"); -} - - -DesktopAgnosticVFSFileType desktop_agnostic_vfs_file_get_file_type (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_file_type (self); -} - - -DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_get_access_flags (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_access_flags (self); -} - - -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_get_parent (DesktopAgnosticVFSFile* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_parent (self); -} - - -static void desktop_agnostic_vfs_file_class_init (DesktopAgnosticVFSFileClass * klass) { - desktop_agnostic_vfs_file_parent_class = g_type_class_peek_parent (klass); - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->init = desktop_agnostic_vfs_file_real_init; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->exists = desktop_agnostic_vfs_file_real_exists; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->monitor = desktop_agnostic_vfs_file_real_monitor; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->load_contents = desktop_agnostic_vfs_file_real_load_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->replace_contents = desktop_agnostic_vfs_file_real_replace_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->launch = desktop_agnostic_vfs_file_real_launch; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->enumerate_children = desktop_agnostic_vfs_file_real_enumerate_children; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->copy = desktop_agnostic_vfs_file_real_copy; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->remove = desktop_agnostic_vfs_file_real_remove; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_file_set_property; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_IMPLEMENTATION, g_param_spec_pointer ("implementation", "implementation", "implementation", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_IMPL_URI, g_param_spec_string ("impl-uri", "impl-uri", "impl-uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_URI, g_param_spec_string ("uri", "uri", "uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_IMPL_PATH, g_param_spec_string ("impl-path", "impl-path", "impl-path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_PATH, g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_FILE_TYPE, g_param_spec_enum ("file-type", "file-type", "file-type", DESKTOP_AGNOSTIC_VFS_TYPE_FILE_TYPE, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_ACCESS_FLAGS, g_param_spec_enum ("access-flags", "access-flags", "access-flags", DESKTOP_AGNOSTIC_VFS_TYPE_ACCESS_FLAGS, DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_PARENT, g_param_spec_object ("parent", "parent", "parent", DESKTOP_AGNOSTIC_VFS_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -} - - -static void desktop_agnostic_vfs_file_instance_init (DesktopAgnosticVFSFile * self) { -} - - -GType desktop_agnostic_vfs_file_get_type (void) { - static GType desktop_agnostic_vfs_file_type_id = 0; - if (desktop_agnostic_vfs_file_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSFile), 0, (GInstanceInitFunc) desktop_agnostic_vfs_file_instance_init, NULL }; - desktop_agnostic_vfs_file_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSFile", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); - } - return desktop_agnostic_vfs_file_type_id; -} - - -static void desktop_agnostic_vfs_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFile * self; - self = DESKTOP_AGNOSTIC_VFS_FILE (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_URI: - g_value_set_string (value, desktop_agnostic_vfs_file_get_uri (self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_PATH: - g_value_set_string (value, desktop_agnostic_vfs_file_get_path (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_file_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFile * self; - self = DESKTOP_AGNOSTIC_VFS_FILE (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_URI: - desktop_agnostic_vfs_file_set_uri (self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_PATH: - desktop_agnostic_vfs_file_set_path (self, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_path (const char* path, GError** error) { - DesktopAgnosticVFSFile* result; - GError * _inner_error_; - DesktopAgnosticVFSImplementation* vfs; - g_return_val_if_fail (path != NULL, NULL); - _inner_error_ = NULL; - vfs = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (vfs == NULL) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_VFS_FILE (g_object_new (desktop_agnostic_vfs_implementation_get_file_type (vfs), "path", path, NULL)); - return result; - } -} - - -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_uri (const char* uri, GError** error) { - DesktopAgnosticVFSFile* result; - GError * _inner_error_; - DesktopAgnosticVFSImplementation* vfs; - g_return_val_if_fail (uri != NULL, NULL); - _inner_error_ = NULL; - vfs = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (vfs == NULL) { - result = NULL; - return result; - } else { - result = DESKTOP_AGNOSTIC_VFS_FILE (g_object_new (desktop_agnostic_vfs_implementation_get_file_type (vfs), "uri", uri, NULL)); - return result; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-impl-gio.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-impl-gio.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-impl-gio.c 2010-04-11 07:32:16.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-impl-gio.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,642 +0,0 @@ -/* vfs-file-impl-gio.c generated by valac, the Vala compiler - * generated from vfs-file-impl-gio.vala, do not modify */ - -/* - * Desktop Agnostic Library: File implementation (with GIO). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO (desktop_agnostic_vfs_file_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) - -typedef struct _DesktopAgnosticVFSFileGIO DesktopAgnosticVFSFileGIO; -typedef struct _DesktopAgnosticVFSFileGIOClass DesktopAgnosticVFSFileGIOClass; -typedef struct _DesktopAgnosticVFSFileGIOPrivate DesktopAgnosticVFSFileGIOPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO (desktop_agnostic_vfs_file_monitor_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGIO DesktopAgnosticVFSFileMonitorGIO; -typedef struct _DesktopAgnosticVFSFileMonitorGIOClass DesktopAgnosticVFSFileMonitorGIOClass; -#define __g_list_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_unref (var), NULL))) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -struct _DesktopAgnosticVFSFileGIO { - DesktopAgnosticVFSFile parent_instance; - DesktopAgnosticVFSFileGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileGIOClass { - DesktopAgnosticVFSFileClass parent_class; -}; - -struct _DesktopAgnosticVFSFileGIOPrivate { - GFile* _file; - char* _uri; -}; - - -static gpointer desktop_agnostic_vfs_file_gio_parent_class = NULL; - -GType desktop_agnostic_vfs_file_gio_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_FILE_GIO_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPL_PATH, - DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPL_URI, - DESKTOP_AGNOSTIC_VFS_FILE_GIO_FILE_TYPE, - DESKTOP_AGNOSTIC_VFS_FILE_GIO_ACCESS_FLAGS, - DESKTOP_AGNOSTIC_VFS_FILE_GIO_PARENT -}; -static void desktop_agnostic_vfs_file_gio_real_init (DesktopAgnosticVFSFile* base, const char* uri); -static gboolean desktop_agnostic_vfs_file_gio_real_exists (DesktopAgnosticVFSFile* base); -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_new (DesktopAgnosticVFSFileGIO* file); -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_construct (GType object_type, DesktopAgnosticVFSFileGIO* file); -GType desktop_agnostic_vfs_file_monitor_gio_get_type (void); -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_gio_real_monitor (DesktopAgnosticVFSFile* base); -static gboolean desktop_agnostic_vfs_file_gio_real_load_contents (DesktopAgnosticVFSFile* base, char** contents, gsize* length, GError** error); -static gboolean desktop_agnostic_vfs_file_gio_real_replace_contents (DesktopAgnosticVFSFile* base, const char* contents, GError** error); -static void _g_list_free_g_object_unref (GList* self); -static gboolean desktop_agnostic_vfs_file_gio_real_launch (DesktopAgnosticVFSFile* base, GError** error); -static void _g_slist_free_g_object_unref (GSList* self); -static GSList* desktop_agnostic_vfs_file_gio_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error); -static gboolean desktop_agnostic_vfs_file_gio_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); -static gboolean desktop_agnostic_vfs_file_gio_real_remove (DesktopAgnosticVFSFile* base, GError** error); -DesktopAgnosticVFSFileGIO* desktop_agnostic_vfs_file_gio_new (void); -DesktopAgnosticVFSFileGIO* desktop_agnostic_vfs_file_gio_construct (GType object_type); -static void desktop_agnostic_vfs_file_gio_finalize (GObject* obj); -static void desktop_agnostic_vfs_file_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static void desktop_agnostic_vfs_file_gio_real_init (DesktopAgnosticVFSFile* base, const char* uri) { - DesktopAgnosticVFSFileGIO * self; - GFile* _tmp0_; - self = (DesktopAgnosticVFSFileGIO*) base; - g_return_if_fail (uri != NULL); - self->priv->_file = (_tmp0_ = g_file_new_for_uri (uri), _g_object_unref0 (self->priv->_file), _tmp0_); -} - - -static gboolean desktop_agnostic_vfs_file_gio_real_exists (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileGIO * self; - gboolean result; - self = (DesktopAgnosticVFSFileGIO*) base; - result = g_file_query_exists (self->priv->_file, NULL); - return result; -} - - -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_gio_real_monitor (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileGIO * self; - DesktopAgnosticVFSFileMonitor* result; - self = (DesktopAgnosticVFSFileGIO*) base; - result = (DesktopAgnosticVFSFileMonitor*) desktop_agnostic_vfs_file_monitor_gio_new (self); - return result; -} - - -static gboolean desktop_agnostic_vfs_file_gio_real_load_contents (DesktopAgnosticVFSFile* base, char** contents, gsize* length, GError** error) { - DesktopAgnosticVFSFileGIO * self; - gboolean result; - GError * _inner_error_; - char* _tmp2_; - gboolean _tmp1_; - char* _tmp0_ = NULL; - gboolean _tmp3_; - self = (DesktopAgnosticVFSFileGIO*) base; - if (contents != NULL) { - *contents = NULL; - } - _inner_error_ = NULL; - _tmp3_ = (_tmp1_ = g_file_load_contents (self->priv->_file, NULL, &_tmp0_, length, NULL, &_inner_error_), *contents = (_tmp2_ = _tmp0_, _g_free0 (*contents), _tmp2_), _tmp1_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - result = _tmp3_; - return result; -} - - -static gboolean desktop_agnostic_vfs_file_gio_real_replace_contents (DesktopAgnosticVFSFile* base, const char* contents, GError** error) { - DesktopAgnosticVFSFileGIO * self; - gboolean result; - GError * _inner_error_; - gboolean _tmp0_; - self = (DesktopAgnosticVFSFileGIO*) base; - g_return_val_if_fail (contents != NULL, FALSE); - _inner_error_ = NULL; - _tmp0_ = g_file_replace_contents (self->priv->_file, contents, strlen (contents), NULL, FALSE, 0, NULL, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - result = _tmp0_; - return result; -} - - -static void _g_list_free_g_object_unref (GList* self) { - g_list_foreach (self, (GFunc) g_object_unref, NULL); - g_list_free (self); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static gboolean desktop_agnostic_vfs_file_gio_real_launch (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileGIO * self; - gboolean result; - GError * _inner_error_; - GAppInfo* app_info; - GList* files; - GAppInfo* _tmp0_; - GAppInfo* _tmp1_; - gboolean _tmp2_; - self = (DesktopAgnosticVFSFileGIO*) base; - _inner_error_ = NULL; - app_info = NULL; - files = NULL; - _tmp0_ = g_file_query_default_handler (self->priv->_file, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (app_info); - __g_list_free_g_object_unref0 (files); - return FALSE; - } - app_info = (_tmp1_ = _tmp0_, _g_object_unref0 (app_info), _tmp1_); - files = g_list_append (files, _g_object_ref0 (self->priv->_file)); - _tmp2_ = g_app_info_launch (app_info, files, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (app_info); - __g_list_free_g_object_unref0 (files); - return FALSE; - } - result = _tmp2_; - _g_object_unref0 (app_info); - __g_list_free_g_object_unref0 (files); - return result; -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static GSList* desktop_agnostic_vfs_file_gio_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileGIO * self; - GSList* result; - GError * _inner_error_; - GSList* children; - GFileEnumerator* enumerator; - GFileInfo* info; - GSList* _tmp0_; - GFileEnumerator* _tmp1_; - GFileEnumerator* _tmp2_; - self = (DesktopAgnosticVFSFileGIO*) base; - _inner_error_ = NULL; - children = NULL; - enumerator = NULL; - info = NULL; - children = (_tmp0_ = NULL, __g_slist_free_g_object_unref0 (children), _tmp0_); - _tmp1_ = g_file_enumerate_children (self->priv->_file, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NONE, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (children); - _g_object_unref0 (enumerator); - _g_object_unref0 (info); - return NULL; - } - enumerator = (_tmp2_ = _tmp1_, _g_object_unref0 (enumerator), _tmp2_); - while (TRUE) { - GFileInfo* _tmp3_; - GFileInfo* _tmp4_; - GFile* gchild; - DesktopAgnosticVFSFile* child; - GFile* _tmp5_; - char* _tmp6_; - DesktopAgnosticVFSFile* _tmp7_; - DesktopAgnosticVFSFile* _tmp8_; - DesktopAgnosticVFSFile* _tmp9_; - DesktopAgnosticVFSFile* _tmp10_; - _tmp3_ = g_file_enumerator_next_file (enumerator, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (children); - _g_object_unref0 (enumerator); - _g_object_unref0 (info); - return NULL; - } - if (!((info = (_tmp4_ = _tmp3_, _g_object_unref0 (info), _tmp4_)) != NULL)) { - break; - } - gchild = NULL; - child = NULL; - gchild = (_tmp5_ = g_file_get_child (self->priv->_file, g_file_info_get_name (info)), _g_object_unref0 (gchild), _tmp5_); - _tmp8_ = (_tmp7_ = desktop_agnostic_vfs_file_new_for_uri (_tmp6_ = g_file_get_uri (gchild), &_inner_error_), _g_free0 (_tmp6_), _tmp7_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (gchild); - _g_object_unref0 (child); - __g_slist_free_g_object_unref0 (children); - _g_object_unref0 (enumerator); - _g_object_unref0 (info); - return NULL; - } - child = (_tmp9_ = _tmp8_, _g_object_unref0 (child), _tmp9_); - children = g_slist_append (children, (_tmp10_ = child, child = NULL, _tmp10_)); - _g_object_unref0 (gchild); - _g_object_unref0 (child); - } - result = children; - _g_object_unref0 (enumerator); - _g_object_unref0 (info); - return result; -} - - -static gboolean desktop_agnostic_vfs_file_gio_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error) { - DesktopAgnosticVFSFileGIO * self; - gboolean result; - GError * _inner_error_; - GFileCopyFlags flags; - gboolean _tmp0_; - self = (DesktopAgnosticVFSFileGIO*) base; - g_return_val_if_fail (destination != NULL, FALSE); - _inner_error_ = NULL; - flags = 0; - if (overwrite) { - flags = G_FILE_COPY_OVERWRITE; - } - _tmp0_ = g_file_copy (self->priv->_file, G_FILE (desktop_agnostic_vfs_file_get_implementation (destination)), flags, NULL, NULL, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - result = _tmp0_; - return result; -} - - -static gboolean desktop_agnostic_vfs_file_gio_real_remove (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileGIO * self; - gboolean result; - GError * _inner_error_; - gboolean _tmp2_; - self = (DesktopAgnosticVFSFileGIO*) base; - _inner_error_ = NULL; - if (!desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - char* _tmp0_; - GError* _tmp1_; - _inner_error_ = (_tmp1_ = g_error_new (DESKTOP_AGNOSTIC_VFS_FILE_ERROR, DESKTOP_AGNOSTIC_VFS_FILE_ERROR_FILE_NOT_FOUND, "The file '%s' does not exist.", _tmp0_ = desktop_agnostic_vfs_file_get_uri ((DesktopAgnosticVFSFile*) self)), _g_free0 (_tmp0_), _tmp1_); - { - g_propagate_error (error, _inner_error_); - return FALSE; - } - } - _tmp2_ = g_file_delete (self->priv->_file, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - result = _tmp2_; - return result; -} - - -DesktopAgnosticVFSFileGIO* desktop_agnostic_vfs_file_gio_construct (GType object_type) { - DesktopAgnosticVFSFileGIO * self; - self = (DesktopAgnosticVFSFileGIO*) desktop_agnostic_vfs_file_construct (object_type); - return self; -} - - -DesktopAgnosticVFSFileGIO* desktop_agnostic_vfs_file_gio_new (void) { - return desktop_agnostic_vfs_file_gio_construct (DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO); -} - - -static void* desktop_agnostic_vfs_file_gio_real_get_implementation (DesktopAgnosticVFSFile* base) { - void* result; - DesktopAgnosticVFSFileGIO* self; - self = (DesktopAgnosticVFSFileGIO*) base; - result = (void*) self->priv->_file; - return result; -} - - -static char* desktop_agnostic_vfs_file_gio_real_get_impl_path (DesktopAgnosticVFSFile* base) { - char* result; - DesktopAgnosticVFSFileGIO* self; - self = (DesktopAgnosticVFSFileGIO*) base; - result = g_file_get_path (self->priv->_file); - return result; -} - - -static char* desktop_agnostic_vfs_file_gio_real_get_impl_uri (DesktopAgnosticVFSFile* base) { - char* result; - DesktopAgnosticVFSFileGIO* self; - self = (DesktopAgnosticVFSFileGIO*) base; - if (self->priv->_uri == NULL) { - char* _tmp0_; - self->priv->_uri = (_tmp0_ = g_file_get_uri (self->priv->_file), _g_free0 (self->priv->_uri), _tmp0_); - } - result = g_strdup (self->priv->_uri); - return result; -} - - -static DesktopAgnosticVFSFileType desktop_agnostic_vfs_file_gio_real_get_file_type (DesktopAgnosticVFSFile* base) { - GError * _inner_error_; - DesktopAgnosticVFSFileType result; - DesktopAgnosticVFSFileGIO* self; - DesktopAgnosticVFSFileType ft; - _inner_error_ = NULL; - self = (DesktopAgnosticVFSFileGIO*) base; - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; - if (desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - GFileInfo* info; - GFileType gft = 0; - info = NULL; - { - GFileInfo* _tmp0_; - GFileInfo* _tmp1_; - _tmp0_ = g_file_query_info (self->priv->_file, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - info = (_tmp1_ = _tmp0_, _g_object_unref0 (info), _tmp1_); - gft = (GFileType) g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE); - switch (gft) { - case G_FILE_TYPE_REGULAR: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR; - break; - } - case G_FILE_TYPE_DIRECTORY: - case G_FILE_TYPE_MOUNTABLE: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY; - break; - } - case G_FILE_TYPE_SYMBOLIC_LINK: - case G_FILE_TYPE_SHORTCUT: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK; - break; - } - case G_FILE_TYPE_SPECIAL: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL; - break; - } - case G_FILE_TYPE_UNKNOWN: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; - break; - } - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("vfs-file-impl-gio.vala:94: An error occurred while querying the file type: %s", err->message); - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_object_unref0 (info); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - _g_object_unref0 (info); - } - result = ft; - return result; -} - - -static DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_gio_real_get_access_flags (DesktopAgnosticVFSFile* base) { - GError * _inner_error_; - DesktopAgnosticVFSAccessFlags result; - DesktopAgnosticVFSFileGIO* self; - DesktopAgnosticVFSAccessFlags flags; - _inner_error_ = NULL; - self = (DesktopAgnosticVFSFileGIO*) base; - flags = DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE; - if (desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - GFileInfo* info; - info = NULL; - { - char* attrs; - char* _tmp0_; - GFileInfo* _tmp1_; - GFileInfo* _tmp2_; - attrs = NULL; - attrs = (_tmp0_ = g_strdup_printf ("%s,%s,%s", G_FILE_ATTRIBUTE_ACCESS_CAN_READ, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE), _g_free0 (attrs), _tmp0_); - _tmp1_ = g_file_query_info (self->priv->_file, attrs, G_FILE_QUERY_INFO_NONE, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (attrs); - goto __catch1_g_error; - } - info = (_tmp2_ = _tmp1_, _g_object_unref0 (info), _tmp2_); - if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ)) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ; - } - if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE; - } - if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE)) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE; - } - _g_free0 (attrs); - } - goto __finally1; - __catch1_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("vfs-file-impl-gio.vala:135: An error occurred while querying the access flags: %s", err->message); - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - _g_object_unref0 (info); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - _g_object_unref0 (info); - } - result = flags; - return result; -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_gio_real_get_parent (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFile* result; - DesktopAgnosticVFSFileGIO* self; - GFile* file; - GFile* _tmp0_; - self = (DesktopAgnosticVFSFileGIO*) base; - file = NULL; - file = (_tmp0_ = g_file_get_parent (self->priv->_file), _g_object_unref0 (file), _tmp0_); - if (file == NULL) { - result = NULL; - _g_object_unref0 (file); - return result; - } else { - DesktopAgnosticVFSFile* _result_; - DesktopAgnosticVFSFile* _tmp1_; - char* _tmp2_; - _result_ = NULL; - _result_ = (_tmp1_ = (DesktopAgnosticVFSFile*) desktop_agnostic_vfs_file_gio_new (), _g_object_unref0 (_result_), _tmp1_); - desktop_agnostic_vfs_file_init (_result_, _tmp2_ = g_file_get_uri (file)); - _g_free0 (_tmp2_); - result = _result_; - _g_object_unref0 (file); - return result; - } - _g_object_unref0 (file); -} - - -static void desktop_agnostic_vfs_file_gio_class_init (DesktopAgnosticVFSFileGIOClass * klass) { - desktop_agnostic_vfs_file_gio_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSFileGIOPrivate)); - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->init = desktop_agnostic_vfs_file_gio_real_init; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->exists = desktop_agnostic_vfs_file_gio_real_exists; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->monitor = desktop_agnostic_vfs_file_gio_real_monitor; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->load_contents = desktop_agnostic_vfs_file_gio_real_load_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->replace_contents = desktop_agnostic_vfs_file_gio_real_replace_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->launch = desktop_agnostic_vfs_file_gio_real_launch; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->enumerate_children = desktop_agnostic_vfs_file_gio_real_enumerate_children; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->copy = desktop_agnostic_vfs_file_gio_real_copy; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->remove = desktop_agnostic_vfs_file_gio_real_remove; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_implementation = desktop_agnostic_vfs_file_gio_real_get_implementation; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_impl_path = desktop_agnostic_vfs_file_gio_real_get_impl_path; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_impl_uri = desktop_agnostic_vfs_file_gio_real_get_impl_uri; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_file_type = desktop_agnostic_vfs_file_gio_real_get_file_type; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_access_flags = desktop_agnostic_vfs_file_gio_real_get_access_flags; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_parent = desktop_agnostic_vfs_file_gio_real_get_parent; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_gio_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_file_gio_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPLEMENTATION, "implementation"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPL_PATH, "impl-path"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPL_URI, "impl-uri"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GIO_FILE_TYPE, "file-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GIO_ACCESS_FLAGS, "access-flags"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GIO_PARENT, "parent"); -} - - -static void desktop_agnostic_vfs_file_gio_instance_init (DesktopAgnosticVFSFileGIO * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_FILE_GIO_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_file_gio_finalize (GObject* obj) { - DesktopAgnosticVFSFileGIO * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_GIO (obj); - _g_object_unref0 (self->priv->_file); - _g_free0 (self->priv->_uri); - G_OBJECT_CLASS (desktop_agnostic_vfs_file_gio_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_file_gio_get_type (void) { - static GType desktop_agnostic_vfs_file_gio_type_id = 0; - if (desktop_agnostic_vfs_file_gio_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileGIOClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_file_gio_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSFileGIO), 0, (GInstanceInitFunc) desktop_agnostic_vfs_file_gio_instance_init, NULL }; - desktop_agnostic_vfs_file_gio_type_id = g_type_register_static (DESKTOP_AGNOSTIC_VFS_TYPE_FILE, "DesktopAgnosticVFSFileGIO", &g_define_type_info, 0); - } - return desktop_agnostic_vfs_file_gio_type_id; -} - - -static void desktop_agnostic_vfs_file_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFileGIO * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_GIO (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPLEMENTATION: - g_value_set_pointer (value, desktop_agnostic_vfs_file_get_implementation ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPL_PATH: - g_value_set_string (value, desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPL_URI: - g_value_set_string (value, desktop_agnostic_vfs_file_get_impl_uri ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GIO_FILE_TYPE: - g_value_set_enum (value, desktop_agnostic_vfs_file_get_file_type ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GIO_ACCESS_FLAGS: - g_value_set_enum (value, desktop_agnostic_vfs_file_get_access_flags ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GIO_PARENT: - g_value_set_object (value, desktop_agnostic_vfs_file_get_parent ((DesktopAgnosticVFSFile*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-impl-gnome-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-impl-gnome-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-impl-gnome-vfs.c 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-impl-gnome-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,683 +0,0 @@ -/* vfs-file-impl-gnome-vfs.c generated by valac, the Vala compiler - * generated from vfs-file-impl-gnome-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: File implementation (with GNOME VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS (desktop_agnostic_vfs_file_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileGnomeVFS DesktopAgnosticVFSFileGnomeVFS; -typedef struct _DesktopAgnosticVFSFileGnomeVFSClass DesktopAgnosticVFSFileGnomeVFSClass; -typedef struct _DesktopAgnosticVFSFileGnomeVFSPrivate DesktopAgnosticVFSFileGnomeVFSPrivate; -#define _gnome_vfs_uri_unref0(var) ((var == NULL) ? NULL : (var = (gnome_vfs_uri_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS (desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFS DesktopAgnosticVFSFileMonitorGnomeVFS; -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFSClass DesktopAgnosticVFSFileMonitorGnomeVFSClass; -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _gnome_vfs_file_info_unref0(var) ((var == NULL) ? NULL : (var = (gnome_vfs_file_info_unref (var), NULL))) -#define __g_list_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_free (var), NULL))) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -struct _DesktopAgnosticVFSFileGnomeVFS { - DesktopAgnosticVFSFile parent_instance; - DesktopAgnosticVFSFileGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileGnomeVFSClass { - DesktopAgnosticVFSFileClass parent_class; -}; - -struct _DesktopAgnosticVFSFileGnomeVFSPrivate { - GnomeVFSURI* _uri; - char* _uri_str; -}; - - -static gpointer desktop_agnostic_vfs_file_gnome_vfs_parent_class = NULL; - -GType desktop_agnostic_vfs_file_gnome_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPL_URI, - DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPL_PATH, - DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_FILE_TYPE, - DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_ACCESS_FLAGS, - DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_PARENT -}; -static void desktop_agnostic_vfs_file_gnome_vfs_real_init (DesktopAgnosticVFSFile* base, const char* uri); -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_exists (DesktopAgnosticVFSFile* base); -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_new (DesktopAgnosticVFSFileGnomeVFS* file); -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_construct (GType object_type, DesktopAgnosticVFSFileGnomeVFS* file); -GType desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type (void); -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_gnome_vfs_real_monitor (DesktopAgnosticVFSFile* base); -static gboolean desktop_agnostic_vfs_file_gnome_vfs_handle_error (DesktopAgnosticVFSFileGnomeVFS* self, GnomeVFSResult res, GError** error); -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_load_contents (DesktopAgnosticVFSFile* base, char** contents, gsize* length, GError** error); -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_replace_contents (DesktopAgnosticVFSFile* base, const char* contents, GError** error); -static void _g_list_free_g_free (GList* self); -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_launch (DesktopAgnosticVFSFile* base, GError** error); -static void _g_slist_free_g_object_unref (GSList* self); -static GSList* desktop_agnostic_vfs_file_gnome_vfs_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error); -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_remove (DesktopAgnosticVFSFile* base, GError** error); -DesktopAgnosticVFSFileGnomeVFS* desktop_agnostic_vfs_file_gnome_vfs_new (void); -DesktopAgnosticVFSFileGnomeVFS* desktop_agnostic_vfs_file_gnome_vfs_construct (GType object_type); -static void desktop_agnostic_vfs_file_gnome_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_file_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -static void desktop_agnostic_vfs_file_gnome_vfs_real_init (DesktopAgnosticVFSFile* base, const char* uri) { - DesktopAgnosticVFSFileGnomeVFS * self; - char* _tmp0_; - GnomeVFSURI* _tmp1_; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - g_return_if_fail (uri != NULL); - self->priv->_uri_str = (_tmp0_ = g_strdup (uri), _g_free0 (self->priv->_uri_str), _tmp0_); - self->priv->_uri = (_tmp1_ = gnome_vfs_uri_new (uri), _gnome_vfs_uri_unref0 (self->priv->_uri), _tmp1_); -} - - -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_exists (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileGnomeVFS * self; - gboolean result; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - result = gnome_vfs_uri_exists (self->priv->_uri); - return result; -} - - -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_gnome_vfs_real_monitor (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileGnomeVFS * self; - DesktopAgnosticVFSFileMonitor* result; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - result = (DesktopAgnosticVFSFileMonitor*) desktop_agnostic_vfs_file_monitor_gnome_vfs_new (self); - return result; -} - - -static gpointer _g_error_copy0 (gpointer self) { - return self ? g_error_copy (self) : NULL; -} - - -static gboolean desktop_agnostic_vfs_file_gnome_vfs_handle_error (DesktopAgnosticVFSFileGnomeVFS* self, GnomeVFSResult res, GError** error) { - gboolean result; - GError * _inner_error_; - g_return_val_if_fail (self != NULL, FALSE); - _inner_error_ = NULL; - if (res == GNOME_VFS_OK) { - result = FALSE; - return result; - } else { - GError* err; - err = (GError*) g_error_new (g_quark_from_string ("Gnome.VFS"), 0, gnome_vfs_result_to_string (res), NULL); - _inner_error_ = _g_error_copy0 (err); - { - g_propagate_error (error, _inner_error_); - _g_error_free0 (err); - return FALSE; - } - _g_error_free0 (err); - } -} - - -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_load_contents (DesktopAgnosticVFSFile* base, char** contents, gsize* length, GError** error) { - DesktopAgnosticVFSFileGnomeVFS * self; - gboolean result; - GError * _inner_error_; - GnomeVFSFileInfo* info; - GnomeVFSResult res = 0; - GnomeVFSHandle* handle; - gint buffer_size; - gint buffer_length1; - gchar* buffer; - GnomeVFSFileInfo* _tmp0_; - gboolean _tmp1_; - gboolean _tmp2_; - gchar* _tmp3_; - gboolean _tmp4_; - char* _tmp5_; - gboolean _tmp6_; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - if (contents != NULL) { - *contents = NULL; - } - _inner_error_ = NULL; - info = NULL; - handle = NULL; - buffer = (buffer_length1 = 0, NULL); - info = (_tmp0_ = gnome_vfs_file_info_new (), _gnome_vfs_file_info_unref0 (info), _tmp0_); - res = gnome_vfs_get_file_info_uri (self->priv->_uri, info, GNOME_VFS_FILE_INFO_DEFAULT); - _tmp1_ = desktop_agnostic_vfs_file_gnome_vfs_handle_error (self, res, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return FALSE; - } - if (_tmp1_) { - result = FALSE; - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return result; - } - res = gnome_vfs_open_uri (&handle, self->priv->_uri, GNOME_VFS_OPEN_READ); - _tmp2_ = desktop_agnostic_vfs_file_gnome_vfs_handle_error (self, res, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return FALSE; - } - if (_tmp2_) { - result = FALSE; - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return result; - } - buffer = (_tmp3_ = g_new0 (gchar, (gint) info->size), buffer = (g_free (buffer), NULL), buffer_length1 = (gint) info->size, buffer_size = buffer_length1, _tmp3_); - res = gnome_vfs_read (handle, (void*) buffer, info->size, NULL); - _tmp4_ = desktop_agnostic_vfs_file_gnome_vfs_handle_error (self, res, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return FALSE; - } - if (_tmp4_) { - result = FALSE; - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return result; - } - *contents = (_tmp5_ = g_strdup ((const char*) buffer), _g_free0 (*contents), _tmp5_); - res = gnome_vfs_close (handle); - _tmp6_ = desktop_agnostic_vfs_file_gnome_vfs_handle_error (self, res, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return FALSE; - } - if (_tmp6_) { - result = FALSE; - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return result; - } - result = TRUE; - _gnome_vfs_file_info_unref0 (info); - buffer = (g_free (buffer), NULL); - return result; -} - - -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_replace_contents (DesktopAgnosticVFSFile* base, const char* contents, GError** error) { - DesktopAgnosticVFSFileGnomeVFS * self; - gboolean result; - GError * _inner_error_; - GnomeVFSResult res = 0; - GnomeVFSHandle* handle; - gboolean _tmp0_; - gboolean _tmp1_; - gboolean _tmp2_; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - g_return_val_if_fail (contents != NULL, FALSE); - _inner_error_ = NULL; - handle = NULL; - if (desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - res = gnome_vfs_open_uri (&handle, self->priv->_uri, GNOME_VFS_OPEN_WRITE); - } else { - res = gnome_vfs_create_uri (&handle, self->priv->_uri, GNOME_VFS_OPEN_WRITE, TRUE, (guint) 0644); - } - _tmp0_ = desktop_agnostic_vfs_file_gnome_vfs_handle_error (self, res, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - if (_tmp0_) { - result = FALSE; - return result; - } - res = gnome_vfs_write (handle, (void*) contents, (GnomeVFSFileSize) strlen (contents), NULL); - _tmp1_ = desktop_agnostic_vfs_file_gnome_vfs_handle_error (self, res, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - if (_tmp1_) { - result = FALSE; - return result; - } - res = gnome_vfs_close (handle); - _tmp2_ = desktop_agnostic_vfs_file_gnome_vfs_handle_error (self, res, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - if (_tmp2_) { - result = FALSE; - return result; - } - result = TRUE; - return result; -} - - -static void _g_list_free_g_free (GList* self) { - g_list_foreach (self, (GFunc) g_free, NULL); - g_list_free (self); -} - - -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_launch (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileGnomeVFS * self; - gboolean result; - GnomeVFSFileInfo* info; - GnomeVFSMimeApplication* mime_app; - GList* uris; - GnomeVFSFileInfo* _tmp0_; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - info = NULL; - mime_app = NULL; - uris = NULL; - info = (_tmp0_ = gnome_vfs_file_info_new (), _gnome_vfs_file_info_unref0 (info), _tmp0_); - gnome_vfs_get_file_info_uri (self->priv->_uri, info, GNOME_VFS_FILE_INFO_GET_MIME_TYPE); - mime_app = gnome_vfs_mime_get_default_application_for_uri (self->priv->_uri_str, info->mime_type); - uris = g_list_append (uris, g_strdup (self->priv->_uri_str)); - result = gnome_vfs_mime_application_launch (mime_app, uris) == GNOME_VFS_OK; - _gnome_vfs_file_info_unref0 (info); - __g_list_free_g_free0 (uris); - return result; -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static GSList* desktop_agnostic_vfs_file_gnome_vfs_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileGnomeVFS * self; - GSList* result; - GError * _inner_error_; - GSList* _result_; - GnomeVFSDirectoryHandle* dir; - GnomeVFSResult res = 0; - GSList* _tmp0_; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - _inner_error_ = NULL; - _result_ = NULL; - dir = NULL; - _result_ = (_tmp0_ = NULL, __g_slist_free_g_object_unref0 (_result_), _tmp0_); - res = gnome_vfs_directory_open_from_uri (&dir, self->priv->_uri, GNOME_VFS_FILE_INFO_NAME_ONLY); - if (res == GNOME_VFS_OK) { - GnomeVFSFileInfo* file_info; - file_info = gnome_vfs_file_info_new (); - while (TRUE) { - gboolean _tmp1_ = FALSE; - if (!((res = gnome_vfs_directory_read_next (dir, file_info)) == GNOME_VFS_OK)) { - break; - } - if (_vala_strcmp0 (file_info->name, ".") != 0) { - _tmp1_ = _vala_strcmp0 (file_info->name, "..") != 0; - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - char* full_uri; - DesktopAgnosticVFSFile* child; - char* _tmp2_; - DesktopAgnosticVFSFile* _tmp3_; - DesktopAgnosticVFSFile* _tmp4_; - DesktopAgnosticVFSFile* _tmp5_; - full_uri = NULL; - child = NULL; - full_uri = (_tmp2_ = g_strdup_printf ("%s/%s", self->priv->_uri_str, gnome_vfs_escape_string (file_info->name)), _g_free0 (full_uri), _tmp2_); - _tmp3_ = desktop_agnostic_vfs_file_new_for_uri (full_uri, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (full_uri); - _g_object_unref0 (child); - _gnome_vfs_file_info_unref0 (file_info); - __g_slist_free_g_object_unref0 (_result_); - return NULL; - } - child = (_tmp4_ = _tmp3_, _g_object_unref0 (child), _tmp4_); - _result_ = g_slist_append (_result_, (_tmp5_ = child, child = NULL, _tmp5_)); - _g_free0 (full_uri); - _g_object_unref0 (child); - } - } - gnome_vfs_directory_close (dir); - _gnome_vfs_file_info_unref0 (file_info); - } else { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_VFS_FILE_ERROR, DESKTOP_AGNOSTIC_VFS_FILE_ERROR_INVALID_TYPE, "VFS Error: %s", gnome_vfs_result_to_string (res)); - { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (_result_); - return NULL; - } - } - result = _result_; - return result; -} - - -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error) { - DesktopAgnosticVFSFileGnomeVFS * self; - gboolean result; - GnomeVFSXferOverwriteMode overwrite_mode = 0; - GnomeVFSResult res = 0; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - g_return_val_if_fail (destination != NULL, FALSE); - if (overwrite) { - overwrite_mode = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE; - } else { - overwrite_mode = GNOME_VFS_XFER_OVERWRITE_MODE_ABORT; - } - res = gnome_vfs_xfer_uri ((GnomeVFSURI*) desktop_agnostic_vfs_file_get_implementation ((DesktopAgnosticVFSFile*) self), (GnomeVFSURI*) desktop_agnostic_vfs_file_get_implementation (destination), GNOME_VFS_XFER_DEFAULT, GNOME_VFS_XFER_ERROR_MODE_ABORT, overwrite_mode, NULL, NULL); - result = res == GNOME_VFS_OK; - return result; -} - - -static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_remove (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileGnomeVFS * self; - gboolean result; - GError * _inner_error_; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - _inner_error_ = NULL; - if (!desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - char* _tmp0_; - GError* _tmp1_; - _inner_error_ = (_tmp1_ = g_error_new (DESKTOP_AGNOSTIC_VFS_FILE_ERROR, DESKTOP_AGNOSTIC_VFS_FILE_ERROR_FILE_NOT_FOUND, "The file '%s' does not exist.", _tmp0_ = desktop_agnostic_vfs_file_get_uri ((DesktopAgnosticVFSFile*) self)), _g_free0 (_tmp0_), _tmp1_); - { - g_propagate_error (error, _inner_error_); - return FALSE; - } - } - result = gnome_vfs_unlink_from_uri (self->priv->_uri) == GNOME_VFS_OK; - return result; -} - - -DesktopAgnosticVFSFileGnomeVFS* desktop_agnostic_vfs_file_gnome_vfs_construct (GType object_type) { - DesktopAgnosticVFSFileGnomeVFS * self; - self = (DesktopAgnosticVFSFileGnomeVFS*) desktop_agnostic_vfs_file_construct (object_type); - return self; -} - - -DesktopAgnosticVFSFileGnomeVFS* desktop_agnostic_vfs_file_gnome_vfs_new (void) { - return desktop_agnostic_vfs_file_gnome_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS); -} - - -static void* desktop_agnostic_vfs_file_gnome_vfs_real_get_implementation (DesktopAgnosticVFSFile* base) { - void* result; - DesktopAgnosticVFSFileGnomeVFS* self; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - result = (void*) self->priv->_uri; - return result; -} - - -static char* desktop_agnostic_vfs_file_gnome_vfs_real_get_impl_uri (DesktopAgnosticVFSFile* base) { - char* result; - DesktopAgnosticVFSFileGnomeVFS* self; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - result = g_strdup (self->priv->_uri_str); - return result; -} - - -static char* desktop_agnostic_vfs_file_gnome_vfs_real_get_impl_path (DesktopAgnosticVFSFile* base) { - char* result; - DesktopAgnosticVFSFileGnomeVFS* self; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - result = g_strdup (gnome_vfs_uri_get_path (self->priv->_uri)); - return result; -} - - -static DesktopAgnosticVFSFileType desktop_agnostic_vfs_file_gnome_vfs_real_get_file_type (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileType result; - DesktopAgnosticVFSFileGnomeVFS* self; - DesktopAgnosticVFSFileType ft = 0; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - if (desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - GnomeVFSFileInfo* info; - info = gnome_vfs_file_info_new (); - gnome_vfs_get_file_info_uri (self->priv->_uri, info, GNOME_VFS_FILE_INFO_DEFAULT); - switch (info->type) { - case GNOME_VFS_FILE_TYPE_REGULAR: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR; - break; - } - case GNOME_VFS_FILE_TYPE_DIRECTORY: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY; - break; - } - case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK; - break; - } - case GNOME_VFS_FILE_TYPE_FIFO: - case GNOME_VFS_FILE_TYPE_SOCKET: - case GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE: - case GNOME_VFS_FILE_TYPE_BLOCK_DEVICE: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL; - break; - } - default: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; - break; - } - } - _gnome_vfs_file_info_unref0 (info); - } else { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; - } - result = ft; - return result; -} - - -static DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_gnome_vfs_real_get_access_flags (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSAccessFlags result; - DesktopAgnosticVFSFileGnomeVFS* self; - DesktopAgnosticVFSAccessFlags flags; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - flags = DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE; - if (desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - GnomeVFSFileInfo* info; - GnomeVFSFileInfoOptions options = 0; - info = gnome_vfs_file_info_new (); - options = GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS; - gnome_vfs_get_file_info_uri (self->priv->_uri, info, options); - if ((info->permissions & GNOME_VFS_PERM_ACCESS_READABLE) != 0) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ; - } - if ((info->permissions & GNOME_VFS_PERM_ACCESS_WRITABLE) != 0) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE; - } - if ((info->permissions & GNOME_VFS_PERM_ACCESS_EXECUTABLE) != 0) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE; - } - _gnome_vfs_file_info_unref0 (info); - } - result = flags; - return result; -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_gnome_vfs_real_get_parent (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFile* result; - DesktopAgnosticVFSFileGnomeVFS* self; - GnomeVFSURI* uri; - self = (DesktopAgnosticVFSFileGnomeVFS*) base; - uri = NULL; - uri = gnome_vfs_uri_get_parent (self->priv->_uri); - if (uri == NULL) { - result = NULL; - return result; - } else { - DesktopAgnosticVFSFile* _result_; - DesktopAgnosticVFSFile* _tmp0_; - _result_ = NULL; - _result_ = (_tmp0_ = (DesktopAgnosticVFSFile*) desktop_agnostic_vfs_file_gnome_vfs_new (), _g_object_unref0 (_result_), _tmp0_); - desktop_agnostic_vfs_file_init (_result_, gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE)); - result = _result_; - return result; - } -} - - -static void desktop_agnostic_vfs_file_gnome_vfs_class_init (DesktopAgnosticVFSFileGnomeVFSClass * klass) { - desktop_agnostic_vfs_file_gnome_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSFileGnomeVFSPrivate)); - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->init = desktop_agnostic_vfs_file_gnome_vfs_real_init; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->exists = desktop_agnostic_vfs_file_gnome_vfs_real_exists; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->monitor = desktop_agnostic_vfs_file_gnome_vfs_real_monitor; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->load_contents = desktop_agnostic_vfs_file_gnome_vfs_real_load_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->replace_contents = desktop_agnostic_vfs_file_gnome_vfs_real_replace_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->launch = desktop_agnostic_vfs_file_gnome_vfs_real_launch; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->enumerate_children = desktop_agnostic_vfs_file_gnome_vfs_real_enumerate_children; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->copy = desktop_agnostic_vfs_file_gnome_vfs_real_copy; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->remove = desktop_agnostic_vfs_file_gnome_vfs_real_remove; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_implementation = desktop_agnostic_vfs_file_gnome_vfs_real_get_implementation; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_impl_uri = desktop_agnostic_vfs_file_gnome_vfs_real_get_impl_uri; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_impl_path = desktop_agnostic_vfs_file_gnome_vfs_real_get_impl_path; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_file_type = desktop_agnostic_vfs_file_gnome_vfs_real_get_file_type; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_access_flags = desktop_agnostic_vfs_file_gnome_vfs_real_get_access_flags; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_parent = desktop_agnostic_vfs_file_gnome_vfs_real_get_parent; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_gnome_vfs_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_file_gnome_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPLEMENTATION, "implementation"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPL_URI, "impl-uri"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPL_PATH, "impl-path"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_FILE_TYPE, "file-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_ACCESS_FLAGS, "access-flags"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_PARENT, "parent"); -} - - -static void desktop_agnostic_vfs_file_gnome_vfs_instance_init (DesktopAgnosticVFSFileGnomeVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_file_gnome_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSFileGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS (obj); - _gnome_vfs_uri_unref0 (self->priv->_uri); - _g_free0 (self->priv->_uri_str); - G_OBJECT_CLASS (desktop_agnostic_vfs_file_gnome_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_file_gnome_vfs_get_type (void) { - static GType desktop_agnostic_vfs_file_gnome_vfs_type_id = 0; - if (desktop_agnostic_vfs_file_gnome_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileGnomeVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_file_gnome_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSFileGnomeVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_file_gnome_vfs_instance_init, NULL }; - desktop_agnostic_vfs_file_gnome_vfs_type_id = g_type_register_static (DESKTOP_AGNOSTIC_VFS_TYPE_FILE, "DesktopAgnosticVFSFileGnomeVFS", &g_define_type_info, 0); - } - return desktop_agnostic_vfs_file_gnome_vfs_type_id; -} - - -static void desktop_agnostic_vfs_file_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFileGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPLEMENTATION: - g_value_set_pointer (value, desktop_agnostic_vfs_file_get_implementation ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPL_URI: - g_value_set_string (value, desktop_agnostic_vfs_file_get_impl_uri ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPL_PATH: - g_value_set_string (value, desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_FILE_TYPE: - g_value_set_enum (value, desktop_agnostic_vfs_file_get_file_type ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_ACCESS_FLAGS: - g_value_set_enum (value, desktop_agnostic_vfs_file_get_access_flags ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_PARENT: - g_value_set_object (value, desktop_agnostic_vfs_file_get_parent ((DesktopAgnosticVFSFile*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-impl-thunar-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-impl-thunar-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-impl-thunar-vfs.c 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-impl-thunar-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,658 +0,0 @@ -/* vfs-file-impl-thunar-vfs.c generated by valac, the Vala compiler - * generated from vfs-file-impl-thunar-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: File implementation (with Thunar VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS (desktop_agnostic_vfs_file_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileThunarVFS DesktopAgnosticVFSFileThunarVFS; -typedef struct _DesktopAgnosticVFSFileThunarVFSClass DesktopAgnosticVFSFileThunarVFSClass; -typedef struct _DesktopAgnosticVFSFileThunarVFSPrivate DesktopAgnosticVFSFileThunarVFSPrivate; -#define _thunar_vfs_path_unref0(var) ((var == NULL) ? NULL : (var = (thunar_vfs_path_unref (var), NULL))) -#define _thunar_vfs_info_unref0(var) ((var == NULL) ? NULL : (var = (thunar_vfs_info_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS (desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFS DesktopAgnosticVFSFileMonitorThunarVFS; -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFSClass DesktopAgnosticVFSFileMonitorThunarVFSClass; -#define __g_list_free_thunar_vfs_path_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_thunar_vfs_path_unref (var), NULL))) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) -#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -struct _DesktopAgnosticVFSFileThunarVFS { - DesktopAgnosticVFSFile parent_instance; - DesktopAgnosticVFSFileThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileThunarVFSClass { - DesktopAgnosticVFSFileClass parent_class; -}; - -struct _DesktopAgnosticVFSFileThunarVFSPrivate { - ThunarVfsPath* _path; - ThunarVfsInfo* _info; - char* _uri; -}; - - -static gpointer desktop_agnostic_vfs_file_thunar_vfs_parent_class = NULL; - -GType desktop_agnostic_vfs_file_thunar_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPL_PATH, - DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPL_URI, - DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_FILE_TYPE, - DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_PARENT -}; -static void desktop_agnostic_vfs_file_thunar_vfs_real_init (DesktopAgnosticVFSFile* base, const char* uri); -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_exists (DesktopAgnosticVFSFile* base); -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_new (DesktopAgnosticVFSFileThunarVFS* file); -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_construct (GType object_type, DesktopAgnosticVFSFileThunarVFS* file); -GType desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type (void); -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_thunar_vfs_real_monitor (DesktopAgnosticVFSFile* base); -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_load_contents (DesktopAgnosticVFSFile* base, char** contents, gsize* length, GError** error); -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_replace_contents (DesktopAgnosticVFSFile* base, const char* contents, GError** error); -static void _g_list_free_thunar_vfs_path_unref (GList* self); -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_launch (DesktopAgnosticVFSFile* base, GError** error); -static void _g_slist_free_g_object_unref (GSList* self); -static GSList* desktop_agnostic_vfs_file_thunar_vfs_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error); -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_remove (DesktopAgnosticVFSFile* base, GError** error); -DesktopAgnosticVFSFileThunarVFS* desktop_agnostic_vfs_file_thunar_vfs_new (void); -DesktopAgnosticVFSFileThunarVFS* desktop_agnostic_vfs_file_thunar_vfs_construct (GType object_type); -static void desktop_agnostic_vfs_file_thunar_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_file_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static void desktop_agnostic_vfs_file_thunar_vfs_real_init (DesktopAgnosticVFSFile* base, const char* uri) { - DesktopAgnosticVFSFileThunarVFS * self; - GError * _inner_error_; - char* _tmp0_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - g_return_if_fail (uri != NULL); - _inner_error_ = NULL; - self->priv->_uri = (_tmp0_ = g_strdup (uri), _g_free0 (self->priv->_uri), _tmp0_); - { - ThunarVfsPath* _tmp1_; - ThunarVfsPath* _tmp2_; - _tmp1_ = thunar_vfs_path_new (self->priv->_uri, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - self->priv->_path = (_tmp2_ = _tmp1_, _thunar_vfs_path_unref0 (self->priv->_path), _tmp2_); - { - ThunarVfsInfo* _tmp3_; - ThunarVfsInfo* _tmp4_; - _tmp3_ = thunar_vfs_info_new_for_path (self->priv->_path, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch1_g_file_error; - } - goto __finally1; - } - self->priv->_info = (_tmp4_ = _tmp3_, _thunar_vfs_info_unref0 (self->priv->_info), _tmp4_); - } - goto __finally1; - __catch1_g_file_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - ThunarVfsInfo* _tmp5_; - self->priv->_info = (_tmp5_ = NULL, _thunar_vfs_info_unref0 (self->priv->_info), _tmp5_); - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("vfs-file-impl-thunar-vfs.vala:156: VFS File Error (Thunar VFS): %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } -} - - -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_exists (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileThunarVFS * self; - gboolean result; - char* _tmp0_; - gboolean _tmp1_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - result = (_tmp1_ = g_file_test (_tmp0_ = desktop_agnostic_vfs_file_get_path ((DesktopAgnosticVFSFile*) self), G_FILE_TEST_EXISTS), _g_free0 (_tmp0_), _tmp1_); - return result; -} - - -static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_thunar_vfs_real_monitor (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileThunarVFS * self; - DesktopAgnosticVFSFileMonitor* result; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - result = (DesktopAgnosticVFSFileMonitor*) desktop_agnostic_vfs_file_monitor_thunar_vfs_new (self); - return result; -} - - -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_load_contents (DesktopAgnosticVFSFile* base, char** contents, gsize* length, GError** error) { - DesktopAgnosticVFSFileThunarVFS * self; - gboolean result; - GError * _inner_error_; - char* _tmp3_; - gboolean _tmp2_; - char* _tmp1_ = NULL; - char* _tmp0_; - gboolean _tmp4_; - gboolean _tmp5_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - if (contents != NULL) { - *contents = NULL; - } - _inner_error_ = NULL; - _tmp5_ = (_tmp4_ = (_tmp2_ = g_file_get_contents (_tmp0_ = desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self), &_tmp1_, length, &_inner_error_), *contents = (_tmp3_ = _tmp1_, _g_free0 (*contents), _tmp3_), _tmp2_), _g_free0 (_tmp0_), _tmp4_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - result = _tmp5_; - return result; -} - - -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_replace_contents (DesktopAgnosticVFSFile* base, const char* contents, GError** error) { - DesktopAgnosticVFSFileThunarVFS * self; - gboolean result; - GError * _inner_error_; - char* _tmp0_; - gboolean _tmp1_; - gboolean _tmp2_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - g_return_val_if_fail (contents != NULL, FALSE); - _inner_error_ = NULL; - _tmp2_ = (_tmp1_ = g_file_set_contents (_tmp0_ = desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self), contents, -1, &_inner_error_), _g_free0 (_tmp0_), _tmp1_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return FALSE; - } - result = _tmp2_; - return result; -} - - -static void _g_list_free_thunar_vfs_path_unref (GList* self) { - g_list_foreach (self, (GFunc) thunar_vfs_path_unref, NULL); - g_list_free (self); -} - - -static gpointer _thunar_vfs_path_ref0 (gpointer self) { - return self ? thunar_vfs_path_ref (self) : NULL; -} - - -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_launch (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileThunarVFS * self; - gboolean result; - GError * _inner_error_; - ThunarVfsMimeDatabase* mime_db; - ThunarVfsInfo* info; - ThunarVfsMimeApplication* mime_app; - GList* paths; - ThunarVfsInfo* _tmp0_; - ThunarVfsInfo* _tmp1_; - gboolean _tmp2_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - _inner_error_ = NULL; - mime_db = NULL; - info = NULL; - mime_app = NULL; - paths = NULL; - mime_db = thunar_vfs_mime_database_get_default (); - _tmp0_ = thunar_vfs_info_new_for_path (self->priv->_path, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _thunar_vfs_info_unref0 (info); - __g_list_free_thunar_vfs_path_unref0 (paths); - return FALSE; - } - info = (_tmp1_ = _tmp0_, _thunar_vfs_info_unref0 (info), _tmp1_); - mime_app = thunar_vfs_mime_database_get_default_application (mime_db, info->mime_info); - paths = g_list_append (paths, _thunar_vfs_path_ref0 (self->priv->_path)); - _tmp2_ = thunar_vfs_mime_handler_exec ((ThunarVfsMimeHandler*) mime_app, gdk_screen_get_default (), paths, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _thunar_vfs_info_unref0 (info); - __g_list_free_thunar_vfs_path_unref0 (paths); - return FALSE; - } - result = _tmp2_; - _thunar_vfs_info_unref0 (info); - __g_list_free_thunar_vfs_path_unref0 (paths); - return result; -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static GSList* desktop_agnostic_vfs_file_thunar_vfs_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileThunarVFS * self; - GSList* result; - GError * _inner_error_; - GSList* children; - GDir* dir; - const char* child; - GSList* _tmp2_; - char* _tmp3_; - GDir* _tmp4_; - GDir* _tmp5_; - GDir* _tmp6_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - _inner_error_ = NULL; - children = NULL; - dir = NULL; - child = NULL; - if (desktop_agnostic_vfs_file_get_file_type ((DesktopAgnosticVFSFile*) self) != DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY) { - char* _tmp0_; - GError* _tmp1_; - _inner_error_ = (_tmp1_ = g_error_new (DESKTOP_AGNOSTIC_VFS_FILE_ERROR, DESKTOP_AGNOSTIC_VFS_FILE_ERROR_INVALID_TYPE, "File '%s' is not a directory.", _tmp0_ = desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)), _g_free0 (_tmp0_), _tmp1_); - { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (children); - _g_dir_close0 (dir); - return NULL; - } - } - children = (_tmp2_ = NULL, __g_slist_free_g_object_unref0 (children), _tmp2_); - _tmp5_ = (_tmp4_ = g_dir_open (_tmp3_ = desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self), 0, &_inner_error_), _g_free0 (_tmp3_), _tmp4_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (children); - _g_dir_close0 (dir); - return NULL; - } - dir = (_tmp6_ = _tmp5_, _g_dir_close0 (dir), _tmp6_); - while (TRUE) { - char* child_path; - char* _tmp8_; - char* _tmp7_; - DesktopAgnosticVFSFile* _tmp9_; - if (!((child = g_dir_read_name (dir)) != NULL)) { - break; - } - child_path = NULL; - child_path = (_tmp8_ = g_build_filename (_tmp7_ = desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self), child, NULL), _g_free0 (child_path), _tmp8_); - _g_free0 (_tmp7_); - _tmp9_ = desktop_agnostic_vfs_file_new_for_path (child_path, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (child_path); - __g_slist_free_g_object_unref0 (children); - _g_dir_close0 (dir); - return NULL; - } - children = g_slist_append (children, _tmp9_); - _g_free0 (child_path); - } - result = children; - _g_dir_close0 (dir); - return result; -} - - -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error) { - DesktopAgnosticVFSFileThunarVFS * self; - gboolean result; - GError * _inner_error_; - char* data; - gsize length = 0UL; - gboolean _tmp0_ = FALSE; - gboolean _tmp3_ = FALSE; - char* _tmp6_; - gboolean _tmp5_; - char* _tmp4_ = NULL; - gboolean _tmp7_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - g_return_val_if_fail (destination != NULL, FALSE); - _inner_error_ = NULL; - data = NULL; - if (!overwrite) { - _tmp0_ = desktop_agnostic_vfs_file_exists (destination); - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - char* _tmp1_; - GError* _tmp2_; - _inner_error_ = (_tmp2_ = g_error_new (DESKTOP_AGNOSTIC_VFS_FILE_ERROR, DESKTOP_AGNOSTIC_VFS_FILE_ERROR_EXISTS, "The destination file (%s) exists.", _tmp1_ = desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)), _g_free0 (_tmp1_), _tmp2_); - { - g_propagate_error (error, _inner_error_); - _g_free0 (data); - return FALSE; - } - } - _tmp7_ = (_tmp5_ = desktop_agnostic_vfs_file_load_contents ((DesktopAgnosticVFSFile*) self, &_tmp4_, &length, &_inner_error_), data = (_tmp6_ = _tmp4_, _g_free0 (data), _tmp6_), _tmp5_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (data); - return FALSE; - } - if (_tmp7_) { - gboolean _tmp8_; - _tmp8_ = desktop_agnostic_vfs_file_replace_contents (destination, data, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (data); - return FALSE; - } - _tmp3_ = _tmp8_; - } else { - _tmp3_ = FALSE; - } - result = _tmp3_; - _g_free0 (data); - return result; -} - - -static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_remove (DesktopAgnosticVFSFile* base, GError** error) { - DesktopAgnosticVFSFileThunarVFS * self; - gboolean result; - GError * _inner_error_; - char* _tmp2_; - gboolean _tmp3_; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - _inner_error_ = NULL; - if (!desktop_agnostic_vfs_file_exists ((DesktopAgnosticVFSFile*) self)) { - char* _tmp0_; - GError* _tmp1_; - _inner_error_ = (_tmp1_ = g_error_new (DESKTOP_AGNOSTIC_VFS_FILE_ERROR, DESKTOP_AGNOSTIC_VFS_FILE_ERROR_FILE_NOT_FOUND, "The file '%s' does not exist.", _tmp0_ = desktop_agnostic_vfs_file_get_uri ((DesktopAgnosticVFSFile*) self)), _g_free0 (_tmp0_), _tmp1_); - { - g_propagate_error (error, _inner_error_); - return FALSE; - } - } - result = (_tmp3_ = g_unlink (_tmp2_ = desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)) == 0, _g_free0 (_tmp2_), _tmp3_); - return result; -} - - -DesktopAgnosticVFSFileThunarVFS* desktop_agnostic_vfs_file_thunar_vfs_construct (GType object_type) { - DesktopAgnosticVFSFileThunarVFS * self; - self = (DesktopAgnosticVFSFileThunarVFS*) desktop_agnostic_vfs_file_construct (object_type); - return self; -} - - -DesktopAgnosticVFSFileThunarVFS* desktop_agnostic_vfs_file_thunar_vfs_new (void) { - return desktop_agnostic_vfs_file_thunar_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS); -} - - -static void* desktop_agnostic_vfs_file_thunar_vfs_real_get_implementation (DesktopAgnosticVFSFile* base) { - void* result; - DesktopAgnosticVFSFileThunarVFS* self; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - result = (void*) self->priv->_path; - return result; -} - - -static char* desktop_agnostic_vfs_file_thunar_vfs_real_get_impl_path (DesktopAgnosticVFSFile* base) { - char* result; - DesktopAgnosticVFSFileThunarVFS* self; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - result = g_strdup (thunar_vfs_path_dup_string (self->priv->_path)); - return result; -} - - -static char* desktop_agnostic_vfs_file_thunar_vfs_real_get_impl_uri (DesktopAgnosticVFSFile* base) { - char* result; - DesktopAgnosticVFSFileThunarVFS* self; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - result = g_strdup (self->priv->_uri); - return result; -} - - -static DesktopAgnosticVFSFileType desktop_agnostic_vfs_file_thunar_vfs_real_get_file_type (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFileType result; - DesktopAgnosticVFSFileThunarVFS* self; - DesktopAgnosticVFSFileType ft; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; - ; - if (self->priv->_info != NULL) { - if ((self->priv->_info->flags & THUNAR_VFS_FILE_FLAGS_SYMLINK) != 0) { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK; - } else { - switch (self->priv->_info->type) { - case THUNAR_VFS_FILE_TYPE_REGULAR: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR; - break; - } - case THUNAR_VFS_FILE_TYPE_DIRECTORY: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY; - break; - } - case THUNAR_VFS_FILE_TYPE_SYMLINK: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK; - break; - } - case THUNAR_VFS_FILE_TYPE_PORT: - case THUNAR_VFS_FILE_TYPE_DOOR: - case THUNAR_VFS_FILE_TYPE_SOCKET: - case THUNAR_VFS_FILE_TYPE_BLOCKDEV: - case THUNAR_VFS_FILE_TYPE_CHARDEV: - case THUNAR_VFS_FILE_TYPE_FIFO: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL; - break; - } - case THUNAR_VFS_FILE_TYPE_UNKNOWN: - { - ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; - break; - } - } - } - } - result = ft; - return result; -} - - -static DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_thunar_vfs_real_get_access_flags (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSAccessFlags result; - DesktopAgnosticVFSFileThunarVFS* self; - DesktopAgnosticVFSAccessFlags flags; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - flags = DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE; - if (self->priv->_info != NULL) { - if ((self->priv->_info->flags & THUNAR_VFS_FILE_FLAGS_READABLE) != 0) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ; - } - if ((self->priv->_info->flags & THUNAR_VFS_FILE_FLAGS_WRITABLE) != 0) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE; - } - if ((self->priv->_info->flags & THUNAR_VFS_FILE_FLAGS_EXECUTABLE) != 0) { - flags = flags | DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE; - } - } - result = flags; - return result; -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_thunar_vfs_real_get_parent (DesktopAgnosticVFSFile* base) { - DesktopAgnosticVFSFile* result; - DesktopAgnosticVFSFileThunarVFS* self; - ThunarVfsPath* path; - self = (DesktopAgnosticVFSFileThunarVFS*) base; - path = NULL; - path = thunar_vfs_path_get_parent (self->priv->_path); - if (path == NULL) { - result = NULL; - return result; - } else { - DesktopAgnosticVFSFile* _result_; - DesktopAgnosticVFSFile* _tmp0_; - _result_ = NULL; - _result_ = (_tmp0_ = (DesktopAgnosticVFSFile*) desktop_agnostic_vfs_file_thunar_vfs_new (), _g_object_unref0 (_result_), _tmp0_); - desktop_agnostic_vfs_file_init (_result_, thunar_vfs_path_dup_uri (path)); - result = _result_; - return result; - } -} - - -static void desktop_agnostic_vfs_file_thunar_vfs_class_init (DesktopAgnosticVFSFileThunarVFSClass * klass) { - desktop_agnostic_vfs_file_thunar_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSFileThunarVFSPrivate)); - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->init = desktop_agnostic_vfs_file_thunar_vfs_real_init; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->exists = desktop_agnostic_vfs_file_thunar_vfs_real_exists; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->monitor = desktop_agnostic_vfs_file_thunar_vfs_real_monitor; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->load_contents = desktop_agnostic_vfs_file_thunar_vfs_real_load_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->replace_contents = desktop_agnostic_vfs_file_thunar_vfs_real_replace_contents; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->launch = desktop_agnostic_vfs_file_thunar_vfs_real_launch; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->enumerate_children = desktop_agnostic_vfs_file_thunar_vfs_real_enumerate_children; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->copy = desktop_agnostic_vfs_file_thunar_vfs_real_copy; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->remove = desktop_agnostic_vfs_file_thunar_vfs_real_remove; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_implementation = desktop_agnostic_vfs_file_thunar_vfs_real_get_implementation; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_impl_path = desktop_agnostic_vfs_file_thunar_vfs_real_get_impl_path; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_impl_uri = desktop_agnostic_vfs_file_thunar_vfs_real_get_impl_uri; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_file_type = desktop_agnostic_vfs_file_thunar_vfs_real_get_file_type; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_access_flags = desktop_agnostic_vfs_file_thunar_vfs_real_get_access_flags; - DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_parent = desktop_agnostic_vfs_file_thunar_vfs_real_get_parent; - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_thunar_vfs_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_file_thunar_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPLEMENTATION, "implementation"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPL_PATH, "impl-path"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPL_URI, "impl-uri"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_FILE_TYPE, "file-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_PARENT, "parent"); -} - - -static void desktop_agnostic_vfs_file_thunar_vfs_instance_init (DesktopAgnosticVFSFileThunarVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_file_thunar_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSFileThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS (obj); - _thunar_vfs_path_unref0 (self->priv->_path); - _thunar_vfs_info_unref0 (self->priv->_info); - _g_free0 (self->priv->_uri); - G_OBJECT_CLASS (desktop_agnostic_vfs_file_thunar_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_file_thunar_vfs_get_type (void) { - static GType desktop_agnostic_vfs_file_thunar_vfs_type_id = 0; - if (desktop_agnostic_vfs_file_thunar_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileThunarVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_file_thunar_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSFileThunarVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_file_thunar_vfs_instance_init, NULL }; - desktop_agnostic_vfs_file_thunar_vfs_type_id = g_type_register_static (DESKTOP_AGNOSTIC_VFS_TYPE_FILE, "DesktopAgnosticVFSFileThunarVFS", &g_define_type_info, 0); - } - return desktop_agnostic_vfs_file_thunar_vfs_type_id; -} - - -static void desktop_agnostic_vfs_file_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFileThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPLEMENTATION: - g_value_set_pointer (value, desktop_agnostic_vfs_file_get_implementation ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPL_PATH: - g_value_set_string (value, desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPL_URI: - g_value_set_string (value, desktop_agnostic_vfs_file_get_impl_uri ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_FILE_TYPE: - g_value_set_enum (value, desktop_agnostic_vfs_file_get_file_type ((DesktopAgnosticVFSFile*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_PARENT: - g_value_set_object (value, desktop_agnostic_vfs_file_get_parent ((DesktopAgnosticVFSFile*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor.c 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -/* vfs-file-monitor.c generated by valac, the Vala compiler - * generated from vfs-file-monitor.vala, do not modify */ - -/* - * Desktop Agnostic Library: File monitor interface (similar to GFileMonitor). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_EVENT (desktop_agnostic_vfs_file_monitor_event_get_type ()) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR (desktop_agnostic_vfs_file_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitorIface)) - -typedef struct _DesktopAgnosticVFSFileMonitor DesktopAgnosticVFSFileMonitor; -typedef struct _DesktopAgnosticVFSFileMonitorIface DesktopAgnosticVFSFileMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE (desktop_agnostic_vfs_file_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFile)) -#define DESKTOP_AGNOSTIC_VFS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) - -typedef struct _DesktopAgnosticVFSFile DesktopAgnosticVFSFile; -typedef struct _DesktopAgnosticVFSFileClass DesktopAgnosticVFSFileClass; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN = 0, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED -} DesktopAgnosticVFSFileMonitorEvent; - -struct _DesktopAgnosticVFSFileMonitorIface { - GTypeInterface parent_iface; - void (*emit) (DesktopAgnosticVFSFileMonitor* self, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); - gboolean (*cancel) (DesktopAgnosticVFSFileMonitor* self); - gboolean (*get_cancelled) (DesktopAgnosticVFSFileMonitor* self); -}; - - - -GType desktop_agnostic_vfs_file_monitor_event_get_type (void); -GType desktop_agnostic_vfs_file_get_type (void); -GType desktop_agnostic_vfs_file_monitor_get_type (void); -void desktop_agnostic_vfs_file_monitor_emit (DesktopAgnosticVFSFileMonitor* self, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); -gboolean desktop_agnostic_vfs_file_monitor_cancel (DesktopAgnosticVFSFileMonitor* self); -gboolean desktop_agnostic_vfs_file_monitor_get_cancelled (DesktopAgnosticVFSFileMonitor* self); - - -static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); - - -GType desktop_agnostic_vfs_file_monitor_event_get_type (void) { - static GType desktop_agnostic_vfs_file_monitor_event_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_vfs_file_monitor_event_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN, "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN", "unknown"}, {DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED, "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED", "changed"}, {DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED, "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED", "created"}, {DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED, "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED", "deleted"}, {DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED, "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED", "attribute-changed"}, {0, NULL, NULL}}; - desktop_agnostic_vfs_file_monitor_event_type_id = g_enum_register_static ("DesktopAgnosticVFSFileMonitorEvent", values); - } - return desktop_agnostic_vfs_file_monitor_event_type_id; -} - - -void desktop_agnostic_vfs_file_monitor_emit (DesktopAgnosticVFSFileMonitor* self, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event) { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GET_INTERFACE (self)->emit (self, other, event); -} - - -gboolean desktop_agnostic_vfs_file_monitor_cancel (DesktopAgnosticVFSFileMonitor* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GET_INTERFACE (self)->cancel (self); -} - - -gboolean desktop_agnostic_vfs_file_monitor_get_cancelled (DesktopAgnosticVFSFileMonitor* self) { - return DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GET_INTERFACE (self)->get_cancelled (self); -} - - -static void desktop_agnostic_vfs_file_monitor_base_init (DesktopAgnosticVFSFileMonitorIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_object_interface_install_property (iface, g_param_spec_boolean ("cancelled", "cancelled", "cancelled", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_signal_new ("changed", DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM, G_TYPE_NONE, 3, DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_EVENT); - } -} - - -GType desktop_agnostic_vfs_file_monitor_get_type (void) { - static GType desktop_agnostic_vfs_file_monitor_type_id = 0; - if (desktop_agnostic_vfs_file_monitor_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileMonitorIface), (GBaseInitFunc) desktop_agnostic_vfs_file_monitor_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - desktop_agnostic_vfs_file_monitor_type_id = g_type_register_static (G_TYPE_INTERFACE, "DesktopAgnosticVFSFileMonitor", &g_define_type_info, 0); - g_type_interface_add_prerequisite (desktop_agnostic_vfs_file_monitor_type_id, G_TYPE_OBJECT); - } - return desktop_agnostic_vfs_file_monitor_type_id; -} - - - -static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (gpointer data1, gpointer arg_1, gpointer arg_2, gint arg_3, gpointer data2); - register GMarshalFunc_VOID__OBJECT_OBJECT_ENUM callback; - register GCClosure * cc; - register gpointer data1, data2; - cc = (GCClosure *) closure; - g_return_if_fail (n_param_values == 4); - if (G_CCLOSURE_SWAP_DATA (closure)) { - data1 = closure->data; - data2 = param_values->data[0].v_pointer; - } else { - data1 = param_values->data[0].v_pointer; - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (marshal_data ? marshal_data : cc->callback); - callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), g_value_get_enum (param_values + 3), data2); -} - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gio.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gio.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gio.c 2010-04-11 07:32:16.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gio.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,319 +0,0 @@ -/* vfs-file-monitor-impl-gio.c generated by valac, the Vala compiler - * generated from vfs-file-monitor-impl-gio.vala, do not modify */ - -/* - * Desktop Agnostic Library: File monitor implementation (with GIO). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO (desktop_agnostic_vfs_file_monitor_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGIO DesktopAgnosticVFSFileMonitorGIO; -typedef struct _DesktopAgnosticVFSFileMonitorGIOClass DesktopAgnosticVFSFileMonitorGIOClass; -typedef struct _DesktopAgnosticVFSFileMonitorGIOPrivate DesktopAgnosticVFSFileMonitorGIOPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO (desktop_agnostic_vfs_file_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) - -typedef struct _DesktopAgnosticVFSFileGIO DesktopAgnosticVFSFileGIO; -typedef struct _DesktopAgnosticVFSFileGIOClass DesktopAgnosticVFSFileGIOClass; -#define _g_free0(var) (var = (g_free (var), NULL)) - -struct _DesktopAgnosticVFSFileMonitorGIO { - GObject parent_instance; - DesktopAgnosticVFSFileMonitorGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileMonitorGIOClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSFileMonitorGIOPrivate { - GFileMonitor* monitor; - DesktopAgnosticVFSFile* file; -}; - - -static gpointer desktop_agnostic_vfs_file_monitor_gio_parent_class = NULL; -static DesktopAgnosticVFSFileMonitorIface* desktop_agnostic_vfs_file_monitor_gio_desktop_agnostic_vfs_file_monitor_parent_iface = NULL; - -GType desktop_agnostic_vfs_file_monitor_gio_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_CANCELLED -}; -static void desktop_agnostic_vfs_file_monitor_gio_monitor_callback (DesktopAgnosticVFSFileMonitorGIO* self, GFileMonitor* monitor, GFile* file, GFile* other, GFileMonitorEvent event_type); -static void _desktop_agnostic_vfs_file_monitor_gio_monitor_callback_g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self); -GType desktop_agnostic_vfs_file_gio_get_type (void); -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_new (DesktopAgnosticVFSFileGIO* file); -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_construct (GType object_type, DesktopAgnosticVFSFileGIO* file); -static void desktop_agnostic_vfs_file_monitor_gio_real_emit (DesktopAgnosticVFSFileMonitor* base, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); -static gboolean desktop_agnostic_vfs_file_monitor_gio_real_cancel (DesktopAgnosticVFSFileMonitor* base); -static void desktop_agnostic_vfs_file_monitor_gio_finalize (GObject* obj); -static void desktop_agnostic_vfs_file_monitor_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void _desktop_agnostic_vfs_file_monitor_gio_monitor_callback_g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) { - desktop_agnostic_vfs_file_monitor_gio_monitor_callback (self, _sender, file, other_file, event_type); -} - - -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_construct (GType object_type, DesktopAgnosticVFSFileGIO* file) { - GError * _inner_error_; - DesktopAgnosticVFSFileMonitorGIO * self; - DesktopAgnosticVFSFile* _tmp0_; - GFile* impl; - g_return_val_if_fail (file != NULL, NULL); - _inner_error_ = NULL; - self = (DesktopAgnosticVFSFileMonitorGIO*) g_object_new (object_type, NULL); - self->priv->file = (_tmp0_ = _g_object_ref0 ((DesktopAgnosticVFSFile*) file), _g_object_unref0 (self->priv->file), _tmp0_); - impl = _g_object_ref0 (G_FILE (desktop_agnostic_vfs_file_get_implementation ((DesktopAgnosticVFSFile*) file))); - if (desktop_agnostic_vfs_file_get_file_type ((DesktopAgnosticVFSFile*) file) == DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY) { - GFileMonitor* _tmp1_; - GFileMonitor* _tmp2_; - _tmp1_ = g_file_monitor_directory (impl, G_FILE_MONITOR_NONE, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (impl); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - self->priv->monitor = (_tmp2_ = _tmp1_, _g_object_unref0 (self->priv->monitor), _tmp2_); - } else { - GFileMonitor* _tmp3_; - GFileMonitor* _tmp4_; - _tmp3_ = g_file_monitor_file (impl, G_FILE_MONITOR_NONE, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (impl); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - self->priv->monitor = (_tmp4_ = _tmp3_, _g_object_unref0 (self->priv->monitor), _tmp4_); - } - g_signal_connect_object (self->priv->monitor, "changed", (GCallback) _desktop_agnostic_vfs_file_monitor_gio_monitor_callback_g_file_monitor_changed, self, 0); - _g_object_unref0 (impl); - return self; -} - - -DesktopAgnosticVFSFileMonitorGIO* desktop_agnostic_vfs_file_monitor_gio_new (DesktopAgnosticVFSFileGIO* file) { - return desktop_agnostic_vfs_file_monitor_gio_construct (DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, file); -} - - -static void desktop_agnostic_vfs_file_monitor_gio_monitor_callback (DesktopAgnosticVFSFileMonitorGIO* self, GFileMonitor* monitor, GFile* file, GFile* other, GFileMonitorEvent event_type) { - GError * _inner_error_; - DesktopAgnosticVFSFile* other_file; - DesktopAgnosticVFSFileMonitorEvent da_event = 0; - g_return_if_fail (self != NULL); - g_return_if_fail (monitor != NULL); - g_return_if_fail (file != NULL); - _inner_error_ = NULL; - other_file = NULL; - if (other != NULL) { - char* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - DesktopAgnosticVFSFile* _tmp2_; - DesktopAgnosticVFSFile* _tmp3_; - _tmp2_ = (_tmp1_ = desktop_agnostic_vfs_file_new_for_uri (_tmp0_ = g_file_get_uri (other), &_inner_error_), _g_free0 (_tmp0_), _tmp1_); - if (_inner_error_ != NULL) { - _g_object_unref0 (other_file); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - other_file = (_tmp3_ = _tmp2_, _g_object_unref0 (other_file), _tmp3_); - } - switch (event_type) { - case G_FILE_MONITOR_EVENT_CHANGED: - case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED; - break; - } - case G_FILE_MONITOR_EVENT_CREATED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED; - break; - } - case G_FILE_MONITOR_EVENT_DELETED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED; - break; - } - case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED; - break; - } - default: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN; - break; - } - } - g_signal_emit_by_name ((DesktopAgnosticVFSFileMonitor*) self, "changed", self->priv->file, other_file, da_event); - _g_object_unref0 (other_file); -} - - -static void desktop_agnostic_vfs_file_monitor_gio_real_emit (DesktopAgnosticVFSFileMonitor* base, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event) { - DesktopAgnosticVFSFileMonitorGIO * self; - GFileMonitorEvent gio_event = 0; - GFile* other_file; - self = (DesktopAgnosticVFSFileMonitorGIO*) base; - other_file = NULL; - switch (event) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED: - { - gio_event = G_FILE_MONITOR_EVENT_CHANGED; - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED: - { - gio_event = G_FILE_MONITOR_EVENT_CREATED; - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED: - { - gio_event = G_FILE_MONITOR_EVENT_DELETED; - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: - { - gio_event = G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED; - break; - } - default: - { - _g_object_unref0 (other_file); - return; - } - } - if (other != NULL) { - GFile* _tmp0_; - other_file = (_tmp0_ = _g_object_ref0 (G_FILE (desktop_agnostic_vfs_file_get_implementation (other))), _g_object_unref0 (other_file), _tmp0_); - } - g_file_monitor_emit_event (self->priv->monitor, G_FILE (desktop_agnostic_vfs_file_get_implementation (self->priv->file)), other_file, gio_event); - _g_object_unref0 (other_file); -} - - -static gboolean desktop_agnostic_vfs_file_monitor_gio_real_cancel (DesktopAgnosticVFSFileMonitor* base) { - DesktopAgnosticVFSFileMonitorGIO * self; - gboolean result; - self = (DesktopAgnosticVFSFileMonitorGIO*) base; - result = g_file_monitor_cancel (self->priv->monitor); - return result; -} - - -static gboolean desktop_agnostic_vfs_file_monitor_gio_real_get_cancelled (DesktopAgnosticVFSFileMonitor* base) { - gboolean result; - DesktopAgnosticVFSFileMonitorGIO* self; - self = (DesktopAgnosticVFSFileMonitorGIO*) base; - result = g_file_monitor_is_cancelled (self->priv->monitor); - return result; -} - - -static void desktop_agnostic_vfs_file_monitor_gio_class_init (DesktopAgnosticVFSFileMonitorGIOClass * klass) { - desktop_agnostic_vfs_file_monitor_gio_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSFileMonitorGIOPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_monitor_gio_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_file_monitor_gio_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_CANCELLED, "cancelled"); -} - - -static void desktop_agnostic_vfs_file_monitor_gio_desktop_agnostic_vfs_file_monitor_interface_init (DesktopAgnosticVFSFileMonitorIface * iface) { - desktop_agnostic_vfs_file_monitor_gio_desktop_agnostic_vfs_file_monitor_parent_iface = g_type_interface_peek_parent (iface); - iface->emit = desktop_agnostic_vfs_file_monitor_gio_real_emit; - iface->cancel = desktop_agnostic_vfs_file_monitor_gio_real_cancel; - iface->get_cancelled = desktop_agnostic_vfs_file_monitor_gio_real_get_cancelled; -} - - -static void desktop_agnostic_vfs_file_monitor_gio_instance_init (DesktopAgnosticVFSFileMonitorGIO * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_file_monitor_gio_finalize (GObject* obj) { - DesktopAgnosticVFSFileMonitorGIO * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO (obj); - _g_object_unref0 (self->priv->monitor); - _g_object_unref0 (self->priv->file); - G_OBJECT_CLASS (desktop_agnostic_vfs_file_monitor_gio_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_file_monitor_gio_get_type (void) { - static GType desktop_agnostic_vfs_file_monitor_gio_type_id = 0; - if (desktop_agnostic_vfs_file_monitor_gio_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileMonitorGIOClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_file_monitor_gio_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSFileMonitorGIO), 0, (GInstanceInitFunc) desktop_agnostic_vfs_file_monitor_gio_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_file_monitor_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_file_monitor_gio_desktop_agnostic_vfs_file_monitor_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_file_monitor_gio_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSFileMonitorGIO", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_file_monitor_gio_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, &desktop_agnostic_vfs_file_monitor_info); - } - return desktop_agnostic_vfs_file_monitor_gio_type_id; -} - - -static void desktop_agnostic_vfs_file_monitor_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFileMonitorGIO * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_CANCELLED: - g_value_set_boolean (value, desktop_agnostic_vfs_file_monitor_get_cancelled ((DesktopAgnosticVFSFileMonitor*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gnome-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gnome-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gnome-vfs.c 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gnome-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,268 +0,0 @@ -/* vfs-file-monitor-impl-gnome-vfs.c generated by valac, the Vala compiler - * generated from vfs-file-monitor-impl-gnome-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: File monitor implementation (with GNOME VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS (desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFS DesktopAgnosticVFSFileMonitorGnomeVFS; -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFSClass DesktopAgnosticVFSFileMonitorGnomeVFSClass; -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFSPrivate DesktopAgnosticVFSFileMonitorGnomeVFSPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS (desktop_agnostic_vfs_file_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileGnomeVFS DesktopAgnosticVFSFileGnomeVFS; -typedef struct _DesktopAgnosticVFSFileGnomeVFSClass DesktopAgnosticVFSFileGnomeVFSClass; - -struct _DesktopAgnosticVFSFileMonitorGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSFileMonitorGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileMonitorGnomeVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSFileMonitorGnomeVFSPrivate { - gboolean _cancelled; - GnomeVFSMonitorHandle* handle; - DesktopAgnosticVFSFile* _file; -}; - - -static gpointer desktop_agnostic_vfs_file_monitor_gnome_vfs_parent_class = NULL; -static DesktopAgnosticVFSFileMonitorIface* desktop_agnostic_vfs_file_monitor_gnome_vfs_desktop_agnostic_vfs_file_monitor_parent_iface = NULL; - -GType desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_CANCELLED -}; -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_monitor_callback (DesktopAgnosticVFSFileMonitorGnomeVFS* self, GnomeVFSMonitorHandle* handle, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event); -static void _desktop_agnostic_vfs_file_monitor_gnome_vfs_monitor_callback_gnome_vfs_monitor_callback (GnomeVFSMonitorHandle* handle, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event_type, gpointer self); -GType desktop_agnostic_vfs_file_gnome_vfs_get_type (void); -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_new (DesktopAgnosticVFSFileGnomeVFS* file); -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_construct (GType object_type, DesktopAgnosticVFSFileGnomeVFS* file); -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_real_emit (DesktopAgnosticVFSFileMonitor* base, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); -static gboolean desktop_agnostic_vfs_file_monitor_gnome_vfs_real_cancel (DesktopAgnosticVFSFileMonitor* base); -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void _desktop_agnostic_vfs_file_monitor_gnome_vfs_monitor_callback_gnome_vfs_monitor_callback (GnomeVFSMonitorHandle* handle, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event_type, gpointer self) { - desktop_agnostic_vfs_file_monitor_gnome_vfs_monitor_callback (self, handle, monitor_uri, info_uri, event_type); -} - - -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_construct (GType object_type, DesktopAgnosticVFSFileGnomeVFS* file) { - DesktopAgnosticVFSFileMonitorGnomeVFS * self; - DesktopAgnosticVFSFile* _tmp0_; - GnomeVFSMonitorType mt = 0; - char* _tmp1_; - g_return_val_if_fail (file != NULL, NULL); - self = (DesktopAgnosticVFSFileMonitorGnomeVFS*) g_object_new (object_type, NULL); - self->priv->_file = (_tmp0_ = _g_object_ref0 ((DesktopAgnosticVFSFile*) file), _g_object_unref0 (self->priv->_file), _tmp0_); - if (desktop_agnostic_vfs_file_get_file_type ((DesktopAgnosticVFSFile*) file) == DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY) { - mt = GNOME_VFS_MONITOR_DIRECTORY; - } else { - mt = GNOME_VFS_MONITOR_FILE; - } - gnome_vfs_monitor_add (&self->priv->handle, _tmp1_ = desktop_agnostic_vfs_file_get_uri ((DesktopAgnosticVFSFile*) file), mt, _desktop_agnostic_vfs_file_monitor_gnome_vfs_monitor_callback_gnome_vfs_monitor_callback, self); - _g_free0 (_tmp1_); - self->priv->_cancelled = FALSE; - return self; -} - - -DesktopAgnosticVFSFileMonitorGnomeVFS* desktop_agnostic_vfs_file_monitor_gnome_vfs_new (DesktopAgnosticVFSFileGnomeVFS* file) { - return desktop_agnostic_vfs_file_monitor_gnome_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, file); -} - - -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_monitor_callback (DesktopAgnosticVFSFileMonitorGnomeVFS* self, GnomeVFSMonitorHandle* handle, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event) { - GError * _inner_error_; - DesktopAgnosticVFSFile* info_file; - DesktopAgnosticVFSFileMonitorEvent da_event = 0; - g_return_if_fail (self != NULL); - g_return_if_fail (handle != NULL); - g_return_if_fail (monitor_uri != NULL); - g_return_if_fail (info_uri != NULL); - _inner_error_ = NULL; - info_file = NULL; - if (info_uri != NULL) { - DesktopAgnosticVFSFile* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - _tmp0_ = desktop_agnostic_vfs_file_new_for_uri (info_uri, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (info_file); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - info_file = (_tmp1_ = _tmp0_, _g_object_unref0 (info_file), _tmp1_); - } - switch (event) { - case GNOME_VFS_MONITOR_EVENT_CHANGED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED; - break; - } - case GNOME_VFS_MONITOR_EVENT_CREATED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED; - break; - } - case GNOME_VFS_MONITOR_EVENT_DELETED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED; - break; - } - case GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED; - break; - } - default: - { - _g_object_unref0 (info_file); - return; - } - } - g_signal_emit_by_name ((DesktopAgnosticVFSFileMonitor*) self, "changed", self->priv->_file, info_file, da_event); - _g_object_unref0 (info_file); -} - - -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_real_emit (DesktopAgnosticVFSFileMonitor* base, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event) { - DesktopAgnosticVFSFileMonitorGnomeVFS * self; - self = (DesktopAgnosticVFSFileMonitorGnomeVFS*) base; - g_signal_emit_by_name ((DesktopAgnosticVFSFileMonitor*) self, "changed", self->priv->_file, other, event); -} - - -static gboolean desktop_agnostic_vfs_file_monitor_gnome_vfs_real_cancel (DesktopAgnosticVFSFileMonitor* base) { - DesktopAgnosticVFSFileMonitorGnomeVFS * self; - gboolean result; - GnomeVFSResult res; - self = (DesktopAgnosticVFSFileMonitorGnomeVFS*) base; - res = gnome_vfs_monitor_cancel (self->priv->handle); - self->priv->_cancelled = res == GNOME_VFS_OK; - result = self->priv->_cancelled; - return result; -} - - -static gboolean desktop_agnostic_vfs_file_monitor_gnome_vfs_real_get_cancelled (DesktopAgnosticVFSFileMonitor* base) { - gboolean result; - DesktopAgnosticVFSFileMonitorGnomeVFS* self; - self = (DesktopAgnosticVFSFileMonitorGnomeVFS*) base; - result = self->priv->_cancelled; - return result; -} - - -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_class_init (DesktopAgnosticVFSFileMonitorGnomeVFSClass * klass) { - desktop_agnostic_vfs_file_monitor_gnome_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSFileMonitorGnomeVFSPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_monitor_gnome_vfs_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_file_monitor_gnome_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_CANCELLED, "cancelled"); -} - - -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_desktop_agnostic_vfs_file_monitor_interface_init (DesktopAgnosticVFSFileMonitorIface * iface) { - desktop_agnostic_vfs_file_monitor_gnome_vfs_desktop_agnostic_vfs_file_monitor_parent_iface = g_type_interface_peek_parent (iface); - iface->emit = desktop_agnostic_vfs_file_monitor_gnome_vfs_real_emit; - iface->cancel = desktop_agnostic_vfs_file_monitor_gnome_vfs_real_cancel; - iface->get_cancelled = desktop_agnostic_vfs_file_monitor_gnome_vfs_real_get_cancelled; -} - - -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_instance_init (DesktopAgnosticVFSFileMonitorGnomeVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSFileMonitorGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS (obj); - _g_object_unref0 (self->priv->_file); - G_OBJECT_CLASS (desktop_agnostic_vfs_file_monitor_gnome_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type (void) { - static GType desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id = 0; - if (desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileMonitorGnomeVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_file_monitor_gnome_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSFileMonitorGnomeVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_file_monitor_gnome_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_file_monitor_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_file_monitor_gnome_vfs_desktop_agnostic_vfs_file_monitor_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSFileMonitorGnomeVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, &desktop_agnostic_vfs_file_monitor_info); - } - return desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id; -} - - -static void desktop_agnostic_vfs_file_monitor_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFileMonitorGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_CANCELLED: - g_value_set_boolean (value, desktop_agnostic_vfs_file_monitor_get_cancelled ((DesktopAgnosticVFSFileMonitor*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-thunar-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-thunar-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-thunar-vfs.c 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-thunar-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,306 +0,0 @@ -/* vfs-file-monitor-impl-thunar-vfs.c generated by valac, the Vala compiler - * generated from vfs-file-monitor-impl-thunar-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: File monitor implementation (with Thunar VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS (desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFS DesktopAgnosticVFSFileMonitorThunarVFS; -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFSClass DesktopAgnosticVFSFileMonitorThunarVFSClass; -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFSPrivate DesktopAgnosticVFSFileMonitorThunarVFSPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS (desktop_agnostic_vfs_file_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileThunarVFS DesktopAgnosticVFSFileThunarVFS; -typedef struct _DesktopAgnosticVFSFileThunarVFSClass DesktopAgnosticVFSFileThunarVFSClass; -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _thunar_vfs_path_unref0(var) ((var == NULL) ? NULL : (var = (thunar_vfs_path_unref (var), NULL))) - -struct _DesktopAgnosticVFSFileMonitorThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSFileMonitorThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSFileMonitorThunarVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSFileMonitorThunarVFSPrivate { - ThunarVfsMonitorHandle* handle; - DesktopAgnosticVFSFile* file; - gboolean _cancelled; -}; - - -static gpointer desktop_agnostic_vfs_file_monitor_thunar_vfs_parent_class = NULL; -static DesktopAgnosticVFSFileMonitorIface* desktop_agnostic_vfs_file_monitor_thunar_vfs_desktop_agnostic_vfs_file_monitor_parent_iface = NULL; - -GType desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_CANCELLED -}; -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_monitor_callback (DesktopAgnosticVFSFileMonitorThunarVFS* self, ThunarVfsMonitor* monitor, ThunarVfsMonitorHandle* handle, ThunarVfsMonitorEvent event, ThunarVfsPath* handle_path, ThunarVfsPath* event_path); -static void _desktop_agnostic_vfs_file_monitor_thunar_vfs_monitor_callback_thunar_vfs_monitor_callback (ThunarVfsMonitor* monitor, ThunarVfsMonitorHandle* handle, ThunarVfsMonitorEvent event, ThunarVfsPath* handle_path, ThunarVfsPath* event_path, gpointer self); -GType desktop_agnostic_vfs_file_thunar_vfs_get_type (void); -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_new (DesktopAgnosticVFSFileThunarVFS* file); -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_construct (GType object_type, DesktopAgnosticVFSFileThunarVFS* file); -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_real_emit (DesktopAgnosticVFSFileMonitor* base, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); -static gboolean desktop_agnostic_vfs_file_monitor_thunar_vfs_real_cancel (DesktopAgnosticVFSFileMonitor* base); -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void _desktop_agnostic_vfs_file_monitor_thunar_vfs_monitor_callback_thunar_vfs_monitor_callback (ThunarVfsMonitor* monitor, ThunarVfsMonitorHandle* handle, ThunarVfsMonitorEvent event, ThunarVfsPath* handle_path, ThunarVfsPath* event_path, gpointer self) { - desktop_agnostic_vfs_file_monitor_thunar_vfs_monitor_callback (self, monitor, handle, event, handle_path, event_path); -} - - -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_construct (GType object_type, DesktopAgnosticVFSFileThunarVFS* file) { - DesktopAgnosticVFSFileMonitorThunarVFS * self; - DesktopAgnosticVFSFile* _tmp0_; - ThunarVfsMonitor* mon; - g_return_val_if_fail (file != NULL, NULL); - self = (DesktopAgnosticVFSFileMonitorThunarVFS*) g_object_new (object_type, NULL); - self->priv->file = (_tmp0_ = _g_object_ref0 ((DesktopAgnosticVFSFile*) file), _g_object_unref0 (self->priv->file), _tmp0_); - mon = thunar_vfs_monitor_get_default (); - if (desktop_agnostic_vfs_file_get_file_type ((DesktopAgnosticVFSFile*) file) == DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY) { - self->priv->handle = thunar_vfs_monitor_add_directory (mon, (ThunarVfsPath*) desktop_agnostic_vfs_file_get_implementation ((DesktopAgnosticVFSFile*) file), _desktop_agnostic_vfs_file_monitor_thunar_vfs_monitor_callback_thunar_vfs_monitor_callback, self); - } else { - self->priv->handle = thunar_vfs_monitor_add_file (mon, (ThunarVfsPath*) desktop_agnostic_vfs_file_get_implementation ((DesktopAgnosticVFSFile*) file), _desktop_agnostic_vfs_file_monitor_thunar_vfs_monitor_callback_thunar_vfs_monitor_callback, self); - } - self->priv->_cancelled = FALSE; - return self; -} - - -DesktopAgnosticVFSFileMonitorThunarVFS* desktop_agnostic_vfs_file_monitor_thunar_vfs_new (DesktopAgnosticVFSFileThunarVFS* file) { - return desktop_agnostic_vfs_file_monitor_thunar_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, file); -} - - -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_monitor_callback (DesktopAgnosticVFSFileMonitorThunarVFS* self, ThunarVfsMonitor* monitor, ThunarVfsMonitorHandle* handle, ThunarVfsMonitorEvent event, ThunarVfsPath* handle_path, ThunarVfsPath* event_path) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (monitor != NULL); - g_return_if_fail (handle != NULL); - g_return_if_fail (handle_path != NULL); - g_return_if_fail (event_path != NULL); - _inner_error_ = NULL; - { - DesktopAgnosticVFSFile* event_file; - DesktopAgnosticVFSFileMonitorEvent da_event; - event_file = desktop_agnostic_vfs_file_new_for_uri (thunar_vfs_path_dup_uri (event_path), &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch2_g_error; - } - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN; - switch (event) { - case THUNAR_VFS_MONITOR_EVENT_CHANGED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED; - break; - } - case THUNAR_VFS_MONITOR_EVENT_CREATED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED; - break; - } - case THUNAR_VFS_MONITOR_EVENT_DELETED: - { - da_event = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED; - break; - } - } - g_signal_emit_by_name ((DesktopAgnosticVFSFileMonitor*) self, "changed", self->priv->file, event_file, da_event); - _g_object_unref0 (event_file); - } - goto __finally2; - __catch2_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("vfs-file-monitor-impl-thunar-vfs.vala:75: Error: %s", err->message); - _g_error_free0 (err); - } - } - __finally2: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } -} - - -static gpointer _thunar_vfs_path_ref0 (gpointer self) { - return self ? thunar_vfs_path_ref (self) : NULL; -} - - -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_real_emit (DesktopAgnosticVFSFileMonitor* base, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event) { - DesktopAgnosticVFSFileMonitorThunarVFS * self; - ThunarVfsMonitorEvent tvfs_event = 0; - ThunarVfsPath* path; - ThunarVfsMonitor* mon; - self = (DesktopAgnosticVFSFileMonitorThunarVFS*) base; - path = NULL; - mon = thunar_vfs_monitor_get_default (); - switch (event) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED: - { - tvfs_event = THUNAR_VFS_MONITOR_EVENT_CHANGED; - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED: - { - tvfs_event = THUNAR_VFS_MONITOR_EVENT_CREATED; - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED: - { - tvfs_event = THUNAR_VFS_MONITOR_EVENT_DELETED; - break; - } - default: - { - _thunar_vfs_path_unref0 (path); - return; - } - } - if (other == NULL) { - ThunarVfsPath* _tmp0_; - path = (_tmp0_ = _thunar_vfs_path_ref0 ((ThunarVfsPath*) desktop_agnostic_vfs_file_get_implementation (self->priv->file)), _thunar_vfs_path_unref0 (path), _tmp0_); - } else { - ThunarVfsPath* _tmp1_; - path = (_tmp1_ = _thunar_vfs_path_ref0 ((ThunarVfsPath*) desktop_agnostic_vfs_file_get_implementation (other)), _thunar_vfs_path_unref0 (path), _tmp1_); - } - thunar_vfs_monitor_feed (mon, tvfs_event, path); - _thunar_vfs_path_unref0 (path); -} - - -static gboolean desktop_agnostic_vfs_file_monitor_thunar_vfs_real_cancel (DesktopAgnosticVFSFileMonitor* base) { - DesktopAgnosticVFSFileMonitorThunarVFS * self; - gboolean result; - self = (DesktopAgnosticVFSFileMonitorThunarVFS*) base; - thunar_vfs_monitor_remove (thunar_vfs_monitor_get_default (), self->priv->handle); - self->priv->_cancelled = TRUE; - result = TRUE; - return result; -} - - -static gboolean desktop_agnostic_vfs_file_monitor_thunar_vfs_real_get_cancelled (DesktopAgnosticVFSFileMonitor* base) { - gboolean result; - DesktopAgnosticVFSFileMonitorThunarVFS* self; - self = (DesktopAgnosticVFSFileMonitorThunarVFS*) base; - result = self->priv->_cancelled; - return result; -} - - -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_class_init (DesktopAgnosticVFSFileMonitorThunarVFSClass * klass) { - desktop_agnostic_vfs_file_monitor_thunar_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSFileMonitorThunarVFSPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_monitor_thunar_vfs_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_file_monitor_thunar_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_CANCELLED, "cancelled"); -} - - -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_desktop_agnostic_vfs_file_monitor_interface_init (DesktopAgnosticVFSFileMonitorIface * iface) { - desktop_agnostic_vfs_file_monitor_thunar_vfs_desktop_agnostic_vfs_file_monitor_parent_iface = g_type_interface_peek_parent (iface); - iface->emit = desktop_agnostic_vfs_file_monitor_thunar_vfs_real_emit; - iface->cancel = desktop_agnostic_vfs_file_monitor_thunar_vfs_real_cancel; - iface->get_cancelled = desktop_agnostic_vfs_file_monitor_thunar_vfs_real_get_cancelled; -} - - -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_instance_init (DesktopAgnosticVFSFileMonitorThunarVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSFileMonitorThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS (obj); - _g_object_unref0 (self->priv->file); - G_OBJECT_CLASS (desktop_agnostic_vfs_file_monitor_thunar_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type (void) { - static GType desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id = 0; - if (desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSFileMonitorThunarVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_file_monitor_thunar_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSFileMonitorThunarVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_file_monitor_thunar_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_file_monitor_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_file_monitor_thunar_vfs_desktop_agnostic_vfs_file_monitor_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSFileMonitorThunarVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, &desktop_agnostic_vfs_file_monitor_info); - } - return desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id; -} - - -static void desktop_agnostic_vfs_file_monitor_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSFileMonitorThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_CANCELLED: - g_value_set_boolean (value, desktop_agnostic_vfs_file_monitor_get_cancelled ((DesktopAgnosticVFSFileMonitor*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-glob.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-glob.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-glob.c 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-glob.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,445 +0,0 @@ -/* vfs-glob.c generated by valac, the Vala compiler - * generated from vfs-glob.vala, do not modify */ - -/* - * Desktop Agnostic Library: glob() wrapper. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GLOB (desktop_agnostic_vfs_glob_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GLOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, DesktopAgnosticVFSGlob)) -#define DESKTOP_AGNOSTIC_VFS_GLOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, DesktopAgnosticVFSGlobClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GLOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB)) -#define DESKTOP_AGNOSTIC_VFS_IS_GLOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB)) -#define DESKTOP_AGNOSTIC_VFS_GLOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, DesktopAgnosticVFSGlobClass)) - -typedef struct _DesktopAgnosticVFSGlob DesktopAgnosticVFSGlob; -typedef struct _DesktopAgnosticVFSGlobClass DesktopAgnosticVFSGlobClass; -typedef struct _DesktopAgnosticVFSGlobPrivate DesktopAgnosticVFSGlobPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -typedef enum { - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOSPACE, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_ABORTED, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOMATCH, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_BAD_PATTERN, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_BAD_FLAGS, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_ERRNO -} DesktopAgnosticVFSGlobError; -#define DESKTOP_AGNOSTIC_VFS_GLOB_ERROR desktop_agnostic_vfs_glob_error_quark () -struct _DesktopAgnosticVFSGlob { - GObject parent_instance; - DesktopAgnosticVFSGlobPrivate * priv; -}; - -struct _DesktopAgnosticVFSGlobClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSGlobPrivate { - glob_t glob; - char* _pattern; - gint _flags; -}; - - -static gpointer desktop_agnostic_vfs_glob_parent_class = NULL; - -GQuark desktop_agnostic_vfs_glob_error_quark (void); -GType desktop_agnostic_vfs_glob_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_GLOB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, DesktopAgnosticVFSGlobPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_GLOB_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_GLOB_OFFSET, - DESKTOP_AGNOSTIC_VFS_GLOB_PATTERN, - DESKTOP_AGNOSTIC_VFS_GLOB_FLAGS -}; -static void desktop_agnostic_vfs_glob_run_glob (DesktopAgnosticVFSGlob* self, const char* pattern, gint flags, GError** error); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_execute (const char* pattern, GError** error); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_execute_with_flags (const char* pattern, gint flags, GError** error); -void desktop_agnostic_vfs_glob_append (DesktopAgnosticVFSGlob* self, const char* pattern, GError** error); -char** desktop_agnostic_vfs_glob_get_paths (DesktopAgnosticVFSGlob* self, int* result_length1); -static gint desktop_agnostic_vfs_glob_on_glob_error (const char* path, gint eerrno); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_new (void); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_construct (GType object_type); -gsize desktop_agnostic_vfs_glob_get_offset (DesktopAgnosticVFSGlob* self); -const char* desktop_agnostic_vfs_glob_get_pattern (DesktopAgnosticVFSGlob* self); -void desktop_agnostic_vfs_glob_set_pattern (DesktopAgnosticVFSGlob* self, const char* value); -gint desktop_agnostic_vfs_glob_get_flags (DesktopAgnosticVFSGlob* self); -void desktop_agnostic_vfs_glob_set_flags (DesktopAgnosticVFSGlob* self, gint value); -static void desktop_agnostic_vfs_glob_finalize (GObject* obj); -static void desktop_agnostic_vfs_glob_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_glob_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -GQuark desktop_agnostic_vfs_glob_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_vfs_glob_error-quark"); -} - - -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_execute (const char* pattern, GError** error) { - DesktopAgnosticVFSGlob* result; - GError * _inner_error_; - DesktopAgnosticVFSGlob* g; - g_return_val_if_fail (pattern != NULL, NULL); - _inner_error_ = NULL; - g = DESKTOP_AGNOSTIC_VFS_GLOB (g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, "pattern", pattern, NULL)); - desktop_agnostic_vfs_glob_run_glob (g, g->priv->_pattern, g->priv->_flags, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (g); - return NULL; - } else { - _g_object_unref0 (g); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - result = g; - return result; -} - - -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_execute_with_flags (const char* pattern, gint flags, GError** error) { - DesktopAgnosticVFSGlob* result; - GError * _inner_error_; - DesktopAgnosticVFSGlob* g; - g_return_val_if_fail (pattern != NULL, NULL); - _inner_error_ = NULL; - g = DESKTOP_AGNOSTIC_VFS_GLOB (g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, "pattern", pattern, "flags", flags, NULL)); - desktop_agnostic_vfs_glob_run_glob (g, g->priv->_pattern, g->priv->_flags, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (g); - return NULL; - } else { - _g_object_unref0 (g); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - } - result = g; - return result; -} - - -void desktop_agnostic_vfs_glob_append (DesktopAgnosticVFSGlob* self, const char* pattern, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (pattern != NULL); - _inner_error_ = NULL; - desktop_agnostic_vfs_glob_run_glob (self, pattern, self->priv->_flags | GLOB_APPEND, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } -} - - -char** desktop_agnostic_vfs_glob_get_paths (DesktopAgnosticVFSGlob* self, int* result_length1) { - char** result; - char** _tmp0_; - g_return_val_if_fail (self != NULL, NULL); - result = (_tmp0_ = self->priv->glob.gl_pathv, *result_length1 = self->priv->glob.gl_pathc, _tmp0_); - return result; -} - - -static void desktop_agnostic_vfs_glob_run_glob (DesktopAgnosticVFSGlob* self, const char* pattern, gint flags, GError** error) { - GError * _inner_error_; - glob_t _tmp2_; - gint _tmp1_; - glob_t _tmp0_ = {0}; - gint res; - g_return_if_fail (self != NULL); - g_return_if_fail (pattern != NULL); - _inner_error_ = NULL; - res = (_tmp1_ = glob (pattern, flags, (void*) desktop_agnostic_vfs_glob_on_glob_error, &_tmp0_), self->priv->glob = (_tmp2_ = _tmp0_, globfree (&self->priv->glob), _tmp2_), _tmp1_); - if (res != 0) { - switch (res) { - case GLOB_NOSPACE: - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOSPACE, "Ran out of memory."); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - case GLOB_ABORTED: - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_ABORTED, "Read error."); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - case GLOB_NOMATCH: - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOMATCH, "No matches found."); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - default: - { - g_critical ("vfs-glob.vala:126: Unknown error code: %d", res); - break; - } - } - } -} - - -static gint desktop_agnostic_vfs_glob_on_glob_error (const char* path, gint eerrno) { - gint result; - GError * _inner_error_; - g_return_val_if_fail (path != NULL, 0); - _inner_error_ = NULL; - switch (eerrno) { - case EACCES: - case EBADF: - case EMFILE: - case ENFILE: - case ENOENT: - case ENOMEM: - case ENOTDIR: - case EFAULT: - case EINVAL: - case ELOOP: - case ENAMETOOLONG: - { - _inner_error_ = g_error_new (DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_ERRNO, "Miscellaneous error for '%s' (%d): %s", path, eerrno, strerror (eerrno)); - { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - } - default: - { - g_critical ("vfs-glob.vala:151: Unknown error code: %d", eerrno); - break; - } - } - result = 1; - return result; -} - - -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_construct (GType object_type) { - DesktopAgnosticVFSGlob * self; - self = (DesktopAgnosticVFSGlob*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_new (void) { - return desktop_agnostic_vfs_glob_construct (DESKTOP_AGNOSTIC_VFS_TYPE_GLOB); -} - - -gsize desktop_agnostic_vfs_glob_get_offset (DesktopAgnosticVFSGlob* self) { - gsize result; - g_return_val_if_fail (self != NULL, 0UL); - result = self->priv->glob.gl_offs; - return result; -} - - -const char* desktop_agnostic_vfs_glob_get_pattern (DesktopAgnosticVFSGlob* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_pattern; - return result; -} - - -void desktop_agnostic_vfs_glob_set_pattern (DesktopAgnosticVFSGlob* self, const char* value) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (_vala_strcmp0 (value, "") != 0) { - char* _tmp0_; - self->priv->_pattern = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_pattern), _tmp0_); - } else { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_BAD_PATTERN, "Invalid pattern."); - { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - g_object_notify ((GObject *) self, "pattern"); -} - - -gint desktop_agnostic_vfs_glob_get_flags (DesktopAgnosticVFSGlob* self) { - gint result; - g_return_val_if_fail (self != NULL, 0); - result = self->priv->_flags; - return result; -} - - -void desktop_agnostic_vfs_glob_set_flags (DesktopAgnosticVFSGlob* self, gint value) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (value >= 0) { - self->priv->_flags = value; - } else { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_BAD_FLAGS, "Invalid flags."); - { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - g_object_notify ((GObject *) self, "flags"); -} - - -static void desktop_agnostic_vfs_glob_class_init (DesktopAgnosticVFSGlobClass * klass) { - desktop_agnostic_vfs_glob_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSGlobPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_glob_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_glob_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_glob_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GLOB_OFFSET, g_param_spec_ulong ("offset", "offset", "offset", 0, G_MAXULONG, 0UL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GLOB_PATTERN, g_param_spec_string ("pattern", "pattern", "pattern", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GLOB_FLAGS, g_param_spec_int ("flags", "flags", "flags", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); -} - - -static void desktop_agnostic_vfs_glob_instance_init (DesktopAgnosticVFSGlob * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_GLOB_GET_PRIVATE (self); - self->priv->_flags = (GLOB_MARK | GLOB_BRACE) | GLOB_TILDE_CHECK; -} - - -static void desktop_agnostic_vfs_glob_finalize (GObject* obj) { - DesktopAgnosticVFSGlob * self; - self = DESKTOP_AGNOSTIC_VFS_GLOB (obj); - globfree (&self->priv->glob); - _g_free0 (self->priv->_pattern); - G_OBJECT_CLASS (desktop_agnostic_vfs_glob_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_glob_get_type (void) { - static GType desktop_agnostic_vfs_glob_type_id = 0; - if (desktop_agnostic_vfs_glob_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSGlobClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_glob_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSGlob), 0, (GInstanceInitFunc) desktop_agnostic_vfs_glob_instance_init, NULL }; - desktop_agnostic_vfs_glob_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSGlob", &g_define_type_info, 0); - } - return desktop_agnostic_vfs_glob_type_id; -} - - -static void desktop_agnostic_vfs_glob_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSGlob * self; - self = DESKTOP_AGNOSTIC_VFS_GLOB (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_GLOB_OFFSET: - g_value_set_ulong (value, desktop_agnostic_vfs_glob_get_offset (self)); - break; - case DESKTOP_AGNOSTIC_VFS_GLOB_PATTERN: - g_value_set_string (value, desktop_agnostic_vfs_glob_get_pattern (self)); - break; - case DESKTOP_AGNOSTIC_VFS_GLOB_FLAGS: - g_value_set_int (value, desktop_agnostic_vfs_glob_get_flags (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_glob_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSGlob * self; - self = DESKTOP_AGNOSTIC_VFS_GLOB (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_GLOB_PATTERN: - desktop_agnostic_vfs_glob_set_pattern (self, g_value_get_string (value)); - break; - case DESKTOP_AGNOSTIC_VFS_GLOB_FLAGS: - desktop_agnostic_vfs_glob_set_flags (self, g_value_get_int (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs.h libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs.h --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs.h 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,346 +0,0 @@ -/* vfs.h generated by valac, the Vala compiler, do not modify */ - - -#ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_VFS_H__ -#define __DEFAULT_LIBDESKTOP_AGNOSTIC_VFS_H__ - -#include -#include -#include -#include - -G_BEGIN_DECLS - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION (desktop_agnostic_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_IS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementationIface)) - -typedef struct _DesktopAgnosticVFSImplementation DesktopAgnosticVFSImplementation; -typedef struct _DesktopAgnosticVFSImplementationIface DesktopAgnosticVFSImplementationIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE (desktop_agnostic_vfs_file_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFile)) -#define DESKTOP_AGNOSTIC_VFS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) - -typedef struct _DesktopAgnosticVFSFile DesktopAgnosticVFSFile; -typedef struct _DesktopAgnosticVFSFileClass DesktopAgnosticVFSFileClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR (desktop_agnostic_vfs_volume_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitorIface)) - -typedef struct _DesktopAgnosticVFSVolumeMonitor DesktopAgnosticVFSVolumeMonitor; -typedef struct _DesktopAgnosticVFSVolumeMonitorIface DesktopAgnosticVFSVolumeMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME (desktop_agnostic_vfs_volume_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolume)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolumeIface)) - -typedef struct _DesktopAgnosticVFSVolume DesktopAgnosticVFSVolume; -typedef struct _DesktopAgnosticVFSVolumeIface DesktopAgnosticVFSVolumeIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK (desktop_agnostic_vfs_bookmark_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK, DesktopAgnosticVFSBookmark)) -#define DESKTOP_AGNOSTIC_VFS_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK, DesktopAgnosticVFSBookmarkClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK)) -#define DESKTOP_AGNOSTIC_VFS_IS_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK)) -#define DESKTOP_AGNOSTIC_VFS_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_BOOKMARK, DesktopAgnosticVFSBookmarkClass)) - -typedef struct _DesktopAgnosticVFSBookmark DesktopAgnosticVFSBookmark; -typedef struct _DesktopAgnosticVFSBookmarkClass DesktopAgnosticVFSBookmarkClass; -typedef struct _DesktopAgnosticVFSBookmarkPrivate DesktopAgnosticVFSBookmarkPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS (desktop_agnostic_vfs_gtk_bookmarks_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, DesktopAgnosticVFSGtkBookmarks)) -#define DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, DesktopAgnosticVFSGtkBookmarksClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GTK_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS)) -#define DESKTOP_AGNOSTIC_VFS_IS_GTK_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS)) -#define DESKTOP_AGNOSTIC_VFS_GTK_BOOKMARKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GTK_BOOKMARKS, DesktopAgnosticVFSGtkBookmarksClass)) - -typedef struct _DesktopAgnosticVFSGtkBookmarks DesktopAgnosticVFSGtkBookmarks; -typedef struct _DesktopAgnosticVFSGtkBookmarksClass DesktopAgnosticVFSGtkBookmarksClass; -typedef struct _DesktopAgnosticVFSGtkBookmarksPrivate DesktopAgnosticVFSGtkBookmarksPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_TYPE (desktop_agnostic_vfs_file_type_get_type ()) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_ACCESS_FLAGS (desktop_agnostic_vfs_access_flags_get_type ()) -typedef struct _DesktopAgnosticVFSFilePrivate DesktopAgnosticVFSFilePrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR (desktop_agnostic_vfs_file_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR, DesktopAgnosticVFSFileMonitorIface)) - -typedef struct _DesktopAgnosticVFSFileMonitor DesktopAgnosticVFSFileMonitor; -typedef struct _DesktopAgnosticVFSFileMonitorIface DesktopAgnosticVFSFileMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_EVENT (desktop_agnostic_vfs_file_monitor_event_get_type ()) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GLOB (desktop_agnostic_vfs_glob_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GLOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, DesktopAgnosticVFSGlob)) -#define DESKTOP_AGNOSTIC_VFS_GLOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, DesktopAgnosticVFSGlobClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GLOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB)) -#define DESKTOP_AGNOSTIC_VFS_IS_GLOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB)) -#define DESKTOP_AGNOSTIC_VFS_GLOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, DesktopAgnosticVFSGlobClass)) - -typedef struct _DesktopAgnosticVFSGlob DesktopAgnosticVFSGlob; -typedef struct _DesktopAgnosticVFSGlobClass DesktopAgnosticVFSGlobClass; -typedef struct _DesktopAgnosticVFSGlobPrivate DesktopAgnosticVFSGlobPrivate; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH (desktop_agnostic_vfs_trash_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, DesktopAgnosticVFSTrash)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, DesktopAgnosticVFSTrashIface)) - -typedef struct _DesktopAgnosticVFSTrash DesktopAgnosticVFSTrash; -typedef struct _DesktopAgnosticVFSTrashIface DesktopAgnosticVFSTrashIface; - -typedef void (*DesktopAgnosticVFSVolumeCallback) (void* user_data); -typedef enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT -} DesktopAgnosticVFSVolumeError; -#define DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR desktop_agnostic_vfs_volume_error_quark () -struct _DesktopAgnosticVFSVolumeIface { - GTypeInterface parent_iface; - gboolean (*is_mounted) (DesktopAgnosticVFSVolume* self); - void (*mount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*mount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - void (*unmount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*unmount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - gboolean (*can_eject) (DesktopAgnosticVFSVolume* self); - void (*eject) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*eject_finish) (DesktopAgnosticVFSVolume* self, GError** error); - const char* (*get_name) (DesktopAgnosticVFSVolume* self); - DesktopAgnosticVFSFile* (*get_uri) (DesktopAgnosticVFSVolume* self); - char* (*get_icon) (DesktopAgnosticVFSVolume* self); -}; - -struct _DesktopAgnosticVFSVolumeMonitorIface { - GTypeInterface parent_iface; - void* (*get_implementation) (DesktopAgnosticVFSVolumeMonitor* self); - GList* (*get_volumes) (DesktopAgnosticVFSVolumeMonitor* self); -}; - -struct _DesktopAgnosticVFSImplementationIface { - GTypeInterface parent_iface; - void (*init) (DesktopAgnosticVFSImplementation* self); - GSList* (*files_from_uri_list) (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error); - DesktopAgnosticVFSVolumeMonitor* (*volume_monitor_get_default) (DesktopAgnosticVFSImplementation* self); - void (*shutdown) (DesktopAgnosticVFSImplementation* self); - const char* (*get_name) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_monitor_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_trash_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_volume_type) (DesktopAgnosticVFSImplementation* self); -}; - -struct _DesktopAgnosticVFSBookmark { - GObject parent_instance; - DesktopAgnosticVFSBookmarkPrivate * priv; -}; - -struct _DesktopAgnosticVFSBookmarkClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSGtkBookmarks { - GObject parent_instance; - DesktopAgnosticVFSGtkBookmarksPrivate * priv; -}; - -struct _DesktopAgnosticVFSGtkBookmarksClass { - GObjectClass parent_class; -}; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_ERROR_FILE_NOT_FOUND, - DESKTOP_AGNOSTIC_VFS_FILE_ERROR_EXISTS, - DESKTOP_AGNOSTIC_VFS_FILE_ERROR_INVALID_TYPE -} DesktopAgnosticVFSFileError; -#define DESKTOP_AGNOSTIC_VFS_FILE_ERROR desktop_agnostic_vfs_file_error_quark () -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN = 0, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK, - DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL -} DesktopAgnosticVFSFileType; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE = 0, - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ = 1 << 0, - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE = 1 << 1, - DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE = 1 << 2 -} DesktopAgnosticVFSAccessFlags; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN = 0, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED, - DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED -} DesktopAgnosticVFSFileMonitorEvent; - -struct _DesktopAgnosticVFSFileMonitorIface { - GTypeInterface parent_iface; - void (*emit) (DesktopAgnosticVFSFileMonitor* self, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); - gboolean (*cancel) (DesktopAgnosticVFSFileMonitor* self); - gboolean (*get_cancelled) (DesktopAgnosticVFSFileMonitor* self); -}; - -struct _DesktopAgnosticVFSFile { - GObject parent_instance; - DesktopAgnosticVFSFilePrivate * priv; -}; - -struct _DesktopAgnosticVFSFileClass { - GObjectClass parent_class; - void (*init) (DesktopAgnosticVFSFile* self, const char* uri); - gboolean (*exists) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSFileMonitor* (*monitor) (DesktopAgnosticVFSFile* self); - gboolean (*load_contents) (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error); - gboolean (*replace_contents) (DesktopAgnosticVFSFile* self, const char* contents, GError** error); - gboolean (*launch) (DesktopAgnosticVFSFile* self, GError** error); - GSList* (*enumerate_children) (DesktopAgnosticVFSFile* self, GError** error); - gboolean (*copy) (DesktopAgnosticVFSFile* self, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); - gboolean (*remove) (DesktopAgnosticVFSFile* self, GError** error); - void* (*get_implementation) (DesktopAgnosticVFSFile* self); - char* (*get_impl_uri) (DesktopAgnosticVFSFile* self); - char* (*get_impl_path) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSFileType (*get_file_type) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSAccessFlags (*get_access_flags) (DesktopAgnosticVFSFile* self); - DesktopAgnosticVFSFile* (*get_parent) (DesktopAgnosticVFSFile* self); -}; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOSPACE, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_ABORTED, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOMATCH, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_BAD_PATTERN, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_BAD_FLAGS, - DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_ERRNO -} DesktopAgnosticVFSGlobError; -#define DESKTOP_AGNOSTIC_VFS_GLOB_ERROR desktop_agnostic_vfs_glob_error_quark () -struct _DesktopAgnosticVFSGlob { - GObject parent_instance; - DesktopAgnosticVFSGlobPrivate * priv; -}; - -struct _DesktopAgnosticVFSGlobClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSTrashIface { - GTypeInterface parent_iface; - void (*send_to_trash) (DesktopAgnosticVFSTrash* self, DesktopAgnosticVFSFile* file, GError** error); - void (*empty) (DesktopAgnosticVFSTrash* self); - guint (*get_file_count) (DesktopAgnosticVFSTrash* self); -}; - - -GType desktop_agnostic_vfs_file_get_type (void); -GQuark desktop_agnostic_vfs_volume_error_quark (void); -GType desktop_agnostic_vfs_volume_get_type (void); -GType desktop_agnostic_vfs_volume_monitor_get_type (void); -GType desktop_agnostic_vfs_implementation_get_type (void); -void desktop_agnostic_vfs_implementation_init (DesktopAgnosticVFSImplementation* self); -GSList* desktop_agnostic_vfs_implementation_files_from_uri_list (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error); -DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_implementation_volume_monitor_get_default (DesktopAgnosticVFSImplementation* self); -void desktop_agnostic_vfs_implementation_shutdown (DesktopAgnosticVFSImplementation* self); -const char* desktop_agnostic_vfs_implementation_get_name (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_file_type (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_file_monitor_type (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_trash_type (DesktopAgnosticVFSImplementation* self); -GType desktop_agnostic_vfs_implementation_get_volume_type (DesktopAgnosticVFSImplementation* self); -DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error); -void desktop_agnostic_vfs_init (GError** error); -void desktop_agnostic_vfs_shutdown (GError** error); -GSList* desktop_agnostic_vfs_files_from_uri_list (const char* uri_list, GError** error); -GType desktop_agnostic_vfs_bookmark_get_type (void); -DesktopAgnosticVFSBookmark* desktop_agnostic_vfs_bookmark_new (void); -DesktopAgnosticVFSBookmark* desktop_agnostic_vfs_bookmark_construct (GType object_type); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_bookmark_get_file (DesktopAgnosticVFSBookmark* self); -void desktop_agnostic_vfs_bookmark_set_file (DesktopAgnosticVFSBookmark* self, DesktopAgnosticVFSFile* value); -const char* desktop_agnostic_vfs_bookmark_get_alias (DesktopAgnosticVFSBookmark* self); -void desktop_agnostic_vfs_bookmark_set_alias (DesktopAgnosticVFSBookmark* self, const char* value); -GType desktop_agnostic_vfs_gtk_bookmarks_get_type (void); -DesktopAgnosticVFSGtkBookmarks* desktop_agnostic_vfs_gtk_bookmarks_new (DesktopAgnosticVFSFile* file, gboolean monitor); -DesktopAgnosticVFSGtkBookmarks* desktop_agnostic_vfs_gtk_bookmarks_construct (GType object_type, DesktopAgnosticVFSFile* file, gboolean monitor); -GSList* desktop_agnostic_vfs_gtk_bookmarks_get_bookmarks (DesktopAgnosticVFSGtkBookmarks* self); -GQuark desktop_agnostic_vfs_file_error_quark (void); -GType desktop_agnostic_vfs_file_type_get_type (void); -GType desktop_agnostic_vfs_access_flags_get_type (void); -GType desktop_agnostic_vfs_file_monitor_event_get_type (void); -GType desktop_agnostic_vfs_file_monitor_get_type (void); -void desktop_agnostic_vfs_file_init (DesktopAgnosticVFSFile* self, const char* uri); -gboolean desktop_agnostic_vfs_file_exists (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_is_readable (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_is_writable (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_is_executable (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_monitor (DesktopAgnosticVFSFile* self); -gboolean desktop_agnostic_vfs_file_load_contents (DesktopAgnosticVFSFile* self, char** contents, gsize* length, GError** error); -gboolean desktop_agnostic_vfs_file_replace_contents (DesktopAgnosticVFSFile* self, const char* contents, GError** error); -gboolean desktop_agnostic_vfs_file_launch (DesktopAgnosticVFSFile* self, GError** error); -GSList* desktop_agnostic_vfs_file_enumerate_children (DesktopAgnosticVFSFile* self, GError** error); -gboolean desktop_agnostic_vfs_file_copy (DesktopAgnosticVFSFile* self, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error); -gboolean desktop_agnostic_vfs_file_remove (DesktopAgnosticVFSFile* self, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_construct (GType object_type); -void* desktop_agnostic_vfs_file_get_implementation (DesktopAgnosticVFSFile* self); -char* desktop_agnostic_vfs_file_get_impl_uri (DesktopAgnosticVFSFile* self); -char* desktop_agnostic_vfs_file_get_uri (DesktopAgnosticVFSFile* self); -char* desktop_agnostic_vfs_file_get_impl_path (DesktopAgnosticVFSFile* self); -char* desktop_agnostic_vfs_file_get_path (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSFileType desktop_agnostic_vfs_file_get_file_type (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_get_access_flags (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_get_parent (DesktopAgnosticVFSFile* self); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_path (const char* path, GError** error); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_uri (const char* uri, GError** error); -void desktop_agnostic_vfs_file_monitor_emit (DesktopAgnosticVFSFileMonitor* self, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); -gboolean desktop_agnostic_vfs_file_monitor_cancel (DesktopAgnosticVFSFileMonitor* self); -gboolean desktop_agnostic_vfs_file_monitor_get_cancelled (DesktopAgnosticVFSFileMonitor* self); -GQuark desktop_agnostic_vfs_glob_error_quark (void); -GType desktop_agnostic_vfs_glob_get_type (void); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_execute (const char* pattern, GError** error); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_execute_with_flags (const char* pattern, gint flags, GError** error); -void desktop_agnostic_vfs_glob_append (DesktopAgnosticVFSGlob* self, const char* pattern, GError** error); -char** desktop_agnostic_vfs_glob_get_paths (DesktopAgnosticVFSGlob* self, int* result_length1); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_new (void); -DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_construct (GType object_type); -gsize desktop_agnostic_vfs_glob_get_offset (DesktopAgnosticVFSGlob* self); -const char* desktop_agnostic_vfs_glob_get_pattern (DesktopAgnosticVFSGlob* self); -void desktop_agnostic_vfs_glob_set_pattern (DesktopAgnosticVFSGlob* self, const char* value); -gint desktop_agnostic_vfs_glob_get_flags (DesktopAgnosticVFSGlob* self); -void desktop_agnostic_vfs_glob_set_flags (DesktopAgnosticVFSGlob* self, gint value); -GType desktop_agnostic_vfs_trash_get_type (void); -void desktop_agnostic_vfs_trash_send_to_trash (DesktopAgnosticVFSTrash* self, DesktopAgnosticVFSFile* file, GError** error); -void desktop_agnostic_vfs_trash_empty (DesktopAgnosticVFSTrash* self); -guint desktop_agnostic_vfs_trash_get_file_count (DesktopAgnosticVFSTrash* self); -DesktopAgnosticVFSTrash* desktop_agnostic_vfs_trash_get_default (GError** error); -gboolean desktop_agnostic_vfs_volume_is_mounted (DesktopAgnosticVFSVolume* self); -void desktop_agnostic_vfs_volume_mount (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -gboolean desktop_agnostic_vfs_volume_mount_finish (DesktopAgnosticVFSVolume* self, GError** error); -void desktop_agnostic_vfs_volume_unmount (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -gboolean desktop_agnostic_vfs_volume_unmount_finish (DesktopAgnosticVFSVolume* self, GError** error); -gboolean desktop_agnostic_vfs_volume_can_eject (DesktopAgnosticVFSVolume* self); -void desktop_agnostic_vfs_volume_eject (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -gboolean desktop_agnostic_vfs_volume_eject_finish (DesktopAgnosticVFSVolume* self, GError** error); -const char* desktop_agnostic_vfs_volume_get_name (DesktopAgnosticVFSVolume* self); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_volume_get_uri (DesktopAgnosticVFSVolume* self); -char* desktop_agnostic_vfs_volume_get_icon (DesktopAgnosticVFSVolume* self); -void* desktop_agnostic_vfs_volume_monitor_get_implementation (DesktopAgnosticVFSVolumeMonitor* self); -GList* desktop_agnostic_vfs_volume_monitor_get_volumes (DesktopAgnosticVFSVolumeMonitor* self); -DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_volume_monitor_get_default (GError** error); - - -G_END_DECLS - -#endif diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-impl-gio.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-impl-gio.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-impl-gio.c 2010-04-11 07:32:15.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-impl-gio.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,395 +0,0 @@ -/* vfs-impl-gio.c generated by valac, the Vala compiler - * generated from vfs-impl-gio.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS implementation (with GIO). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION (desktop_agnostic_vfs_gio_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION, DesktopAgnosticVFSGIOImplementation)) -#define DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION, DesktopAgnosticVFSGIOImplementationClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GIO_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IS_GIO_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION, DesktopAgnosticVFSGIOImplementationClass)) - -typedef struct _DesktopAgnosticVFSGIOImplementation DesktopAgnosticVFSGIOImplementation; -typedef struct _DesktopAgnosticVFSGIOImplementationClass DesktopAgnosticVFSGIOImplementationClass; -typedef struct _DesktopAgnosticVFSGIOImplementationPrivate DesktopAgnosticVFSGIOImplementationPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO (desktop_agnostic_vfs_volume_monitor_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIOClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorGIO DesktopAgnosticVFSVolumeMonitorGIO; -typedef struct _DesktopAgnosticVFSVolumeMonitorGIOClass DesktopAgnosticVFSVolumeMonitorGIOClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO (desktop_agnostic_vfs_file_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO, DesktopAgnosticVFSFileGIOClass)) - -typedef struct _DesktopAgnosticVFSFileGIO DesktopAgnosticVFSFileGIO; -typedef struct _DesktopAgnosticVFSFileGIOClass DesktopAgnosticVFSFileGIOClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO (desktop_agnostic_vfs_file_monitor_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO, DesktopAgnosticVFSFileMonitorGIOClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGIO DesktopAgnosticVFSFileMonitorGIO; -typedef struct _DesktopAgnosticVFSFileMonitorGIOClass DesktopAgnosticVFSFileMonitorGIOClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO (desktop_agnostic_vfs_trash_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIO)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIOClass)) - -typedef struct _DesktopAgnosticVFSTrashGIO DesktopAgnosticVFSTrashGIO; -typedef struct _DesktopAgnosticVFSTrashGIOClass DesktopAgnosticVFSTrashGIOClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO (desktop_agnostic_vfs_volume_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIOClass)) - -typedef struct _DesktopAgnosticVFSVolumeGIO DesktopAgnosticVFSVolumeGIO; -typedef struct _DesktopAgnosticVFSVolumeGIOClass DesktopAgnosticVFSVolumeGIOClass; - -struct _DesktopAgnosticVFSGIOImplementation { - GObject parent_instance; - DesktopAgnosticVFSGIOImplementationPrivate * priv; -}; - -struct _DesktopAgnosticVFSGIOImplementationClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSGIOImplementationPrivate { - DesktopAgnosticVFSVolumeMonitor* vmonitor; -}; - - -static gpointer desktop_agnostic_vfs_gio_implementation_parent_class = NULL; -static DesktopAgnosticVFSImplementationIface* desktop_agnostic_vfs_gio_implementation_desktop_agnostic_vfs_implementation_parent_iface = NULL; - -GType desktop_agnostic_vfs_gio_implementation_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION, DesktopAgnosticVFSGIOImplementationPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_NAME, - DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_FILE_TYPE, - DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_FILE_MONITOR_TYPE, - DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_TRASH_TYPE, - DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_VOLUME_TYPE -}; -static void desktop_agnostic_vfs_gio_implementation_real_init (DesktopAgnosticVFSImplementation* base); -static void _g_slist_free_g_object_unref (GSList* self); -static GSList* desktop_agnostic_vfs_gio_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error); -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_new (void); -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_construct (GType object_type); -GType desktop_agnostic_vfs_volume_monitor_gio_get_type (void); -static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_gio_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base); -static void desktop_agnostic_vfs_gio_implementation_real_shutdown (DesktopAgnosticVFSImplementation* base); -DesktopAgnosticVFSGIOImplementation* desktop_agnostic_vfs_gio_implementation_new (void); -DesktopAgnosticVFSGIOImplementation* desktop_agnostic_vfs_gio_implementation_construct (GType object_type); -GType desktop_agnostic_vfs_file_gio_get_type (void); -GType desktop_agnostic_vfs_file_monitor_gio_get_type (void); -GType desktop_agnostic_vfs_trash_gio_get_type (void); -GType desktop_agnostic_vfs_volume_gio_get_type (void); -static void desktop_agnostic_vfs_gio_implementation_finalize (GObject* obj); -static void desktop_agnostic_vfs_gio_implementation_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -GType register_plugin (void); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static gint _vala_array_length (gpointer array); - - - -static void desktop_agnostic_vfs_gio_implementation_real_init (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSGIOImplementation * self; - self = (DesktopAgnosticVFSGIOImplementation*) base; -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static GSList* desktop_agnostic_vfs_gio_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error) { - DesktopAgnosticVFSGIOImplementation * self; - GSList* result; - GError * _inner_error_; - GSList* files; - char** _tmp1_; - gint uris_size; - gint uris_length1; - char** _tmp0_; - char** uris; - self = (DesktopAgnosticVFSGIOImplementation*) base; - g_return_val_if_fail (uri_list != NULL, NULL); - _inner_error_ = NULL; - files = NULL; - uris = (_tmp1_ = _tmp0_ = g_uri_list_extract_uris (uri_list), uris_length1 = _vala_array_length (_tmp0_), uris_size = uris_length1, _tmp1_); - { - char** uri_collection; - int uri_collection_length1; - int uri_it; - uri_collection = uris; - uri_collection_length1 = uris_length1; - for (uri_it = 0; uri_it < uris_length1; uri_it = uri_it + 1) { - const char* uri; - uri = uri_collection[uri_it]; - { - DesktopAgnosticVFSFile* file; - DesktopAgnosticVFSFile* _tmp2_; - file = desktop_agnostic_vfs_file_new_for_uri (uri, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (files); - uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL); - return NULL; - } - files = g_slist_append (files, (_tmp2_ = file, file = NULL, _tmp2_)); - _g_object_unref0 (file); - } - } - } - result = files; - uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL); - return result; -} - - -static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_gio_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSGIOImplementation * self; - DesktopAgnosticVFSVolumeMonitor* result; - self = (DesktopAgnosticVFSGIOImplementation*) base; - if (self->priv->vmonitor == NULL) { - DesktopAgnosticVFSVolumeMonitor* _tmp0_; - self->priv->vmonitor = (_tmp0_ = (DesktopAgnosticVFSVolumeMonitor*) desktop_agnostic_vfs_volume_monitor_gio_new (), _g_object_unref0 (self->priv->vmonitor), _tmp0_); - } - result = self->priv->vmonitor; - return result; -} - - -static void desktop_agnostic_vfs_gio_implementation_real_shutdown (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSGIOImplementation * self; - self = (DesktopAgnosticVFSGIOImplementation*) base; -} - - -DesktopAgnosticVFSGIOImplementation* desktop_agnostic_vfs_gio_implementation_construct (GType object_type) { - DesktopAgnosticVFSGIOImplementation * self; - self = (DesktopAgnosticVFSGIOImplementation*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSGIOImplementation* desktop_agnostic_vfs_gio_implementation_new (void) { - return desktop_agnostic_vfs_gio_implementation_construct (DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION); -} - - -static const char* desktop_agnostic_vfs_gio_implementation_real_get_name (DesktopAgnosticVFSImplementation* base) { - const char* result; - DesktopAgnosticVFSGIOImplementation* self; - self = (DesktopAgnosticVFSGIOImplementation*) base; - result = "GIO"; - return result; -} - - -static GType desktop_agnostic_vfs_gio_implementation_real_get_file_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGIOImplementation* self; - self = (DesktopAgnosticVFSGIOImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GIO; - return result; -} - - -static GType desktop_agnostic_vfs_gio_implementation_real_get_file_monitor_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGIOImplementation* self; - self = (DesktopAgnosticVFSGIOImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GIO; - return result; -} - - -static GType desktop_agnostic_vfs_gio_implementation_real_get_trash_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGIOImplementation* self; - self = (DesktopAgnosticVFSGIOImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO; - return result; -} - - -static GType desktop_agnostic_vfs_gio_implementation_real_get_volume_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGIOImplementation* self; - self = (DesktopAgnosticVFSGIOImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO; - return result; -} - - -static void desktop_agnostic_vfs_gio_implementation_class_init (DesktopAgnosticVFSGIOImplementationClass * klass) { - desktop_agnostic_vfs_gio_implementation_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSGIOImplementationPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_gio_implementation_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_gio_implementation_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_FILE_TYPE, "file-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_FILE_MONITOR_TYPE, "file-monitor-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_TRASH_TYPE, "trash-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_VOLUME_TYPE, "volume-type"); -} - - -static void desktop_agnostic_vfs_gio_implementation_desktop_agnostic_vfs_implementation_interface_init (DesktopAgnosticVFSImplementationIface * iface) { - desktop_agnostic_vfs_gio_implementation_desktop_agnostic_vfs_implementation_parent_iface = g_type_interface_peek_parent (iface); - iface->init = desktop_agnostic_vfs_gio_implementation_real_init; - iface->files_from_uri_list = desktop_agnostic_vfs_gio_implementation_real_files_from_uri_list; - iface->volume_monitor_get_default = desktop_agnostic_vfs_gio_implementation_real_volume_monitor_get_default; - iface->shutdown = desktop_agnostic_vfs_gio_implementation_real_shutdown; - iface->get_name = desktop_agnostic_vfs_gio_implementation_real_get_name; - iface->get_file_type = desktop_agnostic_vfs_gio_implementation_real_get_file_type; - iface->get_file_monitor_type = desktop_agnostic_vfs_gio_implementation_real_get_file_monitor_type; - iface->get_trash_type = desktop_agnostic_vfs_gio_implementation_real_get_trash_type; - iface->get_volume_type = desktop_agnostic_vfs_gio_implementation_real_get_volume_type; -} - - -static void desktop_agnostic_vfs_gio_implementation_instance_init (DesktopAgnosticVFSGIOImplementation * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_gio_implementation_finalize (GObject* obj) { - DesktopAgnosticVFSGIOImplementation * self; - self = DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION (obj); - _g_object_unref0 (self->priv->vmonitor); - G_OBJECT_CLASS (desktop_agnostic_vfs_gio_implementation_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_gio_implementation_get_type (void) { - static GType desktop_agnostic_vfs_gio_implementation_type_id = 0; - if (desktop_agnostic_vfs_gio_implementation_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSGIOImplementationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_gio_implementation_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSGIOImplementation), 0, (GInstanceInitFunc) desktop_agnostic_vfs_gio_implementation_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_implementation_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_gio_implementation_desktop_agnostic_vfs_implementation_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_gio_implementation_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSGIOImplementation", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_gio_implementation_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, &desktop_agnostic_vfs_implementation_info); - } - return desktop_agnostic_vfs_gio_implementation_type_id; -} - - -static void desktop_agnostic_vfs_gio_implementation_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSGIOImplementation * self; - self = DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_NAME: - g_value_set_string (value, desktop_agnostic_vfs_implementation_get_name ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_FILE_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_file_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_FILE_MONITOR_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_file_monitor_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_TRASH_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_trash_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GIO_IMPLEMENTATION_VOLUME_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_volume_type ((DesktopAgnosticVFSImplementation*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -GType register_plugin (void) { - GType result; - result = DESKTOP_AGNOSTIC_VFS_TYPE_GIO_IMPLEMENTATION; - return result; -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static gint _vala_array_length (gpointer array) { - int length; - length = 0; - if (array) { - while (((gpointer*) array)[length]) { - length++; - } - } - return length; -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-impl-gnome-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-impl-gnome-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-impl-gnome-vfs.c 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-impl-gnome-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,362 +0,0 @@ -/* vfs-impl-gnome-vfs.c generated by valac, the Vala compiler - * generated from vfs-impl-gnome-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS implementation (with GNOME VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION (desktop_agnostic_vfs_gnome_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION, DesktopAgnosticVFSGnomeVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION, DesktopAgnosticVFSGnomeVFSImplementationClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_GNOME_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IS_GNOME_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION, DesktopAgnosticVFSGnomeVFSImplementationClass)) - -typedef struct _DesktopAgnosticVFSGnomeVFSImplementation DesktopAgnosticVFSGnomeVFSImplementation; -typedef struct _DesktopAgnosticVFSGnomeVFSImplementationClass DesktopAgnosticVFSGnomeVFSImplementationClass; -typedef struct _DesktopAgnosticVFSGnomeVFSImplementationPrivate DesktopAgnosticVFSGnomeVFSImplementationPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS (desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFS DesktopAgnosticVFSVolumeMonitorGnomeVFS; -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSClass DesktopAgnosticVFSVolumeMonitorGnomeVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS (desktop_agnostic_vfs_file_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS, DesktopAgnosticVFSFileGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileGnomeVFS DesktopAgnosticVFSFileGnomeVFS; -typedef struct _DesktopAgnosticVFSFileGnomeVFSClass DesktopAgnosticVFSFileGnomeVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS (desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS, DesktopAgnosticVFSFileMonitorGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFS DesktopAgnosticVFSFileMonitorGnomeVFS; -typedef struct _DesktopAgnosticVFSFileMonitorGnomeVFSClass DesktopAgnosticVFSFileMonitorGnomeVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS (desktop_agnostic_vfs_trash_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSTrashGnomeVFS DesktopAgnosticVFSTrashGnomeVFS; -typedef struct _DesktopAgnosticVFSTrashGnomeVFSClass DesktopAgnosticVFSTrashGnomeVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS (desktop_agnostic_vfs_volume_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeGnomeVFS DesktopAgnosticVFSVolumeGnomeVFS; -typedef struct _DesktopAgnosticVFSVolumeGnomeVFSClass DesktopAgnosticVFSVolumeGnomeVFSClass; - -struct _DesktopAgnosticVFSGnomeVFSImplementation { - GObject parent_instance; - DesktopAgnosticVFSGnomeVFSImplementationPrivate * priv; -}; - -struct _DesktopAgnosticVFSGnomeVFSImplementationClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSGnomeVFSImplementationPrivate { - DesktopAgnosticVFSVolumeMonitor* vmonitor; -}; - - -static gpointer desktop_agnostic_vfs_gnome_vfs_implementation_parent_class = NULL; -static DesktopAgnosticVFSImplementationIface* desktop_agnostic_vfs_gnome_vfs_implementation_desktop_agnostic_vfs_implementation_parent_iface = NULL; - -GType desktop_agnostic_vfs_gnome_vfs_implementation_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION, DesktopAgnosticVFSGnomeVFSImplementationPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_NAME, - DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_FILE_TYPE, - DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_FILE_MONITOR_TYPE, - DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_TRASH_TYPE, - DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_VOLUME_TYPE -}; -static void desktop_agnostic_vfs_gnome_vfs_implementation_real_init (DesktopAgnosticVFSImplementation* base); -static void _g_slist_free_g_object_unref (GSList* self); -static GSList* desktop_agnostic_vfs_gnome_vfs_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error); -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_new (void); -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_type (void); -static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_gnome_vfs_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base); -static void desktop_agnostic_vfs_gnome_vfs_implementation_real_shutdown (DesktopAgnosticVFSImplementation* base); -DesktopAgnosticVFSGnomeVFSImplementation* desktop_agnostic_vfs_gnome_vfs_implementation_new (void); -DesktopAgnosticVFSGnomeVFSImplementation* desktop_agnostic_vfs_gnome_vfs_implementation_construct (GType object_type); -GType desktop_agnostic_vfs_file_gnome_vfs_get_type (void); -GType desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type (void); -GType desktop_agnostic_vfs_trash_gnome_vfs_get_type (void); -GType desktop_agnostic_vfs_volume_gnome_vfs_get_type (void); -static void desktop_agnostic_vfs_gnome_vfs_implementation_finalize (GObject* obj); -static void desktop_agnostic_vfs_gnome_vfs_implementation_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -GType register_plugin (void); - - - -static void desktop_agnostic_vfs_gnome_vfs_implementation_real_init (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSGnomeVFSImplementation * self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - gnome_vfs_init (); -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static GSList* desktop_agnostic_vfs_gnome_vfs_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error) { - DesktopAgnosticVFSGnomeVFSImplementation * self; - GSList* result; - GError * _inner_error_; - GSList* files; - GList* uris; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - g_return_val_if_fail (uri_list != NULL, NULL); - _inner_error_ = NULL; - files = NULL; - uris = gnome_vfs_uri_list_parse (uri_list); - { - GList* uri_collection; - GList* uri_it; - uri_collection = uris; - for (uri_it = uri_collection; uri_it != NULL; uri_it = uri_it->next) { - GnomeVFSURI* uri; - uri = (GnomeVFSURI*) uri_it->data; - { - char* uri_str; - DesktopAgnosticVFSFile* file; - DesktopAgnosticVFSFile* _tmp0_; - uri_str = g_strdup (gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE)); - file = desktop_agnostic_vfs_file_new_for_uri (uri_str, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_free0 (uri_str); - __g_slist_free_g_object_unref0 (files); - return NULL; - } - files = g_slist_append (files, (_tmp0_ = file, file = NULL, _tmp0_)); - _g_free0 (uri_str); - _g_object_unref0 (file); - } - } - } - result = files; - return result; -} - - -static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_gnome_vfs_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSGnomeVFSImplementation * self; - DesktopAgnosticVFSVolumeMonitor* result; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - if (self->priv->vmonitor == NULL) { - DesktopAgnosticVFSVolumeMonitor* _tmp0_; - self->priv->vmonitor = (_tmp0_ = (DesktopAgnosticVFSVolumeMonitor*) desktop_agnostic_vfs_volume_monitor_gnome_vfs_new (), _g_object_unref0 (self->priv->vmonitor), _tmp0_); - } - result = self->priv->vmonitor; - return result; -} - - -static void desktop_agnostic_vfs_gnome_vfs_implementation_real_shutdown (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSGnomeVFSImplementation * self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - gnome_vfs_shutdown (); -} - - -DesktopAgnosticVFSGnomeVFSImplementation* desktop_agnostic_vfs_gnome_vfs_implementation_construct (GType object_type) { - DesktopAgnosticVFSGnomeVFSImplementation * self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSGnomeVFSImplementation* desktop_agnostic_vfs_gnome_vfs_implementation_new (void) { - return desktop_agnostic_vfs_gnome_vfs_implementation_construct (DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION); -} - - -static const char* desktop_agnostic_vfs_gnome_vfs_implementation_real_get_name (DesktopAgnosticVFSImplementation* base) { - const char* result; - DesktopAgnosticVFSGnomeVFSImplementation* self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - result = "GNOME VFS"; - return result; -} - - -static GType desktop_agnostic_vfs_gnome_vfs_implementation_real_get_file_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGnomeVFSImplementation* self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_FILE_GNOME_VFS; - return result; -} - - -static GType desktop_agnostic_vfs_gnome_vfs_implementation_real_get_file_monitor_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGnomeVFSImplementation* self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_GNOME_VFS; - return result; -} - - -static GType desktop_agnostic_vfs_gnome_vfs_implementation_real_get_trash_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGnomeVFSImplementation* self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS; - return result; -} - - -static GType desktop_agnostic_vfs_gnome_vfs_implementation_real_get_volume_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSGnomeVFSImplementation* self; - self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS; - return result; -} - - -static void desktop_agnostic_vfs_gnome_vfs_implementation_class_init (DesktopAgnosticVFSGnomeVFSImplementationClass * klass) { - desktop_agnostic_vfs_gnome_vfs_implementation_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSGnomeVFSImplementationPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_gnome_vfs_implementation_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_gnome_vfs_implementation_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_FILE_TYPE, "file-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_FILE_MONITOR_TYPE, "file-monitor-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_TRASH_TYPE, "trash-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_VOLUME_TYPE, "volume-type"); -} - - -static void desktop_agnostic_vfs_gnome_vfs_implementation_desktop_agnostic_vfs_implementation_interface_init (DesktopAgnosticVFSImplementationIface * iface) { - desktop_agnostic_vfs_gnome_vfs_implementation_desktop_agnostic_vfs_implementation_parent_iface = g_type_interface_peek_parent (iface); - iface->init = desktop_agnostic_vfs_gnome_vfs_implementation_real_init; - iface->files_from_uri_list = desktop_agnostic_vfs_gnome_vfs_implementation_real_files_from_uri_list; - iface->volume_monitor_get_default = desktop_agnostic_vfs_gnome_vfs_implementation_real_volume_monitor_get_default; - iface->shutdown = desktop_agnostic_vfs_gnome_vfs_implementation_real_shutdown; - iface->get_name = desktop_agnostic_vfs_gnome_vfs_implementation_real_get_name; - iface->get_file_type = desktop_agnostic_vfs_gnome_vfs_implementation_real_get_file_type; - iface->get_file_monitor_type = desktop_agnostic_vfs_gnome_vfs_implementation_real_get_file_monitor_type; - iface->get_trash_type = desktop_agnostic_vfs_gnome_vfs_implementation_real_get_trash_type; - iface->get_volume_type = desktop_agnostic_vfs_gnome_vfs_implementation_real_get_volume_type; -} - - -static void desktop_agnostic_vfs_gnome_vfs_implementation_instance_init (DesktopAgnosticVFSGnomeVFSImplementation * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_gnome_vfs_implementation_finalize (GObject* obj) { - DesktopAgnosticVFSGnomeVFSImplementation * self; - self = DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION (obj); - _g_object_unref0 (self->priv->vmonitor); - G_OBJECT_CLASS (desktop_agnostic_vfs_gnome_vfs_implementation_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_gnome_vfs_implementation_get_type (void) { - static GType desktop_agnostic_vfs_gnome_vfs_implementation_type_id = 0; - if (desktop_agnostic_vfs_gnome_vfs_implementation_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSGnomeVFSImplementationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_gnome_vfs_implementation_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSGnomeVFSImplementation), 0, (GInstanceInitFunc) desktop_agnostic_vfs_gnome_vfs_implementation_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_implementation_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_gnome_vfs_implementation_desktop_agnostic_vfs_implementation_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_gnome_vfs_implementation_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSGnomeVFSImplementation", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_gnome_vfs_implementation_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, &desktop_agnostic_vfs_implementation_info); - } - return desktop_agnostic_vfs_gnome_vfs_implementation_type_id; -} - - -static void desktop_agnostic_vfs_gnome_vfs_implementation_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSGnomeVFSImplementation * self; - self = DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_NAME: - g_value_set_string (value, desktop_agnostic_vfs_implementation_get_name ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_FILE_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_file_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_FILE_MONITOR_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_file_monitor_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_TRASH_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_trash_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_GNOME_VFS_IMPLEMENTATION_VOLUME_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_volume_type ((DesktopAgnosticVFSImplementation*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -GType register_plugin (void) { - GType result; - result = DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION; - return result; -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-impl-thunar-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-impl-thunar-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-impl-thunar-vfs.c 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-impl-thunar-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,364 +0,0 @@ -/* vfs-impl-thunar-vfs.c generated by valac, the Vala compiler - * generated from vfs-impl-thunar-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS implementation (with Thunar VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION (desktop_agnostic_vfs_thunar_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION, DesktopAgnosticVFSThunarVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION, DesktopAgnosticVFSThunarVFSImplementationClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_THUNAR_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IS_THUNAR_VFS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION, DesktopAgnosticVFSThunarVFSImplementationClass)) - -typedef struct _DesktopAgnosticVFSThunarVFSImplementation DesktopAgnosticVFSThunarVFSImplementation; -typedef struct _DesktopAgnosticVFSThunarVFSImplementationClass DesktopAgnosticVFSThunarVFSImplementationClass; -typedef struct _DesktopAgnosticVFSThunarVFSImplementationPrivate DesktopAgnosticVFSThunarVFSImplementationPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS (desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFS DesktopAgnosticVFSVolumeMonitorThunarVFS; -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFSClass DesktopAgnosticVFSVolumeMonitorThunarVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS (desktop_agnostic_vfs_file_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS, DesktopAgnosticVFSFileThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileThunarVFS DesktopAgnosticVFSFileThunarVFS; -typedef struct _DesktopAgnosticVFSFileThunarVFSClass DesktopAgnosticVFSFileThunarVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS (desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS, DesktopAgnosticVFSFileMonitorThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFS DesktopAgnosticVFSFileMonitorThunarVFS; -typedef struct _DesktopAgnosticVFSFileMonitorThunarVFSClass DesktopAgnosticVFSFileMonitorThunarVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS (desktop_agnostic_vfs_trash_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSTrashThunarVFS DesktopAgnosticVFSTrashThunarVFS; -typedef struct _DesktopAgnosticVFSTrashThunarVFSClass DesktopAgnosticVFSTrashThunarVFSClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS (desktop_agnostic_vfs_volume_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeThunarVFS DesktopAgnosticVFSVolumeThunarVFS; -typedef struct _DesktopAgnosticVFSVolumeThunarVFSClass DesktopAgnosticVFSVolumeThunarVFSClass; - -struct _DesktopAgnosticVFSThunarVFSImplementation { - GObject parent_instance; - DesktopAgnosticVFSThunarVFSImplementationPrivate * priv; -}; - -struct _DesktopAgnosticVFSThunarVFSImplementationClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSThunarVFSImplementationPrivate { - DesktopAgnosticVFSVolumeMonitor* vmonitor; -}; - - -static gpointer desktop_agnostic_vfs_thunar_vfs_implementation_parent_class = NULL; -static DesktopAgnosticVFSImplementationIface* desktop_agnostic_vfs_thunar_vfs_implementation_desktop_agnostic_vfs_implementation_parent_iface = NULL; - -GType desktop_agnostic_vfs_thunar_vfs_implementation_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION, DesktopAgnosticVFSThunarVFSImplementationPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_NAME, - DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_FILE_TYPE, - DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_FILE_MONITOR_TYPE, - DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_TRASH_TYPE, - DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_VOLUME_TYPE -}; -static void desktop_agnostic_vfs_thunar_vfs_implementation_real_init (DesktopAgnosticVFSImplementation* base); -static void _g_slist_free_g_object_unref (GSList* self); -static GSList* desktop_agnostic_vfs_thunar_vfs_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error); -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_new (void); -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_construct (GType object_type); -GType desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_type (void); -static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_thunar_vfs_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base); -static void desktop_agnostic_vfs_thunar_vfs_implementation_real_shutdown (DesktopAgnosticVFSImplementation* base); -DesktopAgnosticVFSThunarVFSImplementation* desktop_agnostic_vfs_thunar_vfs_implementation_new (void); -DesktopAgnosticVFSThunarVFSImplementation* desktop_agnostic_vfs_thunar_vfs_implementation_construct (GType object_type); -GType desktop_agnostic_vfs_file_thunar_vfs_get_type (void); -GType desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type (void); -GType desktop_agnostic_vfs_trash_thunar_vfs_get_type (void); -GType desktop_agnostic_vfs_volume_thunar_vfs_get_type (void); -static void desktop_agnostic_vfs_thunar_vfs_implementation_finalize (GObject* obj); -static void desktop_agnostic_vfs_thunar_vfs_implementation_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -GType register_plugin (void); - - - -static void desktop_agnostic_vfs_thunar_vfs_implementation_real_init (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSThunarVFSImplementation * self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - thunar_vfs_init (); -} - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -static GSList* desktop_agnostic_vfs_thunar_vfs_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error) { - DesktopAgnosticVFSThunarVFSImplementation * self; - GSList* result; - GError * _inner_error_; - GSList* files; - GList* paths; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - g_return_val_if_fail (uri_list != NULL, NULL); - _inner_error_ = NULL; - files = NULL; - paths = thunar_vfs_path_list_from_string (uri_list, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (files); - return NULL; - } - { - GList* path_collection; - GList* path_it; - path_collection = paths; - for (path_it = path_collection; path_it != NULL; path_it = path_it->next) { - ThunarVfsPath* path; - path = (ThunarVfsPath*) path_it->data; - { - const char* uri; - DesktopAgnosticVFSFile* file; - DesktopAgnosticVFSFile* _tmp0_; - uri = thunar_vfs_path_dup_uri (path); - file = desktop_agnostic_vfs_file_new_for_uri (uri, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - __g_slist_free_g_object_unref0 (files); - return NULL; - } - files = g_slist_append (files, (_tmp0_ = file, file = NULL, _tmp0_)); - _g_object_unref0 (file); - } - } - } - result = files; - return result; -} - - -static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_thunar_vfs_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSThunarVFSImplementation * self; - DesktopAgnosticVFSVolumeMonitor* result; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - if (self->priv->vmonitor == NULL) { - DesktopAgnosticVFSVolumeMonitor* _tmp0_; - self->priv->vmonitor = (_tmp0_ = (DesktopAgnosticVFSVolumeMonitor*) desktop_agnostic_vfs_volume_monitor_thunar_vfs_new (), _g_object_unref0 (self->priv->vmonitor), _tmp0_); - } - result = self->priv->vmonitor; - return result; -} - - -static void desktop_agnostic_vfs_thunar_vfs_implementation_real_shutdown (DesktopAgnosticVFSImplementation* base) { - DesktopAgnosticVFSThunarVFSImplementation * self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - thunar_vfs_shutdown (); -} - - -DesktopAgnosticVFSThunarVFSImplementation* desktop_agnostic_vfs_thunar_vfs_implementation_construct (GType object_type) { - DesktopAgnosticVFSThunarVFSImplementation * self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSThunarVFSImplementation* desktop_agnostic_vfs_thunar_vfs_implementation_new (void) { - return desktop_agnostic_vfs_thunar_vfs_implementation_construct (DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION); -} - - -static const char* desktop_agnostic_vfs_thunar_vfs_implementation_real_get_name (DesktopAgnosticVFSImplementation* base) { - const char* result; - DesktopAgnosticVFSThunarVFSImplementation* self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - result = "Thunar VFS"; - return result; -} - - -static GType desktop_agnostic_vfs_thunar_vfs_implementation_real_get_file_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSThunarVFSImplementation* self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_FILE_THUNAR_VFS; - return result; -} - - -static GType desktop_agnostic_vfs_thunar_vfs_implementation_real_get_file_monitor_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSThunarVFSImplementation* self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_THUNAR_VFS; - return result; -} - - -static GType desktop_agnostic_vfs_thunar_vfs_implementation_real_get_trash_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSThunarVFSImplementation* self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS; - return result; -} - - -static GType desktop_agnostic_vfs_thunar_vfs_implementation_real_get_volume_type (DesktopAgnosticVFSImplementation* base) { - GType result; - DesktopAgnosticVFSThunarVFSImplementation* self; - self = (DesktopAgnosticVFSThunarVFSImplementation*) base; - result = DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS; - return result; -} - - -static void desktop_agnostic_vfs_thunar_vfs_implementation_class_init (DesktopAgnosticVFSThunarVFSImplementationClass * klass) { - desktop_agnostic_vfs_thunar_vfs_implementation_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSThunarVFSImplementationPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_thunar_vfs_implementation_get_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_thunar_vfs_implementation_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_FILE_TYPE, "file-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_FILE_MONITOR_TYPE, "file-monitor-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_TRASH_TYPE, "trash-type"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_VOLUME_TYPE, "volume-type"); -} - - -static void desktop_agnostic_vfs_thunar_vfs_implementation_desktop_agnostic_vfs_implementation_interface_init (DesktopAgnosticVFSImplementationIface * iface) { - desktop_agnostic_vfs_thunar_vfs_implementation_desktop_agnostic_vfs_implementation_parent_iface = g_type_interface_peek_parent (iface); - iface->init = desktop_agnostic_vfs_thunar_vfs_implementation_real_init; - iface->files_from_uri_list = desktop_agnostic_vfs_thunar_vfs_implementation_real_files_from_uri_list; - iface->volume_monitor_get_default = desktop_agnostic_vfs_thunar_vfs_implementation_real_volume_monitor_get_default; - iface->shutdown = desktop_agnostic_vfs_thunar_vfs_implementation_real_shutdown; - iface->get_name = desktop_agnostic_vfs_thunar_vfs_implementation_real_get_name; - iface->get_file_type = desktop_agnostic_vfs_thunar_vfs_implementation_real_get_file_type; - iface->get_file_monitor_type = desktop_agnostic_vfs_thunar_vfs_implementation_real_get_file_monitor_type; - iface->get_trash_type = desktop_agnostic_vfs_thunar_vfs_implementation_real_get_trash_type; - iface->get_volume_type = desktop_agnostic_vfs_thunar_vfs_implementation_real_get_volume_type; -} - - -static void desktop_agnostic_vfs_thunar_vfs_implementation_instance_init (DesktopAgnosticVFSThunarVFSImplementation * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_thunar_vfs_implementation_finalize (GObject* obj) { - DesktopAgnosticVFSThunarVFSImplementation * self; - self = DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION (obj); - _g_object_unref0 (self->priv->vmonitor); - G_OBJECT_CLASS (desktop_agnostic_vfs_thunar_vfs_implementation_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_thunar_vfs_implementation_get_type (void) { - static GType desktop_agnostic_vfs_thunar_vfs_implementation_type_id = 0; - if (desktop_agnostic_vfs_thunar_vfs_implementation_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSThunarVFSImplementationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_thunar_vfs_implementation_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSThunarVFSImplementation), 0, (GInstanceInitFunc) desktop_agnostic_vfs_thunar_vfs_implementation_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_implementation_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_thunar_vfs_implementation_desktop_agnostic_vfs_implementation_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_thunar_vfs_implementation_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSThunarVFSImplementation", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_thunar_vfs_implementation_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, &desktop_agnostic_vfs_implementation_info); - } - return desktop_agnostic_vfs_thunar_vfs_implementation_type_id; -} - - -static void desktop_agnostic_vfs_thunar_vfs_implementation_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSThunarVFSImplementation * self; - self = DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_NAME: - g_value_set_string (value, desktop_agnostic_vfs_implementation_get_name ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_FILE_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_file_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_FILE_MONITOR_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_file_monitor_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_TRASH_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_trash_type ((DesktopAgnosticVFSImplementation*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_THUNAR_VFS_IMPLEMENTATION_VOLUME_TYPE: - g_value_set_gtype (value, desktop_agnostic_vfs_implementation_get_volume_type ((DesktopAgnosticVFSImplementation*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -GType register_plugin (void) { - GType result; - result = DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION; - return result; -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash.c 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,198 +0,0 @@ -/* vfs-trash.c generated by valac, the Vala compiler - * generated from vfs-trash.vala, do not modify */ - -/* - * Desktop Agnostic Library: Trash interface. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH (desktop_agnostic_vfs_trash_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, DesktopAgnosticVFSTrash)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, DesktopAgnosticVFSTrashIface)) - -typedef struct _DesktopAgnosticVFSTrash DesktopAgnosticVFSTrash; -typedef struct _DesktopAgnosticVFSTrashIface DesktopAgnosticVFSTrashIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE (desktop_agnostic_vfs_file_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFile)) -#define DESKTOP_AGNOSTIC_VFS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) - -typedef struct _DesktopAgnosticVFSFile DesktopAgnosticVFSFile; -typedef struct _DesktopAgnosticVFSFileClass DesktopAgnosticVFSFileClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION (desktop_agnostic_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_IS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementationIface)) - -typedef struct _DesktopAgnosticVFSImplementation DesktopAgnosticVFSImplementation; -typedef struct _DesktopAgnosticVFSImplementationIface DesktopAgnosticVFSImplementationIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR (desktop_agnostic_vfs_volume_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitorIface)) - -typedef struct _DesktopAgnosticVFSVolumeMonitor DesktopAgnosticVFSVolumeMonitor; -typedef struct _DesktopAgnosticVFSVolumeMonitorIface DesktopAgnosticVFSVolumeMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME (desktop_agnostic_vfs_volume_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolume)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolumeIface)) - -typedef struct _DesktopAgnosticVFSVolume DesktopAgnosticVFSVolume; -typedef struct _DesktopAgnosticVFSVolumeIface DesktopAgnosticVFSVolumeIface; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -struct _DesktopAgnosticVFSTrashIface { - GTypeInterface parent_iface; - void (*send_to_trash) (DesktopAgnosticVFSTrash* self, DesktopAgnosticVFSFile* file, GError** error); - void (*empty) (DesktopAgnosticVFSTrash* self); - guint (*get_file_count) (DesktopAgnosticVFSTrash* self); -}; - -typedef void (*DesktopAgnosticVFSVolumeCallback) (void* user_data); -typedef enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT -} DesktopAgnosticVFSVolumeError; -#define DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR desktop_agnostic_vfs_volume_error_quark () -struct _DesktopAgnosticVFSVolumeIface { - GTypeInterface parent_iface; - gboolean (*is_mounted) (DesktopAgnosticVFSVolume* self); - void (*mount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*mount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - void (*unmount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*unmount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - gboolean (*can_eject) (DesktopAgnosticVFSVolume* self); - void (*eject) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*eject_finish) (DesktopAgnosticVFSVolume* self, GError** error); - const char* (*get_name) (DesktopAgnosticVFSVolume* self); - DesktopAgnosticVFSFile* (*get_uri) (DesktopAgnosticVFSVolume* self); - char* (*get_icon) (DesktopAgnosticVFSVolume* self); -}; - -struct _DesktopAgnosticVFSVolumeMonitorIface { - GTypeInterface parent_iface; - void* (*get_implementation) (DesktopAgnosticVFSVolumeMonitor* self); - GList* (*get_volumes) (DesktopAgnosticVFSVolumeMonitor* self); -}; - -struct _DesktopAgnosticVFSImplementationIface { - GTypeInterface parent_iface; - void (*init) (DesktopAgnosticVFSImplementation* self); - GSList* (*files_from_uri_list) (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error); - DesktopAgnosticVFSVolumeMonitor* (*volume_monitor_get_default) (DesktopAgnosticVFSImplementation* self); - void (*shutdown) (DesktopAgnosticVFSImplementation* self); - const char* (*get_name) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_monitor_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_trash_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_volume_type) (DesktopAgnosticVFSImplementation* self); -}; - - -extern DesktopAgnosticVFSTrash* desktop_agnostic_vfs_trash; -DesktopAgnosticVFSTrash* desktop_agnostic_vfs_trash = NULL; - -GType desktop_agnostic_vfs_file_get_type (void); -GType desktop_agnostic_vfs_trash_get_type (void); -void desktop_agnostic_vfs_trash_send_to_trash (DesktopAgnosticVFSTrash* self, DesktopAgnosticVFSFile* file, GError** error); -void desktop_agnostic_vfs_trash_empty (DesktopAgnosticVFSTrash* self); -guint desktop_agnostic_vfs_trash_get_file_count (DesktopAgnosticVFSTrash* self); -GQuark desktop_agnostic_vfs_volume_error_quark (void); -GType desktop_agnostic_vfs_volume_get_type (void); -GType desktop_agnostic_vfs_volume_monitor_get_type (void); -GType desktop_agnostic_vfs_implementation_get_type (void); -DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error); -GType desktop_agnostic_vfs_implementation_get_trash_type (DesktopAgnosticVFSImplementation* self); -DesktopAgnosticVFSTrash* desktop_agnostic_vfs_trash_get_default (GError** error); - - - -void desktop_agnostic_vfs_trash_send_to_trash (DesktopAgnosticVFSTrash* self, DesktopAgnosticVFSFile* file, GError** error) { - DESKTOP_AGNOSTIC_VFS_TRASH_GET_INTERFACE (self)->send_to_trash (self, file, error); -} - - -void desktop_agnostic_vfs_trash_empty (DesktopAgnosticVFSTrash* self) { - DESKTOP_AGNOSTIC_VFS_TRASH_GET_INTERFACE (self)->empty (self); -} - - -guint desktop_agnostic_vfs_trash_get_file_count (DesktopAgnosticVFSTrash* self) { - return DESKTOP_AGNOSTIC_VFS_TRASH_GET_INTERFACE (self)->get_file_count (self); -} - - -static void desktop_agnostic_vfs_trash_base_init (DesktopAgnosticVFSTrashIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_object_interface_install_property (iface, g_param_spec_uint ("file-count", "file-count", "file-count", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_signal_new ("file_count_changed", DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - } -} - - -GType desktop_agnostic_vfs_trash_get_type (void) { - static GType desktop_agnostic_vfs_trash_type_id = 0; - if (desktop_agnostic_vfs_trash_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSTrashIface), (GBaseInitFunc) desktop_agnostic_vfs_trash_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - desktop_agnostic_vfs_trash_type_id = g_type_register_static (G_TYPE_INTERFACE, "DesktopAgnosticVFSTrash", &g_define_type_info, 0); - g_type_interface_add_prerequisite (desktop_agnostic_vfs_trash_type_id, G_TYPE_OBJECT); - } - return desktop_agnostic_vfs_trash_type_id; -} - - -DesktopAgnosticVFSTrash* desktop_agnostic_vfs_trash_get_default (GError** error) { - DesktopAgnosticVFSTrash* result; - GError * _inner_error_; - _inner_error_ = NULL; - if (desktop_agnostic_vfs_trash == NULL) { - DesktopAgnosticVFSImplementation* vfs; - DesktopAgnosticVFSTrash* _tmp0_; - vfs = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - desktop_agnostic_vfs_trash = (_tmp0_ = DESKTOP_AGNOSTIC_VFS_TRASH (g_object_new (desktop_agnostic_vfs_implementation_get_trash_type (vfs), NULL)), _g_object_unref0 (desktop_agnostic_vfs_trash), _tmp0_); - } - result = desktop_agnostic_vfs_trash; - return result; -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash-impl-gio.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash-impl-gio.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash-impl-gio.c 2010-04-11 07:32:16.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash-impl-gio.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,401 +0,0 @@ -/* vfs-trash-impl-gio.c generated by valac, the Vala compiler - * generated from vfs-trash-impl-gio.vala, do not modify */ - -/* - * Desktop Agnostic Library: Trash implementation with GIO. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO (desktop_agnostic_vfs_trash_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIO)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIOClass)) - -typedef struct _DesktopAgnosticVFSTrashGIO DesktopAgnosticVFSTrashGIO; -typedef struct _DesktopAgnosticVFSTrashGIOClass DesktopAgnosticVFSTrashGIOClass; -typedef struct _DesktopAgnosticVFSTrashGIOPrivate DesktopAgnosticVFSTrashGIOPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) - -struct _DesktopAgnosticVFSTrashGIO { - GObject parent_instance; - DesktopAgnosticVFSTrashGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSTrashGIOClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSTrashGIOPrivate { - DesktopAgnosticVFSFile* trash; - DesktopAgnosticVFSFileMonitor* monitor; - guint _file_count; -}; - - -static gpointer desktop_agnostic_vfs_trash_gio_parent_class = NULL; -static DesktopAgnosticVFSTrashIface* desktop_agnostic_vfs_trash_gio_desktop_agnostic_vfs_trash_parent_iface = NULL; - -GType desktop_agnostic_vfs_trash_gio_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_TRASH_GIO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO, DesktopAgnosticVFSTrashGIOPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_TRASH_GIO_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_TRASH_GIO_FILE_COUNT -}; -static void desktop_agnostic_vfs_trash_gio_update_file_count (DesktopAgnosticVFSTrashGIO* self); -static void desktop_agnostic_vfs_trash_gio_on_trash_changed (DesktopAgnosticVFSTrashGIO* self, DesktopAgnosticVFSFileMonitor* monitor, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other_file, DesktopAgnosticVFSFileMonitorEvent event_type); -static void desktop_agnostic_vfs_trash_gio_on_trash_count (DesktopAgnosticVFSTrashGIO* self, GObject* obj, GAsyncResult* res); -static void _desktop_agnostic_vfs_trash_gio_on_trash_count_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); -static void desktop_agnostic_vfs_trash_gio_do_empty (DesktopAgnosticVFSTrashGIO* self, GFile* dir); -static void desktop_agnostic_vfs_trash_gio_real_send_to_trash (DesktopAgnosticVFSTrash* base, DesktopAgnosticVFSFile* uri, GError** error); -static void desktop_agnostic_vfs_trash_gio_real_empty (DesktopAgnosticVFSTrash* base); -DesktopAgnosticVFSTrashGIO* desktop_agnostic_vfs_trash_gio_new (void); -DesktopAgnosticVFSTrashGIO* desktop_agnostic_vfs_trash_gio_construct (GType object_type); -static void _desktop_agnostic_vfs_trash_gio_on_trash_changed_desktop_agnostic_vfs_file_monitor_changed (DesktopAgnosticVFSFileMonitor* _sender, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, gpointer self); -static GObject * desktop_agnostic_vfs_trash_gio_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_vfs_trash_gio_finalize (GObject* obj); -static void desktop_agnostic_vfs_trash_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static void desktop_agnostic_vfs_trash_gio_on_trash_changed (DesktopAgnosticVFSTrashGIO* self, DesktopAgnosticVFSFileMonitor* monitor, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other_file, DesktopAgnosticVFSFileMonitorEvent event_type) { - g_return_if_fail (self != NULL); - g_return_if_fail (monitor != NULL); - g_return_if_fail (file != NULL); - desktop_agnostic_vfs_trash_gio_update_file_count (self); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void _desktop_agnostic_vfs_trash_gio_on_trash_count_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) { - desktop_agnostic_vfs_trash_gio_on_trash_count (self, source_object, res); -} - - -static void desktop_agnostic_vfs_trash_gio_update_file_count (DesktopAgnosticVFSTrashGIO* self) { - GFile* dir; - g_return_if_fail (self != NULL); - dir = _g_object_ref0 (G_FILE (desktop_agnostic_vfs_file_get_implementation (self->priv->trash))); - g_file_query_info_async (dir, G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, _desktop_agnostic_vfs_trash_gio_on_trash_count_gasync_ready_callback, self); - _g_object_unref0 (dir); -} - - -static void desktop_agnostic_vfs_trash_gio_on_trash_count (DesktopAgnosticVFSTrashGIO* self, GObject* obj, GAsyncResult* res) { - GError * _inner_error_; - GFile* dir; - GFileInfo* file_info; - g_return_if_fail (self != NULL); - g_return_if_fail (res != NULL); - _inner_error_ = NULL; - dir = _g_object_ref0 (G_FILE (obj)); - file_info = NULL; - { - GFileInfo* _tmp0_; - GFileInfo* _tmp1_; - _tmp0_ = g_file_query_info_finish (dir, res, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch2_g_error; - } - file_info = (_tmp1_ = _tmp0_, _g_object_unref0 (file_info), _tmp1_); - self->priv->_file_count = (guint) g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT); - g_signal_emit_by_name ((DesktopAgnosticVFSTrash*) self, "file-count-changed"); - } - goto __finally2; - __catch2_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("vfs-trash-impl-gio.vala:86: Could not update file count: %s", err->message); - _g_error_free0 (err); - } - } - __finally2: - if (_inner_error_ != NULL) { - _g_object_unref0 (dir); - _g_object_unref0 (file_info); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _g_object_unref0 (dir); - _g_object_unref0 (file_info); -} - - -static void desktop_agnostic_vfs_trash_gio_do_empty (DesktopAgnosticVFSTrashGIO* self, GFile* dir) { - GError * _inner_error_; - GFileEnumerator* files; - GFileInfo* info; - g_return_if_fail (self != NULL); - g_return_if_fail (dir != NULL); - _inner_error_ = NULL; - files = NULL; - info = NULL; - { - char* attrs; - GFileEnumerator* _tmp0_; - GFileEnumerator* _tmp1_; - attrs = g_strdup (G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE); - _tmp0_ = g_file_enumerate_children (dir, attrs, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (attrs); - goto __catch3_g_error; - } - files = (_tmp1_ = _tmp0_, _g_object_unref0 (files), _tmp1_); - _g_free0 (attrs); - } - goto __finally3; - __catch3_g_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("vfs-trash-impl-gio.vala:106: Trash error: %s", e->message); - _g_error_free0 (e); - } - } - __finally3: - if (_inner_error_ != NULL) { - _g_object_unref0 (files); - _g_object_unref0 (info); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - if (files == NULL) { - _g_object_unref0 (files); - _g_object_unref0 (info); - return; - } - while (TRUE) { - GFileInfo* _tmp2_; - GFileInfo* _tmp3_; - GFile* child; - GFile* _tmp4_; - _tmp2_ = g_file_enumerator_next_file (files, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (files); - _g_object_unref0 (info); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - if (!((info = (_tmp3_ = _tmp2_, _g_object_unref0 (info), _tmp3_)) != NULL)) { - break; - } - child = NULL; - child = (_tmp4_ = g_file_get_child (dir, g_file_info_get_name (info)), _g_object_unref0 (child), _tmp4_); - if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) { - desktop_agnostic_vfs_trash_gio_do_empty (self, child); - } - { - g_file_delete (child, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch4_g_error; - } - } - goto __finally4; - __catch4_g_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("vfs-trash-impl-gio.vala:126: Trash error: %s", e->message); - _g_error_free0 (e); - } - } - __finally4: - if (_inner_error_ != NULL) { - _g_object_unref0 (child); - _g_object_unref0 (files); - _g_object_unref0 (info); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _g_object_unref0 (child); - } - _g_object_unref0 (files); - _g_object_unref0 (info); -} - - -static void desktop_agnostic_vfs_trash_gio_real_send_to_trash (DesktopAgnosticVFSTrash* base, DesktopAgnosticVFSFile* uri, GError** error) { - DesktopAgnosticVFSTrashGIO * self; - GError * _inner_error_; - GFile* file; - self = (DesktopAgnosticVFSTrashGIO*) base; - g_return_if_fail (uri != NULL); - _inner_error_ = NULL; - file = _g_object_ref0 (G_FILE (desktop_agnostic_vfs_file_get_implementation (uri))); - g_file_trash (file, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (file); - return; - } - _g_object_unref0 (file); -} - - -static void desktop_agnostic_vfs_trash_gio_real_empty (DesktopAgnosticVFSTrash* base) { - DesktopAgnosticVFSTrashGIO * self; - self = (DesktopAgnosticVFSTrashGIO*) base; - desktop_agnostic_vfs_trash_gio_do_empty (self, G_FILE (desktop_agnostic_vfs_file_get_implementation (self->priv->trash))); -} - - -DesktopAgnosticVFSTrashGIO* desktop_agnostic_vfs_trash_gio_construct (GType object_type) { - DesktopAgnosticVFSTrashGIO * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticVFSTrashGIO* desktop_agnostic_vfs_trash_gio_new (void) { - return desktop_agnostic_vfs_trash_gio_construct (DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GIO); -} - - -static guint desktop_agnostic_vfs_trash_gio_real_get_file_count (DesktopAgnosticVFSTrash* base) { - guint result; - DesktopAgnosticVFSTrashGIO* self; - self = (DesktopAgnosticVFSTrashGIO*) base; - result = self->priv->_file_count; - return result; -} - - -static void _desktop_agnostic_vfs_trash_gio_on_trash_changed_desktop_agnostic_vfs_file_monitor_changed (DesktopAgnosticVFSFileMonitor* _sender, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, gpointer self) { - desktop_agnostic_vfs_trash_gio_on_trash_changed (self, _sender, file, other, event); -} - - -static GObject * desktop_agnostic_vfs_trash_gio_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticVFSTrashGIO * self; - GError * _inner_error_; - parent_class = G_OBJECT_CLASS (desktop_agnostic_vfs_trash_gio_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_VFS_TRASH_GIO (obj); - _inner_error_ = NULL; - { - DesktopAgnosticVFSFile* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - DesktopAgnosticVFSFileMonitor* _tmp2_; - _tmp0_ = desktop_agnostic_vfs_file_new_for_uri ("trash://", &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - self->priv->trash = (_tmp1_ = _tmp0_, _g_object_unref0 (self->priv->trash), _tmp1_); - if (self->priv->trash == NULL) { - g_critical ("vfs-trash-impl-gio.vala:36: trash is NULL!!!!"); - } - self->priv->monitor = (_tmp2_ = desktop_agnostic_vfs_file_monitor (self->priv->trash), _g_object_unref0 (self->priv->monitor), _tmp2_); - g_signal_connect_object (self->priv->monitor, "changed", (GCallback) _desktop_agnostic_vfs_trash_gio_on_trash_changed_desktop_agnostic_vfs_file_monitor_changed, self, 0); - self->priv->_file_count = (guint) 0; - desktop_agnostic_vfs_trash_gio_update_file_count (self); - } - return obj; -} - - -static void desktop_agnostic_vfs_trash_gio_class_init (DesktopAgnosticVFSTrashGIOClass * klass) { - desktop_agnostic_vfs_trash_gio_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSTrashGIOPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_trash_gio_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_vfs_trash_gio_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_trash_gio_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_TRASH_GIO_FILE_COUNT, "file-count"); -} - - -static void desktop_agnostic_vfs_trash_gio_desktop_agnostic_vfs_trash_interface_init (DesktopAgnosticVFSTrashIface * iface) { - desktop_agnostic_vfs_trash_gio_desktop_agnostic_vfs_trash_parent_iface = g_type_interface_peek_parent (iface); - iface->send_to_trash = desktop_agnostic_vfs_trash_gio_real_send_to_trash; - iface->empty = desktop_agnostic_vfs_trash_gio_real_empty; - iface->get_file_count = desktop_agnostic_vfs_trash_gio_real_get_file_count; -} - - -static void desktop_agnostic_vfs_trash_gio_instance_init (DesktopAgnosticVFSTrashGIO * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_TRASH_GIO_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_trash_gio_finalize (GObject* obj) { - DesktopAgnosticVFSTrashGIO * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_GIO (obj); - _g_object_unref0 (self->priv->trash); - _g_object_unref0 (self->priv->monitor); - G_OBJECT_CLASS (desktop_agnostic_vfs_trash_gio_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_trash_gio_get_type (void) { - static GType desktop_agnostic_vfs_trash_gio_type_id = 0; - if (desktop_agnostic_vfs_trash_gio_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSTrashGIOClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_trash_gio_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSTrashGIO), 0, (GInstanceInitFunc) desktop_agnostic_vfs_trash_gio_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_trash_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_trash_gio_desktop_agnostic_vfs_trash_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_trash_gio_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSTrashGIO", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_trash_gio_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, &desktop_agnostic_vfs_trash_info); - } - return desktop_agnostic_vfs_trash_gio_type_id; -} - - -static void desktop_agnostic_vfs_trash_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSTrashGIO * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_GIO (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_TRASH_GIO_FILE_COUNT: - g_value_set_uint (value, desktop_agnostic_vfs_trash_get_file_count ((DesktopAgnosticVFSTrash*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash-impl-gnome-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash-impl-gnome-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash-impl-gnome-vfs.c 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash-impl-gnome-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,609 +0,0 @@ -/* vfs-trash-impl-gnome-vfs.c generated by valac, the Vala compiler - * generated from vfs-trash-impl-gnome-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: Trash implementation with GNOME VFS. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME (desktop_agnostic_vfs_trash_volume_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, DesktopAgnosticVFSTrashVolume)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, DesktopAgnosticVFSTrashVolumeClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, DesktopAgnosticVFSTrashVolumeClass)) - -typedef struct _DesktopAgnosticVFSTrashVolume DesktopAgnosticVFSTrashVolume; -typedef struct _DesktopAgnosticVFSTrashVolumeClass DesktopAgnosticVFSTrashVolumeClass; -typedef struct _DesktopAgnosticVFSTrashVolumePrivate DesktopAgnosticVFSTrashVolumePrivate; -#define _gnome_vfs_file_info_unref0(var) ((var == NULL) ? NULL : (var = (gnome_vfs_file_info_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS (desktop_agnostic_vfs_trash_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS, DesktopAgnosticVFSTrashGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSTrashGnomeVFS DesktopAgnosticVFSTrashGnomeVFS; -typedef struct _DesktopAgnosticVFSTrashGnomeVFSClass DesktopAgnosticVFSTrashGnomeVFSClass; -typedef struct _DesktopAgnosticVFSTrashGnomeVFSPrivate DesktopAgnosticVFSTrashGnomeVFSPrivate; -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) -#define _gnome_vfs_uri_unref0(var) ((var == NULL) ? NULL : (var = (gnome_vfs_uri_unref (var), NULL))) -#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -struct _DesktopAgnosticVFSTrashVolume { - GObject parent_instance; - DesktopAgnosticVFSTrashVolumePrivate * priv; -}; - -struct _DesktopAgnosticVFSTrashVolumeClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSTrashVolumePrivate { - guint _file_count; - DesktopAgnosticVFSTrash* trash; - GnomeVFSMonitorHandle* monitor; - GnomeVFSURI* _uri; -}; - -struct _DesktopAgnosticVFSTrashGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSTrashGnomeVFSPrivate * priv; - GHashTable* trash_dirs; -}; - -struct _DesktopAgnosticVFSTrashGnomeVFSClass { - GObjectClass parent_class; -}; - - -static gpointer desktop_agnostic_vfs_trash_volume_parent_class = NULL; -static gpointer desktop_agnostic_vfs_trash_gnome_vfs_parent_class = NULL; -static DesktopAgnosticVFSTrashIface* desktop_agnostic_vfs_trash_gnome_vfs_desktop_agnostic_vfs_trash_parent_iface = NULL; - -GType desktop_agnostic_vfs_trash_volume_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, DesktopAgnosticVFSTrashVolumePrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_FILE_COUNT, - DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_URI -}; -void desktop_agnostic_vfs_trash_volume_set_uri (DesktopAgnosticVFSTrashVolume* self, GnomeVFSURI* value); -DesktopAgnosticVFSTrashVolume* desktop_agnostic_vfs_trash_volume_new (DesktopAgnosticVFSTrash* trash, GnomeVFSURI* uri); -DesktopAgnosticVFSTrashVolume* desktop_agnostic_vfs_trash_volume_construct (GType object_type, DesktopAgnosticVFSTrash* trash, GnomeVFSURI* uri); -static void desktop_agnostic_vfs_trash_volume_reset_file_count (DesktopAgnosticVFSTrashVolume* self); -static void desktop_agnostic_vfs_trash_volume_update_file_count (DesktopAgnosticVFSTrashVolume* self, GnomeVFSMonitorHandle* monitor, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event_type); -GnomeVFSURI* desktop_agnostic_vfs_trash_volume_get_uri (DesktopAgnosticVFSTrashVolume* self); -static void desktop_agnostic_vfs_trash_volume_do_empty (GnomeVFSURI* dir); -static gboolean desktop_agnostic_vfs_trash_volume_visit_callback (const char* rel_path, GnomeVFSFileInfo* info, gboolean recursing_will_loop, void** data, gboolean recurse); -void desktop_agnostic_vfs_trash_volume_empty (DesktopAgnosticVFSTrashVolume* self); -guint desktop_agnostic_vfs_trash_volume_get_file_count (DesktopAgnosticVFSTrashVolume* self); -static void _desktop_agnostic_vfs_trash_volume_update_file_count_gnome_vfs_monitor_callback (GnomeVFSMonitorHandle* handle, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event_type, gpointer self); -static void desktop_agnostic_vfs_trash_volume_finalize (GObject* obj); -static void desktop_agnostic_vfs_trash_volume_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_trash_volume_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType desktop_agnostic_vfs_trash_gnome_vfs_get_type (void); -enum { - DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_FILE_COUNT -}; -static void desktop_agnostic_vfs_trash_gnome_vfs_real_send_to_trash (DesktopAgnosticVFSTrash* base, DesktopAgnosticVFSFile* uri, GError** error); -static void desktop_agnostic_vfs_trash_gnome_vfs_real_empty (DesktopAgnosticVFSTrash* base); -static void desktop_agnostic_vfs_trash_gnome_vfs_check_volume_for_trash_dir (DesktopAgnosticVFSTrashGnomeVFS* self, GnomeVFSVolumeMonitor* vm, GnomeVFSVolume* vol); -static void _desktop_agnostic_vfs_trash_gnome_vfs_check_volume_for_trash_dir_gnome_vfs_volume_monitor_volume_mounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self); -static void desktop_agnostic_vfs_trash_gnome_vfs_remove_volume (DesktopAgnosticVFSTrashGnomeVFS* self, GnomeVFSVolumeMonitor* vm, GnomeVFSVolume* vol); -static void _desktop_agnostic_vfs_trash_gnome_vfs_remove_volume_gnome_vfs_volume_monitor_volume_unmounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self); -static gboolean desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs (DesktopAgnosticVFSTrashGnomeVFS* self); -DesktopAgnosticVFSTrashGnomeVFS* desktop_agnostic_vfs_trash_gnome_vfs_new (void); -DesktopAgnosticVFSTrashGnomeVFS* desktop_agnostic_vfs_trash_gnome_vfs_construct (GType object_type); -static gboolean _desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs_gsource_func (gpointer self); -static GObject * desktop_agnostic_vfs_trash_gnome_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_vfs_trash_gnome_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_trash_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -DesktopAgnosticVFSTrashVolume* desktop_agnostic_vfs_trash_volume_construct (GType object_type, DesktopAgnosticVFSTrash* trash, GnomeVFSURI* uri) { - DesktopAgnosticVFSTrashVolume * self; - g_return_val_if_fail (trash != NULL, NULL); - g_return_val_if_fail (uri != NULL, NULL); - self = (DesktopAgnosticVFSTrashVolume*) g_object_new (object_type, NULL); - self->priv->_file_count = (guint) 0; - self->priv->trash = trash; - desktop_agnostic_vfs_trash_volume_set_uri (self, uri); - return self; -} - - -DesktopAgnosticVFSTrashVolume* desktop_agnostic_vfs_trash_volume_new (DesktopAgnosticVFSTrash* trash, GnomeVFSURI* uri) { - return desktop_agnostic_vfs_trash_volume_construct (DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_VOLUME, trash, uri); -} - - -static void desktop_agnostic_vfs_trash_volume_update_file_count (DesktopAgnosticVFSTrashVolume* self, GnomeVFSMonitorHandle* monitor, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event_type) { - gboolean _tmp0_ = FALSE; - guint old_file_count; - g_return_if_fail (self != NULL); - g_return_if_fail (monitor != NULL); - g_return_if_fail (monitor_uri != NULL); - g_return_if_fail (info_uri != NULL); - if (event_type != GNOME_VFS_MONITOR_EVENT_CREATED) { - _tmp0_ = event_type != GNOME_VFS_MONITOR_EVENT_DELETED; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - return; - } - old_file_count = self->priv->_file_count; - desktop_agnostic_vfs_trash_volume_reset_file_count (self); - if (old_file_count != self->priv->_file_count) { - g_signal_emit_by_name (self->priv->trash, "file-count-changed"); - } -} - - -static void desktop_agnostic_vfs_trash_volume_reset_file_count (DesktopAgnosticVFSTrashVolume* self) { - GnomeVFSDirectoryHandle* handle; - GnomeVFSResult res = 0; - g_return_if_fail (self != NULL); - g_message ("vfs-trash-impl-gnome-vfs.vala:91: reset_file_count"); - handle = NULL; - self->priv->_file_count = (guint) 0; - res = gnome_vfs_directory_open_from_uri (&handle, desktop_agnostic_vfs_trash_volume_get_uri (self), GNOME_VFS_FILE_INFO_NAME_ONLY); - if (res == GNOME_VFS_OK) { - GnomeVFSFileInfo* file_info; - GnomeVFSFileInfo* _tmp0_; - file_info = NULL; - file_info = (_tmp0_ = gnome_vfs_file_info_new (), _gnome_vfs_file_info_unref0 (file_info), _tmp0_); - while (TRUE) { - gboolean _tmp1_ = FALSE; - if (!((res = gnome_vfs_directory_read_next (handle, file_info)) == GNOME_VFS_OK)) { - break; - } - if (_vala_strcmp0 (file_info->name, ".") != 0) { - _tmp1_ = _vala_strcmp0 (file_info->name, "..") != 0; - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - self->priv->_file_count++; - } - } - gnome_vfs_directory_close (handle); - _gnome_vfs_file_info_unref0 (file_info); - } -} - - -static gboolean desktop_agnostic_vfs_trash_volume_visit_callback (const char* rel_path, GnomeVFSFileInfo* info, gboolean recursing_will_loop, void** data, gboolean recurse) { - gboolean result; - GnomeVFSURI* item; - g_return_val_if_fail (rel_path != NULL, FALSE); - g_return_val_if_fail (info != NULL, FALSE); - item = NULL; - item = gnome_vfs_uri_resolve_relative ((GnomeVFSURI*) (*data), rel_path); - if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) { - desktop_agnostic_vfs_trash_volume_do_empty (item); - } - gnome_vfs_unlink_from_uri (item); - result = TRUE; - return result; -} - - -static void desktop_agnostic_vfs_trash_volume_do_empty (GnomeVFSURI* dir) { - GnomeVFSResult res = 0; - g_return_if_fail (dir != NULL); - res = gnome_vfs_directory_visit_uri (dir, GNOME_VFS_FILE_INFO_DEFAULT, GNOME_VFS_DIRECTORY_VISIT_LOOPCHECK, (GnomeVFSDirectoryVisitFunc) desktop_agnostic_vfs_trash_volume_visit_callback, &dir); - if (res != GNOME_VFS_OK) { - g_warning ("vfs-trash-impl-gnome-vfs.vala:141: Error occurred: %s", gnome_vfs_result_to_string (res)); - } -} - - -void desktop_agnostic_vfs_trash_volume_empty (DesktopAgnosticVFSTrashVolume* self) { - g_return_if_fail (self != NULL); - if (self->priv->_uri == NULL) { - g_warning ("vfs-trash-impl-gnome-vfs.vala:150: URI is NULL!"); - } - desktop_agnostic_vfs_trash_volume_do_empty (self->priv->_uri); -} - - -guint desktop_agnostic_vfs_trash_volume_get_file_count (DesktopAgnosticVFSTrashVolume* self) { - guint result; - g_return_val_if_fail (self != NULL, 0U); - result = self->priv->_file_count; - return result; -} - - -GnomeVFSURI* desktop_agnostic_vfs_trash_volume_get_uri (DesktopAgnosticVFSTrashVolume* self) { - GnomeVFSURI* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_uri; - return result; -} - - -static void _desktop_agnostic_vfs_trash_volume_update_file_count_gnome_vfs_monitor_callback (GnomeVFSMonitorHandle* handle, const char* monitor_uri, const char* info_uri, GnomeVFSMonitorEventType event_type, gpointer self) { - desktop_agnostic_vfs_trash_volume_update_file_count (self, handle, monitor_uri, info_uri, event_type); -} - - -void desktop_agnostic_vfs_trash_volume_set_uri (DesktopAgnosticVFSTrashVolume* self, GnomeVFSURI* value) { - g_return_if_fail (self != NULL); - self->priv->_uri = value; - desktop_agnostic_vfs_trash_volume_reset_file_count (self); - if (self->priv->monitor == NULL) { - gnome_vfs_monitor_add (&self->priv->monitor, gnome_vfs_uri_to_string (desktop_agnostic_vfs_trash_volume_get_uri (self), GNOME_VFS_URI_HIDE_NONE), GNOME_VFS_MONITOR_DIRECTORY, _desktop_agnostic_vfs_trash_volume_update_file_count_gnome_vfs_monitor_callback, self); - } - g_object_notify ((GObject *) self, "uri"); -} - - -static void desktop_agnostic_vfs_trash_volume_class_init (DesktopAgnosticVFSTrashVolumeClass * klass) { - desktop_agnostic_vfs_trash_volume_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSTrashVolumePrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_trash_volume_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_trash_volume_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_trash_volume_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_FILE_COUNT, g_param_spec_uint ("file-count", "file-count", "file-count", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_URI, g_param_spec_pointer ("uri", "uri", "uri", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); -} - - -static void desktop_agnostic_vfs_trash_volume_instance_init (DesktopAgnosticVFSTrashVolume * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_trash_volume_finalize (GObject* obj) { - DesktopAgnosticVFSTrashVolume * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME (obj); - G_OBJECT_CLASS (desktop_agnostic_vfs_trash_volume_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_trash_volume_get_type (void) { - static GType desktop_agnostic_vfs_trash_volume_type_id = 0; - if (desktop_agnostic_vfs_trash_volume_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSTrashVolumeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_trash_volume_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSTrashVolume), 0, (GInstanceInitFunc) desktop_agnostic_vfs_trash_volume_instance_init, NULL }; - desktop_agnostic_vfs_trash_volume_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSTrashVolume", &g_define_type_info, 0); - } - return desktop_agnostic_vfs_trash_volume_type_id; -} - - -static void desktop_agnostic_vfs_trash_volume_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSTrashVolume * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_FILE_COUNT: - g_value_set_uint (value, desktop_agnostic_vfs_trash_volume_get_file_count (self)); - break; - case DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_URI: - g_value_set_pointer (value, desktop_agnostic_vfs_trash_volume_get_uri (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_trash_volume_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSTrashVolume * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_TRASH_VOLUME_URI: - desktop_agnostic_vfs_trash_volume_set_uri (self, g_value_get_pointer (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static gpointer _gnome_vfs_uri_ref0 (gpointer self) { - return self ? gnome_vfs_uri_ref (self) : NULL; -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_real_send_to_trash (DesktopAgnosticVFSTrash* base, DesktopAgnosticVFSFile* uri, GError** error) { - DesktopAgnosticVFSTrashGnomeVFS * self; - GnomeVFSURI* g_uri; - GnomeVFSURI* trash_uri; - GnomeVFSResult res = 0; - GnomeVFSURI* _tmp0_; - GnomeVFSURI* _tmp3_; - GnomeVFSResult _tmp2_; - GnomeVFSURI* _tmp1_ = NULL; - self = (DesktopAgnosticVFSTrashGnomeVFS*) base; - g_return_if_fail (uri != NULL); - g_uri = NULL; - trash_uri = NULL; - g_uri = (_tmp0_ = _gnome_vfs_uri_ref0 ((GnomeVFSURI*) desktop_agnostic_vfs_file_get_implementation (uri)), _gnome_vfs_uri_unref0 (g_uri), _tmp0_); - res = (_tmp2_ = gnome_vfs_find_directory (g_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &_tmp1_, TRUE, FALSE, (guint) 0777), trash_uri = (_tmp3_ = _gnome_vfs_uri_ref0 (_tmp1_), _gnome_vfs_uri_unref0 (trash_uri), _tmp3_), _tmp2_); - if (res == GNOME_VFS_OK) { - GnomeVFSURI* new_uri; - new_uri = _gnome_vfs_uri_ref0 (gnome_vfs_uri_append_file_name (trash_uri, gnome_vfs_uri_extract_short_path_name (g_uri))); - g_message ("vfs-trash-impl-gnome-vfs.vala:196: Moving '%s' to '%s'...", gnome_vfs_uri_to_string (g_uri, GNOME_VFS_URI_HIDE_NONE), gnome_vfs_uri_to_string (new_uri, GNOME_VFS_URI_HIDE_NONE)); - res = gnome_vfs_move_uri (g_uri, new_uri, FALSE); - if (res != GNOME_VFS_OK) { - g_warning ("vfs-trash-impl-gnome-vfs.vala:200: Error occurred: %s", gnome_vfs_result_to_string (res)); - } - _gnome_vfs_uri_unref0 (new_uri); - } else { - g_warning ("vfs-trash-impl-gnome-vfs.vala:205: Error occurred: %s", gnome_vfs_result_to_string (res)); - } - _gnome_vfs_uri_unref0 (g_uri); - _gnome_vfs_uri_unref0 (trash_uri); -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_real_empty (DesktopAgnosticVFSTrash* base) { - DesktopAgnosticVFSTrashGnomeVFS * self; - GList* values; - GList* _tmp0_; - self = (DesktopAgnosticVFSTrashGnomeVFS*) base; - values = NULL; - values = (_tmp0_ = g_hash_table_get_values (self->trash_dirs), _g_list_free0 (values), _tmp0_); - { - GList* tv_collection; - GList* tv_it; - tv_collection = values; - for (tv_it = tv_collection; tv_it != NULL; tv_it = tv_it->next) { - DesktopAgnosticVFSTrashVolume* tv; - tv = (DesktopAgnosticVFSTrashVolume*) tv_it->data; - { - desktop_agnostic_vfs_trash_volume_empty (tv); - } - } - } - _g_list_free0 (values); -} - - -static void _desktop_agnostic_vfs_trash_gnome_vfs_check_volume_for_trash_dir_gnome_vfs_volume_monitor_volume_mounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self) { - desktop_agnostic_vfs_trash_gnome_vfs_check_volume_for_trash_dir (self, _sender, volume); -} - - -static void _desktop_agnostic_vfs_trash_gnome_vfs_remove_volume_gnome_vfs_volume_monitor_volume_unmounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self) { - desktop_agnostic_vfs_trash_gnome_vfs_remove_volume (self, _sender, volume); -} - - -static gboolean desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs (DesktopAgnosticVFSTrashGnomeVFS* self) { - gboolean result; - GnomeVFSVolumeMonitor* volume_monitor; - GList* volumes; - g_return_val_if_fail (self != NULL, FALSE); - volume_monitor = NULL; - volumes = NULL; - volume_monitor = gnome_vfs_get_volume_monitor (); - volumes = gnome_vfs_volume_monitor_get_mounted_volumes (volume_monitor); - { - GList* volume_collection; - GList* volume_it; - volume_collection = volumes; - for (volume_it = volume_collection; volume_it != NULL; volume_it = volume_it->next) { - GnomeVFSVolume* volume; - volume = (GnomeVFSVolume*) volume_it->data; - { - desktop_agnostic_vfs_trash_gnome_vfs_check_volume_for_trash_dir (self, volume_monitor, volume); - } - } - } - g_signal_connect_object (volume_monitor, "volume-mounted", (GCallback) _desktop_agnostic_vfs_trash_gnome_vfs_check_volume_for_trash_dir_gnome_vfs_volume_monitor_volume_mounted, self, 0); - g_signal_connect_object (volume_monitor, "volume-unmounted", (GCallback) _desktop_agnostic_vfs_trash_gnome_vfs_remove_volume_gnome_vfs_volume_monitor_volume_unmounted, self, 0); - g_signal_emit_by_name ((DesktopAgnosticVFSTrash*) self, "file-count-changed"); - result = FALSE; - return result; -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_check_volume_for_trash_dir (DesktopAgnosticVFSTrashGnomeVFS* self, GnomeVFSVolumeMonitor* vm, GnomeVFSVolume* vol) { - g_return_if_fail (self != NULL); - g_return_if_fail (vm != NULL); - g_return_if_fail (vol != NULL); - if (gnome_vfs_volume_handles_trash (vol)) { - GnomeVFSResult res = 0; - GnomeVFSURI* uri; - GnomeVFSURI* trash_uri; - GnomeVFSURI* _tmp0_; - GnomeVFSURI* _tmp3_; - GnomeVFSResult _tmp2_; - GnomeVFSURI* _tmp1_ = NULL; - uri = NULL; - trash_uri = NULL; - uri = (_tmp0_ = gnome_vfs_uri_new (gnome_vfs_volume_get_activation_uri (vol)), _gnome_vfs_uri_unref0 (uri), _tmp0_); - res = (_tmp2_ = gnome_vfs_find_directory (uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &_tmp1_, FALSE, TRUE, (guint) 0777), trash_uri = (_tmp3_ = _gnome_vfs_uri_ref0 (_tmp1_), _gnome_vfs_uri_unref0 (trash_uri), _tmp3_), _tmp2_); - if (res == GNOME_VFS_OK) { - DesktopAgnosticVFSTrashVolume* tv; - DesktopAgnosticVFSTrashVolume* _tmp4_; - DesktopAgnosticVFSTrashVolume* _tmp5_; - tv = NULL; - tv = (_tmp4_ = desktop_agnostic_vfs_trash_volume_new ((DesktopAgnosticVFSTrash*) self, trash_uri), _g_object_unref0 (tv), _tmp4_); - g_hash_table_insert (self->trash_dirs, vol, (_tmp5_ = tv, tv = NULL, _tmp5_)); - g_message ("vfs-trash-impl-gnome-vfs.vala:254: Volume added"); - _g_object_unref0 (tv); - } - _gnome_vfs_uri_unref0 (uri); - _gnome_vfs_uri_unref0 (trash_uri); - } -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_remove_volume (DesktopAgnosticVFSTrashGnomeVFS* self, GnomeVFSVolumeMonitor* vm, GnomeVFSVolume* vol) { - g_return_if_fail (self != NULL); - g_return_if_fail (vm != NULL); - g_return_if_fail (vol != NULL); - if (((DesktopAgnosticVFSTrashVolume*) g_hash_table_lookup (self->trash_dirs, vol)) != NULL) { - g_hash_table_remove (self->trash_dirs, vol); - } -} - - -DesktopAgnosticVFSTrashGnomeVFS* desktop_agnostic_vfs_trash_gnome_vfs_construct (GType object_type) { - DesktopAgnosticVFSTrashGnomeVFS * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticVFSTrashGnomeVFS* desktop_agnostic_vfs_trash_gnome_vfs_new (void) { - return desktop_agnostic_vfs_trash_gnome_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_GNOME_VFS); -} - - -static guint desktop_agnostic_vfs_trash_gnome_vfs_real_get_file_count (DesktopAgnosticVFSTrash* base) { - guint result; - DesktopAgnosticVFSTrashGnomeVFS* self; - guint total; - GList* values; - GList* _tmp0_; - self = (DesktopAgnosticVFSTrashGnomeVFS*) base; - total = (guint) 0; - values = NULL; - values = (_tmp0_ = g_hash_table_get_values (self->trash_dirs), _g_list_free0 (values), _tmp0_); - { - GList* tv_collection; - GList* tv_it; - tv_collection = values; - for (tv_it = tv_collection; tv_it != NULL; tv_it = tv_it->next) { - DesktopAgnosticVFSTrashVolume* tv; - tv = (DesktopAgnosticVFSTrashVolume*) tv_it->data; - { - total = total + desktop_agnostic_vfs_trash_volume_get_file_count (tv); - } - } - } - result = total; - _g_list_free0 (values); - return result; -} - - -static gboolean _desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs_gsource_func (gpointer self) { - return desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs (self); -} - - -static GObject * desktop_agnostic_vfs_trash_gnome_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticVFSTrashGnomeVFS * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_vfs_trash_gnome_vfs_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS (obj); - { - GHashTable* _tmp0_; - g_message ("vfs-trash-impl-gnome-vfs.vala:162: GNOME VFS Impl."); - self->trash_dirs = (_tmp0_ = g_hash_table_new (g_direct_hash, g_direct_equal), _g_hash_table_unref0 (self->trash_dirs), _tmp0_); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs_gsource_func, g_object_ref (self), g_object_unref); - } - return obj; -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_class_init (DesktopAgnosticVFSTrashGnomeVFSClass * klass) { - desktop_agnostic_vfs_trash_gnome_vfs_parent_class = g_type_class_peek_parent (klass); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_trash_gnome_vfs_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_vfs_trash_gnome_vfs_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_trash_gnome_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_FILE_COUNT, "file-count"); -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_desktop_agnostic_vfs_trash_interface_init (DesktopAgnosticVFSTrashIface * iface) { - desktop_agnostic_vfs_trash_gnome_vfs_desktop_agnostic_vfs_trash_parent_iface = g_type_interface_peek_parent (iface); - iface->send_to_trash = desktop_agnostic_vfs_trash_gnome_vfs_real_send_to_trash; - iface->empty = desktop_agnostic_vfs_trash_gnome_vfs_real_empty; - iface->get_file_count = desktop_agnostic_vfs_trash_gnome_vfs_real_get_file_count; -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_instance_init (DesktopAgnosticVFSTrashGnomeVFS * self) { -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSTrashGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS (obj); - _g_hash_table_unref0 (self->trash_dirs); - G_OBJECT_CLASS (desktop_agnostic_vfs_trash_gnome_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_trash_gnome_vfs_get_type (void) { - static GType desktop_agnostic_vfs_trash_gnome_vfs_type_id = 0; - if (desktop_agnostic_vfs_trash_gnome_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSTrashGnomeVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_trash_gnome_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSTrashGnomeVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_trash_gnome_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_trash_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_trash_gnome_vfs_desktop_agnostic_vfs_trash_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_trash_gnome_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSTrashGnomeVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_trash_gnome_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, &desktop_agnostic_vfs_trash_info); - } - return desktop_agnostic_vfs_trash_gnome_vfs_type_id; -} - - -static void desktop_agnostic_vfs_trash_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSTrashGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_TRASH_GNOME_VFS_FILE_COUNT: - g_value_set_uint (value, desktop_agnostic_vfs_trash_get_file_count ((DesktopAgnosticVFSTrash*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.c 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1740 +0,0 @@ -/* vfs-trash-impl-thunar-vfs.c generated by valac, the Vala compiler - * generated from vfs-trash-impl-thunar-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: Trash implementation with Thunar VFS. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define XFCE_TYPE_TRASH (xfce_trash_get_type ()) -#define XFCE_TRASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TRASH, XfceTrash)) -#define XFCE_IS_TRASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_TRASH)) -#define XFCE_TRASH_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), XFCE_TYPE_TRASH, XfceTrashIface)) - -typedef struct _XfceTrash XfceTrash; -typedef struct _XfceTrashIface XfceTrashIface; -#define _g_free0(var) (var = (g_free (var), NULL)) -typedef struct _XfceTrashDBusProxy XfceTrashDBusProxy; -typedef DBusGProxyClass XfceTrashDBusProxyClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_STATE (desktop_agnostic_vfs_trash_state_get_type ()) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS (desktop_agnostic_vfs_trash_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_TRASH_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSTrashThunarVFS DesktopAgnosticVFSTrashThunarVFS; -typedef struct _DesktopAgnosticVFSTrashThunarVFSClass DesktopAgnosticVFSTrashThunarVFSClass; -typedef struct _DesktopAgnosticVFSTrashThunarVFSPrivate DesktopAgnosticVFSTrashThunarVFSPrivate; -#define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -typedef struct _DBusObjectVTable _DBusObjectVTable; - -struct _XfceTrashIface { - GTypeInterface parent_iface; - void (*DisplayTrash) (XfceTrash* self, const char* display, GError** error); - void (*EmptyTrash) (XfceTrash* self, const char* display, GError** error); - void (*MoveToTrash) (XfceTrash* self, char** uris, int uris_length1, const char* display, GError** error); - gboolean (*QueryTrash) (XfceTrash* self, GError** error); -}; - -struct _XfceTrashDBusProxy { - DBusGProxy parent_instance; - gboolean disposed; -}; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_TRASH_STATE_UNKNOWN = -1, - DESKTOP_AGNOSTIC_VFS_TRASH_STATE_EMPTY, - DESKTOP_AGNOSTIC_VFS_TRASH_STATE_FULL -} DesktopAgnosticVFSTrashState; - -struct _DesktopAgnosticVFSTrashThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSTrashThunarVFSPrivate * priv; - ThunarVfsPath* trash; -}; - -struct _DesktopAgnosticVFSTrashThunarVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSTrashThunarVFSPrivate { - DBusGConnection* dbus; - XfceTrash* xfce_trash; - guint _file_count; - ThunarVfsJob* job; -}; - -struct _DBusObjectVTable { - void (*register_object) (DBusConnection*, const char*, void*); -}; - - -static gpointer desktop_agnostic_vfs_trash_thunar_vfs_parent_class = NULL; -static DesktopAgnosticVFSTrashIface* desktop_agnostic_vfs_trash_thunar_vfs_desktop_agnostic_vfs_trash_parent_iface = NULL; - -GType xfce_trash_get_type (void); -void xfce_trash_DisplayTrash (XfceTrash* self, const char* display, GError** error); -void xfce_trash_EmptyTrash (XfceTrash* self, const char* display, GError** error); -void xfce_trash_MoveToTrash (XfceTrash* self, char** uris, int uris_length1, const char* display, GError** error); -gboolean xfce_trash_QueryTrash (XfceTrash* self, GError** error); -void xfce_trash_dbus_register_object (DBusConnection* connection, const char* path, void* object); -void _xfce_trash_dbus_unregister (DBusConnection* connection, void* _user_data_); -DBusHandlerResult xfce_trash_dbus_message (DBusConnection* connection, DBusMessage* message, void* object); -static DBusHandlerResult _dbus_xfce_trash_introspect (XfceTrash* self, DBusConnection* connection, DBusMessage* message); -static DBusHandlerResult _dbus_xfce_trash_property_get_all (XfceTrash* self, DBusConnection* connection, DBusMessage* message); -static DBusHandlerResult _dbus_xfce_trash_DisplayTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message); -static DBusHandlerResult _dbus_xfce_trash_EmptyTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message); -static DBusHandlerResult _dbus_xfce_trash_MoveToTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message); -static DBusHandlerResult _dbus_xfce_trash_QueryTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message); -static void _dbus_xfce_trash_trash_changed (GObject* _sender, gboolean full, DBusConnection* _connection); -GType xfce_trash_dbus_proxy_get_type (void); -XfceTrash* xfce_trash_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path); -static void _dbus_handle_xfce_trash_trash_changed (XfceTrash* self, DBusConnection* connection, DBusMessage* message); -DBusHandlerResult xfce_trash_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data); -enum { - XFCE_TRASH_DBUS_PROXY_DUMMY_PROPERTY -}; -static void xfce_trash_dbus_proxy_DisplayTrash (XfceTrash* self, const char* display, GError** error); -static void xfce_trash_dbus_proxy_EmptyTrash (XfceTrash* self, const char* display, GError** error); -static void xfce_trash_dbus_proxy_MoveToTrash (XfceTrash* self, char** uris, int uris_length1, const char* display, GError** error); -static gboolean xfce_trash_dbus_proxy_QueryTrash (XfceTrash* self, GError** error); -static void xfce_trash_dbus_proxy_xfce_trash__interface_init (XfceTrashIface* iface); -static void xfce_trash_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void xfce_trash_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType desktop_agnostic_vfs_trash_state_get_type (void); -GType desktop_agnostic_vfs_trash_thunar_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS, DesktopAgnosticVFSTrashThunarVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_FILE_COUNT -}; -static void desktop_agnostic_vfs_trash_thunar_vfs_update_file_count (DesktopAgnosticVFSTrashThunarVFS* self, DesktopAgnosticVFSTrashState state); -static void desktop_agnostic_vfs_trash_thunar_vfs_on_trash_changed (DesktopAgnosticVFSTrashThunarVFS* self, gboolean full); -static void desktop_agnostic_vfs_trash_thunar_vfs_on_trash_count (DesktopAgnosticVFSTrashThunarVFS* self, ThunarVfsJob* job, guint64 total_size, guint file_count, guint dir_count, guint unreadable_dir_count); -static void _desktop_agnostic_vfs_trash_thunar_vfs_on_trash_count_thunar_vfs_job_status_ready (ThunarVfsJob* _sender, guint64 total_size, guint file_count, guint directory_count, guint unreadable_directory_count, gpointer self); -static void desktop_agnostic_vfs_trash_thunar_vfs_on_job_finished (DesktopAgnosticVFSTrashThunarVFS* self, ThunarVfsJob* job); -static void _desktop_agnostic_vfs_trash_thunar_vfs_on_job_finished_thunar_vfs_job_finished (ThunarVfsJob* _sender, gpointer self); -static void desktop_agnostic_vfs_trash_thunar_vfs_real_send_to_trash (DesktopAgnosticVFSTrash* base, DesktopAgnosticVFSFile* file, GError** error); -static void desktop_agnostic_vfs_trash_thunar_vfs_real_empty (DesktopAgnosticVFSTrash* base); -DesktopAgnosticVFSTrashThunarVFS* desktop_agnostic_vfs_trash_thunar_vfs_new (void); -DesktopAgnosticVFSTrashThunarVFS* desktop_agnostic_vfs_trash_thunar_vfs_construct (GType object_type); -static void _desktop_agnostic_vfs_trash_thunar_vfs_on_trash_changed_xfce_trash_trash_changed (XfceTrash* _sender, gboolean full, gpointer self); -static GObject * desktop_agnostic_vfs_trash_thunar_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_vfs_trash_thunar_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_trash_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); -static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object); -static void _vala_dbus_unregister_object (gpointer connection, GObject* object); - -static const DBusObjectPathVTable _xfce_trash_dbus_path_vtable = {_xfce_trash_dbus_unregister, xfce_trash_dbus_message}; -static const _DBusObjectVTable _xfce_trash_dbus_vtable = {xfce_trash_dbus_register_object}; - - -void xfce_trash_DisplayTrash (XfceTrash* self, const char* display, GError** error) { - XFCE_TRASH_GET_INTERFACE (self)->DisplayTrash (self, display, error); -} - - -void xfce_trash_EmptyTrash (XfceTrash* self, const char* display, GError** error) { - XFCE_TRASH_GET_INTERFACE (self)->EmptyTrash (self, display, error); -} - - -void xfce_trash_MoveToTrash (XfceTrash* self, char** uris, int uris_length1, const char* display, GError** error) { - XFCE_TRASH_GET_INTERFACE (self)->MoveToTrash (self, uris, uris_length1, display, error); -} - - -gboolean xfce_trash_QueryTrash (XfceTrash* self, GError** error) { - return XFCE_TRASH_GET_INTERFACE (self)->QueryTrash (self, error); -} - - -void _xfce_trash_dbus_unregister (DBusConnection* connection, void* _user_data_) { -} - - -static DBusHandlerResult _dbus_xfce_trash_introspect (XfceTrash* self, DBusConnection* connection, DBusMessage* message) { - DBusMessage* reply; - DBusMessageIter iter; - GString* xml_data; - char** children; - int i; - reply = dbus_message_new_method_return (message); - dbus_message_iter_init_append (reply, &iter); - xml_data = g_string_new ("\n"); - g_string_append (xml_data, "\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"); - dbus_connection_list_registered (connection, g_object_get_data ((GObject *) self, "dbus_object_path"), &children); - for (i = 0; children[i]; i++) { - g_string_append_printf (xml_data, "\n", children[i]); - } - dbus_free_string_array (children); - g_string_append (xml_data, "\n"); - dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &xml_data->str); - g_string_free (xml_data, TRUE); - if (reply) { - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } else { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } -} - - -static DBusHandlerResult _dbus_xfce_trash_property_get_all (XfceTrash* self, DBusConnection* connection, DBusMessage* message) { - DBusMessage* reply; - DBusMessageIter iter, reply_iter, subiter; - char* interface_name; - const char* _tmp0_; - if (strcmp (dbus_message_get_signature (message), "s")) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - dbus_message_iter_init (message, &iter); - reply = dbus_message_new_method_return (message); - dbus_message_iter_init_append (reply, &reply_iter); - dbus_message_iter_get_basic (&iter, &_tmp0_); - dbus_message_iter_next (&iter); - interface_name = g_strdup (_tmp0_); - if (strcmp (interface_name, "org.xfce.Trash") == 0) { - dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_ARRAY, "{sv}", &subiter); - dbus_message_iter_close_container (&reply_iter, &subiter); - } else { - dbus_message_unref (reply); - reply = NULL; - } - g_free (interface_name); - if (reply) { - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } else { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } -} - - -static DBusHandlerResult _dbus_xfce_trash_DisplayTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message) { - DBusMessageIter iter; - GError* error; - char* display = NULL; - const char* _tmp1_; - DBusMessage* reply; - error = NULL; - if (strcmp (dbus_message_get_signature (message), "s")) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - dbus_message_iter_init (message, &iter); - dbus_message_iter_get_basic (&iter, &_tmp1_); - dbus_message_iter_next (&iter); - display = g_strdup (_tmp1_); - xfce_trash_DisplayTrash (self, display, &error); - if (error) { - if (error->domain == DBUS_GERROR) { - switch (error->code) { - case DBUS_GERROR_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message); - break; - case DBUS_GERROR_NO_MEMORY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message); - break; - case DBUS_GERROR_SERVICE_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message); - break; - case DBUS_GERROR_NAME_HAS_NO_OWNER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message); - break; - case DBUS_GERROR_NO_REPLY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message); - break; - case DBUS_GERROR_IO_ERROR: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message); - break; - case DBUS_GERROR_BAD_ADDRESS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message); - break; - case DBUS_GERROR_NOT_SUPPORTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message); - break; - case DBUS_GERROR_LIMITS_EXCEEDED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message); - break; - case DBUS_GERROR_ACCESS_DENIED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message); - break; - case DBUS_GERROR_AUTH_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message); - break; - case DBUS_GERROR_NO_SERVER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message); - break; - case DBUS_GERROR_TIMEOUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message); - break; - case DBUS_GERROR_NO_NETWORK: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message); - break; - case DBUS_GERROR_ADDRESS_IN_USE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message); - break; - case DBUS_GERROR_DISCONNECTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message); - break; - case DBUS_GERROR_INVALID_ARGS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message); - break; - case DBUS_GERROR_FILE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message); - break; - case DBUS_GERROR_FILE_EXISTS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message); - break; - case DBUS_GERROR_UNKNOWN_METHOD: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message); - break; - case DBUS_GERROR_TIMED_OUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message); - break; - case DBUS_GERROR_MATCH_RULE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message); - break; - case DBUS_GERROR_MATCH_RULE_INVALID: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message); - break; - case DBUS_GERROR_SPAWN_EXEC_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message); - break; - case DBUS_GERROR_SPAWN_FORK_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_EXITED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_SIGNALED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message); - break; - case DBUS_GERROR_SPAWN_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message); - break; - case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message); - break; - case DBUS_GERROR_INVALID_SIGNATURE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message); - break; - case DBUS_GERROR_INVALID_FILE_CONTENT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message); - break; - case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message); - break; - case DBUS_GERROR_REMOTE_EXCEPTION: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message); - break; - } - } - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - reply = dbus_message_new_method_return (message); - dbus_message_iter_init_append (reply, &iter); - _g_free0 (display); - if (reply) { - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } else { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } -} - - -static DBusHandlerResult _dbus_xfce_trash_EmptyTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message) { - DBusMessageIter iter; - GError* error; - char* display = NULL; - const char* _tmp2_; - DBusMessage* reply; - error = NULL; - if (strcmp (dbus_message_get_signature (message), "s")) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - dbus_message_iter_init (message, &iter); - dbus_message_iter_get_basic (&iter, &_tmp2_); - dbus_message_iter_next (&iter); - display = g_strdup (_tmp2_); - xfce_trash_EmptyTrash (self, display, &error); - if (error) { - if (error->domain == DBUS_GERROR) { - switch (error->code) { - case DBUS_GERROR_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message); - break; - case DBUS_GERROR_NO_MEMORY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message); - break; - case DBUS_GERROR_SERVICE_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message); - break; - case DBUS_GERROR_NAME_HAS_NO_OWNER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message); - break; - case DBUS_GERROR_NO_REPLY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message); - break; - case DBUS_GERROR_IO_ERROR: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message); - break; - case DBUS_GERROR_BAD_ADDRESS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message); - break; - case DBUS_GERROR_NOT_SUPPORTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message); - break; - case DBUS_GERROR_LIMITS_EXCEEDED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message); - break; - case DBUS_GERROR_ACCESS_DENIED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message); - break; - case DBUS_GERROR_AUTH_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message); - break; - case DBUS_GERROR_NO_SERVER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message); - break; - case DBUS_GERROR_TIMEOUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message); - break; - case DBUS_GERROR_NO_NETWORK: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message); - break; - case DBUS_GERROR_ADDRESS_IN_USE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message); - break; - case DBUS_GERROR_DISCONNECTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message); - break; - case DBUS_GERROR_INVALID_ARGS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message); - break; - case DBUS_GERROR_FILE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message); - break; - case DBUS_GERROR_FILE_EXISTS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message); - break; - case DBUS_GERROR_UNKNOWN_METHOD: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message); - break; - case DBUS_GERROR_TIMED_OUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message); - break; - case DBUS_GERROR_MATCH_RULE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message); - break; - case DBUS_GERROR_MATCH_RULE_INVALID: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message); - break; - case DBUS_GERROR_SPAWN_EXEC_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message); - break; - case DBUS_GERROR_SPAWN_FORK_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_EXITED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_SIGNALED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message); - break; - case DBUS_GERROR_SPAWN_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message); - break; - case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message); - break; - case DBUS_GERROR_INVALID_SIGNATURE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message); - break; - case DBUS_GERROR_INVALID_FILE_CONTENT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message); - break; - case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message); - break; - case DBUS_GERROR_REMOTE_EXCEPTION: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message); - break; - } - } - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - reply = dbus_message_new_method_return (message); - dbus_message_iter_init_append (reply, &iter); - _g_free0 (display); - if (reply) { - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } else { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } -} - - -static DBusHandlerResult _dbus_xfce_trash_MoveToTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message) { - DBusMessageIter iter; - GError* error; - char** uris = NULL; - int uris_length1; - char** _tmp3_; - int _tmp3__length; - int _tmp3__size; - int _tmp3__length1; - DBusMessageIter _tmp4_; - char* display = NULL; - const char* _tmp6_; - DBusMessage* reply; - error = NULL; - if (strcmp (dbus_message_get_signature (message), "ass")) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - dbus_message_iter_init (message, &iter); - uris_length1 = 0; - _tmp3_ = g_new (char*, 5); - _tmp3__length = 0; - _tmp3__size = 4; - _tmp3__length1 = 0; - dbus_message_iter_recurse (&iter, &_tmp4_); - for (; dbus_message_iter_get_arg_type (&_tmp4_); _tmp3__length1++) { - const char* _tmp5_; - if (_tmp3__size == _tmp3__length) { - _tmp3__size = 2 * _tmp3__size; - _tmp3_ = g_renew (char*, _tmp3_, _tmp3__size + 1); - } - dbus_message_iter_get_basic (&_tmp4_, &_tmp5_); - dbus_message_iter_next (&_tmp4_); - _tmp3_[_tmp3__length++] = g_strdup (_tmp5_); - } - uris_length1 = _tmp3__length1; - _tmp3_[_tmp3__length] = NULL; - dbus_message_iter_next (&iter); - uris = _tmp3_; - dbus_message_iter_get_basic (&iter, &_tmp6_); - dbus_message_iter_next (&iter); - display = g_strdup (_tmp6_); - xfce_trash_MoveToTrash (self, uris, uris_length1, display, &error); - if (error) { - if (error->domain == DBUS_GERROR) { - switch (error->code) { - case DBUS_GERROR_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message); - break; - case DBUS_GERROR_NO_MEMORY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message); - break; - case DBUS_GERROR_SERVICE_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message); - break; - case DBUS_GERROR_NAME_HAS_NO_OWNER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message); - break; - case DBUS_GERROR_NO_REPLY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message); - break; - case DBUS_GERROR_IO_ERROR: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message); - break; - case DBUS_GERROR_BAD_ADDRESS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message); - break; - case DBUS_GERROR_NOT_SUPPORTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message); - break; - case DBUS_GERROR_LIMITS_EXCEEDED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message); - break; - case DBUS_GERROR_ACCESS_DENIED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message); - break; - case DBUS_GERROR_AUTH_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message); - break; - case DBUS_GERROR_NO_SERVER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message); - break; - case DBUS_GERROR_TIMEOUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message); - break; - case DBUS_GERROR_NO_NETWORK: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message); - break; - case DBUS_GERROR_ADDRESS_IN_USE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message); - break; - case DBUS_GERROR_DISCONNECTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message); - break; - case DBUS_GERROR_INVALID_ARGS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message); - break; - case DBUS_GERROR_FILE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message); - break; - case DBUS_GERROR_FILE_EXISTS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message); - break; - case DBUS_GERROR_UNKNOWN_METHOD: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message); - break; - case DBUS_GERROR_TIMED_OUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message); - break; - case DBUS_GERROR_MATCH_RULE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message); - break; - case DBUS_GERROR_MATCH_RULE_INVALID: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message); - break; - case DBUS_GERROR_SPAWN_EXEC_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message); - break; - case DBUS_GERROR_SPAWN_FORK_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_EXITED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_SIGNALED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message); - break; - case DBUS_GERROR_SPAWN_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message); - break; - case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message); - break; - case DBUS_GERROR_INVALID_SIGNATURE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message); - break; - case DBUS_GERROR_INVALID_FILE_CONTENT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message); - break; - case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message); - break; - case DBUS_GERROR_REMOTE_EXCEPTION: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message); - break; - } - } - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - reply = dbus_message_new_method_return (message); - dbus_message_iter_init_append (reply, &iter); - uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL); - _g_free0 (display); - if (reply) { - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } else { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } -} - - -static DBusHandlerResult _dbus_xfce_trash_QueryTrash (XfceTrash* self, DBusConnection* connection, DBusMessage* message) { - DBusMessageIter iter; - GError* error; - gboolean result; - DBusMessage* reply; - dbus_bool_t _tmp7_; - error = NULL; - if (strcmp (dbus_message_get_signature (message), "")) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - dbus_message_iter_init (message, &iter); - result = xfce_trash_QueryTrash (self, &error); - if (error) { - if (error->domain == DBUS_GERROR) { - switch (error->code) { - case DBUS_GERROR_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message); - break; - case DBUS_GERROR_NO_MEMORY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message); - break; - case DBUS_GERROR_SERVICE_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message); - break; - case DBUS_GERROR_NAME_HAS_NO_OWNER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message); - break; - case DBUS_GERROR_NO_REPLY: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message); - break; - case DBUS_GERROR_IO_ERROR: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message); - break; - case DBUS_GERROR_BAD_ADDRESS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message); - break; - case DBUS_GERROR_NOT_SUPPORTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message); - break; - case DBUS_GERROR_LIMITS_EXCEEDED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message); - break; - case DBUS_GERROR_ACCESS_DENIED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message); - break; - case DBUS_GERROR_AUTH_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message); - break; - case DBUS_GERROR_NO_SERVER: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message); - break; - case DBUS_GERROR_TIMEOUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message); - break; - case DBUS_GERROR_NO_NETWORK: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message); - break; - case DBUS_GERROR_ADDRESS_IN_USE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message); - break; - case DBUS_GERROR_DISCONNECTED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message); - break; - case DBUS_GERROR_INVALID_ARGS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message); - break; - case DBUS_GERROR_FILE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message); - break; - case DBUS_GERROR_FILE_EXISTS: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message); - break; - case DBUS_GERROR_UNKNOWN_METHOD: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message); - break; - case DBUS_GERROR_TIMED_OUT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message); - break; - case DBUS_GERROR_MATCH_RULE_NOT_FOUND: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message); - break; - case DBUS_GERROR_MATCH_RULE_INVALID: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message); - break; - case DBUS_GERROR_SPAWN_EXEC_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message); - break; - case DBUS_GERROR_SPAWN_FORK_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_EXITED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message); - break; - case DBUS_GERROR_SPAWN_CHILD_SIGNALED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message); - break; - case DBUS_GERROR_SPAWN_FAILED: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message); - break; - case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message); - break; - case DBUS_GERROR_INVALID_SIGNATURE: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message); - break; - case DBUS_GERROR_INVALID_FILE_CONTENT: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message); - break; - case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message); - break; - case DBUS_GERROR_REMOTE_EXCEPTION: - reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message); - break; - } - } - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - reply = dbus_message_new_method_return (message); - dbus_message_iter_init_append (reply, &iter); - _tmp7_ = result; - dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &_tmp7_); - if (reply) { - dbus_connection_send (connection, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } else { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } -} - - -DBusHandlerResult xfce_trash_dbus_message (DBusConnection* connection, DBusMessage* message, void* object) { - DBusHandlerResult result; - result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) { - result = _dbus_xfce_trash_introspect (object, connection, message); - } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "GetAll")) { - result = _dbus_xfce_trash_property_get_all (object, connection, message); - } else if (dbus_message_is_method_call (message, "org.xfce.Trash", "DisplayTrash")) { - result = _dbus_xfce_trash_DisplayTrash (object, connection, message); - } else if (dbus_message_is_method_call (message, "org.xfce.Trash", "EmptyTrash")) { - result = _dbus_xfce_trash_EmptyTrash (object, connection, message); - } else if (dbus_message_is_method_call (message, "org.xfce.Trash", "MoveToTrash")) { - result = _dbus_xfce_trash_MoveToTrash (object, connection, message); - } else if (dbus_message_is_method_call (message, "org.xfce.Trash", "QueryTrash")) { - result = _dbus_xfce_trash_QueryTrash (object, connection, message); - } - if (result == DBUS_HANDLER_RESULT_HANDLED) { - return result; - } else { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } -} - - -static void _dbus_xfce_trash_trash_changed (GObject* _sender, gboolean full, DBusConnection* _connection) { - const char * _path; - DBusMessage *_message; - DBusMessageIter _iter; - dbus_bool_t _tmp8_; - _path = g_object_get_data (_sender, "dbus_object_path"); - _message = dbus_message_new_signal (_path, "org.xfce.Trash", "TrashChanged"); - dbus_message_iter_init_append (_message, &_iter); - _tmp8_ = full; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_BOOLEAN, &_tmp8_); - dbus_connection_send (_connection, _message, NULL); - dbus_message_unref (_message); -} - - -void xfce_trash_dbus_register_object (DBusConnection* connection, const char* path, void* object) { - if (!g_object_get_data (object, "dbus_object_path")) { - g_object_set_data (object, "dbus_object_path", g_strdup (path)); - dbus_connection_register_object_path (connection, path, &_xfce_trash_dbus_path_vtable, object); - g_object_weak_ref (object, _vala_dbus_unregister_object, connection); - } - g_signal_connect (object, "trash-changed", (GCallback) _dbus_xfce_trash_trash_changed, connection); -} - - -static void xfce_trash_base_init (XfceTrashIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_signal_new ("trash_changed", XFCE_TYPE_TRASH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); - g_type_set_qdata (XFCE_TYPE_TRASH, g_quark_from_static_string ("DBusObjectVTable"), (void*) (&_xfce_trash_dbus_vtable)); - } -} - - -GType xfce_trash_get_type (void) { - static GType xfce_trash_type_id = 0; - if (xfce_trash_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (XfceTrashIface), (GBaseInitFunc) xfce_trash_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - xfce_trash_type_id = g_type_register_static (G_TYPE_INTERFACE, "XfceTrash", &g_define_type_info, 0); - g_type_interface_add_prerequisite (xfce_trash_type_id, DBUS_TYPE_G_PROXY); - g_type_set_qdata (xfce_trash_type_id, g_quark_from_string ("ValaDBusInterfaceProxyType"), &xfce_trash_dbus_proxy_get_type); - } - return xfce_trash_type_id; -} - - -G_DEFINE_TYPE_EXTENDED (XfceTrashDBusProxy, xfce_trash_dbus_proxy, DBUS_TYPE_G_PROXY, 0, G_IMPLEMENT_INTERFACE (XFCE_TYPE_TRASH, xfce_trash_dbus_proxy_xfce_trash__interface_init) ); -XfceTrash* xfce_trash_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path) { - XfceTrash* self; - self = g_object_new (xfce_trash_dbus_proxy_get_type (), "connection", connection, "name", name, "path", path, "interface", "org.xfce.Trash", NULL); - return self; -} - - -static GObject* xfce_trash_dbus_proxy_construct (GType gtype, guint n_properties, GObjectConstructParam* properties) { - GObject* self; - DBusGConnection *connection; - char* path; - char* filter; - self = G_OBJECT_CLASS (xfce_trash_dbus_proxy_parent_class)->constructor (gtype, n_properties, properties); - g_object_get (self, "connection", &connection, NULL); - g_object_get (self, "path", &path, NULL); - dbus_connection_add_filter (dbus_g_connection_get_connection (connection), xfce_trash_dbus_proxy_filter, self, NULL); - filter = g_strdup_printf ("type='signal',path='%s'", path); - dbus_bus_add_match (dbus_g_connection_get_connection (connection), filter, NULL); - dbus_g_connection_unref (connection); - g_free (path); - g_free (filter); - return self; -} - - -static void _dbus_handle_xfce_trash_trash_changed (XfceTrash* self, DBusConnection* connection, DBusMessage* message) { - DBusMessageIter iter; - gboolean full = FALSE; - dbus_bool_t _tmp9_; - DBusMessage* reply; - if (strcmp (dbus_message_get_signature (message), "b")) { - return; - } - dbus_message_iter_init (message, &iter); - dbus_message_iter_get_basic (&iter, &_tmp9_); - dbus_message_iter_next (&iter); - full = _tmp9_; - g_signal_emit_by_name (self, "trash-changed", full); -} - - -DBusHandlerResult xfce_trash_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data) { - if (dbus_message_has_path (message, dbus_g_proxy_get_path (user_data))) { - if (dbus_message_is_signal (message, "org.xfce.Trash", "TrashChanged")) { - _dbus_handle_xfce_trash_trash_changed (user_data, connection, message); - } - } - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - - -static void xfce_trash_dbus_proxy_dispose (GObject* self) { - DBusGConnection *connection; - if (((XfceTrashDBusProxy*) self)->disposed) { - return; - } - ((XfceTrashDBusProxy*) self)->disposed = TRUE; - g_object_get (self, "connection", &connection, NULL); - dbus_connection_remove_filter (dbus_g_connection_get_connection (connection), xfce_trash_dbus_proxy_filter, self); - G_OBJECT_CLASS (xfce_trash_dbus_proxy_parent_class)->dispose (self); -} - - -static void xfce_trash_dbus_proxy_class_init (XfceTrashDBusProxyClass* klass) { - G_OBJECT_CLASS (klass)->constructor = xfce_trash_dbus_proxy_construct; - G_OBJECT_CLASS (klass)->dispose = xfce_trash_dbus_proxy_dispose; - G_OBJECT_CLASS (klass)->get_property = xfce_trash_dbus_proxy_get_property; - G_OBJECT_CLASS (klass)->set_property = xfce_trash_dbus_proxy_set_property; -} - - -static void xfce_trash_dbus_proxy_init (XfceTrashDBusProxy* self) { -} - - -static void xfce_trash_dbus_proxy_DisplayTrash (XfceTrash* self, const char* display, GError** error) { - DBusError _dbus_error; - DBusGConnection *_connection; - DBusMessage *_message, *_reply; - DBusMessageIter _iter; - const char* _tmp10_; - if (((XfceTrashDBusProxy*) self)->disposed) { - g_set_error_literal (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "Connection is closed"); - return; - } - _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.xfce.Trash", "DisplayTrash"); - dbus_message_iter_init_append (_message, &_iter); - _tmp10_ = display; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp10_); - g_object_get (self, "connection", &_connection, NULL); - dbus_error_init (&_dbus_error); - _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error); - dbus_g_connection_unref (_connection); - dbus_message_unref (_message); - if (dbus_error_is_set (&_dbus_error)) { - GQuark _edomain; - gint _ecode; - if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp11_; - _edomain = DBUS_GERROR; - _tmp11_ = _dbus_error.name + 27; - if (strcmp (_tmp11_, "Failed") == 0) { - _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp11_, "NoMemory") == 0) { - _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp11_, "ServiceUnknown") == 0) { - _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp11_, "NameHasNoOwner") == 0) { - _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp11_, "NoReply") == 0) { - _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp11_, "IOError") == 0) { - _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp11_, "BadAddress") == 0) { - _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp11_, "NotSupported") == 0) { - _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp11_, "LimitsExceeded") == 0) { - _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp11_, "AccessDenied") == 0) { - _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp11_, "AuthFailed") == 0) { - _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp11_, "NoServer") == 0) { - _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp11_, "Timeout") == 0) { - _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp11_, "NoNetwork") == 0) { - _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp11_, "AddressInUse") == 0) { - _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp11_, "Disconnected") == 0) { - _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp11_, "InvalidArgs") == 0) { - _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp11_, "FileNotFound") == 0) { - _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp11_, "FileExists") == 0) { - _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp11_, "UnknownMethod") == 0) { - _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp11_, "TimedOut") == 0) { - _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp11_, "MatchRuleNotFound") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp11_, "MatchRuleInvalid") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp11_, "Spawn.ExecFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp11_, "Spawn.ForkFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp11_, "Spawn.ChildExited") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp11_, "Spawn.ChildSignaled") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp11_, "Spawn.Failed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp11_, "UnixProcessIdUnknown") == 0) { - _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp11_, "InvalidSignature") == 0) { - _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp11_, "InvalidFileContent") == 0) { - _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp11_, "SELinuxSecurityContextUnknown") == 0) { - _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp11_, "RemoteException") == 0) { - _ecode = DBUS_GERROR_REMOTE_EXCEPTION; - } - } - g_set_error_literal (error, _edomain, _ecode, _dbus_error.message); - dbus_error_free (&_dbus_error); - return; - } - if (strcmp (dbus_message_get_signature (_reply), "")) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply)); - dbus_message_unref (_reply); - return; - } - dbus_message_iter_init (_reply, &_iter); - dbus_message_unref (_reply); -} - - -static void xfce_trash_dbus_proxy_EmptyTrash (XfceTrash* self, const char* display, GError** error) { - DBusError _dbus_error; - DBusGConnection *_connection; - DBusMessage *_message, *_reply; - DBusMessageIter _iter; - const char* _tmp12_; - if (((XfceTrashDBusProxy*) self)->disposed) { - g_set_error_literal (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "Connection is closed"); - return; - } - _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.xfce.Trash", "EmptyTrash"); - dbus_message_iter_init_append (_message, &_iter); - _tmp12_ = display; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp12_); - g_object_get (self, "connection", &_connection, NULL); - dbus_error_init (&_dbus_error); - _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error); - dbus_g_connection_unref (_connection); - dbus_message_unref (_message); - if (dbus_error_is_set (&_dbus_error)) { - GQuark _edomain; - gint _ecode; - if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp13_; - _edomain = DBUS_GERROR; - _tmp13_ = _dbus_error.name + 27; - if (strcmp (_tmp13_, "Failed") == 0) { - _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp13_, "NoMemory") == 0) { - _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp13_, "ServiceUnknown") == 0) { - _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp13_, "NameHasNoOwner") == 0) { - _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp13_, "NoReply") == 0) { - _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp13_, "IOError") == 0) { - _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp13_, "BadAddress") == 0) { - _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp13_, "NotSupported") == 0) { - _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp13_, "LimitsExceeded") == 0) { - _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp13_, "AccessDenied") == 0) { - _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp13_, "AuthFailed") == 0) { - _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp13_, "NoServer") == 0) { - _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp13_, "Timeout") == 0) { - _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp13_, "NoNetwork") == 0) { - _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp13_, "AddressInUse") == 0) { - _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp13_, "Disconnected") == 0) { - _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp13_, "InvalidArgs") == 0) { - _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp13_, "FileNotFound") == 0) { - _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp13_, "FileExists") == 0) { - _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp13_, "UnknownMethod") == 0) { - _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp13_, "TimedOut") == 0) { - _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp13_, "MatchRuleNotFound") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp13_, "MatchRuleInvalid") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp13_, "Spawn.ExecFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp13_, "Spawn.ForkFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp13_, "Spawn.ChildExited") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp13_, "Spawn.ChildSignaled") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp13_, "Spawn.Failed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp13_, "UnixProcessIdUnknown") == 0) { - _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp13_, "InvalidSignature") == 0) { - _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp13_, "InvalidFileContent") == 0) { - _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp13_, "SELinuxSecurityContextUnknown") == 0) { - _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp13_, "RemoteException") == 0) { - _ecode = DBUS_GERROR_REMOTE_EXCEPTION; - } - } - g_set_error_literal (error, _edomain, _ecode, _dbus_error.message); - dbus_error_free (&_dbus_error); - return; - } - if (strcmp (dbus_message_get_signature (_reply), "")) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply)); - dbus_message_unref (_reply); - return; - } - dbus_message_iter_init (_reply, &_iter); - dbus_message_unref (_reply); -} - - -static void xfce_trash_dbus_proxy_MoveToTrash (XfceTrash* self, char** uris, int uris_length1, const char* display, GError** error) { - DBusError _dbus_error; - DBusGConnection *_connection; - DBusMessage *_message, *_reply; - DBusMessageIter _iter; - char** _tmp14_; - DBusMessageIter _tmp15_; - int _tmp16_; - const char* _tmp18_; - if (((XfceTrashDBusProxy*) self)->disposed) { - g_set_error_literal (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "Connection is closed"); - return; - } - _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.xfce.Trash", "MoveToTrash"); - dbus_message_iter_init_append (_message, &_iter); - _tmp14_ = uris; - dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "s", &_tmp15_); - for (_tmp16_ = 0; _tmp16_ < uris_length1; _tmp16_++) { - const char* _tmp17_; - _tmp17_ = *_tmp14_; - dbus_message_iter_append_basic (&_tmp15_, DBUS_TYPE_STRING, &_tmp17_); - _tmp14_++; - } - dbus_message_iter_close_container (&_iter, &_tmp15_); - _tmp18_ = display; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp18_); - g_object_get (self, "connection", &_connection, NULL); - dbus_error_init (&_dbus_error); - _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error); - dbus_g_connection_unref (_connection); - dbus_message_unref (_message); - if (dbus_error_is_set (&_dbus_error)) { - GQuark _edomain; - gint _ecode; - if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp19_; - _edomain = DBUS_GERROR; - _tmp19_ = _dbus_error.name + 27; - if (strcmp (_tmp19_, "Failed") == 0) { - _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp19_, "NoMemory") == 0) { - _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp19_, "ServiceUnknown") == 0) { - _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp19_, "NameHasNoOwner") == 0) { - _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp19_, "NoReply") == 0) { - _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp19_, "IOError") == 0) { - _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp19_, "BadAddress") == 0) { - _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp19_, "NotSupported") == 0) { - _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp19_, "LimitsExceeded") == 0) { - _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp19_, "AccessDenied") == 0) { - _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp19_, "AuthFailed") == 0) { - _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp19_, "NoServer") == 0) { - _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp19_, "Timeout") == 0) { - _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp19_, "NoNetwork") == 0) { - _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp19_, "AddressInUse") == 0) { - _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp19_, "Disconnected") == 0) { - _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp19_, "InvalidArgs") == 0) { - _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp19_, "FileNotFound") == 0) { - _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp19_, "FileExists") == 0) { - _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp19_, "UnknownMethod") == 0) { - _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp19_, "TimedOut") == 0) { - _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp19_, "MatchRuleNotFound") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp19_, "MatchRuleInvalid") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp19_, "Spawn.ExecFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp19_, "Spawn.ForkFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp19_, "Spawn.ChildExited") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp19_, "Spawn.ChildSignaled") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp19_, "Spawn.Failed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp19_, "UnixProcessIdUnknown") == 0) { - _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp19_, "InvalidSignature") == 0) { - _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp19_, "InvalidFileContent") == 0) { - _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp19_, "SELinuxSecurityContextUnknown") == 0) { - _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp19_, "RemoteException") == 0) { - _ecode = DBUS_GERROR_REMOTE_EXCEPTION; - } - } - g_set_error_literal (error, _edomain, _ecode, _dbus_error.message); - dbus_error_free (&_dbus_error); - return; - } - if (strcmp (dbus_message_get_signature (_reply), "")) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply)); - dbus_message_unref (_reply); - return; - } - dbus_message_iter_init (_reply, &_iter); - dbus_message_unref (_reply); -} - - -static gboolean xfce_trash_dbus_proxy_QueryTrash (XfceTrash* self, GError** error) { - DBusError _dbus_error; - DBusGConnection *_connection; - DBusMessage *_message, *_reply; - DBusMessageIter _iter; - gboolean _result; - dbus_bool_t _tmp20_; - if (((XfceTrashDBusProxy*) self)->disposed) { - g_set_error_literal (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "Connection is closed"); - return FALSE; - } - _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.xfce.Trash", "QueryTrash"); - dbus_message_iter_init_append (_message, &_iter); - g_object_get (self, "connection", &_connection, NULL); - dbus_error_init (&_dbus_error); - _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error); - dbus_g_connection_unref (_connection); - dbus_message_unref (_message); - if (dbus_error_is_set (&_dbus_error)) { - GQuark _edomain; - gint _ecode; - if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp21_; - _edomain = DBUS_GERROR; - _tmp21_ = _dbus_error.name + 27; - if (strcmp (_tmp21_, "Failed") == 0) { - _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp21_, "NoMemory") == 0) { - _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp21_, "ServiceUnknown") == 0) { - _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp21_, "NameHasNoOwner") == 0) { - _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp21_, "NoReply") == 0) { - _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp21_, "IOError") == 0) { - _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp21_, "BadAddress") == 0) { - _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp21_, "NotSupported") == 0) { - _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp21_, "LimitsExceeded") == 0) { - _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp21_, "AccessDenied") == 0) { - _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp21_, "AuthFailed") == 0) { - _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp21_, "NoServer") == 0) { - _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp21_, "Timeout") == 0) { - _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp21_, "NoNetwork") == 0) { - _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp21_, "AddressInUse") == 0) { - _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp21_, "Disconnected") == 0) { - _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp21_, "InvalidArgs") == 0) { - _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp21_, "FileNotFound") == 0) { - _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp21_, "FileExists") == 0) { - _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp21_, "UnknownMethod") == 0) { - _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp21_, "TimedOut") == 0) { - _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp21_, "MatchRuleNotFound") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp21_, "MatchRuleInvalid") == 0) { - _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp21_, "Spawn.ExecFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp21_, "Spawn.ForkFailed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp21_, "Spawn.ChildExited") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp21_, "Spawn.ChildSignaled") == 0) { - _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp21_, "Spawn.Failed") == 0) { - _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp21_, "UnixProcessIdUnknown") == 0) { - _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp21_, "InvalidSignature") == 0) { - _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp21_, "InvalidFileContent") == 0) { - _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp21_, "SELinuxSecurityContextUnknown") == 0) { - _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp21_, "RemoteException") == 0) { - _ecode = DBUS_GERROR_REMOTE_EXCEPTION; - } - } - g_set_error_literal (error, _edomain, _ecode, _dbus_error.message); - dbus_error_free (&_dbus_error); - return FALSE; - } - if (strcmp (dbus_message_get_signature (_reply), "b")) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "b", dbus_message_get_signature (_reply)); - dbus_message_unref (_reply); - return FALSE; - } - dbus_message_iter_init (_reply, &_iter); - dbus_message_iter_get_basic (&_iter, &_tmp20_); - dbus_message_iter_next (&_iter); - _result = _tmp20_; - dbus_message_unref (_reply); - return _result; -} - - -static void xfce_trash_dbus_proxy_xfce_trash__interface_init (XfceTrashIface* iface) { - iface->DisplayTrash = xfce_trash_dbus_proxy_DisplayTrash; - iface->EmptyTrash = xfce_trash_dbus_proxy_EmptyTrash; - iface->MoveToTrash = xfce_trash_dbus_proxy_MoveToTrash; - iface->QueryTrash = xfce_trash_dbus_proxy_QueryTrash; -} - - -static void xfce_trash_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { -} - - -static void xfce_trash_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { -} - - - -GType desktop_agnostic_vfs_trash_state_get_type (void) { - static GType desktop_agnostic_vfs_trash_state_type_id = 0; - if (G_UNLIKELY (desktop_agnostic_vfs_trash_state_type_id == 0)) { - static const GEnumValue values[] = {{DESKTOP_AGNOSTIC_VFS_TRASH_STATE_UNKNOWN, "DESKTOP_AGNOSTIC_VFS_TRASH_STATE_UNKNOWN", "unknown"}, {DESKTOP_AGNOSTIC_VFS_TRASH_STATE_EMPTY, "DESKTOP_AGNOSTIC_VFS_TRASH_STATE_EMPTY", "empty"}, {DESKTOP_AGNOSTIC_VFS_TRASH_STATE_FULL, "DESKTOP_AGNOSTIC_VFS_TRASH_STATE_FULL", "full"}, {0, NULL, NULL}}; - desktop_agnostic_vfs_trash_state_type_id = g_enum_register_static ("DesktopAgnosticVFSTrashState", values); - } - return desktop_agnostic_vfs_trash_state_type_id; -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_on_trash_changed (DesktopAgnosticVFSTrashThunarVFS* self, gboolean full) { - DesktopAgnosticVFSTrashState _tmp0_ = 0; - g_return_if_fail (self != NULL); - if (full) { - _tmp0_ = DESKTOP_AGNOSTIC_VFS_TRASH_STATE_FULL; - } else { - _tmp0_ = DESKTOP_AGNOSTIC_VFS_TRASH_STATE_EMPTY; - } - desktop_agnostic_vfs_trash_thunar_vfs_update_file_count (self, _tmp0_); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void _desktop_agnostic_vfs_trash_thunar_vfs_on_trash_count_thunar_vfs_job_status_ready (ThunarVfsJob* _sender, guint64 total_size, guint file_count, guint directory_count, guint unreadable_directory_count, gpointer self) { - desktop_agnostic_vfs_trash_thunar_vfs_on_trash_count (self, _sender, total_size, file_count, directory_count, unreadable_directory_count); -} - - -static void _desktop_agnostic_vfs_trash_thunar_vfs_on_job_finished_thunar_vfs_job_finished (ThunarVfsJob* _sender, gpointer self) { - desktop_agnostic_vfs_trash_thunar_vfs_on_job_finished (self, _sender); -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_update_file_count (DesktopAgnosticVFSTrashThunarVFS* self, DesktopAgnosticVFSTrashState state) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - if (state == DESKTOP_AGNOSTIC_VFS_TRASH_STATE_EMPTY) { - self->priv->_file_count = (guint) 0; - g_signal_emit_by_name ((DesktopAgnosticVFSTrash*) self, "file-count-changed"); - } else { - { - ThunarVfsJob* _tmp0_; - ThunarVfsJob* _tmp1_; - _tmp0_ = thunar_vfs_deep_count (self->trash, THUNAR_VFS_DEEP_COUNT_FLAGS_NONE, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch3_g_error; - } - self->priv->job = (_tmp1_ = _g_object_ref0 (_tmp0_), _g_object_unref0 (self->priv->job), _tmp1_); - g_signal_connect_object (self->priv->job, "status-ready", (GCallback) _desktop_agnostic_vfs_trash_thunar_vfs_on_trash_count_thunar_vfs_job_status_ready, self, 0); - g_signal_connect_object (self->priv->job, "finished", (GCallback) _desktop_agnostic_vfs_trash_thunar_vfs_on_job_finished_thunar_vfs_job_finished, self, 0); - } - goto __finally3; - __catch3_g_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("vfs-trash-impl-thunar-vfs.vala:89: Could not retrieve contents of Trash: %s", e->message); - _g_error_free0 (e); - } - } - __finally3: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_on_job_finished (DesktopAgnosticVFSTrashThunarVFS* self, ThunarVfsJob* job) { - ThunarVfsJob* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (job != NULL); - self->priv->job = (_tmp0_ = NULL, _g_object_unref0 (self->priv->job), _tmp0_); -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_on_trash_count (DesktopAgnosticVFSTrashThunarVFS* self, ThunarVfsJob* job, guint64 total_size, guint file_count, guint dir_count, guint unreadable_dir_count) { - g_return_if_fail (self != NULL); - g_return_if_fail (job != NULL); - self->priv->_file_count = (file_count + (dir_count - 1)) + unreadable_dir_count; - g_signal_emit_by_name ((DesktopAgnosticVFSTrash*) self, "file-count-changed"); -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_real_send_to_trash (DesktopAgnosticVFSTrash* base, DesktopAgnosticVFSFile* file, GError** error) { - DesktopAgnosticVFSTrashThunarVFS * self; - GError * _inner_error_; - char** _tmp1_; - gint uris_size; - gint uris_length1; - char** _tmp0_ = NULL; - char** uris; - self = (DesktopAgnosticVFSTrashThunarVFS*) base; - g_return_if_fail (file != NULL); - _inner_error_ = NULL; - uris = (_tmp1_ = (_tmp0_ = g_new0 (char*, 1 + 1), _tmp0_[0] = desktop_agnostic_vfs_file_get_uri (file), _tmp0_), uris_length1 = 1, uris_size = uris_length1, _tmp1_); - xfce_trash_MoveToTrash (self->priv->xfce_trash, uris, uris_length1, "", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL); - return; - } - uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL); -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_real_empty (DesktopAgnosticVFSTrash* base) { - DesktopAgnosticVFSTrashThunarVFS * self; - GError * _inner_error_; - self = (DesktopAgnosticVFSTrashThunarVFS*) base; - _inner_error_ = NULL; - { - xfce_trash_EmptyTrash (self->priv->xfce_trash, "", &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DBUS_GERROR) { - goto __catch4_dbus_gerror; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - goto __finally4; - __catch4_dbus_gerror: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("vfs-trash-impl-thunar-vfs.vala:136: VFS Trash Error (Thunar VFS): %s", err->message); - _g_error_free0 (err); - } - } - __finally4: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } -} - - -DesktopAgnosticVFSTrashThunarVFS* desktop_agnostic_vfs_trash_thunar_vfs_construct (GType object_type) { - DesktopAgnosticVFSTrashThunarVFS * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticVFSTrashThunarVFS* desktop_agnostic_vfs_trash_thunar_vfs_new (void) { - return desktop_agnostic_vfs_trash_thunar_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_TRASH_THUNAR_VFS); -} - - -static guint desktop_agnostic_vfs_trash_thunar_vfs_real_get_file_count (DesktopAgnosticVFSTrash* base) { - guint result; - DesktopAgnosticVFSTrashThunarVFS* self; - self = (DesktopAgnosticVFSTrashThunarVFS*) base; - result = self->priv->_file_count; - return result; -} - - -static void _desktop_agnostic_vfs_trash_thunar_vfs_on_trash_changed_xfce_trash_trash_changed (XfceTrash* _sender, gboolean full, gpointer self) { - desktop_agnostic_vfs_trash_thunar_vfs_on_trash_changed (self, full); -} - - -static GObject * desktop_agnostic_vfs_trash_thunar_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticVFSTrashThunarVFS * self; - GError * _inner_error_; - parent_class = G_OBJECT_CLASS (desktop_agnostic_vfs_trash_thunar_vfs_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS (obj); - _inner_error_ = NULL; - { - ThunarVfsMonitor* monitor; - DBusGConnection* _tmp22_; - DBusGConnection* _tmp23_; - XfceTrash* _tmp24_; - monitor = NULL; - self->trash = thunar_vfs_path_get_for_trash (); - _tmp22_ = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (monitor); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - self->priv->dbus = (_tmp23_ = _tmp22_, _dbus_g_connection_unref0 (self->priv->dbus), _tmp23_); - self->priv->xfce_trash = (_tmp24_ = xfce_trash_dbus_proxy_new (self->priv->dbus, "org.xfce.Thunar", "/org/xfce/FileManager"), _g_object_unref0 (self->priv->xfce_trash), _tmp24_); - g_signal_connect_object (self->priv->xfce_trash, "trash-changed", (GCallback) _desktop_agnostic_vfs_trash_thunar_vfs_on_trash_changed_xfce_trash_trash_changed, self, 0); - self->priv->_file_count = (guint) 0; - desktop_agnostic_vfs_trash_thunar_vfs_update_file_count (self, DESKTOP_AGNOSTIC_VFS_TRASH_STATE_UNKNOWN); - _g_object_unref0 (monitor); - } - return obj; -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_class_init (DesktopAgnosticVFSTrashThunarVFSClass * klass) { - desktop_agnostic_vfs_trash_thunar_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSTrashThunarVFSPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_trash_thunar_vfs_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_vfs_trash_thunar_vfs_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_trash_thunar_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_FILE_COUNT, "file-count"); -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_desktop_agnostic_vfs_trash_interface_init (DesktopAgnosticVFSTrashIface * iface) { - desktop_agnostic_vfs_trash_thunar_vfs_desktop_agnostic_vfs_trash_parent_iface = g_type_interface_peek_parent (iface); - iface->send_to_trash = desktop_agnostic_vfs_trash_thunar_vfs_real_send_to_trash; - iface->empty = desktop_agnostic_vfs_trash_thunar_vfs_real_empty; - iface->get_file_count = desktop_agnostic_vfs_trash_thunar_vfs_real_get_file_count; -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_instance_init (DesktopAgnosticVFSTrashThunarVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSTrashThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS (obj); - _dbus_g_connection_unref0 (self->priv->dbus); - _g_object_unref0 (self->priv->xfce_trash); - _g_object_unref0 (self->priv->job); - G_OBJECT_CLASS (desktop_agnostic_vfs_trash_thunar_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_trash_thunar_vfs_get_type (void) { - static GType desktop_agnostic_vfs_trash_thunar_vfs_type_id = 0; - if (desktop_agnostic_vfs_trash_thunar_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSTrashThunarVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_trash_thunar_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSTrashThunarVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_trash_thunar_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_trash_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_trash_thunar_vfs_desktop_agnostic_vfs_trash_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_trash_thunar_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSTrashThunarVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_trash_thunar_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_TRASH, &desktop_agnostic_vfs_trash_info); - } - return desktop_agnostic_vfs_trash_thunar_vfs_type_id; -} - - -static void desktop_agnostic_vfs_trash_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSTrashThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_TRASH_THUNAR_VFS_FILE_COUNT: - g_value_set_uint (value, desktop_agnostic_vfs_trash_get_file_count ((DesktopAgnosticVFSTrash*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { - if ((array != NULL) && (destroy_func != NULL)) { - int i; - for (i = 0; i < array_length; i = i + 1) { - if (((gpointer*) array)[i] != NULL) { - destroy_func (((gpointer*) array)[i]); - } - } - } -} - - -static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { - _vala_array_destroy (array, array_length, destroy_func); - g_free (array); -} - - -static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object) { - const _DBusObjectVTable * vtable; - vtable = g_type_get_qdata (G_TYPE_FROM_INSTANCE (object), g_quark_from_static_string ("DBusObjectVTable")); - if (vtable) { - vtable->register_object (connection, path, object); - } else { - g_warning ("Object does not implement any D-Bus interface"); - } -} - - -static void _vala_dbus_unregister_object (gpointer connection, GObject* object) { - char* path; - path = g_object_steal_data ((GObject*) object, "dbus_object_path"); - dbus_connection_unregister_object_path (connection, path); - g_free (path); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume.c 2010-04-11 07:32:11.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/* vfs-volume.c generated by valac, the Vala compiler - * generated from vfs-volume.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS Volume interface. - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME (desktop_agnostic_vfs_volume_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolume)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, DesktopAgnosticVFSVolumeIface)) - -typedef struct _DesktopAgnosticVFSVolume DesktopAgnosticVFSVolume; -typedef struct _DesktopAgnosticVFSVolumeIface DesktopAgnosticVFSVolumeIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_FILE (desktop_agnostic_vfs_file_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFile)) -#define DESKTOP_AGNOSTIC_VFS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_FILE)) -#define DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_FILE, DesktopAgnosticVFSFileClass)) - -typedef struct _DesktopAgnosticVFSFile DesktopAgnosticVFSFile; -typedef struct _DesktopAgnosticVFSFileClass DesktopAgnosticVFSFileClass; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR (desktop_agnostic_vfs_volume_monitor_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitor)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, DesktopAgnosticVFSVolumeMonitorIface)) - -typedef struct _DesktopAgnosticVFSVolumeMonitor DesktopAgnosticVFSVolumeMonitor; -typedef struct _DesktopAgnosticVFSVolumeMonitorIface DesktopAgnosticVFSVolumeMonitorIface; - -#define DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION (desktop_agnostic_vfs_implementation_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementation)) -#define DESKTOP_AGNOSTIC_VFS_IS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION)) -#define DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_IMPLEMENTATION, DesktopAgnosticVFSImplementationIface)) - -typedef struct _DesktopAgnosticVFSImplementation DesktopAgnosticVFSImplementation; -typedef struct _DesktopAgnosticVFSImplementationIface DesktopAgnosticVFSImplementationIface; - -typedef enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, - DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT -} DesktopAgnosticVFSVolumeError; -#define DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR desktop_agnostic_vfs_volume_error_quark () -typedef void (*DesktopAgnosticVFSVolumeCallback) (void* user_data); -struct _DesktopAgnosticVFSVolumeIface { - GTypeInterface parent_iface; - gboolean (*is_mounted) (DesktopAgnosticVFSVolume* self); - void (*mount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*mount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - void (*unmount) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*unmount_finish) (DesktopAgnosticVFSVolume* self, GError** error); - gboolean (*can_eject) (DesktopAgnosticVFSVolume* self); - void (*eject) (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); - gboolean (*eject_finish) (DesktopAgnosticVFSVolume* self, GError** error); - const char* (*get_name) (DesktopAgnosticVFSVolume* self); - DesktopAgnosticVFSFile* (*get_uri) (DesktopAgnosticVFSVolume* self); - char* (*get_icon) (DesktopAgnosticVFSVolume* self); -}; - -struct _DesktopAgnosticVFSVolumeMonitorIface { - GTypeInterface parent_iface; - void* (*get_implementation) (DesktopAgnosticVFSVolumeMonitor* self); - GList* (*get_volumes) (DesktopAgnosticVFSVolumeMonitor* self); -}; - -struct _DesktopAgnosticVFSImplementationIface { - GTypeInterface parent_iface; - void (*init) (DesktopAgnosticVFSImplementation* self); - GSList* (*files_from_uri_list) (DesktopAgnosticVFSImplementation* self, const char* uri_list, GError** error); - DesktopAgnosticVFSVolumeMonitor* (*volume_monitor_get_default) (DesktopAgnosticVFSImplementation* self); - void (*shutdown) (DesktopAgnosticVFSImplementation* self); - const char* (*get_name) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_file_monitor_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_trash_type) (DesktopAgnosticVFSImplementation* self); - GType (*get_volume_type) (DesktopAgnosticVFSImplementation* self); -}; - - - -GQuark desktop_agnostic_vfs_volume_error_quark (void); -GType desktop_agnostic_vfs_file_get_type (void); -GType desktop_agnostic_vfs_volume_get_type (void); -gboolean desktop_agnostic_vfs_volume_is_mounted (DesktopAgnosticVFSVolume* self); -void desktop_agnostic_vfs_volume_mount (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -gboolean desktop_agnostic_vfs_volume_mount_finish (DesktopAgnosticVFSVolume* self, GError** error); -void desktop_agnostic_vfs_volume_unmount (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -gboolean desktop_agnostic_vfs_volume_unmount_finish (DesktopAgnosticVFSVolume* self, GError** error); -gboolean desktop_agnostic_vfs_volume_can_eject (DesktopAgnosticVFSVolume* self); -void desktop_agnostic_vfs_volume_eject (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -gboolean desktop_agnostic_vfs_volume_eject_finish (DesktopAgnosticVFSVolume* self, GError** error); -const char* desktop_agnostic_vfs_volume_get_name (DesktopAgnosticVFSVolume* self); -DesktopAgnosticVFSFile* desktop_agnostic_vfs_volume_get_uri (DesktopAgnosticVFSVolume* self); -char* desktop_agnostic_vfs_volume_get_icon (DesktopAgnosticVFSVolume* self); -GType desktop_agnostic_vfs_volume_monitor_get_type (void); -void* desktop_agnostic_vfs_volume_monitor_get_implementation (DesktopAgnosticVFSVolumeMonitor* self); -GList* desktop_agnostic_vfs_volume_monitor_get_volumes (DesktopAgnosticVFSVolumeMonitor* self); -GType desktop_agnostic_vfs_implementation_get_type (void); -DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error); -DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_implementation_volume_monitor_get_default (DesktopAgnosticVFSImplementation* self); -DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_volume_monitor_get_default (GError** error); - - - -GQuark desktop_agnostic_vfs_volume_error_quark (void) { - return g_quark_from_static_string ("desktop_agnostic_vfs_volume_error-quark"); -} - - -gboolean desktop_agnostic_vfs_volume_is_mounted (DesktopAgnosticVFSVolume* self) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->is_mounted (self); -} - - -void desktop_agnostic_vfs_volume_mount (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->mount (self, callback, callback_target); -} - - -gboolean desktop_agnostic_vfs_volume_mount_finish (DesktopAgnosticVFSVolume* self, GError** error) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->mount_finish (self, error); -} - - -void desktop_agnostic_vfs_volume_unmount (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->unmount (self, callback, callback_target); -} - - -gboolean desktop_agnostic_vfs_volume_unmount_finish (DesktopAgnosticVFSVolume* self, GError** error) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->unmount_finish (self, error); -} - - -gboolean desktop_agnostic_vfs_volume_can_eject (DesktopAgnosticVFSVolume* self) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->can_eject (self); -} - - -void desktop_agnostic_vfs_volume_eject (DesktopAgnosticVFSVolume* self, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->eject (self, callback, callback_target); -} - - -gboolean desktop_agnostic_vfs_volume_eject_finish (DesktopAgnosticVFSVolume* self, GError** error) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->eject_finish (self, error); -} - - -const char* desktop_agnostic_vfs_volume_get_name (DesktopAgnosticVFSVolume* self) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->get_name (self); -} - - -DesktopAgnosticVFSFile* desktop_agnostic_vfs_volume_get_uri (DesktopAgnosticVFSVolume* self) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->get_uri (self); -} - - -char* desktop_agnostic_vfs_volume_get_icon (DesktopAgnosticVFSVolume* self) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_GET_INTERFACE (self)->get_icon (self); -} - - -static void desktop_agnostic_vfs_volume_base_init (DesktopAgnosticVFSVolumeIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_object_interface_install_property (iface, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_interface_install_property (iface, g_param_spec_object ("uri", "uri", "uri", DESKTOP_AGNOSTIC_VFS_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_interface_install_property (iface, g_param_spec_string ("icon", "icon", "icon", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - } -} - - -GType desktop_agnostic_vfs_volume_get_type (void) { - static GType desktop_agnostic_vfs_volume_type_id = 0; - if (desktop_agnostic_vfs_volume_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeIface), (GBaseInitFunc) desktop_agnostic_vfs_volume_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - desktop_agnostic_vfs_volume_type_id = g_type_register_static (G_TYPE_INTERFACE, "DesktopAgnosticVFSVolume", &g_define_type_info, 0); - g_type_interface_add_prerequisite (desktop_agnostic_vfs_volume_type_id, G_TYPE_OBJECT); - } - return desktop_agnostic_vfs_volume_type_id; -} - - -void* desktop_agnostic_vfs_volume_monitor_get_implementation (DesktopAgnosticVFSVolumeMonitor* self) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GET_INTERFACE (self)->get_implementation (self); -} - - -GList* desktop_agnostic_vfs_volume_monitor_get_volumes (DesktopAgnosticVFSVolumeMonitor* self) { - return DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GET_INTERFACE (self)->get_volumes (self); -} - - -static void desktop_agnostic_vfs_volume_monitor_base_init (DesktopAgnosticVFSVolumeMonitorIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_object_interface_install_property (iface, g_param_spec_pointer ("implementation", "implementation", "implementation", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_interface_install_property (iface, g_param_spec_pointer ("volumes", "volumes", "volumes", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_signal_new ("volume_mounted", DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME); - g_signal_new ("volume_unmounted", DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME); - } -} - - -GType desktop_agnostic_vfs_volume_monitor_get_type (void) { - static GType desktop_agnostic_vfs_volume_monitor_type_id = 0; - if (desktop_agnostic_vfs_volume_monitor_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeMonitorIface), (GBaseInitFunc) desktop_agnostic_vfs_volume_monitor_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - desktop_agnostic_vfs_volume_monitor_type_id = g_type_register_static (G_TYPE_INTERFACE, "DesktopAgnosticVFSVolumeMonitor", &g_define_type_info, 0); - g_type_interface_add_prerequisite (desktop_agnostic_vfs_volume_monitor_type_id, G_TYPE_OBJECT); - } - return desktop_agnostic_vfs_volume_monitor_type_id; -} - - -DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_volume_monitor_get_default (GError** error) { - DesktopAgnosticVFSVolumeMonitor* result; - GError * _inner_error_; - DesktopAgnosticVFSImplementation* vfs; - _inner_error_ = NULL; - vfs = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return NULL; - } - if (vfs == NULL) { - result = NULL; - return result; - } else { - result = desktop_agnostic_vfs_implementation_volume_monitor_get_default (vfs); - return result; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume-impl-gio.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume-impl-gio.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume-impl-gio.c 2010-04-11 07:32:16.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume-impl-gio.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,866 +0,0 @@ -/* vfs-volume-impl-gio.c generated by valac, the Vala compiler - * generated from vfs-volume-impl-gio.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS Volume implementation (GIO). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO (desktop_agnostic_vfs_volume_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIOClass)) - -typedef struct _DesktopAgnosticVFSVolumeGIO DesktopAgnosticVFSVolumeGIO; -typedef struct _DesktopAgnosticVFSVolumeGIOClass DesktopAgnosticVFSVolumeGIOClass; -typedef struct _DesktopAgnosticVFSVolumeGIOPrivate DesktopAgnosticVFSVolumeGIOPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO (desktop_agnostic_vfs_volume_monitor_gio_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIOClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIOClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorGIO DesktopAgnosticVFSVolumeMonitorGIO; -typedef struct _DesktopAgnosticVFSVolumeMonitorGIOClass DesktopAgnosticVFSVolumeMonitorGIOClass; -typedef struct _DesktopAgnosticVFSVolumeMonitorGIOPrivate DesktopAgnosticVFSVolumeMonitorGIOPrivate; -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) - -struct _DesktopAgnosticVFSVolumeGIO { - GObject parent_instance; - DesktopAgnosticVFSVolumeGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeGIOClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeGIOPrivate { - GVolume* vol; - DesktopAgnosticVFSFile* _uri; - char* _icon; - DesktopAgnosticVFSVolumeCallback _mount_callback; - gpointer _mount_callback_target; - GDestroyNotify _mount_callback_target_destroy_notify; - GAsyncResult* async_result; - DesktopAgnosticVFSVolumeCallback _unmount_callback; - gpointer _unmount_callback_target; - GDestroyNotify _unmount_callback_target_destroy_notify; - DesktopAgnosticVFSVolumeCallback _eject_callback; - gpointer _eject_callback_target; - GDestroyNotify _eject_callback_target_destroy_notify; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGIO { - GObject parent_instance; - DesktopAgnosticVFSVolumeMonitorGIOPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGIOClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGIOPrivate { - GVolumeMonitor* monitor; - GHashTable* _volumes; -}; - - -static gpointer desktop_agnostic_vfs_volume_gio_parent_class = NULL; -static DesktopAgnosticVFSVolumeIface* desktop_agnostic_vfs_volume_gio_desktop_agnostic_vfs_volume_parent_iface = NULL; -static gpointer desktop_agnostic_vfs_volume_monitor_gio_parent_class = NULL; -static DesktopAgnosticVFSVolumeMonitorIface* desktop_agnostic_vfs_volume_monitor_gio_desktop_agnostic_vfs_volume_monitor_parent_iface = NULL; - -GType desktop_agnostic_vfs_volume_gio_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, DesktopAgnosticVFSVolumeGIOPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_NAME, - DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_URI, - DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_ICON -}; -static gboolean desktop_agnostic_vfs_volume_gio_real_is_mounted (DesktopAgnosticVFSVolume* base); -static void desktop_agnostic_vfs_volume_gio_on_mount (DesktopAgnosticVFSVolumeGIO* self, GObject* obj, GAsyncResult* res); -static void _desktop_agnostic_vfs_volume_gio_on_mount_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); -static void desktop_agnostic_vfs_volume_gio_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_gio_real_mount_finish (DesktopAgnosticVFSVolume* base, GError** error); -static void desktop_agnostic_vfs_volume_gio_on_unmount (DesktopAgnosticVFSVolumeGIO* self, GObject* obj, GAsyncResult* res); -static void _desktop_agnostic_vfs_volume_gio_on_unmount_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); -static void desktop_agnostic_vfs_volume_gio_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_gio_real_unmount_finish (DesktopAgnosticVFSVolume* base, GError** error); -static gboolean desktop_agnostic_vfs_volume_gio_real_can_eject (DesktopAgnosticVFSVolume* base); -static void desktop_agnostic_vfs_volume_gio_on_eject (DesktopAgnosticVFSVolumeGIO* self, GObject* obj, GAsyncResult* res); -static void _desktop_agnostic_vfs_volume_gio_on_eject_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); -static void desktop_agnostic_vfs_volume_gio_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_gio_real_eject_finish (DesktopAgnosticVFSVolume* base, GError** error); -DesktopAgnosticVFSVolumeGIO* desktop_agnostic_vfs_volume_gio_new (void); -DesktopAgnosticVFSVolumeGIO* desktop_agnostic_vfs_volume_gio_construct (GType object_type); -static void desktop_agnostic_vfs_volume_gio_set_implementation (DesktopAgnosticVFSVolumeGIO* self, GVolume* value); -static void desktop_agnostic_vfs_volume_gio_finalize (GObject* obj); -static void desktop_agnostic_vfs_volume_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_volume_gio_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType desktop_agnostic_vfs_volume_monitor_gio_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO, DesktopAgnosticVFSVolumeMonitorGIOPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_VOLUMES -}; -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gio_create_volume (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolume* vol); -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gio_check_volume (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolume* gvol); -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gio_get_volume_from_mount (DesktopAgnosticVFSVolumeMonitorGIO* self, GMount* mount); -static void desktop_agnostic_vfs_volume_monitor_gio_on_mount_added (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GMount* mount); -static void desktop_agnostic_vfs_volume_monitor_gio_on_mount_removed (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GMount* mount); -static void desktop_agnostic_vfs_volume_monitor_gio_on_volume_added (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GVolume* gvol); -static void desktop_agnostic_vfs_volume_monitor_gio_on_volume_removed (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GVolume* gvol); -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_new (void); -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_construct (GType object_type); -static void _desktop_agnostic_vfs_volume_monitor_gio_on_mount_added_g_volume_monitor_mount_added (GVolumeMonitor* _sender, GMount* mount, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_gio_on_mount_removed_g_volume_monitor_mount_removed (GVolumeMonitor* _sender, GMount* mount, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_gio_on_volume_added_g_volume_monitor_volume_added (GVolumeMonitor* _sender, GVolume* volume, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_gio_on_volume_removed_g_volume_monitor_volume_removed (GVolumeMonitor* _sender, GVolume* volume, gpointer self); -static GObject * desktop_agnostic_vfs_volume_monitor_gio_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_vfs_volume_monitor_gio_finalize (GObject* obj); -static void desktop_agnostic_vfs_volume_monitor_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -static gboolean desktop_agnostic_vfs_volume_gio_real_is_mounted (DesktopAgnosticVFSVolume* base) { - DesktopAgnosticVFSVolumeGIO * self; - gboolean result; - self = (DesktopAgnosticVFSVolumeGIO*) base; - result = g_volume_get_mount (self->priv->vol) != NULL; - return result; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_vfs_volume_gio_on_mount (DesktopAgnosticVFSVolumeGIO* self, GObject* obj, GAsyncResult* res) { - GAsyncResult* _tmp0_; - DesktopAgnosticVFSVolumeCallback _tmp1_; - g_return_if_fail (self != NULL); - g_return_if_fail (res != NULL); - self->priv->async_result = (_tmp0_ = _g_object_ref0 (res), _g_object_unref0 (self->priv->async_result), _tmp0_); - self->priv->_mount_callback (self->priv->_mount_callback_target); - self->priv->_mount_callback = (_tmp1_ = NULL, ((self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target), self->priv->_mount_callback = NULL, self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL), self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL, _tmp1_); -} - - -static void _desktop_agnostic_vfs_volume_gio_on_mount_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) { - desktop_agnostic_vfs_volume_gio_on_mount (self, source_object, res); -} - - -static void desktop_agnostic_vfs_volume_gio_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeGIO * self; - self = (DesktopAgnosticVFSVolumeGIO*) base; - if (self->priv->_mount_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_mount_callback = (_tmp0_ = callback, ((self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target), self->priv->_mount_callback = NULL, self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL), self->priv->_mount_callback_target = callback_target, self->priv->_mount_callback_target_destroy_notify = NULL, _tmp0_); - g_volume_mount (self->priv->vol, G_MOUNT_MOUNT_NONE, NULL, NULL, _desktop_agnostic_vfs_volume_gio_on_mount_gasync_ready_callback, self); - } -} - - -static gboolean desktop_agnostic_vfs_volume_gio_real_mount_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeGIO * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - GAsyncResult* _tmp1_; - self = (DesktopAgnosticVFSVolumeGIO*) base; - _inner_error_ = NULL; - _result_ = FALSE; - { - gboolean _tmp0_; - _tmp0_ = g_volume_mount_finish (self->priv->vol, self->priv->async_result, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch5_g_error; - } - _result_ = _tmp0_; - } - goto __finally5; - __catch5_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, err->message); - { - _g_error_free0 (err); - goto __finally5; - } - _g_error_free0 (err); - } - } - __finally5: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - return FALSE; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - self->priv->async_result = (_tmp1_ = NULL, _g_object_unref0 (self->priv->async_result), _tmp1_); - result = _result_; - return result; -} - - -static void desktop_agnostic_vfs_volume_gio_on_unmount (DesktopAgnosticVFSVolumeGIO* self, GObject* obj, GAsyncResult* res) { - GAsyncResult* _tmp0_; - DesktopAgnosticVFSVolumeCallback _tmp1_; - g_return_if_fail (self != NULL); - g_return_if_fail (res != NULL); - self->priv->async_result = (_tmp0_ = _g_object_ref0 (res), _g_object_unref0 (self->priv->async_result), _tmp0_); - self->priv->_unmount_callback (self->priv->_unmount_callback_target); - self->priv->_unmount_callback = (_tmp1_ = NULL, ((self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target), self->priv->_unmount_callback = NULL, self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL), self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL, _tmp1_); -} - - -static void _desktop_agnostic_vfs_volume_gio_on_unmount_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) { - desktop_agnostic_vfs_volume_gio_on_unmount (self, source_object, res); -} - - -static void desktop_agnostic_vfs_volume_gio_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeGIO * self; - self = (DesktopAgnosticVFSVolumeGIO*) base; - if (self->priv->_unmount_callback == NULL) { - GMount* mount; - DesktopAgnosticVFSVolumeCallback _tmp0_; - mount = NULL; - self->priv->_unmount_callback = (_tmp0_ = callback, ((self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target), self->priv->_unmount_callback = NULL, self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL), self->priv->_unmount_callback_target = callback_target, self->priv->_unmount_callback_target_destroy_notify = NULL, _tmp0_); - mount = g_volume_get_mount (self->priv->vol); - if (mount != NULL) { - g_mount_unmount (mount, G_MOUNT_UNMOUNT_NONE, NULL, _desktop_agnostic_vfs_volume_gio_on_unmount_gasync_ready_callback, self); - } - } -} - - -static gboolean desktop_agnostic_vfs_volume_gio_real_unmount_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeGIO * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - GAsyncResult* _tmp1_; - self = (DesktopAgnosticVFSVolumeGIO*) base; - _inner_error_ = NULL; - _result_ = FALSE; - { - gboolean _tmp0_; - _tmp0_ = g_mount_unmount_finish (g_volume_get_mount (self->priv->vol), self->priv->async_result, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch6_g_error; - } - _result_ = _tmp0_; - } - goto __finally6; - __catch6_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, err->message); - { - _g_error_free0 (err); - goto __finally6; - } - _g_error_free0 (err); - } - } - __finally6: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - return FALSE; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - self->priv->async_result = (_tmp1_ = NULL, _g_object_unref0 (self->priv->async_result), _tmp1_); - result = _result_; - return result; -} - - -static gboolean desktop_agnostic_vfs_volume_gio_real_can_eject (DesktopAgnosticVFSVolume* base) { - DesktopAgnosticVFSVolumeGIO * self; - gboolean result; - self = (DesktopAgnosticVFSVolumeGIO*) base; - result = g_volume_can_eject (self->priv->vol); - return result; -} - - -static void desktop_agnostic_vfs_volume_gio_on_eject (DesktopAgnosticVFSVolumeGIO* self, GObject* obj, GAsyncResult* res) { - GAsyncResult* _tmp0_; - DesktopAgnosticVFSVolumeCallback _tmp1_; - g_return_if_fail (self != NULL); - g_return_if_fail (res != NULL); - self->priv->async_result = (_tmp0_ = _g_object_ref0 (res), _g_object_unref0 (self->priv->async_result), _tmp0_); - self->priv->_eject_callback (self->priv->_eject_callback_target); - self->priv->_eject_callback = (_tmp1_ = NULL, ((self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target), self->priv->_eject_callback = NULL, self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL), self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL, _tmp1_); -} - - -static void _desktop_agnostic_vfs_volume_gio_on_eject_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) { - desktop_agnostic_vfs_volume_gio_on_eject (self, source_object, res); -} - - -static void desktop_agnostic_vfs_volume_gio_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeGIO * self; - self = (DesktopAgnosticVFSVolumeGIO*) base; - if (self->priv->_eject_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_eject_callback = (_tmp0_ = callback, ((self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target), self->priv->_eject_callback = NULL, self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL), self->priv->_eject_callback_target = callback_target, self->priv->_eject_callback_target_destroy_notify = NULL, _tmp0_); - g_volume_eject (self->priv->vol, G_MOUNT_UNMOUNT_NONE, NULL, _desktop_agnostic_vfs_volume_gio_on_eject_gasync_ready_callback, self); - } -} - - -static gboolean desktop_agnostic_vfs_volume_gio_real_eject_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeGIO * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - GAsyncResult* _tmp1_; - self = (DesktopAgnosticVFSVolumeGIO*) base; - _inner_error_ = NULL; - _result_ = FALSE; - { - gboolean _tmp0_; - _tmp0_ = g_volume_eject_finish (self->priv->vol, self->priv->async_result, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch7_g_error; - } - _result_ = _tmp0_; - } - goto __finally7; - __catch7_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT, err->message); - { - _g_error_free0 (err); - goto __finally7; - } - _g_error_free0 (err); - } - } - __finally7: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - return FALSE; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - self->priv->async_result = (_tmp1_ = NULL, _g_object_unref0 (self->priv->async_result), _tmp1_); - result = _result_; - return result; -} - - -DesktopAgnosticVFSVolumeGIO* desktop_agnostic_vfs_volume_gio_construct (GType object_type) { - DesktopAgnosticVFSVolumeGIO * self; - self = (DesktopAgnosticVFSVolumeGIO*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSVolumeGIO* desktop_agnostic_vfs_volume_gio_new (void) { - return desktop_agnostic_vfs_volume_gio_construct (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO); -} - - -static void desktop_agnostic_vfs_volume_gio_set_implementation (DesktopAgnosticVFSVolumeGIO* self, GVolume* value) { - GVolume* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->vol = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->vol), _tmp0_); - g_object_notify ((GObject *) self, "implementation"); -} - - -static const char* desktop_agnostic_vfs_volume_gio_real_get_name (DesktopAgnosticVFSVolume* base) { - const char* result; - DesktopAgnosticVFSVolumeGIO* self; - self = (DesktopAgnosticVFSVolumeGIO*) base; - result = g_volume_get_name (self->priv->vol); - return result; -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_vfs_volume_gio_real_get_uri (DesktopAgnosticVFSVolume* base) { - GError * _inner_error_; - DesktopAgnosticVFSFile* result; - DesktopAgnosticVFSVolumeGIO* self; - _inner_error_ = NULL; - self = (DesktopAgnosticVFSVolumeGIO*) base; - if (self->priv->_uri == NULL) { - GMount* mount; - mount = _g_object_ref0 (g_volume_get_mount (self->priv->vol)); - if (mount != NULL) { - GFile* file; - char* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - DesktopAgnosticVFSFile* _tmp2_; - DesktopAgnosticVFSFile* _tmp3_; - file = _g_object_ref0 (g_mount_get_root (mount)); - _tmp2_ = (_tmp1_ = desktop_agnostic_vfs_file_new_for_uri (_tmp0_ = g_file_get_uri (file), &_inner_error_), _g_free0 (_tmp0_), _tmp1_); - if (_inner_error_ != NULL) { - _g_object_unref0 (file); - _g_object_unref0 (mount); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - self->priv->_uri = (_tmp3_ = _tmp2_, _g_object_unref0 (self->priv->_uri), _tmp3_); - _g_object_unref0 (file); - } - _g_object_unref0 (mount); - } - result = self->priv->_uri; - return result; -} - - -static char* desktop_agnostic_vfs_volume_gio_real_get_icon (DesktopAgnosticVFSVolume* base) { - char* result; - DesktopAgnosticVFSVolumeGIO* self; - self = (DesktopAgnosticVFSVolumeGIO*) base; - if (self->priv->_icon == NULL) { - GIcon* icon; - icon = _g_object_ref0 (g_volume_get_icon (self->priv->vol)); - if (G_IS_THEMED_ICON (icon)) { - char** _tmp0_; - gint icon_names_size; - gint icon_names_length1; - char** icon_names; - icon_names = (_tmp0_ = (char**) g_themed_icon_get_names (G_THEMED_ICON (icon)), icon_names_length1 = -1, icon_names_size = icon_names_length1, _tmp0_); - if (icon_names_length1 > 0) { - char* _tmp1_; - self->priv->_icon = (_tmp1_ = g_strdup (icon_names[0]), _g_free0 (self->priv->_icon), _tmp1_); - } else { - char* _tmp2_; - self->priv->_icon = (_tmp2_ = g_strdup ("drive-harddisk"), _g_free0 (self->priv->_icon), _tmp2_); - } - } else { - if (G_IS_FILE_ICON (icon)) { - char* path; - char* _tmp3_; - path = g_file_get_path (g_file_icon_get_file (G_FILE_ICON (icon))); - self->priv->_icon = (_tmp3_ = g_strdup (path), _g_free0 (self->priv->_icon), _tmp3_); - _g_free0 (path); - } else { - char* _tmp4_; - g_warning ("vfs-volume-impl-gio.vala:90: Unknown icon type: %s", g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) icon))); - self->priv->_icon = (_tmp4_ = g_strdup ("drive-harddisk"), _g_free0 (self->priv->_icon), _tmp4_); - } - } - _g_object_unref0 (icon); - } - result = g_strdup (self->priv->_icon); - return result; -} - - -static void desktop_agnostic_vfs_volume_gio_class_init (DesktopAgnosticVFSVolumeGIOClass * klass) { - desktop_agnostic_vfs_volume_gio_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSVolumeGIOPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_volume_gio_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_volume_gio_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_volume_gio_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_IMPLEMENTATION, g_param_spec_object ("implementation", "implementation", "implementation", G_TYPE_VOLUME, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_URI, "uri"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_ICON, "icon"); -} - - -static void desktop_agnostic_vfs_volume_gio_desktop_agnostic_vfs_volume_interface_init (DesktopAgnosticVFSVolumeIface * iface) { - desktop_agnostic_vfs_volume_gio_desktop_agnostic_vfs_volume_parent_iface = g_type_interface_peek_parent (iface); - iface->is_mounted = desktop_agnostic_vfs_volume_gio_real_is_mounted; - iface->mount = desktop_agnostic_vfs_volume_gio_real_mount; - iface->mount_finish = desktop_agnostic_vfs_volume_gio_real_mount_finish; - iface->unmount = desktop_agnostic_vfs_volume_gio_real_unmount; - iface->unmount_finish = desktop_agnostic_vfs_volume_gio_real_unmount_finish; - iface->can_eject = desktop_agnostic_vfs_volume_gio_real_can_eject; - iface->eject = desktop_agnostic_vfs_volume_gio_real_eject; - iface->eject_finish = desktop_agnostic_vfs_volume_gio_real_eject_finish; - iface->get_name = desktop_agnostic_vfs_volume_gio_real_get_name; - iface->get_uri = desktop_agnostic_vfs_volume_gio_real_get_uri; - iface->get_icon = desktop_agnostic_vfs_volume_gio_real_get_icon; -} - - -static void desktop_agnostic_vfs_volume_gio_instance_init (DesktopAgnosticVFSVolumeGIO * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_volume_gio_finalize (GObject* obj) { - DesktopAgnosticVFSVolumeGIO * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_GIO (obj); - _g_object_unref0 (self->priv->vol); - _g_object_unref0 (self->priv->_uri); - _g_free0 (self->priv->_icon); - (self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target); - self->priv->_mount_callback = NULL; - self->priv->_mount_callback_target = NULL; - self->priv->_mount_callback_target_destroy_notify = NULL; - _g_object_unref0 (self->priv->async_result); - (self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target); - self->priv->_unmount_callback = NULL; - self->priv->_unmount_callback_target = NULL; - self->priv->_unmount_callback_target_destroy_notify = NULL; - (self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target); - self->priv->_eject_callback = NULL; - self->priv->_eject_callback_target = NULL; - self->priv->_eject_callback_target_destroy_notify = NULL; - G_OBJECT_CLASS (desktop_agnostic_vfs_volume_gio_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_volume_gio_get_type (void) { - static GType desktop_agnostic_vfs_volume_gio_type_id = 0; - if (desktop_agnostic_vfs_volume_gio_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeGIOClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_volume_gio_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSVolumeGIO), 0, (GInstanceInitFunc) desktop_agnostic_vfs_volume_gio_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_volume_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_volume_gio_desktop_agnostic_vfs_volume_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_volume_gio_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSVolumeGIO", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_volume_gio_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, &desktop_agnostic_vfs_volume_info); - } - return desktop_agnostic_vfs_volume_gio_type_id; -} - - -static void desktop_agnostic_vfs_volume_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeGIO * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_GIO (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_NAME: - g_value_set_string (value, desktop_agnostic_vfs_volume_get_name ((DesktopAgnosticVFSVolume*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_URI: - g_value_set_object (value, desktop_agnostic_vfs_volume_get_uri ((DesktopAgnosticVFSVolume*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_ICON: - g_value_set_string (value, desktop_agnostic_vfs_volume_get_icon ((DesktopAgnosticVFSVolume*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_volume_gio_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeGIO * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_GIO (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_GIO_IMPLEMENTATION: - desktop_agnostic_vfs_volume_gio_set_implementation (self, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gio_create_volume (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolume* vol) { - DesktopAgnosticVFSVolume* result; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (vol != NULL, NULL); - result = DESKTOP_AGNOSTIC_VFS_VOLUME (g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, "implementation", vol, NULL)); - return result; -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gio_check_volume (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolume* gvol) { - DesktopAgnosticVFSVolume* result; - DesktopAgnosticVFSVolume* vol; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (gvol != NULL, NULL); - vol = _g_object_ref0 ((DesktopAgnosticVFSVolume*) g_hash_table_lookup (self->priv->_volumes, gvol)); - if (vol == NULL) { - DesktopAgnosticVFSVolume* _tmp0_; - vol = (_tmp0_ = desktop_agnostic_vfs_volume_monitor_gio_create_volume (self, gvol), _g_object_unref0 (vol), _tmp0_); - g_hash_table_insert (self->priv->_volumes, _g_object_ref0 (gvol), _g_object_ref0 (vol)); - } - result = vol; - return result; -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gio_get_volume_from_mount (DesktopAgnosticVFSVolumeMonitorGIO* self, GMount* mount) { - DesktopAgnosticVFSVolume* result; - GVolume* gvol; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (mount != NULL, NULL); - gvol = _g_object_ref0 (g_mount_get_volume (mount)); - if (gvol == NULL) { - result = NULL; - _g_object_unref0 (gvol); - return result; - } else { - result = desktop_agnostic_vfs_volume_monitor_gio_check_volume (self, gvol); - _g_object_unref0 (gvol); - return result; - } - _g_object_unref0 (gvol); -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_on_mount_added (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GMount* mount) { - DesktopAgnosticVFSVolume* volume; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (mount != NULL); - volume = desktop_agnostic_vfs_volume_monitor_gio_get_volume_from_mount (self, mount); - if (volume != NULL) { - g_signal_emit_by_name ((DesktopAgnosticVFSVolumeMonitor*) self, "volume-mounted", volume); - } - _g_object_unref0 (volume); -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_on_mount_removed (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GMount* mount) { - DesktopAgnosticVFSVolume* volume; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (mount != NULL); - volume = desktop_agnostic_vfs_volume_monitor_gio_get_volume_from_mount (self, mount); - if (volume != NULL) { - g_signal_emit_by_name ((DesktopAgnosticVFSVolumeMonitor*) self, "volume-unmounted", volume); - } - _g_object_unref0 (volume); -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_on_volume_added (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GVolume* gvol) { - DesktopAgnosticVFSVolume* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (gvol != NULL); - _tmp0_ = desktop_agnostic_vfs_volume_monitor_gio_check_volume (self, gvol); - _g_object_unref0 (_tmp0_); -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_on_volume_removed (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolumeMonitor* vmonitor, GVolume* gvol) { - DesktopAgnosticVFSVolume* vol; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (gvol != NULL); - vol = _g_object_ref0 ((DesktopAgnosticVFSVolume*) g_hash_table_lookup (self->priv->_volumes, gvol)); - if (vol != NULL) { - g_hash_table_remove (self->priv->_volumes, gvol); - g_signal_emit_by_name ((DesktopAgnosticVFSVolumeMonitor*) self, "volume-unmounted", vol); - } - _g_object_unref0 (vol); -} - - -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_construct (GType object_type) { - DesktopAgnosticVFSVolumeMonitorGIO * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_new (void) { - return desktop_agnostic_vfs_volume_monitor_gio_construct (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GIO); -} - - -static void* desktop_agnostic_vfs_volume_monitor_gio_real_get_implementation (DesktopAgnosticVFSVolumeMonitor* base) { - void* result; - DesktopAgnosticVFSVolumeMonitorGIO* self; - self = (DesktopAgnosticVFSVolumeMonitorGIO*) base; - result = (void*) self->priv->monitor; - return result; -} - - -static GList* desktop_agnostic_vfs_volume_monitor_gio_real_get_volumes (DesktopAgnosticVFSVolumeMonitor* base) { - GList* result; - DesktopAgnosticVFSVolumeMonitorGIO* self; - self = (DesktopAgnosticVFSVolumeMonitorGIO*) base; - result = g_hash_table_get_values (self->priv->_volumes); - return result; -} - - -static void _desktop_agnostic_vfs_volume_monitor_gio_on_mount_added_g_volume_monitor_mount_added (GVolumeMonitor* _sender, GMount* mount, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gio_on_mount_added (self, _sender, mount); -} - - -static void _desktop_agnostic_vfs_volume_monitor_gio_on_mount_removed_g_volume_monitor_mount_removed (GVolumeMonitor* _sender, GMount* mount, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gio_on_mount_removed (self, _sender, mount); -} - - -static void _desktop_agnostic_vfs_volume_monitor_gio_on_volume_added_g_volume_monitor_volume_added (GVolumeMonitor* _sender, GVolume* volume, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gio_on_volume_added (self, _sender, volume); -} - - -static void _desktop_agnostic_vfs_volume_monitor_gio_on_volume_removed_g_volume_monitor_volume_removed (GVolumeMonitor* _sender, GVolume* volume, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gio_on_volume_removed (self, _sender, volume); -} - - -static GObject * desktop_agnostic_vfs_volume_monitor_gio_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticVFSVolumeMonitorGIO * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_vfs_volume_monitor_gio_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO (obj); - { - GVolumeMonitor* _tmp0_; - GHashTable* _tmp1_; - GList* vols; - self->priv->monitor = (_tmp0_ = _g_object_ref0 (g_volume_monitor_get ()), _g_object_unref0 (self->priv->monitor), _tmp0_); - self->priv->_volumes = (_tmp1_ = g_hash_table_new (g_direct_hash, g_direct_equal), _g_hash_table_unref0 (self->priv->_volumes), _tmp1_); - vols = g_volume_monitor_get_volumes (self->priv->monitor); - { - GList* gvol_collection; - GList* gvol_it; - gvol_collection = vols; - for (gvol_it = gvol_collection; gvol_it != NULL; gvol_it = gvol_it->next) { - GVolume* gvol; - gvol = (GVolume*) gvol_it->data; - { - DesktopAgnosticVFSVolume* vol; - vol = desktop_agnostic_vfs_volume_monitor_gio_create_volume (self, gvol); - g_hash_table_insert (self->priv->_volumes, _g_object_ref0 (gvol), _g_object_ref0 (vol)); - _g_object_unref0 (vol); - } - } - } - g_signal_connect_object (self->priv->monitor, "mount-added", (GCallback) _desktop_agnostic_vfs_volume_monitor_gio_on_mount_added_g_volume_monitor_mount_added, self, 0); - g_signal_connect_object (self->priv->monitor, "mount-removed", (GCallback) _desktop_agnostic_vfs_volume_monitor_gio_on_mount_removed_g_volume_monitor_mount_removed, self, 0); - g_signal_connect_object (self->priv->monitor, "volume-added", (GCallback) _desktop_agnostic_vfs_volume_monitor_gio_on_volume_added_g_volume_monitor_volume_added, self, 0); - g_signal_connect_object (self->priv->monitor, "volume-removed", (GCallback) _desktop_agnostic_vfs_volume_monitor_gio_on_volume_removed_g_volume_monitor_volume_removed, self, 0); - } - return obj; -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_class_init (DesktopAgnosticVFSVolumeMonitorGIOClass * klass) { - desktop_agnostic_vfs_volume_monitor_gio_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSVolumeMonitorGIOPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_volume_monitor_gio_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_vfs_volume_monitor_gio_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_volume_monitor_gio_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_IMPLEMENTATION, "implementation"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_VOLUMES, "volumes"); -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_desktop_agnostic_vfs_volume_monitor_interface_init (DesktopAgnosticVFSVolumeMonitorIface * iface) { - desktop_agnostic_vfs_volume_monitor_gio_desktop_agnostic_vfs_volume_monitor_parent_iface = g_type_interface_peek_parent (iface); - iface->get_implementation = desktop_agnostic_vfs_volume_monitor_gio_real_get_implementation; - iface->get_volumes = desktop_agnostic_vfs_volume_monitor_gio_real_get_volumes; -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_instance_init (DesktopAgnosticVFSVolumeMonitorGIO * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_finalize (GObject* obj) { - DesktopAgnosticVFSVolumeMonitorGIO * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO (obj); - _g_object_unref0 (self->priv->monitor); - _g_hash_table_unref0 (self->priv->_volumes); - G_OBJECT_CLASS (desktop_agnostic_vfs_volume_monitor_gio_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_volume_monitor_gio_get_type (void) { - static GType desktop_agnostic_vfs_volume_monitor_gio_type_id = 0; - if (desktop_agnostic_vfs_volume_monitor_gio_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeMonitorGIOClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_volume_monitor_gio_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSVolumeMonitorGIO), 0, (GInstanceInitFunc) desktop_agnostic_vfs_volume_monitor_gio_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_volume_monitor_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_volume_monitor_gio_desktop_agnostic_vfs_volume_monitor_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_volume_monitor_gio_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSVolumeMonitorGIO", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_volume_monitor_gio_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, &desktop_agnostic_vfs_volume_monitor_info); - } - return desktop_agnostic_vfs_volume_monitor_gio_type_id; -} - - -static void desktop_agnostic_vfs_volume_monitor_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeMonitorGIO * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_IMPLEMENTATION: - g_value_set_pointer (value, desktop_agnostic_vfs_volume_monitor_get_implementation ((DesktopAgnosticVFSVolumeMonitor*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GIO_VOLUMES: - g_value_set_pointer (value, desktop_agnostic_vfs_volume_monitor_get_volumes ((DesktopAgnosticVFSVolumeMonitor*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.c 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,828 +0,0 @@ -/* vfs-volume-impl-gnome-vfs.c generated by valac, the Vala compiler - * generated from vfs-volume-impl-gnome-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS Volume implementation (GNOME VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_RESULT (desktop_agnostic_vfs_volume_result_get_type ()) -typedef struct _DesktopAgnosticVFSVolumeResult DesktopAgnosticVFSVolumeResult; -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS (desktop_agnostic_vfs_volume_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeGnomeVFS DesktopAgnosticVFSVolumeGnomeVFS; -typedef struct _DesktopAgnosticVFSVolumeGnomeVFSClass DesktopAgnosticVFSVolumeGnomeVFSClass; -typedef struct _DesktopAgnosticVFSVolumeGnomeVFSPrivate DesktopAgnosticVFSVolumeGnomeVFSPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _desktop_agnostic_vfs_volume_result_free0(var) ((var == NULL) ? NULL : (var = (desktop_agnostic_vfs_volume_result_free (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS (desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GNOME_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_GNOME_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFS DesktopAgnosticVFSVolumeMonitorGnomeVFS; -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSClass DesktopAgnosticVFSVolumeMonitorGnomeVFSClass; -typedef struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate; -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) - -struct _DesktopAgnosticVFSVolumeResult { - gboolean succeeded; - char* error; - char* detailed_error; -}; - -struct _DesktopAgnosticVFSVolumeGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeGnomeVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeGnomeVFSPrivate { - GnomeVFSDrive* drive; - DesktopAgnosticVFSFile* _uri; - DesktopAgnosticVFSVolumeResult* result; - DesktopAgnosticVFSVolumeCallback _mount_callback; - gpointer _mount_callback_target; - GDestroyNotify _mount_callback_target_destroy_notify; - DesktopAgnosticVFSVolumeCallback _unmount_callback; - gpointer _unmount_callback_target; - GDestroyNotify _unmount_callback_target_destroy_notify; - DesktopAgnosticVFSVolumeCallback _eject_callback; - gpointer _eject_callback_target; - GDestroyNotify _eject_callback_target_destroy_notify; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGnomeVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate { - GnomeVFSVolumeMonitor* monitor; - GHashTable* _volumes; -}; - - -static gpointer desktop_agnostic_vfs_volume_gnome_vfs_parent_class = NULL; -static DesktopAgnosticVFSVolumeIface* desktop_agnostic_vfs_volume_gnome_vfs_desktop_agnostic_vfs_volume_parent_iface = NULL; -static gpointer desktop_agnostic_vfs_volume_monitor_gnome_vfs_parent_class = NULL; -static DesktopAgnosticVFSVolumeMonitorIface* desktop_agnostic_vfs_volume_monitor_gnome_vfs_desktop_agnostic_vfs_volume_monitor_parent_iface = NULL; - -GType desktop_agnostic_vfs_volume_result_get_type (void); -DesktopAgnosticVFSVolumeResult* desktop_agnostic_vfs_volume_result_dup (const DesktopAgnosticVFSVolumeResult* self); -void desktop_agnostic_vfs_volume_result_free (DesktopAgnosticVFSVolumeResult* self); -void desktop_agnostic_vfs_volume_result_copy (const DesktopAgnosticVFSVolumeResult* self, DesktopAgnosticVFSVolumeResult* dest); -void desktop_agnostic_vfs_volume_result_destroy (DesktopAgnosticVFSVolumeResult* self); -GType desktop_agnostic_vfs_volume_gnome_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, DesktopAgnosticVFSVolumeGnomeVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_NAME, - DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_URI, - DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_ICON -}; -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_is_mounted (DesktopAgnosticVFSVolume* base); -static void desktop_agnostic_vfs_volume_gnome_vfs_on_drive_mounted (DesktopAgnosticVFSVolumeGnomeVFS* self, gboolean succeeded, const char* _error_, const char* detailed_error); -static void desktop_agnostic_vfs_volume_gnome_vfs_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_mount_finish (DesktopAgnosticVFSVolume* base, GError** error); -static void desktop_agnostic_vfs_volume_gnome_vfs_on_drive_unmounted (DesktopAgnosticVFSVolumeGnomeVFS* self, gboolean succeeded, const char* _error_, const char* detailed_error); -static void desktop_agnostic_vfs_volume_gnome_vfs_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_unmount_finish (DesktopAgnosticVFSVolume* base, GError** error); -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_can_eject (DesktopAgnosticVFSVolume* base); -static void desktop_agnostic_vfs_volume_gnome_vfs_on_drive_ejected (DesktopAgnosticVFSVolumeGnomeVFS* self, gboolean succeeded, const char* _error_, const char* detailed_error); -static void desktop_agnostic_vfs_volume_gnome_vfs_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_eject_finish (DesktopAgnosticVFSVolume* base, GError** error); -DesktopAgnosticVFSVolumeGnomeVFS* desktop_agnostic_vfs_volume_gnome_vfs_new (void); -DesktopAgnosticVFSVolumeGnomeVFS* desktop_agnostic_vfs_volume_gnome_vfs_construct (GType object_type); -static void desktop_agnostic_vfs_volume_gnome_vfs_set_implementation (DesktopAgnosticVFSVolumeGnomeVFS* self, GnomeVFSDrive* value); -static void desktop_agnostic_vfs_volume_gnome_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_volume_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_volume_gnome_vfs_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS, DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_VOLUMES -}; -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gnome_vfs_create_volume (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSDrive* drive); -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gnome_vfs_check_volume (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSDrive* drive); -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_connected (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSDrive* drive); -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_disconnected (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSDrive* drive); -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_volume (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolume* gvol); -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_mounted (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSVolume* gvol); -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_unmounted (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSVolume* gvol); -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_new (void); -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_construct (GType object_type); -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_connected_gnome_vfs_volume_monitor_drive_connected (GnomeVFSVolumeMonitor* _sender, GnomeVFSDrive* drive, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_disconnected_gnome_vfs_volume_monitor_drive_disconnected (GnomeVFSVolumeMonitor* _sender, GnomeVFSDrive* drive, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_mounted_gnome_vfs_volume_monitor_volume_mounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_unmounted_gnome_vfs_volume_monitor_volume_unmounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self); -static GObject * desktop_agnostic_vfs_volume_monitor_gnome_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -void desktop_agnostic_vfs_volume_result_copy (const DesktopAgnosticVFSVolumeResult* self, DesktopAgnosticVFSVolumeResult* dest) { - dest->succeeded = self->succeeded; - dest->error = g_strdup (self->error); - dest->detailed_error = g_strdup (self->detailed_error); -} - - -void desktop_agnostic_vfs_volume_result_destroy (DesktopAgnosticVFSVolumeResult* self) { - _g_free0 (self->error); - _g_free0 (self->detailed_error); -} - - -DesktopAgnosticVFSVolumeResult* desktop_agnostic_vfs_volume_result_dup (const DesktopAgnosticVFSVolumeResult* self) { - DesktopAgnosticVFSVolumeResult* dup; - dup = g_new0 (DesktopAgnosticVFSVolumeResult, 1); - desktop_agnostic_vfs_volume_result_copy (self, dup); - return dup; -} - - -void desktop_agnostic_vfs_volume_result_free (DesktopAgnosticVFSVolumeResult* self) { - desktop_agnostic_vfs_volume_result_destroy (self); - g_free (self); -} - - -GType desktop_agnostic_vfs_volume_result_get_type (void) { - static GType desktop_agnostic_vfs_volume_result_type_id = 0; - if (desktop_agnostic_vfs_volume_result_type_id == 0) { - desktop_agnostic_vfs_volume_result_type_id = g_boxed_type_register_static ("DesktopAgnosticVFSVolumeResult", (GBoxedCopyFunc) desktop_agnostic_vfs_volume_result_dup, (GBoxedFreeFunc) desktop_agnostic_vfs_volume_result_free); - } - return desktop_agnostic_vfs_volume_result_type_id; -} - - -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_is_mounted (DesktopAgnosticVFSVolume* base) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - gboolean result; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - result = gnome_vfs_drive_is_mounted (self->priv->drive); - return result; -} - - -static gpointer _desktop_agnostic_vfs_volume_result_dup0 (gpointer self) { - return self ? desktop_agnostic_vfs_volume_result_dup (self) : NULL; -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_on_drive_mounted (DesktopAgnosticVFSVolumeGnomeVFS* self, gboolean succeeded, const char* _error_, const char* detailed_error) { - DesktopAgnosticVFSVolumeResult* _tmp3_; - DesktopAgnosticVFSVolumeResult _tmp2_; - DesktopAgnosticVFSVolumeResult _tmp1_; - DesktopAgnosticVFSVolumeResult _tmp0_ = {0}; - char* _tmp4_; - char* _tmp5_; - DesktopAgnosticVFSVolumeCallback _tmp6_; - g_return_if_fail (self != NULL); - g_return_if_fail (_error_ != NULL); - g_return_if_fail (detailed_error != NULL); - self->priv->result = (_tmp3_ = _desktop_agnostic_vfs_volume_result_dup0 ((_tmp2_ = _tmp1_ = (memset (&_tmp0_, 0, sizeof (DesktopAgnosticVFSVolumeResult)), _tmp0_), &_tmp2_)), _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp3_); - desktop_agnostic_vfs_volume_result_destroy (&_tmp1_); - (*self->priv->result).succeeded = succeeded; - (*self->priv->result).error = (_tmp4_ = g_strdup (_error_), _g_free0 ((*self->priv->result).error), _tmp4_); - (*self->priv->result).detailed_error = (_tmp5_ = g_strdup (detailed_error), _g_free0 ((*self->priv->result).detailed_error), _tmp5_); - self->priv->_mount_callback (self->priv->_mount_callback_target); - self->priv->_mount_callback = (_tmp6_ = NULL, ((self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target), self->priv->_mount_callback = NULL, self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL), self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL, _tmp6_); -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - if (self->priv->_mount_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_mount_callback = (_tmp0_ = callback, ((self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target), self->priv->_mount_callback = NULL, self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL), self->priv->_mount_callback_target = callback_target, self->priv->_mount_callback_target_destroy_notify = NULL, _tmp0_); - gnome_vfs_drive_mount (self->priv->drive, (GnomeVFSVolumeOpCallback) desktop_agnostic_vfs_volume_gnome_vfs_on_drive_mounted, NULL); - } -} - - -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_mount_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - DesktopAgnosticVFSVolumeResult* _tmp1_; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - _inner_error_ = NULL; - _result_ = (*self->priv->result).succeeded; - if (!_result_) { - char* msg; - DesktopAgnosticVFSVolumeResult* _tmp0_; - msg = g_strdup_printf ("%s (%s)", (*self->priv->result).error, (*self->priv->result).detailed_error); - self->priv->result = (_tmp0_ = NULL, _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp0_); - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, msg); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (msg); - return FALSE; - } else { - _g_free0 (msg); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - _g_free0 (msg); - } - self->priv->result = (_tmp1_ = NULL, _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp1_); - result = _result_; - return result; -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_on_drive_unmounted (DesktopAgnosticVFSVolumeGnomeVFS* self, gboolean succeeded, const char* _error_, const char* detailed_error) { - DesktopAgnosticVFSVolumeResult* _tmp3_; - DesktopAgnosticVFSVolumeResult _tmp2_; - DesktopAgnosticVFSVolumeResult _tmp1_; - DesktopAgnosticVFSVolumeResult _tmp0_ = {0}; - char* _tmp4_; - char* _tmp5_; - DesktopAgnosticVFSVolumeCallback _tmp6_; - g_return_if_fail (self != NULL); - g_return_if_fail (_error_ != NULL); - g_return_if_fail (detailed_error != NULL); - self->priv->result = (_tmp3_ = _desktop_agnostic_vfs_volume_result_dup0 ((_tmp2_ = _tmp1_ = (memset (&_tmp0_, 0, sizeof (DesktopAgnosticVFSVolumeResult)), _tmp0_), &_tmp2_)), _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp3_); - desktop_agnostic_vfs_volume_result_destroy (&_tmp1_); - (*self->priv->result).succeeded = succeeded; - (*self->priv->result).error = (_tmp4_ = g_strdup (_error_), _g_free0 ((*self->priv->result).error), _tmp4_); - (*self->priv->result).detailed_error = (_tmp5_ = g_strdup (detailed_error), _g_free0 ((*self->priv->result).detailed_error), _tmp5_); - self->priv->_unmount_callback (self->priv->_unmount_callback_target); - self->priv->_unmount_callback = (_tmp6_ = NULL, ((self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target), self->priv->_unmount_callback = NULL, self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL), self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL, _tmp6_); -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - if (self->priv->_unmount_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_unmount_callback = (_tmp0_ = callback, ((self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target), self->priv->_unmount_callback = NULL, self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL), self->priv->_unmount_callback_target = callback_target, self->priv->_unmount_callback_target_destroy_notify = NULL, _tmp0_); - gnome_vfs_drive_unmount (self->priv->drive, (GnomeVFSVolumeOpCallback) desktop_agnostic_vfs_volume_gnome_vfs_on_drive_unmounted, NULL); - } -} - - -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_unmount_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - DesktopAgnosticVFSVolumeResult* _tmp1_; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - _inner_error_ = NULL; - _result_ = (*self->priv->result).succeeded; - if (!_result_) { - char* msg; - DesktopAgnosticVFSVolumeResult* _tmp0_; - msg = g_strdup_printf ("%s (%s)", (*self->priv->result).error, (*self->priv->result).detailed_error); - self->priv->result = (_tmp0_ = NULL, _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp0_); - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, msg); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (msg); - return FALSE; - } else { - _g_free0 (msg); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - _g_free0 (msg); - } - self->priv->result = (_tmp1_ = NULL, _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp1_); - result = _result_; - return result; -} - - -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_can_eject (DesktopAgnosticVFSVolume* base) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - gboolean result; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - result = TRUE; - return result; -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_on_drive_ejected (DesktopAgnosticVFSVolumeGnomeVFS* self, gboolean succeeded, const char* _error_, const char* detailed_error) { - DesktopAgnosticVFSVolumeResult* _tmp3_; - DesktopAgnosticVFSVolumeResult _tmp2_; - DesktopAgnosticVFSVolumeResult _tmp1_; - DesktopAgnosticVFSVolumeResult _tmp0_ = {0}; - char* _tmp4_; - char* _tmp5_; - DesktopAgnosticVFSVolumeCallback _tmp6_; - g_return_if_fail (self != NULL); - g_return_if_fail (_error_ != NULL); - g_return_if_fail (detailed_error != NULL); - self->priv->result = (_tmp3_ = _desktop_agnostic_vfs_volume_result_dup0 ((_tmp2_ = _tmp1_ = (memset (&_tmp0_, 0, sizeof (DesktopAgnosticVFSVolumeResult)), _tmp0_), &_tmp2_)), _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp3_); - desktop_agnostic_vfs_volume_result_destroy (&_tmp1_); - (*self->priv->result).succeeded = succeeded; - (*self->priv->result).error = (_tmp4_ = g_strdup (_error_), _g_free0 ((*self->priv->result).error), _tmp4_); - (*self->priv->result).detailed_error = (_tmp5_ = g_strdup (detailed_error), _g_free0 ((*self->priv->result).detailed_error), _tmp5_); - self->priv->_eject_callback (self->priv->_eject_callback_target); - self->priv->_eject_callback = (_tmp6_ = NULL, ((self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target), self->priv->_eject_callback = NULL, self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL), self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL, _tmp6_); -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - if (self->priv->_eject_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_eject_callback = (_tmp0_ = callback, ((self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target), self->priv->_eject_callback = NULL, self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL), self->priv->_eject_callback_target = callback_target, self->priv->_eject_callback_target_destroy_notify = NULL, _tmp0_); - gnome_vfs_drive_eject (self->priv->drive, (GnomeVFSVolumeOpCallback) desktop_agnostic_vfs_volume_gnome_vfs_on_drive_ejected, NULL); - } -} - - -static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_eject_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - DesktopAgnosticVFSVolumeResult* _tmp1_; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - _inner_error_ = NULL; - _result_ = (*self->priv->result).succeeded; - if (!_result_) { - char* msg; - DesktopAgnosticVFSVolumeResult* _tmp0_; - msg = g_strdup_printf ("%s (%s)", (*self->priv->result).error, (*self->priv->result).detailed_error); - self->priv->result = (_tmp0_ = NULL, _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp0_); - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT, msg); - { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - _g_free0 (msg); - return FALSE; - } else { - _g_free0 (msg); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - _g_free0 (msg); - } - self->priv->result = (_tmp1_ = NULL, _desktop_agnostic_vfs_volume_result_free0 (self->priv->result), _tmp1_); - result = _result_; - return result; -} - - -DesktopAgnosticVFSVolumeGnomeVFS* desktop_agnostic_vfs_volume_gnome_vfs_construct (GType object_type) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSVolumeGnomeVFS* desktop_agnostic_vfs_volume_gnome_vfs_new (void) { - return desktop_agnostic_vfs_volume_gnome_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_set_implementation (DesktopAgnosticVFSVolumeGnomeVFS* self, GnomeVFSDrive* value) { - GnomeVFSDrive* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->drive = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->drive), _tmp0_); - g_object_notify ((GObject *) self, "implementation"); -} - - -static const char* desktop_agnostic_vfs_volume_gnome_vfs_real_get_name (DesktopAgnosticVFSVolume* base) { - const char* result; - DesktopAgnosticVFSVolumeGnomeVFS* self; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - result = gnome_vfs_drive_get_display_name (self->priv->drive); - return result; -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_vfs_volume_gnome_vfs_real_get_uri (DesktopAgnosticVFSVolume* base) { - GError * _inner_error_; - DesktopAgnosticVFSFile* result; - DesktopAgnosticVFSVolumeGnomeVFS* self; - _inner_error_ = NULL; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - if (self->priv->_uri == NULL) { - char* activation_uri; - DesktopAgnosticVFSFile* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - activation_uri = g_strdup (gnome_vfs_drive_get_activation_uri (self->priv->drive)); - _tmp0_ = desktop_agnostic_vfs_file_new_for_uri (activation_uri, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (activation_uri); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - self->priv->_uri = (_tmp1_ = _tmp0_, _g_object_unref0 (self->priv->_uri), _tmp1_); - _g_free0 (activation_uri); - } - result = self->priv->_uri; - return result; -} - - -static char* desktop_agnostic_vfs_volume_gnome_vfs_real_get_icon (DesktopAgnosticVFSVolume* base) { - char* result; - DesktopAgnosticVFSVolumeGnomeVFS* self; - self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; - result = g_strdup (gnome_vfs_drive_get_icon (self->priv->drive)); - return result; -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_class_init (DesktopAgnosticVFSVolumeGnomeVFSClass * klass) { - desktop_agnostic_vfs_volume_gnome_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSVolumeGnomeVFSPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_volume_gnome_vfs_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_volume_gnome_vfs_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_volume_gnome_vfs_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_IMPLEMENTATION, g_param_spec_object ("implementation", "implementation", "implementation", GNOME_VFS_TYPE_DRIVE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_URI, "uri"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_ICON, "icon"); -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_desktop_agnostic_vfs_volume_interface_init (DesktopAgnosticVFSVolumeIface * iface) { - desktop_agnostic_vfs_volume_gnome_vfs_desktop_agnostic_vfs_volume_parent_iface = g_type_interface_peek_parent (iface); - iface->is_mounted = desktop_agnostic_vfs_volume_gnome_vfs_real_is_mounted; - iface->mount = desktop_agnostic_vfs_volume_gnome_vfs_real_mount; - iface->mount_finish = desktop_agnostic_vfs_volume_gnome_vfs_real_mount_finish; - iface->unmount = desktop_agnostic_vfs_volume_gnome_vfs_real_unmount; - iface->unmount_finish = desktop_agnostic_vfs_volume_gnome_vfs_real_unmount_finish; - iface->can_eject = desktop_agnostic_vfs_volume_gnome_vfs_real_can_eject; - iface->eject = desktop_agnostic_vfs_volume_gnome_vfs_real_eject; - iface->eject_finish = desktop_agnostic_vfs_volume_gnome_vfs_real_eject_finish; - iface->get_name = desktop_agnostic_vfs_volume_gnome_vfs_real_get_name; - iface->get_uri = desktop_agnostic_vfs_volume_gnome_vfs_real_get_uri; - iface->get_icon = desktop_agnostic_vfs_volume_gnome_vfs_real_get_icon; -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_instance_init (DesktopAgnosticVFSVolumeGnomeVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS (obj); - _g_object_unref0 (self->priv->drive); - _g_object_unref0 (self->priv->_uri); - _desktop_agnostic_vfs_volume_result_free0 (self->priv->result); - (self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target); - self->priv->_mount_callback = NULL; - self->priv->_mount_callback_target = NULL; - self->priv->_mount_callback_target_destroy_notify = NULL; - (self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target); - self->priv->_unmount_callback = NULL; - self->priv->_unmount_callback_target = NULL; - self->priv->_unmount_callback_target_destroy_notify = NULL; - (self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target); - self->priv->_eject_callback = NULL; - self->priv->_eject_callback_target = NULL; - self->priv->_eject_callback_target_destroy_notify = NULL; - G_OBJECT_CLASS (desktop_agnostic_vfs_volume_gnome_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_volume_gnome_vfs_get_type (void) { - static GType desktop_agnostic_vfs_volume_gnome_vfs_type_id = 0; - if (desktop_agnostic_vfs_volume_gnome_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeGnomeVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_volume_gnome_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSVolumeGnomeVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_volume_gnome_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_volume_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_volume_gnome_vfs_desktop_agnostic_vfs_volume_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_volume_gnome_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSVolumeGnomeVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_volume_gnome_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, &desktop_agnostic_vfs_volume_info); - } - return desktop_agnostic_vfs_volume_gnome_vfs_type_id; -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_NAME: - g_value_set_string (value, desktop_agnostic_vfs_volume_get_name ((DesktopAgnosticVFSVolume*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_URI: - g_value_set_object (value, desktop_agnostic_vfs_volume_get_uri ((DesktopAgnosticVFSVolume*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_ICON: - g_value_set_string (value, desktop_agnostic_vfs_volume_get_icon ((DesktopAgnosticVFSVolume*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_volume_gnome_vfs_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_GNOME_VFS_IMPLEMENTATION: - desktop_agnostic_vfs_volume_gnome_vfs_set_implementation (self, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gnome_vfs_create_volume (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSDrive* drive) { - DesktopAgnosticVFSVolume* result; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (drive != NULL, NULL); - result = DESKTOP_AGNOSTIC_VFS_VOLUME (g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, "implementation", drive, NULL)); - return result; -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gnome_vfs_check_volume (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSDrive* drive) { - DesktopAgnosticVFSVolume* result; - DesktopAgnosticVFSVolume* vol; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (drive != NULL, NULL); - vol = _g_object_ref0 ((DesktopAgnosticVFSVolume*) g_hash_table_lookup (self->priv->_volumes, drive)); - if (vol == NULL) { - DesktopAgnosticVFSVolume* _tmp0_; - vol = (_tmp0_ = desktop_agnostic_vfs_volume_monitor_gnome_vfs_create_volume (self, drive), _g_object_unref0 (vol), _tmp0_); - g_hash_table_insert (self->priv->_volumes, _g_object_ref0 (drive), _g_object_ref0 (vol)); - } - result = vol; - return result; -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_connected (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSDrive* drive) { - DesktopAgnosticVFSVolume* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (drive != NULL); - _tmp0_ = desktop_agnostic_vfs_volume_monitor_gnome_vfs_check_volume (self, drive); - _g_object_unref0 (_tmp0_); -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_disconnected (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSDrive* drive) { - DesktopAgnosticVFSVolume* vol; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (drive != NULL); - vol = _g_object_ref0 ((DesktopAgnosticVFSVolume*) g_hash_table_lookup (self->priv->_volumes, drive)); - if (vol != NULL) { - g_hash_table_remove (self->priv->_volumes, drive); - } - _g_object_unref0 (vol); -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_volume (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolume* gvol) { - DesktopAgnosticVFSVolume* result; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (gvol != NULL, NULL); - result = desktop_agnostic_vfs_volume_monitor_gnome_vfs_check_volume (self, gnome_vfs_volume_get_drive (gvol)); - return result; -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_mounted (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSVolume* gvol) { - DesktopAgnosticVFSVolume* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (gvol != NULL); - g_signal_emit_by_name ((DesktopAgnosticVFSVolumeMonitor*) self, "volume-mounted", _tmp0_ = desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_volume (self, gvol)); - _g_object_unref0 (_tmp0_); -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_unmounted (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSVolumeMonitor* vmonitor, GnomeVFSVolume* gvol) { - DesktopAgnosticVFSVolume* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (vmonitor != NULL); - g_return_if_fail (gvol != NULL); - g_signal_emit_by_name ((DesktopAgnosticVFSVolumeMonitor*) self, "volume-unmounted", _tmp0_ = desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_volume (self, gvol)); - _g_object_unref0 (_tmp0_); -} - - -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_construct (GType object_type) { - DesktopAgnosticVFSVolumeMonitorGnomeVFS * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticVFSVolumeMonitorGnomeVFS* desktop_agnostic_vfs_volume_monitor_gnome_vfs_new (void) { - return desktop_agnostic_vfs_volume_monitor_gnome_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_GNOME_VFS); -} - - -static void* desktop_agnostic_vfs_volume_monitor_gnome_vfs_real_get_implementation (DesktopAgnosticVFSVolumeMonitor* base) { - void* result; - DesktopAgnosticVFSVolumeMonitorGnomeVFS* self; - self = (DesktopAgnosticVFSVolumeMonitorGnomeVFS*) base; - result = (void*) self->priv->monitor; - return result; -} - - -static GList* desktop_agnostic_vfs_volume_monitor_gnome_vfs_real_get_volumes (DesktopAgnosticVFSVolumeMonitor* base) { - GList* result; - DesktopAgnosticVFSVolumeMonitorGnomeVFS* self; - self = (DesktopAgnosticVFSVolumeMonitorGnomeVFS*) base; - result = g_hash_table_get_values (self->priv->_volumes); - return result; -} - - -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_connected_gnome_vfs_volume_monitor_drive_connected (GnomeVFSVolumeMonitor* _sender, GnomeVFSDrive* drive, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_connected (self, _sender, drive); -} - - -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_disconnected_gnome_vfs_volume_monitor_drive_disconnected (GnomeVFSVolumeMonitor* _sender, GnomeVFSDrive* drive, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_disconnected (self, _sender, drive); -} - - -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_mounted_gnome_vfs_volume_monitor_volume_mounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_mounted (self, _sender, volume); -} - - -static void _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_unmounted_gnome_vfs_volume_monitor_volume_unmounted (GnomeVFSVolumeMonitor* _sender, GnomeVFSVolume* volume, gpointer self) { - desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_unmounted (self, _sender, volume); -} - - -static GObject * desktop_agnostic_vfs_volume_monitor_gnome_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticVFSVolumeMonitorGnomeVFS * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_vfs_volume_monitor_gnome_vfs_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS (obj); - { - GnomeVFSVolumeMonitor* _tmp0_; - GHashTable* _tmp1_; - GList* drives; - self->priv->monitor = (_tmp0_ = _g_object_ref0 (gnome_vfs_get_volume_monitor ()), _g_object_unref0 (self->priv->monitor), _tmp0_); - self->priv->_volumes = (_tmp1_ = g_hash_table_new (g_direct_hash, g_direct_equal), _g_hash_table_unref0 (self->priv->_volumes), _tmp1_); - drives = gnome_vfs_volume_monitor_get_connected_drives (self->priv->monitor); - { - GList* drive_collection; - GList* drive_it; - drive_collection = drives; - for (drive_it = drive_collection; drive_it != NULL; drive_it = drive_it->next) { - GnomeVFSDrive* drive; - drive = (GnomeVFSDrive*) drive_it->data; - { - DesktopAgnosticVFSVolume* vol; - vol = desktop_agnostic_vfs_volume_monitor_gnome_vfs_create_volume (self, drive); - g_hash_table_insert (self->priv->_volumes, _g_object_ref0 (drive), _g_object_ref0 (vol)); - _g_object_unref0 (vol); - } - } - } - g_signal_connect_object (self->priv->monitor, "drive-connected", (GCallback) _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_connected_gnome_vfs_volume_monitor_drive_connected, self, 0); - g_signal_connect_object (self->priv->monitor, "drive-disconnected", (GCallback) _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_drive_disconnected_gnome_vfs_volume_monitor_drive_disconnected, self, 0); - g_signal_connect_object (self->priv->monitor, "volume-mounted", (GCallback) _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_mounted_gnome_vfs_volume_monitor_volume_mounted, self, 0); - g_signal_connect_object (self->priv->monitor, "volume-unmounted", (GCallback) _desktop_agnostic_vfs_volume_monitor_gnome_vfs_on_volume_unmounted_gnome_vfs_volume_monitor_volume_unmounted, self, 0); - } - return obj; -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_class_init (DesktopAgnosticVFSVolumeMonitorGnomeVFSClass * klass) { - desktop_agnostic_vfs_volume_monitor_gnome_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSVolumeMonitorGnomeVFSPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_vfs_volume_monitor_gnome_vfs_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_volume_monitor_gnome_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_IMPLEMENTATION, "implementation"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_VOLUMES, "volumes"); -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_desktop_agnostic_vfs_volume_monitor_interface_init (DesktopAgnosticVFSVolumeMonitorIface * iface) { - desktop_agnostic_vfs_volume_monitor_gnome_vfs_desktop_agnostic_vfs_volume_monitor_parent_iface = g_type_interface_peek_parent (iface); - iface->get_implementation = desktop_agnostic_vfs_volume_monitor_gnome_vfs_real_get_implementation; - iface->get_volumes = desktop_agnostic_vfs_volume_monitor_gnome_vfs_real_get_volumes; -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_instance_init (DesktopAgnosticVFSVolumeMonitorGnomeVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSVolumeMonitorGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS (obj); - _g_object_unref0 (self->priv->monitor); - _g_hash_table_unref0 (self->priv->_volumes); - G_OBJECT_CLASS (desktop_agnostic_vfs_volume_monitor_gnome_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_type (void) { - static GType desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id = 0; - if (desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeMonitorGnomeVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_volume_monitor_gnome_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSVolumeMonitorGnomeVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_volume_monitor_gnome_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_volume_monitor_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_volume_monitor_gnome_vfs_desktop_agnostic_vfs_volume_monitor_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSVolumeMonitorGnomeVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, &desktop_agnostic_vfs_volume_monitor_info); - } - return desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id; -} - - -static void desktop_agnostic_vfs_volume_monitor_gnome_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeMonitorGnomeVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_IMPLEMENTATION: - g_value_set_pointer (value, desktop_agnostic_vfs_volume_monitor_get_implementation ((DesktopAgnosticVFSVolumeMonitor*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_GNOME_VFS_VOLUMES: - g_value_set_pointer (value, desktop_agnostic_vfs_volume_monitor_get_volumes ((DesktopAgnosticVFSVolumeMonitor*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.c --- libdesktop-agnostic-0.3.90/gen_src/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.c 2010-04-11 07:32:27.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,838 +0,0 @@ -/* vfs-volume-impl-thunar-vfs.c generated by valac, the Vala compiler - * generated from vfs-volume-impl-thunar-vfs.vala, do not modify */ - -/* - * Desktop Agnostic Library: VFS Volume implementation (Thunar VFS). - * - * Copyright (C) 2009 Mark Lee - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include - - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS (desktop_agnostic_vfs_volume_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeThunarVFS DesktopAgnosticVFSVolumeThunarVFS; -typedef struct _DesktopAgnosticVFSVolumeThunarVFSClass DesktopAgnosticVFSVolumeThunarVFSClass; -typedef struct _DesktopAgnosticVFSVolumeThunarVFSPrivate DesktopAgnosticVFSVolumeThunarVFSPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _thunar_vfs_path_unref0(var) ((var == NULL) ? NULL : (var = (thunar_vfs_path_unref (var), NULL))) - -#define DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS (desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_type ()) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFSClass)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_THUNAR_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_IS_VOLUME_MONITOR_THUNAR_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS)) -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFSClass)) - -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFS DesktopAgnosticVFSVolumeMonitorThunarVFS; -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFSClass DesktopAgnosticVFSVolumeMonitorThunarVFSClass; -typedef struct _DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate; -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) - -struct _DesktopAgnosticVFSVolumeThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeThunarVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeThunarVFSPrivate { - ThunarVfsVolume* vol; - DesktopAgnosticVFSFile* _uri; - DesktopAgnosticVFSVolumeCallback _mount_callback; - gpointer _mount_callback_target; - GDestroyNotify _mount_callback_target_destroy_notify; - DesktopAgnosticVFSVolumeCallback _unmount_callback; - gpointer _unmount_callback_target; - GDestroyNotify _unmount_callback_target_destroy_notify; - DesktopAgnosticVFSVolumeCallback _eject_callback; - gpointer _eject_callback_target; - GDestroyNotify _eject_callback_target_destroy_notify; -}; - -struct _DesktopAgnosticVFSVolumeMonitorThunarVFS { - GObject parent_instance; - DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate * priv; -}; - -struct _DesktopAgnosticVFSVolumeMonitorThunarVFSClass { - GObjectClass parent_class; -}; - -struct _DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate { - ThunarVfsVolumeManager* manager; - GHashTable* _volumes; -}; - - -static gpointer desktop_agnostic_vfs_volume_thunar_vfs_parent_class = NULL; -static DesktopAgnosticVFSVolumeIface* desktop_agnostic_vfs_volume_thunar_vfs_desktop_agnostic_vfs_volume_parent_iface = NULL; -static gpointer desktop_agnostic_vfs_volume_monitor_thunar_vfs_parent_class = NULL; -static DesktopAgnosticVFSVolumeMonitorIface* desktop_agnostic_vfs_volume_monitor_thunar_vfs_desktop_agnostic_vfs_volume_monitor_parent_iface = NULL; - -GType desktop_agnostic_vfs_volume_thunar_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, DesktopAgnosticVFSVolumeThunarVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_NAME, - DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_URI, - DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_ICON -}; -static void desktop_agnostic_vfs_volume_thunar_vfs_set_implementation (DesktopAgnosticVFSVolumeThunarVFS* self, ThunarVfsVolume* value); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_new_for_implementation (ThunarVfsVolume* impl); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_construct_for_implementation (GType object_type, ThunarVfsVolume* impl); -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_is_mounted (DesktopAgnosticVFSVolume* base); -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_mount (DesktopAgnosticVFSVolumeThunarVFS* self); -static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_mount_gsource_func (gpointer self); -static void desktop_agnostic_vfs_volume_thunar_vfs_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_mount_finish (DesktopAgnosticVFSVolume* base, GError** error); -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_unmount (DesktopAgnosticVFSVolumeThunarVFS* self); -static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_unmount_gsource_func (gpointer self); -static void desktop_agnostic_vfs_volume_thunar_vfs_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_unmount_finish (DesktopAgnosticVFSVolume* base, GError** error); -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_can_eject (DesktopAgnosticVFSVolume* base); -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_eject (DesktopAgnosticVFSVolumeThunarVFS* self); -static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_eject_gsource_func (gpointer self); -static void desktop_agnostic_vfs_volume_thunar_vfs_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_eject_finish (DesktopAgnosticVFSVolume* base, GError** error); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_new (void); -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_construct (GType object_type); -static void desktop_agnostic_vfs_volume_thunar_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_volume_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void desktop_agnostic_vfs_volume_thunar_vfs_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_type (void); -#define DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS, DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate)) -enum { - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_DUMMY_PROPERTY, - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_IMPLEMENTATION, - DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_VOLUMES -}; -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_thunar_vfs_create_volume (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolume* vol); -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_thunar_vfs_check_volume (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolume* tvol); -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_added (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, ThunarVfsVolume* vol); -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_removed (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, ThunarVfsVolume* vol); -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_added (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, void* ptr); -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_removed (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, void* ptr); -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_new (void); -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_construct (GType object_type); -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_added_thunar_vfs_volume_manager_volume_mounted (ThunarVfsVolumeManager* _sender, ThunarVfsVolume* p0, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_removed_thunar_vfs_volume_manager_volume_unmounted (ThunarVfsVolumeManager* _sender, ThunarVfsVolume* p0, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_added_thunar_vfs_volume_manager_volumes_added (ThunarVfsVolumeManager* _sender, void* p0, gpointer self); -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_removed_thunar_vfs_volume_manager_volumes_removed (ThunarVfsVolumeManager* _sender, void* p0, gpointer self); -static GObject * desktop_agnostic_vfs_volume_monitor_thunar_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_finalize (GObject* obj); -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); - - - -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_construct_for_implementation (GType object_type, ThunarVfsVolume* impl) { - GParameter * __params; - GParameter * __params_it; - DesktopAgnosticVFSVolumeThunarVFS * self; - g_return_val_if_fail (impl != NULL, NULL); - __params = g_new0 (GParameter, 1); - __params_it = __params; - __params_it->name = "implementation"; - g_value_init (&__params_it->value, THUNAR_VFS_TYPE_VOLUME); - g_value_set_object (&__params_it->value, impl); - __params_it++; - self = g_object_newv (object_type, __params_it - __params, __params); - while (__params_it > __params) { - --__params_it; - g_value_unset (&__params_it->value); - } - g_free (__params); - return self; -} - - -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_new_for_implementation (ThunarVfsVolume* impl) { - return desktop_agnostic_vfs_volume_thunar_vfs_construct_for_implementation (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS, impl); -} - - -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_is_mounted (DesktopAgnosticVFSVolume* base) { - DesktopAgnosticVFSVolumeThunarVFS * self; - gboolean result; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - result = thunar_vfs_volume_is_mounted (self->priv->vol); - return result; -} - - -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_mount (DesktopAgnosticVFSVolumeThunarVFS* self) { - gboolean result; - DesktopAgnosticVFSVolumeCallback _tmp0_; - g_return_val_if_fail (self != NULL, FALSE); - self->priv->_mount_callback (self->priv->_mount_callback_target); - self->priv->_mount_callback = (_tmp0_ = NULL, ((self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target), self->priv->_mount_callback = NULL, self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL), self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL, _tmp0_); - result = FALSE; - return result; -} - - -static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_mount_gsource_func (gpointer self) { - return desktop_agnostic_vfs_volume_thunar_vfs_do_mount (self); -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeThunarVFS * self; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - if (self->priv->_mount_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_mount_callback = (_tmp0_ = callback, ((self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target), self->priv->_mount_callback = NULL, self->priv->_mount_callback_target = NULL, self->priv->_mount_callback_target_destroy_notify = NULL), self->priv->_mount_callback_target = callback_target, self->priv->_mount_callback_target_destroy_notify = NULL, _tmp0_); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _desktop_agnostic_vfs_volume_thunar_vfs_do_mount_gsource_func, g_object_ref (self), g_object_unref); - } -} - - -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_mount_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeThunarVFS * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - _inner_error_ = NULL; - _result_ = FALSE; - { - gboolean _tmp0_; - _tmp0_ = thunar_vfs_volume_mount (self->priv->vol, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch5_g_error; - } - _result_ = _tmp0_; - } - goto __finally5; - __catch5_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_MOUNT, err->message); - { - _g_error_free0 (err); - goto __finally5; - } - _g_error_free0 (err); - } - } - __finally5: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - return FALSE; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - result = _result_; - return result; -} - - -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_unmount (DesktopAgnosticVFSVolumeThunarVFS* self) { - gboolean result; - DesktopAgnosticVFSVolumeCallback _tmp0_; - g_return_val_if_fail (self != NULL, FALSE); - self->priv->_unmount_callback (self->priv->_unmount_callback_target); - self->priv->_unmount_callback = (_tmp0_ = NULL, ((self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target), self->priv->_unmount_callback = NULL, self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL), self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL, _tmp0_); - result = FALSE; - return result; -} - - -static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_unmount_gsource_func (gpointer self) { - return desktop_agnostic_vfs_volume_thunar_vfs_do_unmount (self); -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeThunarVFS * self; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - if (self->priv->_unmount_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_unmount_callback = (_tmp0_ = callback, ((self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target), self->priv->_unmount_callback = NULL, self->priv->_unmount_callback_target = NULL, self->priv->_unmount_callback_target_destroy_notify = NULL), self->priv->_unmount_callback_target = callback_target, self->priv->_unmount_callback_target_destroy_notify = NULL, _tmp0_); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _desktop_agnostic_vfs_volume_thunar_vfs_do_unmount_gsource_func, g_object_ref (self), g_object_unref); - } -} - - -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_unmount_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeThunarVFS * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - _inner_error_ = NULL; - _result_ = FALSE; - { - gboolean _tmp0_; - _tmp0_ = thunar_vfs_volume_unmount (self->priv->vol, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch6_g_error; - } - _result_ = _tmp0_; - } - goto __finally6; - __catch6_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_UNMOUNT, err->message); - { - _g_error_free0 (err); - goto __finally6; - } - _g_error_free0 (err); - } - } - __finally6: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - return FALSE; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - result = _result_; - return result; -} - - -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_can_eject (DesktopAgnosticVFSVolume* base) { - DesktopAgnosticVFSVolumeThunarVFS * self; - gboolean result; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - result = thunar_vfs_volume_is_ejectable (self->priv->vol); - return result; -} - - -gboolean desktop_agnostic_vfs_volume_thunar_vfs_do_eject (DesktopAgnosticVFSVolumeThunarVFS* self) { - gboolean result; - DesktopAgnosticVFSVolumeCallback _tmp0_; - g_return_val_if_fail (self != NULL, FALSE); - self->priv->_eject_callback (self->priv->_eject_callback_target); - self->priv->_eject_callback = (_tmp0_ = NULL, ((self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target), self->priv->_eject_callback = NULL, self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL), self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL, _tmp0_); - result = FALSE; - return result; -} - - -static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_eject_gsource_func (gpointer self) { - return desktop_agnostic_vfs_volume_thunar_vfs_do_eject (self); -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target) { - DesktopAgnosticVFSVolumeThunarVFS * self; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - if (self->priv->_eject_callback == NULL) { - DesktopAgnosticVFSVolumeCallback _tmp0_; - self->priv->_eject_callback = (_tmp0_ = callback, ((self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target), self->priv->_eject_callback = NULL, self->priv->_eject_callback_target = NULL, self->priv->_eject_callback_target_destroy_notify = NULL), self->priv->_eject_callback_target = callback_target, self->priv->_eject_callback_target_destroy_notify = NULL, _tmp0_); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _desktop_agnostic_vfs_volume_thunar_vfs_do_eject_gsource_func, g_object_ref (self), g_object_unref); - } -} - - -static gboolean desktop_agnostic_vfs_volume_thunar_vfs_real_eject_finish (DesktopAgnosticVFSVolume* base, GError** error) { - DesktopAgnosticVFSVolumeThunarVFS * self; - gboolean result; - GError * _inner_error_; - gboolean _result_; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - _inner_error_ = NULL; - _result_ = FALSE; - { - gboolean _tmp0_; - _tmp0_ = thunar_vfs_volume_eject (self->priv->vol, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch7_g_error; - } - _result_ = _tmp0_; - } - goto __finally7; - __catch7_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR, DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR_EJECT, err->message); - { - _g_error_free0 (err); - goto __finally7; - } - _g_error_free0 (err); - } - } - __finally7: - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_VOLUME_ERROR) { - g_propagate_error (error, _inner_error_); - return FALSE; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - result = _result_; - return result; -} - - -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_construct (GType object_type) { - DesktopAgnosticVFSVolumeThunarVFS * self; - self = (DesktopAgnosticVFSVolumeThunarVFS*) g_object_new (object_type, NULL); - return self; -} - - -DesktopAgnosticVFSVolumeThunarVFS* desktop_agnostic_vfs_volume_thunar_vfs_new (void) { - return desktop_agnostic_vfs_volume_thunar_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_THUNAR_VFS); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_set_implementation (DesktopAgnosticVFSVolumeThunarVFS* self, ThunarVfsVolume* value) { - ThunarVfsVolume* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->vol = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->vol), _tmp0_); - g_object_notify ((GObject *) self, "implementation"); -} - - -static const char* desktop_agnostic_vfs_volume_thunar_vfs_real_get_name (DesktopAgnosticVFSVolume* base) { - const char* result; - DesktopAgnosticVFSVolumeThunarVFS* self; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - result = thunar_vfs_volume_get_name (self->priv->vol); - return result; -} - - -static gpointer _thunar_vfs_path_ref0 (gpointer self) { - return self ? thunar_vfs_path_ref (self) : NULL; -} - - -static DesktopAgnosticVFSFile* desktop_agnostic_vfs_volume_thunar_vfs_real_get_uri (DesktopAgnosticVFSVolume* base) { - GError * _inner_error_; - DesktopAgnosticVFSFile* result; - DesktopAgnosticVFSVolumeThunarVFS* self; - _inner_error_ = NULL; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - if (self->priv->_uri == NULL) { - ThunarVfsPath* path; - DesktopAgnosticVFSFile* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - path = _thunar_vfs_path_ref0 (thunar_vfs_volume_get_mount_point (self->priv->vol)); - _tmp0_ = desktop_agnostic_vfs_file_new_for_uri (thunar_vfs_path_dup_uri (path), &_inner_error_); - if (_inner_error_ != NULL) { - _thunar_vfs_path_unref0 (path); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - self->priv->_uri = (_tmp1_ = _tmp0_, _g_object_unref0 (self->priv->_uri), _tmp1_); - _thunar_vfs_path_unref0 (path); - } - result = self->priv->_uri; - return result; -} - - -static char* desktop_agnostic_vfs_volume_thunar_vfs_real_get_icon (DesktopAgnosticVFSVolume* base) { - char* result; - DesktopAgnosticVFSVolumeThunarVFS* self; - self = (DesktopAgnosticVFSVolumeThunarVFS*) base; - result = g_strdup (thunar_vfs_volume_lookup_icon_name (self->priv->vol, gtk_icon_theme_get_default ())); - return result; -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_class_init (DesktopAgnosticVFSVolumeThunarVFSClass * klass) { - desktop_agnostic_vfs_volume_thunar_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSVolumeThunarVFSPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_volume_thunar_vfs_get_property; - G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_volume_thunar_vfs_set_property; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_volume_thunar_vfs_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_IMPLEMENTATION, g_param_spec_object ("implementation", "implementation", "implementation", THUNAR_VFS_TYPE_VOLUME, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_NAME, "name"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_URI, "uri"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_ICON, "icon"); -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_desktop_agnostic_vfs_volume_interface_init (DesktopAgnosticVFSVolumeIface * iface) { - desktop_agnostic_vfs_volume_thunar_vfs_desktop_agnostic_vfs_volume_parent_iface = g_type_interface_peek_parent (iface); - iface->is_mounted = desktop_agnostic_vfs_volume_thunar_vfs_real_is_mounted; - iface->mount = desktop_agnostic_vfs_volume_thunar_vfs_real_mount; - iface->mount_finish = desktop_agnostic_vfs_volume_thunar_vfs_real_mount_finish; - iface->unmount = desktop_agnostic_vfs_volume_thunar_vfs_real_unmount; - iface->unmount_finish = desktop_agnostic_vfs_volume_thunar_vfs_real_unmount_finish; - iface->can_eject = desktop_agnostic_vfs_volume_thunar_vfs_real_can_eject; - iface->eject = desktop_agnostic_vfs_volume_thunar_vfs_real_eject; - iface->eject_finish = desktop_agnostic_vfs_volume_thunar_vfs_real_eject_finish; - iface->get_name = desktop_agnostic_vfs_volume_thunar_vfs_real_get_name; - iface->get_uri = desktop_agnostic_vfs_volume_thunar_vfs_real_get_uri; - iface->get_icon = desktop_agnostic_vfs_volume_thunar_vfs_real_get_icon; -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_instance_init (DesktopAgnosticVFSVolumeThunarVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSVolumeThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS (obj); - _g_object_unref0 (self->priv->vol); - _g_object_unref0 (self->priv->_uri); - (self->priv->_mount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_mount_callback_target_destroy_notify (self->priv->_mount_callback_target); - self->priv->_mount_callback = NULL; - self->priv->_mount_callback_target = NULL; - self->priv->_mount_callback_target_destroy_notify = NULL; - (self->priv->_unmount_callback_target_destroy_notify == NULL) ? NULL : self->priv->_unmount_callback_target_destroy_notify (self->priv->_unmount_callback_target); - self->priv->_unmount_callback = NULL; - self->priv->_unmount_callback_target = NULL; - self->priv->_unmount_callback_target_destroy_notify = NULL; - (self->priv->_eject_callback_target_destroy_notify == NULL) ? NULL : self->priv->_eject_callback_target_destroy_notify (self->priv->_eject_callback_target); - self->priv->_eject_callback = NULL; - self->priv->_eject_callback_target = NULL; - self->priv->_eject_callback_target_destroy_notify = NULL; - G_OBJECT_CLASS (desktop_agnostic_vfs_volume_thunar_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_volume_thunar_vfs_get_type (void) { - static GType desktop_agnostic_vfs_volume_thunar_vfs_type_id = 0; - if (desktop_agnostic_vfs_volume_thunar_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeThunarVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_volume_thunar_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSVolumeThunarVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_volume_thunar_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_volume_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_volume_thunar_vfs_desktop_agnostic_vfs_volume_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_volume_thunar_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSVolumeThunarVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_volume_thunar_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME, &desktop_agnostic_vfs_volume_info); - } - return desktop_agnostic_vfs_volume_thunar_vfs_type_id; -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_NAME: - g_value_set_string (value, desktop_agnostic_vfs_volume_get_name ((DesktopAgnosticVFSVolume*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_URI: - g_value_set_object (value, desktop_agnostic_vfs_volume_get_uri ((DesktopAgnosticVFSVolume*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_ICON: - g_value_set_string (value, desktop_agnostic_vfs_volume_get_icon ((DesktopAgnosticVFSVolume*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void desktop_agnostic_vfs_volume_thunar_vfs_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_THUNAR_VFS_IMPLEMENTATION: - desktop_agnostic_vfs_volume_thunar_vfs_set_implementation (self, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_thunar_vfs_create_volume (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolume* vol) { - DesktopAgnosticVFSVolume* result; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (vol != NULL, NULL); - result = (DesktopAgnosticVFSVolume*) desktop_agnostic_vfs_volume_thunar_vfs_new_for_implementation (vol); - return result; -} - - -static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_thunar_vfs_check_volume (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolume* tvol) { - DesktopAgnosticVFSVolume* result; - DesktopAgnosticVFSVolume* vol; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (tvol != NULL, NULL); - vol = _g_object_ref0 ((DesktopAgnosticVFSVolume*) g_hash_table_lookup (self->priv->_volumes, tvol)); - if (vol == NULL) { - DesktopAgnosticVFSVolume* _tmp0_; - vol = (_tmp0_ = desktop_agnostic_vfs_volume_monitor_thunar_vfs_create_volume (self, tvol), _g_object_unref0 (vol), _tmp0_); - g_hash_table_insert (self->priv->_volumes, _g_object_ref0 (tvol), _g_object_ref0 (vol)); - } - result = vol; - return result; -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_added (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, ThunarVfsVolume* vol) { - DesktopAgnosticVFSVolume* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (manager != NULL); - g_return_if_fail (vol != NULL); - g_signal_emit_by_name ((DesktopAgnosticVFSVolumeMonitor*) self, "volume-mounted", _tmp0_ = desktop_agnostic_vfs_volume_monitor_thunar_vfs_check_volume (self, vol)); - _g_object_unref0 (_tmp0_); -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_removed (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, ThunarVfsVolume* vol) { - DesktopAgnosticVFSVolume* _tmp0_; - g_return_if_fail (self != NULL); - g_return_if_fail (manager != NULL); - g_return_if_fail (vol != NULL); - g_signal_emit_by_name ((DesktopAgnosticVFSVolumeMonitor*) self, "volume-unmounted", _tmp0_ = desktop_agnostic_vfs_volume_monitor_thunar_vfs_check_volume (self, vol)); - _g_object_unref0 (_tmp0_); -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_added (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, void* ptr) { - GList* vols; - g_return_if_fail (self != NULL); - g_return_if_fail (manager != NULL); - vols = (GList*) ptr; - { - GList* tvol_collection; - GList* tvol_it; - tvol_collection = vols; - for (tvol_it = tvol_collection; tvol_it != NULL; tvol_it = tvol_it->next) { - ThunarVfsVolume* tvol; - tvol = (ThunarVfsVolume*) tvol_it->data; - { - DesktopAgnosticVFSVolume* _tmp0_; - _tmp0_ = desktop_agnostic_vfs_volume_monitor_thunar_vfs_check_volume (self, tvol); - _g_object_unref0 (_tmp0_); - } - } - } -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_removed (DesktopAgnosticVFSVolumeMonitorThunarVFS* self, ThunarVfsVolumeManager* manager, void* ptr) { - GList* vols; - g_return_if_fail (self != NULL); - g_return_if_fail (manager != NULL); - vols = (GList*) ptr; - { - GList* tvol_collection; - GList* tvol_it; - tvol_collection = vols; - for (tvol_it = tvol_collection; tvol_it != NULL; tvol_it = tvol_it->next) { - ThunarVfsVolume* tvol; - tvol = (ThunarVfsVolume*) tvol_it->data; - { - DesktopAgnosticVFSVolume* vol; - vol = _g_object_ref0 ((DesktopAgnosticVFSVolume*) g_hash_table_lookup (self->priv->_volumes, tvol)); - if (vol != NULL) { - g_hash_table_remove (self->priv->_volumes, tvol); - } - _g_object_unref0 (vol); - } - } - } -} - - -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_construct (GType object_type) { - DesktopAgnosticVFSVolumeMonitorThunarVFS * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -DesktopAgnosticVFSVolumeMonitorThunarVFS* desktop_agnostic_vfs_volume_monitor_thunar_vfs_new (void) { - return desktop_agnostic_vfs_volume_monitor_thunar_vfs_construct (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR_THUNAR_VFS); -} - - -static void* desktop_agnostic_vfs_volume_monitor_thunar_vfs_real_get_implementation (DesktopAgnosticVFSVolumeMonitor* base) { - void* result; - DesktopAgnosticVFSVolumeMonitorThunarVFS* self; - self = (DesktopAgnosticVFSVolumeMonitorThunarVFS*) base; - result = (void*) self->priv->manager; - return result; -} - - -static GList* desktop_agnostic_vfs_volume_monitor_thunar_vfs_real_get_volumes (DesktopAgnosticVFSVolumeMonitor* base) { - GList* result; - DesktopAgnosticVFSVolumeMonitorThunarVFS* self; - self = (DesktopAgnosticVFSVolumeMonitorThunarVFS*) base; - result = g_hash_table_get_values (self->priv->_volumes); - return result; -} - - -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_added_thunar_vfs_volume_manager_volume_mounted (ThunarVfsVolumeManager* _sender, ThunarVfsVolume* p0, gpointer self) { - desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_added (self, _sender, p0); -} - - -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_removed_thunar_vfs_volume_manager_volume_unmounted (ThunarVfsVolumeManager* _sender, ThunarVfsVolume* p0, gpointer self) { - desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_removed (self, _sender, p0); -} - - -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_added_thunar_vfs_volume_manager_volumes_added (ThunarVfsVolumeManager* _sender, void* p0, gpointer self) { - desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_added (self, _sender, p0); -} - - -static void _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_removed_thunar_vfs_volume_manager_volumes_removed (ThunarVfsVolumeManager* _sender, void* p0, gpointer self) { - desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_removed (self, _sender, p0); -} - - -static GObject * desktop_agnostic_vfs_volume_monitor_thunar_vfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - DesktopAgnosticVFSVolumeMonitorThunarVFS * self; - parent_class = G_OBJECT_CLASS (desktop_agnostic_vfs_volume_monitor_thunar_vfs_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS (obj); - { - ThunarVfsVolumeManager* _tmp0_; - GHashTable* _tmp1_; - GList* vols; - self->priv->manager = (_tmp0_ = _g_object_ref0 (thunar_vfs_volume_manager_get_default ()), _g_object_unref0 (self->priv->manager), _tmp0_); - self->priv->_volumes = (_tmp1_ = g_hash_table_new (g_direct_hash, g_direct_equal), _g_hash_table_unref0 (self->priv->_volumes), _tmp1_); - vols = thunar_vfs_volume_manager_get_volumes (self->priv->manager); - { - GList* tvol_collection; - GList* tvol_it; - tvol_collection = vols; - for (tvol_it = tvol_collection; tvol_it != NULL; tvol_it = tvol_it->next) { - ThunarVfsVolume* tvol; - tvol = (ThunarVfsVolume*) tvol_it->data; - { - g_hash_table_insert (self->priv->_volumes, _g_object_ref0 (tvol), desktop_agnostic_vfs_volume_monitor_thunar_vfs_create_volume (self, tvol)); - } - } - } - g_signal_connect_object (self->priv->manager, "volume-mounted", (GCallback) _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_added_thunar_vfs_volume_manager_volume_mounted, self, 0); - g_signal_connect_object (self->priv->manager, "volume-unmounted", (GCallback) _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_mount_removed_thunar_vfs_volume_manager_volume_unmounted, self, 0); - g_signal_connect_object (self->priv->manager, "volumes-added", (GCallback) _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_added_thunar_vfs_volume_manager_volumes_added, self, 0); - g_signal_connect_object (self->priv->manager, "volumes-removed", (GCallback) _desktop_agnostic_vfs_volume_monitor_thunar_vfs_on_volumes_removed_thunar_vfs_volume_manager_volumes_removed, self, 0); - } - return obj; -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_class_init (DesktopAgnosticVFSVolumeMonitorThunarVFSClass * klass) { - desktop_agnostic_vfs_volume_monitor_thunar_vfs_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (DesktopAgnosticVFSVolumeMonitorThunarVFSPrivate)); - G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_property; - G_OBJECT_CLASS (klass)->constructor = desktop_agnostic_vfs_volume_monitor_thunar_vfs_constructor; - G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_vfs_volume_monitor_thunar_vfs_finalize; - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_IMPLEMENTATION, "implementation"); - g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_VOLUMES, "volumes"); -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_desktop_agnostic_vfs_volume_monitor_interface_init (DesktopAgnosticVFSVolumeMonitorIface * iface) { - desktop_agnostic_vfs_volume_monitor_thunar_vfs_desktop_agnostic_vfs_volume_monitor_parent_iface = g_type_interface_peek_parent (iface); - iface->get_implementation = desktop_agnostic_vfs_volume_monitor_thunar_vfs_real_get_implementation; - iface->get_volumes = desktop_agnostic_vfs_volume_monitor_thunar_vfs_real_get_volumes; -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_instance_init (DesktopAgnosticVFSVolumeMonitorThunarVFS * self) { - self->priv = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_GET_PRIVATE (self); -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_finalize (GObject* obj) { - DesktopAgnosticVFSVolumeMonitorThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS (obj); - _g_object_unref0 (self->priv->manager); - _g_hash_table_unref0 (self->priv->_volumes); - G_OBJECT_CLASS (desktop_agnostic_vfs_volume_monitor_thunar_vfs_parent_class)->finalize (obj); -} - - -GType desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_type (void) { - static GType desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id = 0; - if (desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticVFSVolumeMonitorThunarVFSClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_vfs_volume_monitor_thunar_vfs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticVFSVolumeMonitorThunarVFS), 0, (GInstanceInitFunc) desktop_agnostic_vfs_volume_monitor_thunar_vfs_instance_init, NULL }; - static const GInterfaceInfo desktop_agnostic_vfs_volume_monitor_info = { (GInterfaceInitFunc) desktop_agnostic_vfs_volume_monitor_thunar_vfs_desktop_agnostic_vfs_volume_monitor_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; - desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSVolumeMonitorThunarVFS", &g_define_type_info, 0); - g_type_add_interface_static (desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id, DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_MONITOR, &desktop_agnostic_vfs_volume_monitor_info); - } - return desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id; -} - - -static void desktop_agnostic_vfs_volume_monitor_thunar_vfs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - DesktopAgnosticVFSVolumeMonitorThunarVFS * self; - self = DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS (object); - switch (property_id) { - case DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_IMPLEMENTATION: - g_value_set_pointer (value, desktop_agnostic_vfs_volume_monitor_get_implementation ((DesktopAgnosticVFSVolumeMonitor*) self)); - break; - case DESKTOP_AGNOSTIC_VFS_VOLUME_MONITOR_THUNAR_VFS_VOLUMES: - g_value_set_pointer (value, desktop_agnostic_vfs_volume_monitor_get_volumes ((DesktopAgnosticVFSVolumeMonitor*) self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-color.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-color.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-color.c 2010-04-11 07:32:40.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-color.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,212 +0,0 @@ -/* test-color.c generated by valac, the Vala compiler - * generated from test-color.vala, do not modify */ - -/* - * Tests the Color class, plus its interaction with the Config interface. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -void print_color (DesktopAgnosticColor* clr, const char* name); -void print_cfg_color (DesktopAgnosticConfigBackend* cfg, const char* name); -gint _main (char** args, int args_length1); - - - -void print_color (DesktopAgnosticColor* clr, const char* name) { - g_return_if_fail (name != NULL); - if (clr == NULL) { - g_message ("test-color.vala:29: color '%s' is NULL", name); - } else { - char* _tmp0_; - g_message ("test-color.vala:33: color '%s' = %s", name, _tmp0_ = desktop_agnostic_color_to_string (clr)); - _g_free0 (_tmp0_); - } -} - - -void print_cfg_color (DesktopAgnosticConfigBackend* cfg, const char* name) { - GError * _inner_error_; - GValue val = {0}; - GValue _tmp0_ = {0}; - GValue _tmp1_; - GValue _tmp2_; - g_return_if_fail (cfg != NULL); - g_return_if_fail (name != NULL); - _inner_error_ = NULL; - _tmp1_ = (desktop_agnostic_config_backend_get_value (cfg, DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, name, &_tmp0_, &_inner_error_), _tmp0_); - if (_inner_error_ != NULL) { - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - val = (_tmp2_ = _tmp1_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp2_); - print_color (g_value_get_object (&val), name); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; -} - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - { - DesktopAgnosticConfigSchema* schema; - DesktopAgnosticConfigBackend* cfg; - GValue _tmp2_ = {0}; - GValue val; - GValueArray* array; - { - DesktopAgnosticColor* green; - char* _tmp0_; - DesktopAgnosticColor* one_char_hex; - char* _tmp1_; - green = desktop_agnostic_color_new_from_string ("green", &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR) { - goto __catch1_desktop_agnostic_color_parse_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - g_assert (desktop_agnostic_color_get_alpha (green) == G_MAXUSHORT); - g_message ("test-color.vala:53: green = %s", _tmp0_ = desktop_agnostic_color_to_string (green)); - _g_free0 (_tmp0_); - one_char_hex = desktop_agnostic_color_new_from_string ("#f00f", &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (green); - if (_inner_error_->domain == DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR) { - goto __catch1_desktop_agnostic_color_parse_error; - } - _g_object_unref0 (green); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - g_message ("test-color.vala:55: red = %s", _tmp1_ = desktop_agnostic_color_to_string (one_char_hex)); - _g_free0 (_tmp1_); - _g_object_unref0 (green); - _g_object_unref0 (one_char_hex); - } - goto __finally1; - __catch1_desktop_agnostic_color_parse_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-color.vala:59: Color parse error: %s", err->message); - _g_error_free0 (err); - } - } - __finally1: - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - schema = desktop_agnostic_config_schema_new ("test-color.schema-ini", &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - cfg = desktop_agnostic_config_new (schema, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - goto __catch0_g_error; - } - print_cfg_color (cfg, "color"); - print_cfg_color (cfg, "none"); - val = (desktop_agnostic_config_backend_get_value (cfg, DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, "color_list", &_tmp2_, &_inner_error_), _tmp2_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - goto __catch0_g_error; - } - array = g_value_get_boxed (&val); - { - guint i; - i = (guint) 0; - { - gboolean _tmp3_; - _tmp3_ = TRUE; - while (TRUE) { - GValue v; - char* _tmp4_; - if (!_tmp3_) { - i++; - } - _tmp3_ = FALSE; - if (!(i < array->n_values)) { - break; - } - v = *g_value_array_get_nth (array, i); - print_color (g_value_get_object (&v), _tmp4_ = g_strdup_printf ("color_list[%u]", i)); - _g_free0 (_tmp4_); - } - } - } - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-color.vala:75: Error: %s", err->message); - result = 1; - _g_error_free0 (err); - return result; - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-config-bridge.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-config-bridge.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-config-bridge.c 2010-04-11 07:32:38.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-config-bridge.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,779 +0,0 @@ -/* test-config-bridge.c generated by valac, the Vala compiler - * generated from test-config-bridge.vala, do not modify */ - -/* - * Tests the GObject <-> Config bridge - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - - -#define TYPE_TEST_ENUM (test_enum_get_type ()) - -#define TYPE_TEST (test_get_type ()) -#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test)) -#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass)) -#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST)) -#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST)) -#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass)) - -typedef struct _Test Test; -typedef struct _TestClass TestClass; -typedef struct _TestPrivate TestPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define TYPE_TEST_DESTRUCT (test_destruct_get_type ()) -#define TEST_DESTRUCT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_DESTRUCT, TestDestruct)) -#define TEST_DESTRUCT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_DESTRUCT, TestDestructClass)) -#define IS_TEST_DESTRUCT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_DESTRUCT)) -#define IS_TEST_DESTRUCT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_DESTRUCT)) -#define TEST_DESTRUCT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_DESTRUCT, TestDestructClass)) - -typedef struct _TestDestruct TestDestruct; -typedef struct _TestDestructClass TestDestructClass; -typedef struct _TestDestructPrivate TestDestructPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -typedef enum { - TEST_ENUM_ZERO = 0, - TEST_ENUM_ONE, - TEST_ENUM_TWO -} TestEnum; - -struct _Test { - GObject parent_instance; - TestPrivate * priv; -}; - -struct _TestClass { - GObjectClass parent_class; -}; - -struct _TestPrivate { - char* _str; - gint _num; - float _dec; - gboolean _tf; - TestEnum _enum_val; -}; - -struct _TestDestruct { - Test parent_instance; - TestDestructPrivate * priv; - gint foo_counter; - gint str_counter; -}; - -struct _TestDestructClass { - TestClass parent_class; -}; - -struct _TestDestructPrivate { - DesktopAgnosticConfigBackend* cfg; - gint _num2; -}; - - -static gpointer test_parent_class = NULL; -extern gboolean test_destruct_instance_exists; -gboolean test_destruct_instance_exists = FALSE; -static gpointer test_destruct_parent_class = NULL; - -GType test_enum_get_type (void); -#define DEFAULT_STR "Not expected string" -GType test_get_type (void); -#define TEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TEST, TestPrivate)) -enum { - TEST_DUMMY_PROPERTY, - TEST_STR, - TEST_NUM, - TEST_DEC, - TEST_TF, - TEST_ENUM_VAL -}; -Test* test_new (void); -Test* test_construct (GType object_type); -const char* test_get_str (Test* self); -void test_set_str (Test* self, const char* value); -gint test_get_num (Test* self); -void test_set_num (Test* self, gint value); -float test_get_dec (Test* self); -void test_set_dec (Test* self, float value); -gboolean test_get_tf (Test* self); -void test_set_tf (Test* self, gboolean value); -TestEnum test_get_enum_val (Test* self); -void test_set_enum_val (Test* self, TestEnum value); -static GObject * test_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void test_finalize (GObject* obj); -static void test_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void test_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -GType test_destruct_get_type (void); -#define TEST_DESTRUCT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TEST_DESTRUCT, TestDestructPrivate)) -enum { - TEST_DESTRUCT_DUMMY_PROPERTY, - TEST_DESTRUCT_NUM2 -}; -void test_destruct_set_num2 (TestDestruct* self, gint value); -static void test_destruct_on_str_notify_pre_bind (TestDestruct* self, GParamSpec* spec); -static void _test_destruct_on_str_notify_pre_bind_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); -TestDestruct* test_destruct_new (DesktopAgnosticConfigBackend* cfg); -TestDestruct* test_destruct_construct (GType object_type, DesktopAgnosticConfigBackend* cfg); -static void test_destruct_on_str_notify_post_bind (TestDestruct* self, GParamSpec* spec); -static void _test_destruct_on_str_notify_post_bind_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); -void test_destruct_add_post_bind_notify (TestDestruct* self); -gint test_destruct_get_num2 (TestDestruct* self); -static void test_destruct_finalize (GObject* obj); -static void test_destruct_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void test_destruct_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -void bridge_assertions (DesktopAgnosticConfigBackend* cfg, DesktopAgnosticConfigBridge* bridge, Test* obj, GError** error); -gint _main (char** args, int args_length1); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - - -GType test_enum_get_type (void) { - static GType test_enum_type_id = 0; - if (G_UNLIKELY (test_enum_type_id == 0)) { - static const GEnumValue values[] = {{TEST_ENUM_ZERO, "TEST_ENUM_ZERO", "zero"}, {TEST_ENUM_ONE, "TEST_ENUM_ONE", "one"}, {TEST_ENUM_TWO, "TEST_ENUM_TWO", "two"}, {0, NULL, NULL}}; - test_enum_type_id = g_enum_register_static ("TestEnum", values); - } - return test_enum_type_id; -} - - -Test* test_construct (GType object_type) { - Test * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -Test* test_new (void) { - return test_construct (TYPE_TEST); -} - - -const char* test_get_str (Test* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_str; - return result; -} - - -void test_set_str (Test* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_str = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_str), _tmp0_); - g_object_notify ((GObject *) self, "str"); -} - - -gint test_get_num (Test* self) { - gint result; - g_return_val_if_fail (self != NULL, 0); - result = self->priv->_num; - return result; -} - - -void test_set_num (Test* self, gint value) { - g_return_if_fail (self != NULL); - self->priv->_num = value; - g_object_notify ((GObject *) self, "num"); -} - - -float test_get_dec (Test* self) { - float result; - g_return_val_if_fail (self != NULL, 0.0F); - result = self->priv->_dec; - return result; -} - - -void test_set_dec (Test* self, float value) { - g_return_if_fail (self != NULL); - self->priv->_dec = value; - g_object_notify ((GObject *) self, "dec"); -} - - -gboolean test_get_tf (Test* self) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->_tf; - return result; -} - - -void test_set_tf (Test* self, gboolean value) { - g_return_if_fail (self != NULL); - self->priv->_tf = value; - g_object_notify ((GObject *) self, "tf"); -} - - -TestEnum test_get_enum_val (Test* self) { - TestEnum result; - g_return_val_if_fail (self != NULL, 0); - result = self->priv->_enum_val; - return result; -} - - -void test_set_enum_val (Test* self, TestEnum value) { - g_return_if_fail (self != NULL); - self->priv->_enum_val = value; - g_object_notify ((GObject *) self, "enum-val"); -} - - -static GObject * test_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - Test * self; - parent_class = G_OBJECT_CLASS (test_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = TEST (obj); - { - test_set_str (self, DEFAULT_STR); - test_set_num (self, 1); - test_set_dec (self, 2.71f); - test_set_tf (self, FALSE); - test_set_enum_val (self, TEST_ENUM_ZERO); - } - return obj; -} - - -static void test_class_init (TestClass * klass) { - test_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (TestPrivate)); - G_OBJECT_CLASS (klass)->get_property = test_get_property; - G_OBJECT_CLASS (klass)->set_property = test_set_property; - G_OBJECT_CLASS (klass)->constructor = test_constructor; - G_OBJECT_CLASS (klass)->finalize = test_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_STR, g_param_spec_string ("str", "str", "str", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_NUM, g_param_spec_int ("num", "num", "num", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_DEC, g_param_spec_float ("dec", "dec", "dec", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TF, g_param_spec_boolean ("tf", "tf", "tf", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_ENUM_VAL, g_param_spec_enum ("enum-val", "enum-val", "enum-val", TYPE_TEST_ENUM, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); -} - - -static void test_instance_init (Test * self) { - self->priv = TEST_GET_PRIVATE (self); -} - - -static void test_finalize (GObject* obj) { - Test * self; - self = TEST (obj); - _g_free0 (self->priv->_str); - G_OBJECT_CLASS (test_parent_class)->finalize (obj); -} - - -GType test_get_type (void) { - static GType test_type_id = 0; - if (test_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 0, (GInstanceInitFunc) test_instance_init, NULL }; - test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0); - } - return test_type_id; -} - - -static void test_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - Test * self; - self = TEST (object); - switch (property_id) { - case TEST_STR: - g_value_set_string (value, test_get_str (self)); - break; - case TEST_NUM: - g_value_set_int (value, test_get_num (self)); - break; - case TEST_DEC: - g_value_set_float (value, test_get_dec (self)); - break; - case TEST_TF: - g_value_set_boolean (value, test_get_tf (self)); - break; - case TEST_ENUM_VAL: - g_value_set_enum (value, test_get_enum_val (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void test_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - Test * self; - self = TEST (object); - switch (property_id) { - case TEST_STR: - test_set_str (self, g_value_get_string (value)); - break; - case TEST_NUM: - test_set_num (self, g_value_get_int (value)); - break; - case TEST_DEC: - test_set_dec (self, g_value_get_float (value)); - break; - case TEST_TF: - test_set_tf (self, g_value_get_boolean (value)); - break; - case TEST_ENUM_VAL: - test_set_enum_val (self, g_value_get_enum (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void _test_destruct_on_str_notify_pre_bind_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - test_destruct_on_str_notify_pre_bind (self, pspec); -} - - -TestDestruct* test_destruct_construct (GType object_type, DesktopAgnosticConfigBackend* cfg) { - TestDestruct * self; - DesktopAgnosticConfigBackend* _tmp0_; - g_return_val_if_fail (cfg != NULL, NULL); - self = (TestDestruct*) test_construct (object_type); - test_destruct_set_num2 (self, 1); - self->priv->cfg = (_tmp0_ = _g_object_ref0 (cfg), _g_object_unref0 (self->priv->cfg), _tmp0_); - test_destruct_instance_exists = TRUE; - g_signal_connect_object ((GObject*) self, "notify::str", (GCallback) _test_destruct_on_str_notify_pre_bind_g_object_notify, self, 0); - return self; -} - - -TestDestruct* test_destruct_new (DesktopAgnosticConfigBackend* cfg) { - return test_destruct_construct (TYPE_TEST_DESTRUCT, cfg); -} - - -static void test_destruct_on_str_notify_pre_bind (TestDestruct* self, GParamSpec* spec) { - char* str; - g_return_if_fail (self != NULL); - g_return_if_fail (spec != NULL); - str = g_strdup (test_get_str ((Test*) self)); - g_assert (_vala_strcmp0 (str, DEFAULT_STR) != 0); - if (_vala_strcmp0 (str, "foo") == 0) { - self->foo_counter++; - } else { - self->str_counter++; - } - _g_free0 (str); -} - - -static void _test_destruct_on_str_notify_post_bind_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - test_destruct_on_str_notify_post_bind (self, pspec); -} - - -void test_destruct_add_post_bind_notify (TestDestruct* self) { - g_return_if_fail (self != NULL); - g_signal_connect_object ((GObject*) self, "notify::str", (GCallback) _test_destruct_on_str_notify_post_bind_g_object_notify, self, 0); -} - - -static void test_destruct_on_str_notify_post_bind (TestDestruct* self, GParamSpec* spec) { - char* str; - g_return_if_fail (self != NULL); - g_return_if_fail (spec != NULL); - str = g_strdup (test_get_str ((Test*) self)); - g_assert (_vala_strcmp0 (str, DEFAULT_STR) != 0); - if (_vala_strcmp0 (str, "foo") == 0) { - self->foo_counter--; - } else { - self->str_counter--; - } - _g_free0 (str); -} - - -gint test_destruct_get_num2 (TestDestruct* self) { - gint result; - g_return_val_if_fail (self != NULL, 0); - result = self->priv->_num2; - return result; -} - - -void test_destruct_set_num2 (TestDestruct* self, gint value) { - g_return_if_fail (self != NULL); - self->priv->_num2 = value; - g_object_notify ((GObject *) self, "num2"); -} - - -static void test_destruct_class_init (TestDestructClass * klass) { - test_destruct_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (TestDestructPrivate)); - G_OBJECT_CLASS (klass)->get_property = test_destruct_get_property; - G_OBJECT_CLASS (klass)->set_property = test_destruct_set_property; - G_OBJECT_CLASS (klass)->finalize = test_destruct_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_DESTRUCT_NUM2, g_param_spec_int ("num2", "num2", "num2", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); -} - - -static void test_destruct_instance_init (TestDestruct * self) { - self->priv = TEST_DESTRUCT_GET_PRIVATE (self); - self->foo_counter = 0; - self->str_counter = 0; -} - - -static void test_destruct_finalize (GObject* obj) { - TestDestruct * self; - GError * _inner_error_; - self = TEST_DESTRUCT (obj); - _inner_error_ = NULL; - { - DesktopAgnosticConfigBridge* bridge; - bridge = desktop_agnostic_config_bridge_get_default (); - desktop_agnostic_config_bridge_remove_all_for_object (bridge, self->priv->cfg, (GObject*) self, &_inner_error_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - test_destruct_instance_exists = FALSE; - } - _g_object_unref0 (self->priv->cfg); - G_OBJECT_CLASS (test_destruct_parent_class)->finalize (obj); -} - - -GType test_destruct_get_type (void) { - static GType test_destruct_type_id = 0; - if (test_destruct_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (TestDestructClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_destruct_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestDestruct), 0, (GInstanceInitFunc) test_destruct_instance_init, NULL }; - test_destruct_type_id = g_type_register_static (TYPE_TEST, "TestDestruct", &g_define_type_info, 0); - } - return test_destruct_type_id; -} - - -static void test_destruct_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - TestDestruct * self; - self = TEST_DESTRUCT (object); - switch (property_id) { - case TEST_DESTRUCT_NUM2: - g_value_set_int (value, test_destruct_get_num2 (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void test_destruct_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - TestDestruct * self; - self = TEST_DESTRUCT (object); - switch (property_id) { - case TEST_DESTRUCT_NUM2: - test_destruct_set_num2 (self, g_value_get_int (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -void bridge_assertions (DesktopAgnosticConfigBackend* cfg, DesktopAgnosticConfigBridge* bridge, Test* obj, GError** error) { - GError * _inner_error_; - char* _tmp0_; - char* _tmp1_; - char* _tmp4_; - char* _tmp5_; - gint _tmp6_; - float _tmp7_; - gboolean _tmp8_; - gint _tmp9_; - g_return_if_fail (cfg != NULL); - g_return_if_fail (bridge != NULL); - g_return_if_fail (obj != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_reset (cfg, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - _tmp0_ = desktop_agnostic_config_backend_get_string (cfg, "group", "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_assert (_vala_strcmp0 (_tmp1_ = _tmp0_, "foo") == 0); - _g_free0 (_tmp1_); - desktop_agnostic_config_bridge_bind (bridge, cfg, "group", "string", (GObject*) obj, "str", FALSE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - desktop_agnostic_config_bridge_bind (bridge, cfg, "group", "number", (GObject*) obj, "num", TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - if (IS_TEST_DESTRUCT (obj)) { - Test* _tmp2_; - test_destruct_add_post_bind_notify ((_tmp2_ = obj, IS_TEST_DESTRUCT (_tmp2_) ? ((TestDestruct*) _tmp2_) : NULL)); - desktop_agnostic_config_bridge_bind (bridge, cfg, "group", "number", (GObject*) obj, "num2", TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - } - desktop_agnostic_config_bridge_bind (bridge, cfg, "group", "decimal", (GObject*) obj, "dec", FALSE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - desktop_agnostic_config_bridge_bind (bridge, cfg, "group", "tf", (GObject*) obj, "tf", TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - desktop_agnostic_config_bridge_bind (bridge, cfg, "group", "enum", (GObject*) obj, "enum_val", TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_assert (_vala_strcmp0 (test_get_str (obj), "foo") == 0); - g_assert (test_get_num (obj) == 10); - if (IS_TEST_DESTRUCT (obj)) { - Test* _tmp3_; - g_assert (test_destruct_get_num2 ((_tmp3_ = obj, IS_TEST_DESTRUCT (_tmp3_) ? ((TestDestruct*) _tmp3_) : NULL)) == 10); - } - g_assert (test_get_dec (obj) == 3.14f); - g_assert (test_get_tf (obj) == TRUE); - g_assert (test_get_enum_val (obj) == TEST_ENUM_ONE); - test_set_str (obj, "Some new string"); - test_set_num (obj, 100); - test_set_dec (obj, 1.618f); - test_set_tf (obj, FALSE); - test_set_enum_val (obj, TEST_ENUM_TWO); - _tmp4_ = desktop_agnostic_config_backend_get_string (cfg, "group", "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_assert (_vala_strcmp0 (_tmp5_ = _tmp4_, test_get_str (obj)) == 0); - _g_free0 (_tmp5_); - _tmp6_ = desktop_agnostic_config_backend_get_int (cfg, "group", "number", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_assert (_tmp6_ != test_get_num (obj)); - _tmp7_ = desktop_agnostic_config_backend_get_float (cfg, "group", "decimal", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_assert (_tmp7_ == test_get_dec (obj)); - _tmp8_ = desktop_agnostic_config_backend_get_bool (cfg, "group", "tf", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_assert (_tmp8_ != test_get_tf (obj)); - _tmp9_ = desktop_agnostic_config_backend_get_int (cfg, "group", "enum", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_assert (_tmp9_ != 2); - if (IS_TEST_DESTRUCT (obj)) { - Test* _tmp10_; - TestDestruct* td; - td = (_tmp10_ = obj, IS_TEST_DESTRUCT (_tmp10_) ? ((TestDestruct*) _tmp10_) : NULL); - g_assert (td->foo_counter == 1); - g_assert (td->str_counter == 1); - } -} - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - { - DesktopAgnosticConfigSchema* schema; - DesktopAgnosticConfigBackend* cfg; - DesktopAgnosticConfigBridge* bridge; - Test* t; - TestDestruct* td; - Test* _tmp0_; - TestDestruct* _tmp1_; - TestDestruct* _tmp2_; - Test* _tmp3_; - TestDestruct* _tmp4_; - TestDestruct* _tmp5_; - schema = desktop_agnostic_config_schema_new ("test-config-bridge.schema-ini", &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - cfg = desktop_agnostic_config_new (schema, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - goto __catch0_g_error; - } - bridge = desktop_agnostic_config_bridge_get_default (); - t = NULL; - td = NULL; - t = (_tmp0_ = test_new (), _g_object_unref0 (t), _tmp0_); - bridge_assertions (cfg, bridge, t, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - goto __catch0_g_error; - } - desktop_agnostic_config_bridge_remove_all_for_object (bridge, cfg, (GObject*) t, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - goto __catch0_g_error; - } - desktop_agnostic_config_backend_reset (cfg, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - goto __catch0_g_error; - } - td = (_tmp1_ = test_destruct_new (cfg), _g_object_unref0 (td), _tmp1_); - bridge_assertions (cfg, bridge, (Test*) td, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - goto __catch0_g_error; - } - td = (_tmp2_ = NULL, _g_object_unref0 (td), _tmp2_); - g_assert (!test_destruct_instance_exists); - t = (_tmp3_ = test_new (), _g_object_unref0 (t), _tmp3_); - bridge_assertions (cfg, bridge, t, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - goto __catch0_g_error; - } - td = (_tmp4_ = test_destruct_new (cfg), _g_object_unref0 (td), _tmp4_); - bridge_assertions (cfg, bridge, (Test*) td, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - goto __catch0_g_error; - } - td = (_tmp5_ = NULL, _g_object_unref0 (td), _tmp5_); - g_assert (!test_destruct_instance_exists); - desktop_agnostic_config_bridge_remove_all_for_object (bridge, cfg, (GObject*) t, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - goto __catch0_g_error; - } - _g_object_unref0 (schema); - _g_object_unref0 (cfg); - _g_object_unref0 (t); - _g_object_unref0 (td); - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-config-bridge.vala:207: Error: %s", err->message); - result = 1; - _g_error_free0 (err); - return result; - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-config.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-config.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-config.c 2010-04-11 07:32:34.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-config.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2036 +0,0 @@ -/* test-config.c generated by valac, the Vala compiler - * generated from test-config.vala, do not modify */ - -/* - * Desktop Agnostic Library: Test for the config backend implementations. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -#define TYPE_TEST_CASE (test_case_get_type ()) -#define TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_CASE, TestCase)) -#define TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_CASE, TestCaseClass)) -#define IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_CASE)) -#define IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_CASE)) -#define TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_CASE, TestCaseClass)) - -typedef struct _TestCase TestCase; -typedef struct _TestCaseClass TestCaseClass; -typedef struct _TestCasePrivate TestCasePrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _test_case_unref0(var) ((var == NULL) ? NULL : (var = (test_case_unref (var), NULL))) -typedef struct _ParamSpecTestCase ParamSpecTestCase; - -typedef enum { - ASSERTION_ERROR_NOT_EQUAL, - ASSERTION_ERROR_INVALID_TYPE, - ASSERTION_ERROR_NOT_REACHED -} AssertionError; -#define ASSERTION_ERROR assertion_error_quark () -struct _TestCase { - GTypeInstance parent_instance; - volatile int ref_count; - TestCasePrivate * priv; -}; - -struct _TestCaseClass { - GTypeClass parent_class; - void (*finalize) (TestCase *self); -}; - -struct _TestCasePrivate { - DesktopAgnosticConfigBackend* cfg; - guint notify_counter; - GMainLoop* ml; - gint retval; -}; - -typedef void (*TestCaseGetCfgFunc) (DesktopAgnosticConfigBackend* cfg, const char* group, const char* key, GError** error); -struct _ParamSpecTestCase { - GParamSpec parent_instance; -}; - - -static gpointer test_case_parent_class = NULL; - -GQuark assertion_error_quark (void); -#define EXIT_SUCCESS 0 -#define EXIT_ASSERTION 1 -#define EXIT_EXCEPTION 2 -gpointer test_case_ref (gpointer instance); -void test_case_unref (gpointer instance); -GParamSpec* param_spec_test_case (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); -void value_set_test_case (GValue* value, gpointer v_object); -gpointer value_get_test_case (const GValue* value); -GType test_case_get_type (void); -#define TEST_CASE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TEST_CASE, TestCasePrivate)) -enum { - TEST_CASE_DUMMY_PROPERTY -}; -TestCase* test_case_new (GError** error); -TestCase* test_case_construct (GType object_type, GError** error); -static void test_case_on_string_changed (TestCase* self, const char* group, const char* key, GValue* value); -static void test_case_on_string_changed2 (TestCase* self, const char* group, const char* key, GValue* value); -static void test_case_assert_equals (TestCase* self, GValue* expected, GValue* actual, GError** error); -static gboolean test_case_array_equals (TestCase* self, GValueArray* expected, GValueArray* actual, GError** error); -static void test_case_test_default_empty_list (TestCase* self, const char* suffix, GError** error); -static void test_case_test_defaults (TestCase* self, GError** error); -static void test_case_test_set_empty_list (TestCase* self, const char* key, GError** error); -static void test_case_test_set (TestCase* self, GError** error); -static void test_case_update_notify_value (TestCase* self, GMainContext* ctx, const char* value, guint counter_expected, GError** error); -static void _test_case_on_string_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self); -static void _test_case_on_string_changed2_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self); -static void test_case_test_notify (TestCase* self, GError** error); -static void test_case_test_invalid_func (TestCase* self, TestCaseGetCfgFunc func, GError** error); -static void test_case_test_invalid (TestCase* self, GError** error); -gint test_case_main (char** args, int args_length1); -static void test_case_finalize (TestCase* obj); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -GQuark assertion_error_quark (void) { - return g_quark_from_static_string ("assertion_error-quark"); -} - - -TestCase* test_case_construct (GType object_type, GError** error) { - GError * _inner_error_; - TestCase* self; - DesktopAgnosticConfigSchema* schema; - DesktopAgnosticConfigSchema* _tmp1_; - DesktopAgnosticConfigSchema* _tmp0_; - DesktopAgnosticConfigBackend* _tmp2_; - DesktopAgnosticConfigBackend* _tmp3_; - DesktopAgnosticConfigBackend* _tmp4_; - GMainLoop* _tmp5_; - _inner_error_ = NULL; - self = (TestCase*) g_type_create_instance (object_type); - schema = desktop_agnostic_config_schema_new ("test-config.schema-ini", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - test_case_unref (self); - return NULL; - } - _tmp3_ = (_tmp2_ = desktop_agnostic_config_new (_tmp1_ = (_tmp0_ = schema, schema = NULL, _tmp0_), &_inner_error_), _g_object_unref0 (_tmp1_), _tmp2_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_object_unref0 (schema); - test_case_unref (self); - return NULL; - } - self->priv->cfg = (_tmp4_ = _tmp3_, _g_object_unref0 (self->priv->cfg), _tmp4_); - self->priv->notify_counter = (guint) 0; - self->priv->ml = (_tmp5_ = g_main_loop_new (NULL, FALSE), _g_main_loop_unref0 (self->priv->ml), _tmp5_); - self->priv->retval = 0; - _g_object_unref0 (schema); - return self; -} - - -TestCase* test_case_new (GError** error) { - return test_case_construct (TYPE_TEST_CASE, error); -} - - -static void test_case_on_string_changed (TestCase* self, const char* group, const char* key, GValue* value) { - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - self->priv->notify_counter++; -} - - -static gboolean string_contains (const char* self, const char* needle) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (needle != NULL, FALSE); - result = strstr (self, needle) != NULL; - return result; -} - - -static void test_case_on_string_changed2 (TestCase* self, const char* group, const char* key, GValue* value) { - g_return_if_fail (self != NULL); - g_return_if_fail (group != NULL); - g_return_if_fail (key != NULL); - if (string_contains (g_value_get_string (value), "quux")) { - self->priv->notify_counter = self->priv->notify_counter + ((guint) 3); - } -} - - -static gboolean test_case_array_equals (TestCase* self, GValueArray* expected, GValueArray* actual, GError** error) { - gboolean result; - GError * _inner_error_; - gboolean equal; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (expected != NULL, FALSE); - g_return_val_if_fail (actual != NULL, FALSE); - _inner_error_ = NULL; - equal = TRUE; - if (expected->n_values == actual->n_values) { - { - guint i; - i = (guint) 0; - { - gboolean _tmp0_; - _tmp0_ = TRUE; - while (TRUE) { - if (!_tmp0_) { - i++; - } - _tmp0_ = FALSE; - if (!(i < actual->n_values)) { - break; - } - test_case_assert_equals (self, g_value_array_get_nth (expected, i), g_value_array_get_nth (actual, i), &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == ASSERTION_ERROR) { - g_propagate_error (error, _inner_error_); - return FALSE; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - } - } - } - } - } else { - equal = FALSE; - } - result = equal; - return result; -} - - -static void test_case_assert_equals (TestCase* self, GValue* expected, GValue* actual, GError** error) { - GError * _inner_error_; - gboolean equal; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - equal = TRUE; - if (G_VALUE_HOLDS (actual, G_TYPE_BOOLEAN)) { - equal = g_value_get_boolean (expected) == g_value_get_boolean (actual); - } else { - if (G_VALUE_HOLDS (actual, G_TYPE_INT)) { - equal = g_value_get_int (expected) == g_value_get_int (actual); - } else { - if (G_VALUE_HOLDS (actual, G_TYPE_FLOAT)) { - equal = g_value_get_float (expected) == g_value_get_float (actual); - } else { - if (G_VALUE_HOLDS (actual, G_TYPE_STRING)) { - equal = _vala_strcmp0 (g_value_get_string (expected), g_value_get_string (actual)) == 0; - } else { - if (G_VALUE_HOLDS (actual, G_TYPE_VALUE_ARRAY)) { - gboolean _tmp0_; - _tmp0_ = test_case_array_equals (self, g_value_get_boxed (expected), g_value_get_boxed (actual), &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == ASSERTION_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - equal = _tmp0_; - } else { - _inner_error_ = g_error_new (ASSERTION_ERROR, ASSERTION_ERROR_INVALID_TYPE, "Invalid value type (%s).", g_type_name (G_VALUE_TYPE (actual))); - { - if (_inner_error_->domain == ASSERTION_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } - } - } - } - } - if (!equal) { - char* _tmp2_; - char* _tmp1_; - GError* _tmp3_; - _inner_error_ = (_tmp3_ = g_error_new (ASSERTION_ERROR, ASSERTION_ERROR_NOT_EQUAL, "%s != %s", _tmp1_ = g_strdup_value_contents (expected), _tmp2_ = g_strdup_value_contents (actual)), _g_free0 (_tmp2_), _g_free0 (_tmp1_), _tmp3_); - { - if (_inner_error_->domain == ASSERTION_ERROR) { - g_propagate_error (error, _inner_error_); - return; - } else { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - } -} - - -static void test_case_test_default_empty_list (TestCase* self, const char* suffix, GError** error) { - GError * _inner_error_; - GValueArray* expected_array; - GValue expected = {0}; - char* key; - GValueArray* _tmp0_; - GValue _tmp2_; - GValue _tmp1_ = {0}; - char* _tmp3_; - GValue _tmp4_ = {0}; - GValue _tmp5_; - GValue _tmp7_; - GValue _tmp6_; - GValueArray* _tmp8_; - GValueArray* _tmp9_; - gboolean _tmp10_; - gboolean _tmp11_; - g_return_if_fail (self != NULL); - g_return_if_fail (suffix != NULL); - _inner_error_ = NULL; - expected_array = NULL; - key = NULL; - expected_array = (_tmp0_ = g_value_array_new ((guint) 0), _g_value_array_free0 (expected_array), _tmp0_); - expected = (_tmp2_ = (g_value_init (&_tmp1_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp1_, expected_array), _tmp1_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp2_); - key = (_tmp3_ = g_strdup_printf ("list-%s", suffix), _g_free0 (key), _tmp3_); - _tmp5_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "empty", key, &_tmp4_, &_inner_error_), _tmp4_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - _g_free0 (key); - return; - } - test_case_assert_equals (self, &expected, (_tmp7_ = _tmp6_ = _tmp5_, &_tmp7_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - _g_free0 (key); - return; - } - G_IS_VALUE (&_tmp6_) ? (g_value_unset (&_tmp6_), NULL) : NULL; - _tmp8_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "empty", key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - _g_free0 (key); - return; - } - _tmp11_ = (_tmp10_ = test_case_array_equals (self, expected_array, _tmp9_ = _tmp8_, &_inner_error_), _g_value_array_free0 (_tmp9_), _tmp10_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - _g_free0 (key); - return; - } - g_assert (_tmp11_); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - _g_free0 (key); -} - - -static void test_case_test_defaults (TestCase* self, GError** error) { - GError * _inner_error_; - GValue expected = {0}; - GValue item_1 = {0}; - GValue item_2 = {0}; - GValue item_3 = {0}; - GValueArray* expected_array; - GValue _tmp1_; - GValue _tmp0_ = {0}; - GValue _tmp2_ = {0}; - GValue _tmp3_; - GValue _tmp5_; - GValue _tmp4_; - gboolean _tmp6_; - GValue _tmp8_; - GValue _tmp7_ = {0}; - GValue _tmp9_ = {0}; - GValue _tmp10_; - GValue _tmp12_; - GValue _tmp11_; - gint _tmp13_; - GValue _tmp15_; - GValue _tmp14_ = {0}; - GValue _tmp16_ = {0}; - GValue _tmp17_; - GValue _tmp19_; - GValue _tmp18_; - float _tmp20_; - GValue _tmp22_; - GValue _tmp21_ = {0}; - GValue _tmp23_ = {0}; - GValue _tmp24_; - GValue _tmp26_; - GValue _tmp25_; - char* _tmp27_; - char* _tmp28_; - GValue _tmp30_; - GValue _tmp29_ = {0}; - GValue _tmp31_ = {0}; - GValue _tmp32_; - GValue _tmp34_; - GValue _tmp33_; - char* _tmp35_; - char* _tmp36_; - GValueArray* _tmp37_; - GValue _tmp39_; - GValue _tmp38_ = {0}; - GValue _tmp41_; - GValue _tmp40_ = {0}; - GValue _tmp43_; - GValue _tmp42_ = {0}; - GValue _tmp44_ = {0}; - GValue _tmp45_; - GValue _tmp47_; - GValue _tmp46_; - GValueArray* _tmp48_; - GValueArray* _tmp49_; - gboolean _tmp50_; - gboolean _tmp51_; - GValueArray* _tmp52_; - GValue _tmp54_; - GValue _tmp53_ = {0}; - GValue _tmp56_; - GValue _tmp55_ = {0}; - GValue _tmp58_; - GValue _tmp57_ = {0}; - GValue _tmp60_; - GValue _tmp59_ = {0}; - GValue _tmp61_ = {0}; - GValue _tmp62_; - GValue _tmp64_; - GValue _tmp63_; - GValueArray* _tmp65_; - GValueArray* _tmp66_; - gboolean _tmp67_; - gboolean _tmp68_; - GValueArray* _tmp69_; - GValue _tmp71_; - GValue _tmp70_ = {0}; - GValue _tmp73_; - GValue _tmp72_ = {0}; - GValue _tmp75_; - GValue _tmp74_ = {0}; - GValue _tmp77_; - GValue _tmp76_ = {0}; - GValue _tmp78_ = {0}; - GValue _tmp79_; - GValue _tmp81_; - GValue _tmp80_; - GValueArray* _tmp82_; - GValueArray* _tmp83_; - gboolean _tmp84_; - gboolean _tmp85_; - GValueArray* _tmp86_; - GValue _tmp88_; - GValue _tmp87_ = {0}; - GValue _tmp90_; - GValue _tmp89_ = {0}; - GValue _tmp92_; - GValue _tmp91_ = {0}; - GValue _tmp93_ = {0}; - GValue _tmp94_; - GValue _tmp96_; - GValue _tmp95_; - GValueArray* _tmp97_; - GValueArray* _tmp98_; - gboolean _tmp99_; - gboolean _tmp100_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - expected_array = NULL; - desktop_agnostic_config_backend_reset (self->priv->cfg, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - expected = (_tmp1_ = (g_value_init (&_tmp0_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp0_, TRUE), _tmp0_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp1_); - _tmp3_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "numeric", "boolean", &_tmp2_, &_inner_error_), _tmp2_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp5_ = _tmp4_ = _tmp3_, &_tmp5_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp4_) ? (g_value_unset (&_tmp4_), NULL) : NULL; - _tmp6_ = desktop_agnostic_config_backend_get_bool (self->priv->cfg, "numeric", "boolean", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (g_value_get_boolean (&expected) == _tmp6_); - expected = (_tmp8_ = (g_value_init (&_tmp7_, G_TYPE_INT), g_value_set_int (&_tmp7_, 3), _tmp7_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp8_); - _tmp10_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "numeric", "integer", &_tmp9_, &_inner_error_), _tmp9_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp12_ = _tmp11_ = _tmp10_, &_tmp12_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp11_) ? (g_value_unset (&_tmp11_), NULL) : NULL; - _tmp13_ = desktop_agnostic_config_backend_get_int (self->priv->cfg, "numeric", "integer", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (g_value_get_int (&expected) == _tmp13_); - expected = (_tmp15_ = (g_value_init (&_tmp14_, G_TYPE_FLOAT), g_value_set_float (&_tmp14_, 3.14f), _tmp14_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp15_); - _tmp17_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "numeric", "float", &_tmp16_, &_inner_error_), _tmp16_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp19_ = _tmp18_ = _tmp17_, &_tmp19_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp18_) ? (g_value_unset (&_tmp18_), NULL) : NULL; - _tmp20_ = desktop_agnostic_config_backend_get_float (self->priv->cfg, "numeric", "float", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (g_value_get_float (&expected) == _tmp20_); - expected = (_tmp22_ = (g_value_init (&_tmp21_, G_TYPE_STRING), g_value_set_string (&_tmp21_, "Foo bar"), _tmp21_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp22_); - _tmp24_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "misc", "string", &_tmp23_, &_inner_error_), _tmp23_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp26_ = _tmp25_ = _tmp24_, &_tmp26_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp25_) ? (g_value_unset (&_tmp25_), NULL) : NULL; - _tmp27_ = desktop_agnostic_config_backend_get_string (self->priv->cfg, "misc", "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_vala_strcmp0 (g_value_get_string (&expected), _tmp28_ = _tmp27_) == 0); - _g_free0 (_tmp28_); - expected = (_tmp30_ = (g_value_init (&_tmp29_, G_TYPE_STRING), g_value_set_string (&_tmp29_, ""), _tmp29_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp30_); - _tmp32_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "empty", "string", &_tmp31_, &_inner_error_), _tmp31_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp34_ = _tmp33_ = _tmp32_, &_tmp34_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp33_) ? (g_value_unset (&_tmp33_), NULL) : NULL; - _tmp35_ = desktop_agnostic_config_backend_get_string (self->priv->cfg, "empty", "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_vala_strcmp0 (g_value_get_string (&expected), _tmp36_ = _tmp35_) == 0); - _g_free0 (_tmp36_); - expected_array = (_tmp37_ = g_value_array_new ((guint) 2), _g_value_array_free0 (expected_array), _tmp37_); - item_1 = (_tmp39_ = (g_value_init (&_tmp38_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp38_, TRUE), _tmp38_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp39_); - item_2 = (_tmp41_ = (g_value_init (&_tmp40_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp40_, FALSE), _tmp40_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp41_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - expected = (_tmp43_ = (g_value_init (&_tmp42_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp42_, expected_array), _tmp42_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp43_); - _tmp45_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "boolean", &_tmp44_, &_inner_error_), _tmp44_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp47_ = _tmp46_ = _tmp45_, &_tmp47_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp46_) ? (g_value_unset (&_tmp46_), NULL) : NULL; - _tmp48_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "boolean", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp51_ = (_tmp50_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp49_ = _tmp48_, &_inner_error_), _g_value_array_free0 (_tmp49_), _tmp50_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp51_); - expected_array = (_tmp52_ = g_value_array_new ((guint) 3), _g_value_array_free0 (expected_array), _tmp52_); - item_1 = (_tmp54_ = (g_value_init (&_tmp53_, G_TYPE_INT), g_value_set_int (&_tmp53_, 1), _tmp53_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp54_); - item_2 = (_tmp56_ = (g_value_init (&_tmp55_, G_TYPE_INT), g_value_set_int (&_tmp55_, 2), _tmp55_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp56_); - item_3 = (_tmp58_ = (g_value_init (&_tmp57_, G_TYPE_INT), g_value_set_int (&_tmp57_, 3), _tmp57_), G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL, _tmp58_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - g_value_array_append (expected_array, &item_3); - expected = (_tmp60_ = (g_value_init (&_tmp59_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp59_, expected_array), _tmp59_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp60_); - _tmp62_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "integer", &_tmp61_, &_inner_error_), _tmp61_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp64_ = _tmp63_ = _tmp62_, &_tmp64_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp63_) ? (g_value_unset (&_tmp63_), NULL) : NULL; - _tmp65_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "integer", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp68_ = (_tmp67_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp66_ = _tmp65_, &_inner_error_), _g_value_array_free0 (_tmp66_), _tmp67_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp68_); - expected_array = (_tmp69_ = g_value_array_new ((guint) 3), _g_value_array_free0 (expected_array), _tmp69_); - item_1 = (_tmp71_ = (g_value_init (&_tmp70_, G_TYPE_FLOAT), g_value_set_float (&_tmp70_, 1.618f), _tmp70_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp71_); - item_2 = (_tmp73_ = (g_value_init (&_tmp72_, G_TYPE_FLOAT), g_value_set_float (&_tmp72_, 2.718f), _tmp72_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp73_); - item_3 = (_tmp75_ = (g_value_init (&_tmp74_, G_TYPE_FLOAT), g_value_set_float (&_tmp74_, 3.141f), _tmp74_), G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL, _tmp75_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - g_value_array_append (expected_array, &item_3); - expected = (_tmp77_ = (g_value_init (&_tmp76_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp76_, expected_array), _tmp76_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp77_); - _tmp79_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "float", &_tmp78_, &_inner_error_), _tmp78_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp81_ = _tmp80_ = _tmp79_, &_tmp81_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp80_) ? (g_value_unset (&_tmp80_), NULL) : NULL; - _tmp82_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "float", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp85_ = (_tmp84_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp83_ = _tmp82_, &_inner_error_), _g_value_array_free0 (_tmp83_), _tmp84_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp85_); - expected_array = (_tmp86_ = g_value_array_new ((guint) 2), _g_value_array_free0 (expected_array), _tmp86_); - item_1 = (_tmp88_ = (g_value_init (&_tmp87_, G_TYPE_STRING), g_value_set_string (&_tmp87_, "foo"), _tmp87_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp88_); - item_2 = (_tmp90_ = (g_value_init (&_tmp89_, G_TYPE_STRING), g_value_set_string (&_tmp89_, "bar"), _tmp89_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp90_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - expected = (_tmp92_ = (g_value_init (&_tmp91_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp91_, expected_array), _tmp91_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp92_); - _tmp94_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "string", &_tmp93_, &_inner_error_), _tmp93_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp96_ = _tmp95_ = _tmp94_, &_tmp96_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp95_) ? (g_value_unset (&_tmp95_), NULL) : NULL; - _tmp97_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp100_ = (_tmp99_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp98_ = _tmp97_, &_inner_error_), _g_value_array_free0 (_tmp98_), _tmp99_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp100_); - test_case_test_default_empty_list (self, "boolean", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_test_default_empty_list (self, "integer", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_test_default_empty_list (self, "float", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_test_default_empty_list (self, "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); -} - - -static void test_case_test_set_empty_list (TestCase* self, const char* key, GError** error) { - GError * _inner_error_; - GValueArray* old_value; - GValueArray* expected_array; - GValue expected = {0}; - GValueArray* _tmp0_; - GValueArray* _tmp1_; - GValueArray* _tmp2_; - GValue _tmp4_; - GValue _tmp3_ = {0}; - GValue _tmp5_ = {0}; - GValue _tmp6_; - GValue _tmp8_; - GValue _tmp7_; - GValueArray* _tmp9_; - GValueArray* _tmp10_; - gboolean _tmp11_; - gboolean _tmp12_; - GValueArray* _tmp13_; - GValueArray* _tmp14_; - gboolean _tmp15_; - gboolean _tmp16_; - GValue _tmp17_ = {0}; - GValue _tmp18_; - GValue _tmp20_; - GValue _tmp19_; - GValueArray* _tmp21_; - GValueArray* _tmp22_; - gboolean _tmp23_; - gboolean _tmp24_; - g_return_if_fail (self != NULL); - g_return_if_fail (key != NULL); - _inner_error_ = NULL; - old_value = NULL; - expected_array = NULL; - _tmp0_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - old_value = (_tmp1_ = _tmp0_, _g_value_array_free0 (old_value), _tmp1_); - expected_array = (_tmp2_ = g_value_array_new ((guint) 0), _g_value_array_free0 (expected_array), _tmp2_); - expected = (_tmp4_ = (g_value_init (&_tmp3_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp3_, expected_array), _tmp3_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp4_); - desktop_agnostic_config_backend_set_list (self->priv->cfg, "list", key, expected_array, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - _tmp6_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", key, &_tmp5_, &_inner_error_), _tmp5_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - test_case_assert_equals (self, &expected, (_tmp8_ = _tmp7_ = _tmp6_, &_tmp8_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - G_IS_VALUE (&_tmp7_) ? (g_value_unset (&_tmp7_), NULL) : NULL; - _tmp9_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - _tmp12_ = (_tmp11_ = test_case_array_equals (self, expected_array, _tmp10_ = _tmp9_, &_inner_error_), _g_value_array_free0 (_tmp10_), _tmp11_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - g_assert (_tmp12_); - desktop_agnostic_config_backend_set_list (self->priv->cfg, "list", key, old_value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - _tmp13_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - _tmp16_ = (_tmp15_ = test_case_array_equals (self, old_value, _tmp14_ = _tmp13_, &_inner_error_), _g_value_array_free0 (_tmp14_), _tmp15_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - g_assert (_tmp16_); - desktop_agnostic_config_backend_set_value (self->priv->cfg, "list", key, &expected, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - _tmp18_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", key, &_tmp17_, &_inner_error_), _tmp17_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - test_case_assert_equals (self, &expected, (_tmp20_ = _tmp19_ = _tmp18_, &_tmp20_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - G_IS_VALUE (&_tmp19_) ? (g_value_unset (&_tmp19_), NULL) : NULL; - _tmp21_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", key, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - _tmp24_ = (_tmp23_ = test_case_array_equals (self, expected_array, _tmp22_ = _tmp21_, &_inner_error_), _g_value_array_free0 (_tmp22_), _tmp23_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - return; - } - g_assert (_tmp24_); - _g_value_array_free0 (old_value); - _g_value_array_free0 (expected_array); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; -} - - -static void test_case_test_set (TestCase* self, GError** error) { - GError * _inner_error_; - GValue expected = {0}; - GValue item_1 = {0}; - GValue item_2 = {0}; - GValue item_3 = {0}; - GValueArray* expected_array; - GValue _tmp1_; - GValue _tmp0_ = {0}; - GValue _tmp2_ = {0}; - GValue _tmp3_; - GValue _tmp5_; - GValue _tmp4_; - gboolean _tmp6_; - GValue _tmp8_; - GValue _tmp7_ = {0}; - GValue _tmp9_ = {0}; - GValue _tmp10_; - GValue _tmp12_; - GValue _tmp11_; - gint _tmp13_; - GValue _tmp15_; - GValue _tmp14_ = {0}; - GValue _tmp16_ = {0}; - GValue _tmp17_; - GValue _tmp19_; - GValue _tmp18_; - float _tmp20_; - GValue _tmp22_; - GValue _tmp21_ = {0}; - GValue _tmp23_ = {0}; - GValue _tmp24_; - GValue _tmp26_; - GValue _tmp25_; - char* _tmp27_; - char* _tmp28_; - GValueArray* _tmp29_; - GValue _tmp31_; - GValue _tmp30_ = {0}; - GValue _tmp33_; - GValue _tmp32_ = {0}; - GValue _tmp35_; - GValue _tmp34_ = {0}; - GValue _tmp37_; - GValue _tmp36_ = {0}; - GValue _tmp38_ = {0}; - GValue _tmp39_; - GValue _tmp41_; - GValue _tmp40_; - GValueArray* _tmp42_; - GValueArray* _tmp43_; - gboolean _tmp44_; - gboolean _tmp45_; - GValueArray* _tmp46_; - GValue _tmp48_; - GValue _tmp47_ = {0}; - GValue _tmp50_; - GValue _tmp49_ = {0}; - GValue _tmp52_; - GValue _tmp51_ = {0}; - GValue _tmp54_; - GValue _tmp53_ = {0}; - GValue _tmp55_ = {0}; - GValue _tmp56_; - GValue _tmp58_; - GValue _tmp57_; - GValueArray* _tmp59_; - GValueArray* _tmp60_; - gboolean _tmp61_; - gboolean _tmp62_; - GValueArray* _tmp63_; - GValue _tmp65_; - GValue _tmp64_ = {0}; - GValue _tmp67_; - GValue _tmp66_ = {0}; - GValue _tmp69_; - GValue _tmp68_ = {0}; - GValue _tmp71_; - GValue _tmp70_ = {0}; - GValue _tmp72_ = {0}; - GValue _tmp73_; - GValue _tmp75_; - GValue _tmp74_; - GValueArray* _tmp76_; - GValueArray* _tmp77_; - gboolean _tmp78_; - gboolean _tmp79_; - GValueArray* _tmp80_; - GValue _tmp82_; - GValue _tmp81_ = {0}; - GValue _tmp84_; - GValue _tmp83_ = {0}; - GValue _tmp86_; - GValue _tmp85_ = {0}; - GValue _tmp88_; - GValue _tmp87_ = {0}; - GValue _tmp89_ = {0}; - GValue _tmp90_; - GValue _tmp92_; - GValue _tmp91_; - GValueArray* _tmp93_; - GValueArray* _tmp94_; - gboolean _tmp95_; - gboolean _tmp96_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - expected_array = NULL; - expected = (_tmp1_ = (g_value_init (&_tmp0_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp0_, FALSE), _tmp0_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp1_); - desktop_agnostic_config_backend_set_bool (self->priv->cfg, "numeric", "boolean", g_value_get_boolean (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp3_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "numeric", "boolean", &_tmp2_, &_inner_error_), _tmp2_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp5_ = _tmp4_ = _tmp3_, &_tmp5_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp4_) ? (g_value_unset (&_tmp4_), NULL) : NULL; - _tmp6_ = desktop_agnostic_config_backend_get_bool (self->priv->cfg, "numeric", "boolean", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (g_value_get_boolean (&expected) == _tmp6_); - expected = (_tmp8_ = (g_value_init (&_tmp7_, G_TYPE_INT), g_value_set_int (&_tmp7_, 10), _tmp7_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp8_); - desktop_agnostic_config_backend_set_int (self->priv->cfg, "numeric", "integer", g_value_get_int (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp10_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "numeric", "integer", &_tmp9_, &_inner_error_), _tmp9_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp12_ = _tmp11_ = _tmp10_, &_tmp12_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp11_) ? (g_value_unset (&_tmp11_), NULL) : NULL; - _tmp13_ = desktop_agnostic_config_backend_get_int (self->priv->cfg, "numeric", "integer", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (g_value_get_int (&expected) == _tmp13_); - expected = (_tmp15_ = (g_value_init (&_tmp14_, G_TYPE_FLOAT), g_value_set_float (&_tmp14_, 2.718f), _tmp14_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp15_); - desktop_agnostic_config_backend_set_float (self->priv->cfg, "numeric", "float", g_value_get_float (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp17_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "numeric", "float", &_tmp16_, &_inner_error_), _tmp16_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp19_ = _tmp18_ = _tmp17_, &_tmp19_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp18_) ? (g_value_unset (&_tmp18_), NULL) : NULL; - _tmp20_ = desktop_agnostic_config_backend_get_float (self->priv->cfg, "numeric", "float", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (g_value_get_float (&expected) == _tmp20_); - expected = (_tmp22_ = (g_value_init (&_tmp21_, G_TYPE_STRING), g_value_set_string (&_tmp21_, "Quux baz"), _tmp21_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp22_); - desktop_agnostic_config_backend_set_string (self->priv->cfg, "misc", "string", g_value_get_string (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp24_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "misc", "string", &_tmp23_, &_inner_error_), _tmp23_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp26_ = _tmp25_ = _tmp24_, &_tmp26_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp25_) ? (g_value_unset (&_tmp25_), NULL) : NULL; - _tmp27_ = desktop_agnostic_config_backend_get_string (self->priv->cfg, "misc", "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_vala_strcmp0 (g_value_get_string (&expected), _tmp28_ = _tmp27_) == 0); - _g_free0 (_tmp28_); - expected_array = (_tmp29_ = g_value_array_new ((guint) 3), _g_value_array_free0 (expected_array), _tmp29_); - item_1 = (_tmp31_ = (g_value_init (&_tmp30_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp30_, FALSE), _tmp30_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp31_); - item_2 = (_tmp33_ = (g_value_init (&_tmp32_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp32_, TRUE), _tmp32_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp33_); - item_3 = (_tmp35_ = (g_value_init (&_tmp34_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp34_, FALSE), _tmp34_), G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL, _tmp35_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - g_value_array_append (expected_array, &item_3); - expected = (_tmp37_ = (g_value_init (&_tmp36_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp36_, expected_array), _tmp36_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp37_); - desktop_agnostic_config_backend_set_list (self->priv->cfg, "list", "boolean", g_value_get_boxed (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp39_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "boolean", &_tmp38_, &_inner_error_), _tmp38_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp41_ = _tmp40_ = _tmp39_, &_tmp41_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp40_) ? (g_value_unset (&_tmp40_), NULL) : NULL; - _tmp42_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "boolean", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp45_ = (_tmp44_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp43_ = _tmp42_, &_inner_error_), _g_value_array_free0 (_tmp43_), _tmp44_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp45_); - expected_array = (_tmp46_ = g_value_array_new ((guint) 3), _g_value_array_free0 (expected_array), _tmp46_); - item_1 = (_tmp48_ = (g_value_init (&_tmp47_, G_TYPE_INT), g_value_set_int (&_tmp47_, 10), _tmp47_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp48_); - item_2 = (_tmp50_ = (g_value_init (&_tmp49_, G_TYPE_INT), g_value_set_int (&_tmp49_, 20), _tmp49_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp50_); - item_3 = (_tmp52_ = (g_value_init (&_tmp51_, G_TYPE_INT), g_value_set_int (&_tmp51_, 30), _tmp51_), G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL, _tmp52_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - g_value_array_append (expected_array, &item_3); - expected = (_tmp54_ = (g_value_init (&_tmp53_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp53_, expected_array), _tmp53_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp54_); - desktop_agnostic_config_backend_set_list (self->priv->cfg, "list", "integer", g_value_get_boxed (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp56_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "integer", &_tmp55_, &_inner_error_), _tmp55_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp58_ = _tmp57_ = _tmp56_, &_tmp58_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp57_) ? (g_value_unset (&_tmp57_), NULL) : NULL; - _tmp59_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "integer", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp62_ = (_tmp61_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp60_ = _tmp59_, &_inner_error_), _g_value_array_free0 (_tmp60_), _tmp61_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp62_); - expected_array = (_tmp63_ = g_value_array_new ((guint) 3), _g_value_array_free0 (expected_array), _tmp63_); - item_1 = (_tmp65_ = (g_value_init (&_tmp64_, G_TYPE_FLOAT), g_value_set_float (&_tmp64_, 10.5f), _tmp64_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp65_); - item_2 = (_tmp67_ = (g_value_init (&_tmp66_, G_TYPE_FLOAT), g_value_set_float (&_tmp66_, 20.6f), _tmp66_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp67_); - item_3 = (_tmp69_ = (g_value_init (&_tmp68_, G_TYPE_FLOAT), g_value_set_float (&_tmp68_, 30.7f), _tmp68_), G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL, _tmp69_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - g_value_array_append (expected_array, &item_3); - expected = (_tmp71_ = (g_value_init (&_tmp70_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp70_, expected_array), _tmp70_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp71_); - desktop_agnostic_config_backend_set_list (self->priv->cfg, "list", "float", g_value_get_boxed (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp73_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "float", &_tmp72_, &_inner_error_), _tmp72_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp75_ = _tmp74_ = _tmp73_, &_tmp75_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp74_) ? (g_value_unset (&_tmp74_), NULL) : NULL; - _tmp76_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "float", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp79_ = (_tmp78_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp77_ = _tmp76_, &_inner_error_), _g_value_array_free0 (_tmp77_), _tmp78_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp79_); - expected_array = (_tmp80_ = g_value_array_new ((guint) 3), _g_value_array_free0 (expected_array), _tmp80_); - item_1 = (_tmp82_ = (g_value_init (&_tmp81_, G_TYPE_STRING), g_value_set_string (&_tmp81_, "Quux"), _tmp81_), G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL, _tmp82_); - item_2 = (_tmp84_ = (g_value_init (&_tmp83_, G_TYPE_STRING), g_value_set_string (&_tmp83_, "Baz"), _tmp83_), G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL, _tmp84_); - item_3 = (_tmp86_ = (g_value_init (&_tmp85_, G_TYPE_STRING), g_value_set_string (&_tmp85_, "Foo"), _tmp85_), G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL, _tmp86_); - g_value_array_append (expected_array, &item_1); - g_value_array_append (expected_array, &item_2); - g_value_array_append (expected_array, &item_3); - expected = (_tmp88_ = (g_value_init (&_tmp87_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp87_, expected_array), _tmp87_), G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL, _tmp88_); - desktop_agnostic_config_backend_set_list (self->priv->cfg, "list", "string", g_value_get_boxed (&expected), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp90_ = (desktop_agnostic_config_backend_get_value (self->priv->cfg, "list", "string", &_tmp89_, &_inner_error_), _tmp89_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_assert_equals (self, &expected, (_tmp92_ = _tmp91_ = _tmp90_, &_tmp92_), &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&_tmp91_) ? (g_value_unset (&_tmp91_), NULL) : NULL; - _tmp93_ = desktop_agnostic_config_backend_get_list (self->priv->cfg, "list", "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - _tmp96_ = (_tmp95_ = test_case_array_equals (self, g_value_get_boxed (&expected), _tmp94_ = _tmp93_, &_inner_error_), _g_value_array_free0 (_tmp94_), _tmp95_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - g_assert (_tmp96_); - test_case_test_set_empty_list (self, "boolean", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_test_set_empty_list (self, "integer", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_test_set_empty_list (self, "float", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - test_case_test_set_empty_list (self, "string", &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); - return; - } - G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; - G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; - G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; - G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; - _g_value_array_free0 (expected_array); -} - - -static void test_case_update_notify_value (TestCase* self, GMainContext* ctx, const char* value, guint counter_expected, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - g_return_if_fail (ctx != NULL); - g_return_if_fail (value != NULL); - _inner_error_ = NULL; - desktop_agnostic_config_backend_set_string (self->priv->cfg, "misc", "string", value, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - g_usleep ((gulong) 250000); - while (TRUE) { - if (!g_main_context_pending (ctx)) { - break; - } - g_main_context_iteration (ctx, FALSE); - } - g_assert (self->priv->notify_counter == counter_expected); -} - - -static void _test_case_on_string_changed_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self) { - test_case_on_string_changed (self, group, key, value); -} - - -static void _test_case_on_string_changed2_desktop_agnostic_config_notify_func (const char* group, const char* key, GValue* value, gpointer self) { - test_case_on_string_changed2 (self, group, key, value); -} - - -static void test_case_test_notify (TestCase* self, GError** error) { - GError * _inner_error_; - GMainContext* ctx; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - ctx = g_main_loop_get_context (self->priv->ml); - desktop_agnostic_config_backend_notify_add (self->priv->cfg, "misc", "string", _test_case_on_string_changed_desktop_agnostic_config_notify_func, self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - desktop_agnostic_config_backend_notify_add (self->priv->cfg, "misc", "string", _test_case_on_string_changed2_desktop_agnostic_config_notify_func, self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_update_notify_value (self, ctx, "Bar foo", (guint) 1, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_update_notify_value (self, ctx, "Foo quux", (guint) 5, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - desktop_agnostic_config_backend_notify_remove (self->priv->cfg, "misc", "string", _test_case_on_string_changed_desktop_agnostic_config_notify_func, self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_update_notify_value (self, ctx, "Bar quux", (guint) 8, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - desktop_agnostic_config_backend_notify_remove (self->priv->cfg, "misc", "string", _test_case_on_string_changed2_desktop_agnostic_config_notify_func, self, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_update_notify_value (self, ctx, "Baz foo", (guint) 8, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -static gpointer _g_error_copy0 (gpointer self) { - return self ? g_error_copy (self) : NULL; -} - - -static void test_case_test_invalid_func (TestCase* self, TestCaseGetCfgFunc func, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - { - func (self->priv->cfg, "foo", "bar", &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - _inner_error_ = g_error_new_literal (ASSERTION_ERROR, ASSERTION_ERROR_NOT_REACHED, "Key should have been nonexistent."); - { - goto __catch0_g_error; - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - if (!g_error_matches (err, DESKTOP_AGNOSTIC_CONFIG_ERROR, DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND)) { - _inner_error_ = _g_error_copy0 (err); - { - _g_error_free0 (err); - goto __finally0; - } - } - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -static void test_case_test_invalid (TestCase* self, GError** error) { - GError * _inner_error_; - g_return_if_fail (self != NULL); - _inner_error_ = NULL; - test_case_test_invalid_func (self, (TestCaseGetCfgFunc) desktop_agnostic_config_backend_get_bool, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_test_invalid_func (self, (TestCaseGetCfgFunc) desktop_agnostic_config_backend_get_float, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_test_invalid_func (self, (TestCaseGetCfgFunc) desktop_agnostic_config_backend_get_int, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_test_invalid_func (self, (TestCaseGetCfgFunc) desktop_agnostic_config_backend_get_string, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } - test_case_test_invalid_func (self, (TestCaseGetCfgFunc) desktop_agnostic_config_backend_get_list, &_inner_error_); - if (_inner_error_ != NULL) { - g_propagate_error (error, _inner_error_); - return; - } -} - - -gint test_case_main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - { - TestCase* test; - test = test_case_new (&_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == ASSERTION_ERROR) { - goto __catch1_assertion_error; - } - goto __catch1_g_error; - } - test_case_test_defaults (test, &_inner_error_); - if (_inner_error_ != NULL) { - _test_case_unref0 (test); - if (_inner_error_->domain == ASSERTION_ERROR) { - goto __catch1_assertion_error; - } - goto __catch1_g_error; - } - test_case_test_set (test, &_inner_error_); - if (_inner_error_ != NULL) { - _test_case_unref0 (test); - if (_inner_error_->domain == ASSERTION_ERROR) { - goto __catch1_assertion_error; - } - goto __catch1_g_error; - } - test_case_test_invalid (test, &_inner_error_); - if (_inner_error_ != NULL) { - _test_case_unref0 (test); - if (_inner_error_->domain == ASSERTION_ERROR) { - goto __catch1_assertion_error; - } - goto __catch1_g_error; - } - test_case_test_notify (test, &_inner_error_); - if (_inner_error_ != NULL) { - _test_case_unref0 (test); - if (_inner_error_->domain == ASSERTION_ERROR) { - goto __catch1_assertion_error; - } - goto __catch1_g_error; - } - _test_case_unref0 (test); - } - goto __finally1; - __catch1_assertion_error: - { - GError * assertion; - assertion = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-config.vala:400: Assertion Error: %s", assertion->message); - result = EXIT_ASSERTION; - _g_error_free0 (assertion); - return result; - } - } - goto __finally1; - __catch1_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-config.vala:405: Error: %s", err->message); - result = EXIT_EXCEPTION; - _g_error_free0 (err); - return result; - } - } - __finally1: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = EXIT_SUCCESS; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return test_case_main (argv, argc); -} - - -static void value_test_case_init (GValue* value) { - value->data[0].v_pointer = NULL; -} - - -static void value_test_case_free_value (GValue* value) { - if (value->data[0].v_pointer) { - test_case_unref (value->data[0].v_pointer); - } -} - - -static void value_test_case_copy_value (const GValue* src_value, GValue* dest_value) { - if (src_value->data[0].v_pointer) { - dest_value->data[0].v_pointer = test_case_ref (src_value->data[0].v_pointer); - } else { - dest_value->data[0].v_pointer = NULL; - } -} - - -static gpointer value_test_case_peek_pointer (const GValue* value) { - return value->data[0].v_pointer; -} - - -static gchar* value_test_case_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - if (collect_values[0].v_pointer) { - TestCase* object; - object = collect_values[0].v_pointer; - if (object->parent_instance.g_class == NULL) { - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } - value->data[0].v_pointer = test_case_ref (object); - } else { - value->data[0].v_pointer = NULL; - } - return NULL; -} - - -static gchar* value_test_case_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - TestCase** object_p; - object_p = collect_values[0].v_pointer; - if (!object_p) { - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); - } - if (!value->data[0].v_pointer) { - *object_p = NULL; - } else if (collect_flags && G_VALUE_NOCOPY_CONTENTS) { - *object_p = value->data[0].v_pointer; - } else { - *object_p = test_case_ref (value->data[0].v_pointer); - } - return NULL; -} - - -GParamSpec* param_spec_test_case (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { - ParamSpecTestCase* spec; - g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_CASE), NULL); - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); - G_PARAM_SPEC (spec)->value_type = object_type; - return G_PARAM_SPEC (spec); -} - - -gpointer value_get_test_case (const GValue* value) { - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_CASE), NULL); - return value->data[0].v_pointer; -} - - -void value_set_test_case (GValue* value, gpointer v_object) { - TestCase* old; - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_CASE)); - old = value->data[0].v_pointer; - if (v_object) { - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_CASE)); - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); - value->data[0].v_pointer = v_object; - test_case_ref (value->data[0].v_pointer); - } else { - value->data[0].v_pointer = NULL; - } - if (old) { - test_case_unref (old); - } -} - - -static void test_case_class_init (TestCaseClass * klass) { - test_case_parent_class = g_type_class_peek_parent (klass); - TEST_CASE_CLASS (klass)->finalize = test_case_finalize; - g_type_class_add_private (klass, sizeof (TestCasePrivate)); -} - - -static void test_case_instance_init (TestCase * self) { - self->priv = TEST_CASE_GET_PRIVATE (self); - self->ref_count = 1; -} - - -static void test_case_finalize (TestCase* obj) { - TestCase * self; - self = TEST_CASE (obj); - _g_object_unref0 (self->priv->cfg); - _g_main_loop_unref0 (self->priv->ml); -} - - -GType test_case_get_type (void) { - static GType test_case_type_id = 0; - if (test_case_type_id == 0) { - static const GTypeValueTable g_define_type_value_table = { value_test_case_init, value_test_case_free_value, value_test_case_copy_value, value_test_case_peek_pointer, "p", value_test_case_collect_value, "p", value_test_case_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (TestCaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_case_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestCase), 0, (GInstanceInitFunc) test_case_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - test_case_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestCase", &g_define_type_info, &g_define_type_fundamental_info, 0); - } - return test_case_type_id; -} - - -gpointer test_case_ref (gpointer instance) { - TestCase* self; - self = instance; - g_atomic_int_inc (&self->ref_count); - return instance; -} - - -void test_case_unref (gpointer instance) { - TestCase* self; - self = instance; - if (g_atomic_int_dec_and_test (&self->ref_count)) { - TEST_CASE_GET_CLASS (self)->finalize (self); - g_type_free_instance ((GTypeInstance *) self); - } -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-desktop-entry.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-desktop-entry.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-desktop-entry.c 2010-04-11 07:32:32.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-desktop-entry.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,174 +0,0 @@ -/* test-desktop-entry.c generated by valac, the Vala compiler - * generated from test-desktop-entry.vala, do not modify */ - -/* - * Desktop Agnostic Library: Test for the desktop entry implementations. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -gint _main (char** args, int args_length1); - - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - gdk_init (&args_length1, &args); - { - desktop_agnostic_vfs_init (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - if (args_length1 > 1) { - gboolean hit_first_arg; - hit_first_arg = FALSE; - { - char** arg_collection; - int arg_collection_length1; - int arg_it; - arg_collection = args; - arg_collection_length1 = args_length1; - for (arg_it = 0; arg_it < args_length1; arg_it = arg_it + 1) { - const char* arg; - arg = arg_collection[arg_it]; - { - DesktopAgnosticVFSFile* file; - DesktopAgnosticFDODesktopEntry* entry; - char* _tmp0_; - char* _tmp1_; - if (!hit_first_arg) { - hit_first_arg = TRUE; - continue; - } - file = desktop_agnostic_vfs_file_new_for_path (arg, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - entry = desktop_agnostic_fdo_desktop_entry_new_for_file (file, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (file); - goto __catch0_g_error; - } - g_message ("test-desktop-entry.vala:45: Entry: %s", _tmp0_ = desktop_agnostic_fdo_desktop_entry_get_name (entry)); - _g_free0 (_tmp0_); - g_message ("test-desktop-entry.vala:46: Entry exec line: %s", _tmp1_ = desktop_agnostic_fdo_desktop_entry_get_string (entry, "Exec")); - _g_free0 (_tmp1_); - if (desktop_agnostic_fdo_desktop_entry_exists (entry)) { - desktop_agnostic_fdo_desktop_entry_launch (entry, 0, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (file); - _g_object_unref0 (entry); - goto __catch0_g_error; - } - } else { - g_critical ("test-desktop-entry.vala:53: Entry does not exist."); - } - _g_object_unref0 (file); - _g_object_unref0 (entry); - } - } - } - } else { - DesktopAgnosticFDODesktopEntry* entry; - DesktopAgnosticVFSFile* file; - DesktopAgnosticFDODesktopEntry* _tmp2_; - DesktopAgnosticFDODesktopEntry* _tmp3_; - DesktopAgnosticVFSFile* _tmp4_; - DesktopAgnosticVFSFile* _tmp5_; - DesktopAgnosticFDODesktopEntry* _tmp6_; - entry = NULL; - file = NULL; - _tmp2_ = desktop_agnostic_fdo_desktop_entry_new (&_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (entry); - _g_object_unref0 (file); - goto __catch0_g_error; - } - entry = (_tmp3_ = _tmp2_, _g_object_unref0 (entry), _tmp3_); - desktop_agnostic_fdo_desktop_entry_set_name (entry, "hosts file"); - desktop_agnostic_fdo_desktop_entry_set_entry_type (entry, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK); - desktop_agnostic_fdo_desktop_entry_set_string (entry, "URL", "file:///etc/hosts"); - _tmp4_ = desktop_agnostic_vfs_file_new_for_path ("/tmp/desktop-agnostic-test.desktop", &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (entry); - _g_object_unref0 (file); - goto __catch0_g_error; - } - file = (_tmp5_ = _tmp4_, _g_object_unref0 (file), _tmp5_); - desktop_agnostic_fdo_desktop_entry_save (entry, file, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (entry); - _g_object_unref0 (file); - goto __catch0_g_error; - } - entry = (_tmp6_ = NULL, _g_object_unref0 (entry), _tmp6_); - _g_object_unref0 (entry); - _g_object_unref0 (file); - } - desktop_agnostic_vfs_shutdown (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-desktop-entry.vala:74: Error: %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-ui-color-button.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-ui-color-button.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-ui-color-button.c 2010-04-11 07:32:44.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-ui-color-button.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,234 +0,0 @@ -/* test-ui-color-button.c generated by valac, the Vala compiler - * generated from test-ui-color-button.vala, do not modify */ - -/* - * Tests the GtkColorButton wrapper class. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -#define TYPE_TEST_COLOR_BUTTON (test_color_button_get_type ()) -#define TEST_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_COLOR_BUTTON, TestColorButton)) -#define TEST_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_COLOR_BUTTON, TestColorButtonClass)) -#define IS_TEST_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_COLOR_BUTTON)) -#define IS_TEST_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_COLOR_BUTTON)) -#define TEST_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_COLOR_BUTTON, TestColorButtonClass)) - -typedef struct _TestColorButton TestColorButton; -typedef struct _TestColorButtonClass TestColorButtonClass; -typedef struct _TestColorButtonPrivate TestColorButtonPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -struct _TestColorButton { - GtkWindow parent_instance; - TestColorButtonPrivate * priv; -}; - -struct _TestColorButtonClass { - GtkWindowClass parent_class; -}; - - -static gpointer test_color_button_parent_class = NULL; - -GType test_color_button_get_type (void); -enum { - TEST_COLOR_BUTTON_DUMMY_PROPERTY -}; -static gboolean test_color_button_on_quit (TestColorButton* self, GtkWidget* widget, GdkEvent* event); -static void test_color_button_on_color_set (TestColorButton* self, GtkColorButton* button); -TestColorButton* test_color_button_new (void); -TestColorButton* test_color_button_construct (GType object_type); -gint test_color_button_main (char** args, int args_length1); -static gboolean _test_color_button_on_quit_gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static void _test_color_button_on_color_set_gtk_color_button_color_set (GtkColorButton* _sender, gpointer self); -static GObject * test_color_button_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); - - - -static gboolean test_color_button_on_quit (TestColorButton* self, GtkWidget* widget, GdkEvent* event) { - gboolean result; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (event != NULL, FALSE); - gtk_main_quit (); - result = TRUE; - return result; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void test_color_button_on_color_set (TestColorButton* self, GtkColorButton* button) { - GtkColorButton* _tmp0_; - DesktopAgnosticUIColorButton* real_button; - char* _tmp1_; - GdkColor _tmp5_; - GdkColor _tmp4_; - GdkColor _tmp2_ = {0}; - GdkColor _tmp3_ = {0}; - g_return_if_fail (self != NULL); - g_return_if_fail (button != NULL); - real_button = _g_object_ref0 ((_tmp0_ = button, DESKTOP_AGNOSTIC_UI_IS_COLOR_BUTTON (_tmp0_) ? ((DesktopAgnosticUIColorButton*) _tmp0_) : NULL)); - g_message ("test-ui-color-button.vala:62: Selected color: %s", _tmp1_ = desktop_agnostic_color_to_string (desktop_agnostic_ui_color_button_get_da_color (real_button))); - _g_free0 (_tmp1_); - g_assert (gdk_color_equal ((_tmp4_ = (desktop_agnostic_color_get_color (desktop_agnostic_ui_color_button_get_da_color (real_button), &_tmp2_), _tmp2_), &_tmp4_), (_tmp5_ = (gtk_color_button_get_color ((GtkColorButton*) real_button, &_tmp3_), _tmp3_), &_tmp5_))); - g_assert (desktop_agnostic_color_get_alpha (desktop_agnostic_ui_color_button_get_da_color (real_button)) == gtk_color_button_get_alpha ((GtkColorButton*) real_button)); - gtk_main_quit (); - _g_object_unref0 (real_button); -} - - -gint test_color_button_main (char** args, int args_length1) { - gint result; - TestColorButton* window; - TestColorButton* _tmp0_; - window = NULL; - gtk_init (&args_length1, &args); - window = (_tmp0_ = g_object_ref_sink (test_color_button_new ()), _g_object_unref0 (window), _tmp0_); - gtk_widget_show_all ((GtkWidget*) window); - gtk_main (); - result = 0; - _g_object_unref0 (window); - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return test_color_button_main (argv, argc); -} - - -TestColorButton* test_color_button_construct (GType object_type) { - TestColorButton * self; - self = g_object_newv (object_type, 0, NULL); - return self; -} - - -TestColorButton* test_color_button_new (void) { - return test_color_button_construct (TYPE_TEST_COLOR_BUTTON); -} - - -static gboolean _test_color_button_on_quit_gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { - return test_color_button_on_quit (self, _sender, event); -} - - -static void _test_color_button_on_color_set_gtk_color_button_color_set (GtkColorButton* _sender, gpointer self) { - test_color_button_on_color_set (self, _sender); -} - - -static GObject * test_color_button_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - TestColorButton * self; - GError * _inner_error_; - parent_class = G_OBJECT_CLASS (test_color_button_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = TEST_COLOR_BUTTON (obj); - _inner_error_ = NULL; - { - GtkVBox* box; - DesktopAgnosticColor* color; - GtkLabel* label; - DesktopAgnosticUIColorButton* button; - GtkVBox* _tmp0_; - GtkLabel* _tmp1_; - DesktopAgnosticColor* _tmp2_; - DesktopAgnosticColor* _tmp3_; - DesktopAgnosticUIColorButton* _tmp4_; - GtkLabel* _tmp5_; - DesktopAgnosticUIColorButton* _tmp6_; - box = NULL; - color = NULL; - label = NULL; - button = NULL; - g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) _test_color_button_on_quit_gtk_widget_delete_event, self, 0); - box = (_tmp0_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 5)), _g_object_unref0 (box), _tmp0_); - label = (_tmp1_ = g_object_ref_sink ((GtkLabel*) gtk_label_new ("With default color")), _g_object_unref0 (label), _tmp1_); - gtk_container_add ((GtkContainer*) box, (GtkWidget*) label); - _tmp2_ = desktop_agnostic_color_new_from_string ("green", &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (box); - _g_object_unref0 (color); - _g_object_unref0 (label); - _g_object_unref0 (button); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - color = (_tmp3_ = _tmp2_, _g_object_unref0 (color), _tmp3_); - desktop_agnostic_color_set_alpha (color, (guint) (G_MAXUSHORT / 2)); - button = (_tmp4_ = g_object_ref_sink (desktop_agnostic_ui_color_button_new_with_color (color)), _g_object_unref0 (button), _tmp4_); - g_signal_connect_object ((GtkColorButton*) button, "color-set", (GCallback) _test_color_button_on_color_set_gtk_color_button_color_set, self, 0); - gtk_container_add ((GtkContainer*) box, (GtkWidget*) button); - label = (_tmp5_ = g_object_ref_sink ((GtkLabel*) gtk_label_new ("Without default color")), _g_object_unref0 (label), _tmp5_); - gtk_container_add ((GtkContainer*) box, (GtkWidget*) label); - button = (_tmp6_ = g_object_ref_sink (desktop_agnostic_ui_color_button_new ()), _g_object_unref0 (button), _tmp6_); - g_signal_connect_object ((GtkColorButton*) button, "color-set", (GCallback) _test_color_button_on_color_set_gtk_color_button_color_set, self, 0); - gtk_container_add ((GtkContainer*) box, (GtkWidget*) button); - gtk_container_add ((GtkContainer*) self, (GtkWidget*) box); - _g_object_unref0 (box); - _g_object_unref0 (color); - _g_object_unref0 (label); - _g_object_unref0 (button); - } - return obj; -} - - -static void test_color_button_class_init (TestColorButtonClass * klass) { - test_color_button_parent_class = g_type_class_peek_parent (klass); - G_OBJECT_CLASS (klass)->constructor = test_color_button_constructor; -} - - -static void test_color_button_instance_init (TestColorButton * self) { -} - - -GType test_color_button_get_type (void) { - static GType test_color_button_type_id = 0; - if (test_color_button_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (TestColorButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_color_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestColorButton), 0, (GInstanceInitFunc) test_color_button_instance_init, NULL }; - test_color_button_type_id = g_type_register_static (GTK_TYPE_WINDOW, "TestColorButton", &g_define_type_info, 0); - } - return test_color_button_type_id; -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-ui-color-button-gtkbuilder.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-ui-color-button-gtkbuilder.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-ui-color-button-gtkbuilder.c 2010-04-11 07:32:44.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-ui-color-button-gtkbuilder.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,149 +0,0 @@ -/* test-ui-color-button-gtkbuilder.c generated by valac, the Vala compiler - * generated from test-ui-color-button-gtkbuilder.vala, do not modify */ - -/* - * Tests the GtkColorButton wrapper class with GtkBuilder. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -gboolean on_quit (GtkWidget* widget, GdkEvent* event); -void on_color_set (GtkColorButton* button); -static gboolean _on_quit_gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static void _on_color_set_gtk_color_button_color_set (GtkColorButton* _sender, gpointer self); -gint _main (char** args, int args_length1); - - - -gboolean on_quit (GtkWidget* widget, GdkEvent* event) { - gboolean result; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (event != NULL, FALSE); - gtk_main_quit (); - result = TRUE; - return result; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -void on_color_set (GtkColorButton* button) { - GtkColorButton* _tmp0_; - DesktopAgnosticUIColorButton* real_button; - char* _tmp1_; - g_return_if_fail (button != NULL); - real_button = _g_object_ref0 ((_tmp0_ = button, DESKTOP_AGNOSTIC_UI_IS_COLOR_BUTTON (_tmp0_) ? ((DesktopAgnosticUIColorButton*) _tmp0_) : NULL)); - g_message ("test-ui-color-button-gtkbuilder.vala:36: Selected color: %s", _tmp1_ = desktop_agnostic_color_to_string (desktop_agnostic_ui_color_button_get_da_color (real_button))); - _g_free0 (_tmp1_); - gtk_main_quit (); - _g_object_unref0 (real_button); -} - - -static gboolean _on_quit_gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { - return on_quit (_sender, event); -} - - -static void _on_color_set_gtk_color_button_color_set (GtkColorButton* _sender, gpointer self) { - on_color_set (_sender); -} - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - GtkBuilder* builder; - GtkWindow* window; - DesktopAgnosticUIColorButton* button; - GtkBuilder* _tmp0_; - _inner_error_ = NULL; - builder = NULL; - window = NULL; - button = NULL; - gtk_init (&args_length1, &args); - builder = (_tmp0_ = gtk_builder_new (), _g_object_unref0 (builder), _tmp0_); - { - GObject* _tmp1_; - GtkWidget* _tmp2_; - gtk_builder_add_from_file (builder, "test-ui-color-button-gtkbuilder.ui", &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - window = (_tmp1_ = gtk_builder_get_object (builder, "window1"), GTK_IS_WINDOW (_tmp1_) ? ((GtkWindow*) _tmp1_) : NULL); - g_signal_connect ((GtkWidget*) window, "delete-event", (GCallback) _on_quit_gtk_widget_delete_event, NULL); - button = (_tmp2_ = gtk_bin_get_child ((GtkBin*) window), DESKTOP_AGNOSTIC_UI_IS_COLOR_BUTTON (_tmp2_) ? ((DesktopAgnosticUIColorButton*) _tmp2_) : NULL); - g_signal_connect ((GtkColorButton*) button, "color-set", (GCallback) _on_color_set_gtk_color_button_color_set, NULL); - gtk_widget_show_all ((GtkWidget*) window); - gtk_main (); - result = 0; - _g_object_unref0 (builder); - return result; - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-ui-color-button-gtkbuilder.vala:61: Error: %s", err->message); - result = 1; - _g_error_free0 (err); - _g_object_unref0 (builder); - return result; - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_object_unref0 (builder); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - _g_object_unref0 (builder); -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-bookmarks-gtk.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-bookmarks-gtk.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-bookmarks-gtk.c 2010-04-11 07:32:13.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-bookmarks-gtk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -/* test-vfs-bookmarks-gtk.c generated by valac, the Vala compiler - * generated from test-vfs-bookmarks-gtk.vala, do not modify */ - -/* - * Desktop Agnostic Library: Test for the desktop entry implementations. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include - -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL))) - - - -void print_bookmarks (DesktopAgnosticVFSGtkBookmarks* parser); -static void _print_bookmarks_desktop_agnostic_vfs_gtk_bookmarks_changed (DesktopAgnosticVFSGtkBookmarks* _sender, gpointer self); -gint _main (char** args, int args_length1); - - - -void print_bookmarks (DesktopAgnosticVFSGtkBookmarks* parser) { - g_return_if_fail (parser != NULL); - if (desktop_agnostic_vfs_gtk_bookmarks_get_bookmarks (parser) == NULL) { - g_message ("test-vfs-bookmarks-gtk.vala:31: No bookmarks."); - } else { - g_message ("test-vfs-bookmarks-gtk.vala:35: Bookmarks:"); - { - GSList* b_collection; - GSList* b_it; - b_collection = desktop_agnostic_vfs_gtk_bookmarks_get_bookmarks (parser); - for (b_it = b_collection; b_it != NULL; b_it = b_it->next) { - DesktopAgnosticVFSBookmark* b; - b = (DesktopAgnosticVFSBookmark*) b_it->data; - { - char* path; - path = desktop_agnostic_vfs_file_get_path (desktop_agnostic_vfs_bookmark_get_file (b)); - if (path == NULL) { - char* _tmp0_; - g_message ("test-vfs-bookmarks-gtk.vala:41: * %s (%s)", _tmp0_ = desktop_agnostic_vfs_file_get_uri (desktop_agnostic_vfs_bookmark_get_file (b)), desktop_agnostic_vfs_bookmark_get_alias (b)); - _g_free0 (_tmp0_); - } else { - g_message ("test-vfs-bookmarks-gtk.vala:45: * %s (%s)", path, desktop_agnostic_vfs_bookmark_get_alias (b)); - } - _g_free0 (path); - } - } - } - } -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void _print_bookmarks_desktop_agnostic_vfs_gtk_bookmarks_changed (DesktopAgnosticVFSGtkBookmarks* _sender, gpointer self) { - print_bookmarks (_sender); -} - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - DesktopAgnosticVFSImplementation* vfs; - DesktopAgnosticVFSGtkBookmarks* parser; - DesktopAgnosticVFSImplementation* _tmp0_; - DesktopAgnosticVFSImplementation* _tmp1_; - GMainLoop* ml; - DesktopAgnosticVFSGtkBookmarks* _tmp4_; - _inner_error_ = NULL; - vfs = NULL; - parser = NULL; - _tmp0_ = desktop_agnostic_vfs_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (vfs); - _g_object_unref0 (parser); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - vfs = (_tmp1_ = _g_object_ref0 (_tmp0_), _g_object_unref0 (vfs), _tmp1_); - desktop_agnostic_vfs_implementation_init (vfs); - if (args_length1 < 2) { - DesktopAgnosticVFSGtkBookmarks* _tmp2_; - parser = (_tmp2_ = desktop_agnostic_vfs_gtk_bookmarks_new (NULL, TRUE), _g_object_unref0 (parser), _tmp2_); - } else { - { - DesktopAgnosticVFSFile* file; - DesktopAgnosticVFSGtkBookmarks* _tmp3_; - file = desktop_agnostic_vfs_file_new_for_path (args[1], &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - parser = (_tmp3_ = desktop_agnostic_vfs_gtk_bookmarks_new (file, TRUE), _g_object_unref0 (parser), _tmp3_); - _g_object_unref0 (file); - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-vfs-bookmarks-gtk.vala:73: Error: %s", err->message); - result = 1; - _g_error_free0 (err); - _g_object_unref0 (vfs); - _g_object_unref0 (parser); - return result; - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_object_unref0 (vfs); - _g_object_unref0 (parser); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - } - print_bookmarks (parser); - g_signal_connect (parser, "changed", (GCallback) _print_bookmarks_desktop_agnostic_vfs_gtk_bookmarks_changed, NULL); - ml = g_main_loop_new (NULL, FALSE); - g_main_loop_run (ml); - parser = (_tmp4_ = NULL, _g_object_unref0 (parser), _tmp4_); - desktop_agnostic_vfs_implementation_shutdown (vfs); - result = 0; - _g_object_unref0 (vfs); - _g_object_unref0 (parser); - _g_main_loop_unref0 (ml); - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-file.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-file.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-file.c 2010-04-11 07:32:18.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-file.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,349 +0,0 @@ -/* test-vfs-file.c generated by valac, the Vala compiler - * generated from test-vfs-file.vala, do not modify */ - -/* - * Desktop Agnostic Library: Test for the file (monitor) implementations. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -#define CONTENT "Desktop Agnostic Library" -static void _g_slist_free_g_object_unref (GSList* self); -gint _main (char** args, int args_length1); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -static void _g_slist_free_g_object_unref (GSList* self) { - g_slist_foreach (self, (GFunc) g_object_unref, NULL); - g_slist_free (self); -} - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - gdk_init (&args_length1, &args); - { - gboolean test_launch = FALSE; - const char* path; - DesktopAgnosticVFSFile* tmp; - char* file_path; - DesktopAgnosticVFSFile* file; - char* contents; - gsize length = 0UL; - char* file_copy_path; - DesktopAgnosticVFSFile* file_copy; - char* copy_contents; - gsize copy_length = 0UL; - gboolean _tmp0_ = FALSE; - DesktopAgnosticVFSFile* _tmp1_; - DesktopAgnosticVFSFile* _tmp2_; - DesktopAgnosticVFSFile* _tmp3_; - char* _tmp4_; - char* _tmp5_; - GSList* _tmp6_; - GSList* _tmp7_; - char* _tmp8_; - DesktopAgnosticVFSFile* _tmp9_; - DesktopAgnosticVFSFile* _tmp10_; - char* _tmp14_; - char* _tmp13_; - DesktopAgnosticVFSFile* _tmp12_; - DesktopAgnosticVFSFile* _tmp11_; - DesktopAgnosticVFSFile* _tmp15_; - char* _tmp18_; - gboolean _tmp17_; - char* _tmp16_ = NULL; - char* _tmp20_; - DesktopAgnosticVFSFile* _tmp21_; - DesktopAgnosticVFSFile* _tmp22_; - gboolean _tmp23_; - char* _tmp26_; - gboolean _tmp25_; - char* _tmp24_ = NULL; - DesktopAgnosticVFSFile* _tmp29_; - path = NULL; - tmp = NULL; - file_path = NULL; - file = NULL; - contents = NULL; - file_copy_path = NULL; - file_copy = NULL; - copy_contents = NULL; - if (args_length1 > 1) { - _tmp0_ = _vala_strcmp0 (args[1], "launch") == 0; - } else { - _tmp0_ = FALSE; - } - test_launch = _tmp0_; - desktop_agnostic_vfs_init (&_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - path = g_get_tmp_dir (); - _tmp1_ = desktop_agnostic_vfs_file_new_for_path (path, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - tmp = (_tmp2_ = _tmp1_, _g_object_unref0 (tmp), _tmp2_); - g_assert ((_tmp3_ = desktop_agnostic_vfs_file_get_parent (tmp)) != NULL); - _g_object_unref0 (_tmp3_); - g_assert (desktop_agnostic_vfs_file_exists (tmp)); - g_assert (desktop_agnostic_vfs_file_get_file_type (tmp) == DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY); - g_assert ((desktop_agnostic_vfs_file_get_access_flags (tmp) & DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ) != 0); - g_assert (desktop_agnostic_vfs_file_is_readable (tmp)); - g_assert ((desktop_agnostic_vfs_file_get_access_flags (tmp) & DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE) != 0); - g_assert (desktop_agnostic_vfs_file_is_writable (tmp)); - g_message ("test-vfs-file.vala:56: URI: %s", _tmp4_ = desktop_agnostic_vfs_file_get_uri (tmp)); - _g_free0 (_tmp4_); - g_message ("test-vfs-file.vala:57: Path: %s", _tmp5_ = desktop_agnostic_vfs_file_get_path (tmp)); - _g_free0 (_tmp5_); - _tmp6_ = desktop_agnostic_vfs_file_enumerate_children (tmp, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - g_message ("test-vfs-file.vala:58: # of files: %u", g_slist_length (_tmp7_ = _tmp6_)); - __g_slist_free_g_object_unref0 (_tmp7_); - file_path = (_tmp8_ = g_build_filename (path, "desktop-agnostic-test", NULL), _g_free0 (file_path), _tmp8_); - _tmp9_ = desktop_agnostic_vfs_file_new_for_path (file_path, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - file = (_tmp10_ = _tmp9_, _g_object_unref0 (file), _tmp10_); - g_assert (((_tmp11_ = desktop_agnostic_vfs_file_get_parent (file)) != NULL) && (_vala_strcmp0 (_tmp13_ = desktop_agnostic_vfs_file_get_uri (_tmp12_ = desktop_agnostic_vfs_file_get_parent (file)), _tmp14_ = desktop_agnostic_vfs_file_get_uri (tmp)) == 0)); - _g_free0 (_tmp14_); - _g_free0 (_tmp13_); - _g_object_unref0 (_tmp12_); - _g_object_unref0 (_tmp11_); - tmp = (_tmp15_ = NULL, _g_object_unref0 (tmp), _tmp15_); - desktop_agnostic_vfs_file_replace_contents (file, CONTENT, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - _tmp17_ = desktop_agnostic_vfs_file_load_contents (file, &_tmp16_, &length, &_inner_error_); - contents = (_tmp18_ = _tmp16_, _g_free0 (contents), _tmp18_); - _tmp17_; - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - g_assert (_vala_strcmp0 (contents, CONTENT) == 0); - if (test_launch) { - gboolean _tmp19_; - _tmp19_ = desktop_agnostic_vfs_file_launch (file, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - g_assert (_tmp19_); - } - file_copy_path = (_tmp20_ = g_strdup_printf ("%s-copy", file_path), _g_free0 (file_copy_path), _tmp20_); - _tmp21_ = desktop_agnostic_vfs_file_new_for_path (file_copy_path, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - file_copy = (_tmp22_ = _tmp21_, _g_object_unref0 (file_copy), _tmp22_); - _tmp23_ = desktop_agnostic_vfs_file_copy (file, file_copy, TRUE, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - g_assert (_tmp23_); - _tmp25_ = desktop_agnostic_vfs_file_load_contents (file_copy, &_tmp24_, ©_length, &_inner_error_); - copy_contents = (_tmp26_ = _tmp24_, _g_free0 (copy_contents), _tmp26_); - _tmp25_; - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - g_assert (_vala_strcmp0 (contents, copy_contents) == 0); - g_assert (length == copy_length); - if (!test_launch) { - gboolean _tmp27_; - gboolean _tmp28_; - _tmp27_ = desktop_agnostic_vfs_file_remove (file_copy, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - g_assert (_tmp27_); - g_assert (!desktop_agnostic_vfs_file_exists (file_copy)); - _tmp28_ = desktop_agnostic_vfs_file_remove (file, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - g_assert (_tmp28_); - g_assert (!desktop_agnostic_vfs_file_exists (file)); - } - file = (_tmp29_ = NULL, _g_object_unref0 (file), _tmp29_); - desktop_agnostic_vfs_shutdown (&_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - goto __catch0_g_error; - } - _g_object_unref0 (tmp); - _g_free0 (file_path); - _g_object_unref0 (file); - _g_free0 (contents); - _g_free0 (file_copy_path); - _g_object_unref0 (file_copy); - _g_free0 (copy_contents); - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-vfs-file.vala:88: Error: %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-file-monitor.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-file-monitor.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-file-monitor.c 2010-04-11 07:32:13.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-file-monitor.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,423 +0,0 @@ -/* test-vfs-file-monitor.c generated by valac, the Vala compiler - * generated from test-vfs-file-monitor.vala, do not modify */ - -/* - * Desktop Agnostic Library: Test for the file monitor implementations. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - - -#define TYPE_TEST_FILE_MONITOR (test_file_monitor_get_type ()) -#define TEST_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_FILE_MONITOR, TestFileMonitor)) -#define TEST_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_FILE_MONITOR, TestFileMonitorClass)) -#define IS_TEST_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_FILE_MONITOR)) -#define IS_TEST_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_FILE_MONITOR)) -#define TEST_FILE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_FILE_MONITOR, TestFileMonitorClass)) - -typedef struct _TestFileMonitor TestFileMonitor; -typedef struct _TestFileMonitorClass TestFileMonitorClass; -typedef struct _TestFileMonitorPrivate TestFileMonitorPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL))) -typedef struct _ParamSpecTestFileMonitor ParamSpecTestFileMonitor; - -struct _TestFileMonitor { - GTypeInstance parent_instance; - volatile int ref_count; - TestFileMonitorPrivate * priv; -}; - -struct _TestFileMonitorClass { - GTypeClass parent_class; - void (*finalize) (TestFileMonitor *self); -}; - -struct _ParamSpecTestFileMonitor { - GParamSpec parent_instance; -}; - - -static DesktopAgnosticVFSFile* test_file_monitor_file; -static DesktopAgnosticVFSFile* test_file_monitor_file = NULL; -static DesktopAgnosticVFSFileMonitor* test_file_monitor_monitor; -static DesktopAgnosticVFSFileMonitor* test_file_monitor_monitor = NULL; -static gpointer test_file_monitor_parent_class = NULL; - -gpointer test_file_monitor_ref (gpointer instance); -void test_file_monitor_unref (gpointer instance); -GParamSpec* param_spec_test_file_monitor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); -void value_set_test_file_monitor (GValue* value, gpointer v_object); -gpointer value_get_test_file_monitor (const GValue* value); -GType test_file_monitor_get_type (void); -enum { - TEST_FILE_MONITOR_DUMMY_PROPERTY -}; -static void test_file_monitor_on_change (DesktopAgnosticVFSFileMonitor* monitor, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event); -static gboolean test_file_monitor_do_emit (void); -static void _test_file_monitor_on_change_desktop_agnostic_vfs_file_monitor_changed (DesktopAgnosticVFSFileMonitor* _sender, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, gpointer self); -static gboolean _test_file_monitor_do_emit_gsource_func (gpointer self); -gint test_file_monitor_main (char** args, int args_length1); -TestFileMonitor* test_file_monitor_new (void); -TestFileMonitor* test_file_monitor_construct (GType object_type); -static void test_file_monitor_finalize (TestFileMonitor* obj); - - - -static void test_file_monitor_on_change (DesktopAgnosticVFSFileMonitor* monitor, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event) { - char* evt_str; - char* _tmp5_; - g_return_if_fail (monitor != NULL); - g_return_if_fail (file != NULL); - evt_str = g_strdup ("?"); - switch (event) { - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED: - { - char* _tmp0_; - evt_str = (_tmp0_ = g_strdup ("Changed"), _g_free0 (evt_str), _tmp0_); - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED: - { - char* _tmp1_; - evt_str = (_tmp1_ = g_strdup ("Created"), _g_free0 (evt_str), _tmp1_); - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED: - { - char* _tmp2_; - evt_str = (_tmp2_ = g_strdup ("Deleted"), _g_free0 (evt_str), _tmp2_); - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: - { - char* _tmp3_; - evt_str = (_tmp3_ = g_strdup ("Attribute Changed"), _g_free0 (evt_str), _tmp3_); - break; - } - case DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN: - { - char* _tmp4_; - evt_str = (_tmp4_ = g_strdup ("Unknown"), _g_free0 (evt_str), _tmp4_); - break; - } - } - g_message ("test-vfs-file-monitor.vala:53: %s: %s", evt_str, _tmp5_ = desktop_agnostic_vfs_file_get_uri (file)); - _g_free0 (_tmp5_); - if (other != NULL) { - char* _tmp6_; - g_message ("test-vfs-file-monitor.vala:56: * other: %s", _tmp6_ = desktop_agnostic_vfs_file_get_uri (other)); - _g_free0 (_tmp6_); - } - _g_free0 (evt_str); -} - - -static gboolean test_file_monitor_do_emit (void) { - gboolean result; - GError * _inner_error_; - _inner_error_ = NULL; - { - char* _tmp0_; - char* _tmp1_; - char* filename; - DesktopAgnosticVFSFile* other; - filename = (_tmp1_ = g_build_filename (_tmp0_ = desktop_agnostic_vfs_file_get_path (test_file_monitor_file), "test-vfs-file.txt", NULL), _g_free0 (_tmp0_), _tmp1_); - other = desktop_agnostic_vfs_file_new_for_path (filename, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (filename); - goto __catch0_g_error; - } - desktop_agnostic_vfs_file_monitor_emit (test_file_monitor_monitor, other, DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED); - _g_free0 (filename); - _g_object_unref0 (other); - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-vfs-file-monitor.vala:70: Error: %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - result = FALSE; - return result; -} - - -static void _test_file_monitor_on_change_desktop_agnostic_vfs_file_monitor_changed (DesktopAgnosticVFSFileMonitor* _sender, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other, DesktopAgnosticVFSFileMonitorEvent event, gpointer self) { - test_file_monitor_on_change (_sender, file, other, event); -} - - -static gboolean _test_file_monitor_do_emit_gsource_func (gpointer self) { - return test_file_monitor_do_emit (); -} - - -gint test_file_monitor_main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - if (args_length1 < 2) { - fprintf (stderr, "Usage: %s [FILE | DIRECTORY FILE] \n", args[0]); - result = 1; - return result; - } - { - const char* path; - DesktopAgnosticVFSFile* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - DesktopAgnosticVFSFileMonitor* _tmp2_; - GMainLoop* mainloop; - gboolean _tmp3_ = FALSE; - desktop_agnostic_vfs_init (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch1_g_error; - } - path = args[1]; - _tmp0_ = desktop_agnostic_vfs_file_new_for_path (path, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch1_g_error; - } - test_file_monitor_file = (_tmp1_ = _tmp0_, _g_object_unref0 (test_file_monitor_file), _tmp1_); - test_file_monitor_monitor = (_tmp2_ = desktop_agnostic_vfs_file_monitor (test_file_monitor_file), _g_object_unref0 (test_file_monitor_monitor), _tmp2_); - g_signal_connect (test_file_monitor_monitor, "changed", (GCallback) _test_file_monitor_on_change_desktop_agnostic_vfs_file_monitor_changed, NULL); - mainloop = g_main_loop_new (NULL, FALSE); - if (args_length1 == 3) { - _tmp3_ = desktop_agnostic_vfs_file_get_file_type (test_file_monitor_file) == DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY; - } else { - _tmp3_ = FALSE; - } - if (_tmp3_) { - g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 2, _test_file_monitor_do_emit_gsource_func, NULL, NULL); - } - g_main_loop_run (mainloop); - desktop_agnostic_vfs_file_monitor_cancel (test_file_monitor_monitor); - g_assert (desktop_agnostic_vfs_file_monitor_get_cancelled (test_file_monitor_monitor)); - desktop_agnostic_vfs_shutdown (&_inner_error_); - if (_inner_error_ != NULL) { - _g_main_loop_unref0 (mainloop); - goto __catch1_g_error; - } - _g_main_loop_unref0 (mainloop); - } - goto __finally1; - __catch1_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-vfs-file-monitor.vala:102: VFS Error: %s", err->message); - result = 1; - _g_error_free0 (err); - return result; - } - } - __finally1: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return test_file_monitor_main (argv, argc); -} - - -TestFileMonitor* test_file_monitor_construct (GType object_type) { - TestFileMonitor* self; - self = (TestFileMonitor*) g_type_create_instance (object_type); - return self; -} - - -TestFileMonitor* test_file_monitor_new (void) { - return test_file_monitor_construct (TYPE_TEST_FILE_MONITOR); -} - - -static void value_test_file_monitor_init (GValue* value) { - value->data[0].v_pointer = NULL; -} - - -static void value_test_file_monitor_free_value (GValue* value) { - if (value->data[0].v_pointer) { - test_file_monitor_unref (value->data[0].v_pointer); - } -} - - -static void value_test_file_monitor_copy_value (const GValue* src_value, GValue* dest_value) { - if (src_value->data[0].v_pointer) { - dest_value->data[0].v_pointer = test_file_monitor_ref (src_value->data[0].v_pointer); - } else { - dest_value->data[0].v_pointer = NULL; - } -} - - -static gpointer value_test_file_monitor_peek_pointer (const GValue* value) { - return value->data[0].v_pointer; -} - - -static gchar* value_test_file_monitor_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - if (collect_values[0].v_pointer) { - TestFileMonitor* object; - object = collect_values[0].v_pointer; - if (object->parent_instance.g_class == NULL) { - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } - value->data[0].v_pointer = test_file_monitor_ref (object); - } else { - value->data[0].v_pointer = NULL; - } - return NULL; -} - - -static gchar* value_test_file_monitor_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - TestFileMonitor** object_p; - object_p = collect_values[0].v_pointer; - if (!object_p) { - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); - } - if (!value->data[0].v_pointer) { - *object_p = NULL; - } else if (collect_flags && G_VALUE_NOCOPY_CONTENTS) { - *object_p = value->data[0].v_pointer; - } else { - *object_p = test_file_monitor_ref (value->data[0].v_pointer); - } - return NULL; -} - - -GParamSpec* param_spec_test_file_monitor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { - ParamSpecTestFileMonitor* spec; - g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_FILE_MONITOR), NULL); - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); - G_PARAM_SPEC (spec)->value_type = object_type; - return G_PARAM_SPEC (spec); -} - - -gpointer value_get_test_file_monitor (const GValue* value) { - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_FILE_MONITOR), NULL); - return value->data[0].v_pointer; -} - - -void value_set_test_file_monitor (GValue* value, gpointer v_object) { - TestFileMonitor* old; - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_FILE_MONITOR)); - old = value->data[0].v_pointer; - if (v_object) { - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_FILE_MONITOR)); - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); - value->data[0].v_pointer = v_object; - test_file_monitor_ref (value->data[0].v_pointer); - } else { - value->data[0].v_pointer = NULL; - } - if (old) { - test_file_monitor_unref (old); - } -} - - -static void test_file_monitor_class_init (TestFileMonitorClass * klass) { - test_file_monitor_parent_class = g_type_class_peek_parent (klass); - TEST_FILE_MONITOR_CLASS (klass)->finalize = test_file_monitor_finalize; -} - - -static void test_file_monitor_instance_init (TestFileMonitor * self) { - self->ref_count = 1; -} - - -static void test_file_monitor_finalize (TestFileMonitor* obj) { - TestFileMonitor * self; - self = TEST_FILE_MONITOR (obj); -} - - -GType test_file_monitor_get_type (void) { - static GType test_file_monitor_type_id = 0; - if (test_file_monitor_type_id == 0) { - static const GTypeValueTable g_define_type_value_table = { value_test_file_monitor_init, value_test_file_monitor_free_value, value_test_file_monitor_copy_value, value_test_file_monitor_peek_pointer, "p", value_test_file_monitor_collect_value, "p", value_test_file_monitor_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (TestFileMonitorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_file_monitor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestFileMonitor), 0, (GInstanceInitFunc) test_file_monitor_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - test_file_monitor_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestFileMonitor", &g_define_type_info, &g_define_type_fundamental_info, 0); - } - return test_file_monitor_type_id; -} - - -gpointer test_file_monitor_ref (gpointer instance) { - TestFileMonitor* self; - self = instance; - g_atomic_int_inc (&self->ref_count); - return instance; -} - - -void test_file_monitor_unref (gpointer instance) { - TestFileMonitor* self; - self = instance; - if (g_atomic_int_dec_and_test (&self->ref_count)) { - TEST_FILE_MONITOR_GET_CLASS (self)->finalize (self); - g_type_free_instance ((GTypeInstance *) self); - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-glob.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-glob.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-glob.c 2010-04-11 07:32:20.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-glob.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -/* test-vfs-glob.c generated by valac, the Vala compiler - * generated from test-vfs-glob.vala, do not modify */ - -/* - * Desktop Agnostic Library: glob() wrapper test. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -gint _main (char** args, int args_length1); - - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - DesktopAgnosticVFSGlob* g; - gboolean first_arg; - _inner_error_ = NULL; - if (args_length1 < 2) { - result = 0; - return result; - } - g = NULL; - first_arg = FALSE; - { - char** arg_collection; - int arg_collection_length1; - int arg_it; - arg_collection = args; - arg_collection_length1 = args_length1; - for (arg_it = 0; arg_it < args_length1; arg_it = arg_it + 1) { - const char* arg; - arg = arg_collection[arg_it]; - { - if (!first_arg) { - first_arg = TRUE; - continue; - } - { - if (g == NULL) { - DesktopAgnosticVFSGlob* _tmp0_; - DesktopAgnosticVFSGlob* _tmp1_; - _tmp0_ = desktop_agnostic_vfs_glob_execute (arg, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - goto __catch0_desktop_agnostic_vfs_glob_error; - } - _g_object_unref0 (g); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - g = (_tmp1_ = _tmp0_, _g_object_unref0 (g), _tmp1_); - } else { - desktop_agnostic_vfs_glob_append (g, arg, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == DESKTOP_AGNOSTIC_VFS_GLOB_ERROR) { - goto __catch0_desktop_agnostic_vfs_glob_error; - } - _g_object_unref0 (g); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - } - { - gint _tmp2_; - char** path_collection; - int path_collection_length1; - int path_it; - path_collection = desktop_agnostic_vfs_glob_get_paths (g, &_tmp2_); - path_collection_length1 = _tmp2_; - for (path_it = 0; path_it < _tmp2_; path_it = path_it + 1) { - const char* path; - path = path_collection[path_it]; - { - fprintf (stdout, "%s\n", path); - } - } - } - } - goto __finally0; - __catch0_desktop_agnostic_vfs_glob_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - if (g_error_matches (err, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR, DESKTOP_AGNOSTIC_VFS_GLOB_ERROR_NOMATCH)) { - g_critical ("test-vfs-glob.vala:60: Error: %s", err->message); - result = 1; - _g_error_free0 (err); - _g_object_unref0 (g); - return result; - } - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_object_unref0 (g); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - } - } - } - result = 0; - _g_object_unref0 (g); - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-trash.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-trash.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-trash.c 2010-04-11 07:32:24.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-trash.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,302 +0,0 @@ -/* test-vfs-trash.c generated by valac, the Vala compiler - * generated from test-vfs-trash.vala, do not modify */ - -/* - * Test program for the Trash VFS backends. - * - * Copyright (C) 2008, 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define TYPE_TEST_TRASH (test_trash_get_type ()) -#define TEST_TRASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_TRASH, TestTrash)) -#define TEST_TRASH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_TRASH, TestTrashClass)) -#define IS_TEST_TRASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_TRASH)) -#define IS_TEST_TRASH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_TRASH)) -#define TEST_TRASH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_TRASH, TestTrashClass)) - -typedef struct _TestTrash TestTrash; -typedef struct _TestTrashClass TestTrashClass; -typedef struct _TestTrashPrivate TestTrashPrivate; -#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -typedef struct _ParamSpecTestTrash ParamSpecTestTrash; - -struct _TestTrash { - GTypeInstance parent_instance; - volatile int ref_count; - TestTrashPrivate * priv; -}; - -struct _TestTrashClass { - GTypeClass parent_class; - void (*finalize) (TestTrash *self); -}; - -struct _ParamSpecTestTrash { - GParamSpec parent_instance; -}; - - -static GMainLoop* test_trash_mainloop; -static GMainLoop* test_trash_mainloop = NULL; -static gpointer test_trash_parent_class = NULL; - -gpointer test_trash_ref (gpointer instance); -void test_trash_unref (gpointer instance); -GParamSpec* param_spec_test_trash (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); -void value_set_test_trash (GValue* value, gpointer v_object); -gpointer value_get_test_trash (const GValue* value); -GType test_trash_get_type (void); -enum { - TEST_TRASH_DUMMY_PROPERTY -}; -static void test_trash_on_file_count_changed (DesktopAgnosticVFSTrash* t); -static void _test_trash_on_file_count_changed_desktop_agnostic_vfs_trash_file_count_changed (DesktopAgnosticVFSTrash* _sender, gpointer self); -static gint test_trash_main (char** args, int args_length1); -TestTrash* test_trash_new (void); -TestTrash* test_trash_construct (GType object_type); -static void test_trash_finalize (TestTrash* obj); - - - -static void test_trash_on_file_count_changed (DesktopAgnosticVFSTrash* t) { - g_return_if_fail (t != NULL); - g_message ("test-vfs-trash.vala:30: Number of files in the trash: %u\n", desktop_agnostic_vfs_trash_get_file_count (t)); - g_main_loop_quit (test_trash_mainloop); -} - - -static void _test_trash_on_file_count_changed_desktop_agnostic_vfs_trash_file_count_changed (DesktopAgnosticVFSTrash* _sender, gpointer self) { - test_trash_on_file_count_changed (_sender); -} - - -static gint test_trash_main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - { - DesktopAgnosticVFSTrash* t; - GMainLoop* _tmp0_; - desktop_agnostic_vfs_init (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - t = desktop_agnostic_vfs_trash_get_default (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - g_signal_connect (t, "file-count-changed", (GCallback) _test_trash_on_file_count_changed_desktop_agnostic_vfs_trash_file_count_changed, NULL); - test_trash_mainloop = (_tmp0_ = g_main_loop_new (NULL, TRUE), _g_main_loop_unref0 (test_trash_mainloop), _tmp0_); - g_main_loop_run (test_trash_mainloop); - desktop_agnostic_vfs_shutdown (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-vfs-trash.vala:46: Error: %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return test_trash_main (argv, argc); -} - - -TestTrash* test_trash_construct (GType object_type) { - TestTrash* self; - self = (TestTrash*) g_type_create_instance (object_type); - return self; -} - - -TestTrash* test_trash_new (void) { - return test_trash_construct (TYPE_TEST_TRASH); -} - - -static void value_test_trash_init (GValue* value) { - value->data[0].v_pointer = NULL; -} - - -static void value_test_trash_free_value (GValue* value) { - if (value->data[0].v_pointer) { - test_trash_unref (value->data[0].v_pointer); - } -} - - -static void value_test_trash_copy_value (const GValue* src_value, GValue* dest_value) { - if (src_value->data[0].v_pointer) { - dest_value->data[0].v_pointer = test_trash_ref (src_value->data[0].v_pointer); - } else { - dest_value->data[0].v_pointer = NULL; - } -} - - -static gpointer value_test_trash_peek_pointer (const GValue* value) { - return value->data[0].v_pointer; -} - - -static gchar* value_test_trash_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - if (collect_values[0].v_pointer) { - TestTrash* object; - object = collect_values[0].v_pointer; - if (object->parent_instance.g_class == NULL) { - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } - value->data[0].v_pointer = test_trash_ref (object); - } else { - value->data[0].v_pointer = NULL; - } - return NULL; -} - - -static gchar* value_test_trash_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - TestTrash** object_p; - object_p = collect_values[0].v_pointer; - if (!object_p) { - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); - } - if (!value->data[0].v_pointer) { - *object_p = NULL; - } else if (collect_flags && G_VALUE_NOCOPY_CONTENTS) { - *object_p = value->data[0].v_pointer; - } else { - *object_p = test_trash_ref (value->data[0].v_pointer); - } - return NULL; -} - - -GParamSpec* param_spec_test_trash (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { - ParamSpecTestTrash* spec; - g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_TRASH), NULL); - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); - G_PARAM_SPEC (spec)->value_type = object_type; - return G_PARAM_SPEC (spec); -} - - -gpointer value_get_test_trash (const GValue* value) { - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_TRASH), NULL); - return value->data[0].v_pointer; -} - - -void value_set_test_trash (GValue* value, gpointer v_object) { - TestTrash* old; - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_TRASH)); - old = value->data[0].v_pointer; - if (v_object) { - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_TRASH)); - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); - value->data[0].v_pointer = v_object; - test_trash_ref (value->data[0].v_pointer); - } else { - value->data[0].v_pointer = NULL; - } - if (old) { - test_trash_unref (old); - } -} - - -static void test_trash_class_init (TestTrashClass * klass) { - test_trash_parent_class = g_type_class_peek_parent (klass); - TEST_TRASH_CLASS (klass)->finalize = test_trash_finalize; -} - - -static void test_trash_instance_init (TestTrash * self) { - self->ref_count = 1; -} - - -static void test_trash_finalize (TestTrash* obj) { - TestTrash * self; - self = TEST_TRASH (obj); -} - - -GType test_trash_get_type (void) { - static GType test_trash_type_id = 0; - if (test_trash_type_id == 0) { - static const GTypeValueTable g_define_type_value_table = { value_test_trash_init, value_test_trash_free_value, value_test_trash_copy_value, value_test_trash_peek_pointer, "p", value_test_trash_collect_value, "p", value_test_trash_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (TestTrashClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_trash_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestTrash), 0, (GInstanceInitFunc) test_trash_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - test_trash_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestTrash", &g_define_type_info, &g_define_type_fundamental_info, 0); - } - return test_trash_type_id; -} - - -gpointer test_trash_ref (gpointer instance) { - TestTrash* self; - self = instance; - g_atomic_int_inc (&self->ref_count); - return instance; -} - - -void test_trash_unref (gpointer instance) { - TestTrash* self; - self = instance; - if (g_atomic_int_dec_and_test (&self->ref_count)) { - TEST_TRASH_GET_CLASS (self)->finalize (self); - g_type_free_instance ((GTypeInstance *) self); - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-volume.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-volume.c --- libdesktop-agnostic-0.3.90/gen_src/tests/test-vfs-volume.c 2010-04-11 07:32:20.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tests/test-vfs-volume.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,327 +0,0 @@ -/* test-vfs-volume.c generated by valac, the Vala compiler - * generated from test-vfs-volume.vala, do not modify */ - -/* - * Test program for the Volume VFS backends. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include - - -#define TYPE_TEST_VOLUME (test_volume_get_type ()) -#define TEST_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_VOLUME, TestVolume)) -#define TEST_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_VOLUME, TestVolumeClass)) -#define IS_TEST_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_VOLUME)) -#define IS_TEST_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_VOLUME)) -#define TEST_VOLUME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_VOLUME, TestVolumeClass)) - -typedef struct _TestVolume TestVolume; -typedef struct _TestVolumeClass TestVolumeClass; -typedef struct _TestVolumePrivate TestVolumePrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define __g_list_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_unref (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -typedef struct _ParamSpecTestVolume ParamSpecTestVolume; - -struct _TestVolume { - GTypeInstance parent_instance; - volatile int ref_count; - TestVolumePrivate * priv; -}; - -struct _TestVolumeClass { - GTypeClass parent_class; - void (*finalize) (TestVolume *self); -}; - -struct _ParamSpecTestVolume { - GParamSpec parent_instance; -}; - - -static gpointer test_volume_parent_class = NULL; - -gpointer test_volume_ref (gpointer instance); -void test_volume_unref (gpointer instance); -GParamSpec* param_spec_test_volume (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); -void value_set_test_volume (GValue* value, gpointer v_object); -gpointer value_get_test_volume (const GValue* value); -GType test_volume_get_type (void); -enum { - TEST_VOLUME_DUMMY_PROPERTY -}; -static void _g_list_free_g_object_unref (GList* self); -static gint test_volume_main (char** args, int args_length1); -TestVolume* test_volume_new (void); -TestVolume* test_volume_construct (GType object_type); -static void test_volume_finalize (TestVolume* obj); - - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static char* bool_to_string (gboolean self) { - char* result; - if (self) { - result = g_strdup ("true"); - return result; - } else { - result = g_strdup ("false"); - return result; - } -} - - -static void _g_list_free_g_object_unref (GList* self) { - g_list_foreach (self, (GFunc) g_object_unref, NULL); - g_list_free (self); -} - - -static gint test_volume_main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - _inner_error_ = NULL; - { - DesktopAgnosticVFSVolumeMonitor* vm; - desktop_agnostic_vfs_init (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - vm = _g_object_ref0 (desktop_agnostic_vfs_volume_monitor_get_default (&_inner_error_)); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - { - GList* vol_collection; - GList* vol_it; - vol_collection = desktop_agnostic_vfs_volume_monitor_get_volumes (vm); - for (vol_it = vol_collection; vol_it != NULL; vol_it = vol_it->next) { - DesktopAgnosticVFSVolume* vol; - vol = (DesktopAgnosticVFSVolume*) vol_it->data; - { - char* _tmp1_; - char* _tmp0_; - g_message ("test-vfs-volume.vala:36: Volume[%s] (Mounted=%s): %s", desktop_agnostic_vfs_volume_get_name (vol), _tmp0_ = bool_to_string (desktop_agnostic_vfs_volume_is_mounted (vol)), _tmp1_ = desktop_agnostic_vfs_file_get_uri (desktop_agnostic_vfs_volume_get_uri (vol))); - _g_free0 (_tmp1_); - _g_free0 (_tmp0_); - } - } - __g_list_free_g_object_unref0 (vol_collection); - } - desktop_agnostic_vfs_shutdown (&_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (vm); - goto __catch0_g_error; - } - _g_object_unref0 (vm); - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("test-vfs-volume.vala:43: Error: %s", err->message); - _g_error_free0 (err); - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return test_volume_main (argv, argc); -} - - -TestVolume* test_volume_construct (GType object_type) { - TestVolume* self; - self = (TestVolume*) g_type_create_instance (object_type); - return self; -} - - -TestVolume* test_volume_new (void) { - return test_volume_construct (TYPE_TEST_VOLUME); -} - - -static void value_test_volume_init (GValue* value) { - value->data[0].v_pointer = NULL; -} - - -static void value_test_volume_free_value (GValue* value) { - if (value->data[0].v_pointer) { - test_volume_unref (value->data[0].v_pointer); - } -} - - -static void value_test_volume_copy_value (const GValue* src_value, GValue* dest_value) { - if (src_value->data[0].v_pointer) { - dest_value->data[0].v_pointer = test_volume_ref (src_value->data[0].v_pointer); - } else { - dest_value->data[0].v_pointer = NULL; - } -} - - -static gpointer value_test_volume_peek_pointer (const GValue* value) { - return value->data[0].v_pointer; -} - - -static gchar* value_test_volume_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - if (collect_values[0].v_pointer) { - TestVolume* object; - object = collect_values[0].v_pointer; - if (object->parent_instance.g_class == NULL) { - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } - value->data[0].v_pointer = test_volume_ref (object); - } else { - value->data[0].v_pointer = NULL; - } - return NULL; -} - - -static gchar* value_test_volume_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - TestVolume** object_p; - object_p = collect_values[0].v_pointer; - if (!object_p) { - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); - } - if (!value->data[0].v_pointer) { - *object_p = NULL; - } else if (collect_flags && G_VALUE_NOCOPY_CONTENTS) { - *object_p = value->data[0].v_pointer; - } else { - *object_p = test_volume_ref (value->data[0].v_pointer); - } - return NULL; -} - - -GParamSpec* param_spec_test_volume (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { - ParamSpecTestVolume* spec; - g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_VOLUME), NULL); - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); - G_PARAM_SPEC (spec)->value_type = object_type; - return G_PARAM_SPEC (spec); -} - - -gpointer value_get_test_volume (const GValue* value) { - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_VOLUME), NULL); - return value->data[0].v_pointer; -} - - -void value_set_test_volume (GValue* value, gpointer v_object) { - TestVolume* old; - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_VOLUME)); - old = value->data[0].v_pointer; - if (v_object) { - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_VOLUME)); - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); - value->data[0].v_pointer = v_object; - test_volume_ref (value->data[0].v_pointer); - } else { - value->data[0].v_pointer = NULL; - } - if (old) { - test_volume_unref (old); - } -} - - -static void test_volume_class_init (TestVolumeClass * klass) { - test_volume_parent_class = g_type_class_peek_parent (klass); - TEST_VOLUME_CLASS (klass)->finalize = test_volume_finalize; -} - - -static void test_volume_instance_init (TestVolume * self) { - self->ref_count = 1; -} - - -static void test_volume_finalize (TestVolume* obj) { - TestVolume * self; - self = TEST_VOLUME (obj); -} - - -GType test_volume_get_type (void) { - static GType test_volume_type_id = 0; - if (test_volume_type_id == 0) { - static const GTypeValueTable g_define_type_value_table = { value_test_volume_init, value_test_volume_free_value, value_test_volume_copy_value, value_test_volume_peek_pointer, "p", value_test_volume_collect_value, "p", value_test_volume_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (TestVolumeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_volume_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestVolume), 0, (GInstanceInitFunc) test_volume_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - test_volume_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestVolume", &g_define_type_info, &g_define_type_fundamental_info, 0); - } - return test_volume_type_id; -} - - -gpointer test_volume_ref (gpointer instance) { - TestVolume* self; - self = instance; - g_atomic_int_inc (&self->ref_count); - return instance; -} - - -void test_volume_unref (gpointer instance) { - TestVolume* self; - self = instance; - if (g_atomic_int_dec_and_test (&self->ref_count)) { - TEST_VOLUME_GET_CLASS (self)->finalize (self); - g_type_free_instance ((GTypeInstance *) self); - } -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tools/lda-desktop-entry-editor.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tools/lda-desktop-entry-editor.c --- libdesktop-agnostic-0.3.90/gen_src/tools/lda-desktop-entry-editor.c 2010-04-11 07:32:42.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tools/lda-desktop-entry-editor.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -/* lda-desktop-entry-editor.c generated by valac, the Vala compiler - * generated from lda-desktop-entry-editor.vala, do not modify */ - -/* - * Desktop Agnostic Library: Desktop entry editor. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include - -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -gint _main (char** args, int args_length1); - -static const GOptionEntry entries[] = {}; - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - DesktopAgnosticVFSFile* file; - DesktopAgnosticVFSFile* output; - DesktopAgnosticUILauncherEditorDialog* editor; - _inner_error_ = NULL; - file = NULL; - output = NULL; - editor = NULL; - if (args_length1 < 2) { - g_critical ("lda-desktop-entry-editor.vala:39: Usage: %s FILE [OUTPUT FILE]", args[0]); - result = 1; - _g_object_unref0 (file); - _g_object_unref0 (output); - _g_object_unref0 (editor); - return result; - } - { - DesktopAgnosticVFSFile* _tmp0_; - DesktopAgnosticVFSFile* _tmp1_; - DesktopAgnosticUILauncherEditorDialog* _tmp4_; - desktop_agnostic_vfs_init (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - gtk_init (&args_length1, &args); - _tmp0_ = desktop_agnostic_vfs_file_new_for_path (args[1], &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - file = (_tmp1_ = _tmp0_, _g_object_unref0 (file), _tmp1_); - if (args_length1 > 2) { - DesktopAgnosticVFSFile* _tmp2_; - DesktopAgnosticVFSFile* _tmp3_; - _tmp2_ = desktop_agnostic_vfs_file_new_for_path (args[2], &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - output = (_tmp3_ = _tmp2_, _g_object_unref0 (output), _tmp3_); - } - editor = (_tmp4_ = g_object_ref_sink (desktop_agnostic_ui_launcher_editor_dialog_new (file, output, TRUE)), _g_object_unref0 (editor), _tmp4_); - gtk_widget_show_all ((GtkWidget*) editor); - gtk_main (); - desktop_agnostic_vfs_shutdown (&_inner_error_); - if (_inner_error_ != NULL) { - goto __catch0_g_error; - } - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - g_critical ("lda-desktop-entry-editor.vala:62: Error: %s", err->message); - result = 1; - _g_error_free0 (err); - _g_object_unref0 (file); - _g_object_unref0 (output); - _g_object_unref0 (editor); - return result; - } - } - __finally0: - if (_inner_error_ != NULL) { - _g_object_unref0 (file); - _g_object_unref0 (output); - _g_object_unref0 (editor); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - _g_object_unref0 (file); - _g_object_unref0 (output); - _g_object_unref0 (editor); - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/gen_src/tools/lda-schema-to-gconf.c libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tools/lda-schema-to-gconf.c --- libdesktop-agnostic-0.3.90/gen_src/tools/lda-schema-to-gconf.c 2010-04-11 07:32:33.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/gen_src/tools/lda-schema-to-gconf.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,373 +0,0 @@ -/* lda-schema-to-gconf.c generated by valac, the Vala compiler - * generated from lda-schema-to-gconf.vala, do not modify */ - -/* - * Desktop Agnostic Library: Desktop Agnostic to GConf schema converter. - * - * Copyright (C) 2009 Mark Lee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author : Mark Lee - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - - - -char* schema_type_to_string (GType type); -void value_array_to_string (GValue* src_value, GValue* dest_value); -static void _value_array_to_string_gvalue_transform (GValue* src_value, GValue* dest_value); -gint _main (char** args, int args_length1); -static int _vala_strcmp0 (const char * str1, const char * str2); - - - -char* schema_type_to_string (GType type) { - char* result; - if (type == G_TYPE_BOOLEAN) { - result = g_strdup ("bool"); - return result; - } else { - if (type == G_TYPE_INT) { - result = g_strdup ("int"); - return result; - } else { - if (type == G_TYPE_FLOAT) { - result = g_strdup ("float"); - return result; - } else { - if (type == G_TYPE_STRING) { - result = g_strdup ("string"); - return result; - } else { - if (type == G_TYPE_VALUE_ARRAY) { - result = g_strdup ("list"); - return result; - } else { - result = g_strdup ("string"); - return result; - } - } - } - } - } -} - - -void value_array_to_string (GValue* src_value, GValue* dest_value) { - GValueArray* arr; - GString* res; - GValue _tmp3_; - GValue _tmp2_ = {0}; - arr = g_value_get_boxed (src_value); - res = g_string_new ("["); - { - guint i; - i = (guint) 0; - { - gboolean _tmp0_; - _tmp0_ = TRUE; - while (TRUE) { - GValue val; - GValue _tmp1_ = {0}; - GValue val_str; - if (!_tmp0_) { - i++; - } - _tmp0_ = FALSE; - if (!(i < arr->n_values)) { - break; - } - val = *g_value_array_get_nth (arr, i); - g_assert (g_value_type_transformable (G_VALUE_TYPE (&val), G_TYPE_STRING)); - val_str = (g_value_init (&_tmp1_, G_TYPE_STRING), _tmp1_); - g_value_transform (&val, &val_str); - if (i != 0) { - g_string_append (res, ","); - } - g_string_append (res, g_value_get_string (&val_str)); - G_IS_VALUE (&val_str) ? (g_value_unset (&val_str), NULL) : NULL; - } - } - } - g_string_append (res, "]"); - *dest_value = (_tmp3_ = (g_value_init (&_tmp2_, G_TYPE_STRING), g_value_set_string (&_tmp2_, res->str), _tmp2_), G_IS_VALUE (dest_value) ? (g_value_unset (dest_value), NULL) : NULL, _tmp3_); - _g_string_free0 (res); -} - - -static void _value_array_to_string_gvalue_transform (GValue* src_value, GValue* dest_value) { - value_array_to_string (src_value, dest_value); -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -gint _main (char** args, int args_length1) { - gint result; - GError * _inner_error_; - const char* current_group; - const char* current_key; - _inner_error_ = NULL; - current_group = NULL; - current_key = NULL; - if (args_length1 < 2) { - result = 1; - return result; - } - g_value_register_transform_func (G_TYPE_VALUE_ARRAY, G_TYPE_STRING, _value_array_to_string_gvalue_transform); - { - GType ct = 0UL; - DesktopAgnosticConfigSchema* schema; - GString* gconf; - DesktopAgnosticConfigSchema* _tmp0_; - DesktopAgnosticConfigSchema* _tmp1_; - GString* _tmp2_; - schema = NULL; - gconf = NULL; - ct = desktop_agnostic_module_loader_load (desktop_agnostic_module_loader_get_default (), "libda-cfg-gconf"); - if (ct == G_TYPE_INVALID) { - g_critical ("lda-schema-to-gconf.vala:98: The GConf configuration module needs to be installed for %s to function correctly.", args[0]); - result = 1; - _g_object_unref0 (schema); - _g_string_free0 (gconf); - return result; - } - if (!g_file_test (args[1], G_FILE_TEST_IS_REGULAR)) { - g_critical ("lda-schema-to-gconf.vala:105: The schema file '%s' does not seem to exist.", args[1]); - result = 1; - _g_object_unref0 (schema); - _g_string_free0 (gconf); - return result; - } - _tmp0_ = desktop_agnostic_config_schema_new (args[1], &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_string_free0 (gconf); - goto __catch0_g_error; - } - schema = (_tmp1_ = _tmp0_, _g_object_unref0 (schema), _tmp1_); - gconf = (_tmp2_ = g_string_new ("\n"), _g_string_free0 (gconf), _tmp2_); - g_string_append (gconf, "\n \n"); - { - GList* group_collection; - GList* group_it; - group_collection = desktop_agnostic_config_schema_get_groups (schema); - for (group_it = group_collection; group_it != NULL; group_it = group_it->next) { - const char* group; - group = (const char*) group_it->data; - { - char* base_path; - char* app_name; - char* path_prefix; - GValue* _tmp3_; - char* _tmp5_; - GValue* _tmp4_; - char* _tmp6_; - base_path = NULL; - app_name = NULL; - path_prefix = NULL; - current_group = group; - _tmp3_ = desktop_agnostic_config_schema_get_metadata_option (schema, "GConf.base_path", &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (base_path); - _g_free0 (app_name); - _g_free0 (path_prefix); - _g_list_free0 (group_collection); - _g_object_unref0 (schema); - _g_string_free0 (gconf); - goto __catch0_g_error; - } - base_path = (_tmp5_ = g_strdup (g_value_get_string (_tmp4_ = _tmp3_)), _g_free0 (base_path), _tmp5_); - _g_free0 (_tmp4_); - app_name = (_tmp6_ = g_strdup (desktop_agnostic_config_schema_get_app_name (schema)), _g_free0 (app_name), _tmp6_); - if (_vala_strcmp0 (group, DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT) == 0) { - char* _tmp7_; - path_prefix = (_tmp7_ = g_strdup_printf ("%s/%s", base_path, app_name), _g_free0 (path_prefix), _tmp7_); - } else { - char* _tmp8_; - path_prefix = (_tmp8_ = g_strdup_printf ("%s/%s/%s", base_path, app_name, group), _g_free0 (path_prefix), _tmp8_); - } - { - GList* key_collection; - GList* key_it; - key_collection = desktop_agnostic_config_schema_get_keys (schema, group); - for (key_it = key_collection; key_it != NULL; key_it = key_it->next) { - const char* key; - key = (const char*) key_it->data; - { - DesktopAgnosticConfigSchemaOption* option; - GType type; - GValue _tmp9_ = {0}; - GValue default_value; - char* summary; - char* _tmp10_; - char* _tmp11_; - char* _tmp12_; - char* _tmp14_; - char* _tmp13_; - GValue _tmp18_; - GValue _tmp17_ = {0}; - char* _tmp21_; - char* _tmp22_; - gboolean _tmp23_ = FALSE; - char* _tmp25_; - option = _g_object_ref0 (desktop_agnostic_config_schema_get_option (schema, group, key)); - type = desktop_agnostic_config_schema_option_get_option_type (option); - default_value = (g_value_init (&_tmp9_, G_TYPE_STRING), _tmp9_); - summary = NULL; - current_key = key; - g_string_append (gconf, " \n"); - g_string_append (gconf, _tmp10_ = g_markup_printf_escaped (" /schemas%s/%s\n", path_prefix, key)); - _g_free0 (_tmp10_); - g_string_append (gconf, _tmp11_ = g_markup_printf_escaped (" %s/%s\n", path_prefix, key)); - _g_free0 (_tmp11_); - g_string_append (gconf, _tmp12_ = g_markup_printf_escaped (" %s\n", app_name)); - _g_free0 (_tmp12_); - g_string_append (gconf, _tmp14_ = g_markup_printf_escaped (" %s\n", _tmp13_ = schema_type_to_string (type))); - _g_free0 (_tmp14_); - _g_free0 (_tmp13_); - if (type == G_TYPE_VALUE_ARRAY) { - GType list_type; - char* _tmp16_; - char* _tmp15_; - list_type = desktop_agnostic_config_schema_option_get_list_type (option); - g_string_append (gconf, _tmp16_ = g_markup_printf_escaped (" %s\n", _tmp15_ = schema_type_to_string (list_type))); - _g_free0 (_tmp16_); - _g_free0 (_tmp15_); - } - g_value_transform ((_tmp18_ = (desktop_agnostic_config_schema_option_get_default_value (option, &_tmp17_), _tmp17_), &_tmp18_), &default_value); - if (NULL == g_value_get_string (&default_value)) { - GValue _tmp20_; - GValue _tmp19_ = {0}; - default_value = (_tmp20_ = (g_value_init (&_tmp19_, G_TYPE_STRING), g_value_set_string (&_tmp19_, ""), _tmp19_), G_IS_VALUE (&default_value) ? (g_value_unset (&default_value), NULL) : NULL, _tmp20_); - } - g_string_append (gconf, _tmp21_ = g_markup_printf_escaped (" %s\n", g_value_get_string (&default_value))); - _g_free0 (_tmp21_); - g_string_append (gconf, " \n"); - summary = (_tmp22_ = g_strdup (desktop_agnostic_config_schema_option_get_summary (option)), _g_free0 (summary), _tmp22_); - if (summary != NULL) { - _tmp23_ = _vala_strcmp0 (summary, "") != 0; - } else { - _tmp23_ = FALSE; - } - if (_tmp23_) { - char* _tmp24_; - g_string_append (gconf, _tmp24_ = g_markup_printf_escaped (" %s\n", summary)); - _g_free0 (_tmp24_); - } - g_string_append (gconf, _tmp25_ = g_markup_printf_escaped (" %s\n", desktop_agnostic_config_schema_option_get_description (option))); - _g_free0 (_tmp25_); - g_string_append (gconf, " \n"); - g_string_append (gconf, " \n"); - _g_object_unref0 (option); - G_IS_VALUE (&default_value) ? (g_value_unset (&default_value), NULL) : NULL; - _g_free0 (summary); - } - } - } - _g_free0 (base_path); - _g_free0 (app_name); - _g_free0 (path_prefix); - } - } - _g_list_free0 (group_collection); - } - g_string_append (gconf, " \n\n"); - if (args_length1 < 3) { - fprintf (stdout, "%s", gconf->str); - } else { - g_file_set_contents (args[2], gconf->str, gconf->len, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (schema); - _g_string_free0 (gconf); - goto __catch0_g_error; - } - } - _g_object_unref0 (schema); - _g_string_free0 (gconf); - } - goto __finally0; - __catch0_g_error: - { - GError * err; - err = _inner_error_; - _inner_error_ = NULL; - { - gboolean _tmp26_ = FALSE; - if (current_group == NULL) { - _tmp26_ = TRUE; - } else { - _tmp26_ = current_key == NULL; - } - if (_tmp26_) { - g_critical ("lda-schema-to-gconf.vala:194: Error: %s", err->message); - } else { - g_critical ("lda-schema-to-gconf.vala:198: Error (%s/%s): %s", current_group, current_key, err->message); - } - result = 1; - _g_error_free0 (err); - return result; - } - } - __finally0: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return 0; - } - result = 0; - return result; -} - - -int main (int argc, char ** argv) { - g_type_init (); - return _main (argv, argc); -} - - -static int _vala_strcmp0 (const char * str1, const char * str2) { - if (str1 == NULL) { - return -(str1 != str2); - } - if (str2 == NULL) { - return str1 != str2; - } - return strcmp (str1, str2); -} - - - - diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-bridge.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-bridge.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-bridge.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-bridge.vala 2010-10-13 21:05:39.000000000 +0000 @@ -202,14 +202,13 @@ string key, ParamSpec spec, NotifyFuncHandler func) throws GLib.Error { - unowned BindingNotifier notifier; - notifier = (BindingNotifier*) config.get_data ("lda-binding-notifier"); + unowned BindingNotifier? notifier; + notifier = config.get_data ("lda-binding-notifier"); if (notifier == null) { BindingNotifier new_notifier = new BindingNotifier (config); notifier = new_notifier; - config.set_data_full ("lda-binding-notifier", notifier.@ref (), - Object.unref); + config.set_data ("lda-binding-notifier", notifier); } if (spec.value_type == typeof (bool) || @@ -353,8 +352,7 @@ uint pos = -1; string binding_key; - unowned BindingListWrapper? obj_bindings = - (BindingListWrapper*) obj.get_data ("lda-bindings"); + unowned BindingListWrapper? obj_bindings = obj.get_data ("lda-bindings"); binding_key = "%s/%s/%s".printf (config.instance_id, group, key); bindings_list = this.bindings.get_data (binding_key); bindings_to_remove = new SList (); diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-client.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-client.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-client.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-client.vala 2010-10-13 21:05:39.000000000 +0000 @@ -101,13 +101,12 @@ // constructors public Client (string schema_filename) { - this.schema_filename = schema_filename; + GLib.Object (schema_filename: schema_filename); } public Client.for_instance (string schema_filename, string instance_id) throws GLib.Error { - this.schema_filename = schema_filename; - this.instance_id = instance_id; + GLib.Object (schema_filename: schema_filename, instance_id: instance_id); } /** * Auto-determines whether an instance config object should be created. diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-gconf.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-gconf.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-gconf.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-gconf.vala 2010-10-13 21:05:39.000000000 +0000 @@ -654,7 +654,6 @@ } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-keyfile.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-keyfile.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-keyfile.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-keyfile.vala 2010-10-13 21:05:39.000000000 +0000 @@ -697,6 +697,10 @@ if (value.n_values == 0) { + if (!this._data.has_group (group)) + { + return; + } if (this._data.has_key (group, key)) { // set_*_list() doesn't like NULL lists, so just unset the key. @@ -764,7 +768,6 @@ } } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-memory.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-memory.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-memory.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-memory.vala 2010-10-13 21:05:39.000000000 +0000 @@ -226,7 +226,6 @@ } } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-null.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-null.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-impl-null.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-impl-null.vala 2010-10-13 21:05:39.000000000 +0000 @@ -121,7 +121,6 @@ } } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-schema.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-schema.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-schema.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-schema.vala 2010-10-13 21:05:39.000000000 +0000 @@ -188,7 +188,8 @@ */ public Schema (string filename) throws GLib.Error { - this.filename = filename; + GLib.Object (filename: filename); + unowned HashTable backend_metadata_keys; this.options = Datalist (); this.keys = new HashTable> (str_hash, str_equal); diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-type-color.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-type-color.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/config-type-color.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/config-type-color.vala 2010-10-13 21:05:39.000000000 +0000 @@ -120,7 +120,6 @@ dest_value = ct.deserialize ((string)src_value); } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/desktop-entry-impl-gio.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/desktop-entry-impl-gio.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/desktop-entry-impl-gio.vala 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/desktop-entry-impl-gio.vala 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1,394 @@ +/* + * Desktop Agnostic Library: Desktop Entry implementation using GLib. + * + * Copyright (C) 2010 Michal Hruby + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author : Michal Hruby + */ + +using DesktopAgnostic; + +namespace DesktopAgnostic.FDO +{ + private const string GROUP = "Desktop Entry"; + public class DesktopEntryGio : DesktopEntry, Object + { + private KeyFile _keyfile = new KeyFile (); + private bool loaded = false; + private VFS.File _file = null; + + public VFS.File? file + { + get + { + return this._file; + } + set construct + { + if (value != null) + { + if (this.loaded) + { + warning ("The desktop entry has already been initialized."); + } + else if (value.exists ()) + { + string? path; + + this._file = value; + path = value.path; + if (path == null) + { + string data; + size_t data_len; + + this._file.load_contents (out data, out data_len); + this._keyfile.load_from_data (data, data_len, + KeyFileFlags.KEEP_TRANSLATIONS); + } + else + { + this._keyfile.load_from_file (path, KeyFileFlags.KEEP_TRANSLATIONS); + } + this.loaded = true; + } + } + } + } + + public KeyFile keyfile + { + get + { + return this._keyfile; + } + set construct + { + if (value != null) + { + if (this.loaded) + { + warning ("The desktop entry has already been initialized."); + } + else + { + string data; + size_t length; + + data = value.to_data (out length); + this._keyfile.load_from_data (data, length, + KeyFileFlags.KEEP_TRANSLATIONS); + this.loaded = true; + } + } + } + } + + public string data + { + set construct + { + if (value != null && value != "") + { + if (this.loaded) + { + warning ("The desktop entry has already been initialized."); + } + else + { + this._keyfile.load_from_data (value, value.size (), + KeyFileFlags.KEEP_TRANSLATIONS); + this.loaded = true; + } + } + } + } + + public DesktopEntryType entry_type + { + get + { + string type = this.get_string ("Type"); + switch (type) + { + case "Application": + return DesktopEntryType.APPLICATION; + case "Link": + return DesktopEntryType.LINK; + case "Directory": + return DesktopEntryType.DIRECTORY; + default: + return DesktopEntryType.UNKNOWN; + } + } + set + { + this.set_string ("Type", desktop_entry_type_to_string (value)); + } + } + + public string name + { + owned get + { + return this.get_string ("Name"); + } + set + { + this.set_string ("Name", value); + } + } + + public string? icon + { + /** + * If a path is provided then return the given value. Otherwise, + * strip any extension (.xpm, .svg, .png). + */ + owned get + { + string? icon_name = this.get_string ("Icon"); + + if (icon_name != null && Path.get_basename (icon_name) == icon_name) + { + icon_name = icon_name.split (".png", 2)[0]; + icon_name = icon_name.split (".svg", 2)[0]; + icon_name = icon_name.split (".xpm", 2)[0]; + } + + return icon_name; + } + set + { + if (value == null) + { + warning ("Cannot set a NULL value for 'Icon'."); + } + else + { + this.set_string ("Icon", value); + } + } + } + + public bool + key_exists (string key) + { + return this._keyfile.has_group (GROUP) && + this._keyfile.has_key (GROUP, key); + } + + public bool + get_boolean (string key) + { + try + { + return this._keyfile.get_boolean (GROUP, key); + } + catch (KeyFileError err) + { + warning ("Error trying to retrieve '%s': %s", key, err.message); + return false; + } + } + + public void + set_boolean (string key, bool value) + { + this._keyfile.set_boolean (GROUP, key, value); + } + + public string? + get_string (string key) + { + try + { + return this._keyfile.get_string (GROUP, key); + } + catch (KeyFileError err) + { + warning ("Error trying to retrieve '%s': %s", key, err.message); + return null; + } + } + + public void + set_string (string key, string value) + { + this._keyfile.set_string (GROUP, key, value); + } + + public string? + get_localestring (string key, string? locale) + { + try + { + return this._keyfile.get_locale_string (GROUP, key, locale); + } + catch (KeyFileError err) + { + warning ("Error trying to retrieve '%s[%s]': %s", key, locale, + err.message); + return null; + } + } + + public void + set_localestring (string key, string locale, string value) + { + this._keyfile.set_locale_string (GROUP, key, locale, value); + } + + [CCode (array_length = false, array_null_terminated = true)] + public string[]? + get_string_list (string key) + { + try + { + return this._keyfile.get_string_list (GROUP, key); + } + catch (KeyFileError err) + { + warning ("Error trying to retrieve '%s': %s", key, err.message); + return null; + } + } + + public void + set_string_list (string key, [CCode (array_length = false, array_null_terminated = true)] string[] value) + { + this._keyfile.set_string_list (GROUP, key, value); + } + + /** + * Based on EggDesktopFile's egg_desktop_file_can_launch(). + */ + public bool + exists () + { + switch (this.entry_type) + { + case DesktopEntryType.APPLICATION: + if (this._keyfile.has_key (GROUP, "TryExec")) + { + if (Environment.find_program_in_path (this.get_string ("TryExec")) != null) + { + return true; + } + } + string? exec; + string[] argv = null;; + exec = this.get_string ("Exec"); + if (exec == null || !Shell.parse_argv (exec, out argv)) + { + return false; + } + return Environment.find_program_in_path (argv[0]) != null; + case DesktopEntryType.LINK: + if (this._keyfile.has_key (GROUP, "URL")) + { + string uri = this._keyfile.get_string (GROUP, "URL"); + VFS.File file = VFS.file_new_for_uri (uri); + return file.exists (); + } + else + { + return false; + } + default: + return false; + } + } + + /** + * Launch desktop entry. + * @return always zero. + */ + public Pid + launch (DesktopEntryLaunchFlags flags, + SList? documents) throws GLib.Error + { + List uris = new List (); + foreach (unowned string s in documents) + { + uris.append (s); + } + + // interesting that GIO 2.26 supports only APPLICATION + switch (this.entry_type) + { + case DesktopEntryType.APPLICATION: + AppInfo info; + if (this._file != null) + { + info = new DesktopAppInfo.from_filename (this._file.path); + } + else + { + info = new DesktopAppInfo.from_keyfile (this._keyfile); + } + + //var context = new AppLaunchContext (); + info.launch_uris (uris, null); + + break; + case DesktopEntryType.LINK: + if (this._keyfile.has_key (GROUP, "URL")) + { + string uri = this._keyfile.get_string (GROUP, "URL"); + AppInfo.launch_default_for_uri (uri, null); + } + else + { + throw new DesktopEntryError.NOT_LAUNCHABLE ("Invalid desktop entry."); + } + break; + default: + throw new DesktopEntryError.NOT_LAUNCHABLE ("Unknown desktop entry type."); + } + + return (Pid) 0; + } + + public void + save (VFS.File? new_file) throws GLib.Error + { + VFS.File? file = null; + if (new_file != null) + { + file = new_file; + } + else if (this._file != null) + { + file = this._file; + } + else + { + throw new DesktopEntryError.INVALID_FILE ("No filename specified."); + } + file.replace_contents (this._keyfile.to_data ()); + } + } +} + +public Type +register_plugin () +{ + return typeof (DesktopAgnostic.FDO.DesktopEntryGio); +} + +// vim: set ts=2 sts=2 sw=2 et ai cindent : diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/desktop-entry-impl-glib.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/desktop-entry-impl-glib.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/desktop-entry-impl-glib.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/desktop-entry-impl-glib.vala 2010-10-13 21:05:39.000000000 +0000 @@ -531,6 +531,59 @@ throw new DesktopEntryError.NOT_LAUNCHABLE ("Could not parse Exec key."); } + if (this._keyfile.has_key (GROUP, "Terminal") && + this.get_boolean ("Terminal")) + { + string[] term_argv = new string[argv.length + 2]; + + // based on the code for GDesktopAppInfo + string? check = null; + check = Environment.find_program_in_path ("gnome-terminal"); + if (check != null) + { + term_argv[0] = check; + term_argv[1] = "-x"; + } + else + { + if (check == null) + { + check = Environment.find_program_in_path ("nxterm"); + } + if (check == null) + { + check = Environment.find_program_in_path ("color-xterm"); + } + if (check == null) + { + check = Environment.find_program_in_path ("rxvt"); + } + if (check == null) + { + check = Environment.find_program_in_path ("xterm"); + } + if (check == null) + { + check = Environment.find_program_in_path ("dtterm"); + } + if (check == null) + { + check = "xterm"; + warning ("couldn't find a terminal, falling back to xterm"); + } + + term_argv[0] = check; + term_argv[1] = "-e"; + } + + for (int i = 0; i < argv.length; i++) + { + term_argv[i+2] = argv[i]; + } + + argv = (owned) term_argv; + } + Process.spawn_async_with_pipes (working_dir, argv, null, flags, null, out pid); return pid; } @@ -614,7 +667,6 @@ } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/desktop-entry-impl-gnome.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/desktop-entry-impl-gnome.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/desktop-entry-impl-gnome.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/desktop-entry-impl-gnome.vala 2010-10-13 21:05:39.000000000 +0000 @@ -305,7 +305,6 @@ } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/ui-icon-chooser-dialog.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/ui-icon-chooser-dialog.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/ui-icon-chooser-dialog.vala 2010-10-13 21:05:39.000000000 +0000 @@ -35,13 +35,40 @@ FILE } + private class LazyPixbufRenderer : CellRendererPixbuf + { + public bool item_ready { get; set; default = false; } + + public signal void prepare_pixbuf (TreePath path); + + public override void render (Gdk.Window window, + Gtk.Widget widget, + Gdk.Rectangle background_area, + Gdk.Rectangle cell_area, + Gdk.Rectangle expose_area, + Gtk.CellRendererState flags) + { + if (!item_ready) + { + int x, y; + var view = widget as Gtk.IconView; + x = cell_area.x + cell_area.width / 2; + y = cell_area.y + cell_area.height / 2; + var path = view.get_path_at_pos (x, y); + prepare_pixbuf (path); + } + base.render (window, widget, + background_area, cell_area, expose_area, flags); + } + } + public class IconChooserDialog : Dialog { private RadioButton _file; private RadioButton _themed; private FileChooserButton _directory; private ComboBox _themed_context; - private IconView _file_viewer; + private IconView? _file_viewer = null; private IconView? _themed_viewer = null; private unowned IconView _viewer; public string selected_icon { get; private set; default = null; } @@ -53,16 +80,26 @@ PIXBUF, NAME, DATA, + PIXBUF_READY, COUNT } public signal void icon_selected (); + private static Gdk.Pixbuf NO_ICON; + + static construct + { + var flags = IconLookupFlags.FORCE_SIZE | IconLookupFlags.GENERIC_FALLBACK; + NO_ICON = IconTheme.get_default ().load_icon ("gtk-file", 48, flags); + } + construct { this.response.connect (this.on_response); this.title = _ ("Select Icon"); this.icon_name = STOCK_FIND; + this.set_default_size (375, 375); this.create_ui (); } @@ -72,27 +109,17 @@ HBox choices; choices = new HBox (false, 5); - this._file = new RadioButton.with_mnemonic (null, _ ("From File")); - choices.add (this._file); - this._themed = new RadioButton.with_mnemonic_from_widget (this._file, - _ ("From Theme")); - this._themed.active = false; - this._themed.toggled.connect (this.on_icon_type_toggled); + this._themed = new RadioButton.with_mnemonic (null, _ ("From Theme")); choices.add (this._themed); + this._file = new RadioButton.with_mnemonic_from_widget (this._themed, + _ ("From File")); + this._themed.active = true; + this._themed.toggled.connect (this.on_icon_type_toggled); + choices.add (this._file); this.vbox.pack_start (choices, false, false, 5); choices.show_all (); - this._directory = new FileChooserButton (_ ("Select icon folder"), - FileChooserAction.SELECT_FOLDER); - this._directory.current_folder_changed.connect (this.on_folder_changed); - this.vbox.pack_start (this._directory, false, false, 5); - this._directory.show (); - - this.add_icon_viewer (ref this._file_viewer, false); - this._file_viewer.parent.show_all (); - this._viewer = this._file_viewer; - - this.on_folder_changed (this._directory); + this.on_icon_type_toggled (); this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, STOCK_OK, ResponseType.OK); @@ -115,30 +142,64 @@ create_icon_viewer (bool themed) { IconView viewer; - CellRendererPixbuf cell_pixbuf; + LazyPixbufRenderer cell_pixbuf; CellRendererText cell_text; viewer = new IconView.with_model (this.create_model ()); - viewer.item_width = 72; - viewer.columns = 4; - viewer.column_spacing = 5; - viewer.set_size_request (325, 300); - viewer.tooltip_column = Column.DATA; - cell_pixbuf = new CellRendererPixbuf (); + // without this the IconView is not shrinkable after expanding it + viewer.set_size_request (108, -1); + viewer.set_item_width (108); + viewer.set_column_spacing (5); + viewer.set_tooltip_column (Column.DATA); + + cell_pixbuf = new LazyPixbufRenderer (); cell_pixbuf.xalign = 0.5f; cell_pixbuf.yalign = 0.5f; cell_pixbuf.width = 48; + viewer.pack_start (cell_pixbuf, false); viewer.add_attribute (cell_pixbuf, "pixbuf", Column.PIXBUF); + viewer.add_attribute (cell_pixbuf, "item-ready", Column.PIXBUF_READY); + + cell_pixbuf.prepare_pixbuf.connect ((p) => + { + TreeIter iter; + Value val; + var store = this._viewer.model as ListStore; + store.get_iter (out iter, p); + store.get_value (iter, Column.DATA, out val); + + string icon_name = val.get_string (); + IconTheme icon_theme = IconTheme.get_default (); + var info = icon_theme.lookup_icon (icon_name, 48, 0); + string? name = info.get_display_name (); + if (name == null) + { + name = icon_name.replace ("-", " "); + } + try + { + var pixbuf = info.load_icon (); + store.set (iter, Column.NAME, name, Column.PIXBUF, pixbuf, + Column.PIXBUF_READY, true, -1); + } + catch (Error err) + { + warning ("Could not load %s: %s", icon_name, err.message); + store.set (iter, Column.NAME, name, Column.PIXBUF_READY, true, -1); + } + }); + cell_text = new CellRendererText (); cell_text.xalign = 0.5f; - cell_text.yalign = 0; + cell_text.yalign = 0.0f; cell_text.wrap_mode = Pango.WrapMode.WORD; - cell_text.wrap_width = 72; - cell_text.width = 72; - cell_text.ellipsize = Pango.EllipsizeMode.START; + int wrap_width = viewer.item_width - viewer.item_padding * 2; + cell_text.wrap_width = wrap_width; + cell_text.width = wrap_width; + cell_text.ellipsize = Pango.EllipsizeMode.MIDDLE; viewer.pack_start (cell_text, true); - viewer.add_attribute (cell_text, "text", 1); + viewer.add_attribute (cell_text, "text", Column.NAME); viewer.selection_mode = SelectionMode.SINGLE; return viewer; @@ -148,20 +209,24 @@ create_model () { // icon, name, data - return new ListStore (Column.COUNT, typeof (Gdk.Pixbuf), typeof (string), - typeof (string)); + return new ListStore (Column.COUNT, + typeof (Gdk.Pixbuf), + typeof (string), + typeof (string), + typeof (bool)); } private void - on_icon_type_toggled (ToggleButton themed) + on_icon_type_toggled () { if (this._themed.active) { if (this._themed_viewer == null) { unowned IconTheme icon_theme; - unowned List context_list; + List context_list; + // "From Theme" widgets -> context combobox + icon view this._themed_context = new ComboBox.text (); this._themed_context.changed.connect (this.on_icon_context_changed); this.vbox.pack_start (this._themed_context, false, false, 5); @@ -171,21 +236,52 @@ icon_theme = IconTheme.get_default (); context_list = icon_theme.list_contexts (); context_list.sort ((CompareFunc)strcmp); + + int active_index = 0; + int cur_index = 0; foreach (unowned string context in context_list) { this._themed_context.append_text (context); + // try to make "Applications" context active by default + if (context == "Applications") + { + active_index = cur_index; + } + cur_index++; } + this._themed_context.set_active (active_index); + } + + if (this._file_viewer != null) + { + this._file_viewer.parent.hide (); + this._directory.hide (); } - this._file_viewer.parent.hide (); - this._directory.hide (); this._themed_viewer.parent.show (); this._themed_context.show (); this._viewer = this._themed_viewer; } else { - this._themed_viewer.parent.hide (); - this._themed_context.hide (); + if (this._file_viewer == null) + { + // "From File" widgets -> directory chooser + icon view + this._directory = new FileChooserButton (_ ("Select icon folder"), + FileChooserAction.SELECT_FOLDER); + this._directory.current_folder_changed.connect (this.on_folder_changed); + this.vbox.pack_start (this._directory, false, false, 5); + this._directory.show (); + + this.add_icon_viewer (ref this._file_viewer, false); + + this.on_folder_changed (this._directory); + } + + if (this._themed_viewer != null) + { + this._themed_viewer.parent.hide (); + this._themed_context.hide (); + } this._file_viewer.parent.show (); this._directory.show (); this._viewer = this._file_viewer; @@ -225,7 +321,9 @@ pixbuf = new Gdk.Pixbuf.from_file_at_scale (path, 48, -1, true); model.append (out iter); - model.set (iter, Column.PIXBUF, pixbuf, + model.set (iter, + Column.PIXBUF, pixbuf, + Column.PIXBUF_READY, true, Column.NAME, Path.get_basename (path), Column.DATA, path); } @@ -246,7 +344,7 @@ { unowned ListStore model; unowned IconTheme icon_theme; - unowned List icon_list; + List icon_list; model = this._themed_viewer.model as ListStore; model.clear (); @@ -256,29 +354,14 @@ icon_list.sort ((CompareFunc)strcmp); foreach (unowned string icon_name in icon_list) { - try - { - IconInfo info; - Gdk.Pixbuf pixbuf; - string? name; - TreeIter iter; + TreeIter iter; - info = icon_theme.lookup_icon (icon_name, 48, 0); - pixbuf = info.load_icon (); - name = info.get_display_name (); - if (name == null) - { - name = icon_name.replace ("-", " "); - } - model.append (out iter); - model.set (iter, Column.PIXBUF, pixbuf, - Column.NAME, name, - Column.DATA, icon_name); - } - catch (Error err) - { - warning ("Could not load %s: %s", icon_name, err.message); - } + model.append (out iter); + model.set (iter, + Column.PIXBUF, NO_ICON, + Column.PIXBUF_READY, false, + Column.NAME, icon_name, + Column.DATA, icon_name); } } @@ -297,7 +380,7 @@ msg = _ ("Please select an icon."); dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR, - ButtonsType.OK, msg); + ButtonsType.OK, "%s", msg); dialog.title = _ ("Error"); dialog.run (); dialog.destroy (); diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/ui-launcher-editor-dialog.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/ui-launcher-editor-dialog.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/ui-launcher-editor-dialog.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/ui-launcher-editor-dialog.vala 2010-10-13 21:05:39.000000000 +0000 @@ -53,37 +53,38 @@ this.attach (widget, left_attach, right_attach, top_attach, bottom_attach, AttachOptions.FILL, 0, 0, 0); } + + public void + attach_expand (Widget widget, uint left_attach, uint right_attach, + uint top_attach, uint bottom_attach) + { + this.attach (widget, left_attach, right_attach, top_attach, bottom_attach, + AttachOptions.FILL | AttachOptions.EXPAND, 0, 0, 0); + } } public class LauncherEditorDialog : Dialog { + private ComboBox _type_combo; private IconButton _icon; private Entry _name; private Entry _desc; private Entry _exec; + private Expander _advanced; private CheckButton _terminal; private CheckButton _startup_notification; + private unowned Label _command_label; public unowned VFS.File file { get; construct; } public VFS.File? output { get; construct; } - private bool _standalone; + public bool entry_type_sensitive { get; construct set; default = false; } private DesktopEntry _entry; - public LauncherEditorDialog (VFS.File file, VFS.File? output, bool standalone) + public LauncherEditorDialog (VFS.File file, VFS.File? output = null, + bool entry_type_sensitive = true) { - WindowType type; - - if (standalone) - { - type = WindowType.TOPLEVEL; - } - else - { - type = WindowType.POPUP; - } - this.type = type; - this._standalone = standalone; - this.file = file; - this.output = output; + GLib.Object (file: file, output: output, + border_width: 4, + entry_type_sensitive: entry_type_sensitive); } private override void @@ -91,13 +92,6 @@ { this.title = _ ("Desktop Entry Editor"); this.icon_name = "gtk-preferences"; - if (this._standalone) - { - this.delete_event.connect((widget, event) => { - main_quit (); - return true; - }); - } if (this._output == null) { this._output = file; @@ -113,10 +107,10 @@ string icon; Button exec_button; Image exec_image; - Label name_label, desc_label, exec_label; + Label type_label, name_label, desc_label, exec_label; HBox exec_hbox; - Expander advanced; VBox advanced_vbox; + bool is_application = true; // Action bar this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, @@ -125,12 +119,12 @@ this.response.connect (this.on_response); // Form container - table = new FixedTable (4, 3); + table = new FixedTable (3, 5); // FIXME Table.row_spacing needs [NoAccessorMethod] in the VAPI, in // Vala 0.7.6 //table.row_spacing = 5; table.set_row_spacings (5); - table.column_spacing = 5; + table.column_spacing = 6; // Icon if (this._entry.key_exists ("Icon")) @@ -143,11 +137,48 @@ } this._icon = new IconButton (icon); this._icon.icon_selected.connect (this.on_icon_changed); - table.attach_defaults (this._icon, 0, 1, 0, 3); + table.attach_defaults (this._icon, 0, 1, 0, 4); + + // Entry Type + if (this._entry.key_exists ("Type")) + { + is_application = this._entry.entry_type == DesktopEntryType.APPLICATION; + } + else + { + // if type is unset, use application + this._entry.entry_type = DesktopEntryType.APPLICATION; + } + type_label = new Label.with_mnemonic (_ ("T_ype:")); + type_label.xalign = 1.0f; + table.attach_defaults (type_label, 1, 2, 0, 1); + this._type_combo = new ComboBox.text (); + this._type_combo.append_text (_ ("Application")); + this._type_combo.append_text (_ ("Location")); + type_label.set_mnemonic_widget (this._type_combo); + + int active_index = -1; + switch (this._entry.entry_type) + { + case DesktopEntryType.APPLICATION: + active_index = 0; + break; + case DesktopEntryType.LINK: + active_index = 1; + break; + } + this._type_combo.set_active (active_index); + this._type_combo.set_sensitive (entry_type_sensitive); + this.notify["entry-type-sensitive"].connect ( + () => { this._type_combo.set_sensitive (this.entry_type_sensitive); } + ); + this._type_combo.changed.connect (this.on_type_changed); + table.attach_expand (this._type_combo, 2, 3, 0, 1); // Name name_label = new Label.with_mnemonic (_ ("_Name:")); - table.attach_defaults (name_label, 1, 2, 0, 1); + name_label.xalign = 1.0f; + table.attach_defaults (name_label, 1, 2, 1, 2); this._name = new Entry (); name_label.set_mnemonic_widget (this._name); if (this._entry.key_exists ("Name")) @@ -155,11 +186,12 @@ this._name.set_text (this._entry.name); } this._name.changed.connect (this.on_name_changed); - table.attach_defaults (this._name, 2, 3, 0, 1); + table.attach_expand (this._name, 2, 3, 1, 2); // Description desc_label = new Label.with_mnemonic (_ ("_Description:")); - table.attach_defaults (desc_label, 1, 2, 1, 2); + desc_label.xalign = 1.0f; + table.attach_defaults (desc_label, 1, 2, 2, 3); this._desc = new Entry (); desc_label.set_mnemonic_widget (this._desc); if (this._entry.key_exists ("Comment")) @@ -167,31 +199,36 @@ this._desc.set_text (this._entry.get_string ("Comment")); } this._desc.changed.connect (this.on_desc_changed); - table.attach_defaults (this._desc, 2, 3, 1, 2); + table.attach_expand (this._desc, 2, 3, 2, 3); // Exec exec_label = new Label.with_mnemonic (_ ("_Command:")); - table.attach_defaults (exec_label, 1, 2, 2, 3); + _command_label = exec_label; + exec_label.xalign = 1.0f; + table.attach_defaults (exec_label, 1, 2, 3, 4); exec_hbox = new HBox (false, 5); this._exec = new Entry (); exec_label.set_mnemonic_widget (this._exec); - if (this._entry.key_exists ("Exec")) + + string key_name = is_application ? "Exec" : "URL"; + if (this._entry.key_exists (key_name)) { - this._exec.set_text (this._entry.get_string ("Exec")); + this._exec.set_text (this._entry.get_string (key_name)); } + this._exec.changed.connect (this.on_exec_changed); - exec_hbox.add (this._exec); + exec_hbox.pack_start (this._exec, true); exec_button = new Button.with_mnemonic (_ ("_Browse...")); exec_image = new Image.from_stock (STOCK_OPEN, IconSize.BUTTON); exec_button.set_image (exec_image); exec_button.clicked.connect (this.on_exec_browse); - exec_hbox.add (exec_button); - table.attach_defaults (exec_hbox, 2, 3, 2, 3); + exec_hbox.pack_start (exec_button, false); + table.attach_expand (exec_hbox, 2, 3, 3, 4); // Advanced options // TODO look into ResizeMode so that the window shrinks when the expander // is un-expanded. - advanced = new Expander.with_mnemonic (_ ("_Advanced")); + this._advanced = new Expander.with_mnemonic (_ ("_Advanced")); advanced_vbox = new VBox (false, 5); this._terminal = new CheckButton.with_mnemonic (_ ("Run in _terminal")); if (this._entry.key_exists ("Terminal")) @@ -207,8 +244,20 @@ } this._startup_notification.toggled.connect (this.on_startup_notification_toggled); advanced_vbox.add (this._startup_notification); - advanced.add (advanced_vbox); - table.attach_fill (advanced, 0, 3, 3, 4); + this._advanced.add (advanced_vbox); + table.attach_expand (this._advanced, 0, 3, 4, 5); + + // make sure widgets are properly set up + on_type_changed (this._type_combo); + + List focus_chain_list = new List (); + focus_chain_list.append (this._type_combo); + focus_chain_list.append (this._name); + focus_chain_list.append (this._desc); + focus_chain_list.append (exec_hbox); + focus_chain_list.append (this._icon); + focus_chain_list.append (this._advanced); + table.set_focus_chain (focus_chain_list); this.vbox.add (table); } @@ -220,6 +269,29 @@ } private void + on_type_changed (ComboBox combo) + { + switch (combo.get_active ()) + { + case 0: this._entry.entry_type = DesktopEntryType.APPLICATION; break; + case 1: this._entry.entry_type = DesktopEntryType.LINK; break; + } + + if (this._entry.entry_type == DesktopEntryType.LINK) + { + this._command_label.set_markup_with_mnemonic (_ ("_Location:")); + this._advanced.hide (); + this._advanced.set_no_show_all (true); + } + else + { + this._command_label.set_markup_with_mnemonic (_ ("_Command:")); + this._advanced.set_no_show_all (false); + this._advanced.show (); + } + } + + private void on_name_changed (Editable editable) { Entry entry = editable as Entry; @@ -237,7 +309,9 @@ on_exec_changed (Editable editable) { Entry entry = editable as Entry; - this._entry.set_string ("Exec", entry.text); + string key_name = + this._entry.entry_type == DesktopEntryType.LINK ? "URL" : "Exec"; + this._entry.set_string (key_name, entry.text); } private void @@ -246,14 +320,17 @@ FileChooserDialog dialog; int response; - dialog = new FileChooserDialog (_ ("Locate Command"), this, + bool is_link = this._entry.entry_type == DesktopEntryType.LINK; + string title = is_link ? _ ("Locate a file") : _ ("Locate Command"); + + dialog = new FileChooserDialog (title, this, FileChooserAction.OPEN, STOCK_CANCEL, ResponseType.CANCEL, STOCK_OK, ResponseType.OK); response = dialog.run (); if (response == ResponseType.OK) { - this._exec.text = dialog.get_filename (); + this._exec.text = is_link ? dialog.get_uri () : dialog.get_filename (); } dialog.destroy (); } @@ -345,14 +422,7 @@ } } } - if (this._standalone) - { - main_quit (); - } - else - { - this.hide (); - } + this.hide (); } } } diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-bookmarks-gtk.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-bookmarks-gtk.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-bookmarks-gtk.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-bookmarks-gtk.vala 2010-10-13 21:05:39.000000000 +0000 @@ -77,7 +77,7 @@ */ public GtkBookmarks (File? file = null, bool monitor = true) { - this.file = file; + GLib.Object (file: file); if (this._file.exists ()) { this.parse (); diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file-impl-gio.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file-impl-gio.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file-impl-gio.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file-impl-gio.vala 2010-10-13 21:05:39.000000000 +0000 @@ -239,6 +239,71 @@ } return this._file.delete (null); } + + public override bool is_native () + { + return this._file.is_native (); + } + + public override string get_mime_type () throws Error + { + var fi = this._file.query_info (FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, + 0, null); + return fi.get_content_type (); + } + + public override string[] get_icon_names () throws Error + { + var fi = this._file.query_info (FILE_ATTRIBUTE_STANDARD_ICON, + 0, null); + GLib.Icon icon = fi.get_icon (); + if (icon != null) + { + if (icon is ThemedIcon) + { + // wow! Vala sucks! + Value v = Value (typeof (string[])); + icon.get_property ("names", ref v); + string[] names = (string[]) v; + + // this should be fixed in vala 0.12 + //names = (icon as ThemedIcon).get_names (); + + return names; + } + + if (icon is FileIcon) + { + string path = (icon as FileIcon).get_file ().get_path (); + string[] result = { path }; + + return result; + } + } + + // hmm... what now? + string[] unknown = {}; + return unknown; + } + + public override string? + get_thumbnail_path () + { + try + { + var fi = this._file.query_info (FILE_ATTRIBUTE_THUMBNAIL_PATH, + 0, null); + if (fi.has_attribute (FILE_ATTRIBUTE_THUMBNAIL_PATH)) + { + return fi.get_attribute_byte_string (FILE_ATTRIBUTE_THUMBNAIL_PATH); + } + } + catch (GLib.Error err) + { + warning ("%s", err.message); + } + return null; + } } } diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala 2010-10-13 21:05:39.000000000 +0000 @@ -322,6 +322,24 @@ } return (GnomeVFS.unlink_from_uri (this._uri) == GnomeVFS.Result.OK); } + + public override bool + is_native () + { + return this._uri_str.has_prefix ("file:"); + } + + public override string + get_mime_type () throws Error + { + return GnomeVFS.get_mime_type_from_uri (this._uri); + } + + public override string[] + get_icon_names () throws Error + { + return get_icon_names_for_mime_type (this.get_mime_type ()); + } } } diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala 2010-10-13 21:05:39.000000000 +0000 @@ -247,6 +247,24 @@ } return (FileUtils.unlink (this.impl_path) == 0); } + + public override bool + is_native () + { + return this._uri.has_prefix ("file:"); + } + + public override string + get_mime_type () throws Error + { + return this._info.mime_info.get_name (); + } + + public override string[] + get_icon_names () throws Error + { + return get_icon_names_for_mime_type (this.get_mime_type ()); + } } } diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-file.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-file.vala 2010-10-13 21:05:39.000000000 +0000 @@ -190,6 +190,34 @@ * @return %TRUE on success, %FALSE on failure. */ public abstract bool remove () throws Error; + + /** + * Checks to see if a file is native to the platform. + * @return %TRUE if file is native, %FALSE otherwise. + */ + public abstract bool is_native (); + + /** + * Gets the file's mime type. (might block) + * @return String containing file's mime type. + */ + public abstract string get_mime_type () throws Error; + + /** + * Gets list of possible icon names representing this file. (might block) + * @return List of possible icon names. + */ + public abstract string[] get_icon_names () throws Error; + + /** + * Get path to thumbnail representing this file. (might block) + * @return Path to file with thumbnail or %null if thumbnail cannot be + * found or backend doesn't support it. + */ + public virtual string? get_thumbnail_path () + { + return null; + } } public File? @@ -219,6 +247,20 @@ return (File)Object.new (vfs.file_type, "uri", uri); } } + + public static string[] + get_icon_names_for_mime_type (string mime_type) + { + string[] names = null; + + return_val_if_fail (mime_type != "", null); + + names += mime_type.replace ("/", "-"); + names += "gnome-mime-%s".printf (names[0]); + names += "%s-x-generic".printf (Regex.split_simple ("/.*", mime_type)[0]); + + return names; + } } // vim: set et ts=2 sts=2 sw=2 ai : diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-impl-gio.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-impl-gio.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-impl-gio.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-impl-gio.vala 2010-10-13 21:05:39.000000000 +0000 @@ -89,7 +89,6 @@ } } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-impl-gnome-vfs.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-impl-gnome-vfs.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-impl-gnome-vfs.vala 2010-10-13 21:05:39.000000000 +0000 @@ -92,7 +92,6 @@ } } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-impl-thunar-vfs.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-impl-thunar-vfs.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-impl-thunar-vfs.vala 2010-10-13 21:05:39.000000000 +0000 @@ -92,7 +92,6 @@ } } } -[ModuleInit] public Type register_plugin () { diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-trash-impl-gio.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-trash-impl-gio.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-trash-impl-gio.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-trash-impl-gio.vala 2010-10-13 21:05:39.000000000 +0000 @@ -77,7 +77,7 @@ try { - file_info = dir.query_info_finish (res); + file_info = dir.query_info_async.end (res); this._file_count = file_info.get_attribute_uint32 (FILE_ATTRIBUTE_TRASH_ITEM_COUNT); this.file_count_changed (); } diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala 2010-10-13 21:05:39.000000000 +0000 @@ -53,7 +53,7 @@ { Monitor monitor; this.trash = ThunarVfs.Path.get_for_trash (); - this.dbus = Bus.get (BusType.SESSION); + this.dbus = DBus.Bus.get (DBus.BusType.SESSION); this.xfce_trash = (Xfce.Trash)this.dbus.get_object ("org.xfce.Thunar", "/org/xfce/FileManager"); diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-volume-impl-gio.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-volume-impl-gio.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-volume-impl-gio.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-volume-impl-gio.vala 2010-10-13 21:05:39.000000000 +0000 @@ -121,7 +121,7 @@ bool result = false; try { - result = this.vol.mount_finish (this.async_result); + result = this.vol.mount.end (this.async_result); } catch (GLib.Error err) { @@ -156,7 +156,7 @@ bool result = false; try { - result = this.vol.get_mount ().unmount_finish (this.async_result); + result = this.vol.get_mount ().unmount.end (this.async_result); } catch (GLib.Error err) { @@ -192,7 +192,7 @@ bool result = false; try { - result = this.vol.eject_finish (this.async_result); + result = this.vol.eject.end (this.async_result); } catch (GLib.Error err) { @@ -211,7 +211,7 @@ this.monitor = GLib.VolumeMonitor.get (); this._volumes = new HashTable (direct_hash, direct_equal); - unowned List vols = this.monitor.get_volumes (); + List vols = this.monitor.get_volumes (); foreach (unowned GLib.Volume gvol in vols) { VFS.Volume vol = this.create_volume (gvol); diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala 2010-10-13 21:05:39.000000000 +0000 @@ -190,8 +190,7 @@ this.monitor = GnomeVFS.get_volume_monitor (); this._volumes = new HashTable (direct_hash, direct_equal); - unowned List drives = - this.monitor.get_connected_drives (); + List drives = this.monitor.get_connected_drives (); foreach (unowned GnomeVFS.Drive drive in drives) { VFS.Volume vol = this.create_volume (drive); diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala 2010-10-13 21:05:39.000000000 +0000 @@ -63,7 +63,7 @@ } public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl) { - this.implementation = impl; + GLib.Object (implementation: impl); } public bool is_mounted () diff -Nru libdesktop-agnostic-0.3.90/libdesktop-agnostic/wscript libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/wscript --- libdesktop-agnostic-0.3.90/libdesktop-agnostic/wscript 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/libdesktop-agnostic/wscript 2010-10-13 21:05:39.000000000 +0000 @@ -34,6 +34,10 @@ } }, 'fdo': { + 'gio': { + 'uselib': 'GIO_UNIX', + 'packages': 'gio-unix-2.0', + }, 'gnome': { 'uselib': 'GNOME_DESKTOP', 'packages': 'gnome-desktop-2.0', @@ -113,7 +117,7 @@ ]) lib.packages = 'gdk-2.0 gmodule-2.0' lib.target = 'desktop-agnostic' - lib.gir = 'DesktopAgnostic-1.0' + if bld.env['INTROSPECTION']: lib.gir = 'DesktopAgnostic-1.0' lib.uselib = 'M GDK GMODULE' lib.packages_private = 'build' lib.includes = '..' @@ -133,7 +137,7 @@ vfs.packages = 'desktop-agnostic posix' vfs.target = 'desktop-agnostic-vfs' vfs.header = 'vfs' - vfs.gir = 'DesktopAgnosticVFS-1.0' + if bld.env['INTROSPECTION']: vfs.gir = 'DesktopAgnosticVFS-1.0' vfs.uselib_local = 'desktop-agnostic' vfs.packages_private = 'posix-glob' vfs.includes = '..' @@ -152,7 +156,7 @@ cfg.packages = 'desktop-agnostic-vfs' cfg.target = 'desktop-agnostic-cfg' cfg.header = 'config' - cfg.gir = 'DesktopAgnosticConfig-1.0' + if bld.env['INTROSPECTION']: cfg.gir = 'DesktopAgnosticConfig-1.0' cfg.uselib_local = 'desktop-agnostic-vfs' cfg.packages_private = 'hashtable-gtype-key' cfg.includes = '..' @@ -166,7 +170,7 @@ fdo.packages = 'desktop-agnostic-vfs' fdo.target = 'desktop-agnostic-fdo' fdo.header = 'fdo' - fdo.gir = 'DesktopAgnosticFDO-1.0' + if bld.env['INTROSPECTION']: fdo.gir = 'DesktopAgnosticFDO-1.0' fdo.uselib_local = 'desktop-agnostic-vfs' fdo.vapi_dirs = '.' fdo.includes = '..' @@ -183,7 +187,7 @@ ui.packages_private = 'build' ui.target = 'desktop-agnostic-ui' ui.header = 'ui' - ui.gir = 'DesktopAgnosticUI-1.0' + if bld.env['INTROSPECTION']: ui.gir = 'DesktopAgnosticUI-1.0' ui.uselib = 'GTK' ui.uselib_local = 'desktop-agnostic-fdo' ui.vapi_dirs = '. ../vapi' diff -Nru libdesktop-agnostic-0.3.90/po/en_US@piglatin.po libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/en_US@piglatin.po --- libdesktop-agnostic-0.3.90/po/en_US@piglatin.po 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/en_US@piglatin.po 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1,103 @@ +# Translatable strings for libdesktop-agnostic. +# Copyright (C) 2009, 2010 Mark Lee +# This file is distributed under the BSD license. +# +# Translators: +# Mark Lee , 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: libdesktop-agnostic-0.4\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-04-18 11:20-0700\n" +"PO-Revision-Date: 2010-04-18 12:46-0800\n" +"Last-Translator: Mark Lee \n" +"Language-Team: Pig Latin \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: English\n" +"X-Poedit-Country: UNITED STATES\n" +"X-Poedit-SourceCharset: utf-8\n" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:64 +msgid "Select Icon" +msgstr "Elect-say Icon-way" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:75 +msgid "From File" +msgstr "Om-fray Ile-fay" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:78 +msgid "From Theme" +msgstr "Om-fray Eme-thay" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:85 +msgid "Select icon folder" +msgstr "Elect-say icon-way older-fay" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:298 +msgid "Please select an icon." +msgstr "Ease-play elect-say an icon-way." + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:301 +msgid "Error" +msgstr "Error-way" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:92 +msgid "Desktop Entry Editor" +msgstr "Esktop-day Entry-way Editor-way" + +#. Name +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:149 +msgid "_Name:" +msgstr "Ame-_nay:" + +#. Description +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:161 +msgid "_Description:" +msgstr "Escription-_day:" + +#. Exec +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:173 +msgid "_Command:" +msgstr "Ommand-_cay:" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:184 +msgid "_Browse..." +msgstr "Owse-_bray..." + +#. Advanced options +#. TODO look into ResizeMode so that the window shrinks when the expander +#. is un-expanded. +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:194 +msgid "_Advanced" +msgstr "_Advanced-way" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:196 +msgid "Run in _terminal" +msgstr "Un-ray in erminal-_tay" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:203 +msgid "Use _startup notification" +msgstr "Use-way artup-_stay otification-nay" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:249 +msgid "Locate Command" +msgstr "Ocate-lay Ommand-cay" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:283 +msgid "Save As" +msgstr "Ave-say As" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:341 +#, c-format +msgid "" +"An error occurred while trying to save the desktop entry:\n" +"\n" +"%s" +msgstr "" +"An error-way occurred-way ile-whay ying-tray to ave-say the esktop-day entry-way:\n" +"\n" +"%s" + diff -Nru libdesktop-agnostic-0.3.90/po/libdesktop-agnostic.pot libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/libdesktop-agnostic.pot --- libdesktop-agnostic-0.3.90/po/libdesktop-agnostic.pot 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/libdesktop-agnostic.pot 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1,96 @@ +# Translatable strings for libdesktop-agnostic. +# Copyright (C) 2009, 2010 Mark Lee +# This file is distributed under the BSD license. +# +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: libdesktop-agnostic-0.4\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-04-18 11:20-0700\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:64 +msgid "Select Icon" +msgstr "" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:75 +msgid "From File" +msgstr "" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:78 +msgid "From Theme" +msgstr "" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:85 +msgid "Select icon folder" +msgstr "" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:298 +msgid "Please select an icon." +msgstr "" + +#: ../libdesktop-agnostic/ui-icon-chooser-dialog.vala:301 +msgid "Error" +msgstr "" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:92 +msgid "Desktop Entry Editor" +msgstr "" + +#. Name +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:149 +msgid "_Name:" +msgstr "" + +#. Description +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:161 +msgid "_Description:" +msgstr "" + +#. Exec +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:173 +msgid "_Command:" +msgstr "" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:184 +msgid "_Browse..." +msgstr "" + +#. Advanced options +#. TODO look into ResizeMode so that the window shrinks when the expander +#. is un-expanded. +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:194 +msgid "_Advanced" +msgstr "" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:196 +msgid "Run in _terminal" +msgstr "" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:203 +msgid "Use _startup notification" +msgstr "" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:249 +msgid "Locate Command" +msgstr "" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:283 +msgid "Save As" +msgstr "" + +#: ../libdesktop-agnostic/ui-launcher-editor-dialog.vala:341 +#, c-format +msgid "" +"An error occurred while trying to save the desktop entry:\n" +"\n" +"%s" +msgstr "" diff -Nru libdesktop-agnostic-0.3.90/po/LINGUAS libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/LINGUAS --- libdesktop-agnostic-0.3.90/po/LINGUAS 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/LINGUAS 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1,2 @@ +# please keep this list sorted alphabetically +en_US@piglatin diff -Nru libdesktop-agnostic-0.3.90/po/POTFILES.in libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/POTFILES.in --- libdesktop-agnostic-0.3.90/po/POTFILES.in 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/POTFILES.in 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1,5 @@ +# List of source files containing translatable strings. +# Please keep this file sorted alphabetically. +[encoding: UTF-8] +libdesktop-agnostic/ui-icon-chooser-dialog.vala +libdesktop-agnostic/ui-launcher-editor-dialog.vala diff -Nru libdesktop-agnostic-0.3.90/po/wscript libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/wscript --- libdesktop-agnostic-0.3.90/po/wscript 1970-01-01 00:00:00.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/po/wscript 2010-10-13 21:05:39.000000000 +0000 @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: set ft=python + + +def build(bld): + bld.new_task_gen(features='intltool_po', appname='libdesktop-agnostic') diff -Nru libdesktop-agnostic-0.3.90/python/desktopagnostic.override libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/desktopagnostic.override --- libdesktop-agnostic-0.3.90/python/desktopagnostic.override 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/desktopagnostic.override 2010-10-13 21:05:39.000000000 +0000 @@ -98,19 +98,23 @@ _wrap_desktop_agnostic_color_from_values (PyObject *self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { "red", "green", "blue", "alpha", NULL }; - int red, green, blue, alpha; - DesktopAgnosticColor *ret; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, - "iiii:color_new_from_values", kwlist, - &red, &green, &blue, &alpha)) - return NULL; + static char *kwlist[] = { "red", "green", "blue", "alpha", NULL }; + int red, green, blue, alpha; + DesktopAgnosticColor *ret; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, + "iiii:color_new_from_values", kwlist, + &red, &green, &blue, &alpha)) + return NULL; - ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha); + ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha); - /* pygobject_new handles NULL checking */ - return pygobject_new ((GObject *)ret); + /* pygobject_new handles NULL checking */ + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; } %% define DesktopAgnosticColor.from_string kwargs staticmethod @@ -122,6 +126,7 @@ char *spec; GError *error = NULL; DesktopAgnosticColor *ret; + PyObject *py_ret; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string", kwlist, &spec)) @@ -137,7 +142,10 @@ } /* pygobject_new handles NULL checking */ - return pygobject_new ((GObject *)ret); + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; } %% override-slot DesktopAgnosticColor.tp_str diff -Nru libdesktop-agnostic-0.3.90/python/fdo.override libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/fdo.override --- libdesktop-agnostic-0.3.90/python/fdo.override 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/fdo.override 2010-10-13 21:05:39.000000000 +0000 @@ -197,6 +197,7 @@ { DesktopAgnosticFDODesktopEntry *ret; GError *error = NULL; + PyObject *py_ret; ret = desktop_agnostic_fdo_desktop_entry_new (&error); @@ -206,7 +207,10 @@ } /* pygobject_new handles NULL checking */ - return pygobject_new ((GObject *)ret); + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; } %% define DesktopAgnosticFDODesktopEntry.for_data kwargs staticmethod @@ -218,6 +222,7 @@ static char *kwlist[] = { "data", NULL }; char *data; DesktopAgnosticFDODesktopEntry *ret; + PyObject *py_ret; GError *error = NULL; if (!PyArg_ParseTupleAndKeywords (args, kwargs, @@ -235,7 +240,10 @@ } /* pygobject_new handles NULL checking */ - return pygobject_new ((GObject *)ret); + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; } %% define DesktopAgnosticFDODesktopEntry.for_file onearg staticmethod @@ -244,6 +252,7 @@ PyGObject *file) { DesktopAgnosticFDODesktopEntry *ret; + PyObject *py_ret; GError *error = NULL; ret = desktop_agnostic_fdo_desktop_entry_new_for_file (DESKTOP_AGNOSTIC_VFS_FILE(file->obj), @@ -255,7 +264,10 @@ } /* pygobject_new handles NULL checking */ - return pygobject_new ((GObject *)ret); + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; } %% define DesktopAgnosticFDODesktopEntry.type_to_string onearg staticmethod diff -Nru libdesktop-agnostic-0.3.90/python/ui.override libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/ui.override --- libdesktop-agnostic-0.3.90/python/ui.override 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/ui.override 2010-10-13 21:05:39.000000000 +0000 @@ -46,9 +46,13 @@ PyGObject *color) { DesktopAgnosticUIColorButton *ret; + PyObject *py_ret; ret = desktop_agnostic_ui_color_button_new_with_color (DESKTOP_AGNOSTIC_COLOR(color->obj)); /* pygobject_new handles NULL checking */ - return pygobject_new((GObject *)ret); + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; } diff -Nru libdesktop-agnostic-0.3.90/python/vfs.defs libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/vfs.defs --- libdesktop-agnostic-0.3.90/python/vfs.defs 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/vfs.defs 2010-10-13 21:05:39.000000000 +0000 @@ -199,6 +199,36 @@ ) ) +(define-method is_native + (of-object "DesktopAgnosticVFSFile") + (c-name "desktop_agnostic_vfs_file_is_native") + (return-type "gboolean") +) + +(define-method get_mime_type + (of-object "DesktopAgnosticVFSFile") + (c-name "desktop_agnostic_vfs_file_get_mime_type") + (return-type "char*") + (parameters + '("GError**" "error") + ) +) + +(define-method get_icon_names + (of-object "DesktopAgnosticVFSFile") + (c-name "desktop_agnostic_vfs_file_get_icon_names") + (return-type "GStrv") + (parameters + '("GError**" "error") + ) +) + +(define-method get_thumbnail_path + (of-object "DesktopAgnosticVFSFile") + (c-name "desktop_agnostic_vfs_file_get_thumbnail_path") + (return-type "char*") +) + (define-function file_new_for_path (c-name "desktop_agnostic_vfs_file_new_for_path") (return-type "DesktopAgnosticVFSFile*") @@ -217,6 +247,14 @@ ) ) +(define-function get_icon_names_for_mime_type + (c-name "desktop_agnostic_vfs_get_icon_names_for_mime_type") + (return-type "char*") + (parameters + '("const-char*" "mime_type") + ) +) + (define-method changed (of-object "DesktopAgnosticVFSFileMonitor") (c-name "desktop_agnostic_vfs_file_monitor_emit") diff -Nru libdesktop-agnostic-0.3.90/python/vfs.override libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/vfs.override --- libdesktop-agnostic-0.3.90/python/vfs.override 2010-04-11 07:32:01.000000000 +0000 +++ libdesktop-agnostic-0.3.91~bzr423+201010132105~maverick1/python/vfs.override 2010-10-13 21:05:39.000000000 +0000 @@ -117,6 +117,7 @@ { char *path; DesktopAgnosticVFSFile *ret; + PyObject *py_ret; GError *error = NULL; if (!PyString_Check (arg)) @@ -136,16 +137,20 @@ } /* pygobject_new handles NULL checking */ - return pygobject_new ((GObject *)ret); + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; } %% define DesktopAgnosticVFSFile.for_uri onearg staticmethod static PyObject * _wrap_desktop_agnostic_v_f_s_file_for_uri (PyObject *self, PyObject *arg) { - char *uri; - DesktopAgnosticVFSFile *ret; - GError *error = NULL; + char *uri; + DesktopAgnosticVFSFile *ret; + PyObject *py_ret; + GError *error = NULL; if (!PyString_Check (arg)) { @@ -164,8 +169,39 @@ } /* pygobject_new handles NULL checking */ - return pygobject_new ((GObject *)ret); + py_ret = pygobject_new ((GObject *)ret); + if (ret != NULL) + g_object_unref (ret); + return py_ret; +} +%% +override desktop_agnostic_vfs_get_icon_names_for_mime_type kwargs +static PyObject * +_wrap_desktop_agnostic_vfs_get_icon_names_for_mime_type(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "mime_type", NULL }; + char *mime_type; + gchar **ret; + int ret_length = 0; + int i; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:get_icon_names_for_mime_type", kwlist, &mime_type)) + return NULL; + + ret = desktop_agnostic_vfs_get_icon_names_for_mime_type(mime_type, &ret_length); + + py_ret = PyList_New (ret_length); + if (ret) { + for (i=0; iobj), + &res_length, &error); + + if (pyg_error_check (&error)) + { + return NULL; + } + + py_result = PyList_New (res_length); + for (i=0; i