libdesktop-agnostic-0.3.92/vapi/packages/thunar-vfs-1/thunar-vfs-1.namespace0000664000175000017510000000001211536677677026142 0ustar seagleseagleThunarVfs libdesktop-agnostic-0.3.92/vapi/packages/thunar-vfs-1/thunar-vfs-1.files0000664000175000017510000000006711536677677025322 0ustar seagleseagleinclude/thunar-vfs-1/thunar-vfs lib/libthunar-vfs-1.so libdesktop-agnostic-0.3.92/vapi/packages/thunar-vfs-1/thunar-vfs-1-custom.vala0000664000175000017510000000226711536677677026457 0ustar seagleseagle/* thunar-vfs-1-custom.vala * * Copyright (C) 2008 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 */ namespace ThunarVfs { public class Job { public virtual signal bool infos_ready (GLib.List info_list); public virtual signal void status_ready (uint64 total_size, uint file_count, uint directory_count, uint unreadable_directory_count); } [Compact] public class Path { public void unref (); } } // vim: set noet : libdesktop-agnostic-0.3.92/vapi/packages/thunar-vfs-1/thunar-vfs-1.gi0000664000175000017510000014556111536677677024630 0ustar seagleseagle libdesktop-agnostic-0.3.92/vapi/packages/thunar-vfs-1/thunar-vfs-1.defines0000664000175000017510000000003111536677677025624 0ustar seagleseagle-DTHUNAR_VFS_COMPILATION libdesktop-agnostic-0.3.92/vapi/packages/thunar-vfs-1/thunar-vfs-1.metadata0000664000175000017510000000050311536677677025773 0ustar seagleseagleThunarVfs cheader_filename="thunar-vfs/thunar-vfs.h" ThunarVfs*Class hidden="1" ThunarVfsJob::infos_ready hidden="1" ThunarVfsPath.parent hidden="1" thunar_vfs_path_get_parent nullable="1" thunar_vfs_volume_eject.window nullable="1" thunar_vfs_volume_mount.window nullable="1" thunar_vfs_volume_unmount.window nullable="1" libdesktop-agnostic-0.3.92/tests/python/test-desktop-entry.py0000664000175000017510000000357111536677677023720 0ustar seagleseagle#!/usr/bin/env python # 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. import sys import gtk from desktopagnostic import fdo from desktopagnostic import vfs def main(args): vfs.init() try: if len(args) > 1: for arg in args[1:]: desktop_file = vfs.File.for_path(arg) entry = fdo.DesktopEntry.for_file(desktop_file) print 'Entry: %s' % entry.props.name print 'Entry exec line: %s', entry.get_string('Exec') if entry.exists(): pid = entry.launch(0, None) print 'PID: %d' % pid else: print 'Entry does not exist!' else: entry = fdo.DesktopEntry.new() entry.props.name = 'hosts file' entry.props.entry_type = fdo.DESKTOP_ENTRY_TYPE_LINK entry.set_string('URL', 'file:///etc/hosts') test_filename = '/tmp/desktop-agnostic-test.desktop' desktop_file = vfs.File.for_path(test_filename) entry.save(desktop_file) finally: vfs.shutdown() if __name__ == '__main__': gtk.init_check() main(sys.argv) libdesktop-agnostic-0.3.92/tests/python/test-config-client.py0000664000175000017510000001214711536677677023630 0ustar seagleseagle#!/usr/bin/env python # # 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. import glib import time import unittest from desktopagnostic import config ''' Map format: type name => (group, key, default, set value) ''' type_key_map = { 'bool': ('numeric', 'boolean', True, False), 'int': ('numeric', 'integer', 3, 10), 'float': ('numeric', 'float', 3.14, 2.718), 'string': ('misc', 'string', 'Foo bar', 'Quux baz'), } ''' Map format: type name => (default, set value) ''' list_value_map = { 'bool': ([True, False], [False, True, False]), 'int': ([1, 2, 3], [10, 20, 30]), 'float': ([1.618, 2.718, 3.141], [10.5, 20.6, 30.7]), 'string': (['foo', 'bar'], ['Quux', 'Baz', 'Foo']), } def create_type_tests(type_name, group, key, default, set_val): list_default, list_set_val = list_value_map[type_name] def test_default(self): self.check_values(group, key, default, type_name) def test_default_list(self): self.check_values('list', key, list_default, 'list') def test_set(self): self.check_set_values(group, key, set_val, type_name, False) def test_set_list(self): self.check_set_values('list', key, list_set_val, 'list', False) def test_set_value(self): self.check_set_values(group, key, set_val, type_name, True) def test_set_list_value(self): self.check_set_values('list', key, list_set_val, 'list', True) return { 'test_default_%s' % type_name: test_default, 'test_default_list_%s' % type_name: test_default_list, 'test_set_%s' % type_name: test_set, 'test_set_list_%s' % type_name: test_set_list, 'test_set_value_%s' % type_name: test_set_value, 'test_set_list_value_%s' % type_name: test_set_list_value} class TestConfigClient(unittest.TestCase): def setUp(self): self.ml = glib.MainLoop() self.notify_counter = 0 self.client = config.Client('../test-config.schema-ini') self.client.reset(False) def check_values(self, group, key, expected, type_name): get_func = getattr(self.client, 'get_%s' % type_name) actual = get_func(group, key) actual_value = self.client.get_value(group, key) if isinstance(expected, float): expected = round(expected, 3) actual = round(actual, 3) actual_value = round(actual_value, 3) elif isinstance(expected, list) and isinstance(expected[0], float): expected = [round(x, 3) for x in expected] actual = [round(x, 3) for x in actual] actual_value = [round(x, 3) for x in actual_value] ERROR_MSG = 'Fail! Expected value: %s, actual: %s' self.assertEqual(expected, actual, ERROR_MSG % (str(expected), str(actual))) self.assertEqual(actual, actual_value) def check_set_values(self, group, key, expected, type_name, set_value): if set_value: set_func = self.client.set_value else: set_func = getattr(self.client, 'set_%s' % type_name) set_func(group, key, expected) self.check_values(group, key, expected, type_name) def string_changed(self, group, key, value): self.notify_counter += 1 def string_changed2(self, group, key, value): if 'quux' in value: self.notify_counter += 3 def check_notify(self, ctx, string, expected_counter): self.client.set_string('misc', 'string', string) # wait for the notification time.sleep(0.25) while ctx.pending(): ctx.iteration() self.assertEqual(self.notify_counter, expected_counter) def test_notify(self): ctx = self.ml.get_context() self.client.notify_add('misc', 'string', self.string_changed) self.client.notify_add('misc', 'string', self.string_changed2) self.check_notify(ctx, 'Bar foo', 1) self.check_notify(ctx, 'Foo quux', 5) self.client.notify_remove('misc', 'string', self.string_changed) self.check_notify(ctx, 'Bar quux', 8) self.client.notify_remove('misc', 'string', self.string_changed2) self.check_notify(ctx, 'Baz foo', 8) # add the type-specific tests to the testcase for type_name, data in type_key_map.iteritems(): methods = create_type_tests(type_name, *data) for name, method in methods.iteritems(): setattr(TestConfigClient, name, method) if __name__ == '__main__': unittest.main() libdesktop-agnostic-0.3.92/tests/python/test-color.py0000664000175000017510000000213411536677677022220 0ustar seagleseagle#!/usr/bin/env python # # 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. import desktopagnostic from gtk import gdk green = desktopagnostic.Color.from_string('green') print green.to_string() print green assert isinstance(green.props.color, gdk.Color) print str(green.props.color) one_char_hex = desktopagnostic.Color.from_string('#f00f') print one_char_hex.to_string() print one_char_hex libdesktop-agnostic-0.3.92/tests/python/test-vfs-file-monitor.py0000664000175000017510000000375011536677677024307 0ustar seagleseagle#!/usr/bin/env python # # 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. import sys import os.path import gobject from desktopagnostic import vfs class TestFileMonitor: def __init__(self, path): self.vfile = vfs.File.for_path(path) self.monitor = self.vfile.monitor() self.monitor.connect('changed', self.on_change) if self.vfile.props.file_type == vfs.FILE_TYPE_DIRECTORY: gobject.timeout_add_seconds(2, self.do_emit) def on_change(self, monitor, vfile, other, event): print '%s: %s' % (event.value_nick, vfile.props.uri) if other is not None: print ' * other: %s' % other.props.uri def do_emit(self): path = os.path.join(self.vfile.props.path, 'test-vfs-file.txt') other = vfs.File.for_path(path) self.monitor.changed(other, vfs.FILE_MONITOR_EVENT_CREATED) def main(args): if len(args) < 2: sys.stderr.write('Usage: %s [FILE | DIRECTORY FILE] \n' % args[0]) return 1 vfs.init() try: ml = gobject.MainLoop() test = TestFileMonitor(args[1]) ml.run() test.monitor.cancel() assert test.monitor.props.cancelled finally: vfs.shutdown() return 0 if __name__ == '__main__': sys.exit(main(sys.argv)) libdesktop-agnostic-0.3.92/tests/python/test-ui-color-button.py0000664000175000017510000000273411536677677024152 0ustar seagleseagle#!/usr/bin/env python # # 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. import gtk import desktopagnostic from desktopagnostic.ui import ColorButton class TestColorButton(gtk.Window): def __init__(self): super(TestColorButton, self).__init__() self.connect('delete-event', gtk.main_quit) color = desktopagnostic.Color.from_string('green') color.props.alpha = 2 ** 15 - 1 button = ColorButton.with_color(color) button.connect('color-set', self.on_color_set) self.add(button) self.show_all() def on_color_set(self, button): print str(button.props.da_color) gtk.main_quit() if __name__ == '__main__': tcb = TestColorButton() gtk.main() # vim:ts=4:sts=4:sw=4:et:ai:cindent: libdesktop-agnostic-0.3.92/tests/python/test-vfs-file.py0000664000175000017510000000471411536677677022623 0ustar seagleseagle#!/usr/bin/env python # vim: set ts=4 sts=4 sw=4 et : # # 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. import sys import os.path import tempfile from desktopagnostic import vfs import gtk CONTENT = 'Desktop Agnostic Library' def main(): gtk.init_check() vfs.init() test_launch = 'launch' in sys.argv try: path = tempfile.gettempdir() tmp = vfs.File.for_path(path) assert tmp.props.parent is not None assert tmp.exists() assert tmp.props.file_type == vfs.FILE_TYPE_DIRECTORY assert (tmp.props.access_flags & vfs.ACCESS_FLAGS_READ) != 0 assert tmp.is_readable() assert (tmp.props.access_flags & vfs.ACCESS_FLAGS_WRITE) != 0 assert tmp.is_writable() print 'URI: %s' % tmp.props.uri print 'Path: %s' % tmp.props.path print '# of files: %d' % len(tmp.enumerate_children()) file_path = os.path.join(path, '%s-lda-test' % tempfile.gettempprefix()) tmp_file = vfs.File.for_path(file_path) assert tmp_file.props.parent is not None and \ tmp_file.props.parent.props.uri == tmp.props.uri tmp_file.replace_contents(CONTENT) assert tmp_file.load_contents() == CONTENT if test_launch: assert tmp_file.launch() file_copy_path = '%s-copy' % file_path file_copy = vfs.File.for_path(file_copy_path) assert tmp_file.copy(file_copy, True) assert CONTENT == file_copy.load_contents() if not test_launch: assert file_copy.remove() assert not file_copy.exists() assert tmp_file.remove() assert not tmp_file.exists() finally: vfs.shutdown() if __name__ == '__main__': main() libdesktop-agnostic-0.3.92/tests/python/test-ui-color-button-gtkbuilder.py0000664000175000017510000000253511536677677026303 0ustar seagleseagle#!/usr/bin/env python # # 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. import gtk # needed to have a readable color string import desktopagnostic from desktopagnostic.ui import ColorButton def on_color_set(button): print str(button.props.da_color) gtk.main_quit() if __name__ == '__main__': builder = gtk.Builder() builder.add_from_file('../test-ui-color-button-gtkbuilder.ui') window = builder.get_object('window1') window.connect('delete-event', gtk.main_quit) button = window.get_child() button.connect('color-set', on_color_set) window.show_all() gtk.main() # vim:ts=4:sts=4:sw=4:et:ai:cindent: libdesktop-agnostic-0.3.92/tests/python/test-vfs-trash.py0000664000175000017510000000243411536677677023022 0ustar seagleseagle#!/usr/bin/env python # # 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. import sys import gobject from desktopagnostic import vfs def on_file_count_changed(trash, mainloop): print 'Number of files in the trash: %u' % trash.props.file_count mainloop.quit() def main(): vfs.init() try: trash = vfs.Trash.get_default() mainloop = gobject.MainLoop() trash.connect('file-count-changed', on_file_count_changed, mainloop) mainloop.run() finally: vfs.shutdown() return 0 if __name__ == '__main__': sys.exit(main()) libdesktop-agnostic-0.3.92/gen_src/tests/test-vfs-file.c0000664000175000017510000002552611537206466022501 0ustar seagleseagle/* test-vfs-file.c generated by valac 0.10.4, 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_free0(var) (var = (g_free (var), NULL)) #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 _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define CONTENT "Desktop Agnostic Library" gint _vala_main (char** args, int args_length1); static void _g_slist_free_g_object_unref (GSList* self); 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 _vala_main (char** args, int args_length1) { gint result = 0; GError * _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_; DesktopAgnosticVFSFile* _tmp11_; DesktopAgnosticVFSFile* _tmp12_; char* _tmp13_; char* _tmp14_; DesktopAgnosticVFSFile* _tmp15_; char* _tmp16_ = NULL; char* _tmp17_; char* _tmp19_; DesktopAgnosticVFSFile* _tmp20_; DesktopAgnosticVFSFile* _tmp21_; gboolean _tmp22_; char* _tmp23_ = NULL; char* _tmp24_; DesktopAgnosticVFSFile* _tmp27_; 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_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); 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_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); 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_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); 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_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); 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_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } desktop_agnostic_vfs_file_load_contents (file, &_tmp16_, &length, &_inner_error_); contents = (_tmp17_ = _tmp16_, _g_free0 (contents), _tmp17_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } g_assert (_vala_strcmp0 (contents, CONTENT) == 0); if (test_launch) { gboolean _tmp18_; _tmp18_ = desktop_agnostic_vfs_file_launch (file, &_inner_error_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } g_assert (_tmp18_); } file_copy_path = (_tmp19_ = g_strdup_printf ("%s-copy", file_path), _g_free0 (file_copy_path), _tmp19_); _tmp20_ = desktop_agnostic_vfs_file_new_for_path (file_copy_path, &_inner_error_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } file_copy = (_tmp21_ = _tmp20_, _g_object_unref0 (file_copy), _tmp21_); _tmp22_ = desktop_agnostic_vfs_file_copy (file, file_copy, TRUE, &_inner_error_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } g_assert (_tmp22_); desktop_agnostic_vfs_file_load_contents (file_copy, &_tmp23_, ©_length, &_inner_error_); copy_contents = (_tmp24_ = _tmp23_, _g_free0 (copy_contents), _tmp24_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } g_assert (_vala_strcmp0 (contents, copy_contents) == 0); g_assert (length == copy_length); if (!test_launch) { gboolean _tmp25_; gboolean _tmp26_; _tmp25_ = desktop_agnostic_vfs_file_remove (file_copy, &_inner_error_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } g_assert (_tmp25_); g_assert (!desktop_agnostic_vfs_file_exists (file_copy)); _tmp26_ = desktop_agnostic_vfs_file_remove (file, &_inner_error_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } g_assert (_tmp26_); g_assert (!desktop_agnostic_vfs_file_exists (file)); } file = (_tmp27_ = NULL, _g_object_unref0 (file), _tmp27_); desktop_agnostic_vfs_shutdown (&_inner_error_); if (_inner_error_ != NULL) { _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); goto __catch0_g_error; } _g_free0 (copy_contents); _g_object_unref0 (file_copy); _g_free0 (file_copy_path); _g_free0 (contents); _g_object_unref0 (file); _g_free0 (file_path); _g_object_unref0 (tmp); } 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 _vala_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); } libdesktop-agnostic-0.3.92/gen_src/tests/test-color.c0000664000175000017510000001522011537206466022072 0ustar seagleseagle/* test-color.c generated by valac 0.10.4, 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 _vala_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) { GValue val = {0}; GValue _tmp0_ = {0}; GValue _tmp1_; GValue _tmp2_; GError * _inner_error_ = NULL; g_return_if_fail (cfg != NULL); g_return_if_fail (name != 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 _vala_main (char** args, int args_length1) { gint result = 0; GError * _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 (one_char_hex); _g_object_unref0 (green); } 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 (cfg); _g_object_unref0 (schema); 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _g_object_unref0 (cfg); _g_object_unref0 (schema); } 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 _vala_main (argv, argc); } libdesktop-agnostic-0.3.92/gen_src/tests/test-config.c0000664000175000017510000025432411537206466022233 0ustar seagleseagle/* test-config.c generated by valac 0.10.4, 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 _test_case_unref0(var) ((var == NULL) ? NULL : (var = (test_case_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))) 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); void value_take_test_case (GValue* value, gpointer v_object); gpointer value_get_test_case (const GValue* value); GType test_case_get_type (void) G_GNUC_CONST; #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 gboolean test_case_array_equals (TestCase* self, GValueArray* expected, GValueArray* actual, GError** error); static void test_case_assert_equals (TestCase* self, GValue* expected, GValue* 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_test_notify (TestCase* self, 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_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) { TestCase* self = (TestCase*) g_type_create_instance (object_type); DesktopAgnosticConfigSchema* schema; DesktopAgnosticConfigSchema* _tmp0_; DesktopAgnosticConfigSchema* _tmp1_; DesktopAgnosticConfigBackend* _tmp2_; DesktopAgnosticConfigBackend* _tmp3_; DesktopAgnosticConfigBackend* _tmp4_; GMainLoop* _tmp5_; GError * _inner_error_ = NULL; schema = desktop_agnostic_config_schema_new ("test-config.schema-ini", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _test_case_unref0 (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_unref0 (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 = FALSE; 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 = FALSE; gboolean equal; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (expected != NULL, FALSE); g_return_val_if_fail (actual != NULL, FALSE); 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) { gboolean equal; GError * _inner_error_ = NULL; g_return_if_fail (self != 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* _tmp1_; char* _tmp2_; 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) { GValueArray* expected_array; GValue expected = {0}; char* key; GValueArray* _tmp0_; GValue _tmp1_ = {0}; GValue _tmp2_; char* _tmp3_; GValue _tmp4_ = {0}; GValue _tmp5_; GValue _tmp6_; GValue _tmp7_; GValueArray* _tmp8_; GValueArray* _tmp9_; gboolean _tmp10_; gboolean _tmp11_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (suffix != 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_free0 (key); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); return; } test_case_assert_equals (self, &expected, (_tmp7_ = _tmp6_ = _tmp5_, &_tmp7_), &_inner_error_); G_IS_VALUE (&_tmp6_) ? (g_value_unset (&_tmp6_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_free0 (key); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); return; } _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_free0 (key); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); 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_free0 (key); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); return; } g_assert (_tmp11_); _g_free0 (key); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); } static void test_case_test_defaults (TestCase* self, GError** error) { GValue expected = {0}; GValue item_1 = {0}; GValue item_2 = {0}; GValue item_3 = {0}; GValueArray* expected_array; GValue _tmp0_ = {0}; GValue _tmp1_; GValue _tmp2_ = {0}; GValue _tmp3_; GValue _tmp4_; GValue _tmp5_; gboolean _tmp6_; GValue _tmp7_ = {0}; GValue _tmp8_; GValue _tmp9_ = {0}; GValue _tmp10_; GValue _tmp11_; GValue _tmp12_; gint _tmp13_; GValue _tmp14_ = {0}; GValue _tmp15_; GValue _tmp16_ = {0}; GValue _tmp17_; GValue _tmp18_; GValue _tmp19_; float _tmp20_; GValue _tmp21_ = {0}; GValue _tmp22_; GValue _tmp23_ = {0}; GValue _tmp24_; GValue _tmp25_; GValue _tmp26_; char* _tmp27_; char* _tmp28_; GValue _tmp29_ = {0}; GValue _tmp30_; GValue _tmp31_ = {0}; GValue _tmp32_; GValue _tmp33_; GValue _tmp34_; char* _tmp35_; char* _tmp36_; GValueArray* _tmp37_; GValue _tmp38_ = {0}; GValue _tmp39_; GValue _tmp40_ = {0}; GValue _tmp41_; GValue _tmp42_ = {0}; GValue _tmp43_; GValue _tmp44_ = {0}; GValue _tmp45_; GValue _tmp46_; GValue _tmp47_; GValueArray* _tmp48_; GValueArray* _tmp49_; gboolean _tmp50_; gboolean _tmp51_; GValueArray* _tmp52_; GValue _tmp53_ = {0}; GValue _tmp54_; GValue _tmp55_ = {0}; GValue _tmp56_; GValue _tmp57_ = {0}; GValue _tmp58_; GValue _tmp59_ = {0}; GValue _tmp60_; GValue _tmp61_ = {0}; GValue _tmp62_; GValue _tmp63_; GValue _tmp64_; GValueArray* _tmp65_; GValueArray* _tmp66_; gboolean _tmp67_; gboolean _tmp68_; GValueArray* _tmp69_; GValue _tmp70_ = {0}; GValue _tmp71_; GValue _tmp72_ = {0}; GValue _tmp73_; GValue _tmp74_ = {0}; GValue _tmp75_; GValue _tmp76_ = {0}; GValue _tmp77_; GValue _tmp78_ = {0}; GValue _tmp79_; GValue _tmp80_; GValue _tmp81_; GValueArray* _tmp82_; GValueArray* _tmp83_; gboolean _tmp84_; gboolean _tmp85_; GValueArray* _tmp86_; GValue _tmp87_ = {0}; GValue _tmp88_; GValue _tmp89_ = {0}; GValue _tmp90_; GValue _tmp91_ = {0}; GValue _tmp92_; GValue _tmp93_ = {0}; GValue _tmp94_; GValue _tmp95_; GValue _tmp96_; GValueArray* _tmp97_; GValueArray* _tmp98_; gboolean _tmp99_; gboolean _tmp100_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp5_ = _tmp4_ = _tmp3_, &_tmp5_), &_inner_error_); G_IS_VALUE (&_tmp4_) ? (g_value_unset (&_tmp4_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp12_ = _tmp11_ = _tmp10_, &_tmp12_), &_inner_error_); G_IS_VALUE (&_tmp11_) ? (g_value_unset (&_tmp11_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp19_ = _tmp18_ = _tmp17_, &_tmp19_), &_inner_error_); G_IS_VALUE (&_tmp18_) ? (g_value_unset (&_tmp18_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp26_ = _tmp25_ = _tmp24_, &_tmp26_), &_inner_error_); G_IS_VALUE (&_tmp25_) ? (g_value_unset (&_tmp25_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp34_ = _tmp33_ = _tmp32_, &_tmp34_), &_inner_error_); G_IS_VALUE (&_tmp33_) ? (g_value_unset (&_tmp33_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp47_ = _tmp46_ = _tmp45_, &_tmp47_), &_inner_error_); G_IS_VALUE (&_tmp46_) ? (g_value_unset (&_tmp46_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp64_ = _tmp63_ = _tmp62_, &_tmp64_), &_inner_error_); G_IS_VALUE (&_tmp63_) ? (g_value_unset (&_tmp63_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp81_ = _tmp80_ = _tmp79_, &_tmp81_), &_inner_error_); G_IS_VALUE (&_tmp80_) ? (g_value_unset (&_tmp80_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp96_ = _tmp95_ = _tmp94_, &_tmp96_), &_inner_error_); G_IS_VALUE (&_tmp95_) ? (g_value_unset (&_tmp95_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_test_default_empty_list (self, "integer", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_test_default_empty_list (self, "float", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_test_default_empty_list (self, "string", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; } static void test_case_test_set_empty_list (TestCase* self, const char* key, GError** error) { GValueArray* old_value; GValueArray* expected_array; GValue expected = {0}; GValueArray* _tmp0_; GValueArray* _tmp1_; GValueArray* _tmp2_; GValue _tmp3_ = {0}; GValue _tmp4_; GValue _tmp5_ = {0}; GValue _tmp6_; GValue _tmp7_; GValue _tmp8_; GValueArray* _tmp9_; GValueArray* _tmp10_; gboolean _tmp11_; gboolean _tmp12_; GValueArray* _tmp13_; GValueArray* _tmp14_; gboolean _tmp15_; gboolean _tmp16_; GValue _tmp17_ = {0}; GValue _tmp18_; GValue _tmp19_; GValue _tmp20_; GValueArray* _tmp21_; GValueArray* _tmp22_; gboolean _tmp23_; gboolean _tmp24_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (key != 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); return; } test_case_assert_equals (self, &expected, (_tmp8_ = _tmp7_ = _tmp6_, &_tmp8_), &_inner_error_); G_IS_VALUE (&_tmp7_) ? (g_value_unset (&_tmp7_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); return; } _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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); return; } test_case_assert_equals (self, &expected, (_tmp20_ = _tmp19_ = _tmp18_, &_tmp20_), &_inner_error_); G_IS_VALUE (&_tmp19_) ? (g_value_unset (&_tmp19_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); return; } _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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); 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_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); return; } g_assert (_tmp24_); G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; _g_value_array_free0 (expected_array); _g_value_array_free0 (old_value); } static void test_case_test_set (TestCase* self, GError** error) { GValue expected = {0}; GValue item_1 = {0}; GValue item_2 = {0}; GValue item_3 = {0}; GValueArray* expected_array; GValue _tmp0_ = {0}; GValue _tmp1_; GValue _tmp2_ = {0}; GValue _tmp3_; GValue _tmp4_; GValue _tmp5_; gboolean _tmp6_; GValue _tmp7_ = {0}; GValue _tmp8_; GValue _tmp9_ = {0}; GValue _tmp10_; GValue _tmp11_; GValue _tmp12_; gint _tmp13_; GValue _tmp14_ = {0}; GValue _tmp15_; GValue _tmp16_ = {0}; GValue _tmp17_; GValue _tmp18_; GValue _tmp19_; float _tmp20_; GValue _tmp21_ = {0}; GValue _tmp22_; GValue _tmp23_ = {0}; GValue _tmp24_; GValue _tmp25_; GValue _tmp26_; char* _tmp27_; char* _tmp28_; GValueArray* _tmp29_; GValue _tmp30_ = {0}; GValue _tmp31_; GValue _tmp32_ = {0}; GValue _tmp33_; GValue _tmp34_ = {0}; GValue _tmp35_; GValue _tmp36_ = {0}; GValue _tmp37_; GValue _tmp38_ = {0}; GValue _tmp39_; GValue _tmp40_; GValue _tmp41_; GValueArray* _tmp42_; GValueArray* _tmp43_; gboolean _tmp44_; gboolean _tmp45_; GValueArray* _tmp46_; GValue _tmp47_ = {0}; GValue _tmp48_; GValue _tmp49_ = {0}; GValue _tmp50_; GValue _tmp51_ = {0}; GValue _tmp52_; GValue _tmp53_ = {0}; GValue _tmp54_; GValue _tmp55_ = {0}; GValue _tmp56_; GValue _tmp57_; GValue _tmp58_; GValueArray* _tmp59_; GValueArray* _tmp60_; gboolean _tmp61_; gboolean _tmp62_; GValueArray* _tmp63_; GValue _tmp64_ = {0}; GValue _tmp65_; GValue _tmp66_ = {0}; GValue _tmp67_; GValue _tmp68_ = {0}; GValue _tmp69_; GValue _tmp70_ = {0}; GValue _tmp71_; GValue _tmp72_ = {0}; GValue _tmp73_; GValue _tmp74_; GValue _tmp75_; GValueArray* _tmp76_; GValueArray* _tmp77_; gboolean _tmp78_; gboolean _tmp79_; GValueArray* _tmp80_; GValue _tmp81_ = {0}; GValue _tmp82_; GValue _tmp83_ = {0}; GValue _tmp84_; GValue _tmp85_ = {0}; GValue _tmp86_; GValue _tmp87_ = {0}; GValue _tmp88_; GValue _tmp89_ = {0}; GValue _tmp90_; GValue _tmp91_; GValue _tmp92_; GValueArray* _tmp93_; GValueArray* _tmp94_; gboolean _tmp95_; gboolean _tmp96_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp5_ = _tmp4_ = _tmp3_, &_tmp5_), &_inner_error_); G_IS_VALUE (&_tmp4_) ? (g_value_unset (&_tmp4_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp12_ = _tmp11_ = _tmp10_, &_tmp12_), &_inner_error_); G_IS_VALUE (&_tmp11_) ? (g_value_unset (&_tmp11_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp19_ = _tmp18_ = _tmp17_, &_tmp19_), &_inner_error_); G_IS_VALUE (&_tmp18_) ? (g_value_unset (&_tmp18_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp26_ = _tmp25_ = _tmp24_, &_tmp26_), &_inner_error_); G_IS_VALUE (&_tmp25_) ? (g_value_unset (&_tmp25_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp41_ = _tmp40_ = _tmp39_, &_tmp41_), &_inner_error_); G_IS_VALUE (&_tmp40_) ? (g_value_unset (&_tmp40_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp58_ = _tmp57_ = _tmp56_, &_tmp58_), &_inner_error_); G_IS_VALUE (&_tmp57_) ? (g_value_unset (&_tmp57_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp75_ = _tmp74_ = _tmp73_, &_tmp75_), &_inner_error_); G_IS_VALUE (&_tmp74_) ? (g_value_unset (&_tmp74_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_assert_equals (self, &expected, (_tmp92_ = _tmp91_ = _tmp90_, &_tmp92_), &_inner_error_); G_IS_VALUE (&_tmp91_) ? (g_value_unset (&_tmp91_), NULL) : NULL; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; 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_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_test_set_empty_list (self, "integer", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_test_set_empty_list (self, "float", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } test_case_test_set_empty_list (self, "string", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; return; } _g_value_array_free0 (expected_array); G_IS_VALUE (&item_3) ? (g_value_unset (&item_3), NULL) : NULL; G_IS_VALUE (&item_2) ? (g_value_unset (&item_2), NULL) : NULL; G_IS_VALUE (&item_1) ? (g_value_unset (&item_1), NULL) : NULL; G_IS_VALUE (&expected) ? (g_value_unset (&expected), NULL) : NULL; } static void test_case_update_notify_value (TestCase* self, GMainContext* ctx, const char* value, guint counter_expected, GError** error) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (ctx != NULL); g_return_if_fail (value != 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) { GMainContext* ctx; GError * _inner_error_ = NULL; g_return_if_fail (self != 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_ = NULL; g_return_if_fail (self != 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_ = NULL; g_return_if_fail (self != 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 = 0; GError * _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); } } void value_take_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; } 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 volatile gsize test_case_type_id__volatile = 0; if (g_once_init_enter (&test_case_type_id__volatile)) { 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) }; GType test_case_type_id; test_case_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestCase", &g_define_type_info, &g_define_type_fundamental_info, 0); g_once_init_leave (&test_case_type_id__volatile, test_case_type_id); } return test_case_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/tests/test-ui-color-button-gtkbuilder.c0000664000175000017510000001152211537206467026152 0ustar seagleseagle/* test-ui-color-button-gtkbuilder.c generated by valac 0.10.4, 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); gint _vala_main (char** args, int args_length1); 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); gboolean on_quit (GtkWidget* widget, GdkEvent* event) { gboolean result = 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; } 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) { gboolean result; result = on_quit (_sender, event); return result; } static void _on_color_set_gtk_color_button_color_set (GtkColorButton* _sender, gpointer self) { on_color_set (_sender); } gint _vala_main (char** args, int args_length1) { gint result = 0; GtkBuilder* builder; GtkWindow* window; DesktopAgnosticUIColorButton* button; GtkBuilder* _tmp0_; GError * _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: { _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 _vala_main (argv, argc); } libdesktop-agnostic-0.3.92/gen_src/tests/test-vfs-glob.c0000664000175000017510000001072611537206466022501 0ustar seagleseagle/* test-vfs-glob.c generated by valac 0.10.4, 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 _vala_main (char** args, int args_length1); gint _vala_main (char** args, int args_length1) { gint result = 0; DesktopAgnosticVFSGlob* g; gboolean first_arg; GError * _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 _vala_main (argv, argc); } libdesktop-agnostic-0.3.92/gen_src/tests/test-desktop-entry.c0000664000175000017510000001276611537206466023600 0ustar seagleseagle/* test-desktop-entry.c generated by valac 0.10.4, 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 _vala_main (char** args, int args_length1); gint _vala_main (char** args, int args_length1) { gint result = 0; GError * _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 (entry); _g_object_unref0 (file); goto __catch0_g_error; } } else { g_critical ("test-desktop-entry.vala:53: Entry does not exist."); } _g_object_unref0 (entry); _g_object_unref0 (file); } } } } 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 (file); _g_object_unref0 (entry); 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 (file); _g_object_unref0 (entry); 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 (file); _g_object_unref0 (entry); goto __catch0_g_error; } entry = (_tmp6_ = NULL, _g_object_unref0 (entry), _tmp6_); _g_object_unref0 (file); _g_object_unref0 (entry); } 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 _vala_main (argv, argc); } libdesktop-agnostic-0.3.92/gen_src/tests/test-vfs-bookmarks-gtk.c0000664000175000017510000001316011537206465024323 0ustar seagleseagle/* test-vfs-bookmarks-gtk.c generated by valac 0.10.4, 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); gint _vala_main (char** args, int args_length1); static void _print_bookmarks_desktop_agnostic_vfs_gtk_bookmarks_changed (DesktopAgnosticVFSGtkBookmarks* _sender, gpointer self); 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 _vala_main (char** args, int args_length1) { gint result = 0; DesktopAgnosticVFSImplementation* vfs; DesktopAgnosticVFSGtkBookmarks* parser; DesktopAgnosticVFSImplementation* _tmp0_; DesktopAgnosticVFSImplementation* _tmp1_; GMainLoop* ml; DesktopAgnosticVFSGtkBookmarks* _tmp4_; GError * _inner_error_ = NULL; vfs = NULL; parser = NULL; _tmp0_ = desktop_agnostic_vfs_get_default (&_inner_error_); if (_inner_error_ != NULL) { _g_object_unref0 (parser); _g_object_unref0 (vfs); 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 (parser); _g_object_unref0 (vfs); return result; } } __finally0: if (_inner_error_ != NULL) { _g_object_unref0 (parser); _g_object_unref0 (vfs); 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_main_loop_unref0 (ml); _g_object_unref0 (parser); _g_object_unref0 (vfs); return result; } int main (int argc, char ** argv) { g_type_init (); return _vala_main (argv, argc); } libdesktop-agnostic-0.3.92/gen_src/tests/test-vfs-trash.c0000664000175000017510000002534111537206465022675 0ustar seagleseagle/* test-vfs-trash.c generated by valac 0.10.4, 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); void value_take_test_trash (GValue* value, gpointer v_object); gpointer value_get_test_trash (const GValue* value); GType test_trash_get_type (void) G_GNUC_CONST; enum { TEST_TRASH_DUMMY_PROPERTY }; static void test_trash_on_file_count_changed (DesktopAgnosticVFSTrash* t); static gint test_trash_main (char** args, int args_length1); static void _test_trash_on_file_count_changed_desktop_agnostic_vfs_trash_file_count_changed (DesktopAgnosticVFSTrash* _sender, gpointer self); 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 = 0; GError * _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 = (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); } } void value_take_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; } 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 volatile gsize test_trash_type_id__volatile = 0; if (g_once_init_enter (&test_trash_type_id__volatile)) { 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) }; GType test_trash_type_id; test_trash_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestTrash", &g_define_type_info, &g_define_type_fundamental_info, 0); g_once_init_leave (&test_trash_type_id__volatile, test_trash_type_id); } return test_trash_type_id__volatile; } 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); } } libdesktop-agnostic-0.3.92/gen_src/tests/test-vfs-file-monitor.c0000664000175000017510000003754411537206465024170 0ustar seagleseagle/* test-vfs-file-monitor.c generated by valac 0.10.4, 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); void value_take_test_file_monitor (GValue* value, gpointer v_object); gpointer value_get_test_file_monitor (const GValue* value); GType test_file_monitor_get_type (void) G_GNUC_CONST; 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); gint test_file_monitor_main (char** args, int args_length1); 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); 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 = FALSE; GError * _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_object_unref0 (other); _g_free0 (filename); } 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) { gboolean result; result = test_file_monitor_do_emit (); return result; } gint test_file_monitor_main (char** args, int args_length1) { gint result = 0; GError * _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 = (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); } } void value_take_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; } 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 volatile gsize test_file_monitor_type_id__volatile = 0; if (g_once_init_enter (&test_file_monitor_type_id__volatile)) { 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) }; GType test_file_monitor_type_id; test_file_monitor_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestFileMonitor", &g_define_type_info, &g_define_type_fundamental_info, 0); g_once_init_leave (&test_file_monitor_type_id__volatile, test_file_monitor_type_id); } return test_file_monitor_type_id__volatile; } 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); } } libdesktop-agnostic-0.3.92/gen_src/tests/test-config-bridge.c0000664000175000017510000006341611537206466023465 0ustar seagleseagle/* test-config-bridge.c generated by valac 0.10.4, 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) G_GNUC_CONST; #define DEFAULT_STR "Not expected string" GType test_get_type (void) G_GNUC_CONST; #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) G_GNUC_CONST; #define TEST_DESTRUCT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TEST_DESTRUCT, TestDestructPrivate)) enum { TEST_DESTRUCT_DUMMY_PROPERTY, TEST_DESTRUCT_NUM2 }; TestDestruct* test_destruct_new (DesktopAgnosticConfigBackend* cfg); TestDestruct* test_destruct_construct (GType object_type, DesktopAgnosticConfigBackend* cfg); 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); void test_destruct_add_post_bind_notify (TestDestruct* self); 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); 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 _vala_main (char** args, int args_length1); static int _vala_strcmp0 (const char * str1, const char * str2); GType test_enum_get_type (void) { static volatile gsize test_enum_type_id__volatile = 0; if (g_once_init_enter (&test_enum_type_id__volatile)) { 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}}; GType test_enum_type_id; test_enum_type_id = g_enum_register_static ("TestEnum", values); g_once_init_leave (&test_enum_type_id__volatile, test_enum_type_id); } return test_enum_type_id__volatile; } Test* test_construct (GType object_type) { Test * self = NULL; self = (Test*) g_object_new (object_type, 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); } /** * Note: array test disabled until the following Vala bug is fixed: * http://bugzilla.gnome.org/show_bug.cgi?id=592493 */ GType test_get_type (void) { static volatile gsize test_type_id__volatile = 0; if (g_once_init_enter (&test_type_id__volatile)) { 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 }; GType test_type_id; test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0); g_once_init_leave (&test_type_id__volatile, test_type_id); } return test_type_id__volatile; } 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 = NULL; 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 volatile gsize test_destruct_type_id__volatile = 0; if (g_once_init_enter (&test_destruct_type_id__volatile)) { 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 }; GType test_destruct_type_id; test_destruct_type_id = g_type_register_static (TYPE_TEST, "TestDestruct", &g_define_type_info, 0); g_once_init_leave (&test_destruct_type_id__volatile, test_destruct_type_id); } return test_destruct_type_id__volatile; } 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) { char* _tmp0_; char* _tmp1_; char* _tmp4_; char* _tmp5_; gint _tmp6_; float _tmp7_; gboolean _tmp8_; gint _tmp9_; GError * _inner_error_ = NULL; g_return_if_fail (cfg != NULL); g_return_if_fail (bridge != NULL); g_return_if_fail (obj != 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 _vala_main (char** args, int args_length1) { gint result = 0; GError * _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 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); 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 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); goto __catch0_g_error; } desktop_agnostic_config_backend_reset (cfg, &_inner_error_); if (_inner_error_ != NULL) { _g_object_unref0 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); 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 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); 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 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); 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 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); 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 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); goto __catch0_g_error; } _g_object_unref0 (td); _g_object_unref0 (t); _g_object_unref0 (cfg); _g_object_unref0 (schema); } 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 _vala_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); } libdesktop-agnostic-0.3.92/gen_src/tests/test-vfs-volume.c0000664000175000017510000002626611537206465023072 0ustar seagleseagle/* test-vfs-volume.c generated by valac 0.10.4, 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); void value_take_test_volume (GValue* value, gpointer v_object); gpointer value_get_test_volume (const GValue* value); GType test_volume_get_type (void) G_GNUC_CONST; enum { TEST_VOLUME_DUMMY_PROPERTY }; static gint test_volume_main (char** args, int args_length1); static void _g_list_free_g_object_unref (GList* self); 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 = NULL; 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 = 0; GError * _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* _tmp0_; char* _tmp1_; 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 = (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); } } void value_take_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; } 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 volatile gsize test_volume_type_id__volatile = 0; if (g_once_init_enter (&test_volume_type_id__volatile)) { 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) }; GType test_volume_type_id; test_volume_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestVolume", &g_define_type_info, &g_define_type_fundamental_info, 0); g_once_init_leave (&test_volume_type_id__volatile, test_volume_type_id); } return test_volume_type_id__volatile; } 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); } } libdesktop-agnostic-0.3.92/gen_src/tests/test-ui-color-button.c0000664000175000017510000002326211537206467024024 0ustar seagleseagle/* test-ui-color-button.c generated by valac 0.10.4, 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) G_GNUC_CONST; 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); gint test_color_button_main (char** args, int args_length1); TestColorButton* test_color_button_new (void); TestColorButton* test_color_button_construct (GType object_type); 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 = FALSE; 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 _tmp2_ = {0}; GdkColor _tmp3_ = {0}; GdkColor _tmp4_; GdkColor _tmp5_; 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 = 0; 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) { gboolean result; result = test_color_button_on_quit (self, _sender, event); return result; } 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 (button); _g_object_unref0 (label); _g_object_unref0 (color); _g_object_unref0 (box); 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 (button); _g_object_unref0 (label); _g_object_unref0 (color); _g_object_unref0 (box); } 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 volatile gsize test_color_button_type_id__volatile = 0; if (g_once_init_enter (&test_color_button_type_id__volatile)) { 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 }; GType test_color_button_type_id; test_color_button_type_id = g_type_register_static (GTK_TYPE_WINDOW, "TestColorButton", &g_define_type_info, 0); g_once_init_leave (&test_color_button_type_id__volatile, test_color_button_type_id); } return test_color_button_type_id__volatile; } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-gconf.vapi0000664000175000017510000000400511537206466025531 0ustar seagleseagle/* da-cfg-gconf.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_")] 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/ui-icon-button.c0000664000175000017510000003627611537206467025475 0ustar seagleseagle/* ui-icon-button.c generated by valac 0.10.4, 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) G_GNUC_CONST; GType desktop_agnostic_ui_icon_type_get_type (void) G_GNUC_CONST; GType desktop_agnostic_ui_icon_chooser_dialog_get_type (void) G_GNUC_CONST; #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 }; DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_new (const char* icon); DesktopAgnosticUIIconButton* desktop_agnostic_ui_icon_button_construct (GType object_type, const char* icon); void desktop_agnostic_ui_icon_button_set_icon (DesktopAgnosticUIIconButton* self, const char* value); static void desktop_agnostic_ui_icon_button_on_clicked (DesktopAgnosticUIIconButton* self); 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); 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 volatile gsize desktop_agnostic_ui_icon_button_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_icon_button_type_id__volatile)) { 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 }; GType desktop_agnostic_ui_icon_button_type_id; desktop_agnostic_ui_icon_button_type_id = g_type_register_static (GTK_TYPE_BUTTON, "DesktopAgnosticUIIconButton", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_ui_icon_button_type_id__volatile, desktop_agnostic_ui_icon_button_type_id); } return desktop_agnostic_ui_icon_button_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file-impl-thunar-vfs.c0000664000175000017510000007326411537206465027362 0ustar seagleseagle/* vfs-file-impl-thunar-vfs.c generated by valac 0.10.4, 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_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (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 _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) G_GNUC_CONST; #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); static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_thunar_vfs_real_monitor (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) G_GNUC_CONST; 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 gboolean desktop_agnostic_vfs_file_thunar_vfs_real_launch (DesktopAgnosticVFSFile* base, GError** error); static void _g_list_free_thunar_vfs_path_unref (GList* self); static GSList* desktop_agnostic_vfs_file_thunar_vfs_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error); static void _g_slist_free_g_object_unref (GSList* self); 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); static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_is_native (DesktopAgnosticVFSFile* base); static char* desktop_agnostic_vfs_file_thunar_vfs_real_get_mime_type (DesktopAgnosticVFSFile* base, GError** error); static char** desktop_agnostic_vfs_file_thunar_vfs_real_get_icon_names (DesktopAgnosticVFSFile* base, int* result_length1, 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; char* _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; g_return_if_fail (uri != 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 = FALSE; 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 = NULL; 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 = FALSE; char* _tmp0_; char* _tmp1_ = NULL; gboolean _tmp2_; char* _tmp3_; gboolean _tmp4_; gboolean _tmp5_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; if (contents != NULL) { *contents = 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 = FALSE; char* _tmp0_; gboolean _tmp1_; gboolean _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; g_return_val_if_fail (contents != NULL, FALSE); _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 = FALSE; ThunarVfsMimeDatabase* mime_db; ThunarVfsInfo* info; ThunarVfsMimeApplication* mime_app; GList* paths; ThunarVfsInfo* _tmp0_; ThunarVfsInfo* _tmp1_; gboolean _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; 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_); __g_list_free_thunar_vfs_path_unref0 (paths); _thunar_vfs_info_unref0 (info); 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_); __g_list_free_thunar_vfs_path_unref0 (paths); _thunar_vfs_info_unref0 (info); return FALSE; } result = _tmp2_; __g_list_free_thunar_vfs_path_unref0 (paths); _thunar_vfs_info_unref0 (info); return result; } /** * Note: not using a ThunarVfs.Job because they're async. */ 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 = NULL; GSList* children; GDir* dir; const char* child; GSList* _tmp2_; char* _tmp3_; GDir* _tmp4_; GDir* _tmp5_; GDir* _tmp6_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; 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_dir_close0 (dir); __g_slist_free_g_object_unref0 (children); 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_dir_close0 (dir); __g_slist_free_g_object_unref0 (children); return NULL; } dir = (_tmp6_ = _tmp5_, _g_dir_close0 (dir), _tmp6_); while (TRUE) { char* child_path; char* _tmp7_; char* _tmp8_; 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_dir_close0 (dir); __g_slist_free_g_object_unref0 (children); return NULL; } children = g_slist_append (children, _tmp9_); _g_free0 (child_path); } result = children; _g_dir_close0 (dir); return result; } /** * Note: not using a ThunarVfs.Job because they're async. */ static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error) { DesktopAgnosticVFSFileThunarVFS * self; gboolean result = FALSE; char* data; gsize length = 0UL; gboolean _tmp0_ = FALSE; gboolean _tmp3_ = FALSE; char* _tmp4_ = NULL; gboolean _tmp5_; char* _tmp6_; gboolean _tmp7_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; g_return_val_if_fail (destination != NULL, FALSE); 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; } /** * Note: not using a ThunarVfs.Job because they're async. */ static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_remove (DesktopAgnosticVFSFile* base, GError** error) { DesktopAgnosticVFSFileThunarVFS * self; gboolean result = FALSE; char* _tmp2_; gboolean _tmp3_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; 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; } static gboolean desktop_agnostic_vfs_file_thunar_vfs_real_is_native (DesktopAgnosticVFSFile* base) { DesktopAgnosticVFSFileThunarVFS * self; gboolean result = FALSE; self = (DesktopAgnosticVFSFileThunarVFS*) base; result = g_str_has_prefix (self->priv->_uri, "file:"); return result; } static char* desktop_agnostic_vfs_file_thunar_vfs_real_get_mime_type (DesktopAgnosticVFSFile* base, GError** error) { DesktopAgnosticVFSFileThunarVFS * self; char* result = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; result = g_strdup (thunar_vfs_mime_info_get_name (self->priv->_info->mime_info)); return result; } static char** desktop_agnostic_vfs_file_thunar_vfs_real_get_icon_names (DesktopAgnosticVFSFile* base, int* result_length1, GError** error) { DesktopAgnosticVFSFileThunarVFS * self; char** result = NULL; char* _tmp0_; char* _tmp1_; gint _tmp2_; char** _tmp3_; char** _tmp4_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileThunarVFS*) base; _tmp0_ = desktop_agnostic_vfs_file_get_mime_type ((DesktopAgnosticVFSFile*) self, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return NULL; } result = (_tmp4_ = (_tmp3_ = desktop_agnostic_vfs_get_icon_names_for_mime_type (_tmp1_ = _tmp0_, &_tmp2_), _g_free0 (_tmp1_), _tmp3_), *result_length1 = _tmp2_, _tmp4_); return result; } DesktopAgnosticVFSFileThunarVFS* desktop_agnostic_vfs_file_thunar_vfs_construct (GType object_type) { DesktopAgnosticVFSFileThunarVFS * self = NULL; 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)->is_native = desktop_agnostic_vfs_file_thunar_vfs_real_is_native; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_mime_type = desktop_agnostic_vfs_file_thunar_vfs_real_get_mime_type; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_icon_names = desktop_agnostic_vfs_file_thunar_vfs_real_get_icon_names; 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 volatile gsize desktop_agnostic_vfs_file_thunar_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_thunar_vfs_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_file_thunar_vfs_type_id; desktop_agnostic_vfs_file_thunar_vfs_type_id = g_type_register_static (DESKTOP_AGNOSTIC_VFS_TYPE_FILE, "DesktopAgnosticVFSFileThunarVFS", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_vfs_file_thunar_vfs_type_id__volatile, desktop_agnostic_vfs_file_thunar_vfs_type_id); } return desktop_agnostic_vfs_file_thunar_vfs_type_id__volatile; } 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_take_string (value, desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)); break; case DESKTOP_AGNOSTIC_VFS_FILE_THUNAR_VFS_IMPL_URI: g_value_take_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_take_object (value, desktop_agnostic_vfs_file_get_parent ((DesktopAgnosticVFSFile*) self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-gio.vapi0000664000175000017510000000521011537206465025250 0ustar seagleseagle/* da-vfs-gio.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_")] 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 (); public override string[] get_icon_names () throws GLib.Error; public override string get_mime_type () throws GLib.Error; public override string? get_thumbnail_path (); protected override void init (string uri); public override bool is_native (); 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.deps0000664000175000017510000000002711537206464027362 0ustar seagleseagledesktop-agnostic posix libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-client.c0000664000175000017510000014621211537206465025330 0ustar seagleseagle/* config-client.c generated by valac 0.10.4, 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 __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_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; #define _g_free0(var) (var = (g_free (var), NULL)) 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) G_GNUC_CONST; GType desktop_agnostic_config_client_get_type (void) G_GNUC_CONST; GType desktop_agnostic_config_schema_get_type (void) G_GNUC_CONST; GType desktop_agnostic_config_backend_get_type (void) G_GNUC_CONST; #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 }; 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); 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); 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); static void _vala_GValue_free (GValue* self); DesktopAgnosticConfigBackend* desktop_agnostic_config_new_for_instance (const char* instance_id, DesktopAgnosticConfigSchema* schema, GError** error); static DesktopAgnosticConfigBackend* desktop_agnostic_config_client_get_backend (DesktopAgnosticConfigClient* self, const char* group, const char* key); GType desktop_agnostic_config_schema_option_get_type (void) G_GNUC_CONST; 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); gboolean desktop_agnostic_config_client_get_bool (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); gboolean desktop_agnostic_config_backend_get_bool (DesktopAgnosticConfigBackend* 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); void desktop_agnostic_config_backend_set_bool (DesktopAgnosticConfigBackend* 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); gint desktop_agnostic_config_backend_get_int (DesktopAgnosticConfigBackend* 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); void desktop_agnostic_config_backend_set_int (DesktopAgnosticConfigBackend* 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); float desktop_agnostic_config_backend_get_float (DesktopAgnosticConfigBackend* 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); void desktop_agnostic_config_backend_set_float (DesktopAgnosticConfigBackend* 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); char* desktop_agnostic_config_backend_get_string (DesktopAgnosticConfigBackend* 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); void desktop_agnostic_config_backend_set_string (DesktopAgnosticConfigBackend* 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); GValueArray* desktop_agnostic_config_backend_get_list (DesktopAgnosticConfigBackend* 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_backend_set_list (DesktopAgnosticConfigBackend* 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_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_set_value (DesktopAgnosticConfigClient* self, const char* group, const char* key, GValue* value, 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_notify_add (DesktopAgnosticConfigClient* self, const char* group, const char* key, DesktopAgnosticConfigNotifyFunc callback, void* callback_target, 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 (DesktopAgnosticConfigClient* self, const char* group, const char* key, GError** error); void desktop_agnostic_config_backend_notify (DesktopAgnosticConfigBackend* 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_backend_notify_remove (DesktopAgnosticConfigBackend* 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_backend_reset (DesktopAgnosticConfigBackend* self, 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); GType desktop_agnostic_config_bridge_get_type (void) G_GNUC_CONST; 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_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 (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, GError** error); void desktop_agnostic_config_client_unbind_all_for_object (DesktopAgnosticConfigClient* self, GObject* obj, GError** error); void desktop_agnostic_config_bridge_remove_all_for_object (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, GObject* obj, GError** error); const char* desktop_agnostic_config_client_get_instance_id (DesktopAgnosticConfigClient* self); const char* desktop_agnostic_config_backend_get_instance_id (DesktopAgnosticConfigBackend* self); static void desktop_agnostic_config_client_set_instance_id (DesktopAgnosticConfigClient* self, const char* value); static void desktop_agnostic_config_client_set_schema_filename (DesktopAgnosticConfigClient* self, const char* value); 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 volatile gsize desktop_agnostic_config_bind_method_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_bind_method_type_id__volatile)) { 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}}; GType desktop_agnostic_config_bind_method_type_id; desktop_agnostic_config_bind_method_type_id = g_enum_register_static ("DesktopAgnosticConfigBindMethod", values); g_once_init_leave (&desktop_agnostic_config_bind_method_type_id__volatile, desktop_agnostic_config_bind_method_type_id); } return desktop_agnostic_config_bind_method_type_id__volatile; } DesktopAgnosticConfigClient* desktop_agnostic_config_client_construct (GType object_type, const char* schema_filename) { DesktopAgnosticConfigClient * self = NULL; g_return_val_if_fail (schema_filename != NULL, NULL); self = (DesktopAgnosticConfigClient*) g_object_new (object_type, "schema-filename", schema_filename, NULL); 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) { DesktopAgnosticConfigClient * self = NULL; g_return_val_if_fail (schema_filename != NULL, NULL); g_return_val_if_fail (instance_id != NULL, NULL); self = (DesktopAgnosticConfigClient*) g_object_new (object_type, "schema-filename", schema_filename, "instance-id", instance_id, NULL); 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); } /** * Auto-determines whether an instance config object should be created. */ 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) { DesktopAgnosticConfigClient * self = NULL; DesktopAgnosticConfigSchema* _tmp0_; GError * _inner_error_ = NULL; g_return_val_if_fail (schema != NULL, 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_unref0 (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) { DesktopAgnosticConfigBackend* _tmp0_; DesktopAgnosticConfigBackend* _tmp1_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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_); } /** * @return whether an instance config object was created. */ static void _vala_GValue_free (GValue* self) { g_value_unset (self); g_free (self); } static gboolean desktop_agnostic_config_client_create_instance_config (DesktopAgnosticConfigClient* self, const char* instance_id, GError** error) { gboolean result = FALSE; GValue* _tmp0_; GValue _tmp1_ = {0}; GValue _tmp2_; GValue single_instance; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (instance_id != NULL, FALSE); 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_))), __vala_GValue_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 = NULL; 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 = FALSE; gboolean _tmp0_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (group != NULL, FALSE); g_return_val_if_fail (key != NULL, FALSE); _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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = 0; gint _tmp0_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, 0); g_return_val_if_fail (group != NULL, 0); g_return_val_if_fail (key != NULL, 0); _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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = 0.0F; float _tmp0_; GError * _inner_error_ = NULL; 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); _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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = NULL; char* _tmp0_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (group != NULL, NULL); g_return_val_if_fail (key != NULL, 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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != NULL); g_return_if_fail (value != 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 = NULL; GValueArray* _tmp0_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (group != NULL, NULL); g_return_val_if_fail (key != NULL, 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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != NULL); g_return_if_fail (value != 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; } } /** * Retrieves the value of the configuration key. If the client has an * instance ID and the key cannot be found in the instance config, it * falls back to retrieving the value from the global config. */ 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) { GValue* temp_val; GValue val = {0}; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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 _tmp3_; GValue _tmp4_; GValue* _tmp5_; _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_)), __vala_GValue_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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; __vala_GValue_free0 (temp_val); goto __finally1; } } _g_error_free0 (err); } } __finally1: if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; __vala_GValue_free0 (temp_val); 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; __vala_GValue_free0 (temp_val); return; } val = (_tmp8_ = _tmp7_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp8_); } else { GValue _tmp9_ = {0}; GValue _tmp10_; 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; __vala_GValue_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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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_ = NULL; g_return_if_fail (self != 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; } } } /** * Binds a config key to a property of an object. * * @param group The configuration group. * @param key The configuration key. * @param obj The object to which to bind the config key. * @param property_name The name of the property to bind. Has an additional * use if //method// is {@link BindMethod.BOTH}. * @param read_only if TRUE, setting the object property does not propagate * to the config backend(s). * @param method The method of binding the config backend(s) to the object. * @see BindMethod */ 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) { DesktopAgnosticConfigBridge* bridge; DesktopAgnosticConfigSchemaOption* option; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; gboolean _tmp6_ = FALSE; gboolean _tmp7_ = FALSE; GError * _inner_error_ = NULL; 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); 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:309: Could not find the schema option for %s/%s, no" \ "t 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; } } } } /** * Removes the bindings between a config key and a GObject property. */ 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) { DesktopAgnosticConfigBridge* bridge; DesktopAgnosticConfigSchemaOption* option; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; gboolean _tmp6_ = FALSE; gboolean _tmp7_ = FALSE; GError * _inner_error_ = NULL; 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); 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:352: Could not find the schema option for %s/%s, no" \ "t 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; } } } } /** * Removes all of the bindings for a given object. */ void desktop_agnostic_config_client_unbind_all_for_object (DesktopAgnosticConfigClient* self, GObject* obj, GError** error) { DesktopAgnosticConfigBridge* bridge; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (obj != 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) { gboolean _tmp0_ = FALSE; GError * _inner_error_ = NULL; g_return_if_fail (self != 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 ther" \ "e 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_ = NULL; g_return_if_fail (self != 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); } /** * A wrapper for {@link Config.Backend} and {@link Config.Bridge} * which handles calls to the global and/or instance objects * of {@link Config.Backend}. * * NOTE: Unknown bizarre behavior may occur if one instantiates two instances * of this class using the same schema, but different instance IDs. */ GType desktop_agnostic_config_client_get_type (void) { static volatile gsize desktop_agnostic_config_client_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_client_type_id__volatile)) { 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 }; GType desktop_agnostic_config_client_type_id; desktop_agnostic_config_client_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigClient", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_client_type_id__volatile, desktop_agnostic_config_client_type_id); } return desktop_agnostic_config_client_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-bookmarks-gtk.c0000664000175000017510000007134511537206464026161 0ustar seagleseagle/* vfs-bookmarks-gtk.c generated by valac 0.10.4, 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) G_GNUC_CONST; GType desktop_agnostic_vfs_file_get_type (void) G_GNUC_CONST; #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) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_event_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_get_type (void) G_GNUC_CONST; #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); 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_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); 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); static void desktop_agnostic_vfs_gtk_bookmarks_set_file (DesktopAgnosticVFSGtkBookmarks* self, DesktopAgnosticVFSFile* value); 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 = NULL; 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); } /** * A representation of a simple bookmark. */ GType desktop_agnostic_vfs_bookmark_get_type (void) { static volatile gsize desktop_agnostic_vfs_bookmark_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_bookmark_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_bookmark_type_id; desktop_agnostic_vfs_bookmark_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSBookmark", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_vfs_bookmark_type_id__volatile, desktop_agnostic_vfs_bookmark_type_id); } return desktop_agnostic_vfs_bookmark_type_id__volatile; } 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); } /** * Creates a new parser object. * @param file the object representing the gtk bookmark file. if %NULL, * defaults to "~/.gtk-bookmarks" (defaults to %NULL) * @param monitor if %TRUE, monitors the file for changes, and notifies of * changes via the "changed" signal (defaults to %TRUE) */ 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) { DesktopAgnosticVFSGtkBookmarks * self = NULL; self = (DesktopAgnosticVFSGtkBookmarks*) g_object_new (object_type, "file", file, NULL); 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); } 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 = NULL; 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) { GSList* _tmp0_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); self->priv->_bookmarks = (_tmp0_ = NULL, __g_slist_free_g_object_unref0 (self->priv->_bookmarks), _tmp0_); { char* contents; gsize length = 0UL; gint lines_length1; gint _lines_size_; char** lines; char* _tmp1_ = NULL; char* _tmp2_; char** _tmp3_; char** _tmp4_; contents = NULL; lines = (lines_length1 = 0, NULL); desktop_agnostic_vfs_file_load_contents (self->priv->_file, &_tmp1_, &length, &_inner_error_); contents = (_tmp2_ = _tmp1_, _g_free0 (contents), _tmp2_); if (_inner_error_ != NULL) { lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL); _g_free0 (contents); goto __catch0_g_error; } lines = (_tmp4_ = _tmp3_ = g_strsplit (contents, "\n", 0), lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL), lines_length1 = _vala_array_length (_tmp3_), _lines_size_ = lines_length1, _tmp4_); { 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_length1; gint _tokens_size_; char** tokens; char** _tmp5_; char** _tmp6_; gboolean _tmp7_ = FALSE; tokens = (tokens_length1 = 0, NULL); if (_vala_strcmp0 (line, "") == 0) { tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); continue; } tokens = (_tmp6_ = _tmp5_ = g_strsplit (line, " ", 2), tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL), tokens_length1 = _vala_array_length (_tmp5_), _tokens_size_ = tokens_length1, _tmp6_); if (tokens != NULL) { _tmp7_ = tokens[0] != NULL; } else { _tmp7_ = FALSE; } if (_tmp7_) { DesktopAgnosticVFSBookmark* bookmark; char* _tmp8_; DesktopAgnosticVFSFile* _tmp9_; DesktopAgnosticVFSFile* _tmp10_; DesktopAgnosticVFSBookmark* _tmp12_; bookmark = desktop_agnostic_vfs_bookmark_new (); _tmp8_ = string_strip (tokens[0]); _g_free0 (_tmp8_); _tmp9_ = 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); lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL); _g_free0 (contents); goto __catch0_g_error; } desktop_agnostic_vfs_bookmark_set_file (bookmark, _tmp10_ = _tmp9_); _g_object_unref0 (_tmp10_); if (tokens[1] == NULL) { desktop_agnostic_vfs_bookmark_set_alias (bookmark, NULL); } else { char* _tmp11_; _tmp11_ = string_strip (tokens[1]); _g_free0 (_tmp11_); desktop_agnostic_vfs_bookmark_set_alias (bookmark, tokens[1]); } self->priv->_bookmarks = g_slist_append (self->priv->_bookmarks, (_tmp12_ = bookmark, bookmark = NULL, _tmp12_)); _g_object_unref0 (bookmark); } tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); } } } lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL); _g_free0 (contents); } goto __finally0; __catch0_g_error: { GError * err; err = _inner_error_; _inner_error_ = NULL; { GSList* _tmp13_; g_critical ("vfs-bookmarks-gtk.vala:134: Could not load/parse GTK bookmarks file: %" \ "s", err->message); self->priv->_bookmarks = (_tmp13_ = NULL, __g_slist_free_g_object_unref0 (self->priv->_bookmarks), _tmp13_); _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_ = NULL; g_return_if_fail (self != 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)); /** * Emitted when a monitor has been created for the bookmarks file, and its * contents have changed. */ 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); } /** * Parses .gtk-bookmarks files. */ GType desktop_agnostic_vfs_gtk_bookmarks_get_type (void) { static volatile gsize desktop_agnostic_vfs_gtk_bookmarks_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_gtk_bookmarks_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_gtk_bookmarks_type_id; desktop_agnostic_vfs_gtk_bookmarks_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSGtkBookmarks", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_vfs_gtk_bookmarks_type_id__volatile, desktop_agnostic_vfs_gtk_bookmarks_type_id); } return desktop_agnostic_vfs_gtk_bookmarks_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-keyfile.h0000664000175000017510000000356611537206466025370 0ustar seagleseagle/* da-cfg-keyfile.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic.vapi0000664000175000017510000000374311537206464026602 0ustar seagleseagle/* desktop-agnostic.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] 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; } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-type-color.h0000664000175000017510000000411611537206466026025 0ustar seagleseagle/* da-cfg-type-color.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-gnome.vapi0000664000175000017510000000110611537206467025553 0ustar seagleseagle/* da-fdo-gnome.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticFDO", lower_case_cprefix = "desktop_agnostic_fdo_")] 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-entry-impl-gnome.c0000664000175000017510000007613311537206467027467 0ustar seagleseagle/* desktop-entry-impl-gnome.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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** desktop_agnostic_fdo_desktop_entry_gnome_real_get_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key); static char** _vala_array_dup1 (char** self, int length); 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 GPid desktop_agnostic_fdo_desktop_entry_gnome_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); static void _g_list_free_g_free (GList* self); 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 = FALSE; 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 = FALSE; 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 = NULL; 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 = NULL; 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; 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 = NULL; char** _tmp0_; char** _tmp1_; 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 = FALSE; 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 = 0; GList* file_list; GnomeDesktopItemLaunchFlags lflags; gint _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGNOME*) base; 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; char* uri; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGNOME*) base; 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 = NULL; 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) { DesktopAgnosticFDODesktopEntryGNOME* self; GError * _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 i" \ "nitialized."); } } 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) { DesktopAgnosticFDODesktopEntryGNOME* self; GError * _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 i" \ "nitialized."); } } g_object_notify ((GObject *) self, "keyfile"); } static void desktop_agnostic_fdo_desktop_entry_gnome_real_set_data (DesktopAgnosticFDODesktopEntry* base, const char* value) { DesktopAgnosticFDODesktopEntryGNOME* self; gboolean _tmp0_ = FALSE; GError * _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 volatile gsize desktop_agnostic_fdo_desktop_entry_gnome_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_fdo_desktop_entry_gnome_type_id__volatile)) { 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}; GType desktop_agnostic_fdo_desktop_entry_gnome_type_id; 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); g_once_init_leave (&desktop_agnostic_fdo_desktop_entry_gnome_type_id__volatile, desktop_agnostic_fdo_desktop_entry_gnome_type_id); } return desktop_agnostic_fdo_desktop_entry_gnome_type_id__volatile; } 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_take_string (value, desktop_agnostic_fdo_desktop_entry_get_name ((DesktopAgnosticFDODesktopEntry*) self)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GNOME_ICON: g_value_take_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 = 0UL; 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/module.c0000664000175000017510000005145511537206464024077 0ustar seagleseagle/* module.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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); char** desktop_agnostic_module_loader_get_search_paths (int* result_length1); static char** _vala_array_dup1 (char** self, int length); 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 = NULL; 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 = NULL; 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 = NULL; 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 = 0UL; 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 = 0UL; 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* _tmp1_; char* _tmp2_; char* _tmp3_; char* _tmp4_; 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* _tmp6_; char* _tmp7_; char* _tmp8_; 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 = FALSE; 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 = NULL; 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 (path); _g_free0 (library); return result; } GType desktop_agnostic_module_loader_guess_module (DesktopAgnosticModuleLoader* self, const char* library_prefix) { GType result = 0UL; 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) { char* _tmp2_; GModule* _tmp3_; 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** _tmp0_ = NULL; char** _tmp1_; 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); } /** * Based on the PluginRegistrar class in * [[http://live.gnome.org/Vala/TypeModules]]. */ GType desktop_agnostic_module_loader_get_type (void) { static volatile gsize desktop_agnostic_module_loader_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_module_loader_type_id__volatile)) { 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 }; GType desktop_agnostic_module_loader_type_id; desktop_agnostic_module_loader_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticModuleLoader", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_module_loader_type_id__volatile, desktop_agnostic_module_loader_type_id); } return desktop_agnostic_module_loader_type_id__volatile; } GType desktop_agnostic_get_module_type (const char* prefix, const char* key, GError** error) { GType result = 0UL; DesktopAgnosticModuleLoader* loader; char* cfg_file; gboolean _tmp0_ = FALSE; GError * _inner_error_ = NULL; g_return_val_if_fail (prefix != NULL, 0UL); g_return_val_if_fail (key != NULL, 0UL); 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 (user_path); _g_free0 (system_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 (user_path); _g_free0 (system_path); _g_free0 (cfg_file); return 0UL; } _g_free0 (user_path); _g_free0 (system_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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.vapi0000664000175000017510000000627511537206465027354 0ustar seagleseagle/* desktop-agnostic-fdo.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticFDO", lower_case_cprefix = "desktop_agnostic_fdo_")] 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.vapi0000664000175000017510000000545011537206466026402 0ustar seagleseagle/* da-vfs-gnome-vfs.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_")] 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 (); public override string[] get_icon_names () throws GLib.Error; public override string get_mime_type () throws GLib.Error; protected override void init (string uri); public override bool is_native (); 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-type-color.deps0000664000175000017510000000007311537206466026527 0ustar seagleseagledesktop-agnostic-cfg desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-glib.vapi0000664000175000017510000000110111537206467025356 0ustar seagleseagle/* da-fdo-glib.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticFDO", lower_case_cprefix = "desktop_agnostic_fdo_")] 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.h0000664000175000017510000002730611537206466025676 0ustar seagleseagle/* da-vfs-gnome-vfs.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; GType desktop_agnostic_vfs_trash_volume_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-trash-impl-gio.c0000664000175000017510000004164311537206465026241 0ustar seagleseagle/* vfs-trash-impl-gio.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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_on_trash_changed (DesktopAgnosticVFSTrashGIO* self, DesktopAgnosticVFSFileMonitor* monitor, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* other_file, DesktopAgnosticVFSFileMonitorEvent event_type); static void desktop_agnostic_vfs_trash_gio_update_file_count (DesktopAgnosticVFSTrashGIO* self); 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); g_object_unref (self); } 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, g_object_ref (self)); _g_object_unref0 (dir); } static void desktop_agnostic_vfs_trash_gio_on_trash_count (DesktopAgnosticVFSTrashGIO* self, GObject* obj, GAsyncResult* res) { GFile* dir; GFileInfo* file_info; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (res != 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 __catch3_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 __finally3; __catch3_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); } } __finally3: if (_inner_error_ != NULL) { _g_object_unref0 (file_info); _g_object_unref0 (dir); 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 (file_info); _g_object_unref0 (dir); } static void desktop_agnostic_vfs_trash_gio_do_empty (DesktopAgnosticVFSTrashGIO* self, GFile* dir) { GFileEnumerator* files; GFileInfo* info; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (dir != 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 __catch4_g_error; } files = (_tmp1_ = _tmp0_, _g_object_unref0 (files), _tmp1_); _g_free0 (attrs); } goto __finally4; __catch4_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); } } __finally4: if (_inner_error_ != NULL) { _g_object_unref0 (info); _g_object_unref0 (files); 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 (info); _g_object_unref0 (files); 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 (info); _g_object_unref0 (files); 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 __catch5_g_error; } } goto __finally5; __catch5_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); } } __finally5: if (_inner_error_ != NULL) { _g_object_unref0 (child); _g_object_unref0 (info); _g_object_unref0 (files); 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 (info); _g_object_unref0 (files); } static void desktop_agnostic_vfs_trash_gio_real_send_to_trash (DesktopAgnosticVFSTrash* base, DesktopAgnosticVFSFile* uri, GError** error) { DesktopAgnosticVFSTrashGIO * self; GFile* file; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSTrashGIO*) base; g_return_if_fail (uri != 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 = NULL; self = (DesktopAgnosticVFSTrashGIO*) g_object_new (object_type, 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 volatile gsize desktop_agnostic_vfs_trash_gio_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_trash_gio_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_trash_gio_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_trash_gio_type_id__volatile, desktop_agnostic_vfs_trash_gio_type_id); } return desktop_agnostic_vfs_trash_gio_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-volume-impl-gio.c0000664000175000017510000012733511537206465026432 0ustar seagleseagle/* vfs-volume-impl-gio.c generated by valac 0.10.4, 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))) #define __g_list_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_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) G_GNUC_CONST; #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_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); static void _desktop_agnostic_vfs_volume_gio_on_mount_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); 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_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); static void _desktop_agnostic_vfs_volume_gio_on_unmount_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); 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_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); static void _desktop_agnostic_vfs_volume_gio_on_eject_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); 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) G_GNUC_CONST; #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 void _g_list_free_g_object_unref (GList* 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 gint _vala_array_length (gpointer array); static gboolean desktop_agnostic_vfs_volume_gio_real_is_mounted (DesktopAgnosticVFSVolume* base) { DesktopAgnosticVFSVolumeGIO * self; gboolean result = FALSE; 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), NULL), 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); g_object_unref (self); } 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), NULL), 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, g_object_ref (self)); } } static gboolean desktop_agnostic_vfs_volume_gio_real_mount_finish (DesktopAgnosticVFSVolume* base, GError** error) { DesktopAgnosticVFSVolumeGIO * self; gboolean result = FALSE; gboolean _result_; GAsyncResult* _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeGIO*) base; _result_ = FALSE; { gboolean _tmp0_; _tmp0_ = g_volume_mount_finish (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_MOUNT, 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 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), NULL), 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); g_object_unref (self); } 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), NULL), 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, g_object_ref (self)); } } } static gboolean desktop_agnostic_vfs_volume_gio_real_unmount_finish (DesktopAgnosticVFSVolume* base, GError** error) { DesktopAgnosticVFSVolumeGIO * self; gboolean result = FALSE; gboolean _result_; GAsyncResult* _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeGIO*) base; _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 __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_UNMOUNT, 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; } static gboolean desktop_agnostic_vfs_volume_gio_real_can_eject (DesktopAgnosticVFSVolume* base) { DesktopAgnosticVFSVolumeGIO * self; gboolean result = FALSE; 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), NULL), 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); g_object_unref (self); } 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), NULL), 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, g_object_ref (self)); } } static gboolean desktop_agnostic_vfs_volume_gio_real_eject_finish (DesktopAgnosticVFSVolume* base, GError** error) { DesktopAgnosticVFSVolumeGIO * self; gboolean result = FALSE; gboolean _result_; GAsyncResult* _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeGIO*) base; _result_ = FALSE; { gboolean _tmp0_; _tmp0_ = g_volume_eject_finish (self->priv->vol, self->priv->async_result, &_inner_error_); if (_inner_error_ != NULL) { goto __catch8_g_error; } _result_ = _tmp0_; } goto __finally8; __catch8_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 __finally8; } _g_error_free0 (err); } } __finally8: 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 = NULL; 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) { DesktopAgnosticVFSFile* result; DesktopAgnosticVFSVolumeGIO* self; GError * _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)) { gint icon_names_length1; gint _icon_names_size_; char** _tmp1_; char** _tmp0_; char** icon_names; icon_names = (_tmp1_ = (char**) (_tmp0_ = g_themed_icon_get_names (G_THEMED_ICON (icon))), icon_names_length1 = _vala_array_length (_tmp0_), _icon_names_size_ = icon_names_length1, _tmp1_); if (icon_names_length1 > 0) { char* _tmp2_; self->priv->_icon = (_tmp2_ = g_strdup (icon_names[0]), _g_free0 (self->priv->_icon), _tmp2_); } else { char* _tmp3_; self->priv->_icon = (_tmp3_ = g_strdup ("drive-harddisk"), _g_free0 (self->priv->_icon), _tmp3_); } } else { if (G_IS_FILE_ICON (icon)) { char* path; char* _tmp4_; path = g_file_get_path (g_file_icon_get_file (G_FILE_ICON (icon))); self->priv->_icon = (_tmp4_ = g_strdup (path), _g_free0 (self->priv->_icon), _tmp4_); _g_free0 (path); } else { char* _tmp5_; g_warning ("vfs-volume-impl-gio.vala:90: Unknown icon type: %s", g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) icon))); self->priv->_icon = (_tmp5_ = g_strdup ("drive-harddisk"), _g_free0 (self->priv->_icon), _tmp5_); } } _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), NULL); 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), NULL); 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), NULL); 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 volatile gsize desktop_agnostic_vfs_volume_gio_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_gio_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_volume_gio_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_gio_type_id__volatile, desktop_agnostic_vfs_volume_gio_type_id); } return desktop_agnostic_vfs_volume_gio_type_id__volatile; } 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_take_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 = NULL; GObject* _tmp0_; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (vol != NULL, NULL); result = DESKTOP_AGNOSTIC_VFS_VOLUME ((_tmp0_ = g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GIO, "implementation", vol, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gio_check_volume (DesktopAgnosticVFSVolumeMonitorGIO* self, GVolume* gvol) { DesktopAgnosticVFSVolume* result = NULL; 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 = NULL; 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 = NULL; self = (DesktopAgnosticVFSVolumeMonitorGIO*) g_object_new (object_type, 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 void _g_list_free_g_object_unref (GList* self) { g_list_foreach (self, (GFunc) g_object_unref, NULL); g_list_free (self); } 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_volume_monitor_get (), _g_object_unref0 (self->priv->monitor), _tmp0_); self->priv->_volumes = (_tmp1_ = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref), _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); __g_list_free_g_object_unref0 (vols); } 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 volatile gsize desktop_agnostic_vfs_volume_monitor_gio_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_monitor_gio_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_volume_monitor_gio_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_monitor_gio_type_id__volatile, desktop_agnostic_vfs_volume_monitor_gio_type_id); } return desktop_agnostic_vfs_volume_monitor_gio_type_id__volatile; } 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; } } static gint _vala_array_length (gpointer array) { int length; length = 0; if (array) { while (((gpointer*) array)[length]) { length++; } } return length; } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs.c0000664000175000017510000003472611537206464023412 0ustar seagleseagle/* vfs.c generated by valac 0.10.4, 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) G_GNUC_CONST; GQuark desktop_agnostic_vfs_volume_error_quark (void); GType desktop_agnostic_vfs_volume_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_monitor_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_implementation_get_type (void) G_GNUC_CONST; 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; /** * The (unique) name of the implementation. */ 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 volatile gsize desktop_agnostic_vfs_implementation_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_implementation_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_implementation_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_implementation_type_id__volatile, desktop_agnostic_vfs_implementation_type_id); } return desktop_agnostic_vfs_implementation_type_id__volatile; } DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error) { DesktopAgnosticVFSImplementation* result = NULL; GError * _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 { GObject* _tmp0_; DesktopAgnosticVFSImplementation* _tmp1_; desktop_agnostic_vfs_vfs = (_tmp1_ = DESKTOP_AGNOSTIC_VFS_IMPLEMENTATION ((_tmp0_ = g_object_new (type, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)), _g_object_unref0 (desktop_agnostic_vfs_vfs), _tmp1_); } } result = desktop_agnostic_vfs_vfs; return result; } /** * Initializes the VFS, if the backend needs it. */ void desktop_agnostic_vfs_init (GError** error) { DesktopAgnosticVFSImplementation* vfs; GError * _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); } } /** * Shuts down the VFS, if the backend needs it. */ void desktop_agnostic_vfs_shutdown (GError** error) { DesktopAgnosticVFSImplementation* vfs; GError * _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); } } /** * Creates a list of files based on a newline-delimited list of URIs. */ GSList* desktop_agnostic_vfs_files_from_uri_list (const char* uri_list, GError** error) { GSList* result = NULL; DesktopAgnosticVFSImplementation* vfs; GError * _inner_error_ = NULL; g_return_val_if_fail (uri_list != NULL, 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-impl-gio.c0000664000175000017510000005167711537206465025132 0ustar seagleseagle/* vfs-impl-gio.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 GSList* desktop_agnostic_vfs_gio_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error); static void _g_slist_free_g_object_unref (GSList* self); static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_gio_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base); 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) G_GNUC_CONST; 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) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_gio_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_trash_gio_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_gio_get_type (void) G_GNUC_CONST; 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 = NULL; GSList* files; gint uris_length1; gint _uris_size_; char** _tmp1_; char** _tmp0_; char** uris; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSGIOImplementation*) base; g_return_val_if_fail (uri_list != NULL, 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_); uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL); __g_slist_free_g_object_unref0 (files); 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 = NULL; 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 = NULL; 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 volatile gsize desktop_agnostic_vfs_gio_implementation_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_gio_implementation_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_gio_implementation_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_gio_implementation_type_id__volatile, desktop_agnostic_vfs_gio_implementation_type_id); } return desktop_agnostic_vfs_gio_implementation_type_id__volatile; } 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 = 0UL; 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; } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-thunar-vfs.c0000664000175000017510000003733711537206465031050 0ustar seagleseagle/* vfs-file-monitor-impl-thunar-vfs.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 }; GType desktop_agnostic_vfs_file_thunar_vfs_get_type (void) G_GNUC_CONST; 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_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); 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 = NULL; 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_ = NULL; 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); { 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 = FALSE; 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 volatile gsize desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id__volatile, desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id); } return desktop_agnostic_vfs_file_monitor_thunar_vfs_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-impl-gnome-vfs.c0000664000175000017510000005253111537206466026244 0ustar seagleseagle/* vfs-impl-gnome-vfs.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 GSList* desktop_agnostic_vfs_gnome_vfs_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error); static void _g_slist_free_g_object_unref (GSList* self); static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_gnome_vfs_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base); 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) G_GNUC_CONST; 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) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_gnome_vfs_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_trash_gnome_vfs_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_gnome_vfs_get_type (void) G_GNUC_CONST; 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 = NULL; GSList* files; GList* uris; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSGnomeVFSImplementation*) base; g_return_val_if_fail (uri_list != NULL, 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_object_unref0 (file); _g_free0 (uri_str); } } } result = files; return result; } static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_gnome_vfs_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base) { DesktopAgnosticVFSGnomeVFSImplementation * self; DesktopAgnosticVFSVolumeMonitor* result = NULL; 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 = NULL; 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 volatile gsize desktop_agnostic_vfs_gnome_vfs_implementation_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_gnome_vfs_implementation_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_gnome_vfs_implementation_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_gnome_vfs_implementation_type_id__volatile, desktop_agnostic_vfs_gnome_vfs_implementation_type_id); } return desktop_agnostic_vfs_gnome_vfs_implementation_type_id__volatile; } 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 = 0UL; result = DESKTOP_AGNOSTIC_VFS_TYPE_GNOME_VFS_IMPLEMENTATION; return result; } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-schema-option.c0000664000175000017510000015450211537206465026621 0ustar seagleseagle/* config-schema-option.c generated by valac 0.10.4, 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 __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL))) #define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL))) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (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_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) G_GNUC_CONST; #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 _vala_GValue_free (GValue* 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); 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); 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) G_GNUC_CONST; 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 void desktop_agnostic_config_schema_option_set_lower_boundary (DesktopAgnosticConfigSchemaOption* self, GValue* value); static GValue* _g_value_dup (GValue* self); 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); static void _vala_GValue_free (GValue* self) { g_value_unset (self); g_free (self); } /** * Parses a schema option from the specification in the schema configuration * file. * @param schema the schema configuration file * @param group the group associated with the configuration option * @param key the name of the configuration option * @throws Error if any required field for the option is not present, or if * any value could not be parsed correctly */ DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_option_construct (GType object_type, GKeyFile** schema, const char* group, const char* key, GError** error) { DesktopAgnosticConfigSchemaOption * self = NULL; char* _tmp0_; char* _tmp1_; char* full_key; char* _tmp2_; char* _tmp3_; char* _tmp4_; char* _tmp5_; char* _tmp6_; char* _tmp7_; gboolean _tmp8_; GError * _inner_error_ = 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); 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_unref0 (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_unref0 (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_unref0 (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_unref0 (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_unref0 (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_unref0 (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); } /** * Determines which GType (and possibly list GType for list types) is described by a string. */ 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); } } /** * Converts a string into a simple type (i.e., not a list). */ 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 = 0UL; GType type = 0UL; const char* _tmp0_; GQuark _tmp1_; 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")))) switch (0) { default: { type = G_TYPE_BOOLEAN; break; } } else if (_tmp1_ == ((0 != _tmp1__label1) ? _tmp1__label1 : (_tmp1__label1 = g_quark_from_static_string ("integer")))) switch (0) { default: { type = G_TYPE_INT; break; } } else if (_tmp1_ == ((0 != _tmp1__label2) ? _tmp1__label2 : (_tmp1__label2 = g_quark_from_static_string ("float")))) switch (0) { default: { type = G_TYPE_FLOAT; break; } } else if (_tmp1_ == ((0 != _tmp1__label3) ? _tmp1__label3 : (_tmp1__label3 = g_quark_from_static_string ("string")))) switch (0) { default: { type = G_TYPE_STRING; break; } } else switch (0) { default: { 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; } } 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) { char* key; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (schema != NULL); g_return_if_fail (group != NULL); key = g_strdup ("default"); { if (self->priv->_option_type == G_TYPE_BOOLEAN) { gboolean _tmp0_; GValue _tmp1_ = {0}; GValue _tmp2_; _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 _tmp4_ = {0}; GValue _tmp5_; _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 _tmp7_ = {0}; GValue _tmp8_; _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 _tmp10_ = {0}; GValue _tmp11_; _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 = (_tmp11_ = (g_value_init (&_tmp10_, G_TYPE_STRING), g_value_take_string (&_tmp10_, _tmp9_), _tmp10_), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp11_); } else { DesktopAgnosticConfigSchemaType* st; st = _g_object_ref0 (desktop_agnostic_config_schema_find_type (self->priv->_option_type)); if (st != NULL) { char* _tmp12_; char* _tmp13_; GValue _tmp14_ = {0}; GValue _tmp15_; GValue _tmp16_; GValue _tmp17_; _tmp12_ = 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; } _tmp16_ = (_tmp15_ = (desktop_agnostic_config_schema_type_deserialize (st, _tmp13_ = _tmp12_, &_tmp14_, &_inner_error_), _tmp14_), _g_free0 (_tmp13_), _tmp15_); 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 = (_tmp17_ = _tmp16_, G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp17_); } else { if (self->priv->_option_type == G_TYPE_VALUE_ARRAY) { GValueArray* array; char* _tmp18_; char* _tmp19_; gboolean _tmp20_; GValue _tmp53_ = {0}; GValue _tmp54_; array = NULL; _tmp18_ = 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 ((_tmp20_ = _vala_strcmp0 (_tmp19_ = _tmp18_, "") == 0, _g_free0 (_tmp19_), _tmp20_)) { GValueArray* _tmp21_; array = (_tmp21_ = g_value_array_new ((guint) 0), _g_value_array_free0 (array), _tmp21_); } else { if (self->priv->_list_type == G_TYPE_BOOLEAN) { gint list_length1; gint _list_size_; gboolean* _tmp23_; gsize _tmp22_; gboolean* list; GValueArray* _tmp24_; list = (_tmp23_ = g_key_file_get_boolean_list (schema, group, key, &_tmp22_, &_inner_error_), list_length1 = _tmp22_, _list_size_ = list_length1, _tmp23_); 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 = (_tmp24_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp24_); { 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 _tmp25_ = {0}; GValue _tmp26_; val = (_tmp26_ = (g_value_init (&_tmp25_, G_TYPE_BOOLEAN), g_value_set_boolean (&_tmp25_, item), _tmp25_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp26_); 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 list_length1; gint _list_size_; gint* _tmp28_; gsize _tmp27_; gint* list; GValueArray* _tmp29_; list = (_tmp28_ = g_key_file_get_integer_list (schema, group, key, &_tmp27_, &_inner_error_), list_length1 = _tmp27_, _list_size_ = list_length1, _tmp28_); 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 = (_tmp29_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp29_); { 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 _tmp30_ = {0}; GValue _tmp31_; val = (_tmp31_ = (g_value_init (&_tmp30_, G_TYPE_INT), g_value_set_int (&_tmp30_, item), _tmp30_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp31_); 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) { gint list_length1; gint _list_size_; double* _tmp33_; gsize _tmp32_; double* list; GValueArray* _tmp34_; list = (_tmp33_ = g_key_file_get_double_list (schema, group, key, &_tmp32_, &_inner_error_), list_length1 = _tmp32_, _list_size_ = list_length1, _tmp33_); 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 = (_tmp34_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp34_); { 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 _tmp35_ = {0}; GValue _tmp36_; val = (_tmp36_ = (g_value_init (&_tmp35_, G_TYPE_FLOAT), g_value_set_float (&_tmp35_, (float) item), _tmp35_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp36_); 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) { gint list_length1; gint _list_size_; char** _tmp38_; gsize _tmp37_; char** list; GValueArray* _tmp39_; list = (_tmp38_ = g_key_file_get_string_list (schema, group, key, &_tmp37_, &_inner_error_), list_length1 = _tmp37_, _list_size_ = list_length1, _tmp38_); 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 = (_tmp39_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp39_); { 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 _tmp40_ = {0}; GValue _tmp41_; val = (_tmp41_ = (g_value_init (&_tmp40_, G_TYPE_STRING), g_value_set_string (&_tmp40_, item), _tmp40_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp41_); 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* _tmp42_; st = (_tmp42_ = _g_object_ref0 (desktop_agnostic_config_schema_find_type (self->priv->_list_type)), _g_object_unref0 (st), _tmp42_); if (st == NULL) { char* _tmp43_; char* _tmp44_; GError* _tmp45_; _tmp43_ = 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_ = (_tmp45_ = 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), _tmp44_ = _tmp43_), _g_free0 (_tmp44_), _tmp45_); { _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 { gint list_length1; gint _list_size_; char** _tmp47_; gsize _tmp46_; char** list; GValueArray* _tmp48_; list = (_tmp47_ = g_key_file_get_string_list (schema, group, key, &_tmp46_, &_inner_error_), list_length1 = _tmp46_, _list_size_ = list_length1, _tmp47_); 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 = (_tmp48_ = g_value_array_new ((guint) list_length1), _g_value_array_free0 (array), _tmp48_); { 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 _tmp49_ = {0}; GValue _tmp50_; GValue _tmp51_; GValue _tmp52_; _tmp50_ = (desktop_agnostic_config_schema_type_deserialize (st, item, &_tmp49_, &_inner_error_), _tmp49_); 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, (_tmp52_ = _tmp51_ = _tmp50_, &_tmp52_)); G_IS_VALUE (&_tmp51_) ? (g_value_unset (&_tmp51_), NULL) : NULL; } } } list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); } } } } } } self->priv->_default_value = (_tmp54_ = (g_value_init (&_tmp53_, G_TYPE_VALUE_ARRAY), g_value_set_boxed (&_tmp53_, array), _tmp53_), G_IS_VALUE (&self->priv->_default_value) ? (g_value_unset (&self->priv->_default_value), NULL) : NULL, _tmp54_); _g_value_array_free0 (array); } else { char* _tmp55_; char* _tmp56_; GError* _tmp57_; _tmp55_ = 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_ = (_tmp57_ = 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), _tmp56_ = _tmp55_), _g_free0 (_tmp56_), _tmp57_); { _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 = NULL; char* _result_; gboolean _tmp0_; GError * _inner_error_ = NULL; 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); _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 _tmp0_ = {0}; GValue _tmp1_; 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), __vala_GValue_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), __vala_GValue_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; /** * The type of the configuration option. Can be one of the following types * (as represented by GType): boolean, integer, float, string, color, list * (AKA ValueArray). If something weird happened, the type is "invalid". */ 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)); /** * If the configuration option type is a list (AKA ValueArray), the type * of values that the list holds. Can be one of the following: boolean, * integer, float, string, color. Otherwise, the list type is "invalid". */ 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)); /** * The default value of the configuration option. Its value type depends on * the option type, and potentially the list type. */ 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)); /** * The description of the configuration option. */ 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)); /** * A summary of the configuration option. This is an optional piece of * metadata. */ 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)); /** * A list of values that the configuration option may only be set to. This * is an optional piece of metadata that is applicable for all types except * boolean. For simple types, the standard usage is observed. For lists, * this is a list of values that can only appear as elements in the list. * Note that if a blacklist is also present, then the whitelist takes * precedence. */ 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)); /** * A list of values that the configuration option may not be set to. This is * an optional piece of metadata that is applicable for all types except * boolean. For simple types, the standard usage is observed. For lists, * this is a list of values that cannot appear as elements in the list. Note * that if a whitelist is also present, then the whitelist takes precedence. */ 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)); /** * Determines whether a configuration option is per instance, or applied * towards all instances of the configuration. Defaults to true. Note that * this option only applies if the "single_instance" metadata key is false. */ 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); __vala_GValue_free0 (self->priv->_lower_boundary); __vala_GValue_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); } /** * A representation of one configuration option as defined by the schema. */ GType desktop_agnostic_config_schema_option_get_type (void) { static volatile gsize desktop_agnostic_config_schema_option_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_schema_option_type_id__volatile)) { 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 }; GType desktop_agnostic_config_schema_option_type_id; desktop_agnostic_config_schema_option_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigSchemaOption", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_schema_option_type_id__volatile, desktop_agnostic_config_schema_option_type_id); } return desktop_agnostic_config_schema_option_type_id__volatile; } static void desktop_agnostic_config_schema_option_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { DesktopAgnosticConfigSchemaOption * self; GValue boxed0; 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: desktop_agnostic_config_schema_option_get_default_value (self, &boxed0); g_value_set_boxed (value, &boxed0); 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_take_boxed (value, desktop_agnostic_config_schema_option_get_whitelist (self)); break; case DESKTOP_AGNOSTIC_CONFIG_SCHEMA_OPTION_BLACKLIST: g_value_take_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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-impl-thunar-vfs.c0000664000175000017510000005316611537206465026444 0ustar seagleseagle/* vfs-impl-thunar-vfs.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 GSList* desktop_agnostic_vfs_thunar_vfs_implementation_real_files_from_uri_list (DesktopAgnosticVFSImplementation* base, const char* uri_list, GError** error); static void _g_slist_free_g_object_unref (GSList* self); static DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_thunar_vfs_implementation_real_volume_monitor_get_default (DesktopAgnosticVFSImplementation* base); 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) G_GNUC_CONST; 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) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_thunar_vfs_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_trash_thunar_vfs_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_thunar_vfs_get_type (void) G_GNUC_CONST; 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 = NULL; GSList* files; GList* paths; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSThunarVFSImplementation*) base; g_return_val_if_fail (uri_list != NULL, 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 = NULL; 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 = NULL; 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 volatile gsize desktop_agnostic_vfs_thunar_vfs_implementation_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_thunar_vfs_implementation_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_thunar_vfs_implementation_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_thunar_vfs_implementation_type_id__volatile, desktop_agnostic_vfs_thunar_vfs_implementation_type_id); } return desktop_agnostic_vfs_thunar_vfs_implementation_type_id__volatile; } 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 = 0UL; result = DESKTOP_AGNOSTIC_VFS_TYPE_THUNAR_VFS_IMPLEMENTATION; return result; } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gio.c0000664000175000017510000003614611537206465027526 0ustar seagleseagle/* vfs-file-monitor-impl-gio.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 }; GType desktop_agnostic_vfs_file_gio_get_type (void) G_GNUC_CONST; 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_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); 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) { DesktopAgnosticVFSFileMonitorGIO * self = NULL; DesktopAgnosticVFSFile* _tmp0_; GFile* impl; GError * _inner_error_ = NULL; g_return_val_if_fail (file != NULL, 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) { DesktopAgnosticVFSFile* other_file; DesktopAgnosticVFSFileMonitorEvent da_event = 0; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (monitor != NULL); g_return_if_fail (file != 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 = FALSE; 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 volatile gsize desktop_agnostic_vfs_file_monitor_gio_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_monitor_gio_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_file_monitor_gio_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_file_monitor_gio_type_id__volatile, desktop_agnostic_vfs_file_monitor_gio_type_id); } return desktop_agnostic_vfs_file_monitor_gio_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-entry-impl-glib.c0000664000175000017510000017061411537206467027276 0ustar seagleseagle/* desktop-entry-impl-glib.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 GPid desktop_agnostic_fdo_desktop_entry_glib_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); static void _g_slist_free_g_free (GSList* self); 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 = FALSE; gboolean _tmp0_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; g_return_val_if_fail (key != NULL, FALSE); 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 = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; g_return_val_if_fail (key != NULL, FALSE); { 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: { 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 = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; g_return_val_if_fail (key != NULL, 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: { 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 = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; g_return_val_if_fail (key != NULL, 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: { 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 = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; g_return_val_if_fail (key != NULL, NULL); { gint _tmp1__length1; gint __tmp1__size_; char** _tmp2_; 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: { 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, (const gchar* const*) value, _vala_array_length (value)); } /** * Based on EggDesktopFile's egg_desktop_file_can_launch(). */ static gboolean desktop_agnostic_fdo_desktop_entry_glib_real_exists (DesktopAgnosticFDODesktopEntry* base) { DesktopAgnosticFDODesktopEntryGLib * self; gboolean result = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; switch (desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)) { case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: { gboolean _tmp0_; char* exec; gint argv_length1; gint _argv_size_; char** _tmp4_; 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* _tmp1_; char* _tmp2_; 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) { argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); 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; argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); return result; } result = (_tmp9_ = (_tmp8_ = g_find_program_in_path (argv[0])) != NULL, _g_free0 (_tmp8_), _tmp9_); argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); return result; argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); } 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_object_unref0 (file); _g_free0 (uri); return result; } else { result = FALSE; return result; } } default: { result = FALSE; return result; } } } /** * Ported from EggDesktopFile. */ static gboolean string_contains (const char* self, const char* needle) { gboolean result = FALSE; 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, (gssize) (-1)); return result; } static char* string_substring (const char* self, glong offset, glong len) { char* result = NULL; glong string_length; const char* start; g_return_val_if_fail (self != NULL, NULL); string_length = string_get_length (self); 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 = NULL; 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; } /** * Ported from EggDesktopFile. */ 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 = NULL; const char* _tmp7_; GQuark _tmp8_; 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 ("%")))) switch (0) { default: { result = g_strdup ("%"); return result; } } 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"))))) switch (0) { default: { 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* _tmp0_; char* _tmp1_; char* _tmp2_; _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; } } 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"))))) switch (0) { default: { 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; } } } else if (_tmp8_ == ((0 != _tmp8__label5) ? _tmp8__label5 : (_tmp8__label5 = g_quark_from_static_string ("i")))) switch (0) { default: { 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; } } } else if (_tmp8_ == ((0 != _tmp8__label6) ? _tmp8__label6 : (_tmp8__label6 = g_quark_from_static_string ("c")))) switch (0) { default: { 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; } } } else if (_tmp8_ == ((0 != _tmp8__label7) ? _tmp8__label7 : (_tmp8__label7 = g_quark_from_static_string ("k")))) switch (0) { default: { if (self->priv->_file == NULL) { result = g_strdup (""); return result; } else { result = desktop_agnostic_vfs_file_get_uri (self->priv->_file); return result; } } } 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"))))) switch (0) { default: { result = g_strdup (""); return result; } } else switch (0) { default: { g_warning ("desktop-entry-impl-glib.vala:436: Unrecognized %%-code '%%%s' in Exec.", code); result = g_strdup (""); return result; } } } /** * Ported from EggDesktopFile. */ static char* desktop_agnostic_fdo_desktop_entry_glib_parse_exec (DesktopAgnosticFDODesktopEntryGLib* self, GSList* documents) { char* result = NULL; char* exec; char* command; gboolean escape = FALSE; gboolean single_quot = FALSE; gboolean double_quot = FALSE; gboolean _tmp0_; char* _tmp1_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, 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 (command); _g_free0 (exec); 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 (command); _g_free0 (exec); 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* _tmp12_; char* _tmp13_; 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 = 0; gint argv_length1; gint _argv_size_; char** argv; GPid pid = 0; char* _tmp0_; gboolean _tmp1_; gboolean _tmp2_; gboolean _tmp3_ = FALSE; gboolean _tmp4_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, 0); 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; } } _tmp4_ = g_key_file_has_key (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, "Terminal", &_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; } if (_tmp4_) { _tmp3_ = desktop_agnostic_fdo_desktop_entry_get_boolean ((DesktopAgnosticFDODesktopEntry*) self, "Terminal"); } else { _tmp3_ = FALSE; } if (_tmp3_) { gint term_argv_length1; gint _term_argv_size_; char** _tmp5_; char** term_argv; char* check; char* _tmp6_; char** _tmp19_; char** _tmp20_; term_argv = (_tmp5_ = g_new0 (char*, (argv_length1 + 2) + 1), term_argv_length1 = argv_length1 + 2, _term_argv_size_ = term_argv_length1, _tmp5_); check = NULL; check = (_tmp6_ = g_find_program_in_path ("gnome-terminal"), _g_free0 (check), _tmp6_); if (check != NULL) { char* _tmp7_; char* _tmp8_; term_argv[0] = (_tmp7_ = g_strdup (check), _g_free0 (term_argv[0]), _tmp7_); term_argv[1] = (_tmp8_ = g_strdup ("-x"), _g_free0 (term_argv[1]), _tmp8_); } else { char* _tmp15_; char* _tmp16_; if (check == NULL) { char* _tmp9_; check = (_tmp9_ = g_find_program_in_path ("nxterm"), _g_free0 (check), _tmp9_); } if (check == NULL) { char* _tmp10_; check = (_tmp10_ = g_find_program_in_path ("color-xterm"), _g_free0 (check), _tmp10_); } if (check == NULL) { char* _tmp11_; check = (_tmp11_ = g_find_program_in_path ("rxvt"), _g_free0 (check), _tmp11_); } if (check == NULL) { char* _tmp12_; check = (_tmp12_ = g_find_program_in_path ("xterm"), _g_free0 (check), _tmp12_); } if (check == NULL) { char* _tmp13_; check = (_tmp13_ = g_find_program_in_path ("dtterm"), _g_free0 (check), _tmp13_); } if (check == NULL) { char* _tmp14_; check = (_tmp14_ = g_strdup ("xterm"), _g_free0 (check), _tmp14_); g_warning ("desktop-entry-impl-glib.vala:572: couldn't find a terminal, falling ba" \ "ck to xterm"); } term_argv[0] = (_tmp15_ = g_strdup (check), _g_free0 (term_argv[0]), _tmp15_); term_argv[1] = (_tmp16_ = g_strdup ("-e"), _g_free0 (term_argv[1]), _tmp16_); } { gint i; i = 0; { gboolean _tmp17_; _tmp17_ = TRUE; while (TRUE) { char* _tmp18_; if (!_tmp17_) { i++; } _tmp17_ = FALSE; if (!(i < argv_length1)) { break; } term_argv[i + 2] = (_tmp18_ = g_strdup (argv[i]), _g_free0 (term_argv[i + 2]), _tmp18_); } } } argv = (_tmp20_ = (_tmp19_ = term_argv, term_argv = NULL, _tmp19_), argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL), argv_length1 = term_argv_length1, _argv_size_ = argv_length1, _tmp20_); _g_free0 (check); term_argv = (_vala_array_free (term_argv, term_argv_length1, (GDestroyNotify) g_free), NULL); } 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; } /** * Based on EggDesktopFile's egg_desktop_file_launch(). * @return the PID of the last process launched. */ 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 = 0; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; 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_object_unref0 (file); _g_free0 (uri); return 0; } result = (GPid) 0; _g_object_unref0 (file); _g_free0 (uri); 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; DesktopAgnosticVFSFile* file; char* _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGLib*) base; 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_); _g_free0 (_tmp2_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_object_unref0 (file); return; } _g_object_unref0 (file); } DesktopAgnosticFDODesktopEntryGLib* desktop_agnostic_fdo_desktop_entry_glib_construct (GType object_type) { DesktopAgnosticFDODesktopEntryGLib * self = NULL; 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) { DesktopAgnosticFDODesktopEntryGLib* self; GError * _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 in" \ "itialized."); } 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* _tmp2_ = NULL; char* _tmp3_; data = NULL; desktop_agnostic_vfs_file_load_contents (self->priv->_file, &_tmp2_, &data_len, &_inner_error_); data = (_tmp3_ = _tmp2_, _g_free0 (data), _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) { DesktopAgnosticFDODesktopEntryGLib* self; GError * _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 in" \ "itialized."); } 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) { DesktopAgnosticFDODesktopEntryGLib* self; gboolean _tmp0_ = FALSE; GError * _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 i" \ "nitialized."); } 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; const char* _tmp0_; GQuark _tmp1_; 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")))) switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION; _g_free0 (type); return result; } } else if (_tmp1_ == ((0 != _tmp1__label1) ? _tmp1__label1 : (_tmp1__label1 = g_quark_from_static_string ("Link")))) switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK; _g_free0 (type); return result; } } else if (_tmp1_ == ((0 != _tmp1__label2) ? _tmp1__label2 : (_tmp1__label2 = g_quark_from_static_string ("Directory")))) switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY; _g_free0 (type); return result; } } else switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN; _g_free0 (type); return result; } } _g_free0 (type); } static void desktop_agnostic_fdo_desktop_entry_glib_real_set_entry_type (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryType value) { DesktopAgnosticFDODesktopEntryGLib* self; char* _tmp0_; self = (DesktopAgnosticFDODesktopEntryGLib*) base; desktop_agnostic_fdo_desktop_entry_set_string ((DesktopAgnosticFDODesktopEntry*) self, "Type", _tmp0_ = desktop_agnostic_fdo_desktop_entry_type_to_string (value)); _g_free0 (_tmp0_); 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** _tmp2_; char** _tmp3_; gint _tmp3__length1; char* _tmp4_; char** _tmp5_; char** _tmp6_; gint _tmp6__length1; char* _tmp7_; char** _tmp8_; char** _tmp9_; gint _tmp9__length1; char* _tmp10_; 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 volatile gsize desktop_agnostic_fdo_desktop_entry_glib_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_fdo_desktop_entry_glib_type_id__volatile)) { 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}; GType desktop_agnostic_fdo_desktop_entry_glib_type_id; 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); g_once_init_leave (&desktop_agnostic_fdo_desktop_entry_glib_type_id__volatile, desktop_agnostic_fdo_desktop_entry_glib_type_id); } return desktop_agnostic_fdo_desktop_entry_glib_type_id__volatile; } 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_take_string (value, desktop_agnostic_fdo_desktop_entry_get_name ((DesktopAgnosticFDODesktopEntry*) self)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GLIB_ICON: g_value_take_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 = 0UL; 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-ui.vapi0000664000175000017510000000362111537206467027213 0ustar seagleseagle/* desktop-agnostic-ui.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticUI", lower_case_cprefix = "desktop_agnostic_ui_")] namespace UI { [CCode (cheader_filename = "libdesktop-agnostic/ui.h")] public class ColorButton : Gtk.ColorButton { public ColorButton (); protected override void constructed (); public new void set_alpha (uint16 alpha); public new 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 = null, bool entry_type_sensitive = true); protected override void constructed (); public bool entry_type_sensitive { get; set construct; } 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 } } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-schema-type.c0000664000175000017510000003226311537206465026271 0ustar seagleseagle/* config-schema-type.c generated by valac 0.10.4, 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) G_GNUC_CONST; 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); /** * Converts a value into a string, to store in the configuration backend. * @param val the value to convert to a string * @return the string-serialized version of the value * @throws SchemaError if the schema type and the value type are different, * or if the serialization fails */ 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); } /** * Converts a serialized string into the corresponding value dictated by the * schema type. * @param serialized the string to convert into the value * @return a container containing the converted value * @throws SchemaError if the deserialization fails */ 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); } /** * Converts the default value specified by the schema into the corresponding * deserialized value. * @param schema the schema from which the default value will be parsed * @param group the configuration option's full group/key * @return the parsed default value * @throws SchemaError if the default value is not found, or could not be * parsed correctly. */ 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); } /** * Converts the default list value specified by the schema into the * corresponding deserialized value array. * @param schema the schema from which the default value will be parsed * @param group the configuration option's full group/key * @return the parsed default value(s) * @throws SchemaError if the default value is not found, or could not be * parsed correctly. */ 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 = NULL; 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; /** * The name of the schema type, used in the "type" and "list type" schema * options for for configuration keys. */ 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)); /** * The GType associated with the schema type. */ 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) { } /** * The definition of a custom schema type. That is, a schema type which is * neither one of the primitive types (boolean, integer, float, string) nor * a list. */ GType desktop_agnostic_config_schema_type_get_type (void) { static volatile gsize desktop_agnostic_config_schema_type_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_schema_type_type_id__volatile)) { 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 }; GType desktop_agnostic_config_schema_type_type_id; desktop_agnostic_config_schema_type_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigSchemaType", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); g_once_init_leave (&desktop_agnostic_config_schema_type_type_id__volatile, desktop_agnostic_config_schema_type_type_id); } return desktop_agnostic_config_schema_type_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-gio.deps0000664000175000017510000000005611537206465025247 0ustar seagleseaglegio-2.0 desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-entry.c0000664000175000017510000005774211537206465025430 0ustar seagleseagle/* desktop-entry.c generated by valac 0.10.4, 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; /** * Generic, DesktopEntry-related errors. */ 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) G_GNUC_CONST; GType desktop_agnostic_fdo_desktop_entry_type_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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); static GType* _g_type_dup (GType* self); 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); /** * Flags used when launching an application from a desktop entry. */ GType desktop_agnostic_fdo_desktop_entry_launch_flags_get_type (void) { static volatile gsize desktop_agnostic_fdo_desktop_entry_launch_flags_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_fdo_desktop_entry_launch_flags_type_id__volatile)) { 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}}; GType desktop_agnostic_fdo_desktop_entry_launch_flags_type_id; desktop_agnostic_fdo_desktop_entry_launch_flags_type_id = g_enum_register_static ("DesktopAgnosticFDODesktopEntryLaunchFlags", values); g_once_init_leave (&desktop_agnostic_fdo_desktop_entry_launch_flags_type_id__volatile, desktop_agnostic_fdo_desktop_entry_launch_flags_type_id); } return desktop_agnostic_fdo_desktop_entry_launch_flags_type_id__volatile; } /** * The kind of desktop entry. * * [[http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html]] */ GType desktop_agnostic_fdo_desktop_entry_type_get_type (void) { static volatile gsize desktop_agnostic_fdo_desktop_entry_type_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_fdo_desktop_entry_type_type_id__volatile)) { 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}}; GType desktop_agnostic_fdo_desktop_entry_type_type_id; desktop_agnostic_fdo_desktop_entry_type_type_id = g_enum_register_static ("DesktopAgnosticFDODesktopEntryType", values); g_once_init_leave (&desktop_agnostic_fdo_desktop_entry_type_type_id__volatile, desktop_agnostic_fdo_desktop_entry_type_type_id); } return desktop_agnostic_fdo_desktop_entry_type_type_id__volatile; } GQuark desktop_agnostic_fdo_desktop_entry_error_quark (void) { return g_quark_from_static_string ("desktop_agnostic_fdo_desktop_entry_error-quark"); } /** * Converts a DesktopEntryType to its string counterpart. */ char* desktop_agnostic_fdo_desktop_entry_type_to_string (DesktopAgnosticFDODesktopEntryType entry_type) { char* result = NULL; 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); } /** * Whether the path specified in the "Exec" key exists. if the entry type is * "Application", also checks to see if it's launchable. */ 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; /** * The file object which points to the desktop entry file. Cannot be * constructed in conjunction with either keyfile or data. * Note: these are really construct-only, but construct-only properties * don't work with GModules. */ 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)); /** * The URI of the desktop entry. Cannot be constructed with either file * or data. * Note: these are really construct-only, but construct-only properties * don't work with GModules. */ 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)); /** * The raw data that is formatted according to the desktop entry * specification. Cannot be constructed in conjunction with either file or * keyfile. * Note: these are really construct-only, but construct-only properties * don't work with GModules. */ 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)); /** * The type of desktop entry, corresponding to the "Type" key. */ 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 volatile gsize desktop_agnostic_fdo_desktop_entry_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_fdo_desktop_entry_type_id__volatile)) { 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 }; GType desktop_agnostic_fdo_desktop_entry_type_id; 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); g_once_init_leave (&desktop_agnostic_fdo_desktop_entry_type_id__volatile, desktop_agnostic_fdo_desktop_entry_type_id); } return desktop_agnostic_fdo_desktop_entry_type_id__volatile; } 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 = 0UL; GError * _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; } /** * Convenience method for creating a new desktop entry from scratch. */ DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new (GError** error) { DesktopAgnosticFDODesktopEntry* result = NULL; GType type; GError * _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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY ((_tmp0_ = g_object_new (type, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } /** * Convenience method for loading a desktop entry via a VFS.File. */ DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_file (DesktopAgnosticVFSFile* file, GError** error) { DesktopAgnosticFDODesktopEntry* result = NULL; GType type; GError * _inner_error_ = NULL; g_return_val_if_fail (file != NULL, 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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY ((_tmp0_ = g_object_new (type, "file", file, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } /** * Convenience method for loading a desktop entry from a KeyFile object. */ DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_keyfile (GKeyFile* keyfile, GError** error) { DesktopAgnosticFDODesktopEntry* result = NULL; GType type; GError * _inner_error_ = NULL; g_return_val_if_fail (keyfile != NULL, 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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY ((_tmp0_ = g_object_new (type, "keyfile", keyfile, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } /** * Convenience method for loading a desktop entry from a string of data. */ DesktopAgnosticFDODesktopEntry* desktop_agnostic_fdo_desktop_entry_new_for_data (const char* data, GError** error) { DesktopAgnosticFDODesktopEntry* result = NULL; GType type; GError * _inner_error_ = NULL; g_return_val_if_fail (data != NULL, 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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY ((_tmp0_ = g_object_new (type, "data", data, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs.h0000664000175000017510000005563111537206464023415 0ustar seagleseagle/* vfs.h generated by valac 0.10.4, 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); gboolean (*is_native) (DesktopAgnosticVFSFile* self); char* (*get_mime_type) (DesktopAgnosticVFSFile* self, GError** error); char** (*get_icon_names) (DesktopAgnosticVFSFile* self, int* result_length1, GError** error); char* (*get_thumbnail_path) (DesktopAgnosticVFSFile* self); 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) G_GNUC_CONST; GQuark desktop_agnostic_vfs_volume_error_quark (void); GType desktop_agnostic_vfs_volume_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_monitor_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_implementation_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; GType desktop_agnostic_vfs_access_flags_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_event_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_get_type (void) G_GNUC_CONST; 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); gboolean desktop_agnostic_vfs_file_is_native (DesktopAgnosticVFSFile* self); char* desktop_agnostic_vfs_file_get_mime_type (DesktopAgnosticVFSFile* self, GError** error); char** desktop_agnostic_vfs_file_get_icon_names (DesktopAgnosticVFSFile* self, int* result_length1, GError** error); char* desktop_agnostic_vfs_file_get_thumbnail_path (DesktopAgnosticVFSFile* self); 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); char** desktop_agnostic_vfs_get_icon_names_for_mime_type (const char* mime_type, int* result_length1); 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-fdo.deps0000664000175000017510000000004611537206465027336 0ustar seagleseagledesktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.c0000664000175000017510000012632611537206465027750 0ustar seagleseagle/* vfs-volume-impl-thunar-vfs.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 }; 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 void desktop_agnostic_vfs_volume_thunar_vfs_real_mount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_mount_gsource_func (gpointer self); 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 void desktop_agnostic_vfs_volume_thunar_vfs_real_unmount (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_unmount_gsource_func (gpointer self); 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 void desktop_agnostic_vfs_volume_thunar_vfs_real_eject (DesktopAgnosticVFSVolume* base, DesktopAgnosticVFSVolumeCallback callback, void* callback_target); static gboolean _desktop_agnostic_vfs_volume_thunar_vfs_do_eject_gsource_func (gpointer self); 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_set_implementation (DesktopAgnosticVFSVolumeThunarVFS* self, ThunarVfsVolume* value); 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) G_GNUC_CONST; #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) { DesktopAgnosticVFSVolumeThunarVFS * self = NULL; g_return_val_if_fail (impl != NULL, NULL); self = (DesktopAgnosticVFSVolumeThunarVFS*) g_object_new (object_type, "implementation", impl, NULL); 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 = FALSE; 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 = FALSE; 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), NULL), 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) { gboolean result; result = desktop_agnostic_vfs_volume_thunar_vfs_do_mount (self); return result; } 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), NULL), 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 = FALSE; gboolean _result_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeThunarVFS*) base; _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 = FALSE; 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), NULL), 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) { gboolean result; result = desktop_agnostic_vfs_volume_thunar_vfs_do_unmount (self); return result; } 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), NULL), 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 = FALSE; gboolean _result_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeThunarVFS*) base; _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 = FALSE; 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 = FALSE; 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), NULL), 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) { gboolean result; result = desktop_agnostic_vfs_volume_thunar_vfs_do_eject (self); return result; } 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), NULL), 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 = FALSE; gboolean _result_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeThunarVFS*) base; _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 = NULL; 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) { DesktopAgnosticVFSFile* result; DesktopAgnosticVFSVolumeThunarVFS* self; GError * _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), NULL); 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), NULL); 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), NULL); 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 volatile gsize desktop_agnostic_vfs_volume_thunar_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_thunar_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_volume_thunar_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_thunar_vfs_type_id__volatile, desktop_agnostic_vfs_volume_thunar_vfs_type_id); } return desktop_agnostic_vfs_volume_thunar_vfs_type_id__volatile; } 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_take_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 = NULL; 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 = NULL; 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 = NULL; self = (DesktopAgnosticVFSVolumeMonitorThunarVFS*) g_object_new (object_type, 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_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref), _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 volatile gsize desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id__volatile, desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id); } return desktop_agnostic_vfs_volume_monitor_thunar_vfs_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.c0000664000175000017510000023654211537206465027564 0ustar seagleseagle/* vfs-trash-impl-thunar-vfs.c generated by valac 0.10.4, 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; typedef struct _DBusObjectVTable _DBusObjectVTable; #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))) 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 _DBusObjectVTable { void (*register_object) (DBusConnection*, const char*, void*); }; 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; }; 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; XfceTrash* xfce_trash_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path); GType xfce_trash_get_type (void) G_GNUC_CONST; 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); static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object); static void _vala_dbus_unregister_object (gpointer connection, GObject* object); 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) G_GNUC_CONST; 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) G_GNUC_CONST; GType desktop_agnostic_vfs_trash_thunar_vfs_get_type (void) G_GNUC_CONST; #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_on_trash_changed (DesktopAgnosticVFSTrashThunarVFS* self, gboolean full); 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_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 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); } 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); } 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 volatile gsize xfce_trash_type_id__volatile = 0; if (g_once_init_enter (&xfce_trash_type_id__volatile)) { 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 }; GType xfce_trash_type_id; 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); g_once_init_leave (&xfce_trash_type_id__volatile, xfce_trash_type_id); } return xfce_trash_type_id__volatile; } 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',interface='org.xfce.Trash'", 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 _tmp0_; DBusMessage* reply; if (strcmp (dbus_message_get_signature (message), "b")) { return; } dbus_message_iter_init (message, &iter); dbus_message_iter_get_basic (&iter, &_tmp0_); dbus_message_iter_next (&iter); full = _tmp0_; 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* _tmp1_; if (((XfceTrashDBusProxy*) self)->disposed) { g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "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); _tmp1_ = display; dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp1_); 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 = 0; gint _ecode = 0; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { const char* _tmp2_; _edomain = DBUS_GERROR; _tmp2_ = _dbus_error.name + 27; if (strcmp (_tmp2_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; } else if (strcmp (_tmp2_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; } else if (strcmp (_tmp2_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; } else if (strcmp (_tmp2_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; } else if (strcmp (_tmp2_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; } else if (strcmp (_tmp2_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; } else if (strcmp (_tmp2_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; } else if (strcmp (_tmp2_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; } else if (strcmp (_tmp2_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; } else if (strcmp (_tmp2_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; } else if (strcmp (_tmp2_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; } else if (strcmp (_tmp2_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; } else if (strcmp (_tmp2_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; } else if (strcmp (_tmp2_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; } else if (strcmp (_tmp2_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; } else if (strcmp (_tmp2_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; } else if (strcmp (_tmp2_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; } else if (strcmp (_tmp2_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; } else if (strcmp (_tmp2_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; } else if (strcmp (_tmp2_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; } else if (strcmp (_tmp2_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; } else if (strcmp (_tmp2_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; } else if (strcmp (_tmp2_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; } else if (strcmp (_tmp2_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; } else if (strcmp (_tmp2_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; } else if (strcmp (_tmp2_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; } else if (strcmp (_tmp2_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; } else if (strcmp (_tmp2_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; } else if (strcmp (_tmp2_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; } else if (strcmp (_tmp2_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; } else if (strcmp (_tmp2_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; } else if (strcmp (_tmp2_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; } else if (strcmp (_tmp2_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } g_set_error (error, _edomain, _ecode, "%s", _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* _tmp3_; if (((XfceTrashDBusProxy*) self)->disposed) { g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "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); _tmp3_ = display; dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp3_); 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 = 0; gint _ecode = 0; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { const char* _tmp4_; _edomain = DBUS_GERROR; _tmp4_ = _dbus_error.name + 27; if (strcmp (_tmp4_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; } else if (strcmp (_tmp4_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; } else if (strcmp (_tmp4_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; } else if (strcmp (_tmp4_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; } else if (strcmp (_tmp4_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; } else if (strcmp (_tmp4_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; } else if (strcmp (_tmp4_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; } else if (strcmp (_tmp4_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; } else if (strcmp (_tmp4_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; } else if (strcmp (_tmp4_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; } else if (strcmp (_tmp4_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; } else if (strcmp (_tmp4_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; } else if (strcmp (_tmp4_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; } else if (strcmp (_tmp4_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; } else if (strcmp (_tmp4_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; } else if (strcmp (_tmp4_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; } else if (strcmp (_tmp4_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; } else if (strcmp (_tmp4_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; } else if (strcmp (_tmp4_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; } else if (strcmp (_tmp4_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; } else if (strcmp (_tmp4_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; } else if (strcmp (_tmp4_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; } else if (strcmp (_tmp4_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; } else if (strcmp (_tmp4_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; } else if (strcmp (_tmp4_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; } else if (strcmp (_tmp4_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; } else if (strcmp (_tmp4_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; } else if (strcmp (_tmp4_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; } else if (strcmp (_tmp4_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; } else if (strcmp (_tmp4_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; } else if (strcmp (_tmp4_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; } else if (strcmp (_tmp4_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; } else if (strcmp (_tmp4_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } g_set_error (error, _edomain, _ecode, "%s", _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** _tmp5_; DBusMessageIter _tmp6_; int _tmp7_; const char* _tmp9_; if (((XfceTrashDBusProxy*) self)->disposed) { g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "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); _tmp5_ = uris; dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "s", &_tmp6_); for (_tmp7_ = 0; _tmp7_ < uris_length1; _tmp7_++) { const char* _tmp8_; _tmp8_ = *_tmp5_; dbus_message_iter_append_basic (&_tmp6_, DBUS_TYPE_STRING, &_tmp8_); _tmp5_++; } dbus_message_iter_close_container (&_iter, &_tmp6_); _tmp9_ = display; dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp9_); 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 = 0; gint _ecode = 0; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { const char* _tmp10_; _edomain = DBUS_GERROR; _tmp10_ = _dbus_error.name + 27; if (strcmp (_tmp10_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; } else if (strcmp (_tmp10_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; } else if (strcmp (_tmp10_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; } else if (strcmp (_tmp10_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; } else if (strcmp (_tmp10_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; } else if (strcmp (_tmp10_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; } else if (strcmp (_tmp10_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; } else if (strcmp (_tmp10_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; } else if (strcmp (_tmp10_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; } else if (strcmp (_tmp10_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; } else if (strcmp (_tmp10_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; } else if (strcmp (_tmp10_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; } else if (strcmp (_tmp10_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; } else if (strcmp (_tmp10_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; } else if (strcmp (_tmp10_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; } else if (strcmp (_tmp10_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; } else if (strcmp (_tmp10_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; } else if (strcmp (_tmp10_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; } else if (strcmp (_tmp10_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; } else if (strcmp (_tmp10_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; } else if (strcmp (_tmp10_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; } else if (strcmp (_tmp10_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; } else if (strcmp (_tmp10_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; } else if (strcmp (_tmp10_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; } else if (strcmp (_tmp10_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; } else if (strcmp (_tmp10_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; } else if (strcmp (_tmp10_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; } else if (strcmp (_tmp10_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; } else if (strcmp (_tmp10_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; } else if (strcmp (_tmp10_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; } else if (strcmp (_tmp10_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; } else if (strcmp (_tmp10_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; } else if (strcmp (_tmp10_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } g_set_error (error, _edomain, _ecode, "%s", _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 _tmp11_; if (((XfceTrashDBusProxy*) self)->disposed) { g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "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 = 0; gint _ecode = 0; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { const char* _tmp12_; _edomain = DBUS_GERROR; _tmp12_ = _dbus_error.name + 27; if (strcmp (_tmp12_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; } else if (strcmp (_tmp12_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; } else if (strcmp (_tmp12_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; } else if (strcmp (_tmp12_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; } else if (strcmp (_tmp12_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; } else if (strcmp (_tmp12_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; } else if (strcmp (_tmp12_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; } else if (strcmp (_tmp12_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; } else if (strcmp (_tmp12_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; } else if (strcmp (_tmp12_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; } else if (strcmp (_tmp12_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; } else if (strcmp (_tmp12_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; } else if (strcmp (_tmp12_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; } else if (strcmp (_tmp12_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; } else if (strcmp (_tmp12_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; } else if (strcmp (_tmp12_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; } else if (strcmp (_tmp12_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; } else if (strcmp (_tmp12_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; } else if (strcmp (_tmp12_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; } else if (strcmp (_tmp12_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; } else if (strcmp (_tmp12_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; } else if (strcmp (_tmp12_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; } else if (strcmp (_tmp12_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; } else if (strcmp (_tmp12_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; } else if (strcmp (_tmp12_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; } else if (strcmp (_tmp12_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; } else if (strcmp (_tmp12_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; } else if (strcmp (_tmp12_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; } else if (strcmp (_tmp12_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; } else if (strcmp (_tmp12_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; } else if (strcmp (_tmp12_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; } else if (strcmp (_tmp12_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; } else if (strcmp (_tmp12_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } g_set_error (error, _edomain, _ecode, "%s", _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, &_tmp11_); dbus_message_iter_next (&_iter); _result = _tmp11_; 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 volatile gsize desktop_agnostic_vfs_trash_state_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_trash_state_type_id__volatile)) { 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}}; GType desktop_agnostic_vfs_trash_state_type_id; desktop_agnostic_vfs_trash_state_type_id = g_enum_register_static ("DesktopAgnosticVFSTrashState", values); g_once_init_leave (&desktop_agnostic_vfs_trash_state_type_id__volatile, desktop_agnostic_vfs_trash_state_type_id); } return desktop_agnostic_vfs_trash_state_type_id__volatile; } 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_ = NULL; g_return_if_fail (self != 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 Tras" \ "h: %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; gint uris_length1; gint _uris_size_; char** _tmp1_; char** _tmp0_ = NULL; char** uris; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSTrashThunarVFS*) base; g_return_if_fail (file != 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_ = NULL; self = (DesktopAgnosticVFSTrashThunarVFS*) base; { 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 = NULL; self = (DesktopAgnosticVFSTrashThunarVFS*) g_object_new (object_type, 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* _tmp0_; DBusGConnection* _tmp1_; XfceTrash* _tmp2_; monitor = NULL; self->trash = thunar_vfs_path_get_for_trash (); _tmp0_ = 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 = (_tmp1_ = _tmp0_, _dbus_g_connection_unref0 (self->priv->dbus), _tmp1_); self->priv->xfce_trash = (_tmp2_ = xfce_trash_dbus_proxy_new (self->priv->dbus, "org.xfce.Thunar", "/org/xfce/FileManager"), _g_object_unref0 (self->priv->xfce_trash), _tmp2_); 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 volatile gsize desktop_agnostic_vfs_trash_thunar_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_trash_thunar_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_trash_thunar_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_trash_thunar_vfs_type_id__volatile, desktop_agnostic_vfs_trash_thunar_vfs_type_id); } return desktop_agnostic_vfs_trash_thunar_vfs_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-trash.c0000664000175000017510000002572011537206464024523 0ustar seagleseagle/* vfs-trash.c generated by valac 0.10.4, 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) G_GNUC_CONST; GType desktop_agnostic_vfs_trash_get_type (void) G_GNUC_CONST; 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); GQuark desktop_agnostic_vfs_volume_error_quark (void); GType desktop_agnostic_vfs_volume_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_monitor_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_implementation_get_type (void) G_GNUC_CONST; DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error); GType desktop_agnostic_vfs_implementation_get_trash_type (DesktopAgnosticVFSImplementation* self); 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 volatile gsize desktop_agnostic_vfs_trash_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_trash_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_trash_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_trash_type_id__volatile, desktop_agnostic_vfs_trash_type_id); } return desktop_agnostic_vfs_trash_type_id__volatile; } DesktopAgnosticVFSTrash* desktop_agnostic_vfs_trash_get_default (GError** error) { DesktopAgnosticVFSTrash* result = NULL; GError * _inner_error_ = NULL; if (desktop_agnostic_vfs_trash == NULL) { DesktopAgnosticVFSImplementation* vfs; GObject* _tmp0_; DesktopAgnosticVFSTrash* _tmp1_; vfs = desktop_agnostic_vfs_get_default (&_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return NULL; } desktop_agnostic_vfs_trash = (_tmp1_ = DESKTOP_AGNOSTIC_VFS_TRASH ((_tmp0_ = g_object_new (desktop_agnostic_vfs_implementation_get_trash_type (vfs), NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)), _g_object_unref0 (desktop_agnostic_vfs_trash), _tmp1_); } result = desktop_agnostic_vfs_trash; return result; } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.h0000664000175000017510000003136011537206465026064 0ustar seagleseagle/* da-vfs-thunar-vfs.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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); XfceTrash* xfce_trash_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path); GType xfce_trash_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file-monitor.c0000664000175000017510000002300711537206464026002 0ustar seagleseagle/* vfs-file-monitor.c generated by valac 0.10.4, 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) G_GNUC_CONST; GType desktop_agnostic_vfs_file_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_get_type (void) G_GNUC_CONST; 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); /** * The file monitor events that will be propagated to the signal handlers. */ GType desktop_agnostic_vfs_file_monitor_event_get_type (void) { static volatile gsize desktop_agnostic_vfs_file_monitor_event_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_monitor_event_type_id__volatile)) { 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}}; GType desktop_agnostic_vfs_file_monitor_event_type_id; desktop_agnostic_vfs_file_monitor_event_type_id = g_enum_register_static ("DesktopAgnosticVFSFileMonitorEvent", values); g_once_init_leave (&desktop_agnostic_vfs_file_monitor_event_type_id__volatile, desktop_agnostic_vfs_file_monitor_event_type_id); } return desktop_agnostic_vfs_file_monitor_event_type_id__volatile; } /** * Emits a file monitor event for the file backend associated with * the monitor. * @param other if the associated URI is a directory, the child file that * triggered the event. Otherwise, it should be NULL. * @param event the event type to emit. */ 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); } /** * Prevent the monitor from monitoring any events from the URI associated * with it. * @return whether the monitor was successfully cancelled. */ 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; /** * Whether the monitor has been cancelled via cancel(). */ 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)); /** * The signal emitted when something changes * @param file the file associated with the monitor. * @param other if the URI associated with the monitor is a directory, the * child file that triggered the event. Otherwise, it should be NULL. * @param event the event type to send */ 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); } } /** * The base class for file/directory monitoring. */ GType desktop_agnostic_vfs_file_monitor_get_type (void) { static volatile gsize desktop_agnostic_vfs_file_monitor_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_monitor_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_file_monitor_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_file_monitor_type_id__volatile, desktop_agnostic_vfs_file_monitor_type_id); } return desktop_agnostic_vfs_file_monitor_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-bridge.c0000664000175000017510000014476111537206465025315 0ustar seagleseagle/* config-bridge.c generated by valac 0.10.4, 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) G_GNUC_CONST; GType desktop_agnostic_config_backend_get_type (void) G_GNUC_CONST; 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); void desktop_agnostic_config_binding_notifier_on_simple_value_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value); GType desktop_agnostic_config_binding_list_wrapper_get_type (void) G_GNUC_CONST; GType desktop_agnostic_config_bridge_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; void desktop_agnostic_config_binding_notifier_on_list_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value); void desktop_agnostic_config_binding_notifier_on_serialized_object_changed (DesktopAgnosticConfigBindingNotifier* self, const char* group, const char* key, GValue* value); GType desktop_agnostic_config_schema_type_get_type (void) G_GNUC_CONST; GParamSpec* desktop_agnostic_config_bridge_get_property_spec (GObject* obj, const char* property_name); DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type); 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 (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, DesktopAgnosticConfigBridgeNotifyFuncHandler func, GError** error); 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_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); static void desktop_agnostic_config_bridge_cleanup_bindings (DesktopAgnosticConfigBindingListWrapper* obj); 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_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_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_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 = NULL; 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* _tmp1_ = {0}; GData* _tmp2_; 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* _tmp1_ = {0}; GData* _tmp2_; 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* _tmp1_ = {0}; GData* _tmp2_; 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_object_unref0 (st); _g_param_spec_unref0 (spec); } } } _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 volatile gsize desktop_agnostic_config_binding_notifier_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_binding_notifier_type_id__volatile)) { 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 }; GType desktop_agnostic_config_binding_notifier_type_id; desktop_agnostic_config_binding_notifier_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBindingNotifier", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_binding_notifier_type_id__volatile, desktop_agnostic_config_binding_notifier_type_id); } return desktop_agnostic_config_binding_notifier_type_id__volatile; } 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 = NULL; 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 volatile gsize desktop_agnostic_config_binding_list_wrapper_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_binding_list_wrapper_type_id__volatile)) { 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 }; GType desktop_agnostic_config_binding_list_wrapper_type_id; desktop_agnostic_config_binding_list_wrapper_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBindingListWrapper", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_binding_list_wrapper_type_id__volatile, desktop_agnostic_config_binding_list_wrapper_type_id); } return desktop_agnostic_config_binding_list_wrapper_type_id__volatile; } DesktopAgnosticConfigBinding* desktop_agnostic_config_binding_construct (GType object_type) { DesktopAgnosticConfigBinding * self = NULL; 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 volatile gsize desktop_agnostic_config_binding_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_binding_type_id__volatile)) { 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 }; GType desktop_agnostic_config_binding_type_id; desktop_agnostic_config_binding_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBinding", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_binding_type_id__volatile, desktop_agnostic_config_binding_type_id); } return desktop_agnostic_config_binding_type_id__volatile; } static DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_construct (GType object_type) { DesktopAgnosticConfigBridge * self = NULL; 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; } /** * Retrieves the singleton that manages all of the bindings. */ DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_get_default (void) { DesktopAgnosticConfigBridge* result = NULL; 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 = NULL; 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) { GParamSpec* spec; GError * _inner_error_ = NULL; 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); 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 _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) { DesktopAgnosticConfigBindingNotifier* notifier; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; gboolean _tmp2_ = FALSE; gboolean _tmp3_ = FALSE; gboolean _tmp4_ = FALSE; gboolean _tmp5_ = FALSE; GError * _inner_error_ = NULL; 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); 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_ref0 (notifier), g_object_unref); _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) { DesktopAgnosticConfigBridge* bridge; GError * _inner_error_ = NULL; g_return_if_fail (obj != 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); } /** * Binds a specific object's property with a specific configuration key. */ 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) { DesktopAgnosticConfigBinding* binding; GParamSpec* spec; DesktopAgnosticConfigBinding* _tmp0_; char* _tmp1_; char* _tmp2_; GError * _inner_error_ = NULL; 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); 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 _tmp7_; GValue _tmp8_; 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_length1; gint _properties_size_; GParamSpec** properties; char* props_str; guint _tmp11_; GParamSpec** _tmp12_; 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:337: Invalid property name for the object (%s). Val" \ "id properties (%d): %s", property_name, properties_length1, props_str); _g_free0 (props_str); } _g_object_unref0 (binding); } /** * Removes a binding between a specific configuration key and a specific * object's property. */ 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) { DesktopAgnosticConfigBindingListWrapper* bindings_list; GSList* bindings_to_remove; guint pos; char* binding_key; DesktopAgnosticConfigBindingListWrapper* obj_bindings; char* _tmp0_; GSList* _tmp1_; GError * _inner_error_ = NULL; 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); 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_free0 (binding_key); _g_slist_free0 (bindings_to_remove); 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_free0 (binding_key); _g_slist_free0 (bindings_to_remove); return; } g_datalist_remove_data (&self->priv->bindings, binding_key); } _g_free0 (binding_key); _g_slist_free0 (bindings_to_remove); } /** * Removes all of the bindings related to a specific object. */ void desktop_agnostic_config_bridge_remove_all_for_object (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, GObject* obj, GError** error) { void* data; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (obj != 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_ = NULL; g_return_if_fail (obj != NULL); g_return_if_fail (spec != NULL); g_return_if_fail (binding != NULL); { GValue val = {0}; g_value_init (&val, spec->value_type); 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:435: 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); } /** * Provides a convenient way for a GObject's properties and associated * configuration keys to be in sync for the duration of the object's life. */ GType desktop_agnostic_config_bridge_get_type (void) { static volatile gsize desktop_agnostic_config_bridge_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_bridge_type_id__volatile)) { 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 }; GType desktop_agnostic_config_bridge_type_id; desktop_agnostic_config_bridge_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBridge", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_bridge_type_id__volatile, desktop_agnostic_config_bridge_type_id); } return desktop_agnostic_config_bridge_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-trash-impl-gnome-vfs.c0000664000175000017510000007177611537206466027377 0ustar seagleseagle/* vfs-trash-impl-gnome-vfs.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 }; 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); void desktop_agnostic_vfs_trash_volume_set_uri (DesktopAgnosticVFSTrashVolume* self, GnomeVFSURI* value); 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); static void desktop_agnostic_vfs_trash_volume_reset_file_count (DesktopAgnosticVFSTrashVolume* self); GnomeVFSURI* desktop_agnostic_vfs_trash_volume_get_uri (DesktopAgnosticVFSTrashVolume* self); static gboolean desktop_agnostic_vfs_trash_volume_visit_callback (const char* rel_path, GnomeVFSFileInfo* info, gboolean recursing_will_loop, void** data, gboolean recurse); static void desktop_agnostic_vfs_trash_volume_do_empty (GnomeVFSURI* dir); 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) G_GNUC_CONST; 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 gboolean desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs (DesktopAgnosticVFSTrashGnomeVFS* self); 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); 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 = NULL; 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 = FALSE; 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 volatile gsize desktop_agnostic_vfs_trash_volume_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_trash_volume_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_trash_volume_type_id; desktop_agnostic_vfs_trash_volume_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSTrashVolume", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_vfs_trash_volume_type_id__volatile, desktop_agnostic_vfs_trash_volume_type_id); } return desktop_agnostic_vfs_trash_volume_type_id__volatile; } 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* _tmp1_ = NULL; GnomeVFSResult _tmp2_; GnomeVFSURI* _tmp3_; 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 (trash_uri); _gnome_vfs_uri_unref0 (g_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 = FALSE; 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* _tmp1_ = NULL; GnomeVFSResult _tmp2_; GnomeVFSURI* _tmp3_; 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 (trash_uri); _gnome_vfs_uri_unref0 (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 = NULL; self = (DesktopAgnosticVFSTrashGnomeVFS*) g_object_new (object_type, 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) { gboolean result; result = desktop_agnostic_vfs_trash_gnome_vfs_search_for_trash_dirs (self); return result; } 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_full (g_direct_hash, g_direct_equal, NULL, g_object_unref), _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 volatile gsize desktop_agnostic_vfs_trash_gnome_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_trash_gnome_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_trash_gnome_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_trash_gnome_vfs_type_id__volatile, desktop_agnostic_vfs_trash_gnome_vfs_type_id); } return desktop_agnostic_vfs_trash_gnome_vfs_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-gnome.deps0000664000175000017510000000011511537206467025546 0ustar seagleseaglegnome-desktop-2.0 desktop-agnostic-fdo desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-keyfile.vapi0000664000175000017510000000402511537206466026067 0ustar seagleseagle/* da-cfg-keyfile.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_")] 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic.h0000664000175000017510000001353211537206464026067 0ustar seagleseagle/* desktop-agnostic.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config.h0000664000175000017510000006015511537206465024062 0ustar seagleseagle/* config.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; GType desktop_agnostic_config_client_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-module-guesser.vapi0000664000175000017510000000036211537206466026642 0ustar seagleseagle/* da-module-guesser.vapi generated by valac 0.10.4, do not modify. */ [CCode (cheader_filename = "libdesktop-agnostic/da-module-guesser.h")] public static GLib.Type guess_module (DesktopAgnostic.ModuleLoader loader, string library_prefix); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.deps0000664000175000017510000000004611537206465027325 0ustar seagleseagledesktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic.deps0000664000175000017510000000002411537206464026563 0ustar seagleseaglegdk-2.0 gmodule-2.0 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-module-guesser.h0000664000175000017510000000067311537206466026137 0ustar seagleseagle/* da-module-guesser.h generated by valac 0.10.4, 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-schema.c0000664000175000017510000013707111537206465025315 0ustar seagleseagle/* config-schema.c generated by valac 0.10.4, 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_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (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))) #define __g_slist_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_free (var), NULL))) /** * Configuration schema error types. */ 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) G_GNUC_CONST; GType desktop_agnostic_config_schema_option_get_type (void) G_GNUC_CONST; #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) G_GNUC_CONST; static void _vala_GValue_free (GValue* self); static void _g_list_free_g_free (GList* 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 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); 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); void desktop_agnostic_config_schema_register_type (DesktopAgnosticConfigSchemaType* st, GError** error); GType desktop_agnostic_config_schema_type_get_schema_type (DesktopAgnosticConfigSchemaType* self); char* desktop_agnostic_config_schema_type_get_name (DesktopAgnosticConfigSchemaType* self); 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_filename (DesktopAgnosticConfigSchema* self, const char* value); 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 _vala_GValue_free (GValue* self) { g_value_unset (self); g_free (self); } static void _g_list_free_g_free (GList* self) { g_list_foreach (self, (GFunc) g_free, NULL); g_list_free (self); } /** * Creates a new Schema object. * @param filename the name of the schema file to parse */ 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) { DesktopAgnosticConfigSchema * self = NULL; GHashTable* backend_metadata_keys; GData* _tmp0_ = {0}; GHashTable* _tmp1_; GList* _tmp2_; GData* _tmp3_ = {0}; GError * _inner_error_ = NULL; g_return_val_if_fail (filename != NULL, NULL); self = (DesktopAgnosticConfigSchema*) g_object_new (object_type, "filename", filename, NULL); backend_metadata_keys = NULL; self->priv->options = (g_datalist_init (&_tmp0_), _tmp0_); self->priv->keys = (_tmp1_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, _g_list_free_g_free), _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_unref0 (self); return NULL; } 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); } /** * Parses the schema file for configuration options and metadata. */ static gboolean string_contains (const char* self, const char* needle) { gboolean result = FALSE; 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, (gssize) (-1)); return result; } static char* string_substring (const char* self, glong offset, glong len) { char* result = NULL; glong string_length; const char* start; g_return_val_if_fail (self != NULL, NULL); string_length = string_get_length (self); 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_ = NULL; g_return_if_fail (self != 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_object_unref0 (option); _g_free0 (option_group); } else { if (_vala_strcmp0 (group, DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT) == 0) { gint _tmp3__length1; gint __tmp3__size_; char** _tmp4_; 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) g_strcmp0) == 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 _tmp5_ = {0}; GValue _tmp6_; GValue _tmp7_ = {0}; GValue _tmp8_; 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 (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_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 (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_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 (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_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 (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_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 (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_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 (&new_val) ? (g_value_unset (&new_val), NULL) : NULL; G_IS_VALUE (&cur_val) ? (g_value_unset (&cur_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); } } /** * Retrieves the configuration groups in the schema. * @return a list of zero or more groups */ GList* desktop_agnostic_config_schema_get_groups (DesktopAgnosticConfigSchema* self) { GList* result = NULL; g_return_val_if_fail (self != NULL, NULL); result = g_hash_table_get_keys (self->priv->keys); return result; } /** * Retrieves the configuration keys for a specified group in the schema. * @param group the group name to search for keys associated with it * @return a list of zero or more keys */ GList* desktop_agnostic_config_schema_get_keys (DesktopAgnosticConfigSchema* self, const char* group) { GList* result = NULL; 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; } /** * Determines if a specified group/key exists in the schema. * @param group the group that the key is associated with * @param key the configuration key to determine if it exists * @return whether the group/key exists */ gboolean desktop_agnostic_config_schema_exists (DesktopAgnosticConfigSchema* self, const char* group, const char* key) { gboolean result = FALSE; 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) g_strcmp0) != NULL; } else { _tmp0_ = FALSE; } result = _tmp0_; return result; } /** * Retrieves the metadata associated with a specific group/key. * @param group the group that the key is associated with * @param key the configuration key to retrieve metadata from * @return an object which contains the option metadata */ DesktopAgnosticConfigSchemaOption* desktop_agnostic_config_schema_get_option (DesktopAgnosticConfigSchema* self, const char* group, const char* key) { DesktopAgnosticConfigSchemaOption* result = NULL; 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; } /** * Retrieves the value of the specified metadata option. * @throws SchemaError if the option named specified is not registered */ GValue* desktop_agnostic_config_schema_get_metadata_option (DesktopAgnosticConfigSchema* self, const char* name, GError** error) { GValue* result = NULL; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (name != NULL, NULL); if (g_list_find_custom (self->priv->valid_metadata_keys, name, (GCompareFunc) g_strcmp0) == 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; } } /** * Registers a configuration schema type with the class. This is usually * not called manually - the class loads all of the configuration schema * type modules that it can find when the class is first instantiated. */ void desktop_agnostic_config_schema_register_type (DesktopAgnosticConfigSchemaType* st, GError** error) { GError * _inner_error_ = NULL; g_return_if_fail (st != 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)); } } } /** * Looks for a registered SchemaType by its GType. */ DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type (GType type) { DesktopAgnosticConfigSchemaType* result = NULL; result = (DesktopAgnosticConfigSchemaType*) g_hash_table_lookup (desktop_agnostic_config_schema_type_registry, GINT_TO_POINTER (type)); return result; } /** * Looks for a registered SchemaType by its declared name. */ DesktopAgnosticConfigSchemaType* desktop_agnostic_config_schema_find_type_by_name (const char* name) { DesktopAgnosticConfigSchemaType* result = NULL; 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_full ((GHashFunc) desktop_agnostic_config_gtype_hash, (GEqualFunc) desktop_agnostic_config_gtype_equal, NULL, g_object_unref); desktop_agnostic_config_schema_name_registry = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); desktop_agnostic_config_schema_common_metadata_keys = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, _vala_GValue_free); _inner_error_ = NULL; { GList* type_modules; gint paths_length1; gint _paths_size_; char** paths; GSList* search_paths; GList* _tmp0_; gint _tmp1_; char** _tmp2_; GSList* _tmp3_; GValue val = {0}; 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_slist_free_g_free0 (search_paths); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); __g_list_free_g_free0 (type_modules); 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_length1; gint _modules_paths_size_; char** modules_paths; DesktopAgnosticVFSGlob* _tmp4_; DesktopAgnosticVFSGlob* _tmp5_; gint _tmp6_; char** _tmp7_; 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_slist_free_g_free0 (search_paths); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); __g_list_free_g_free0 (type_modules); 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* _tmp9_; GObject* obj; GObject* _tmp10_; DesktopAgnosticConfigSchemaType* _tmp11_; obj = (_tmp9_ = g_object_new (type, NULL), G_IS_INITIALLY_UNOWNED (_tmp9_) ? g_object_ref_sink (_tmp9_) : _tmp9_); desktop_agnostic_config_schema_register_type (_tmp11_ = DESKTOP_AGNOSTIC_CONFIG_SCHEMA_TYPE ((_tmp10_ = obj, obj = NULL, _tmp10_)), &_inner_error_); _g_object_unref0 (_tmp11_); 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_slist_free_g_free0 (search_paths); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); __g_list_free_g_free0 (type_modules); 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_); } 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_slist_free_g_free0 (search_paths); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); __g_list_free_g_free0 (type_modules); 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_slist_free_g_free0 (search_paths); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); __g_list_free_g_free0 (type_modules); 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); } } } g_value_init (&val, G_TYPE_BOOLEAN); 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; __g_slist_free_g_free0 (search_paths); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); __g_list_free_g_free0 (type_modules); 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; __g_slist_free_g_free0 (search_paths); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); __g_list_free_g_free0 (type_modules); } } 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); } /** * A representation of a configuration schema, comprised of one or more * configuration options. */ GType desktop_agnostic_config_schema_get_type (void) { static volatile gsize desktop_agnostic_config_schema_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_schema_type_id__volatile)) { 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 }; GType desktop_agnostic_config_schema_type_id; desktop_agnostic_config_schema_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigSchema", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_schema_type_id__volatile, desktop_agnostic_config_schema_type_id); } return desktop_agnostic_config_schema_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-gio.h0000664000175000017510000002316311537206465024547 0ustar seagleseagle/* da-vfs-gio.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_new (void); DesktopAgnosticVFSVolumeMonitorGIO* desktop_agnostic_vfs_volume_monitor_gio_construct (GType object_type); G_END_DECLS #endif libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-glob.c0000664000175000017510000004255111537206464024326 0ustar seagleseagle/* vfs-glob.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 }; DesktopAgnosticVFSGlob* desktop_agnostic_vfs_glob_execute (const char* pattern, GError** error); static void desktop_agnostic_vfs_glob_run_glob (DesktopAgnosticVFSGlob* self, const char* pattern, gint flags, 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 = NULL; GObject* _tmp0_; DesktopAgnosticVFSGlob* g; GError * _inner_error_ = NULL; g_return_val_if_fail (pattern != NULL, NULL); g = DESKTOP_AGNOSTIC_VFS_GLOB ((_tmp0_ = g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, "pattern", pattern, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); 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 = NULL; GObject* _tmp0_; DesktopAgnosticVFSGlob* g; GError * _inner_error_ = NULL; g_return_val_if_fail (pattern != NULL, NULL); g = DESKTOP_AGNOSTIC_VFS_GLOB ((_tmp0_ = g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_GLOB, "pattern", pattern, "flags", flags, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); 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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (pattern != 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 = NULL; 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) { glob_t _tmp0_ = {0}; gint _tmp1_; glob_t _tmp2_; gint res; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (pattern != 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 = 0; GError * _inner_error_ = NULL; g_return_val_if_fail (path != NULL, 0); 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 = NULL; 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_ = NULL; g_return_if_fail (self != 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_ = NULL; g_return_if_fail (self != 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 volatile gsize desktop_agnostic_vfs_glob_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_glob_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_glob_type_id; desktop_agnostic_vfs_glob_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSGlob", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_vfs_glob_type_id__volatile, desktop_agnostic_vfs_glob_type_id); } return desktop_agnostic_vfs_glob_type_id__volatile; } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-gconf.h0000664000175000017510000000374411537206466025032 0ustar seagleseagle/* da-cfg-gconf.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.vapi0000664000175000017510000000661011537206465026574 0ustar seagleseagle/* da-vfs-thunar-vfs.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_")] 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 (); public override string[] get_icon_names () throws GLib.Error; public override string get_mime_type () throws GLib.Error; protected override void init (string uri); public override bool is_native (); 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file-impl-gio.c0000664000175000017510000007773011537206465026045 0ustar seagleseagle/* vfs-file-impl-gio.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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); static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_gio_real_monitor (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) G_GNUC_CONST; 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 gboolean desktop_agnostic_vfs_file_gio_real_launch (DesktopAgnosticVFSFile* base, GError** error); static void _g_list_free_g_object_unref (GList* self); static GSList* desktop_agnostic_vfs_file_gio_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error); static void _g_slist_free_g_object_unref (GSList* self); 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); static gboolean desktop_agnostic_vfs_file_gio_real_is_native (DesktopAgnosticVFSFile* base); static char* desktop_agnostic_vfs_file_gio_real_get_mime_type (DesktopAgnosticVFSFile* base, GError** error); static char** desktop_agnostic_vfs_file_gio_real_get_icon_names (DesktopAgnosticVFSFile* base, int* result_length1, GError** error); static char** _vala_array_dup1 (char** self, int length); static char* desktop_agnostic_vfs_file_gio_real_get_thumbnail_path (DesktopAgnosticVFSFile* base); 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 _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 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 = FALSE; 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 = NULL; 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 = FALSE; char* _tmp0_ = NULL; gboolean _tmp1_; char* _tmp2_; gboolean _tmp3_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; if (contents != NULL) { *contents = 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 = FALSE; gboolean _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; g_return_val_if_fail (contents != NULL, FALSE); _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 = FALSE; GAppInfo* app_info; GList* files; GAppInfo* _tmp0_; GAppInfo* _tmp1_; gboolean _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; 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_list_free_g_object_unref0 (files); _g_object_unref0 (app_info); 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_list_free_g_object_unref0 (files); _g_object_unref0 (app_info); return FALSE; } result = _tmp2_; __g_list_free_g_object_unref0 (files); _g_object_unref0 (app_info); 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 = NULL; GSList* children; GFileEnumerator* enumerator; GFileInfo* info; GSList* _tmp0_; GFileEnumerator* _tmp1_; GFileEnumerator* _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; 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_object_unref0 (info); _g_object_unref0 (enumerator); __g_slist_free_g_object_unref0 (children); 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_object_unref0 (info); _g_object_unref0 (enumerator); __g_slist_free_g_object_unref0 (children); 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 (child); _g_object_unref0 (gchild); _g_object_unref0 (info); _g_object_unref0 (enumerator); __g_slist_free_g_object_unref0 (children); return NULL; } child = (_tmp9_ = _tmp8_, _g_object_unref0 (child), _tmp9_); children = g_slist_append (children, (_tmp10_ = child, child = NULL, _tmp10_)); _g_object_unref0 (child); _g_object_unref0 (gchild); } result = children; _g_object_unref0 (info); _g_object_unref0 (enumerator); return result; } static gboolean desktop_agnostic_vfs_file_gio_real_copy (DesktopAgnosticVFSFile* base, DesktopAgnosticVFSFile* destination, gboolean overwrite, GError** error) { DesktopAgnosticVFSFileGIO * self; gboolean result = FALSE; GFileCopyFlags flags; gboolean _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; g_return_val_if_fail (destination != NULL, FALSE); 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 = FALSE; gboolean _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; 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; } static gboolean desktop_agnostic_vfs_file_gio_real_is_native (DesktopAgnosticVFSFile* base) { DesktopAgnosticVFSFileGIO * self; gboolean result = FALSE; self = (DesktopAgnosticVFSFileGIO*) base; result = g_file_is_native (self->priv->_file); return result; } static char* desktop_agnostic_vfs_file_gio_real_get_mime_type (DesktopAgnosticVFSFile* base, GError** error) { DesktopAgnosticVFSFileGIO * self; char* result = NULL; GFileInfo* fi; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; fi = g_file_query_info (self->priv->_file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, 0, NULL, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return NULL; } result = g_strdup (g_file_info_get_content_type (fi)); _g_object_unref0 (fi); 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; } static char** desktop_agnostic_vfs_file_gio_real_get_icon_names (DesktopAgnosticVFSFile* base, int* result_length1, GError** error) { DesktopAgnosticVFSFileGIO * self; char** result = NULL; GFileInfo* fi; GIcon* icon; gint unknown_length1; gint _unknown_size_; char** _tmp8_; char** _tmp7_ = NULL; char** unknown; char** _tmp9_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; fi = g_file_query_info (self->priv->_file, G_FILE_ATTRIBUTE_STANDARD_ICON, 0, NULL, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return NULL; } icon = _g_object_ref0 (g_file_info_get_icon (fi)); if (icon != NULL) { if (G_IS_THEMED_ICON (icon)) { GValue v = {0}; gint names_length1; gint _names_size_; char** _tmp1_; char** _tmp0_; char** names; char** _tmp2_; g_value_init (&v, G_TYPE_STRV); g_object_get_property ((GObject*) icon, "names", &v); names = (_tmp1_ = (_tmp0_ = g_value_get_boxed (&v), (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup1 (_tmp0_, g_strv_length (g_value_get_boxed (&v)))), names_length1 = g_strv_length (g_value_get_boxed (&v)), _names_size_ = names_length1, _tmp1_); result = (_tmp2_ = names, *result_length1 = names_length1, _tmp2_); G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL; _g_object_unref0 (icon); _g_object_unref0 (fi); return result; names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL); G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL; } if (G_IS_FILE_ICON (icon)) { GIcon* _tmp3_; char* path; gint _result__length1; gint __result__size_; char** _tmp5_; char** _tmp4_ = NULL; char** _result_; char** _tmp6_; path = g_file_get_path (g_file_icon_get_file ((_tmp3_ = icon, G_IS_FILE_ICON (_tmp3_) ? ((GFileIcon*) _tmp3_) : NULL))); _result_ = (_tmp5_ = (_tmp4_ = g_new0 (char*, 1 + 1), _tmp4_[0] = g_strdup (path), _tmp4_), _result__length1 = 1, __result__size_ = _result__length1, _tmp5_); result = (_tmp6_ = _result_, *result_length1 = _result__length1, _tmp6_); _g_free0 (path); _g_object_unref0 (icon); _g_object_unref0 (fi); return result; _result_ = (_vala_array_free (_result_, _result__length1, (GDestroyNotify) g_free), NULL); _g_free0 (path); } } unknown = (_tmp8_ = (_tmp7_ = g_new0 (char*, 0 + 1), _tmp7_), unknown_length1 = 0, _unknown_size_ = unknown_length1, _tmp8_); result = (_tmp9_ = unknown, *result_length1 = unknown_length1, _tmp9_); _g_object_unref0 (icon); _g_object_unref0 (fi); return result; unknown = (_vala_array_free (unknown, unknown_length1, (GDestroyNotify) g_free), NULL); _g_object_unref0 (icon); _g_object_unref0 (fi); } static char* desktop_agnostic_vfs_file_gio_real_get_thumbnail_path (DesktopAgnosticVFSFile* base) { DesktopAgnosticVFSFileGIO * self; char* result = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGIO*) base; { GFileInfo* fi; fi = g_file_query_info (self->priv->_file, G_FILE_ATTRIBUTE_THUMBNAIL_PATH, 0, NULL, &_inner_error_); if (_inner_error_ != NULL) { goto __catch0_g_error; } if (g_file_info_has_attribute (fi, G_FILE_ATTRIBUTE_THUMBNAIL_PATH)) { result = g_strdup (g_file_info_get_attribute_byte_string (fi, G_FILE_ATTRIBUTE_THUMBNAIL_PATH)); _g_object_unref0 (fi); return result; } _g_object_unref0 (fi); } goto __finally0; __catch0_g_error: { GError * err; err = _inner_error_; _inner_error_ = NULL; { g_warning ("vfs-file-impl-gio.vala:303: %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 NULL; } result = NULL; return result; } DesktopAgnosticVFSFileGIO* desktop_agnostic_vfs_file_gio_construct (GType object_type) { DesktopAgnosticVFSFileGIO * self = NULL; 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) { DesktopAgnosticVFSFileType result; DesktopAgnosticVFSFileGIO* self; DesktopAgnosticVFSFileType ft; GError * _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 __catch1_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 __finally1; __catch1_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 t" \ "ype: %s", err->message); ft = DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN; _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 = ft; return result; } static DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_gio_real_get_access_flags (DesktopAgnosticVFSFile* base) { DesktopAgnosticVFSAccessFlags result; DesktopAgnosticVFSFileGIO* self; DesktopAgnosticVFSAccessFlags flags; GError * _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 __catch2_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 __finally2; __catch2_g_error: { GError * err; err = _inner_error_; _inner_error_ = NULL; { g_warning ("vfs-file-impl-gio.vala:135: An error occurred while querying the acces" \ "s flags: %s", err->message); _g_error_free0 (err); } } __finally2: 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)->is_native = desktop_agnostic_vfs_file_gio_real_is_native; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_mime_type = desktop_agnostic_vfs_file_gio_real_get_mime_type; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_icon_names = desktop_agnostic_vfs_file_gio_real_get_icon_names; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_thumbnail_path = desktop_agnostic_vfs_file_gio_real_get_thumbnail_path; 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 volatile gsize desktop_agnostic_vfs_file_gio_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_gio_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_file_gio_type_id; desktop_agnostic_vfs_file_gio_type_id = g_type_register_static (DESKTOP_AGNOSTIC_VFS_TYPE_FILE, "DesktopAgnosticVFSFileGIO", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_vfs_file_gio_type_id__volatile, desktop_agnostic_vfs_file_gio_type_id); } return desktop_agnostic_vfs_file_gio_type_id__volatile; } 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_take_string (value, desktop_agnostic_vfs_file_get_impl_path ((DesktopAgnosticVFSFile*) self)); break; case DESKTOP_AGNOSTIC_VFS_FILE_GIO_IMPL_URI: g_value_take_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_take_object (value, desktop_agnostic_vfs_file_get_parent ((DesktopAgnosticVFSFile*) 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-volume.c0000664000175000017510000003626711537206464024721 0ustar seagleseagle/* vfs-volume.c generated by valac 0.10.4, 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) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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); GType desktop_agnostic_vfs_implementation_get_type (void) G_GNUC_CONST; DesktopAgnosticVFSImplementation* desktop_agnostic_vfs_get_default (GError** error); DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_implementation_volume_monitor_get_default (DesktopAgnosticVFSImplementation* self); GQuark desktop_agnostic_vfs_volume_error_quark (void) { return g_quark_from_static_string ("desktop_agnostic_vfs_volume_error-quark"); } /** * Tells whether the volume is mounted. */ 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; /** * The name of the volume. */ 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)); /** * Usually, the mount point of the volume. */ 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)); /** * Either an icon name usable with gtk.IconTheme, or an absolute path to * an image (either of which are associated with the volume). */ 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 volatile gsize desktop_agnostic_vfs_volume_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_volume_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_type_id__volatile, desktop_agnostic_vfs_volume_type_id); } return desktop_agnostic_vfs_volume_type_id__volatile; } 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 volatile gsize desktop_agnostic_vfs_volume_monitor_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_monitor_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_volume_monitor_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_monitor_type_id__volatile, desktop_agnostic_vfs_volume_monitor_type_id); } return desktop_agnostic_vfs_volume_monitor_type_id__volatile; } DesktopAgnosticVFSVolumeMonitor* desktop_agnostic_vfs_volume_monitor_get_default (GError** error) { DesktopAgnosticVFSVolumeMonitor* result = NULL; DesktopAgnosticVFSImplementation* vfs; GError * _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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-gio.vapi0000664000175000017510000000107411537206466025227 0ustar seagleseagle/* da-fdo-gio.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticFDO", lower_case_cprefix = "desktop_agnostic_fdo_")] namespace FDO { [CCode (cheader_filename = "libdesktop-agnostic/da-fdo-gio.h")] public class DesktopEntryGio : DesktopAgnostic.FDO.DesktopEntry, GLib.Object { public DesktopEntryGio (); } } } [CCode (cheader_filename = "libdesktop-agnostic/da-fdo-gio.h")] public static GLib.Type register_plugin (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-gio.deps0000664000175000017510000000011011537206466025211 0ustar seagleseaglegio-unix-2.0 desktop-agnostic-fdo desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-module-guesser.deps0000664000175000017510000000004611537206466026635 0ustar seagleseagledesktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-type-color.c0000664000175000017510000004715011537206466026151 0ustar seagleseagle/* config-type-color.c generated by valac 0.10.4, 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) G_GNUC_CONST; 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); GType register_plugin (void); 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); 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 = NULL; 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; GValue val = {0}; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigColorType*) base; g_return_if_fail (serialized != NULL); if (_vala_strcmp0 (serialized, "") == 0) { GValue _tmp0_ = {0}; GValue _tmp1_; 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; DesktopAgnosticColor* _tmp2_; GValue _tmp3_ = {0}; GValue _tmp4_; 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 = (_tmp4_ = (g_value_init (&_tmp3_, DESKTOP_AGNOSTIC_TYPE_COLOR), g_value_take_object (&_tmp3_, (_tmp2_ = color, color = NULL, _tmp2_)), _tmp3_), G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp4_); *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_->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; char* _tmp0_; char* _tmp1_; GValue _tmp2_ = {0}; GValue _tmp3_; GValue _tmp4_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigColorType*) base; g_return_if_fail (schema != NULL); g_return_if_fail (group != 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 = NULL; GValueArray* array; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigColorType*) base; g_return_val_if_fail (schema != NULL, NULL); g_return_val_if_fail (group != NULL, NULL); array = NULL; { gint list_length1; gint _list_size_; char** _tmp1_; 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 _tmp5_; GValue _tmp6_; _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_->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 = NULL; 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 volatile gsize desktop_agnostic_config_color_type_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_color_type_type_id__volatile)) { 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 }; GType desktop_agnostic_config_color_type_type_id; desktop_agnostic_config_color_type_type_id = g_type_register_static (DESKTOP_AGNOSTIC_CONFIG_TYPE_SCHEMA_TYPE, "DesktopAgnosticConfigColorType", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_color_type_type_id__volatile, desktop_agnostic_config_color_type_type_id); } return desktop_agnostic_config_color_type_type_id__volatile; } 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_take_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; } } /** * Used for Value transforms. */ void desktop_agnostic_config_color_to_string (GValue* src_value, GValue* dest_value) { DesktopAgnosticConfigColorType* ct; char* _tmp0_; GValue _tmp1_ = {0}; GValue _tmp2_; GError * _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 = (_tmp2_ = (g_value_init (&_tmp1_, G_TYPE_STRING), g_value_take_string (&_tmp1_, _tmp0_), _tmp1_), G_IS_VALUE (dest_value) ? (g_value_unset (dest_value), NULL) : NULL, _tmp2_); _g_object_unref0 (ct); } /** * Used for Value transforms. */ void desktop_agnostic_config_string_to_color (GValue* src_value, GValue* dest_value) { DesktopAgnosticConfigColorType* ct; GValue _tmp0_ = {0}; GValue _tmp1_; GValue _tmp2_; GError * _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 = 0UL; 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config.c0000664000175000017510000013243711537206465024060 0ustar seagleseagle/* config.c generated by valac 0.10.4, 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; /** * Errors which occur when setting/retrieving configuration options. */ 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) G_GNUC_CONST; GType desktop_agnostic_config_schema_get_type (void) G_GNUC_CONST; #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); static void _vala_GValue_free (GValue* self); 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); 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); GType desktop_agnostic_config_schema_option_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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); 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); GType desktop_agnostic_config_get_type (GError** error); static GType* _g_type_dup (GType* self); 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"); } static void _vala_GValue_free (GValue* self) { g_value_unset (self); g_free (self); } GHashTable* desktop_agnostic_config_backend_get_backend_metadata_keys (void) { GHashTable* result = NULL; if (desktop_agnostic_config_backend__backend_metadata_keys == NULL) { GHashTable* _tmp0_; desktop_agnostic_config_backend__backend_metadata_keys = (_tmp0_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, _vala_GValue_free), _g_hash_table_unref0 (desktop_agnostic_config_backend__backend_metadata_keys), _tmp0_); } result = desktop_agnostic_config_backend__backend_metadata_keys; return result; } /** * Resets the configuration to the default values. * @throws Error if something wrong happened during the reset */ 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); } /** * Removes all of the configuration. * @throws Error if the config removal could not be completed. */ 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); } /** * Adds a notification callback to the specified key. * @param group the group the key is associated with * @param key the config key to associate the callback with */ 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); } /** * Manually executes all of the notification callbacks associated with the * specified key. * @param group the group the key is associated with * @param key the config key that is associated with the callback(s) */ 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); } /** * Removes the specified notification callback for the specified key. * @param group the group the key is associated with * @param key the config key that is associated with the callback * @param callback the callback to remove * @throws Error if the callback is not associated with the key, among * other things */ 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); } /** * Sets the configuration option to the specified value. * @param group the group the key is associated with * @param key the config key that is associated with the value * @param value the new value of the configuration option * @throws Error if the group/key does not exist, the value type is not * supported, or something bad happened while trying to set the value */ 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) { DesktopAgnosticConfigSchemaOption* option; GType option_type = 0UL; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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_); _g_free0 (_tmp3_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_object_unref0 (st); _g_object_unref0 (option); return; } } _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 = 0.0F; GError * _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 converted = {0}; g_value_init (&converted, G_TYPE_FLOAT); 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 = 0; GError * _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 converted = {0}; g_value_init (&converted, G_TYPE_INT); 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 = NULL; 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); } /** * The abstract base class that defines what a configuration backend should * look like. */ GType desktop_agnostic_config_backend_get_type (void) { static volatile gsize desktop_agnostic_config_backend_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_backend_type_id__volatile)) { 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 }; GType desktop_agnostic_config_backend_type_id; desktop_agnostic_config_backend_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticConfigBackend", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); g_once_init_leave (&desktop_agnostic_config_backend_type_id__volatile, desktop_agnostic_config_backend_type_id); } return desktop_agnostic_config_backend_type_id__volatile; } 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; } } /** * Retrieve the default config backend type. * @return Config.Backend-based type on succes, Type.INVALID on failure */ 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 = 0UL; GError * _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; } /** * Convenience method for instantiating a configuration backend. * @return a Config.Backend object on success, %NULL on failure */ DesktopAgnosticConfigBackend* desktop_agnostic_config_new (DesktopAgnosticConfigSchema* schema, GError** error) { DesktopAgnosticConfigBackend* result = NULL; GType type; GError * _inner_error_ = NULL; g_return_val_if_fail (schema != NULL, 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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_CONFIG_BACKEND ((_tmp0_ = g_object_new (type, "schema", schema, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } /** * Convenience method for instantiating a configuration backend with an * instance ID. * @return a Config.Backend object on success, %NULL on failure */ DesktopAgnosticConfigBackend* desktop_agnostic_config_new_for_instance (const char* instance_id, DesktopAgnosticConfigSchema* schema, GError** error) { DesktopAgnosticConfigBackend* result = NULL; GType type; GError * _inner_error_ = NULL; g_return_val_if_fail (instance_id != NULL, NULL); g_return_val_if_fail (schema != NULL, 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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_CONFIG_BACKEND ((_tmp0_ = g_object_new (type, "schema", schema, "instance_id", instance_id, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-impl-gconf.c0000664000175000017510000022252611537206466026111 0ustar seagleseagle/* config-impl-gconf.c generated by valac 0.10.4, 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 __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (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_g_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_free (var), NULL))) #define __g_slist_free_gconf_entry_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_gconf_entry_unref (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) G_GNUC_CONST; #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_real_constructed (GObject* base); static void _vala_GValue_free (GValue* self); 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 _g_slist_free_g_free (GSList* self); static void _g_slist_free_gconf_entry_unref (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 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 GValueArray* desktop_agnostic_config_gconf_backend_slist_to_valuearray (DesktopAgnosticConfigGConfBackend* self, GSList* list, GType type, 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 desktop_agnostic_config_gconf_backend_real_set_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValueArray* value, GError** error); static void _g_slist_free_gconf_value_free (GSList* self); 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); GType register_plugin (void); static GValue* _g_value_dup (GValue* self); 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 void _vala_GValue_free (GValue* self) { g_value_unset (self); g_free (self); } static char* string_replace (const char* self, const char* old, const char* replacement) { char* result = NULL; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (old != NULL, NULL); g_return_val_if_fail (replacement != NULL, 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; char* _tmp0_; char* _tmp1_; char* opt_prefix; char* base_path; DesktopAgnosticConfigSchema* schema; GData* _tmp2_ = {0}; char* _tmp3_; GValue* _tmp4_; GValue* _tmp5_; GValue* _tmp6_; char* _tmp7_; char* _tmp8_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; 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_object_unref0 (schema); _g_free0 (base_path); _g_free0 (opt_prefix); 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_); __vala_GValue_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* _tmp15_; char* _tmp16_; _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_object_unref0 (schema); _g_free0 (base_path); _g_free0 (opt_prefix); 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_)), __vala_GValue_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_object_unref0 (schema); _g_free0 (base_path); _g_free0 (opt_prefix); 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_object_unref0 (schema); _g_free0 (base_path); _g_free0 (opt_prefix); 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 (schema); _g_free0 (base_path); _g_free0 (opt_prefix); } /** * Ported from #panel_applet_associate_schemas_in_dir (). */ static void _g_slist_free_g_free (GSList* self) { g_slist_foreach (self, (GFunc) g_free, NULL); g_slist_free (self); } 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 desktop_agnostic_config_gconf_backend_associate_schemas_in_dir (DesktopAgnosticConfigGConfBackend* self, const char* schema_dir, const char* pref_dir, GError** error) { GSList* entries; GSList* subdirs; GSList* _tmp0_; GSList* _tmp1_; GSList* _tmp18_; GSList* _tmp19_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (schema_dir != NULL); g_return_if_fail (pref_dir != 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_g_free0 (subdirs); __g_slist_free_gconf_entry_unref0 (entries); 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* _tmp3_; char* _tmp4_; GConfEntry* _tmp5_; GConfEntry* _tmp6_; char* _tmp7_ = NULL; char* _tmp8_; char* _tmp9_ = NULL; char* _tmp10_; 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_); _g_object_unref0 (option); _g_free0 (ckey); _g_free0 (cgroup); _g_free0 (pref_schema_key); _gconf_entry_unref0 (pref_entry); _g_free0 (key); _g_free0 (schema_key); _gconf_entry_unref0 (entry); __g_slist_free_g_free0 (subdirs); __g_slist_free_gconf_entry_unref0 (entries); 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_) { _g_object_unref0 (option); _g_free0 (ckey); _g_free0 (cgroup); _g_free0 (pref_schema_key); _gconf_entry_unref0 (pref_entry); _g_free0 (key); _g_free0 (schema_key); _gconf_entry_unref0 (entry); 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_); _g_object_unref0 (option); _g_free0 (ckey); _g_free0 (cgroup); _g_free0 (pref_schema_key); _gconf_entry_unref0 (pref_entry); _g_free0 (key); _g_free0 (schema_key); _gconf_entry_unref0 (entry); __g_slist_free_g_free0 (subdirs); __g_slist_free_gconf_entry_unref0 (entries); 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_); _g_object_unref0 (option); _g_free0 (ckey); _g_free0 (cgroup); _g_free0 (pref_schema_key); _gconf_entry_unref0 (pref_entry); _g_free0 (key); _g_free0 (schema_key); _gconf_entry_unref0 (entry); __g_slist_free_g_free0 (subdirs); __g_slist_free_gconf_entry_unref0 (entries); return; } } } _g_object_unref0 (option); _g_free0 (ckey); _g_free0 (cgroup); _g_free0 (pref_schema_key); _gconf_entry_unref0 (pref_entry); _g_free0 (key); _g_free0 (schema_key); _gconf_entry_unref0 (entry); } } } _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_g_free0 (subdirs); __g_slist_free_gconf_entry_unref0 (entries); 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 (pref_subdir); _g_free0 (schema_subdir); _g_free0 (base_key); __g_slist_free_g_free0 (subdirs); __g_slist_free_gconf_entry_unref0 (entries); return; } _g_free0 (pref_subdir); _g_free0 (schema_subdir); _g_free0 (base_key); } } } __g_slist_free_g_free0 (subdirs); __g_slist_free_gconf_entry_unref0 (entries); } static char* desktop_agnostic_config_gconf_backend_generate_key (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key) { char* result = NULL; 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, (gssize) (-1)); return result; } static char* string_substring (const char* self, glong offset, glong len) { char* result = NULL; glong string_length; const char* start; g_return_val_if_fail (self != NULL, NULL); string_length = string_get_length (self); 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 = 0; 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) { DesktopAgnosticConfigSchemaOption* schema_option; GType type = 0UL; GValue value = {0}; DesktopAgnosticConfigSchemaOption* _tmp0_; GError * _inner_error_ = NULL; 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); 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); return; } else { G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); 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 _tmp1_ = {0}; GValue _tmp2_; 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 _tmp3_ = {0}; GValue _tmp4_; 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 _tmp5_ = {0}; GValue _tmp6_; 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 _tmp7_ = {0}; GValue _tmp8_; 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 _tmp9_ = {0}; GValue _tmp10_; GValueArray* _tmp11_; GValueArray* _tmp12_; GValueArray* _tmp13_; GValueArray* _tmp14_; 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); return; } else { _g_value_array_free0 (array); G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); return; } else { _g_object_unref0 (st); G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); return; } else { _g_object_unref0 (st); G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_object_unref0 (schema_option); 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 = NULL; GValueArray* arr; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, 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 _tmp0_ = {0}; GValue _tmp1_; 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 _tmp2_ = {0}; GValue _tmp3_; 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 _tmp4_ = {0}; GValue _tmp5_; 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 _tmp6_ = {0}; GValue _tmp7_; 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) { char* full_key; char* group; char* key; GValue value = {0}; char* _tmp0_ = NULL; char* _tmp1_; char* _tmp2_ = NULL; char* _tmp3_; GValue _tmp4_ = {0}; GValue _tmp5_; GValue _tmp6_; GSList* notify_func_list; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (client != NULL); g_return_if_fail (entry != 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_free0 (key); _g_free0 (group); _g_free0 (full_key); 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_free0 (key); _g_free0 (group); _g_free0 (full_key); } static void _desktop_agnostic_config_gconf_backend_ensure_key_exists (DesktopAgnosticConfigGConfBackend* self, const char* group, const char* key, GError** error) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; 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); _g_free0 (full_key); _desktop_agnostic_config_notify_delegate_free0 (notify); } static void desktop_agnostic_config_gconf_backend_real_notify (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { DesktopAgnosticConfigGConfBackend * self; char* full_key; GSList* notifications; GValue value = {0}; GValue _tmp0_ = {0}; GValue _tmp1_; GValue _tmp2_; GError * _inner_error_ = NULL; 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); 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_free0 (full_key); 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_free0 (full_key); } 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); } _desktop_agnostic_config_notify_delegate_free0 (ndata); _g_free0 (full_key); } static void desktop_agnostic_config_gconf_backend_real_reset (DesktopAgnosticConfigBackend* base, GError** error) { DesktopAgnosticConfigGConfBackend * self; DesktopAgnosticConfigSchema* schema; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; 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_); _gconf_value_free0 (val); _g_free0 (full_key); _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_); _gconf_value_free0 (val); _g_free0 (full_key); _g_list_free0 (group_collection); _g_object_unref0 (schema); return; } _gconf_value_free0 (val); _g_free0 (full_key); } } } } } _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; char* full_key; GConfValue* gc_val; GConfEntry* entry; GValue val = {0}; char* _tmp0_; GConfEntry* _tmp1_; GConfEntry* _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _gconf_entry_unref0 (entry); _g_free0 (full_key); 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _gconf_entry_unref0 (entry); _g_free0 (full_key); 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _gconf_entry_unref0 (entry); _g_free0 (full_key); return; } val = (_tmp5_ = _tmp4_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp5_); } *result = val; _gconf_entry_unref0 (entry); _g_free0 (full_key); 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 = FALSE; char* full_key; char* _tmp0_; gboolean _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_val_if_fail (group != NULL, FALSE); g_return_val_if_fail (key != NULL, FALSE); 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; char* full_key; char* _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = 0.0F; char* full_key; char* _tmp0_; double _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_val_if_fail (group != NULL, 0.0F); g_return_val_if_fail (key != NULL, 0.0F); 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; char* full_key; char* _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = 0; char* full_key; char* _tmp0_; gint _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_val_if_fail (group != NULL, 0); g_return_val_if_fail (key != NULL, 0); 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; char* full_key; char* _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = NULL; char* full_key; char* _tmp0_; char* _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_val_if_fail (group != NULL, NULL); g_return_val_if_fail (key != NULL, 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; char* full_key; char* _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != NULL); g_return_if_fail (value != 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 = NULL; char* full_key; GType list_type = 0UL; GConfValue* gc_val; char* _tmp0_; GConfValue* _tmp1_; GConfValue* _tmp2_; GValueArray* _tmp3_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_val_if_fail (group != NULL, NULL); g_return_val_if_fail (key != NULL, 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_); _gconf_value_free0 (gc_val); _g_free0 (full_key); 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_); _gconf_value_free0 (gc_val); _g_free0 (full_key); 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_); _gconf_value_free0 (gc_val); _g_free0 (full_key); return NULL; } result = _tmp3_; _gconf_value_free0 (gc_val); _g_free0 (full_key); 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; char* full_key; GType type = 0UL; char* _tmp0_; gboolean _tmp1_ = FALSE; gboolean _tmp2_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGConfBackend*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != NULL); g_return_if_fail (value != 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); _gconf_value_free0 (val); __g_slist_free_gconf_value_free0 (list); _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); _gconf_value_free0 (val); __g_slist_free_gconf_value_free0 (list); _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); _gconf_value_free0 (val); __g_slist_free_gconf_value_free0 (list); _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_); _gconf_value_free0 (val); __g_slist_free_gconf_value_free0 (list); _g_free0 (full_key); return; } _gconf_value_free0 (val); __g_slist_free_gconf_value_free0 (list); } 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_slist_free_g_free0 (list); _g_object_unref0 (st); _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_slist_free_g_free0 (list); _g_object_unref0 (st); _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_slist_free_g_free0 (list); _g_object_unref0 (st); _g_free0 (full_key); return; } __g_slist_free_g_free0 (list); _g_object_unref0 (st); } _g_free0 (full_key); } DesktopAgnosticConfigGConfBackend* desktop_agnostic_config_gconf_backend_construct (GType object_type) { DesktopAgnosticConfigGConfBackend * self = NULL; self = (DesktopAgnosticConfigGConfBackend*) desktop_agnostic_config_backend_construct (object_type); 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 volatile gsize desktop_agnostic_config_gconf_backend_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_gconf_backend_type_id__volatile)) { 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 }; GType desktop_agnostic_config_gconf_backend_type_id; desktop_agnostic_config_gconf_backend_type_id = g_type_register_static (DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, "DesktopAgnosticConfigGConfBackend", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_gconf_backend_type_id__volatile, desktop_agnostic_config_gconf_backend_type_id); } return desktop_agnostic_config_gconf_backend_type_id__volatile; } 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_take_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 = 0UL; GValue val = {0}; GHashTable* backend_metadata_keys; GValue _tmp0_ = {0}; GValue _tmp1_; GValue _tmp2_ = {0}; GValue _tmp3_; 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-vfs.vapi0000664000175000017510000001765611537206464027406 0ustar seagleseagle/* desktop-agnostic-vfs.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticVFS", lower_case_cprefix = "desktop_agnostic_vfs_")] 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 (); public abstract string[] get_icon_names () throws GLib.Error; public abstract string get_mime_type () throws GLib.Error; public virtual string? get_thumbnail_path (); protected abstract void init (string uri); public bool is_executable (); public abstract bool is_native (); 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 string[] get_icon_names_for_mime_type (string mime_type); [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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-gconf.deps0000664000175000017510000000010511537206466025522 0ustar seagleseaglegconf-2.0 desktop-agnostic-cfg desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-type-color.vapi0000664000175000017510000000267111537206466026541 0ustar seagleseagle/* da-cfg-type-color.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_")] 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 (); libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-glib.deps0000664000175000017510000000007311537206467025361 0ustar seagleseagledesktop-agnostic-fdo desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-gio.h0000664000175000017510000000373111537206466024521 0ustar seagleseagle/* da-fdo-gio.h generated by valac 0.10.4, the Vala compiler, do not modify */ #ifndef __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_FDO_GIO_H__ #define __DEFAULT_LIBDESKTOP_AGNOSTIC_DA_FDO_GIO_H__ #include #include #include G_BEGIN_DECLS #define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO (desktop_agnostic_fdo_desktop_entry_gio_get_type ()) #define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO, DesktopAgnosticFDODesktopEntryGio)) #define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO, DesktopAgnosticFDODesktopEntryGioClass)) #define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO)) #define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO)) #define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO, DesktopAgnosticFDODesktopEntryGioClass)) typedef struct _DesktopAgnosticFDODesktopEntryGio DesktopAgnosticFDODesktopEntryGio; typedef struct _DesktopAgnosticFDODesktopEntryGioClass DesktopAgnosticFDODesktopEntryGioClass; typedef struct _DesktopAgnosticFDODesktopEntryGioPrivate DesktopAgnosticFDODesktopEntryGioPrivate; struct _DesktopAgnosticFDODesktopEntryGio { GObject parent_instance; DesktopAgnosticFDODesktopEntryGioPrivate * priv; }; struct _DesktopAgnosticFDODesktopEntryGioClass { GObjectClass parent_class; }; GType desktop_agnostic_fdo_desktop_entry_gio_get_type (void) G_GNUC_CONST; DesktopAgnosticFDODesktopEntryGio* desktop_agnostic_fdo_desktop_entry_gio_new (void); DesktopAgnosticFDODesktopEntryGio* desktop_agnostic_fdo_desktop_entry_gio_construct (GType object_type); GType register_plugin (void); G_END_DECLS #endif libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file-impl-gnome-vfs.c0000664000175000017510000007516211537206466027166 0ustar seagleseagle/* vfs-file-impl-gnome-vfs.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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); static DesktopAgnosticVFSFileMonitor* desktop_agnostic_vfs_file_gnome_vfs_real_monitor (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) G_GNUC_CONST; 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 gboolean desktop_agnostic_vfs_file_gnome_vfs_real_launch (DesktopAgnosticVFSFile* base, GError** error); static void _g_list_free_g_free (GList* self); static GSList* desktop_agnostic_vfs_file_gnome_vfs_real_enumerate_children (DesktopAgnosticVFSFile* base, GError** error); static void _g_slist_free_g_object_unref (GSList* self); 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); static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_is_native (DesktopAgnosticVFSFile* base); static char* desktop_agnostic_vfs_file_gnome_vfs_real_get_mime_type (DesktopAgnosticVFSFile* base, GError** error); static char** desktop_agnostic_vfs_file_gnome_vfs_real_get_icon_names (DesktopAgnosticVFSFile* base, int* result_length1, 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 = FALSE; 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 = NULL; self = (DesktopAgnosticVFSFileGnomeVFS*) base; result = (DesktopAgnosticVFSFileMonitor*) desktop_agnostic_vfs_file_monitor_gnome_vfs_new (self); return result; } /** * @return %TRUE if it's an error */ 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 = FALSE; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); 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)); _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 = FALSE; GnomeVFSFileInfo* info; GnomeVFSResult res = 0; GnomeVFSHandle* handle; gint buffer_length1; gint _buffer_size_; gchar* buffer; GnomeVFSFileInfo* _tmp0_; gboolean _tmp1_; gboolean _tmp2_; gchar* _tmp3_; gboolean _tmp4_; char* _tmp5_; gboolean _tmp6_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGnomeVFS*) base; if (contents != NULL) { *contents = 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_); buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); return FALSE; } if (_tmp1_) { result = FALSE; buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); 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_); buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); return FALSE; } if (_tmp2_) { result = FALSE; buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); 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_); buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); return FALSE; } if (_tmp4_) { result = FALSE; buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); 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_); buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); return FALSE; } if (_tmp6_) { result = FALSE; buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); return result; } result = TRUE; buffer = (g_free (buffer), NULL); _gnome_vfs_file_info_unref0 (info); return result; } static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_replace_contents (DesktopAgnosticVFSFile* base, const char* contents, GError** error) { DesktopAgnosticVFSFileGnomeVFS * self; gboolean result = FALSE; GnomeVFSResult res = 0; GnomeVFSHandle* handle; gboolean _tmp0_; gboolean _tmp1_; gboolean _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGnomeVFS*) base; g_return_val_if_fail (contents != NULL, FALSE); 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 = FALSE; 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; __g_list_free_g_free0 (uris); _gnome_vfs_file_info_unref0 (info); 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 = NULL; GSList* _result_; GnomeVFSDirectoryHandle* dir; GnomeVFSResult res = 0; GSList* _tmp0_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGnomeVFS*) base; _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_object_unref0 (child); _g_free0 (full_uri); _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_object_unref0 (child); _g_free0 (full_uri); } } 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 = FALSE; 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 = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGnomeVFS*) base; 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; } static gboolean desktop_agnostic_vfs_file_gnome_vfs_real_is_native (DesktopAgnosticVFSFile* base) { DesktopAgnosticVFSFileGnomeVFS * self; gboolean result = FALSE; self = (DesktopAgnosticVFSFileGnomeVFS*) base; result = g_str_has_prefix (self->priv->_uri_str, "file:"); return result; } static char* desktop_agnostic_vfs_file_gnome_vfs_real_get_mime_type (DesktopAgnosticVFSFile* base, GError** error) { DesktopAgnosticVFSFileGnomeVFS * self; char* result = NULL; self = (DesktopAgnosticVFSFileGnomeVFS*) base; result = g_strdup (gnome_vfs_get_mime_type_from_uri (self->priv->_uri)); return result; } static char** desktop_agnostic_vfs_file_gnome_vfs_real_get_icon_names (DesktopAgnosticVFSFile* base, int* result_length1, GError** error) { DesktopAgnosticVFSFileGnomeVFS * self; char** result = NULL; char* _tmp0_; char* _tmp1_; gint _tmp2_; char** _tmp3_; char** _tmp4_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSFileGnomeVFS*) base; _tmp0_ = desktop_agnostic_vfs_file_get_mime_type ((DesktopAgnosticVFSFile*) self, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return NULL; } result = (_tmp4_ = (_tmp3_ = desktop_agnostic_vfs_get_icon_names_for_mime_type (_tmp1_ = _tmp0_, &_tmp2_), _g_free0 (_tmp1_), _tmp3_), *result_length1 = _tmp2_, _tmp4_); return result; } DesktopAgnosticVFSFileGnomeVFS* desktop_agnostic_vfs_file_gnome_vfs_construct (GType object_type) { DesktopAgnosticVFSFileGnomeVFS * self = NULL; 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)->is_native = desktop_agnostic_vfs_file_gnome_vfs_real_is_native; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_mime_type = desktop_agnostic_vfs_file_gnome_vfs_real_get_mime_type; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_icon_names = desktop_agnostic_vfs_file_gnome_vfs_real_get_icon_names; 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 volatile gsize desktop_agnostic_vfs_file_gnome_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_gnome_vfs_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_file_gnome_vfs_type_id; desktop_agnostic_vfs_file_gnome_vfs_type_id = g_type_register_static (DESKTOP_AGNOSTIC_VFS_TYPE_FILE, "DesktopAgnosticVFSFileGnomeVFS", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_vfs_file_gnome_vfs_type_id__volatile, desktop_agnostic_vfs_file_gnome_vfs_type_id); } return desktop_agnostic_vfs_file_gnome_vfs_type_id__volatile; } 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_take_string (value, desktop_agnostic_vfs_file_get_impl_uri ((DesktopAgnosticVFSFile*) self)); break; case DESKTOP_AGNOSTIC_VFS_FILE_GNOME_VFS_IMPL_PATH: g_value_take_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_take_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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-thunar-vfs.deps0000664000175000017510000000007711537206465026571 0ustar seagleseaglethunar-vfs-1 dbus-glib-1 desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file-monitor-impl-gnome-vfs.c0000664000175000017510000003412011537206466030640 0ustar seagleseagle/* vfs-file-monitor-impl-gnome-vfs.c generated by valac 0.10.4, 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 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 _g_free0(var) (var = (g_free (var), NULL)) 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) G_GNUC_CONST; #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 }; GType desktop_agnostic_vfs_file_gnome_vfs_get_type (void) G_GNUC_CONST; 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_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); 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 = NULL; 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) { DesktopAgnosticVFSFile* info_file; DesktopAgnosticVFSFileMonitorEvent da_event = 0; GError * _inner_error_ = NULL; 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); 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 = FALSE; 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 volatile gsize desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id__volatile, desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id); } return desktop_agnostic_vfs_file_monitor_gnome_vfs_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-gnome.h0000664000175000017510000000403111537206467025043 0ustar seagleseagle/* da-fdo-gnome.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-ui.deps0000664000175000017510000000010411537206467027200 0ustar seagleseagledesktop-agnostic-fdo gtk+-2.0 desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/ui-launcher-editor-dialog.c0000664000175000017510000013633111537206467027547 0ustar seagleseagle/* ui-launcher-editor-dialog.c generated by valac 0.10.4, 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 #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_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))) 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 { GtkComboBox* _type_combo; DesktopAgnosticUIIconButton* _icon; GtkEntry* _name; GtkEntry* _desc; GtkEntry* _exec; GtkExpander* _advanced; GtkCheckButton* _terminal; GtkCheckButton* _startup_notification; GtkLabel* _command_label; DesktopAgnosticVFSFile* _file; DesktopAgnosticVFSFile* _output; gboolean _entry_type_sensitive; 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) G_GNUC_CONST; 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); void desktop_agnostic_ui_fixed_table_attach_expand (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) G_GNUC_CONST; GType desktop_agnostic_ui_icon_button_get_type (void) G_GNUC_CONST; #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, DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_ENTRY_TYPE_SENSITIVE }; DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_new (DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean entry_type_sensitive); DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_construct (GType object_type, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean entry_type_sensitive); static void desktop_agnostic_ui_launcher_editor_dialog_real_constructed (GObject* base); 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_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); gboolean desktop_agnostic_ui_launcher_editor_dialog_get_entry_type_sensitive (DesktopAgnosticUILauncherEditorDialog* self); static void _lambda1_ (DesktopAgnosticUILauncherEditorDialog* self); static void __lambda1__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void desktop_agnostic_ui_launcher_editor_dialog_on_type_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkComboBox* combo); static void _desktop_agnostic_ui_launcher_editor_dialog_on_type_changed_gtk_combo_box_changed (GtkComboBox* _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); static void desktop_agnostic_ui_launcher_editor_dialog_set_file (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticVFSFile* value); DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_output (DesktopAgnosticUILauncherEditorDialog* self); static void desktop_agnostic_ui_launcher_editor_dialog_set_output (DesktopAgnosticUILauncherEditorDialog* self, DesktopAgnosticVFSFile* value); void desktop_agnostic_ui_launcher_editor_dialog_set_entry_type_sensitive (DesktopAgnosticUILauncherEditorDialog* self, gboolean value); 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); } void desktop_agnostic_ui_fixed_table_attach_expand (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_EXPAND, 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 volatile gsize desktop_agnostic_ui_fixed_table_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_fixed_table_type_id__volatile)) { 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 }; GType desktop_agnostic_ui_fixed_table_type_id; desktop_agnostic_ui_fixed_table_type_id = g_type_register_static (GTK_TYPE_TABLE, "DesktopAgnosticUIFixedTable", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_ui_fixed_table_type_id__volatile, desktop_agnostic_ui_fixed_table_type_id); } return desktop_agnostic_ui_fixed_table_type_id__volatile; } DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_construct (GType object_type, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean entry_type_sensitive) { DesktopAgnosticUILauncherEditorDialog * self = NULL; g_return_val_if_fail (file != NULL, NULL); self = (DesktopAgnosticUILauncherEditorDialog*) g_object_new (object_type, "file", file, "output", output, "border-width", 4, "entry-type-sensitive", entry_type_sensitive, NULL); return self; } DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_new (DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean entry_type_sensitive) { return desktop_agnostic_ui_launcher_editor_dialog_construct (DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG, file, output, entry_type_sensitive); } 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; DesktopAgnosticFDODesktopEntry* _tmp1_; DesktopAgnosticFDODesktopEntry* _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticUILauncherEditorDialog*) base; gtk_window_set_title ((GtkWindow*) self, _ ("Desktop Entry Editor")); gtk_window_set_icon_name ((GtkWindow*) self, "gtk-preferences"); 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 _lambda1_ (DesktopAgnosticUILauncherEditorDialog* self) { gtk_widget_set_sensitive ((GtkWidget*) self->priv->_type_combo, self->priv->_entry_type_sensitive); } static void __lambda1__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { _lambda1_ (self); } static void _desktop_agnostic_ui_launcher_editor_dialog_on_type_changed_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) { desktop_agnostic_ui_launcher_editor_dialog_on_type_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* type_label; GtkLabel* name_label; GtkLabel* desc_label; GtkLabel* exec_label; GtkHBox* exec_hbox; GtkVBox* advanced_vbox; gboolean is_application; DesktopAgnosticUIFixedTable* _tmp0_; DesktopAgnosticUIIconButton* _tmp3_; GtkLabel* _tmp4_; GtkComboBox* _tmp5_; gint active_index; GtkLabel* _tmp6_; GtkEntry* _tmp7_; GtkLabel* _tmp9_; GtkEntry* _tmp10_; GtkLabel* _tmp12_; GtkHBox* _tmp13_; GtkEntry* _tmp14_; const char* _tmp15_; char* key_name; GtkButton* _tmp17_; GtkImage* _tmp18_; GtkExpander* _tmp19_; GtkVBox* _tmp20_; GtkCheckButton* _tmp21_; GtkCheckButton* _tmp22_; GList* focus_chain_list; g_return_if_fail (self != NULL); table = NULL; icon = NULL; exec_button = NULL; exec_image = NULL; type_label = NULL; name_label = NULL; desc_label = NULL; exec_label = NULL; exec_hbox = NULL; advanced_vbox = NULL; is_application = TRUE; 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) 3, (guint) 5)), _g_object_unref0 (table), _tmp0_); gtk_table_set_row_spacings ((GtkTable*) table, (guint) 5); g_object_set ((GtkTable*) table, "column-spacing", (guint) 6, 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) 4); if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Type")) { is_application = desktop_agnostic_fdo_desktop_entry_get_entry_type (self->priv->_entry) == DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION; } else { desktop_agnostic_fdo_desktop_entry_set_entry_type (self->priv->_entry, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION); } type_label = (_tmp4_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic (_ ("T_ype:"))), _g_object_unref0 (type_label), _tmp4_); g_object_set ((GtkMisc*) type_label, "xalign", 1.0f, NULL); desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) type_label, (guint) 1, (guint) 2, (guint) 0, (guint) 1); self->priv->_type_combo = (_tmp5_ = g_object_ref_sink ((GtkComboBox*) gtk_combo_box_new_text ()), _g_object_unref0 (self->priv->_type_combo), _tmp5_); gtk_combo_box_append_text (self->priv->_type_combo, _ ("Application")); gtk_combo_box_append_text (self->priv->_type_combo, _ ("Location")); gtk_label_set_mnemonic_widget (type_label, (GtkWidget*) self->priv->_type_combo); active_index = -1; switch (desktop_agnostic_fdo_desktop_entry_get_entry_type (self->priv->_entry)) { case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: { active_index = 0; break; } case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK: { active_index = 1; break; } } gtk_combo_box_set_active (self->priv->_type_combo, active_index); gtk_widget_set_sensitive ((GtkWidget*) self->priv->_type_combo, self->priv->_entry_type_sensitive); g_signal_connect_object ((GObject*) self, "notify::entry-type-sensitive", (GCallback) __lambda1__g_object_notify, self, 0); g_signal_connect_object (self->priv->_type_combo, "changed", (GCallback) _desktop_agnostic_ui_launcher_editor_dialog_on_type_changed_gtk_combo_box_changed, self, 0); desktop_agnostic_ui_fixed_table_attach_expand (table, (GtkWidget*) self->priv->_type_combo, (guint) 2, (guint) 3, (guint) 0, (guint) 1); name_label = (_tmp6_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic (_ ("_Name:"))), _g_object_unref0 (name_label), _tmp6_); g_object_set ((GtkMisc*) name_label, "xalign", 1.0f, NULL); desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) name_label, (guint) 1, (guint) 2, (guint) 1, (guint) 2); self->priv->_name = (_tmp7_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), _g_object_unref0 (self->priv->_name), _tmp7_); gtk_label_set_mnemonic_widget (name_label, (GtkWidget*) self->priv->_name); if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Name")) { char* _tmp8_; gtk_entry_set_text (self->priv->_name, _tmp8_ = desktop_agnostic_fdo_desktop_entry_get_name (self->priv->_entry)); _g_free0 (_tmp8_); } 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_expand (table, (GtkWidget*) self->priv->_name, (guint) 2, (guint) 3, (guint) 1, (guint) 2); desc_label = (_tmp9_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic (_ ("_Description:"))), _g_object_unref0 (desc_label), _tmp9_); g_object_set ((GtkMisc*) desc_label, "xalign", 1.0f, NULL); desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) desc_label, (guint) 1, (guint) 2, (guint) 2, (guint) 3); self->priv->_desc = (_tmp10_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), _g_object_unref0 (self->priv->_desc), _tmp10_); gtk_label_set_mnemonic_widget (desc_label, (GtkWidget*) self->priv->_desc); if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, "Comment")) { char* _tmp11_; gtk_entry_set_text (self->priv->_desc, _tmp11_ = desktop_agnostic_fdo_desktop_entry_get_string (self->priv->_entry, "Comment")); _g_free0 (_tmp11_); } 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_expand (table, (GtkWidget*) self->priv->_desc, (guint) 2, (guint) 3, (guint) 2, (guint) 3); exec_label = (_tmp12_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic (_ ("_Command:"))), _g_object_unref0 (exec_label), _tmp12_); self->priv->_command_label = exec_label; g_object_set ((GtkMisc*) exec_label, "xalign", 1.0f, NULL); desktop_agnostic_ui_fixed_table_attach_defaults (table, (GtkWidget*) exec_label, (guint) 1, (guint) 2, (guint) 3, (guint) 4); exec_hbox = (_tmp13_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 5)), _g_object_unref0 (exec_hbox), _tmp13_); self->priv->_exec = (_tmp14_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), _g_object_unref0 (self->priv->_exec), _tmp14_); gtk_label_set_mnemonic_widget (exec_label, (GtkWidget*) self->priv->_exec); _tmp15_ = NULL; if (is_application) { _tmp15_ = "Exec"; } else { _tmp15_ = "URL"; } key_name = g_strdup (_tmp15_); if (desktop_agnostic_fdo_desktop_entry_key_exists (self->priv->_entry, key_name)) { char* _tmp16_; gtk_entry_set_text (self->priv->_exec, _tmp16_ = desktop_agnostic_fdo_desktop_entry_get_string (self->priv->_entry, key_name)); _g_free0 (_tmp16_); } 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_box_pack_start ((GtkBox*) exec_hbox, (GtkWidget*) self->priv->_exec, TRUE, TRUE, 0); exec_button = (_tmp17_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_mnemonic (_ ("_Browse..."))), _g_object_unref0 (exec_button), _tmp17_); exec_image = (_tmp18_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON)), _g_object_unref0 (exec_image), _tmp18_); 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_box_pack_start ((GtkBox*) exec_hbox, (GtkWidget*) exec_button, FALSE, TRUE, 0); desktop_agnostic_ui_fixed_table_attach_expand (table, (GtkWidget*) exec_hbox, (guint) 2, (guint) 3, (guint) 3, (guint) 4); self->priv->_advanced = (_tmp19_ = g_object_ref_sink ((GtkExpander*) gtk_expander_new_with_mnemonic (_ ("_Advanced"))), _g_object_unref0 (self->priv->_advanced), _tmp19_); advanced_vbox = (_tmp20_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 5)), _g_object_unref0 (advanced_vbox), _tmp20_); self->priv->_terminal = (_tmp21_ = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Run in _terminal"))), _g_object_unref0 (self->priv->_terminal), _tmp21_); 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 = (_tmp22_ = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Use _startup notification"))), _g_object_unref0 (self->priv->_startup_notification), _tmp22_); 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*) self->priv->_advanced, (GtkWidget*) advanced_vbox); desktop_agnostic_ui_fixed_table_attach_expand (table, (GtkWidget*) self->priv->_advanced, (guint) 0, (guint) 3, (guint) 4, (guint) 5); desktop_agnostic_ui_launcher_editor_dialog_on_type_changed (self, self->priv->_type_combo); focus_chain_list = NULL; focus_chain_list = g_list_append (focus_chain_list, (GtkWidget*) self->priv->_type_combo); focus_chain_list = g_list_append (focus_chain_list, (GtkWidget*) self->priv->_name); focus_chain_list = g_list_append (focus_chain_list, (GtkWidget*) self->priv->_desc); focus_chain_list = g_list_append (focus_chain_list, (GtkWidget*) exec_hbox); focus_chain_list = g_list_append (focus_chain_list, (GtkWidget*) self->priv->_icon); focus_chain_list = g_list_append (focus_chain_list, (GtkWidget*) self->priv->_advanced); gtk_container_set_focus_chain ((GtkContainer*) table, focus_chain_list); gtk_container_add ((GtkContainer*) ((GtkDialog*) self)->vbox, (GtkWidget*) table); _g_list_free0 (focus_chain_list); _g_free0 (key_name); _g_object_unref0 (advanced_vbox); _g_object_unref0 (exec_hbox); _g_object_unref0 (exec_label); _g_object_unref0 (desc_label); _g_object_unref0 (name_label); _g_object_unref0 (type_label); _g_object_unref0 (exec_image); _g_object_unref0 (exec_button); _g_free0 (icon); _g_object_unref0 (table); } 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_type_changed (DesktopAgnosticUILauncherEditorDialog* self, GtkComboBox* combo) { g_return_if_fail (self != NULL); g_return_if_fail (combo != NULL); switch (gtk_combo_box_get_active (combo)) { case 0: { desktop_agnostic_fdo_desktop_entry_set_entry_type (self->priv->_entry, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION); break; } case 1: { desktop_agnostic_fdo_desktop_entry_set_entry_type (self->priv->_entry, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK); break; } } if (desktop_agnostic_fdo_desktop_entry_get_entry_type (self->priv->_entry) == DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK) { gtk_label_set_markup_with_mnemonic (self->priv->_command_label, _ ("_Location:")); gtk_widget_hide ((GtkWidget*) self->priv->_advanced); gtk_widget_set_no_show_all ((GtkWidget*) self->priv->_advanced, TRUE); } else { gtk_label_set_markup_with_mnemonic (self->priv->_command_label, _ ("_Command:")); gtk_widget_set_no_show_all ((GtkWidget*) self->priv->_advanced, FALSE); gtk_widget_show ((GtkWidget*) self->priv->_advanced); } } 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; const char* _tmp1_; char* key_name; 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)); _tmp1_ = NULL; if (desktop_agnostic_fdo_desktop_entry_get_entry_type (self->priv->_entry) == DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK) { _tmp1_ = "URL"; } else { _tmp1_ = "Exec"; } key_name = g_strdup (_tmp1_); desktop_agnostic_fdo_desktop_entry_set_string (self->priv->_entry, key_name, gtk_entry_get_text (entry)); _g_free0 (key_name); _g_object_unref0 (entry); } static void desktop_agnostic_ui_launcher_editor_dialog_on_exec_browse (DesktopAgnosticUILauncherEditorDialog* self, GtkButton* btn) { GtkFileChooserDialog* dialog; gint response = 0; gboolean is_link; const char* _tmp0_; char* title; GtkFileChooserDialog* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (btn != NULL); dialog = NULL; is_link = desktop_agnostic_fdo_desktop_entry_get_entry_type (self->priv->_entry) == DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK; _tmp0_ = NULL; if (is_link) { _tmp0_ = _ ("Locate a file"); } else { _tmp0_ = _ ("Locate Command"); } title = g_strdup (_tmp0_); dialog = (_tmp1_ = g_object_ref_sink ((GtkFileChooserDialog*) gtk_file_chooser_dialog_new (title, (GtkWindow*) self, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL)), _g_object_unref0 (dialog), _tmp1_); response = gtk_dialog_run ((GtkDialog*) dialog); if (response == GTK_RESPONSE_OK) { char* _tmp2_; _tmp2_ = NULL; if (is_link) { char* _tmp3_; _tmp2_ = (_tmp3_ = gtk_file_chooser_get_uri ((GtkFileChooser*) dialog), _g_free0 (_tmp2_), _tmp3_); } else { char* _tmp4_; _tmp2_ = (_tmp4_ = gtk_file_chooser_get_filename ((GtkFileChooser*) dialog), _g_free0 (_tmp2_), _tmp4_); } gtk_entry_set_text (self->priv->_exec, _tmp2_); _g_free0 (_tmp2_); } gtk_object_destroy ((GtkObject*) dialog); _g_free0 (title); _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)); } /** * Pops up a "Save As" dialog. */ static gboolean desktop_agnostic_ui_launcher_editor_dialog_change_output_file_prompt (DesktopAgnosticUILauncherEditorDialog* self) { gboolean result = FALSE; GtkFileChooserDialog* dialog; gint response = 0; gboolean try_to_save = FALSE; GtkFileChooserDialog* _tmp0_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); 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) { gboolean try_to_save; GError * _inner_error_ = NULL; g_return_if_fail (self != 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_object_unref0 (dialog); _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_); return; } } } 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"); } gboolean desktop_agnostic_ui_launcher_editor_dialog_get_entry_type_sensitive (DesktopAgnosticUILauncherEditorDialog* self) { gboolean result; g_return_val_if_fail (self != NULL, FALSE); result = self->priv->_entry_type_sensitive; return result; } void desktop_agnostic_ui_launcher_editor_dialog_set_entry_type_sensitive (DesktopAgnosticUILauncherEditorDialog* self, gboolean value) { g_return_if_fail (self != NULL); self->priv->_entry_type_sensitive = value; g_object_notify ((GObject *) self, "entry-type-sensitive"); } 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)); g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_ENTRY_TYPE_SENSITIVE, g_param_spec_boolean ("entry-type-sensitive", "entry-type-sensitive", "entry-type-sensitive", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); } static void desktop_agnostic_ui_launcher_editor_dialog_instance_init (DesktopAgnosticUILauncherEditorDialog * self) { self->priv = DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_GET_PRIVATE (self); self->priv->_entry_type_sensitive = FALSE; } 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->_type_combo); _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->_advanced); _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 volatile gsize desktop_agnostic_ui_launcher_editor_dialog_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_launcher_editor_dialog_type_id__volatile)) { 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 }; GType desktop_agnostic_ui_launcher_editor_dialog_type_id; desktop_agnostic_ui_launcher_editor_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "DesktopAgnosticUILauncherEditorDialog", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_ui_launcher_editor_dialog_type_id__volatile, desktop_agnostic_ui_launcher_editor_dialog_type_id); } return desktop_agnostic_ui_launcher_editor_dialog_type_id__volatile; } 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; case DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_ENTRY_TYPE_SENSITIVE: g_value_set_boolean (value, desktop_agnostic_ui_launcher_editor_dialog_get_entry_type_sensitive (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; case DESKTOP_AGNOSTIC_UI_LAUNCHER_EDITOR_DIALOG_ENTRY_TYPE_SENSITIVE: desktop_agnostic_ui_launcher_editor_dialog_set_entry_type_sensitive (self, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/ui-icon-chooser-dialog.c0000664000175000017510000015534211537206467027055 0ustar seagleseagle/* ui-icon-chooser-dialog.c generated by valac 0.10.4, 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 #define DESKTOP_AGNOSTIC_UI_TYPE_ICON_TYPE (desktop_agnostic_ui_icon_type_get_type ()) #define DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER (desktop_agnostic_ui_lazy_pixbuf_renderer_get_type ()) #define DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER, DesktopAgnosticUILazyPixbufRenderer)) #define DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER, DesktopAgnosticUILazyPixbufRendererClass)) #define DESKTOP_AGNOSTIC_UI_IS_LAZY_PIXBUF_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER)) #define DESKTOP_AGNOSTIC_UI_IS_LAZY_PIXBUF_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER)) #define DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER, DesktopAgnosticUILazyPixbufRendererClass)) typedef struct _DesktopAgnosticUILazyPixbufRenderer DesktopAgnosticUILazyPixbufRenderer; typedef struct _DesktopAgnosticUILazyPixbufRendererClass DesktopAgnosticUILazyPixbufRendererClass; typedef struct _DesktopAgnosticUILazyPixbufRendererPrivate DesktopAgnosticUILazyPixbufRendererPrivate; #define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL))) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #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_free0(var) (var = (g_free (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 _gtk_icon_info_free0(var) ((var == NULL) ? NULL : (var = (gtk_icon_info_free (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_list_free_gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (_g_list_free_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 _DesktopAgnosticUILazyPixbufRenderer { GtkCellRendererPixbuf parent_instance; DesktopAgnosticUILazyPixbufRendererPrivate * priv; }; struct _DesktopAgnosticUILazyPixbufRendererClass { GtkCellRendererPixbufClass parent_class; }; struct _DesktopAgnosticUILazyPixbufRendererPrivate { gboolean _item_ready; }; 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_PIXBUF_READY, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_COUNT } DesktopAgnosticUIIconChooserDialogColumn; static gpointer desktop_agnostic_ui_lazy_pixbuf_renderer_parent_class = NULL; static GdkPixbuf* desktop_agnostic_ui_icon_chooser_dialog_NO_ICON; static GdkPixbuf* desktop_agnostic_ui_icon_chooser_dialog_NO_ICON = NULL; 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) G_GNUC_CONST; GType desktop_agnostic_ui_lazy_pixbuf_renderer_get_type (void) G_GNUC_CONST; #define DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER, DesktopAgnosticUILazyPixbufRendererPrivate)) enum { DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_DUMMY_PROPERTY, DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_ITEM_READY }; static void desktop_agnostic_ui_lazy_pixbuf_renderer_real_render (GtkCellRenderer* base, GdkWindow* window, GtkWidget* widget, GdkRectangle* background_area, GdkRectangle* cell_area, GdkRectangle* expose_area, GtkCellRendererState flags); gboolean desktop_agnostic_ui_lazy_pixbuf_renderer_get_item_ready (DesktopAgnosticUILazyPixbufRenderer* self); DesktopAgnosticUILazyPixbufRenderer* desktop_agnostic_ui_lazy_pixbuf_renderer_new (void); DesktopAgnosticUILazyPixbufRenderer* desktop_agnostic_ui_lazy_pixbuf_renderer_construct (GType object_type); void desktop_agnostic_ui_lazy_pixbuf_renderer_set_item_ready (DesktopAgnosticUILazyPixbufRenderer* self, gboolean value); static void desktop_agnostic_ui_lazy_pixbuf_renderer_finalize (GObject* obj); static void desktop_agnostic_ui_lazy_pixbuf_renderer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void desktop_agnostic_ui_lazy_pixbuf_renderer_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); GType desktop_agnostic_ui_icon_chooser_dialog_get_type (void) G_GNUC_CONST; #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) G_GNUC_UNUSED; static void desktop_agnostic_ui_icon_chooser_dialog_create_ui (DesktopAgnosticUIIconChooserDialog* self); static void desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled (DesktopAgnosticUIIconChooserDialog* self); 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_add_icon_viewer (DesktopAgnosticUIIconChooserDialog* self, GtkIconView** viewer, gboolean themed); 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 _lambda0_ (GtkTreePath* p, DesktopAgnosticUIIconChooserDialog* self); static void __lambda0__desktop_agnostic_ui_lazy_pixbuf_renderer_prepare_pixbuf (DesktopAgnosticUILazyPixbufRenderer* _sender, GtkTreePath* path, gpointer 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_list_free_g_free (GList* 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 _g_slist_free_g_object_unref (GSList* self); static void desktop_agnostic_ui_icon_chooser_dialog_on_response (DesktopAgnosticUIIconChooserDialog* self, gint response); 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); 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); static int _vala_strcmp0 (const char * str1, const char * str2); static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); GType desktop_agnostic_ui_icon_type_get_type (void) { static volatile gsize desktop_agnostic_ui_icon_type_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_icon_type_type_id__volatile)) { 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}}; GType desktop_agnostic_ui_icon_type_type_id; desktop_agnostic_ui_icon_type_type_id = g_enum_register_static ("DesktopAgnosticUIIconType", values); g_once_init_leave (&desktop_agnostic_ui_icon_type_type_id__volatile, desktop_agnostic_ui_icon_type_type_id); } return desktop_agnostic_ui_icon_type_type_id__volatile; } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } static gpointer _gtk_tree_path_copy0 (gpointer self) { return self ? gtk_tree_path_copy (self) : NULL; } static void desktop_agnostic_ui_lazy_pixbuf_renderer_real_render (GtkCellRenderer* base, GdkWindow* window, GtkWidget* widget, GdkRectangle* background_area, GdkRectangle* cell_area, GdkRectangle* expose_area, GtkCellRendererState flags) { DesktopAgnosticUILazyPixbufRenderer * self; self = (DesktopAgnosticUILazyPixbufRenderer*) base; g_return_if_fail (window != NULL); g_return_if_fail (widget != NULL); if (!self->priv->_item_ready) { gint x = 0; gint y = 0; GtkWidget* _tmp0_; GtkIconView* view; GtkTreePath* path; view = _g_object_ref0 ((_tmp0_ = widget, GTK_IS_ICON_VIEW (_tmp0_) ? ((GtkIconView*) _tmp0_) : NULL)); x = (*cell_area).x + ((*cell_area).width / 2); y = (*cell_area).y + ((*cell_area).height / 2); path = _gtk_tree_path_copy0 (gtk_icon_view_get_path_at_pos (view, x, y)); g_signal_emit_by_name (self, "prepare-pixbuf", path); _gtk_tree_path_free0 (path); _g_object_unref0 (view); } GTK_CELL_RENDERER_CLASS (desktop_agnostic_ui_lazy_pixbuf_renderer_parent_class)->render ((GtkCellRenderer*) GTK_CELL_RENDERER_PIXBUF (self), window, widget, background_area, cell_area, expose_area, flags); } DesktopAgnosticUILazyPixbufRenderer* desktop_agnostic_ui_lazy_pixbuf_renderer_construct (GType object_type) { DesktopAgnosticUILazyPixbufRenderer * self; self = g_object_newv (object_type, 0, NULL); return self; } DesktopAgnosticUILazyPixbufRenderer* desktop_agnostic_ui_lazy_pixbuf_renderer_new (void) { return desktop_agnostic_ui_lazy_pixbuf_renderer_construct (DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER); } gboolean desktop_agnostic_ui_lazy_pixbuf_renderer_get_item_ready (DesktopAgnosticUILazyPixbufRenderer* self) { gboolean result; g_return_val_if_fail (self != NULL, FALSE); result = self->priv->_item_ready; return result; } void desktop_agnostic_ui_lazy_pixbuf_renderer_set_item_ready (DesktopAgnosticUILazyPixbufRenderer* self, gboolean value) { g_return_if_fail (self != NULL); self->priv->_item_ready = value; g_object_notify ((GObject *) self, "item-ready"); } static void desktop_agnostic_ui_lazy_pixbuf_renderer_class_init (DesktopAgnosticUILazyPixbufRendererClass * klass) { desktop_agnostic_ui_lazy_pixbuf_renderer_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (DesktopAgnosticUILazyPixbufRendererPrivate)); GTK_CELL_RENDERER_CLASS (klass)->render = desktop_agnostic_ui_lazy_pixbuf_renderer_real_render; G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_ui_lazy_pixbuf_renderer_get_property; G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_ui_lazy_pixbuf_renderer_set_property; G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_ui_lazy_pixbuf_renderer_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_ITEM_READY, g_param_spec_boolean ("item-ready", "item-ready", "item-ready", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_signal_new ("prepare_pixbuf", DESKTOP_AGNOSTIC_UI_TYPE_LAZY_PIXBUF_RENDERER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, 1, GTK_TYPE_TREE_PATH); } static void desktop_agnostic_ui_lazy_pixbuf_renderer_instance_init (DesktopAgnosticUILazyPixbufRenderer * self) { self->priv = DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_GET_PRIVATE (self); self->priv->_item_ready = FALSE; } static void desktop_agnostic_ui_lazy_pixbuf_renderer_finalize (GObject* obj) { DesktopAgnosticUILazyPixbufRenderer * self; self = DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER (obj); G_OBJECT_CLASS (desktop_agnostic_ui_lazy_pixbuf_renderer_parent_class)->finalize (obj); } GType desktop_agnostic_ui_lazy_pixbuf_renderer_get_type (void) { static volatile gsize desktop_agnostic_ui_lazy_pixbuf_renderer_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_lazy_pixbuf_renderer_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticUILazyPixbufRendererClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_ui_lazy_pixbuf_renderer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticUILazyPixbufRenderer), 0, (GInstanceInitFunc) desktop_agnostic_ui_lazy_pixbuf_renderer_instance_init, NULL }; GType desktop_agnostic_ui_lazy_pixbuf_renderer_type_id; desktop_agnostic_ui_lazy_pixbuf_renderer_type_id = g_type_register_static (GTK_TYPE_CELL_RENDERER_PIXBUF, "DesktopAgnosticUILazyPixbufRenderer", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_ui_lazy_pixbuf_renderer_type_id__volatile, desktop_agnostic_ui_lazy_pixbuf_renderer_type_id); } return desktop_agnostic_ui_lazy_pixbuf_renderer_type_id__volatile; } static void desktop_agnostic_ui_lazy_pixbuf_renderer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { DesktopAgnosticUILazyPixbufRenderer * self; self = DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER (object); switch (property_id) { case DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_ITEM_READY: g_value_set_boolean (value, desktop_agnostic_ui_lazy_pixbuf_renderer_get_item_ready (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void desktop_agnostic_ui_lazy_pixbuf_renderer_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { DesktopAgnosticUILazyPixbufRenderer * self; self = DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER (object); switch (property_id) { case DESKTOP_AGNOSTIC_UI_LAZY_PIXBUF_RENDERER_ITEM_READY: desktop_agnostic_ui_lazy_pixbuf_renderer_set_item_ready (self, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static GType desktop_agnostic_ui_icon_chooser_dialog_column_get_type (void) { static volatile gsize desktop_agnostic_ui_icon_chooser_dialog_column_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_icon_chooser_dialog_column_type_id__volatile)) { 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_PIXBUF_READY, "DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF_READY", "pixbuf-ready"}, {DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_COUNT, "DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_COUNT", "count"}, {0, NULL, NULL}}; GType desktop_agnostic_ui_icon_chooser_dialog_column_type_id; desktop_agnostic_ui_icon_chooser_dialog_column_type_id = g_enum_register_static ("DesktopAgnosticUIIconChooserDialogColumn", values); g_once_init_leave (&desktop_agnostic_ui_icon_chooser_dialog_column_type_id__volatile, desktop_agnostic_ui_icon_chooser_dialog_column_type_id); } return desktop_agnostic_ui_icon_chooser_dialog_column_type_id__volatile; } 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); } static void desktop_agnostic_ui_icon_chooser_dialog_create_ui (DesktopAgnosticUIIconChooserDialog* self) { GtkHBox* choices; GtkHBox* _tmp0_; GtkRadioButton* _tmp1_; GtkRadioButton* _tmp2_; 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->_themed = (_tmp1_ = g_object_ref_sink ((GtkRadioButton*) gtk_radio_button_new_with_mnemonic (NULL, _ ("From Theme"))), _g_object_unref0 (self->priv->_themed), _tmp1_); gtk_container_add ((GtkContainer*) choices, (GtkWidget*) self->priv->_themed); self->priv->_file = (_tmp2_ = g_object_ref_sink ((GtkRadioButton*) gtk_radio_button_new_with_mnemonic_from_widget (self->priv->_themed, _ ("From File"))), _g_object_unref0 (self->priv->_file), _tmp2_); gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->_themed, TRUE); 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->_file); gtk_box_pack_start ((GtkBox*) ((GtkDialog*) self)->vbox, (GtkWidget*) choices, FALSE, FALSE, (guint) 5); gtk_widget_show_all ((GtkWidget*) choices); desktop_agnostic_ui_icon_chooser_dialog_on_icon_type_toggled (self); 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 char* string_replace (const char* self, const char* old, const char* replacement) { char* result = NULL; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (old != NULL, NULL); g_return_val_if_fail (replacement != NULL, 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 _lambda0_ (GtkTreePath* p, DesktopAgnosticUIIconChooserDialog* self) { GtkTreeIter iter = {0}; GValue val = {0}; GtkTreeModel* _tmp0_; GtkListStore* store; GValue _tmp1_ = {0}; GValue _tmp2_; char* icon_name; GtkIconTheme* icon_theme; GtkIconInfo* info; char* name; GError * _inner_error_ = NULL; g_return_if_fail (p != NULL); store = _g_object_ref0 ((_tmp0_ = gtk_icon_view_get_model (self->priv->_viewer), GTK_IS_LIST_STORE (_tmp0_) ? ((GtkListStore*) _tmp0_) : NULL)); gtk_tree_model_get_iter ((GtkTreeModel*) store, &iter, p); gtk_tree_model_get_value ((GtkTreeModel*) store, &iter, (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA, &_tmp1_); val = (_tmp2_ = _tmp1_, G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL, _tmp2_); icon_name = g_strdup (g_value_get_string (&val)); icon_theme = _g_object_ref0 (gtk_icon_theme_get_default ()); info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, 0); name = g_strdup (gtk_icon_info_get_display_name (info)); if (name == NULL) { char* _tmp3_; name = (_tmp3_ = string_replace (icon_name, "-", " "), _g_free0 (name), _tmp3_); } { GdkPixbuf* pixbuf; pixbuf = gtk_icon_info_load_icon (info, &_inner_error_); if (_inner_error_ != NULL) { goto __catch1_g_error; } gtk_list_store_set (store, &iter, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME, name, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF, pixbuf, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF_READY, TRUE, -1, -1); _g_object_unref0 (pixbuf); } goto __finally1; __catch1_g_error: { GError * err; err = _inner_error_; _inner_error_ = NULL; { g_warning ("ui-icon-chooser-dialog.vala:188: Could not load %s: %s", icon_name, err->message); gtk_list_store_set (store, &iter, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME, name, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF_READY, TRUE, -1, -1); _g_error_free0 (err); } } __finally1: if (_inner_error_ != NULL) { _g_free0 (name); _gtk_icon_info_free0 (info); _g_object_unref0 (icon_theme); _g_free0 (icon_name); _g_object_unref0 (store); 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_free0 (name); _gtk_icon_info_free0 (info); _g_object_unref0 (icon_theme); _g_free0 (icon_name); _g_object_unref0 (store); G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; } static void __lambda0__desktop_agnostic_ui_lazy_pixbuf_renderer_prepare_pixbuf (DesktopAgnosticUILazyPixbufRenderer* _sender, GtkTreePath* path, gpointer self) { _lambda0_ (path, self); } static GtkIconView* desktop_agnostic_ui_icon_chooser_dialog_create_icon_viewer (DesktopAgnosticUIIconChooserDialog* self, gboolean themed) { GtkIconView* result = NULL; GtkIconView* viewer; DesktopAgnosticUILazyPixbufRenderer* cell_pixbuf; GtkCellRendererText* cell_text; GtkListStore* _tmp0_; GtkIconView* _tmp1_; DesktopAgnosticUILazyPixbufRenderer* _tmp2_; GtkCellRendererText* _tmp3_; gint wrap_width; 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_widget_set_size_request ((GtkWidget*) viewer, 108, -1); gtk_icon_view_set_item_width (viewer, 108); gtk_icon_view_set_column_spacing (viewer, 5); gtk_icon_view_set_tooltip_column (viewer, (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA); cell_pixbuf = (_tmp2_ = g_object_ref_sink (desktop_agnostic_ui_lazy_pixbuf_renderer_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); gtk_cell_layout_add_attribute ((GtkCellLayout*) viewer, (GtkCellRenderer*) cell_pixbuf, "item-ready", (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF_READY); g_signal_connect_object (cell_pixbuf, "prepare-pixbuf", (GCallback) __lambda0__desktop_agnostic_ui_lazy_pixbuf_renderer_prepare_pixbuf, self, 0); 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", 0.0f, NULL); g_object_set (cell_text, "wrap-mode", PANGO_WRAP_WORD, NULL); wrap_width = gtk_icon_view_get_item_width (viewer) - (gtk_icon_view_get_item_padding (viewer) * 2); g_object_set (cell_text, "wrap-width", wrap_width, NULL); g_object_set ((GtkCellRenderer*) cell_text, "width", wrap_width, NULL); g_object_set (cell_text, "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL); gtk_cell_layout_pack_start ((GtkCellLayout*) viewer, (GtkCellRenderer*) cell_text, TRUE); gtk_cell_layout_add_attribute ((GtkCellLayout*) viewer, (GtkCellRenderer*) cell_text, "text", (gint) DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME); gtk_icon_view_set_selection_mode (viewer, GTK_SELECTION_SINGLE); result = viewer; _g_object_unref0 (cell_text); _g_object_unref0 (cell_pixbuf); return result; } static GtkListStore* desktop_agnostic_ui_icon_chooser_dialog_create_model (DesktopAgnosticUIIconChooserDialog* self) { GtkListStore* result = NULL; 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, G_TYPE_BOOLEAN); 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 _g_list_free_g_free (GList* self) { g_list_foreach (self, (GFunc) g_free, NULL); g_list_free (self); } 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_on_icon_type_toggled (DesktopAgnosticUIIconChooserDialog* self) { g_return_if_fail (self != 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_; GList* _tmp1_; gint active_index; gint cur_index; 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 = (_tmp1_ = gtk_icon_theme_list_contexts (icon_theme), __g_list_free_g_free0 (context_list), _tmp1_); context_list = g_list_sort (context_list, (GCompareFunc) g_strcmp0); active_index = 0; cur_index = 0; { 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); if (_vala_strcmp0 (context, "Applications") == 0) { active_index = cur_index; } cur_index++; } } } gtk_combo_box_set_active (self->priv->_themed_context, active_index); __g_list_free_g_free0 (context_list); } if (self->priv->_file_viewer != NULL) { 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 { if (self->priv->_file_viewer == NULL) { GtkFileChooserButton* _tmp2_; self->priv->_directory = (_tmp2_ = 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), _tmp2_); 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); desktop_agnostic_ui_icon_chooser_dialog_on_folder_changed (self, (GtkFileChooser*) self->priv->_directory); } if (self->priv->_themed_viewer != NULL) { 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) { GtkListStore* model; char* uri; DesktopAgnosticVFSFile* directory; GSList* children; GtkTreeModel* _tmp0_; char* _tmp1_; DesktopAgnosticVFSFile* _tmp2_; DesktopAgnosticVFSFile* _tmp3_; GSList* _tmp4_; GSList* _tmp5_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (chooser != 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_slist_free_g_object_unref0 (children); _g_object_unref0 (directory); _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; } directory = (_tmp3_ = _tmp2_, _g_object_unref0 (directory), _tmp3_); _tmp4_ = desktop_agnostic_vfs_file_enumerate_children (directory, &_inner_error_); if (_inner_error_ != NULL) { __g_slist_free_g_object_unref0 (children); _g_object_unref0 (directory); _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; } 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 __catch2_g_file_error; } goto __catch2_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_PIXBUF_READY, TRUE, 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 __finally2; __catch2_g_file_error: { GError * err; err = _inner_error_; _inner_error_ = NULL; { _g_error_free0 (err); } } goto __finally2; __catch2_g_error: { GError * err; err = _inner_error_; _inner_error_ = NULL; { g_warning ("ui-icon-chooser-dialog.vala:336: GDK Pixbuf error (%s): %s", path, err->message); _g_error_free0 (err); } } __finally2: if (_inner_error_ != NULL) { _g_free0 (path_down); _g_free0 (path); __g_slist_free_g_object_unref0 (children); _g_object_unref0 (directory); _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; } } _g_free0 (path_down); _g_free0 (path); } } } __g_slist_free_g_object_unref0 (children); _g_object_unref0 (directory); _g_free0 (uri); } static void desktop_agnostic_ui_icon_chooser_dialog_on_icon_context_changed (DesktopAgnosticUIIconChooserDialog* self, GtkComboBox* box) { GtkListStore* model; GtkIconTheme* icon_theme; GList* icon_list; GtkTreeModel* _tmp0_; GList* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (box != 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 = (_tmp1_ = gtk_icon_theme_list_icons (icon_theme, gtk_combo_box_get_active_text (box)), __g_list_free_g_free0 (icon_list), _tmp1_); icon_list = g_list_sort (icon_list, (GCompareFunc) g_strcmp0); { 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; { GtkTreeIter iter = {0}; gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF, desktop_agnostic_ui_icon_chooser_dialog_NO_ICON, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_PIXBUF_READY, FALSE, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_NAME, icon_name, DESKTOP_AGNOSTIC_UI_ICON_CHOOSER_DIALOG_COLUMN_DATA, icon_name, -1); } } } __g_list_free_g_free0 (icon_list); } 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 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, "%s", msg)), _g_object_unref0 (dialog), _tmp2_); gtk_window_set_title ((GtkWindow*) dialog, _ ("Error")); gtk_dialog_run ((GtkDialog*) dialog); gtk_object_destroy ((GtkObject*) dialog); _g_object_unref0 (dialog); _g_free0 (msg); __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 _tmp5_ = {0}; GValue _tmp6_; GValue _tmp7_ = {0}; GValue _tmp8_; 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 (&data) ? (g_value_unset (&data), NULL) : NULL; G_IS_VALUE (&pixbuf) ? (g_value_unset (&pixbuf), NULL) : NULL; } else { g_warning ("ui-icon-chooser-dialog.vala:423: Something wrong happened when convert" \ "ing tree path -> iter."); } _g_object_unref0 (model); _gtk_tree_path_free0 (path); } __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); gtk_window_set_default_size ((GtkWindow*) self, 375, 375); desktop_agnostic_ui_icon_chooser_dialog_create_ui (self); } return obj; } static void desktop_agnostic_ui_icon_chooser_dialog_class_init (DesktopAgnosticUIIconChooserDialogClass * klass) { GError * _inner_error_; 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); _inner_error_ = NULL; { GtkIconLookupFlags flags; GdkPixbuf* _tmp0_; GdkPixbuf* _tmp1_; flags = GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK; _tmp0_ = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-file", 48, flags, &_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_); } desktop_agnostic_ui_icon_chooser_dialog_NO_ICON = (_tmp1_ = _tmp0_, _g_object_unref0 (desktop_agnostic_ui_icon_chooser_dialog_NO_ICON), _tmp1_); } } 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->_file_viewer = NULL; 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 volatile gsize desktop_agnostic_ui_icon_chooser_dialog_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_icon_chooser_dialog_type_id__volatile)) { 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 }; GType desktop_agnostic_ui_icon_chooser_dialog_type_id; desktop_agnostic_ui_icon_chooser_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "DesktopAgnosticUIIconChooserDialog", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_ui_icon_chooser_dialog_type_id__volatile, desktop_agnostic_ui_icon_chooser_dialog_type_id); } return desktop_agnostic_ui_icon_chooser_dialog_type_id__volatile; } 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; } } 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); } static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1, gpointer arg_1, gpointer data2); register GMarshalFunc_VOID__BOXED callback; register GCClosure * cc; register gpointer data1, data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 2); 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__BOXED) (marshal_data ? marshal_data : cc->callback); callback (data1, g_value_get_boxed (param_values + 1), data2); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.c0000664000175000017510000013667311537206466027563 0ustar seagleseagle/* vfs-volume-impl-gnome-vfs.c generated by valac 0.10.4, 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))) #define __g_list_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_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) G_GNUC_CONST; 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) G_GNUC_CONST; #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) G_GNUC_CONST; #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 void _g_list_free_g_object_unref (GList* 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 volatile gsize desktop_agnostic_vfs_volume_result_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_result_type_id__volatile)) { GType desktop_agnostic_vfs_volume_result_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_result_type_id__volatile, desktop_agnostic_vfs_volume_result_type_id); } return desktop_agnostic_vfs_volume_result_type_id__volatile; } static gboolean desktop_agnostic_vfs_volume_gnome_vfs_real_is_mounted (DesktopAgnosticVFSVolume* base) { DesktopAgnosticVFSVolumeGnomeVFS * self; gboolean result = FALSE; 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 _tmp0_ = {0}; DesktopAgnosticVFSVolumeResult _tmp1_; DesktopAgnosticVFSVolumeResult _tmp2_; DesktopAgnosticVFSVolumeResult* _tmp3_; 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), NULL), 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), NULL), 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 = FALSE; gboolean _result_; DesktopAgnosticVFSVolumeResult* _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; _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 _tmp0_ = {0}; DesktopAgnosticVFSVolumeResult _tmp1_; DesktopAgnosticVFSVolumeResult _tmp2_; DesktopAgnosticVFSVolumeResult* _tmp3_; 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), NULL), 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), NULL), 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 = FALSE; gboolean _result_; DesktopAgnosticVFSVolumeResult* _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; _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 = FALSE; 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 _tmp0_ = {0}; DesktopAgnosticVFSVolumeResult _tmp1_; DesktopAgnosticVFSVolumeResult _tmp2_; DesktopAgnosticVFSVolumeResult* _tmp3_; 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), NULL), 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), NULL), 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 = FALSE; gboolean _result_; DesktopAgnosticVFSVolumeResult* _tmp1_; GError * _inner_error_ = NULL; self = (DesktopAgnosticVFSVolumeGnomeVFS*) base; _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 = NULL; 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) { DesktopAgnosticVFSFile* result; DesktopAgnosticVFSVolumeGnomeVFS* self; GError * _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), NULL); 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), NULL); 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), NULL); 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 volatile gsize desktop_agnostic_vfs_volume_gnome_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_gnome_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_volume_gnome_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_gnome_vfs_type_id__volatile, desktop_agnostic_vfs_volume_gnome_vfs_type_id); } return desktop_agnostic_vfs_volume_gnome_vfs_type_id__volatile; } 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_take_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 = NULL; GObject* _tmp0_; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (drive != NULL, NULL); result = DESKTOP_AGNOSTIC_VFS_VOLUME ((_tmp0_ = g_object_new (DESKTOP_AGNOSTIC_VFS_TYPE_VOLUME_GNOME_VFS, "implementation", drive, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } static DesktopAgnosticVFSVolume* desktop_agnostic_vfs_volume_monitor_gnome_vfs_check_volume (DesktopAgnosticVFSVolumeMonitorGnomeVFS* self, GnomeVFSDrive* drive) { DesktopAgnosticVFSVolume* result = NULL; 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 = NULL; 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 = NULL; self = (DesktopAgnosticVFSVolumeMonitorGnomeVFS*) g_object_new (object_type, 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 void _g_list_free_g_object_unref (GList* self) { g_list_foreach (self, (GFunc) g_object_unref, NULL); g_list_free (self); } 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_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref), _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); __g_list_free_g_object_unref0 (drives); } 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 volatile gsize desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id__volatile)) { 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}; GType desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id; 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); g_once_init_leave (&desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id__volatile, desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id); } return desktop_agnostic_vfs_volume_monitor_gnome_vfs_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-fdo-glib.h0000664000175000017510000000377111537206467024665 0ustar seagleseagle/* da-fdo-glib.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/ui-color-button.c0000664000175000017510000003525011537206467025652 0ustar seagleseagle/* ui-color-button.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 }; 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_color_set (DesktopAgnosticUIColorButton* self); static void desktop_agnostic_ui_color_button_real_constructed (GObject* base); 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); 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)); } } /** * Emits the non-internal signal callbacks for the da-color property. */ 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); } /** * Updates the da-color property when the color is updated via the UI. */ 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_) { GdkColor _tmp1_ = {0}; GdkColor _tmp2_; DesktopAgnosticColor* _tmp3_; 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_) { GdkColor _tmp1_ = {0}; GdkColor _tmp2_; DesktopAgnosticColor* _tmp3_; 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 volatile gsize desktop_agnostic_ui_color_button_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_ui_color_button_type_id__volatile)) { 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 }; GType desktop_agnostic_ui_color_button_type_id; desktop_agnostic_ui_color_button_type_id = g_type_register_static (GTK_TYPE_COLOR_BUTTON, "DesktopAgnosticUIColorButton", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_ui_color_button_type_id__volatile, desktop_agnostic_ui_color_button_type_id); } return desktop_agnostic_ui_color_button_type_id__volatile; } 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-vfs-gnome-vfs.deps0000664000175000017510000000006411537206466026372 0ustar seagleseaglegnome-vfs-2.0 desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/module-guesser.c0000664000175000017510000001504611537206466025550 0ustar seagleseagle/* module-guesser.c generated by valac 0.10.4, 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); /** * Given a valid library prefix, this function takes the first valid module * that is locates via the search paths and glob and loads it. */ GType guess_module (DesktopAgnosticModuleLoader* loader, const char* library_prefix) { GType result = 0UL; gint paths_length1; gint _paths_size_; char** _tmp1_; gint _tmp0_; char** paths; char* module_glob_suffix; GType _result_; GError * _inner_error_ = NULL; g_return_val_if_fail (loader != NULL, 0UL); g_return_val_if_fail (library_prefix != NULL, 0UL); 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_length1; gint _modules_paths_size_; char** modules_paths; DesktopAgnosticVFSGlob* _tmp3_; DesktopAgnosticVFSGlob* _tmp4_; gint _tmp5_; char** _tmp6_; 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); _g_free0 (module_glob_suffix); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), 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 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); _g_free0 (module_glob_suffix); paths = (_vala_array_free (paths, paths_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 0UL; } if (_result_ != G_TYPE_INVALID) { _g_free0 (module_glob); break; } _g_free0 (module_glob); } } } result = _result_; _g_free0 (module_glob_suffix); paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/da-cfg-keyfile.deps0000664000175000017510000000007311537206466026062 0ustar seagleseagledesktop-agnostic-cfg desktop-agnostic-vfs desktop-agnostic libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/color.c0000664000175000017510000006040511537206464023723 0ustar seagleseagle/* color.c generated by valac 0.10.4, 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)) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (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) G_GNUC_CONST; #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); char* desktop_agnostic_color_to_html_color (DesktopAgnosticColor* self); 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_string (DesktopAgnosticColor* self); void desktop_agnostic_color_get_cairo_color (DesktopAgnosticColor* self, double* red, double* green, double* blue, double* alpha); double desktop_agnostic_color_gdk_value_to_cairo (gushort value); 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); 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_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 = 0U; gboolean _tmp0_ = FALSE; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, 0U); 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 = NULL; 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 = NULL; 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); } /** * Parses color from string. * @see Gdk.Color.parse */ static glong string_get_length (const char* self) { glong result; g_return_val_if_fail (self != NULL, 0L); result = g_utf8_strlen (self, (gssize) (-1)); return result; } static char* string_substring (const char* self, glong offset, glong len) { char* result = NULL; glong string_length; const char* start; g_return_val_if_fail (self != NULL, NULL); string_length = string_get_length (self); 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) { DesktopAgnosticColor * self = NULL; GdkColor _tmp0_ = {0}; char* color_data; GError * _inner_error_ = NULL; g_return_val_if_fail (spec != NULL, 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* _tmp3_; char* _tmp4_; char* _tmp5_; 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_unref0 (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 ("%" G_GSIZE_FORMAT, 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_unref0 (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_unref0 (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 = NULL; 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; } /** * Behaves the same as Gdk.Color.to_string (), except that it adds * alpha data. * @see Gdk.Color.to_string */ char* desktop_agnostic_color_to_string (DesktopAgnosticColor* self) { char* result = NULL; 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; } /** * Returns the color values as doubles, where 0.0 < value <= 1.0. */ 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); } } /** * Sets the color with values as doubles, where 0.0 < value <= 1.0. */ 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); } } /** * Converts a single RGBA value for cairo to its GDK/Pango equivalent. */ gushort desktop_agnostic_color_cairo_value_to_gdk (double value) { gushort result = 0U; result = (gushort) (lround (value * 65536) - 1); return result; } /** * Converts a single RGBA value for GDK/Pango to its cairo equivalent. */ double desktop_agnostic_color_gdk_value_to_cairo (gushort value) { double result = 0.0; 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) { gushort _tmp0_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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) { gushort _tmp0_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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) { gushort _tmp0_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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) { gushort _tmp0_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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); } /** * Note: cannot use ushort in properties as Value cannot be mapped to it. */ GType desktop_agnostic_color_get_type (void) { static volatile gsize desktop_agnostic_color_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_color_type_id__volatile)) { 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 }; GType desktop_agnostic_color_type_id; desktop_agnostic_color_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticColor", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_color_type_id__volatile, desktop_agnostic_color_type_id); } return desktop_agnostic_color_type_id__volatile; } static void desktop_agnostic_color_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { DesktopAgnosticColor * self; GdkColor boxed0; self = DESKTOP_AGNOSTIC_COLOR (object); switch (property_id) { case DESKTOP_AGNOSTIC_COLOR_COLOR: desktop_agnostic_color_get_color (self, &boxed0); g_value_set_boxed (value, &boxed0); 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-agnostic-cfg.vapi0000664000175000017510000002165311537206465027340 0ustar seagleseagle/* desktop-agnostic-cfg.vapi generated by valac 0.10.4, do not modify. */ [CCode (cprefix = "DesktopAgnostic", lower_case_cprefix = "desktop_agnostic_")] namespace DesktopAgnostic { [CCode (cprefix = "DesktopAgnosticConfig", lower_case_cprefix = "desktop_agnostic_config_")] 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 new 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 new 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; } } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/desktop-entry-impl-gio.c0000664000175000017510000012356311537206466027137 0ustar seagleseagle/* desktop-entry-impl-gio.c generated by valac 0.10.4, the Vala compiler * generated from desktop-entry-impl-gio.vala, do not modify */ /* * 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 */ #include #include #include #include #include #include #include #include #define DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO (desktop_agnostic_fdo_desktop_entry_gio_get_type ()) #define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO, DesktopAgnosticFDODesktopEntryGio)) #define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO, DesktopAgnosticFDODesktopEntryGioClass)) #define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO)) #define DESKTOP_AGNOSTIC_FDO_IS_DESKTOP_ENTRY_GIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO)) #define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO, DesktopAgnosticFDODesktopEntryGioClass)) typedef struct _DesktopAgnosticFDODesktopEntryGio DesktopAgnosticFDODesktopEntryGio; typedef struct _DesktopAgnosticFDODesktopEntryGioClass DesktopAgnosticFDODesktopEntryGioClass; typedef struct _DesktopAgnosticFDODesktopEntryGioPrivate DesktopAgnosticFDODesktopEntryGioPrivate; #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_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) struct _DesktopAgnosticFDODesktopEntryGio { GObject parent_instance; DesktopAgnosticFDODesktopEntryGioPrivate * priv; }; struct _DesktopAgnosticFDODesktopEntryGioClass { GObjectClass parent_class; }; struct _DesktopAgnosticFDODesktopEntryGioPrivate { GKeyFile* _keyfile; gboolean loaded; DesktopAgnosticVFSFile* _file; }; static gpointer desktop_agnostic_fdo_desktop_entry_gio_parent_class = NULL; static DesktopAgnosticFDODesktopEntryIface* desktop_agnostic_fdo_desktop_entry_gio_desktop_agnostic_fdo_desktop_entry_parent_iface = NULL; #define DESKTOP_AGNOSTIC_FDO_GROUP "Desktop Entry" GType desktop_agnostic_fdo_desktop_entry_gio_get_type (void) G_GNUC_CONST; #define DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO, DesktopAgnosticFDODesktopEntryGioPrivate)) enum { DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_DUMMY_PROPERTY, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_FILE, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_KEYFILE, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_DATA, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_ENTRY_TYPE, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_NAME, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_ICON }; static gboolean desktop_agnostic_fdo_desktop_entry_gio_real_key_exists (DesktopAgnosticFDODesktopEntry* base, const char* key); static gboolean desktop_agnostic_fdo_desktop_entry_gio_real_get_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key); static void desktop_agnostic_fdo_desktop_entry_gio_real_set_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key, gboolean value); static char* desktop_agnostic_fdo_desktop_entry_gio_real_get_string (DesktopAgnosticFDODesktopEntry* base, const char* key); static void desktop_agnostic_fdo_desktop_entry_gio_real_set_string (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* value); static char* desktop_agnostic_fdo_desktop_entry_gio_real_get_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale); static void desktop_agnostic_fdo_desktop_entry_gio_real_set_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale, const char* value); static char** desktop_agnostic_fdo_desktop_entry_gio_real_get_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key); static void desktop_agnostic_fdo_desktop_entry_gio_real_set_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key, char** value); static gboolean desktop_agnostic_fdo_desktop_entry_gio_real_exists (DesktopAgnosticFDODesktopEntry* base); static GPid desktop_agnostic_fdo_desktop_entry_gio_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error); static void desktop_agnostic_fdo_desktop_entry_gio_real_save (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* new_file, GError** error); DesktopAgnosticFDODesktopEntryGio* desktop_agnostic_fdo_desktop_entry_gio_new (void); DesktopAgnosticFDODesktopEntryGio* desktop_agnostic_fdo_desktop_entry_gio_construct (GType object_type); static void desktop_agnostic_fdo_desktop_entry_gio_finalize (GObject* obj); static void desktop_agnostic_fdo_desktop_entry_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void desktop_agnostic_fdo_desktop_entry_gio_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_gio_real_key_exists (DesktopAgnosticFDODesktopEntry* base, const char* key) { DesktopAgnosticFDODesktopEntryGio * self; gboolean result = FALSE; gboolean _tmp0_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; g_return_val_if_fail (key != NULL, FALSE); 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_gio_real_get_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key) { DesktopAgnosticFDODesktopEntryGio * self; gboolean result = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; g_return_val_if_fail (key != NULL, FALSE); { 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-gio.vala:204: Error trying to retrieve '%s': %s", key, err->message); result = FALSE; _g_error_free0 (err); return result; } } __finally0: { 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_gio_real_set_boolean (DesktopAgnosticFDODesktopEntry* base, const char* key, gboolean value) { DesktopAgnosticFDODesktopEntryGio * self; self = (DesktopAgnosticFDODesktopEntryGio*) 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_gio_real_get_string (DesktopAgnosticFDODesktopEntry* base, const char* key) { DesktopAgnosticFDODesktopEntryGio * self; char* result = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; g_return_val_if_fail (key != NULL, 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-gio.vala:224: Error trying to retrieve '%s': %s", key, err->message); result = NULL; _g_error_free0 (err); return result; } } __finally1: { 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_gio_real_set_string (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* value) { DesktopAgnosticFDODesktopEntryGio * self; self = (DesktopAgnosticFDODesktopEntryGio*) 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_gio_real_get_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale) { DesktopAgnosticFDODesktopEntryGio * self; char* result = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; g_return_val_if_fail (key != NULL, 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-gio.vala:244: Error trying to retrieve '%s[%s]': %s", key, locale, err->message); result = NULL; _g_error_free0 (err); return result; } } __finally2: { 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_gio_real_set_localestring (DesktopAgnosticFDODesktopEntry* base, const char* key, const char* locale, const char* value) { DesktopAgnosticFDODesktopEntryGio * self; self = (DesktopAgnosticFDODesktopEntryGio*) 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_gio_real_get_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key) { DesktopAgnosticFDODesktopEntryGio * self; char** result = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; g_return_val_if_fail (key != NULL, NULL); { gint _tmp1__length1; gint __tmp1__size_; char** _tmp2_; 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-gio.vala:266: Error trying to retrieve '%s': %s", key, err->message); result = NULL; _g_error_free0 (err); return result; } } __finally3: { 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_gio_real_set_string_list (DesktopAgnosticFDODesktopEntry* base, const char* key, char** value) { DesktopAgnosticFDODesktopEntryGio * self; self = (DesktopAgnosticFDODesktopEntryGio*) base; g_return_if_fail (key != NULL); g_key_file_set_string_list (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, key, (const gchar* const*) value, _vala_array_length (value)); } /** * Based on EggDesktopFile's egg_desktop_file_can_launch(). */ static gboolean desktop_agnostic_fdo_desktop_entry_gio_real_exists (DesktopAgnosticFDODesktopEntry* base) { DesktopAgnosticFDODesktopEntryGio * self; gboolean result = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; switch (desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)) { case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: { gboolean _tmp0_; char* exec; gint argv_length1; gint _argv_size_; char** _tmp4_; 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* _tmp1_; char* _tmp2_; 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) { argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); 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; argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); return result; } result = (_tmp9_ = (_tmp8_ = g_find_program_in_path (argv[0])) != NULL, _g_free0 (_tmp8_), _tmp9_); argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); return result; argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); _g_free0 (exec); } 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_object_unref0 (file); _g_free0 (uri); return result; } else { result = FALSE; return result; } } default: { result = FALSE; return result; } } } /** * Launch desktop entry. * @return always zero. */ static GPid desktop_agnostic_fdo_desktop_entry_gio_real_launch (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryLaunchFlags flags, GSList* documents, GError** error) { DesktopAgnosticFDODesktopEntryGio * self; GPid result = 0; GList* uris; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; uris = NULL; { GSList* s_collection; GSList* s_it; s_collection = documents; for (s_it = s_collection; s_it != NULL; s_it = s_it->next) { const char* s; s = (const char*) s_it->data; { uris = g_list_append (uris, s); } } } switch (desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)) { case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION: { GAppInfo* info; info = NULL; if (self->priv->_file != NULL) { char* _tmp0_; GAppInfo* _tmp1_; info = (_tmp1_ = (GAppInfo*) g_desktop_app_info_new_from_filename (_tmp0_ = desktop_agnostic_vfs_file_get_path (self->priv->_file)), _g_object_unref0 (info), _tmp1_); _g_free0 (_tmp0_); } else { GAppInfo* _tmp2_; info = (_tmp2_ = (GAppInfo*) g_desktop_app_info_new_from_keyfile (self->priv->_keyfile), _g_object_unref0 (info), _tmp2_); } g_app_info_launch_uris (info, uris, NULL, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_object_unref0 (info); _g_list_free0 (uris); return 0; } _g_object_unref0 (info); break; } case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK: { gboolean _tmp3_; _tmp3_ = g_key_file_has_key (self->priv->_keyfile, DESKTOP_AGNOSTIC_FDO_GROUP, "URL", &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_list_free0 (uris); return 0; } if (_tmp3_) { char* uri; 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_); _g_list_free0 (uris); return 0; } g_app_info_launch_default_for_uri (uri, NULL, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_free0 (uri); _g_list_free0 (uris); return 0; } _g_free0 (uri); } else { _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE, "Invalid desktop entry."); { g_propagate_error (error, _inner_error_); _g_list_free0 (uris); return 0; } } break; } default: { _inner_error_ = g_error_new_literal (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR, DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE, "Unknown desktop entry type."); { g_propagate_error (error, _inner_error_); _g_list_free0 (uris); return 0; } } } result = (GPid) 0; _g_list_free0 (uris); return result; } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } static void desktop_agnostic_fdo_desktop_entry_gio_real_save (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* new_file, GError** error) { DesktopAgnosticFDODesktopEntryGio * self; DesktopAgnosticVFSFile* file; char* _tmp2_; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; 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_); _g_free0 (_tmp2_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_object_unref0 (file); return; } _g_object_unref0 (file); } DesktopAgnosticFDODesktopEntryGio* desktop_agnostic_fdo_desktop_entry_gio_construct (GType object_type) { DesktopAgnosticFDODesktopEntryGio * self = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) g_object_new (object_type, NULL); return self; } DesktopAgnosticFDODesktopEntryGio* desktop_agnostic_fdo_desktop_entry_gio_new (void) { return desktop_agnostic_fdo_desktop_entry_gio_construct (DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO); } static DesktopAgnosticVFSFile* desktop_agnostic_fdo_desktop_entry_gio_real_get_file (DesktopAgnosticFDODesktopEntry* base) { DesktopAgnosticVFSFile* result; DesktopAgnosticFDODesktopEntryGio* self; self = (DesktopAgnosticFDODesktopEntryGio*) base; result = self->priv->_file; return result; } static void desktop_agnostic_fdo_desktop_entry_gio_real_set_file (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticVFSFile* value) { DesktopAgnosticFDODesktopEntryGio* self; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; if (value != NULL) { if (self->priv->loaded) { g_warning ("desktop-entry-impl-gio.vala:46: The desktop entry has already been ini" \ "tialized."); } 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* _tmp2_ = NULL; char* _tmp3_; data = NULL; desktop_agnostic_vfs_file_load_contents (self->priv->_file, &_tmp2_, &data_len, &_inner_error_); data = (_tmp3_ = _tmp2_, _g_free0 (data), _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_gio_real_get_keyfile (DesktopAgnosticFDODesktopEntry* base) { GKeyFile* result; DesktopAgnosticFDODesktopEntryGio* self; self = (DesktopAgnosticFDODesktopEntryGio*) base; result = self->priv->_keyfile; return result; } static void desktop_agnostic_fdo_desktop_entry_gio_real_set_keyfile (DesktopAgnosticFDODesktopEntry* base, GKeyFile* value) { DesktopAgnosticFDODesktopEntryGio* self; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; if (value != NULL) { if (self->priv->loaded) { g_warning ("desktop-entry-impl-gio.vala:85: The desktop entry has already been ini" \ "tialized."); } 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_gio_real_set_data (DesktopAgnosticFDODesktopEntry* base, const char* value) { DesktopAgnosticFDODesktopEntryGio* self; gboolean _tmp0_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticFDODesktopEntryGio*) base; if (value != NULL) { _tmp0_ = _vala_strcmp0 (value, "") != 0; } else { _tmp0_ = FALSE; } if (_tmp0_) { if (self->priv->loaded) { g_warning ("desktop-entry-impl-gio.vala:109: The desktop entry has already been in" \ "itialized."); } 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_gio_real_get_entry_type (DesktopAgnosticFDODesktopEntry* base) { DesktopAgnosticFDODesktopEntryType result; DesktopAgnosticFDODesktopEntryGio* self; char* type; const char* _tmp0_; GQuark _tmp1_; static GQuark _tmp1__label0 = 0; static GQuark _tmp1__label1 = 0; static GQuark _tmp1__label2 = 0; self = (DesktopAgnosticFDODesktopEntryGio*) 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")))) switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION; _g_free0 (type); return result; } } else if (_tmp1_ == ((0 != _tmp1__label1) ? _tmp1__label1 : (_tmp1__label1 = g_quark_from_static_string ("Link")))) switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK; _g_free0 (type); return result; } } else if (_tmp1_ == ((0 != _tmp1__label2) ? _tmp1__label2 : (_tmp1__label2 = g_quark_from_static_string ("Directory")))) switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY; _g_free0 (type); return result; } } else switch (0) { default: { result = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN; _g_free0 (type); return result; } } _g_free0 (type); } static void desktop_agnostic_fdo_desktop_entry_gio_real_set_entry_type (DesktopAgnosticFDODesktopEntry* base, DesktopAgnosticFDODesktopEntryType value) { DesktopAgnosticFDODesktopEntryGio* self; char* _tmp0_; self = (DesktopAgnosticFDODesktopEntryGio*) base; desktop_agnostic_fdo_desktop_entry_set_string ((DesktopAgnosticFDODesktopEntry*) self, "Type", _tmp0_ = desktop_agnostic_fdo_desktop_entry_type_to_string (value)); _g_free0 (_tmp0_); g_object_notify ((GObject *) self, "entry-type"); } static char* desktop_agnostic_fdo_desktop_entry_gio_real_get_name (DesktopAgnosticFDODesktopEntry* base) { char* result; DesktopAgnosticFDODesktopEntryGio* self; self = (DesktopAgnosticFDODesktopEntryGio*) base; result = desktop_agnostic_fdo_desktop_entry_get_string ((DesktopAgnosticFDODesktopEntry*) self, "Name"); return result; } static void desktop_agnostic_fdo_desktop_entry_gio_real_set_name (DesktopAgnosticFDODesktopEntry* base, const char* value) { DesktopAgnosticFDODesktopEntryGio* self; self = (DesktopAgnosticFDODesktopEntryGio*) 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_gio_real_get_icon (DesktopAgnosticFDODesktopEntry* base) { char* result; DesktopAgnosticFDODesktopEntryGio* self; char* icon_name; gboolean _tmp0_ = FALSE; self = (DesktopAgnosticFDODesktopEntryGio*) 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** _tmp2_; char** _tmp3_; gint _tmp3__length1; char* _tmp4_; char** _tmp5_; char** _tmp6_; gint _tmp6__length1; char* _tmp7_; char** _tmp8_; char** _tmp9_; gint _tmp9__length1; char* _tmp10_; 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_gio_real_set_icon (DesktopAgnosticFDODesktopEntry* base, const char* value) { DesktopAgnosticFDODesktopEntryGio* self; self = (DesktopAgnosticFDODesktopEntryGio*) base; if (value == NULL) { g_warning ("desktop-entry-impl-gio.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_gio_class_init (DesktopAgnosticFDODesktopEntryGioClass * klass) { desktop_agnostic_fdo_desktop_entry_gio_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (DesktopAgnosticFDODesktopEntryGioPrivate)); G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_fdo_desktop_entry_gio_get_property; G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_fdo_desktop_entry_gio_set_property; G_OBJECT_CLASS (klass)->finalize = desktop_agnostic_fdo_desktop_entry_gio_finalize; g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_FILE, "file"); g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_KEYFILE, "keyfile"); g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_DATA, "data"); g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_ENTRY_TYPE, "entry-type"); g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_NAME, "name"); g_object_class_override_property (G_OBJECT_CLASS (klass), DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_ICON, "icon"); } static void desktop_agnostic_fdo_desktop_entry_gio_desktop_agnostic_fdo_desktop_entry_interface_init (DesktopAgnosticFDODesktopEntryIface * iface) { desktop_agnostic_fdo_desktop_entry_gio_desktop_agnostic_fdo_desktop_entry_parent_iface = g_type_interface_peek_parent (iface); iface->key_exists = desktop_agnostic_fdo_desktop_entry_gio_real_key_exists; iface->get_boolean = desktop_agnostic_fdo_desktop_entry_gio_real_get_boolean; iface->set_boolean = desktop_agnostic_fdo_desktop_entry_gio_real_set_boolean; iface->get_string = desktop_agnostic_fdo_desktop_entry_gio_real_get_string; iface->set_string = desktop_agnostic_fdo_desktop_entry_gio_real_set_string; iface->get_localestring = desktop_agnostic_fdo_desktop_entry_gio_real_get_localestring; iface->set_localestring = desktop_agnostic_fdo_desktop_entry_gio_real_set_localestring; iface->get_string_list = desktop_agnostic_fdo_desktop_entry_gio_real_get_string_list; iface->set_string_list = desktop_agnostic_fdo_desktop_entry_gio_real_set_string_list; iface->exists = desktop_agnostic_fdo_desktop_entry_gio_real_exists; iface->launch = desktop_agnostic_fdo_desktop_entry_gio_real_launch; iface->save = desktop_agnostic_fdo_desktop_entry_gio_real_save; iface->get_file = desktop_agnostic_fdo_desktop_entry_gio_real_get_file; iface->set_file = desktop_agnostic_fdo_desktop_entry_gio_real_set_file; iface->get_keyfile = desktop_agnostic_fdo_desktop_entry_gio_real_get_keyfile; iface->set_keyfile = desktop_agnostic_fdo_desktop_entry_gio_real_set_keyfile; iface->set_data = desktop_agnostic_fdo_desktop_entry_gio_real_set_data; iface->get_entry_type = desktop_agnostic_fdo_desktop_entry_gio_real_get_entry_type; iface->set_entry_type = desktop_agnostic_fdo_desktop_entry_gio_real_set_entry_type; iface->get_name = desktop_agnostic_fdo_desktop_entry_gio_real_get_name; iface->set_name = desktop_agnostic_fdo_desktop_entry_gio_real_set_name; iface->get_icon = desktop_agnostic_fdo_desktop_entry_gio_real_get_icon; iface->set_icon = desktop_agnostic_fdo_desktop_entry_gio_real_set_icon; } static void desktop_agnostic_fdo_desktop_entry_gio_instance_init (DesktopAgnosticFDODesktopEntryGio * self) { self->priv = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_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_gio_finalize (GObject* obj) { DesktopAgnosticFDODesktopEntryGio * self; self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO (obj); _g_key_file_free0 (self->priv->_keyfile); _g_object_unref0 (self->priv->_file); G_OBJECT_CLASS (desktop_agnostic_fdo_desktop_entry_gio_parent_class)->finalize (obj); } GType desktop_agnostic_fdo_desktop_entry_gio_get_type (void) { static volatile gsize desktop_agnostic_fdo_desktop_entry_gio_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_fdo_desktop_entry_gio_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (DesktopAgnosticFDODesktopEntryGioClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_agnostic_fdo_desktop_entry_gio_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DesktopAgnosticFDODesktopEntryGio), 0, (GInstanceInitFunc) desktop_agnostic_fdo_desktop_entry_gio_instance_init, NULL }; static const GInterfaceInfo desktop_agnostic_fdo_desktop_entry_info = { (GInterfaceInitFunc) desktop_agnostic_fdo_desktop_entry_gio_desktop_agnostic_fdo_desktop_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; GType desktop_agnostic_fdo_desktop_entry_gio_type_id; desktop_agnostic_fdo_desktop_entry_gio_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticFDODesktopEntryGio", &g_define_type_info, 0); g_type_add_interface_static (desktop_agnostic_fdo_desktop_entry_gio_type_id, DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY, &desktop_agnostic_fdo_desktop_entry_info); g_once_init_leave (&desktop_agnostic_fdo_desktop_entry_gio_type_id__volatile, desktop_agnostic_fdo_desktop_entry_gio_type_id); } return desktop_agnostic_fdo_desktop_entry_gio_type_id__volatile; } static void desktop_agnostic_fdo_desktop_entry_gio_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { DesktopAgnosticFDODesktopEntryGio * self; self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO (object); switch (property_id) { case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_FILE: g_value_set_object (value, desktop_agnostic_fdo_desktop_entry_get_file ((DesktopAgnosticFDODesktopEntry*) self)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_KEYFILE: g_value_set_pointer (value, desktop_agnostic_fdo_desktop_entry_get_keyfile ((DesktopAgnosticFDODesktopEntry*) self)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_ENTRY_TYPE: g_value_set_enum (value, desktop_agnostic_fdo_desktop_entry_get_entry_type ((DesktopAgnosticFDODesktopEntry*) self)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_NAME: g_value_take_string (value, desktop_agnostic_fdo_desktop_entry_get_name ((DesktopAgnosticFDODesktopEntry*) self)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_ICON: g_value_take_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_gio_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { DesktopAgnosticFDODesktopEntryGio * self; self = DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO (object); switch (property_id) { case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_FILE: desktop_agnostic_fdo_desktop_entry_set_file ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_object (value)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_KEYFILE: desktop_agnostic_fdo_desktop_entry_set_keyfile ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_pointer (value)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_DATA: desktop_agnostic_fdo_desktop_entry_set_data ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_ENTRY_TYPE: desktop_agnostic_fdo_desktop_entry_set_entry_type ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_enum (value)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_NAME: desktop_agnostic_fdo_desktop_entry_set_name ((DesktopAgnosticFDODesktopEntry*) self, g_value_get_string (value)); break; case DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_GIO_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 = 0UL; result = DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_GIO; 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/config-impl-keyfile.c0000664000175000017510000024715511537206466026452 0ustar seagleseagle/* config-impl-keyfile.c generated by valac 0.10.4, 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) G_GNUC_CONST; #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 void desktop_agnostic_config_gkey_file_set_value_from_keyfile (DesktopAgnosticConfigGKeyFile* self, GKeyFile* keyfile, const char* group, const char* key, 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_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 void desktop_agnostic_config_gkey_file_real_constructed (GObject* base); static gboolean _desktop_agnostic_config_gkey_file_create_file_monitor_gsource_func (gpointer self); 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 desktop_agnostic_config_gkey_file_real_set_list (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GValueArray* value, 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); 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); /** * Saves the current state of the configuration to the filesystem, * suppressing the "changed" signal from the file monitor. */ static void desktop_agnostic_config_gkey_file_save_config (DesktopAgnosticConfigGKeyFile* self, GError** error) { char* data; gsize length = 0UL; char* _tmp0_; char* _tmp1_; GError * _inner_error_ = NULL; g_return_if_fail (self != 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); } /** * Saves the current configuration state to the filesystem (if autosave is * on) and emits the notify signal. */ static void desktop_agnostic_config_gkey_file_update_config (DesktopAgnosticConfigGKeyFile* self, const char* group, const char* key, GError** error) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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) { char* _tmp0_ = NULL; char* _tmp1_; char* _tmp2_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (file != NULL); if (contents != NULL) { *contents = NULL; } if (checksum != NULL) { *checksum = NULL; } desktop_agnostic_vfs_file_load_contents (file, &_tmp0_, length, &_inner_error_); *contents = (_tmp1_ = _tmp0_, _g_free0 (*contents), _tmp1_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return; } *checksum = (_tmp2_ = g_compute_checksum_for_string (G_CHECKSUM_SHA256, *contents, *length), _g_free0 (*checksum), _tmp2_); } static void desktop_agnostic_config_gkey_file_load_data (DesktopAgnosticConfigGKeyFile* self, DesktopAgnosticVFSFile* file, GError** error) { char* data; gsize length = 0UL; char* _tmp0_ = NULL; char* _tmp1_; char* _tmp2_ = NULL; char* _tmp3_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (file != 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) { DesktopAgnosticConfigSchemaOption* option; GType type; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (keyfile != NULL); g_return_if_fail (group != NULL); g_return_if_fail (key != 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_); _g_free0 (_tmp4_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_object_unref0 (option); return; } } 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_; char* _tmp8_; GValue _tmp9_ = {0}; 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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _g_object_unref0 (st); _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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _g_object_unref0 (st); _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_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _g_object_unref0 (st); _g_object_unref0 (option); return; } G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; _g_object_unref0 (st); } } } } } _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 = NULL; DesktopAgnosticConfigSchemaOption* option; GType list_type = 0UL; GValueArray* arr; DesktopAgnosticConfigSchemaOption* _tmp0_; GError * _inner_error_ = NULL; 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); 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_value_array_free0 (arr); _g_object_unref0 (option); 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_value_array_free0 (arr); _g_object_unref0 (option); return NULL; } if (!_tmp1_) { result = g_value_array_new ((guint) 0); _g_value_array_free0 (arr); _g_object_unref0 (option); return result; } } list_type = desktop_agnostic_config_schema_option_get_list_type (option); if (list_type == G_TYPE_BOOLEAN) { gint list_data_length1; gint _list_data_size_; gboolean* list_data; GValue val = {0}; gint _tmp3__length1; gint __tmp3__size_; gboolean* _tmp4_; 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_); G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (g_free (list_data), NULL); _g_value_array_free0 (arr); _g_object_unref0 (option); 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 _tmp7_ = {0}; GValue _tmp8_; 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); } } } G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (g_free (list_data), NULL); } else { if (list_type == G_TYPE_INT) { gint list_data_length1; gint _list_data_size_; gint* list_data; GValue val = {0}; gint _tmp10__length1; gint __tmp10__size_; gint* _tmp11_; 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_); G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (g_free (list_data), NULL); _g_value_array_free0 (arr); _g_object_unref0 (option); 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 _tmp14_ = {0}; GValue _tmp15_; 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); } } } G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (g_free (list_data), NULL); } else { if (list_type == G_TYPE_FLOAT) { gint list_data_length1; gint _list_data_size_; double* list_data; GValue val = {0}; gint _tmp17__length1; gint __tmp17__size_; double* _tmp18_; 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_); G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (g_free (list_data), NULL); _g_value_array_free0 (arr); _g_object_unref0 (option); 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 _tmp21_ = {0}; GValue _tmp22_; 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); } } } G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (g_free (list_data), NULL); } else { if (list_type == G_TYPE_STRING) { gint list_data_length1; gint _list_data_size_; char** list_data; GValue val = {0}; gint _tmp24__length1; gint __tmp24__size_; char** _tmp25_; 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_); G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); _g_value_array_free0 (arr); _g_object_unref0 (option); 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 _tmp28_ = {0}; GValue _tmp29_; 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); } } } G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL; list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); } else { DesktopAgnosticConfigSchemaType* st; gint list_data_length1; gint _list_data_size_; char** list_data; gint _tmp31__length1; gint __tmp31__size_; char** _tmp32_; 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_value_array_free0 (arr); _g_object_unref0 (option); 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_); list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); _g_object_unref0 (st); _g_value_array_free0 (arr); _g_object_unref0 (option); 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 _tmp37_; GValue _tmp38_; _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); list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); _g_object_unref0 (st); _g_value_array_free0 (arr); _g_object_unref0 (option); return NULL; } g_value_array_append (arr, (_tmp38_ = _tmp37_ = _tmp36_, &_tmp38_)); G_IS_VALUE (&_tmp37_) ? (g_value_unset (&_tmp37_), NULL) : NULL; _g_free0 (item); } } } list_data = (_vala_array_free (list_data, list_data_length1, (GDestroyNotify) g_free), NULL); _g_object_unref0 (st); } } } } 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_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (file != NULL); g_return_if_fail (monitor != 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* _tmp0_ = NULL; char* _tmp1_; char* _tmp2_ = NULL; char* _tmp3_; 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 (checksum); _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; } 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 (checksum); _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->_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 (checksum); _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; } if (_tmp6_) { char* _tmp7_; char* _tmp8_; char* _tmp9_; char* _tmp10_; _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 (checksum); _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; } _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 (checksum); _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; } _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 (checksum); _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; } } } } } } } } _g_list_free0 (group_collection); } self->priv->_autosave = TRUE; _g_key_file_free0 (new_data); } _g_free0 (checksum); _g_free0 (data); 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 = FALSE; 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; } /** * Determines the path to the config file and creates/loads it. */ static gboolean _desktop_agnostic_config_gkey_file_create_file_monitor_gsource_func (gpointer self) { gboolean result; result = desktop_agnostic_config_gkey_file_create_file_monitor (self); return result; } static void desktop_agnostic_config_gkey_file_real_constructed (GObject* base) { DesktopAgnosticConfigGKeyFile * self; char* base_path; char* path; DesktopAgnosticConfigSchema* schema; char* _tmp0_; DesktopAgnosticVFSFile* _tmp5_; DesktopAgnosticVFSFile* _tmp6_; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; 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* _tmp1_; char* _tmp2_; 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* _tmp3_; char* _tmp4_; 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_object_unref0 (schema); _g_free0 (path); _g_free0 (base_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->_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_object_unref0 (schema); _g_free0 (path); _g_free0 (base_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_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_object_unref0 (schema); _g_free0 (path); _g_free0 (base_path); } static void desktop_agnostic_config_gkey_file_real_reset (DesktopAgnosticConfigBackend* base, GError** error) { DesktopAgnosticConfigGKeyFile * self; DesktopAgnosticConfigSchema* schema; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; 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 _tmp1_ = {0}; GValue _tmp2_; 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); _desktop_agnostic_config_notify_delegate_free0 (data); _g_free0 (full_key); } static void desktop_agnostic_config_gkey_file_real_notify (DesktopAgnosticConfigBackend* base, const char* group, const char* key, GError** error) { DesktopAgnosticConfigGKeyFile * self; char* full_key; GValue _tmp0_ = {0}; GValue value; GSList* funcs; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; _g_free0 (full_key); } 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); } _desktop_agnostic_config_notify_delegate_free0 (ndata); _g_free0 (full_key); } /** * Removes the config file from the file system. Implies reset(), but does * not save to disk. */ static void desktop_agnostic_config_gkey_file_real_remove (DesktopAgnosticConfigBackend* base, GError** error) { DesktopAgnosticConfigGKeyFile * self; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; 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; DesktopAgnosticConfigSchema* schema; DesktopAgnosticConfigSchemaOption* option; GType option_type = 0UL; GValue _result_ = {0}; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); return; } } option_type = desktop_agnostic_config_schema_option_get_option_type (option); if (option_type == G_TYPE_BOOLEAN) { gboolean _tmp0_; GValue _tmp1_ = {0}; GValue _tmp2_; _tmp0_ = desktop_agnostic_config_backend_get_bool ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); 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 _tmp4_ = {0}; GValue _tmp5_; _tmp3_ = desktop_agnostic_config_backend_get_float ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); 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 _tmp7_ = {0}; GValue _tmp8_; _tmp6_ = desktop_agnostic_config_backend_get_int ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); 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 _tmp10_ = {0}; GValue _tmp11_; _tmp9_ = desktop_agnostic_config_backend_get_string ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); return; } _result_ = (_tmp11_ = (g_value_init (&_tmp10_, G_TYPE_STRING), g_value_take_string (&_tmp10_, _tmp9_), _tmp10_), G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp11_); } else { if (option_type == G_TYPE_VALUE_ARRAY) { GValueArray* _tmp12_; GValue _tmp13_ = {0}; GValue _tmp14_; _tmp12_ = desktop_agnostic_config_backend_get_list ((DesktopAgnosticConfigBackend*) self, group, key, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); return; } _result_ = (_tmp14_ = (g_value_init (&_tmp13_, G_TYPE_VALUE_ARRAY), g_value_take_boxed (&_tmp13_, _tmp12_), _tmp13_), G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _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_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); return; } } else { char* _tmp15_; char* _tmp16_; GValue _tmp17_ = {0}; GValue _tmp18_; GValue _tmp19_; GValue _tmp20_; _tmp15_ = 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_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); return; } _tmp19_ = (_tmp18_ = (desktop_agnostic_config_schema_type_deserialize (st, _tmp16_ = _tmp15_, &_tmp17_, &_inner_error_), _tmp17_), _g_free0 (_tmp16_), _tmp18_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_object_unref0 (st); G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL; _g_object_unref0 (option); _g_object_unref0 (schema); return; } _result_ = (_tmp20_ = _tmp19_, G_IS_VALUE (&_result_) ? (g_value_unset (&_result_), NULL) : NULL, _tmp20_); } _g_object_unref0 (st); } } } } } *result = _result_; _g_object_unref0 (option); _g_object_unref0 (schema); 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 = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_val_if_fail (group != NULL, FALSE); g_return_val_if_fail (key != NULL, FALSE); { 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: { 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; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = 0.0F; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_val_if_fail (group != NULL, 0.0F); g_return_val_if_fail (key != NULL, 0.0F); { 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_->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; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = 0; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_val_if_fail (group != NULL, 0); g_return_val_if_fail (key != NULL, 0); { 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: { 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; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != 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 = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_val_if_fail (group != NULL, NULL); g_return_val_if_fail (key != NULL, 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: { 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; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != NULL); g_return_if_fail (value != 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 = NULL; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_val_if_fail (group != NULL, NULL); g_return_val_if_fail (key != NULL, 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: { 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; DesktopAgnosticConfigSchemaOption* option; GType list_type; gboolean _tmp0_ = FALSE; GError * _inner_error_ = NULL; self = (DesktopAgnosticConfigGKeyFile*) base; g_return_if_fail (group != NULL); g_return_if_fail (key != NULL); g_return_if_fail (value != 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* _tmp6_; char* _tmp7_; _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_; if (!g_key_file_has_group (self->priv->_data, group)) { _g_object_unref0 (option); return; } _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) { gint list_length1; gint _list_size_; gboolean* _tmp10_; 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 list_length1; gint _list_size_; gint* _tmp12_; 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) { gint list_length1; gint _list_size_; double* _tmp15_; 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) { gint list_length1; gint _list_size_; char** _tmp18_; 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, (const gchar* const*) list, list_length1); list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); } else { DesktopAgnosticConfigSchemaType* st; gint list_length1; gint _list_size_; char** _tmp20_; 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_); list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); _g_object_unref0 (st); _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, (const gchar* const*) list, list_length1); list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL); _g_object_unref0 (st); } } } } } 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 = NULL; self = (DesktopAgnosticConfigGKeyFile*) desktop_agnostic_config_backend_construct (object_type); 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 volatile gsize desktop_agnostic_config_gkey_file_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_config_gkey_file_type_id__volatile)) { 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 }; GType desktop_agnostic_config_gkey_file_type_id; desktop_agnostic_config_gkey_file_type_id = g_type_register_static (DESKTOP_AGNOSTIC_CONFIG_TYPE_BACKEND, "DesktopAgnosticConfigGKeyFile", &g_define_type_info, 0); g_once_init_leave (&desktop_agnostic_config_gkey_file_type_id__volatile, desktop_agnostic_config_gkey_file_type_id); } return desktop_agnostic_config_gkey_file_type_id__volatile; } 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_take_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 = 0UL; 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/ui.h0000664000175000017510000002212111537206467023223 0ustar seagleseagle/* ui.h generated by valac 0.10.4, 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) G_GNUC_CONST; 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) G_GNUC_CONST; 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) G_GNUC_CONST; DesktopAgnosticUIIconType desktop_agnostic_ui_icon_button_get_icon_type (DesktopAgnosticUIIconButton* self); GType desktop_agnostic_ui_icon_chooser_dialog_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_new (DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean entry_type_sensitive); DesktopAgnosticUILauncherEditorDialog* desktop_agnostic_ui_launcher_editor_dialog_construct (GType object_type, DesktopAgnosticVFSFile* file, DesktopAgnosticVFSFile* output, gboolean entry_type_sensitive); DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_file (DesktopAgnosticUILauncherEditorDialog* self); DesktopAgnosticVFSFile* desktop_agnostic_ui_launcher_editor_dialog_get_output (DesktopAgnosticUILauncherEditorDialog* self); gboolean desktop_agnostic_ui_launcher_editor_dialog_get_entry_type_sensitive (DesktopAgnosticUILauncherEditorDialog* self); void desktop_agnostic_ui_launcher_editor_dialog_set_entry_type_sensitive (DesktopAgnosticUILauncherEditorDialog* self, gboolean value); G_END_DECLS #endif libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/vfs-file.c0000664000175000017510000012533511537206464024324 0ustar seagleseagle/* vfs-file.c generated by valac 0.10.4, 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; #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))) /** * File-related errors. */ 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); gboolean (*is_native) (DesktopAgnosticVFSFile* self); char* (*get_mime_type) (DesktopAgnosticVFSFile* self, GError** error); char** (*get_icon_names) (DesktopAgnosticVFSFile* self, int* result_length1, GError** error); char* (*get_thumbnail_path) (DesktopAgnosticVFSFile* self); 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) G_GNUC_CONST; GType desktop_agnostic_vfs_access_flags_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_file_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_event_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_file_monitor_get_type (void) G_GNUC_CONST; 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); gboolean desktop_agnostic_vfs_file_is_readable (DesktopAgnosticVFSFile* self); DesktopAgnosticVFSAccessFlags desktop_agnostic_vfs_file_get_access_flags (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); gboolean desktop_agnostic_vfs_file_is_native (DesktopAgnosticVFSFile* self); static gboolean desktop_agnostic_vfs_file_real_is_native (DesktopAgnosticVFSFile* self); char* desktop_agnostic_vfs_file_get_mime_type (DesktopAgnosticVFSFile* self, GError** error); static char* desktop_agnostic_vfs_file_real_get_mime_type (DesktopAgnosticVFSFile* self, GError** error); char** desktop_agnostic_vfs_file_get_icon_names (DesktopAgnosticVFSFile* self, int* result_length1, GError** error); static char** desktop_agnostic_vfs_file_real_get_icon_names (DesktopAgnosticVFSFile* self, int* result_length1, GError** error); char* desktop_agnostic_vfs_file_get_thumbnail_path (DesktopAgnosticVFSFile* self); static char* desktop_agnostic_vfs_file_real_get_thumbnail_path (DesktopAgnosticVFSFile* self); 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); DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_path (const char* path, GError** error); GQuark desktop_agnostic_vfs_volume_error_quark (void); GType desktop_agnostic_vfs_volume_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_volume_monitor_get_type (void) G_GNUC_CONST; GType desktop_agnostic_vfs_implementation_get_type (void) G_GNUC_CONST; 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_uri (const char* uri, GError** error); char** desktop_agnostic_vfs_get_icon_names_for_mime_type (const char* mime_type, int* result_length1); static void _vala_array_add1 (char*** array, int* length, int* size, char* value); static void _vala_array_add2 (char*** array, int* length, int* size, char* value); static void _vala_array_add3 (char*** array, int* length, int* size, char* value); 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); GQuark desktop_agnostic_vfs_file_error_quark (void) { return g_quark_from_static_string ("desktop_agnostic_vfs_file_error-quark"); } /** * The kinds of files recognized by the File backends. */ GType desktop_agnostic_vfs_file_type_get_type (void) { static volatile gsize desktop_agnostic_vfs_file_type_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_type_type_id__volatile)) { 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}}; GType desktop_agnostic_vfs_file_type_type_id; desktop_agnostic_vfs_file_type_type_id = g_enum_register_static ("DesktopAgnosticVFSFileType", values); g_once_init_leave (&desktop_agnostic_vfs_file_type_type_id__volatile, desktop_agnostic_vfs_file_type_type_id); } return desktop_agnostic_vfs_file_type_type_id__volatile; } GType desktop_agnostic_vfs_access_flags_get_type (void) { static volatile gsize desktop_agnostic_vfs_access_flags_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_access_flags_type_id__volatile)) { 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}}; GType desktop_agnostic_vfs_access_flags_type_id; desktop_agnostic_vfs_access_flags_type_id = g_enum_register_static ("DesktopAgnosticVFSAccessFlags", values); g_once_init_leave (&desktop_agnostic_vfs_access_flags_type_id__volatile, desktop_agnostic_vfs_access_flags_type_id); } return desktop_agnostic_vfs_access_flags_type_id__volatile; } /** * Implementation detail. Implementing classes override this to properly * associate the URI with the implementation pointer. */ 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); } /** * Whether something exists at the URI that the object represents. */ 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); } /** * Whether the file is readable. */ gboolean desktop_agnostic_vfs_file_is_readable (DesktopAgnosticVFSFile* self) { gboolean result = FALSE; 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; } /** * Whether the file is writable. */ gboolean desktop_agnostic_vfs_file_is_writable (DesktopAgnosticVFSFile* self) { gboolean result = FALSE; 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; } /** * Whether the file is executable. */ gboolean desktop_agnostic_vfs_file_is_executable (DesktopAgnosticVFSFile* self) { gboolean result = FALSE; 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; } /** * Adds a monitor to the file. * @return the monitor associated with the file */ 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); } /** * Loads the contents of the file to a string. * @return %TRUE on success, %FALSE on failure. */ 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); } /** * Saves a string to the specified file, replacing any content that may * have been in it. * @return %TRUE on success, %FALSE on failure. */ 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); } /** * Launches the specified file with the default MIME application. * @return %TRUE on successful launch, %FALSE on failure. */ 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); } /** * Retrieves a list of child file objects for a given object. Only * guaranteed to work on directories. * @return a list of child file objects */ 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); } /** * Copies a file to another URI. This is a synchronous operation. Only * guaranteed to work on files, not directories. * @param destination the destination of the copied file. * @param overwrite if a file exists at the destination, whether to * overwrite it. */ 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); } /** * Removes the specified file. Only works on files, not directories. * @return %TRUE on success, %FALSE on failure. */ 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); } /** * Checks to see if a file is native to the platform. * @return %TRUE if file is native, %FALSE otherwise. */ static gboolean desktop_agnostic_vfs_file_real_is_native (DesktopAgnosticVFSFile* self) { g_return_val_if_fail (self != NULL, FALSE); g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_is_native'", g_type_name (G_TYPE_FROM_INSTANCE (self))); return FALSE; } gboolean desktop_agnostic_vfs_file_is_native (DesktopAgnosticVFSFile* self) { return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->is_native (self); } /** * Gets the file's mime type. (might block) * @return String containing file's mime type. */ static char* desktop_agnostic_vfs_file_real_get_mime_type (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_get_mime_type'", g_type_name (G_TYPE_FROM_INSTANCE (self))); return NULL; } char* desktop_agnostic_vfs_file_get_mime_type (DesktopAgnosticVFSFile* self, GError** error) { return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_mime_type (self, error); } /** * Gets list of possible icon names representing this file. (might block) * @return List of possible icon names. */ static char** desktop_agnostic_vfs_file_real_get_icon_names (DesktopAgnosticVFSFile* self, int* result_length1, GError** error) { g_return_val_if_fail (self != NULL, NULL); g_critical ("Type `%s' does not implement abstract method `desktop_agnostic_vfs_file_get_icon_names'", g_type_name (G_TYPE_FROM_INSTANCE (self))); return NULL; } char** desktop_agnostic_vfs_file_get_icon_names (DesktopAgnosticVFSFile* self, int* result_length1, GError** error) { return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_icon_names (self, result_length1, 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. */ static char* desktop_agnostic_vfs_file_real_get_thumbnail_path (DesktopAgnosticVFSFile* self) { char* result = NULL; g_return_val_if_fail (self != NULL, NULL); result = NULL; return result; } char* desktop_agnostic_vfs_file_get_thumbnail_path (DesktopAgnosticVFSFile* self) { return DESKTOP_AGNOSTIC_VFS_FILE_GET_CLASS (self)->get_thumbnail_path (self); } DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_construct (GType object_type) { DesktopAgnosticVFSFile * self = NULL; 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; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->is_native = desktop_agnostic_vfs_file_real_is_native; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_mime_type = desktop_agnostic_vfs_file_real_get_mime_type; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_icon_names = desktop_agnostic_vfs_file_real_get_icon_names; DESKTOP_AGNOSTIC_VFS_FILE_CLASS (klass)->get_thumbnail_path = desktop_agnostic_vfs_file_real_get_thumbnail_path; G_OBJECT_CLASS (klass)->get_property = desktop_agnostic_vfs_file_get_property; G_OBJECT_CLASS (klass)->set_property = desktop_agnostic_vfs_file_set_property; /** * The pointer to the implementation used. */ 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)); /** * Implementation detail. Implementing classes override this to allow the * uri property to return the correct value. */ 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)); /** * The URI that the object represents. */ 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)); /** * Implementation detail. Implementing classes override this to allow the * path property to return the correct value. */ 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)); /** * The path that the object represents. */ 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)); /** * The kind of file that the object represents. */ 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)); /** * Access rights for the current user for the file. * @see AccessFlags */ 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)); /** * The parent URI. If this is the root, returns %NULL. */ 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) { } /** * Abstract base class for representations of files. */ GType desktop_agnostic_vfs_file_get_type (void) { static volatile gsize desktop_agnostic_vfs_file_type_id__volatile = 0; if (g_once_init_enter (&desktop_agnostic_vfs_file_type_id__volatile)) { 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 }; GType desktop_agnostic_vfs_file_type_id; desktop_agnostic_vfs_file_type_id = g_type_register_static (G_TYPE_OBJECT, "DesktopAgnosticVFSFile", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); g_once_init_leave (&desktop_agnostic_vfs_file_type_id__volatile, desktop_agnostic_vfs_file_type_id); } return desktop_agnostic_vfs_file_type_id__volatile; } 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_take_string (value, desktop_agnostic_vfs_file_get_uri (self)); break; case DESKTOP_AGNOSTIC_VFS_FILE_PATH: g_value_take_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 = NULL; DesktopAgnosticVFSImplementation* vfs; GError * _inner_error_ = NULL; g_return_val_if_fail (path != NULL, 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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_VFS_FILE ((_tmp0_ = g_object_new (desktop_agnostic_vfs_implementation_get_file_type (vfs), "path", path, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } DesktopAgnosticVFSFile* desktop_agnostic_vfs_file_new_for_uri (const char* uri, GError** error) { DesktopAgnosticVFSFile* result = NULL; DesktopAgnosticVFSImplementation* vfs; GError * _inner_error_ = NULL; g_return_val_if_fail (uri != NULL, 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 { GObject* _tmp0_; result = DESKTOP_AGNOSTIC_VFS_FILE ((_tmp0_ = g_object_new (desktop_agnostic_vfs_implementation_get_file_type (vfs), "uri", uri, NULL), G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_)); return result; } } static char* string_replace (const char* self, const char* old, const char* replacement) { char* result = NULL; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (old != NULL, NULL); g_return_val_if_fail (replacement != NULL, 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 __catch1_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 __catch1_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 __finally1; __catch1_g_regex_error: { GError * e; e = _inner_error_; _inner_error_ = NULL; { g_assert_not_reached (); _g_error_free0 (e); } } __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 _vala_array_add1 (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_add2 (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_add3 (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; } char** desktop_agnostic_vfs_get_icon_names_for_mime_type (const char* mime_type, int* result_length1) { char** result = NULL; gint names_length1; gint _names_size_; char** _tmp0_; char** names; char** _tmp1_; char** _tmp2_; gint _tmp2__length1; char** _tmp3_; g_return_val_if_fail (mime_type != NULL, NULL); names = (_tmp0_ = NULL, names_length1 = 0, _names_size_ = names_length1, _tmp0_); g_return_val_if_fail (_vala_strcmp0 (mime_type, "") != 0, NULL); _vala_array_add1 (&names, &names_length1, &_names_size_, string_replace (mime_type, "/", "-")); _vala_array_add2 (&names, &names_length1, &_names_size_, g_strdup_printf ("gnome-mime-%s", names[0])); _vala_array_add3 (&names, &names_length1, &_names_size_, g_strdup_printf ("%s-x-generic", (_tmp2_ = _tmp1_ = g_regex_split_simple ("/.*", mime_type, 0, 0), _tmp2__length1 = _vala_array_length (_tmp1_), _tmp2_)[0])); _tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL); result = (_tmp3_ = names, *result_length1 = names_length1, _tmp3_); return result; names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL); } 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); } libdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/fdo.h0000664000175000017510000001716011537206465023363 0ustar seagleseagle/* fdo.h generated by valac 0.10.4, 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) G_GNUC_CONST; GType desktop_agnostic_fdo_desktop_entry_type_get_type (void) G_GNUC_CONST; 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) G_GNUC_CONST; 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 libdesktop-agnostic-0.3.92/gen_src/tools/lda-desktop-entry-editor.c0000664000175000017510000000765011537206467024640 0ustar seagleseagle/* lda-desktop-entry-editor.c generated by valac 0.10.4, 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 _vala_main (char** args, int args_length1); const GOptionEntry entries[0] = {}; gint _vala_main (char** args, int args_length1) { gint result = 0; DesktopAgnosticVFSFile* file; DesktopAgnosticVFSFile* output; DesktopAgnosticUILauncherEditorDialog* editor; GError * _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 (editor); _g_object_unref0 (output); _g_object_unref0 (file); 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_dialog_run ((GtkDialog*) editor); 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 (editor); _g_object_unref0 (output); _g_object_unref0 (file); return result; } } __finally0: if (_inner_error_ != NULL) { _g_object_unref0 (editor); _g_object_unref0 (output); _g_object_unref0 (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 0; } result = 0; _g_object_unref0 (editor); _g_object_unref0 (output); _g_object_unref0 (file); return result; } int main (int argc, char ** argv) { g_type_init (); return _vala_main (argv, argc); } libdesktop-agnostic-0.3.92/gen_src/tools/lda-schema-to-gconf.c0000664000175000017510000003102011537206466023501 0ustar seagleseagle/* lda-schema-to-gconf.c generated by valac 0.10.4, 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 __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_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); gint _vala_main (char** args, int args_length1); static void _value_array_to_string_gvalue_transform (GValue* src_value, GValue* dest_value); static void _vala_GValue_free (GValue* self); static int _vala_strcmp0 (const char * str1, const char * str2); char* schema_type_to_string (GType type) { char* result = NULL; 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 _tmp1_ = {0}; GValue _tmp2_; 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 val_str = {0}; 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)); g_value_init (&val_str, G_TYPE_STRING); 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 = (_tmp2_ = (g_value_init (&_tmp1_, G_TYPE_STRING), g_value_set_string (&_tmp1_, res->str), _tmp1_), G_IS_VALUE (dest_value) ? (g_value_unset (dest_value), NULL) : NULL, _tmp2_); _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 void _vala_GValue_free (GValue* self) { g_value_unset (self); g_free (self); } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } gint _vala_main (char** args, int args_length1) { gint result = 0; const char* current_group; const char* current_key; GError * _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 b" \ "e installed for %s to function correctly.", args[0]); result = 1; _g_string_free0 (gconf); _g_object_unref0 (schema); 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 ex" \ "ist.", args[1]); result = 1; _g_string_free0 (gconf); _g_object_unref0 (schema); return result; } _tmp0_ = desktop_agnostic_config_schema_new (args[1], &_inner_error_); if (_inner_error_ != NULL) { _g_string_free0 (gconf); _g_object_unref0 (schema); 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_; GValue* _tmp4_; char* _tmp5_; 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 (path_prefix); _g_free0 (app_name); _g_free0 (base_path); _g_list_free0 (group_collection); _g_string_free0 (gconf); _g_object_unref0 (schema); goto __catch0_g_error; } base_path = (_tmp5_ = g_strdup (g_value_get_string (_tmp4_ = _tmp3_)), _g_free0 (base_path), _tmp5_); __vala_GValue_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 default_value = {0}; char* summary; char* _tmp9_; char* _tmp10_; char* _tmp11_; char* _tmp12_; char* _tmp13_; GValue _tmp16_ = {0}; GValue _tmp17_; char* _tmp20_; char* _tmp21_; gboolean _tmp22_ = FALSE; char* _tmp24_; option = _g_object_ref0 (desktop_agnostic_config_schema_get_option (schema, group, key)); type = desktop_agnostic_config_schema_option_get_option_type (option); g_value_init (&default_value, G_TYPE_STRING); summary = NULL; current_key = key; g_string_append (gconf, " \n"); g_string_append (gconf, _tmp9_ = g_markup_printf_escaped (" /schemas%s/%s\n", path_prefix, key)); _g_free0 (_tmp9_); g_string_append (gconf, _tmp10_ = g_markup_printf_escaped (" %s/%s\n", path_prefix, key)); _g_free0 (_tmp10_); g_string_append (gconf, _tmp11_ = g_markup_printf_escaped (" %s\n", app_name)); _g_free0 (_tmp11_); g_string_append (gconf, _tmp13_ = g_markup_printf_escaped (" %s\n", _tmp12_ = schema_type_to_string (type))); _g_free0 (_tmp13_); _g_free0 (_tmp12_); if (type == G_TYPE_VALUE_ARRAY) { GType list_type; char* _tmp14_; char* _tmp15_; list_type = desktop_agnostic_config_schema_option_get_list_type (option); g_string_append (gconf, _tmp15_ = g_markup_printf_escaped (" %s\n", _tmp14_ = schema_type_to_string (list_type))); _g_free0 (_tmp15_); _g_free0 (_tmp14_); } g_value_transform ((_tmp17_ = (desktop_agnostic_config_schema_option_get_default_value (option, &_tmp16_), _tmp16_), &_tmp17_), &default_value); if (NULL == g_value_get_string (&default_value)) { GValue _tmp18_ = {0}; GValue _tmp19_; default_value = (_tmp19_ = (g_value_init (&_tmp18_, G_TYPE_STRING), g_value_set_string (&_tmp18_, ""), _tmp18_), G_IS_VALUE (&default_value) ? (g_value_unset (&default_value), NULL) : NULL, _tmp19_); } g_string_append (gconf, _tmp20_ = g_markup_printf_escaped (" %s\n", g_value_get_string (&default_value))); _g_free0 (_tmp20_); g_string_append (gconf, " \n"); summary = (_tmp21_ = g_strdup (desktop_agnostic_config_schema_option_get_summary (option)), _g_free0 (summary), _tmp21_); if (summary != NULL) { _tmp22_ = _vala_strcmp0 (summary, "") != 0; } else { _tmp22_ = FALSE; } if (_tmp22_) { char* _tmp23_; g_string_append (gconf, _tmp23_ = g_markup_printf_escaped (" %s\n", summary)); _g_free0 (_tmp23_); } g_string_append (gconf, _tmp24_ = g_markup_printf_escaped (" %s\n", desktop_agnostic_config_schema_option_get_description (option))); _g_free0 (_tmp24_); g_string_append (gconf, " \n"); g_string_append (gconf, " \n"); _g_free0 (summary); G_IS_VALUE (&default_value) ? (g_value_unset (&default_value), NULL) : NULL; _g_object_unref0 (option); } } } _g_free0 (path_prefix); _g_free0 (app_name); _g_free0 (base_path); } } _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_string_free0 (gconf); _g_object_unref0 (schema); goto __catch0_g_error; } } _g_string_free0 (gconf); _g_object_unref0 (schema); } goto __finally0; __catch0_g_error: { GError * err; err = _inner_error_; _inner_error_ = NULL; { gboolean _tmp25_ = FALSE; if (current_group == NULL) { _tmp25_ = TRUE; } else { _tmp25_ = current_key == NULL; } if (_tmp25_) { 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 _vala_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); } libdesktop-agnostic-0.3.92/wafadmin/Tools/suncc.py0000644000175000017510000000241611226437331021415 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,optparse import Utils,Options,Configure import ccroot,ar from Configure import conftest def find_scc(conf): v=conf.env cc=None if v['CC']:cc=v['CC'] elif'CC'in conf.environ:cc=conf.environ['CC'] if not cc:cc=conf.find_program('cc',var='CC') if not cc:conf.fatal('suncc was not found') try: if not Utils.cmd_output('%s -flags'%cc): conf.fatal('suncc %r was not found'%cc) except ValueError: conf.fatal('suncc -flags could not be executed') v['CC']=cc v['CC_NAME']='sun' def scc_common_flags(conf): v=conf.env v['CC_SRC_F']='' v['CC_TGT_F']=['-c','-o',''] v['CPPPATH_ST']='-I%s' if not v['LINK_CC']:v['LINK_CC']=v['CC'] v['CCLNK_SRC_F']='' v['CCLNK_TGT_F']=['-o',''] v['LIB_ST']='-l%s' v['LIBPATH_ST']='-L%s' v['STATICLIB_ST']='-l%s' v['STATICLIBPATH_ST']='-L%s' v['CCDEFINES_ST']='-D%s' v['SONAME_ST']='-Wl,-h -Wl,%s' v['SHLIB_MARKER']='-Bdynamic' v['STATICLIB_MARKER']='-Bstatic' v['program_PATTERN']='%s' v['shlib_CCFLAGS']=['-Kpic','-DPIC'] v['shlib_LINKFLAGS']=['-G'] v['shlib_PATTERN']='lib%s.so' v['staticlib_LINKFLAGS']=['-Bstatic'] v['staticlib_PATTERN']='lib%s.a' detect=''' find_scc find_cpp find_ar scc_common_flags cc_load_tools cc_add_flags ''' conftest(find_scc) conftest(scc_common_flags) libdesktop-agnostic-0.3.92/wafadmin/Tools/d.py0000644000175000017510000002342211226437331020525 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,re,optparse import ccroot import TaskGen,Utils,Task,Configure,Logs,Build from Logs import debug,error from TaskGen import taskgen,feature,after,before,extension EXT_D=['.d','.di','.D'] D_METHS=['apply_core','apply_vnum','apply_objdeps'] def filter_comments(filename): txt=Utils.readf(filename) buf=[] i=0 max=len(txt) while i1: self.features.append('d'+k[1]) TaskGen.bind_feature('d',D_METHS) def init_d(self): Utils.def_attrs(self,dflags='',importpaths='',libs='',libpaths='',uselib='',uselib_local='',generate_headers=False,compiled_tasks=[],add_objects=[],link_task=None) def apply_d_libs(self): uselib=self.to_list(self.uselib) seen=[] local_libs=self.to_list(self.uselib_local) libs=[] libpaths=[] env=self.env while local_libs: x=local_libs.pop() if x in seen: continue else: seen.append(x) y=self.name_to_obj(x) if not y: raise Utils.WafError('object not found in uselib_local: obj %s uselib %s'%(self.name,x)) if y.uselib_local: added=0 lst=y.to_list(y.uselib_local) lst.reverse() for u in lst: if u in seen:continue added=1 local_libs=[u]+local_libs if added:continue y.post() seen.append(x) libname=y.target[y.target.rfind(os.sep)+1:] if'dshlib'in y.features or'dstaticlib'in y.features: env.append_unique('DLINKFLAGS',env['DLIBPATH_ST']%y.link_task.outputs[0].parent.bldpath(env)) env.append_unique('DLINKFLAGS',env['DLIB_ST']%libname) tmp_path=y.path.bldpath(env) if not tmp_path in libpaths:libpaths=[tmp_path]+libpaths if y.link_task is not None: self.link_task.set_run_after(y.link_task) dep_nodes=getattr(self.link_task,'dep_nodes',[]) self.link_task.dep_nodes=dep_nodes+y.link_task.outputs morelibs=y.to_list(y.uselib) for v in morelibs: if v in uselib:continue uselib=[v]+uselib self.uselib=uselib def apply_d_link(self): link=getattr(self,'link',None) if not link: if'dstaticlib'in self.features:link='ar_link_static' else:link='d_link' linktask=self.create_task(link) outputs=[t.outputs[0]for t in self.compiled_tasks] linktask.set_inputs(outputs) linktask.set_outputs(self.path.find_or_declare(get_target_name(self))) self.link_task=linktask def apply_d_vars(self): env=self.env dpath_st=env['DPATH_ST'] lib_st=env['DLIB_ST'] libpath_st=env['DLIBPATH_ST'] importpaths=self.to_list(self.importpaths) libpaths=[] libs=[] uselib=self.to_list(self.uselib) for i in uselib: if env['DFLAGS_'+i]: env.append_unique('DFLAGS',env['DFLAGS_'+i]) for x in self.features: if not x in['dprogram','dstaticlib','dshlib']: continue x.lstrip('d') d_shlib_dflags=env['D_'+x+'_DFLAGS'] if d_shlib_dflags: env.append_unique('DFLAGS',d_shlib_dflags) for i in uselib: if env['DPATH_'+i]: for entry in self.to_list(env['DPATH_'+i]): if not entry in importpaths: importpaths.append(entry) for path in importpaths: if os.path.isabs(path): env.append_unique('_DIMPORTFLAGS',dpath_st%path) else: node=self.path.find_dir(path) self.env.append_unique('INC_PATHS',node) env.append_unique('_DIMPORTFLAGS',dpath_st%node.srcpath(env)) env.append_unique('_DIMPORTFLAGS',dpath_st%node.bldpath(env)) for i in uselib: if env['LIBPATH_'+i]: for entry in self.to_list(env['LIBPATH_'+i]): if not entry in libpaths: libpaths+=[entry] libpaths=self.to_list(self.libpaths)+libpaths for path in libpaths: env.append_unique('DLINKFLAGS',libpath_st%path) for i in uselib: if env['LIB_'+i]: for entry in self.to_list(env['LIB_'+i]): if not entry in libs: libs+=[entry] libs=libs+self.to_list(self.libs) for lib in libs: env.append_unique('DLINKFLAGS',lib_st%lib) for i in uselib: dlinkflags=env['DLINKFLAGS_'+i] if dlinkflags: for linkflag in dlinkflags: env.append_unique('DLINKFLAGS',linkflag) def add_shlib_d_flags(self): for linkflag in self.env['D_shlib_LINKFLAGS']: self.env.append_unique('DLINKFLAGS',linkflag) def d_hook(self,node): task=self.create_task(self.generate_headers and'd_with_header'or'd') try:obj_ext=self.obj_ext except AttributeError:obj_ext='_%d.o'%self.idx task.inputs=[node] task.outputs=[node.change_ext(obj_ext)] self.compiled_tasks.append(task) if self.generate_headers: header_node=node.change_ext(self.env['DHEADER_ext']) task.outputs+=[header_node] d_str='${D_COMPILER} ${DFLAGS} ${_DIMPORTFLAGS} ${D_SRC_F}${SRC} ${D_TGT_F}${TGT}' d_with_header_str='${D_COMPILER} ${DFLAGS} ${_DIMPORTFLAGS} \ ${D_HDR_F}${TGT[1].bldpath(env)} \ ${D_SRC_F}${SRC} \ ${D_TGT_F}${TGT[0].bldpath(env)}' link_str='${D_LINKER} ${DLNK_SRC_F}${SRC} ${DLNK_TGT_F}${TGT} ${DLINKFLAGS}' def override_exec(cls): old_exec=cls.exec_command def exec_command(self,*k,**kw): if self.env['COMPILER_D']=='dmd'and isinstance(k[0],list): lst=k[0] for i in xrange(len(lst)): if lst[i]=='-of': del lst[i] lst[i]='-of'+lst[i] break return old_exec(self,*k,**kw) cls.exec_command=exec_command cls=Task.simple_task_type('d',d_str,'GREEN',before='ar_link_static d_link',shell=False) cls.scan=scan override_exec(cls) cls=Task.simple_task_type('d_with_header',d_with_header_str,'GREEN',before='ar_link_static d_link',shell=False) override_exec(cls) cls=Task.simple_task_type('d_link',link_str,color='YELLOW',shell=False) override_exec(cls) def generate_header(self,filename,install_path): if not hasattr(self,'header_lst'):self.header_lst=[] self.meths.append('process_header') self.header_lst.append([filename,install_path]) def process_header(self): env=self.env for i in getattr(self,'header_lst',[]): node=self.path.find_resource(i[0]) if not node: raise Utils.WafError('file not found on d obj '+i[0]) task=self.create_task('d_header') task.set_inputs(node) task.set_outputs(node.change_ext('.di')) d_header_str='${D_COMPILER} ${D_HEADER} ${SRC}' Task.simple_task_type('d_header',d_header_str,color='BLUE',shell=False) feature('d')(init_d) before('apply_type_vars')(init_d) feature('d')(init_d) before('apply_d_libs')(init_d) feature('d')(apply_d_libs) after('apply_d_link')(apply_d_libs) before('apply_vnum')(apply_d_libs) feature('dprogram','dshlib','dstaticlib')(apply_d_link) after('apply_core')(apply_d_link) feature('d')(apply_d_vars) after('apply_core')(apply_d_vars) feature('dshlib')(add_shlib_d_flags) after('apply_d_vars')(add_shlib_d_flags) extension(EXT_D)(d_hook) taskgen(generate_header) before('apply_core')(process_header) libdesktop-agnostic-0.3.92/wafadmin/Tools/dbus.py0000644000175000017510000000201511226437331021232 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import Task,Utils from TaskGen import taskgen,before,after,feature def add_dbus_file(self,filename,prefix,mode): if not hasattr(self,'dbus_lst'): self.dbus_lst=[] self.meths.append('process_dbus') self.dbus_lst.append([filename,prefix,mode]) def process_dbus(self): for filename,prefix,mode in getattr(self,'dbus_lst',[]): env=self.env.copy() node=self.path.find_resource(filename) if not node: raise Utils.WafError('file not found '+filename) env['DBUS_BINDING_TOOL_PREFIX']=prefix env['DBUS_BINDING_TOOL_MODE']=mode task=self.create_task('dbus_binding_tool',env) task.set_inputs(node) task.set_outputs(node.change_ext('.h')) Task.simple_task_type('dbus_binding_tool','${DBUS_BINDING_TOOL} --prefix=${DBUS_BINDING_TOOL_PREFIX} --mode=${DBUS_BINDING_TOOL_MODE} --output=${TGT} ${SRC}',color='BLUE',before='cc') def detect(conf): dbus_binding_tool=conf.find_program('dbus-binding-tool',var='DBUS_BINDING_TOOL') taskgen(add_dbus_file) before('apply_core')(process_dbus) libdesktop-agnostic-0.3.92/wafadmin/Tools/kde4.py0000644000175000017510000000414411226437331021131 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,re import Options,TaskGen,Task,Utils from TaskGen import taskgen,feature,after class msgfmt_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def init_msgfmt(self): self.default_install_path='${KDE4_LOCALE_INSTALL_DIR}' def apply_msgfmt(self): for lang in self.to_list(self.langs): node=self.path.find_resource(lang+'.po') task=self.create_task('msgfmt') task.set_inputs(node) task.set_outputs(node.change_ext('.mo')) if not self.bld.is_install:continue langname=lang.split('/') langname=langname[-1] task.install_path=self.install_path+os.sep+langname+os.sep+'LC_MESSAGES' task.filename=getattr(self,'appname','set_your_appname')+'.mo' task.chmod=self.chmod def detect(conf): kdeconfig=conf.find_program('kde4-config') if not kdeconfig: conf.fatal('we need kde4-config') prefix=Utils.cmd_output('%s --prefix'%kdeconfig,silent=True).strip() file='%s/share/apps/cmake/modules/KDELibsDependencies.cmake'%prefix try:os.stat(file) except OSError: file='%s/share/kde4/apps/cmake/modules/KDELibsDependencies.cmake'%prefix try:os.stat(file) except OSError:conf.fatal('could not open %s'%file) try: txt=Utils.readf(file) except(OSError,IOError): conf.fatal('could not read %s'%file) txt=txt.replace('\\\n','\n') fu=re.compile('#(.*)\n') txt=fu.sub('',txt) setregexp=re.compile('([sS][eE][tT]\s*\()\s*([^\s]+)\s+\"([^"]+)\"\)') found=setregexp.findall(txt) for(_,key,val)in found: conf.env[key]=val conf.env['LIB_KDECORE']='kdecore' conf.env['LIB_KDEUI']='kdeui' conf.env['LIB_KIO']='kio' conf.env['LIB_KHTML']='khtml' conf.env['LIB_KPARTS']='kparts' conf.env['LIBPATH_KDECORE']=conf.env['KDE4_LIB_INSTALL_DIR'] conf.env['CPPPATH_KDECORE']=conf.env['KDE4_INCLUDE_INSTALL_DIR'] conf.env.append_value('CPPPATH_KDECORE',conf.env['KDE4_INCLUDE_INSTALL_DIR']+"/KDE") conf.env['MSGFMT']=conf.find_program('msgfmt') Task.simple_task_type('msgfmt','${MSGFMT} ${SRC} -o ${TGT}',color='BLUE',shell=False) feature('msgfmt')(init_msgfmt) feature('msgfmt')(apply_msgfmt) after('init_msgfmt')(apply_msgfmt) libdesktop-agnostic-0.3.92/wafadmin/Tools/suncxx.py0000644000175000017510000000225711226437331021635 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,optparse import Utils,Options,Configure import ccroot,ar from Configure import conftest def find_sxx(conf): v=conf.env cc=None if v['CXX']:cc=v['CXX'] elif'CXX'in conf.environ:cc=conf.environ['CXX'] if not cc:cc=conf.find_program('c++',var='CXX') if not cc:cc=conf.find_program('CC',var='CXX') if not cc:conf.fatal('sunc++ was not found') v['CXX']=cc v['CXX_NAME']='sun' def sxx_common_flags(conf): v=conf.env v['CXX_SRC_F']='' v['CXX_TGT_F']=['-c','-o',''] v['CPPPATH_ST']='-I%s' if not v['LINK_CXX']:v['LINK_CXX']=v['CXX'] v['CXXLNK_SRC_F']='' v['CXXLNK_TGT_F']=['-o',''] v['LIB_ST']='-l%s' v['LIBPATH_ST']='-L%s' v['STATICLIB_ST']='-l%s' v['STATICLIBPATH_ST']='-L%s' v['CXXDEFINES_ST']='-D%s' v['SONAME_ST']='-Wl,-h -Wl,%s' v['SHLIB_MARKER']='-Bdynamic' v['STATICLIB_MARKER']='-Bstatic' v['program_PATTERN']='%s' v['shlib_CXXFLAGS']=['-Kpic','-DPIC'] v['shlib_LINKFLAGS']=['-G'] v['shlib_PATTERN']='lib%s.so' v['staticlib_LINKFLAGS']=['-Bstatic'] v['staticlib_PATTERN']='lib%s.a' detect=''' find_sxx find_cpp find_ar sxx_common_flags cxx_load_tools cxx_add_flags ''' conftest(find_sxx) conftest(sxx_common_flags) libdesktop-agnostic-0.3.92/wafadmin/Tools/bison.py0000644000175000017510000000104011226437331021404 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import TaskGen def decide_ext(self,node): c_ext='.tab.c' if node.name.endswith('.yc'):c_ext='.tab.cc' if'-d'in self.env['BISONFLAGS']: return[c_ext,c_ext.replace('c','h')] else: return c_ext TaskGen.declare_chain(name='bison',rule='cd ${SRC[0].bld_dir(env)} && ${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}',ext_in='.y .yc .yy',decider=decide_ext,before='cc cxx',) def detect(conf): bison=conf.find_program('bison',var='BISON',mandatory=True) v=conf.env v['BISONFLAGS']='-d' libdesktop-agnostic-0.3.92/wafadmin/Tools/ar.py0000644000175000017510000000165411226437331020707 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys import Task from Configure import conftest ar_str='${AR} ${ARFLAGS} ${TGT} ${SRC}' cls=Task.simple_task_type('ar_link_static',ar_str,color='YELLOW',ext_in='.o',shell=False) cls.maxjobs=1 old=cls.run def wrap(self): try:os.remove(self.outputs[0].abspath(self.env)) except OSError:pass return old(self) setattr(cls,'run',wrap) def detect(conf): comp=conf.environ.get('AR','') if not comp:comp=conf.env['AR'] if not comp:comp=conf.find_program('ar',var='AR') if not comp:return ranlib=conf.environ.get('RANLIB','') if not ranlib:ranlib=conf.env['RANLIB'] if not ranlib:ranlib=conf.find_program('ranlib',var='RANLIB') if not ranlib:return v=conf.env v['AR']=comp v['ARFLAGS']='rcs' v['RANLIB']=ranlib v['RANLIBFLAGS']='' def find_ar(conf): v=conf.env conf.check_tool('ar') if not v['AR']:conf.fatal('ar is required for static libraries - not found') conftest(find_ar) libdesktop-agnostic-0.3.92/wafadmin/Tools/cc.py0000644000175000017510000000557511226437331020700 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import os import TaskGen,Build,Utils,Task from Logs import debug import ccroot from TaskGen import feature,before,extension,after g_cc_flag_vars=['CCDEPS','FRAMEWORK','FRAMEWORKPATH','STATICLIB','LIB','LIBPATH','LINKFLAGS','RPATH','CCFLAGS','CPPPATH','CPPFLAGS','CCDEFINES'] EXT_CC=['.c'] g_cc_type_vars=['CCFLAGS','LINKFLAGS'] class cc_taskgen(ccroot.ccroot_abstract): pass def init_cc(self): self.p_flag_vars=set(self.p_flag_vars).union(g_cc_flag_vars) self.p_type_vars=set(self.p_type_vars).union(g_cc_type_vars) if not self.env['CC_NAME']: raise Utils.WafError("At least one compiler (gcc, ..) must be selected") def apply_obj_vars_cc(self): env=self.env app=env.append_unique cpppath_st=env['CPPPATH_ST'] for i in env['INC_PATHS']: app('_CCINCFLAGS',cpppath_st%i.bldpath(env)) app('_CCINCFLAGS',cpppath_st%i.srcpath(env)) for i in env['CPPPATH']: app('_CCINCFLAGS',cpppath_st%i) def apply_defines_cc(self): self.defines=getattr(self,'defines',[]) lst=self.to_list(self.defines)+self.to_list(self.env['CCDEFINES']) milst=[] for defi in lst: if not defi in milst: milst.append(defi) libs=self.to_list(self.uselib) for l in libs: val=self.env['CCDEFINES_'+l] if val:milst+=val self.env['DEFLINES']=["%s %s"%(x[0],Utils.trimquotes('='.join(x[1:])))for x in[y.split('=')for y in milst]] y=self.env['CCDEFINES_ST'] self.env['_CCDEFFLAGS']=[y%x for x in milst] def c_hook(self,node): task=self.create_task('cc') if getattr(self,'obj_ext',None): obj_ext=self.obj_ext else: obj_ext='_%d.o'%self.idx task.inputs=[node] task.outputs=[node.change_ext(obj_ext)] try: self.compiled_tasks.append(task) except AttributeError: raise Utils.WafError('Have you forgotten to set the feature "cc" on %s?'%str(self)) return task cc_str='${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' cls=Task.simple_task_type('cc',cc_str,'GREEN',ext_out='.o',ext_in='.c',shell=False) cls.scan=ccroot.scan cls.vars.append('CCDEPS') link_str='${LINK_CC} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT} ${LINKFLAGS}' cls=Task.simple_task_type('cc_link',link_str,color='YELLOW',ext_in='.o',shell=False) cls.maxjobs=1 cls2=Task.task_type_from_func('vnum_cc_link',ccroot.link_vnum,cls.vars,color='CYAN',ext_in='.o') cls2.maxjobs=1 link_str='${LINK_CC} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}' cls=Task.simple_task_type('dll_cc_link',link_str,color='YELLOW',ext_in='.o',shell=False) cls.maxjobs=1 old=cls.run def run(self):return old(self)or ccroot.post_dll_link(self) cls.run=run feature('cc')(init_cc) before('apply_type_vars')(init_cc) after('default_cc')(init_cc) feature('cc')(apply_obj_vars_cc) after('apply_incpaths')(apply_obj_vars_cc) feature('cc')(apply_defines_cc) after('apply_lib_vars')(apply_defines_cc) extension(EXT_CC)(c_hook) libdesktop-agnostic-0.3.92/wafadmin/Tools/cs.py0000644000175000017510000000267711226437331020720 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import TaskGen,Utils,Task from Logs import error from TaskGen import before,after,taskgen,feature flag_vars=['FLAGS','ASSEMBLIES'] def init_cs(self): Utils.def_attrs(self,flags='',assemblies='',resources='',uselib='') def apply_uselib_cs(self): if not self.uselib: return global flag_vars for var in self.to_list(self.uselib): for v in self.flag_vars: val=self.env[v+'_'+var] if val:self.env.append_value(v,val) def apply_cs(self): try:self.meths.remove('apply_core') except ValueError:pass assemblies_flags=[] for i in self.to_list(self.assemblies)+self.env['ASSEMBLIES']: assemblies_flags+='/r:'+i self.env['_ASSEMBLIES']+=assemblies_flags for i in self.to_list(self.resources): self.env['_RESOURCES'].append('/resource:'+i) self.env['_FLAGS']+=self.to_list(self.flags)+self.env['FLAGS'] curnode=self.path nodes=[] for i in self.to_list(self.source): nodes.append(curnode.find_resource(i)) task=self.create_task('mcs') task.inputs=nodes task.set_outputs(self.path.find_or_declare(self.target)) Task.simple_task_type('mcs','${MCS} ${SRC} /out:${TGT} ${_FLAGS} ${_ASSEMBLIES} ${_RESOURCES}',color='YELLOW') def detect(conf): mcs=conf.find_program('mcs',var='MCS') if not mcs:mcs=conf.find_program('gmcs',var='MCS') feature('cs')(init_cs) feature('cs')(apply_uselib_cs) after('init_cs')(apply_uselib_cs) feature('cs')(apply_cs) after('apply_uselib_cs')(apply_cs) before('apply_core')(apply_cs) libdesktop-agnostic-0.3.92/wafadmin/Tools/libtool.py0000644000175000017510000001744011226437331021751 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys,re,os,optparse import TaskGen,Task,Utils,preproc from Logs import error,debug,warn from TaskGen import taskgen,after,before,feature REVISION="0.1.3" fakelibtool_vardeps=['CXX','PREFIX'] def fakelibtool_build(task): env=task.env dest=open(task.outputs[0].abspath(env),'w') sname=task.inputs[0].name fu=dest.write fu("# Generated by ltmain.sh - GNU libtool 1.5.18 - (pwn3d by BKsys II code name WAF)\n") if env['vnum']: nums=env['vnum'].split('.') libname=task.inputs[0].name name3=libname+'.'+env['vnum'] name2=libname+'.'+nums[0] name1=libname fu("dlname='%s'\n"%name2) strn=" ".join([name3,name2,name1]) fu("library_names='%s'\n"%(strn)) else: fu("dlname='%s'\n"%sname) fu("library_names='%s %s %s'\n"%(sname,sname,sname)) fu("old_library=''\n") vars=' '.join(env['libtoolvars']+env['LINKFLAGS']) fu("dependency_libs='%s'\n"%vars) fu("current=0\n") fu("age=0\nrevision=0\ninstalled=yes\nshouldnotlink=no\n") fu("dlopen=''\ndlpreopen=''\n") fu("libdir='%s/lib'\n"%env['PREFIX']) dest.close() return 0 def read_la_file(path): sp=re.compile(r'^([^=]+)=\'(.*)\'$') dc={} file=open(path,"r") for line in file.readlines(): try: _,left,right,_=sp.split(line.strip()) dc[left]=right except ValueError: pass file.close() return dc def apply_link_libtool(self): if self.type!='program': linktask=self.link_task latask=self.create_task('fakelibtool') latask.set_inputs(linktask.outputs) latask.set_outputs(linktask.outputs[0].change_ext('.la')) self.latask=latask if self.bld.is_install: self.bld.install_files('${PREFIX}/lib',linktask.outputs[0].abspath(self.env),self.env) def apply_libtool(self): self.env['vnum']=self.vnum paths=[] libs=[] libtool_files=[] libtool_vars=[] for l in self.env['LINKFLAGS']: if l[:2]=='-L': paths.append(l[2:]) elif l[:2]=='-l': libs.append(l[2:]) for l in libs: for p in paths: dict=read_la_file(p+'/lib'+l+'.la') linkflags2=dict.get('dependency_libs','') for v in linkflags2.split(): if v.endswith('.la'): libtool_files.append(v) libtool_vars.append(v) continue self.env.append_unique('LINKFLAGS',v) break self.env['libtoolvars']=libtool_vars while libtool_files: file=libtool_files.pop() dict=read_la_file(file) for v in dict['dependency_libs'].split(): if v[-3:]=='.la': libtool_files.append(v) continue self.env.append_unique('LINKFLAGS',v) Task.task_type_from_func('fakelibtool',vars=fakelibtool_vardeps,func=fakelibtool_build,color='BLUE',after="cc_link cxx_link ar_link_static") class libtool_la_file: def __init__(self,la_filename): self.__la_filename=la_filename self.linkname=str(os.path.split(la_filename)[-1])[:-3] if self.linkname.startswith("lib"): self.linkname=self.linkname[3:] self.dlname=None self.library_names=None self.old_library=None self.dependency_libs=None self.current=None self.age=None self.revision=None self.installed=None self.shouldnotlink=None self.dlopen=None self.dlpreopen=None self.libdir='/usr/lib' if not self.__parse(): raise"file %s not found!!"%(la_filename) def __parse(self): if not os.path.isfile(self.__la_filename):return 0 la_file=open(self.__la_filename,'r') for line in la_file: ln=line.strip() if not ln:continue if ln[0]=='#':continue (key,value)=str(ln).split('=',1) key=key.strip() value=value.strip() if value=="no":value=False elif value=="yes":value=True else: try:value=int(value) except ValueError:value=value.strip("'") setattr(self,key,value) la_file.close() return 1 def get_libs(self): libs=[] if self.dependency_libs: libs=str(self.dependency_libs).strip().split() if libs==None: libs=[] libs.insert(0,"-l%s"%self.linkname.strip()) libs.insert(0,"-L%s"%self.libdir.strip()) return libs def __str__(self): return'''\ dlname = "%(dlname)s" library_names = "%(library_names)s" old_library = "%(old_library)s" dependency_libs = "%(dependency_libs)s" version = %(current)s.%(age)s.%(revision)s installed = "%(installed)s" shouldnotlink = "%(shouldnotlink)s" dlopen = "%(dlopen)s" dlpreopen = "%(dlpreopen)s" libdir = "%(libdir)s"'''%self.__dict__ class libtool_config: def __init__(self,la_filename): self.__libtool_la_file=libtool_la_file(la_filename) tmp=self.__libtool_la_file self.__version=[int(tmp.current),int(tmp.age),int(tmp.revision)] self.__sub_la_files=[] self.__sub_la_files.append(la_filename) self.__libs=None def __cmp__(self,other): if not other: return 1 othervers=[int(s)for s in str(other).split(".")] selfvers=self.__version return cmp(selfvers,othervers) def __str__(self): return"\n".join([str(self.__libtool_la_file),' '.join(self.__libtool_la_file.get_libs()),'* New getlibs:',' '.join(self.get_libs())]) def __get_la_libs(self,la_filename): return libtool_la_file(la_filename).get_libs() def get_libs(self): libs_list=list(self.__libtool_la_file.get_libs()) libs_map={} while len(libs_list)>0: entry=libs_list.pop(0) if entry: if str(entry).endswith(".la"): if entry not in self.__sub_la_files: self.__sub_la_files.append(entry) libs_list.extend(self.__get_la_libs(entry)) else: libs_map[entry]=1 self.__libs=libs_map.keys() return self.__libs def get_libs_only_L(self): if not self.__libs:self.get_libs() libs=self.__libs libs=[s for s in libs if str(s).startswith('-L')] return libs def get_libs_only_l(self): if not self.__libs:self.get_libs() libs=self.__libs libs=[s for s in libs if str(s).startswith('-l')] return libs def get_libs_only_other(self): if not self.__libs:self.get_libs() libs=self.__libs libs=[s for s in libs if not(str(s).startswith('-L')or str(s).startswith('-l'))] return libs def useCmdLine(): usage='''Usage: %prog [options] PathToFile.la example: %prog --atleast-version=2.0.0 /usr/lib/libIlmImf.la nor: %prog --libs /usr/lib/libamarok.la''' parser=optparse.OptionParser(usage) a=parser.add_option a("--version",dest="versionNumber",action="store_true",default=False,help="output version of libtool-config") a("--debug",dest="debug",action="store_true",default=False,help="enable debug") a("--libs",dest="libs",action="store_true",default=False,help="output all linker flags") a("--libs-only-l",dest="libs_only_l",action="store_true",default=False,help="output -l flags") a("--libs-only-L",dest="libs_only_L",action="store_true",default=False,help="output -L flags") a("--libs-only-other",dest="libs_only_other",action="store_true",default=False,help="output other libs (e.g. -pthread)") a("--atleast-version",dest="atleast_version",default=None,help="return 0 if the module is at least version ATLEAST_VERSION") a("--exact-version",dest="exact_version",default=None,help="return 0 if the module is exactly version EXACT_VERSION") a("--max-version",dest="max_version",default=None,help="return 0 if the module is at no newer than version MAX_VERSION") (options,args)=parser.parse_args() if len(args)!=1 and not options.versionNumber: parser.error("incorrect number of arguments") if options.versionNumber: print("libtool-config version %s"%REVISION) return 0 ltf=libtool_config(args[0]) if options.debug: print(ltf) if options.atleast_version: if ltf>=options.atleast_version:return 0 sys.exit(1) if options.exact_version: if ltf==options.exact_version:return 0 sys.exit(1) if options.max_version: if ltf<=options.max_version:return 0 sys.exit(1) def p(x): print(" ".join(x)) if options.libs:p(ltf.get_libs()) elif options.libs_only_l:p(ltf.get_libs_only_l()) elif options.libs_only_L:p(ltf.get_libs_only_L()) elif options.libs_only_other:p(ltf.get_libs_only_other()) return 0 if __name__=='__main__': useCmdLine() feature("libtool")(apply_link_libtool) after('apply_link')(apply_link_libtool) feature("libtool")(apply_libtool) before('apply_core')(apply_libtool) libdesktop-agnostic-0.3.92/wafadmin/Tools/winres.py0000644000175000017510000000207711226437331021614 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,re import TaskGen,Task from Utils import quote_whitespace from TaskGen import extension EXT_WINRC=['.rc'] winrc_str='${WINRC} ${_CPPDEFFLAGS} ${_CCDEFFLAGS} ${WINRCFLAGS} ${_CPPINCFLAGS} ${_CCINCFLAGS} ${WINRC_TGT_F} ${TGT} ${WINRC_SRC_F} ${SRC}' def rc_file(self,node): obj_ext='.rc.o' if self.env['WINRC_TGT_F']=='/fo':obj_ext='.res' rctask=self.create_task('winrc') rctask.set_inputs(node) rctask.set_outputs(node.change_ext(obj_ext)) self.compiled_tasks.append(rctask) Task.simple_task_type('winrc',winrc_str,color='BLUE',before='cc cxx',shell=False) def detect(conf): v=conf.env winrc=v['WINRC'] v['WINRC_TGT_F']='-o' v['WINRC_SRC_F']='-i' if not winrc: if v['CC_NAME']in['gcc','cc','g++','c++']: winrc=conf.find_program('windres',var='WINRC',path_list=v['PATH']) elif v['CC_NAME']=='msvc': winrc=conf.find_program('RC',var='WINRC',path_list=v['PATH']) v['WINRC_TGT_F']='/fo' v['WINRC_SRC_F']='' if not winrc: conf.fatal('winrc was not found!') v['WINRCFLAGS']='' extension(EXT_WINRC)(rc_file) libdesktop-agnostic-0.3.92/wafadmin/Tools/compiler_cc.py0000644000175000017510000000275611226437331022570 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,imp,types,ccroot import optparse import Utils,Configure,Options from Logs import debug c_compiler={'win32':['msvc','gcc'],'cygwin':['gcc'],'darwin':['gcc'],'aix5':['gcc'],'linux':['gcc','icc','suncc'],'sunos':['gcc','suncc'],'irix':['gcc'],'hpux':['gcc'],'default':['gcc']} def __list_possible_compiler(platform): try: return c_compiler[platform] except KeyError: return c_compiler["default"] def detect(conf): try:test_for_compiler=Options.options.check_c_compiler except AttributeError:conf.fatal("Add set_options(opt): opt.tool_options('compiler_cc')") for compiler in test_for_compiler.split(): try: conf.check_tool(compiler) except Configure.ConfigurationError,e: debug('compiler_cc: %r'%e) else: if conf.env['CC']: conf.check_message(compiler,'',True) conf.env['COMPILER_CC']=compiler break conf.check_message(compiler,'',False) def set_options(opt): detected_platform=Options.platform possible_compiler_list=__list_possible_compiler(detected_platform) test_for_compiler=str(" ").join(possible_compiler_list) cc_compiler_opts=opt.add_option_group("C Compiler Options") cc_compiler_opts.add_option('--check-c-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C-Compiler will be checked by default: "%s"'%(detected_platform,test_for_compiler),dest="check_c_compiler") for c_compiler in test_for_compiler.split(): opt.tool_options('%s'%c_compiler,option_group=cc_compiler_opts) libdesktop-agnostic-0.3.92/wafadmin/Tools/glib2.py0000644000175000017510000000774311226437331021311 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import Task,Utils from TaskGen import taskgen,before,after,feature def add_marshal_file(self,filename,prefix): if not hasattr(self,'marshal_list'): self.marshal_list=[] self.meths.append('process_marshal') self.marshal_list.append((filename,prefix)) def process_marshal(self): for f,prefix in getattr(self,'marshal_list',[]): node=self.path.find_resource(f) if not node: raise Utils.WafError('file not found %r'%f) h_node=node.change_ext('.h') c_node=node.change_ext('.c') task=self.create_task('glib_genmarshal') task.set_inputs(node) task.set_outputs([h_node,c_node]) task.env['GLIB_GENMARSHAL_PREFIX']=prefix self.allnodes.append(c_node) def genmarshal_func(self): bld=self.inputs[0].__class__.bld get=self.env.get_flat cmd1="%s %s --prefix=%s --header > %s"%(get('GLIB_GENMARSHAL'),self.inputs[0].srcpath(self.env),get('GLIB_GENMARSHAL_PREFIX'),self.outputs[0].abspath(self.env)) ret=bld.exec_command(cmd1) if ret:return ret f=open(self.outputs[1].abspath(self.env),'wb') f.write('''#include "%s"\n'''%self.outputs[0].name) f.close() cmd2="%s %s --prefix=%s --body >> %s"%(get('GLIB_GENMARSHAL'),self.inputs[0].srcpath(self.env),get('GLIB_GENMARSHAL_PREFIX'),self.outputs[1].abspath(self.env)) ret=Utils.exec_command(cmd2) if ret:return ret def add_enums_from_template(self,source='',target='',template='',comments=''): if not hasattr(self,'enums_list'): self.enums_list=[] self.meths.append('process_enums') self.enums_list.append({'source':source,'target':target,'template':template,'file-head':'','file-prod':'','file-tail':'','enum-prod':'','value-head':'','value-prod':'','value-tail':'','comments':comments}) def add_enums(self,source='',target='',file_head='',file_prod='',file_tail='',enum_prod='',value_head='',value_prod='',value_tail='',comments=''): if not hasattr(self,'enums_list'): self.enums_list=[] self.meths.append('process_enums') self.enums_list.append({'source':source,'template':'','target':target,'file-head':file_head,'file-prod':file_prod,'file-tail':file_tail,'enum-prod':enum_prod,'value-head':value_head,'value-prod':value_prod,'value-tail':value_tail,'comments':comments}) def process_enums(self): for enum in getattr(self,'enums_list',[]): env=self.env.copy() task=self.create_task('glib_mkenums',env) inputs=[] source_list=self.to_list(enum['source']) if not source_list: raise Utils.WafError('missing source '+str(enum)) source_list=[self.path.find_resource(k)for k in source_list] inputs+=source_list env['GLIB_MKENUMS_SOURCE']=[k.srcpath(env)for k in source_list] if not enum['target']: raise Utils.WafError('missing target '+str(enum)) tgt_node=self.path.find_or_declare(enum['target']) if tgt_node.name.endswith('.c'): self.allnodes.append(tgt_node) env['GLIB_MKENUMS_TARGET']=tgt_node.abspath(env) options=[] if enum['template']: template_node=self.path.find_resource(enum['template']) options.append('--template %s'%(template_node.abspath(env))) inputs.append(template_node) params={'file-head':'--fhead','file-prod':'--fprod','file-tail':'--ftail','enum-prod':'--eprod','value-head':'--vhead','value-prod':'--vprod','value-tail':'--vtail','comments':'--comments'} for param,option in params.iteritems(): if enum[param]: options.append('%s %r'%(option,enum[param])) env['GLIB_MKENUMS_OPTIONS']=' '.join(options) task.set_inputs(inputs) task.set_outputs(tgt_node) Task.task_type_from_func('glib_genmarshal',func=genmarshal_func,vars=['GLIB_GENMARSHAL_PREFIX','GLIB_GENMARSHAL'],color='BLUE',before='cc') Task.simple_task_type('glib_mkenums','${GLIB_MKENUMS} ${GLIB_MKENUMS_OPTIONS} ${GLIB_MKENUMS_SOURCE} > ${GLIB_MKENUMS_TARGET}',color='PINK',before='cc') def detect(conf): glib_genmarshal=conf.find_program('glib-genmarshal',var='GLIB_GENMARSHAL') mk_enums_tool=conf.find_program('glib-mkenums',var='GLIB_MKENUMS') taskgen(add_marshal_file) before('apply_core')(process_marshal) taskgen(add_enums_from_template) taskgen(add_enums) before('apply_core')(process_enums) libdesktop-agnostic-0.3.92/wafadmin/Tools/misc.py0000644000175000017510000002400011226437332021227 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import shutil,re,os import TaskGen,Node,Task,Utils,Build,Constants from TaskGen import feature,taskgen,after,before from Logs import debug def copy_func(tsk): env=tsk.env infile=tsk.inputs[0].abspath(env) outfile=tsk.outputs[0].abspath(env) try: shutil.copy2(infile,outfile) except(OSError,IOError): return 1 else: if tsk.chmod:os.chmod(outfile,tsk.chmod) return 0 def action_process_file_func(tsk): if not tsk.fun:raise Utils.WafError('task must have a function attached to it for copy_func to work!') return tsk.fun(tsk) class cmd_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def apply_cmd(self): if not self.fun:raise Utils.WafError('cmdobj needs a function!') tsk=Task.TaskBase() tsk.fun=self.fun tsk.env=self.env self.tasks.append(tsk) tsk.install_path=self.install_path class copy_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def apply_copy(self): Utils.def_attrs(self,fun=copy_func) self.default_install_path=0 lst=self.to_list(self.source) self.meths.remove('apply_core') for filename in lst: node=self.path.find_resource(filename) if not node:raise Utils.WafError('cannot find input file %s for processing'%filename) target=self.target if not target or len(lst)>1:target=node.name newnode=self.path.find_or_declare(target) tsk=self.create_task('copy') tsk.set_inputs(node) tsk.set_outputs(newnode) tsk.fun=self.fun tsk.chmod=self.chmod if not tsk.env: tsk.debug() raise Utils.WafError('task without an environment') def subst_func(tsk): m4_re=re.compile('@(\w+)@',re.M) env=tsk.env infile=tsk.inputs[0].abspath(env) outfile=tsk.outputs[0].abspath(env) code=Utils.readf(infile) code=code.replace('%','%%') s=m4_re.sub(r'%(\1)s',code) di=tsk.dict or{} if not di: names=m4_re.findall(code) for i in names: di[i]=env.get_flat(i)or env.get_flat(i.upper()) file=open(outfile,'w') file.write(s%di) file.close() if tsk.chmod:os.chmod(outfile,tsk.chmod) class subst_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def apply_subst(self): Utils.def_attrs(self,fun=subst_func) self.default_install_path=0 lst=self.to_list(self.source) self.meths.remove('apply_core') self.dict=getattr(self,'dict',{}) for filename in lst: node=self.path.find_resource(filename) if not node:raise Utils.WafError('cannot find input file %s for processing'%filename) if self.target: newnode=self.path.find_or_declare(self.target) else: newnode=node.change_ext('') try: self.dict=self.dict.get_merged_dict() except AttributeError: pass if self.dict and not self.env['DICT_HASH']: self.env=self.env.copy() keys=list(self.dict.keys()) keys.sort() lst=[self.dict[x]for x in keys] self.env['DICT_HASH']=str(Utils.h_list(lst)) tsk=self.create_task('copy') tsk.set_inputs(node) tsk.set_outputs(newnode) tsk.fun=self.fun tsk.dict=self.dict tsk.dep_vars=['DICT_HASH'] tsk.install_path=self.install_path tsk.chmod=self.chmod if not tsk.env: tsk.debug() raise Utils.WafError('task without an environment') class cmd_arg(object): def __init__(self,name,template='%s'): self.name=name self.template=template self.node=None class input_file(cmd_arg): def find_node(self,base_path): assert isinstance(base_path,Node.Node) self.node=base_path.find_resource(self.name) if self.node is None: raise Utils.WafError("Input file %s not found in "%(self.name,base_path)) def get_path(self,env,absolute): if absolute: return self.template%self.node.abspath(env) else: return self.template%self.node.srcpath(env) class output_file(cmd_arg): def find_node(self,base_path): assert isinstance(base_path,Node.Node) self.node=base_path.find_or_declare(self.name) if self.node is None: raise Utils.WafError("Output file %s not found in "%(self.name,base_path)) def get_path(self,env,absolute): if absolute: return self.template%self.node.abspath(env) else: return self.template%self.node.bldpath(env) class cmd_dir_arg(cmd_arg): def __init__(self,name,template=None): cmd_arg.__init__(self) self.name=name self.node=None if template is None: self.template='%s' else: self.template=template def find_node(self,base_path): assert isinstance(base_path,Node.Node) self.node=base_path.find_dir(self.name) if self.node is None: raise Utils.WafError("Directory %s not found in "%(self.name,base_path)) class input_dir(cmd_dir_arg): def get_path(self,dummy_env,dummy_absolute): return self.template%self.node.abspath() class output_dir(cmd_dir_arg): def get_path(self,env,dummy_absolute): return self.template%self.node.abspath(env) class command_output(Task.Task): color="BLUE" def __init__(self,env,command,command_node,command_args,stdin,stdout,cwd,os_env,stderr): Task.Task.__init__(self,env,normal=1) assert isinstance(command,(str,Node.Node)) self.command=command self.command_args=command_args self.stdin=stdin self.stdout=stdout self.cwd=cwd self.os_env=os_env self.stderr=stderr if command_node is not None:self.dep_nodes=[command_node] self.dep_vars=[] def run(self): task=self def input_path(node,template): if task.cwd is None: return template%node.bldpath(task.env) else: return template%node.abspath() def output_path(node,template): fun=node.abspath if task.cwd is None:fun=node.bldpath return template%fun(task.env) if isinstance(task.command,Node.Node): argv=[input_path(task.command,'%s')] else: argv=[task.command] for arg in task.command_args: if isinstance(arg,str): argv.append(arg) else: assert isinstance(arg,cmd_arg) argv.append(arg.get_path(task.env,(task.cwd is not None))) if task.stdin: stdin=open(input_path(task.stdin,'%s')) else: stdin=None if task.stdout: stdout=open(output_path(task.stdout,'%s'),"w") else: stdout=None if task.stderr: stderr=open(output_path(task.stderr,'%s'),"w") else: stderr=None if task.cwd is None: cwd=('None (actually %r)'%os.getcwd()) else: cwd=repr(task.cwd) debug("command-output: cwd=%s, stdin=%r, stdout=%r, argv=%r"%(cwd,stdin,stdout,argv)) if task.os_env is None: os_env=os.environ else: os_env=task.os_env command=Utils.pproc.Popen(argv,stdin=stdin,stdout=stdout,stderr=stderr,cwd=task.cwd,env=os_env) return command.wait() class cmd_output_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def init_cmd_output(self): Utils.def_attrs(self,stdin=None,stdout=None,stderr=None,command=None,command_is_external=False,argv=[],dependencies=[],dep_vars=[],hidden_inputs=[],hidden_outputs=[],cwd=None,os_env=None) def apply_cmd_output(self): if self.command is None: raise Utils.WafError("command-output missing command") if self.command_is_external: cmd=self.command cmd_node=None else: cmd_node=self.path.find_resource(self.command) assert cmd_node is not None,('''Could not find command '%s' in source tree. Hint: if this is an external command, use command_is_external=True''')%(self.command,) cmd=cmd_node if self.cwd is None: cwd=None else: assert isinstance(cwd,CmdDirArg) self.cwd.find_node(self.path) args=[] inputs=[] outputs=[] for arg in self.argv: if isinstance(arg,cmd_arg): arg.find_node(self.path) if isinstance(arg,input_file): inputs.append(arg.node) if isinstance(arg,output_file): outputs.append(arg.node) if self.stdout is None: stdout=None else: assert isinstance(self.stdout,str) stdout=self.path.find_or_declare(self.stdout) if stdout is None: raise Utils.WafError("File %s not found"%(self.stdout,)) outputs.append(stdout) if self.stderr is None: stderr=None else: assert isinstance(self.stderr,str) stderr=self.path.find_or_declare(self.stderr) if stderr is None: raise Utils.WafError("File %s not found"%(self.stderr,)) outputs.append(stderr) if self.stdin is None: stdin=None else: assert isinstance(self.stdin,str) stdin=self.path.find_resource(self.stdin) if stdin is None: raise Utils.WafError("File %s not found"%(self.stdin,)) inputs.append(stdin) for hidden_input in self.to_list(self.hidden_inputs): node=self.path.find_resource(hidden_input) if node is None: raise Utils.WafError("File %s not found in dir %s"%(hidden_input,self.path)) inputs.append(node) for hidden_output in self.to_list(self.hidden_outputs): node=self.path.find_or_declare(hidden_output) if node is None: raise Utils.WafError("File %s not found in dir %s"%(hidden_output,self.path)) outputs.append(node) if not(inputs or getattr(self,'no_inputs',None)): raise Utils.WafError('command-output objects must have at least one input file or give self.no_inputs') if not(outputs or getattr(self,'no_outputs',None)): raise Utils.WafError('command-output objects must have at least one output file or give self.no_outputs') task=command_output(self.env,cmd,cmd_node,self.argv,stdin,stdout,cwd,self.os_env,stderr) Utils.copy_attrs(self,task,'before after ext_in ext_out',only_if_set=True) self.tasks.append(task) task.inputs=inputs task.outputs=outputs task.dep_vars=self.to_list(self.dep_vars) for dep in self.dependencies: assert dep is not self dep.post() for dep_task in dep.tasks: task.set_run_after(dep_task) if not task.inputs: task.runnable_status=type(Task.TaskBase.run)(runnable_status,task,task.__class__) task.post_run=type(Task.TaskBase.run)(post_run,task,task.__class__) def post_run(self): for x in self.outputs: h=Utils.h_file(x.abspath(self.env)) self.generator.bld.node_sigs[self.env.variant()][x.id]=h def runnable_status(self): return Constants.RUN_ME Task.task_type_from_func('copy',vars=[],func=action_process_file_func) TaskGen.task_gen.classes['command-output']=cmd_output_taskgen feature('cmd')(apply_cmd) feature('copy')(apply_copy) before('apply_core')(apply_copy) feature('subst')(apply_subst) before('apply_core')(apply_subst) feature('command-output')(init_cmd_output) feature('command-output')(apply_cmd_output) after('init_cmd_output')(apply_cmd_output) libdesktop-agnostic-0.3.92/wafadmin/Tools/flex.py0000644000175000017510000000057011226437331021237 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import TaskGen def decide_ext(self,node): if'cxx'in self.features:return'.lex.cc' else:return'.lex.c' TaskGen.declare_chain(name='flex',rule='${FLEX} -o${TGT} ${FLEXFLAGS} ${SRC}',ext_in='.l',decider=decide_ext,before='cc cxx',) def detect(conf): conf.find_program('flex',var='FLEX',mandatory=True) v=conf.env v['FLEXFLAGS']='' libdesktop-agnostic-0.3.92/wafadmin/Tools/gnu_dirs.py0000644000175000017510000000506011226437331022112 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import Utils,Options _options=[x.split(', ')for x in''' bindir, user executables, ${EXEC_PREFIX}/bin sbindir, system admin executables, ${EXEC_PREFIX}/sbin libexecdir, program executables, ${EXEC_PREFIX}/libexec sysconfdir, read-only single-machine data, ${PREFIX}/etc sharedstatedir, modifiable architecture-independent data, ${PREFIX}/com localstatedir, modifiable single-machine data, ${PREFIX}/var libdir, object code libraries, ${EXEC_PREFIX}/lib includedir, C header files, ${PREFIX}/include oldincludedir, C header files for non-gcc, /usr/include datarootdir, read-only arch.-independent data root, ${PREFIX}/share datadir, read-only architecture-independent data, ${DATAROOTDIR} infodir, info documentation, ${DATAROOTDIR}/info localedir, locale-dependent data, ${DATAROOTDIR}/locale mandir, man documentation, ${DATAROOTDIR}/man docdir, documentation root, ${DATAROOTDIR}/doc/${PACKAGE} htmldir, html documentation, ${DOCDIR} dvidir, dvi documentation, ${DOCDIR} pdfdir, pdf documentation, ${DOCDIR} psdir, ps documentation, ${DOCDIR} '''.split('\n')if x] def detect(conf): def get_param(varname,default): return getattr(Options.options,varname,'')or default env=conf.env env['EXEC_PREFIX']=get_param('EXEC_PREFIX',env['PREFIX']) env['PACKAGE']=Utils.g_module.APPNAME or env['PACKAGE'] complete=False iter=0 while not complete and iter not found') conf.fatal('msvc: Impossible to find a valid architecture for building (in get_msvc_version)') for line in lines[1:]: if line.startswith('PATH='): path=line[5:] MSVC_PATH=path.split(';') elif line.startswith('INCLUDE='): MSVC_INCDIR=[i for i in line[8:].split(';')if i] elif line.startswith('LIB='): MSVC_LIBDIR=[i for i in line[4:].split(';')if i] env={} env.update(os.environ) env.update(PATH=path) compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) cxx=conf.find_program(compiler_name,path_list=MSVC_PATH) import pproc try: p=pproc.Popen([cxx],env=env,stdout=pproc.PIPE,stderr=pproc.PIPE) out,err=p.communicate() if p.returncode!=0: raise Exception('return code: '+str(p.returncode)+': '+err) except Exception,e: print('msvc: get_msvc_version: '+compiler+' '+version+' '+target+' -> failed: '+str(e)) conf.fatal('msvc: Compiler is not runnable (in get_msvc_version)') else: debug('msvc: get_msvc_version: '+compiler+' '+version+' '+target+' -> OK') return(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR) def gather_wsdk_versions(conf,versions): version_pattern=re.compile('^v..?.?\...?.?') try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows') except WindowsError: try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows') except WindowsError: return index=0 while 1: try: version=_winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue try: msvc_version=_winreg.OpenKey(all_versions,version) path,type=_winreg.QueryValueEx(msvc_version,'InstallationFolder') except WindowsError: continue if os.path.isfile(os.path.join(path,'bin','SetEnv.cmd')): targets=[] for target,arch in all_msvc_platforms: try: targets.append((target,(arch,conf.get_msvc_version('wsdk',version,'/'+target,os.path.join(path,'bin','SetEnv.cmd'))))) except Configure.ConfigurationError: pass versions.append(('wsdk '+version[1:],targets)) def gather_msvc_versions(conf,versions): try: ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: try: ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: ce_sdk='' if ce_sdk: supported_wince_platforms=[] ce_index=0 while 1: try: sdk_device=_winreg.EnumKey(ce_sdk,ce_index) except WindowsError: break ce_index=ce_index+1 sdk=_winreg.OpenKey(ce_sdk,sdk_device) path,type=_winreg.QueryValueEx(sdk,'SDKRootDir') path=str(path) path,device=os.path.split(path) if not device: path,device=os.path.split(path) for arch,compiler in all_wince_platforms: platforms=[] if os.path.isdir(os.path.join(path,device,'Lib',arch)): platforms.append((arch,compiler,os.path.join(path,device,'Include'),os.path.join(path,device,'Lib',arch))) if platforms: supported_wince_platforms.append((device,platforms)) version_pattern=re.compile('^..?\...?') for vcver,vcvar in[('VCExpress','exp'),('VisualStudio','')]: try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\'+vcver) except WindowsError: try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\'+vcver) except WindowsError: continue index=0 while 1: try: version=_winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue try: msvc_version=_winreg.OpenKey(all_versions,version+"\\Setup\\VS") path,type=_winreg.QueryValueEx(msvc_version,'ProductDir') path=str(path) targets=[] if os.path.isfile(os.path.join(path,'VC','vcvarsall.bat')): for target,realtarget in all_msvc_platforms[::-1]: try: targets.append((target,(realtarget,conf.get_msvc_version('msvc',version,target,os.path.join(path,'VC','vcvarsall.bat'))))) except: pass elif os.path.isfile(os.path.join(path,'Common7','Tools','vsvars32.bat')): try: targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'x86',os.path.join(path,'Common7','Tools','vsvars32.bat'))))) except Configure.ConfigurationError: pass versions.append(('msvc '+version,targets)) if ce_sdk: for device,platforms in supported_wince_platforms: cetargets=[] for platform,compiler,include,lib in platforms: winCEpath=os.path.join(path,'VC','ce') if os.path.isdir(winCEpath): common_bindirs,_1,_2=conf.get_msvc_version('msvc',version,'x86',os.path.join(path,'Common7','Tools','vsvars32.bat')) if os.path.isdir(os.path.join(winCEpath,'lib',platform)): bindirs=[os.path.join(winCEpath,'bin',compiler),os.path.join(winCEpath,'bin','x86_'+compiler)]+common_bindirs incdirs=[include,os.path.join(winCEpath,'include'),os.path.join(winCEpath,'atlmfc','include')] libdirs=[lib,os.path.join(winCEpath,'lib',platform),os.path.join(winCEpath,'atlmfc','lib',platform)] cetargets.append((platform,(platform,(bindirs,incdirs,libdirs)))) versions.append((device+' '+version,cetargets)) except WindowsError: continue def gather_icl_versions(conf,versions): version_pattern=re.compile('^...?.?\....?.?') try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++') except WindowsError: try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Intel\\Compilers\\C++') except WindowsError: return index=0 while 1: try: version=_winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue targets=[] for target,arch in all_icl_platforms: try: icl_version=_winreg.OpenKey(all_versions,version+'\\'+target) path,type=_winreg.QueryValueEx(icl_version,'ProductDir') if os.path.isfile(os.path.join(path,'bin','iclvars.bat')): try: targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat'))))) except Configure.ConfigurationError: pass except WindowsError: continue major=version[0:2] versions.append(('intel '+major,targets)) def get_msvc_versions(conf): if not conf.env['MSVC_INSTALLED_VERSIONS']: conf.env['MSVC_INSTALLED_VERSIONS']=[] conf.gather_msvc_versions(conf.env['MSVC_INSTALLED_VERSIONS']) conf.gather_wsdk_versions(conf.env['MSVC_INSTALLED_VERSIONS']) conf.gather_icl_versions(conf.env['MSVC_INSTALLED_VERSIONS']) return conf.env['MSVC_INSTALLED_VERSIONS'] def print_all_msvc_detected(conf): for version,targets in conf.env['MSVC_INSTALLED_VERSIONS']: info(version) for target,l in targets: info("\t"+target) def detect_msvc(conf): versions=get_msvc_versions(conf) return setup_msvc(conf,versions) def msvc_linker(task): static=task.__class__.name.find('static')>0 e=env=task.env subsystem=getattr(task.generator,'subsystem','') if subsystem: subsystem='/subsystem:%s'%subsystem outfile=task.outputs[0].bldpath(e) manifest=outfile+'.manifest' def to_list(xx): if isinstance(xx,str):return[xx] return xx lst=[] if static: lst.extend(to_list(env['STLIBLINK'])) else: lst.extend(to_list(env['LINK'])) lst.extend(to_list(subsystem)) if static: lst.extend(to_list(env['STLINKFLAGS'])) else: lst.extend(to_list(env['LINKFLAGS'])) lst.extend([a.srcpath(env)for a in task.inputs]) lst.extend(to_list('/OUT:%s'%outfile)) lst=[x for x in lst if x] lst=[lst] ret=task.exec_command(*lst) if ret:return ret pdbnode=task.outputs[0].change_ext('.pdb') pdbfile=pdbnode.bldpath(e) if os.path.exists(pdbfile): task.outputs.append(pdbnode) if not static and os.path.exists(manifest): debug('msvc: manifesttool') mtool=e['MT'] if not mtool: return 0 mode='' if'cprogram'in task.generator.features: mode='1' elif'cshlib'in task.generator.features: mode='2' debug('msvc: embedding manifest') lst=[] lst.extend(to_list(e['MT'])) lst.extend(to_list(e['MTFLAGS'])) lst.extend(to_list("-manifest")) lst.extend(to_list(manifest)) lst.extend(to_list("-outputresource:%s;%s"%(outfile,mode))) lst=[lst] ret=task.exec_command(*lst) return ret g_msvc_systemlibs=""" aclui activeds ad1 adptif adsiid advapi32 asycfilt authz bhsupp bits bufferoverflowu cabinet cap certadm certidl ciuuid clusapi comctl32 comdlg32 comsupp comsuppd comsuppw comsuppwd comsvcs credui crypt32 cryptnet cryptui d3d8thk daouuid dbgeng dbghelp dciman32 ddao35 ddao35d ddao35u ddao35ud delayimp dhcpcsvc dhcpsapi dlcapi dnsapi dsprop dsuiext dtchelp faultrep fcachdll fci fdi framedyd framedyn gdi32 gdiplus glauxglu32 gpedit gpmuuid gtrts32w gtrtst32hlink htmlhelp httpapi icm32 icmui imagehlp imm32 iphlpapi iprop kernel32 ksguid ksproxy ksuser libcmt libcmtd libcpmt libcpmtd loadperf lz32 mapi mapi32 mgmtapi minidump mmc mobsync mpr mprapi mqoa mqrt msacm32 mscms mscoree msdasc msimg32 msrating mstask msvcmrt msvcurt msvcurtd mswsock msxml2 mtx mtxdm netapi32 nmapinmsupp npptools ntdsapi ntdsbcli ntmsapi ntquery odbc32 odbcbcp odbccp32 oldnames ole32 oleacc oleaut32 oledb oledlgolepro32 opends60 opengl32 osptk parser pdh penter pgobootrun pgort powrprof psapi ptrustm ptrustmd ptrustu ptrustud qosname rasapi32 rasdlg rassapi resutils riched20 rpcndr rpcns4 rpcrt4 rtm rtutils runtmchk scarddlg scrnsave scrnsavw secur32 sensapi setupapi sfc shell32 shfolder shlwapi sisbkup snmpapi sporder srclient sti strsafe svcguid tapi32 thunk32 traffic unicows url urlmon user32 userenv usp10 uuid uxtheme vcomp vcompd vdmdbg version vfw32 wbemuuid webpost wiaguid wininet winmm winscard winspool winstrm wintrust wldap32 wmiutils wow32 ws2_32 wsnmp32 wsock32 wst wtsapi32 xaswitch xolehlp """.split() def find_lt_names_msvc(self,libname,is_static=False): lt_names=['lib%s.la'%libname,'%s.la'%libname,] for path in self.env['LIBPATH']: for la in lt_names: laf=os.path.join(path,la) dll=None if os.path.exists(laf): ltdict=read_la_file(laf) lt_libdir=None if ltdict.get('libdir',''): lt_libdir=ltdict['libdir'] if not is_static and ltdict.get('library_names',''): dllnames=ltdict['library_names'].split() dll=dllnames[0].lower() dll=re.sub('\.dll$','',dll) return(lt_libdir,dll,False) elif ltdict.get('old_library',''): olib=ltdict['old_library'] if os.path.exists(os.path.join(path,olib)): return(path,olib,True) elif lt_libdir!=''and os.path.exists(os.path.join(lt_libdir,olib)): return(lt_libdir,olib,True) else: return(None,olib,True) else: raise Utils.WafError('invalid libtool object file: %s'%laf) return(None,None,None) def libname_msvc(self,libname,is_static=False,mandatory=False): lib=libname.lower() lib=re.sub('\.lib$','',lib) if lib in g_msvc_systemlibs: return lib lib=re.sub('^lib','',lib) if lib=='m': return None (lt_path,lt_libname,lt_static)=self.find_lt_names_msvc(lib,is_static) if lt_path!=None and lt_libname!=None: if lt_static==True: return os.path.join(lt_path,lt_libname) if lt_path!=None: _libpaths=[lt_path]+self.env['LIBPATH'] else: _libpaths=self.env['LIBPATH'] static_libs=['lib%ss.lib'%lib,'lib%s.lib'%lib,'%ss.lib'%lib,'%s.lib'%lib,] dynamic_libs=['lib%s.dll.lib'%lib,'lib%s.dll.a'%lib,'%s.dll.lib'%lib,'%s.dll.a'%lib,'lib%s_d.lib'%lib,'%s_d.lib'%lib,'%s.lib'%lib,] libnames=static_libs if not is_static: libnames=dynamic_libs+static_libs for path in _libpaths: for libn in libnames: if os.path.exists(os.path.join(path,libn)): debug('msvc: lib found: %s'%os.path.join(path,libn)) return re.sub('\.lib$','',libn) if mandatory: self.fatal("The library %r could not be found"%libname) return re.sub('\.lib$','',libname) def check_lib_msvc(self,libname,is_static=False,uselib_store=None,mandatory=False): libn=self.libname_msvc(libname,is_static,mandatory) if not uselib_store: uselib_store=libname.upper() if False and is_static: self.env['STATICLIB_'+uselib_store]=[libn] else: self.env['LIB_'+uselib_store]=[libn] def check_libs_msvc(self,libnames,is_static=False,mandatory=False): for libname in Utils.to_list(libnames): self.check_lib_msvc(libname,is_static,mandatory=mandatory) def apply_obj_vars_msvc(self): if self.env['CC_NAME']!='msvc': return try: self.meths.remove('apply_obj_vars') except ValueError: pass env=self.env app=env.append_unique cpppath_st=env['CPPPATH_ST'] lib_st=env['LIB_ST'] staticlib_st=env['STATICLIB_ST'] libpath_st=env['LIBPATH_ST'] staticlibpath_st=env['STATICLIBPATH_ST'] for i in env['LIBPATH']: app('LINKFLAGS',libpath_st%i) if not self.libpaths.count(i): self.libpaths.append(i) for i in env['LIBPATH']: app('LINKFLAGS',staticlibpath_st%i) if not self.libpaths.count(i): self.libpaths.append(i) if not env['FULLSTATIC']: if env['STATICLIB']or env['LIB']: app('LINKFLAGS',env['SHLIB_MARKER']) for i in env['STATICLIB']: app('LINKFLAGS',staticlib_st%i) for i in env['LIB']: app('LINKFLAGS',lib_st%i) def apply_link_msvc(self): if self.env['CC_NAME']!='msvc': return link=getattr(self,'link',None) if not link: if'cstaticlib'in self.features:link='msvc_link_static' elif'cxx'in self.features:link='msvc_cxx_link' else:link='msvc_cc_link' self.link=link def init_msvc(self): try:getattr(self,'libpaths') except AttributeError:self.libpaths=[] Task.task_type_from_func('msvc_link_static',vars=['STLIBLINK','STLINKFLAGS'],color='YELLOW',func=msvc_linker,ext_in='.o') Task.task_type_from_func('msvc_cc_link',vars=['LINK','LINK_SRC_F','LINKFLAGS','MT','MTFLAGS'],color='YELLOW',func=msvc_linker,ext_in='.o') Task.task_type_from_func('msvc_cxx_link',vars=['LINK','LINK_SRC_F','LINKFLAGS','MT','MTFLAGS'],color='YELLOW',func=msvc_linker,ext_in='.o') rc_str='${RC} ${RCFLAGS} /fo ${TGT} ${SRC}' Task.simple_task_type('rc',rc_str,color='GREEN',before='cc cxx',shell=False) def no_autodetect(conf): conf.eval_rules(detect.replace('autodetect','')) detect=''' autodetect find_msvc msvc_common_flags cc_load_tools cxx_load_tools cc_add_flags cxx_add_flags ''' def autodetect(conf): v=conf.env compiler,path,includes,libdirs=detect_msvc(conf) v['PATH']=path v['CPPPATH']=includes v['LIBPATH']=libdirs v['MSVC_COMPILER']=compiler def _get_prog_names(conf,compiler): if compiler=='intel': compiler_name='ICL' linker_name='XILINK' lib_name='XILIB' else: compiler_name='CL' linker_name='LINK' lib_name='LIB' return compiler_name,linker_name,lib_name def find_msvc(conf): if sys.platform!='win32': conf.fatal('MSVC module only works under native Win32 Python! cygwin is not supported yet') v=conf.env compiler,path,includes,libdirs=detect_msvc(conf) v['PATH']=path v['CPPPATH']=includes v['LIBPATH']=libdirs compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) cxx=None if v['CXX']:cxx=v['CXX'] elif'CXX'in conf.environ:cxx=conf.environ['CXX'] if not cxx:cxx=conf.find_program(compiler_name,var='CXX',path_list=path) if not cxx:conf.fatal('%s was not found (compiler)'%compiler_name) cxx=conf.cmd_to_list(cxx) env=dict(conf.environ) env.update(PATH=';'.join(path)) if not Utils.cmd_output([cxx,'/nologo','/?'],silent=True,env=env): conf.fatal('the msvc compiler could not be identified') v['CC']=v['CXX']=cxx v['CC_NAME']=v['CXX_NAME']='msvc' try:v.prepend_value('CPPPATH',conf.environ['INCLUDE']) except KeyError:pass try:v.prepend_value('LIBPATH',conf.environ['LIB']) except KeyError:pass if not v['LINK_CXX']: link=conf.find_program(linker_name,path_list=path) if link:v['LINK_CXX']=link else:conf.fatal('%s was not found (linker)'%linker_name) v['LINK']=link if not v['LINK_CC']:v['LINK_CC']=v['LINK_CXX'] if not v['STLIBLINK']: stliblink=conf.find_program(lib_name,path_list=path) if not stliblink:return v['STLIBLINK']=stliblink v['STLINKFLAGS']=['/NOLOGO'] manifesttool=conf.find_program('MT',path_list=path) if manifesttool: v['MT']=manifesttool v['MTFLAGS']=['/NOLOGO'] conf.check_tool('winres') if not conf.env['WINRC']: warn('Resource compiler not found. Compiling resource file is disabled') def exec_command_msvc(self,*k,**kw): if self.env['CC_NAME']=='msvc': if isinstance(k[0],list): lst=[] carry='' for a in k[0]: if(len(a)==3 and(a.startswith('/F')or a.startswith('/Y')))or(a=='/doc'): carry=a else: lst.append(carry+a) carry='' k=[lst] env=dict(os.environ) env.update(PATH=';'.join(self.env['PATH'])) kw['env']=env return self.generator.bld.exec_command(*k,**kw) for k in'cc cxx msvc_cc_link msvc_cxx_link msvc_link_static winrc'.split(): cls=Task.TaskBase.classes.get(k,None) if cls: cls.exec_command=exec_command_msvc def msvc_common_flags(conf): v=conf.env v['CPPFLAGS']=['/W3','/nologo','/EHsc'] v['CCDEFINES_ST']='/D%s' v['CXXDEFINES_ST']='/D%s' v['CCDEFINES']=['WIN32'] v['CXXDEFINES']=['WIN32'] v['_CCINCFLAGS']=[] v['_CCDEFFLAGS']=[] v['_CXXINCFLAGS']=[] v['_CXXDEFFLAGS']=[] v['CC_SRC_F']='' v['CC_TGT_F']=['/c','/Fo'] v['CXX_SRC_F']='' v['CXX_TGT_F']=['/c','/Fo'] v['CPPPATH_ST']='/I%s' v['CPPFLAGS_CONSOLE']=['/SUBSYSTEM:CONSOLE'] v['CPPFLAGS_NATIVE']=['/SUBSYSTEM:NATIVE'] v['CPPFLAGS_POSIX']=['/SUBSYSTEM:POSIX'] v['CPPFLAGS_WINDOWS']=['/SUBSYSTEM:WINDOWS'] v['CPPFLAGS_WINDOWSCE']=['/SUBSYSTEM:WINDOWSCE'] v['CPPFLAGS_CRT_MULTITHREADED']=['/MT'] v['CPPFLAGS_CRT_MULTITHREADED_DLL']=['/MD'] v['CPPDEFINES_CRT_MULTITHREADED']=['_MT'] v['CPPDEFINES_CRT_MULTITHREADED_DLL']=['_MT','_DLL'] v['CPPFLAGS_CRT_MULTITHREADED_DBG']=['/MTd'] v['CPPFLAGS_CRT_MULTITHREADED_DLL_DBG']=['/MDd'] v['CPPDEFINES_CRT_MULTITHREADED_DBG']=['_DEBUG','_MT'] v['CPPDEFINES_CRT_MULTITHREADED_DLL_DBG']=['_DEBUG','_MT','_DLL'] v['CCFLAGS']=['/TC'] v['CCFLAGS_OPTIMIZED']=['/O2','/DNDEBUG'] v['CCFLAGS_RELEASE']=['/O2','/DNDEBUG'] v['CCFLAGS_DEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI'] v['CCFLAGS_ULTRADEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI'] v['CXXFLAGS']=['/TP'] v['CXXFLAGS_OPTIMIZED']=['/O2','/DNDEBUG'] v['CXXFLAGS_RELEASE']=['/O2','/DNDEBUG'] v['CXXFLAGS_DEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI'] v['CXXFLAGS_ULTRADEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI'] v['LIB']=[] v['LINK_TGT_F']='/OUT:' v['LINK_SRC_F']='' v['LIB_ST']='%s.lib' v['LIBPATH_ST']='/LIBPATH:%s' v['STATICLIB_ST']='lib%s.lib' v['STATICLIBPATH_ST']='/LIBPATH:%s' v['LINKFLAGS']=['/NOLOGO','/MANIFEST'] v['shlib_CCFLAGS']=[''] v['shlib_CXXFLAGS']=[''] v['shlib_LINKFLAGS']=['/DLL'] v['shlib_PATTERN']='%s.dll' v['implib_PATTERN']='%s.lib' v['IMPLIB_ST']='/IMPLIB:%s' v['staticlib_LINKFLAGS']=[''] v['staticlib_PATTERN']='lib%s.lib' v['program_PATTERN']='%s.exe' conf(get_msvc_version) conf(gather_wsdk_versions) conf(gather_msvc_versions) conf(gather_icl_versions) conf(get_msvc_versions) conf(print_all_msvc_detected) conf(find_lt_names_msvc) conf(libname_msvc) conf(check_lib_msvc) conf(check_libs_msvc) feature('cprogram','cshlib','cstaticlib')(apply_obj_vars_msvc) after('apply_lib_vars')(apply_obj_vars_msvc) before('apply_obj_vars')(apply_obj_vars_msvc) feature('cprogram','cshlib','cstaticlib')(apply_link_msvc) before('apply_link')(apply_link_msvc) feature('cc','cxx')(init_msvc) after('init_cc','init_cxx')(init_msvc) before('apply_type_vars','apply_core')(init_msvc) conftest(no_autodetect) conftest(autodetect) conftest(find_msvc) conftest(msvc_common_flags) libdesktop-agnostic-0.3.92/wafadmin/Tools/lua.py0000644000175000017510000000060411226437331021060 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import TaskGen from TaskGen import taskgen,feature from Constants import* TaskGen.declare_chain(name='luac',rule='${LUAC} -s -o ${TGT} ${SRC}',ext_in='.lua',ext_out='.luac',reentrant=0,install='LUADIR',) def init_lua(self): self.default_chmod=O755 def detect(conf): conf.find_program('luac',var='LUAC',mandatory=True) feature('lua')(init_lua) libdesktop-agnostic-0.3.92/wafadmin/Tools/gob2.py0000644000175000017510000000046211226437331021132 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import TaskGen TaskGen.declare_chain(name='gob2',rule='${GOB2} -o ${TGT[0].bld_dir(env)} ${GOB2FLAGS} ${SRC}',ext_in='.gob',ext_out='.c') def detect(conf): gob2=conf.find_program('gob2',var='GOB2',mandatory=True) conf.env['GOB2']=gob2 conf.env['GOB2FLAGS']='' libdesktop-agnostic-0.3.92/wafadmin/Tools/osx.py0000644000175000017510000001061411226437332021113 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,shutil,sys,platform import TaskGen,Task,Build,Options from TaskGen import taskgen,feature,after,before from Logs import error,debug def set_macosx_deployment_target(self): if self.env['MACOSX_DEPLOYMENT_TARGET']: os.environ['MACOSX_DEPLOYMENT_TARGET']=self.env['MACOSX_DEPLOYMENT_TARGET'] elif'MACOSX_DEPLOYMENT_TARGET'not in os.environ: if sys.platform=='darwin': os.environ['MACOSX_DEPLOYMENT_TARGET']='.'.join(platform.mac_ver()[0].split('.')[:2]) def apply_framework(self): for x in self.to_list(self.env['FRAMEWORKPATH']): frameworkpath_st='-F%s' self.env.append_unique('CXXFLAGS',frameworkpath_st%x) self.env.append_unique('CCFLAGS',frameworkpath_st%x) self.env.append_unique('LINKFLAGS',frameworkpath_st%x) for x in self.to_list(self.env['FRAMEWORK']): self.env.append_value('LINKFLAGS',['-framework',x]) def create_task_macapp(self): if'cprogram'in self.features and self.link_task: apptask=self.create_task('macapp',self.env) apptask.set_inputs(self.link_task.outputs) apptask.set_outputs(self.link_task.outputs[0].change_ext('.app')) self.apptask=apptask def apply_link_osx(self): if self.env['MACAPP']or getattr(self,'mac_app',False): self.create_task_macapp() name=self.link_task.outputs[0].name if getattr(self,'vnum',None): name=name.replace('.dylib','.%s.dylib'%self.vnum) path=os.path.join(self.env['PREFIX'],'lib',name) self.env.append_value('LINKFLAGS','-install_name') self.env.append_value('LINKFLAGS',path) def apply_bundle(self): if not('cshlib'in self.features or'shlib'in self.features):return if self.env['MACBUNDLE']or getattr(self,'mac_bundle',False): self.env['shlib_PATTERN']=self.env['macbundle_PATTERN'] uselib=self.uselib=self.to_list(self.uselib) if not'MACBUNDLE'in uselib:uselib.append('MACBUNDLE') def apply_bundle_remove_dynamiclib(self): if self.env['MACBUNDLE']or getattr(self,'mac_bundle',False): if not getattr(self,'vnum',None): try: self.env['LINKFLAGS'].remove('-dynamiclib') except ValueError: pass app_dirs=['Contents',os.path.join('Contents','MacOS'),os.path.join('Contents','Resources')] app_info=''' CFBundlePackageType APPL CFBundleGetInfoString Created by Waf CFBundleSignature ???? NOTE THIS IS A GENERATED FILE, DO NOT MODIFY CFBundleExecutable %s ''' def app_build(task): global app_dirs env=task.env i=0 for p in task.outputs: srcfile=p.srcpath(env) debug('osx: creating directories') try: os.mkdir(srcfile) [os.makedirs(os.path.join(srcfile,d))for d in app_dirs] except(OSError,IOError): pass srcprg=task.inputs[i].srcpath(env) dst=os.path.join(srcfile,'Contents','MacOS') debug('osx: copy %s to %s'%(srcprg,dst)) shutil.copy(srcprg,dst) debug('osx: generate Info.plist') f=open(os.path.join(srcfile,"Contents","Info.plist"),"w") f.write(app_info%os.path.basename(srcprg)) f.close() i+=1 return 0 def install_shlib(task): nums=task.vnum.split('.') path=self.install_path libname=task.outputs[0].name name3=libname.replace('.dylib','.%s.dylib'%task.vnum) name2=libname.replace('.dylib','.%s.dylib'%nums[0]) name1=libname filename=task.outputs[0].abspath(task.env) bld=task.outputs[0].__class__.bld bld.install_as(path+name3,filename,env=task.env) bld.symlink_as(path+name2,name3) bld.symlink_as(path+name1,name3) def install_target_osx_cshlib(self): if not self.bld.is_install:return if getattr(self,'vnum','')and sys.platform!='win32': self.link_task.install=install_shlib Task.task_type_from_func('macapp',vars=[],func=app_build,after="cxx_link cc_link ar_link_static") feature('cc','cxx')(set_macosx_deployment_target) before('apply_lib_vars')(set_macosx_deployment_target) feature('cc','cxx')(apply_framework) after('apply_lib_vars')(apply_framework) taskgen(create_task_macapp) after('apply_link')(apply_link_osx) feature('cc','cxx')(apply_link_osx) before('apply_link','apply_lib_vars')(apply_bundle) feature('cc','cxx')(apply_bundle) after('apply_link')(apply_bundle_remove_dynamiclib) feature('cshlib')(apply_bundle_remove_dynamiclib) feature('osx')(install_target_osx_cshlib) after('install_target_cshlib')(install_target_osx_cshlib) libdesktop-agnostic-0.3.92/wafadmin/Tools/vala.py0000644000175000017510000001772511243334131021227 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os.path,shutil import Task,Runner,Utils,Logs,Build,Node from TaskGen import extension,after,before EXT_VALA=['.vala','.gs'] class valac_task(Task.Task): vars=("VALAC","VALAC_VERSION","VALAFLAGS") before=("cc","cxx") def run(self): env=self.env inputs=[a.srcpath(env)for a in self.inputs] valac=env['VALAC'] vala_flags=env.get_flat('VALAFLAGS') top_src=self.generator.bld.srcnode.abspath() top_bld=self.generator.bld.srcnode.abspath(env) if env['VALAC_VERSION']>(0,1,6): cmd=[valac,'-C','--quiet',vala_flags] else: cmd=[valac,'-C',vala_flags] if self.threading: cmd.append('--thread') if self.target_glib: cmd.append('--target-glib=%s'%self.target_glib) features=self.generator.features if'cshlib'in features or'cstaticlib'in features: output_dir=self.outputs[0].bld_dir(env) cmd.append('--library '+self.target) if env['VALAC_VERSION']>=(0,7,0): header_basename=getattr(self,'header',self.target) cmd.append('--header '+os.path.join(output_dir,header_basename+'.h')) self.outputs.append(self.generator.path.find_or_declare(header_basename+'.h')) if env['VALAC_VERSION']>(0,7,5): includedir=self.generator.path.abspath().replace(top_src+'/','',1) cmd.append('--includedir '+includedir) cmd.append('--basedir '+top_src) cmd.append('-d '+top_bld) if env['VALAC_VERSION']>(0,7,2)and hasattr(self,'gir'): cmd.append('--gir=%s.gir'%self.gir) else: output_dir=self.outputs[0].bld_dir(env) cmd.append('-d %s'%output_dir) for vapi_dir in self.vapi_dirs: cmd.append('--vapidir=%s'%vapi_dir) for package in self.packages: cmd.append('--pkg %s'%package) for package in self.packages_private: cmd.append('--pkg %s'%package) cmd.append(" ".join(inputs)) result=self.generator.bld.exec_command(" ".join(cmd)) if not'cprogram'in features: if self.packages: filename=os.path.join(self.generator.path.abspath(env),"%s.deps"%self.target) deps=open(filename,'w') for package in self.packages: deps.write(package+'\n') deps.close() self._fix_output("../%s.vapi"%self.target) self._fix_output("%s.vapi"%self.target) self._fix_output("%s.gidl"%self.target) self._fix_output("%s.gir"%self.target) if hasattr(self,'gir'): self._fix_output("%s.gir"%self.gir) return result def install(self): bld=self.generator.bld features=self.generator.features if self.attr("install_path")and("cshlib"in features or"cstaticlib"in features): headers_list=[o for o in self.outputs if o.suffix()==".h"] vapi_list=[o for o in self.outputs if(o.suffix()in(".vapi",".deps"))] gir_list=[o for o in self.outputs if o.suffix()==".gir"] for header in headers_list: top_src=self.generator.bld.srcnode package=self.env['PACKAGE'] try: api_version=Utils.g_module.API_VERSION except AttributeError: version=Utils.g_module.VERSION.split(".") if version[0]=="0": api_version="0."+version[1] else: api_version=version[0]+".0" install_path="${INCLUDEDIR}/%s-%s/%s"%(package,api_version,header.relpath_gen(top_src)) bld.install_as(install_path,header.abspath(self.env),self.env) for vapi in vapi_list: bld.install_files("${DATAROOTDIR}/vala/vapi",vapi.abspath(self.env),self.env) for gir in gir_list: bld.install_files("${DATAROOTDIR}/gir-1.0",gir.abspath(self.env),self.env) def _fix_output(self,output): top_bld=self.generator.bld.srcnode.abspath(self.env) try: src=os.path.join(top_bld,output) dst=self.generator.path.abspath(self.env) shutil.move(src,dst) except: pass def vala_file(self,node): valatask=getattr(self,"valatask",None) if not valatask: valatask=self.create_task('valac') self.valatask=valatask self.includes=Utils.to_list(getattr(self,'includes',[])) valatask.packages=[] valatask.packages_private=Utils.to_list(getattr(self,'packages_private',[])) valatask.vapi_dirs=[] valatask.target=self.target valatask.threading=False valatask.install_path=self.install_path valatask.target_glib=None packages=Utils.to_list(getattr(self,'packages',[])) vapi_dirs=Utils.to_list(getattr(self,'vapi_dirs',[])) includes=[] if hasattr(self,'uselib_local'): local_packages=Utils.to_list(self.uselib_local) seen=[] while len(local_packages)>0: package=local_packages.pop() if package in seen: continue seen.append(package) package_obj=self.name_to_obj(package) if not package_obj: raise Utils.WafError("object '%s' was not found in uselib_local (required by '%s')"%(package,self.name)) package_name=package_obj.target package_node=package_obj.path package_dir=package_node.relpath_gen(self.path) for task in package_obj.tasks: for output in task.outputs: if output.name==package_name+".vapi": valatask.set_run_after(task) if package_name not in packages: packages.append(package_name) if package_dir not in vapi_dirs: vapi_dirs.append(package_dir) if package_dir not in includes: includes.append(package_dir) if hasattr(package_obj,'uselib_local'): lst=self.to_list(package_obj.uselib_local) lst.reverse() local_packages=[pkg for pkg in lst if pkg not in seen]+local_packages valatask.packages=packages for vapi_dir in vapi_dirs: try: valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath()) valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath(self.env)) except AttributeError: Logs.warn("Unable to locate Vala API directory: '%s'"%vapi_dir) self.includes.append(node.bld.srcnode.abspath()) self.includes.append(node.bld.srcnode.abspath(self.env)) for include in includes: try: self.includes.append(self.path.find_dir(include).abspath()) self.includes.append(self.path.find_dir(include).abspath(self.env)) except AttributeError: Logs.warn("Unable to locate include directory: '%s'"%include) if hasattr(self,'threading'): valatask.threading=self.threading self.uselib=self.to_list(self.uselib) if not'GTHREAD'in self.uselib: self.uselib.append('GTHREAD') if hasattr(self,'target_glib'): valatask.target_glib=self.target_glib if hasattr(self,'gir'): valatask.gir=self.gir if hasattr(self,'header'): valatask.header=self.header env=valatask.env output_nodes=[] c_node=node.change_ext('.c') output_nodes.append(c_node) self.allnodes.append(c_node) if env['VALAC_VERSION']<(0,7,0): output_nodes.append(node.change_ext('.h')) else: if not'cprogram'in self.features: output_nodes.append(self.path.find_or_declare('%s.h'%getattr(self,'header',self.target))) if not'cprogram'in self.features: output_nodes.append(self.path.find_or_declare('%s.vapi'%self.target)) if env['VALAC_VERSION']>(0,7,2): if hasattr(self,'gir'): output_nodes.append(self.path.find_or_declare('%s.gir'%self.gir)) elif env['VALAC_VERSION']>(0,3,5): output_nodes.append(self.path.find_or_declare('%s.gir'%self.target)) elif env['VALAC_VERSION']>(0,1,7): output_nodes.append(self.path.find_or_declare('%s.gidl'%self.target)) if valatask.packages: output_nodes.append(self.path.find_or_declare('%s.deps'%self.target)) valatask.inputs.append(node) valatask.outputs.extend(output_nodes) def detect(conf): min_version=(0,1,6) min_version_str="%d.%d.%d"%min_version valac=conf.find_program('valac',var='VALAC',mandatory=True) if not conf.env["HAVE_GTHREAD"]: conf.check_cfg(package='gthread-2.0',uselib_store='GTHREAD',args='--cflags --libs') try: output=Utils.cmd_output(valac+" --version",silent=True) version=output.split(' ',1)[-1].strip().split(".") version=[int(x)for x in version] valac_version=tuple(version) except Exception: valac_version=(0,0,0) conf.check_message('program version','valac >= '+min_version_str,valac_version>=min_version,"%d.%d.%d"%valac_version) conf.check_tool('gnu_dirs') if valac_version=','exact-version':'==','max-version':'<=',} SNIP1=''' int main() { void *p; p=(void*)(%s); return 0; } ''' SNIP2=''' int main() { if ((%(type_name)s *) 0) return 0; if (sizeof (%(type_name)s)) return 0; } ''' SNIP3=''' int main() { return 0; } ''' def parse_flags(line,uselib,env): lst=shlex.split(line) while lst: x=lst.pop(0) st=x[:2] ot=x[2:] if st=='-I'or st=='/I': if not ot:ot=lst.pop(0) env.append_unique('CPPPATH_'+uselib,ot) elif st=='-D': if not ot:ot=lst.pop(0) env.append_unique('CXXDEFINES_'+uselib,ot) env.append_unique('CCDEFINES_'+uselib,ot) elif st=='-l': if not ot:ot=lst.pop(0) env.append_unique('LIB_'+uselib,ot) elif st=='-L': if not ot:ot=lst.pop(0) env.append_unique('LIBPATH_'+uselib,ot) elif x=='-pthread'or x.startswith('+'): env.append_unique('CCFLAGS_'+uselib,x) env.append_unique('CXXFLAGS_'+uselib,x) env.append_unique('LINKFLAGS_'+uselib,x) elif x.startswith('-std'): env.append_unique('CCFLAGS_'+uselib,x) env.append_unique('LINKFLAGS_'+uselib,x) elif x.startswith('-Wl'): env.append_unique('LINKFLAGS_'+uselib,x) elif x.startswith('-m')or x.startswith('-f'): env.append_unique('CCFLAGS_'+uselib,x) env.append_unique('CXXFLAGS_'+uselib,x) def ret_msg(self,f,kw): if isinstance(f,str): return f return f(kw) def validate_cfg(self,kw): if not'path'in kw: kw['path']='pkg-config --errors-to-stdout --print-errors' if'atleast_pkgconfig_version'in kw: if not'msg'in kw: kw['msg']='Checking for pkg-config version >= %s'%kw['atleast_pkgconfig_version'] return if'modversion'in kw: return for x in cfg_ver.keys(): y=x.replace('-','_') if y in kw: if not'package'in kw: raise ValueError('%s requires a package'%x) if not'msg'in kw: kw['msg']='Checking for %s %s %s'%(kw['package'],cfg_ver[x],kw[y]) return if not'msg'in kw: kw['msg']='Checking for %s'%kw['package'] if not'okmsg'in kw: kw['okmsg']='ok' if not'errmsg'in kw: kw['errmsg']='not found' def cmd_and_log(self,cmd,kw): Logs.debug('runner: %s\n'%cmd) if self.log:self.log.write('%s\n'%cmd) try: p=Utils.pproc.Popen(cmd,stdout=Utils.pproc.PIPE,shell=True) output=p.communicate()[0] except WindowsError: self.fatal('fail') if p.returncode: if not kw.get('errmsg',''): if kw.get('mandatory',False): kw['errmsg']=output.strip() else: kw['errmsg']='fail' self.fatal('fail') return output def exec_cfg(self,kw): if'atleast_pkgconfig_version'in kw: cmd='%s --atleast-pkgconfig-version=%s'%(kw['path'],kw['atleast_pkgconfig_version']) self.cmd_and_log(cmd,kw) if not'okmsg'in kw: kw['okmsg']='ok' return for x in cfg_ver: y=x.replace('-','_') if y in kw: self.cmd_and_log('%s --%s=%s %s'%(kw['path'],x,kw[y],kw['package']),kw) if not'okmsg'in kw: kw['okmsg']='ok' self.define(self.have_define(kw.get('uselib_store',kw['package'])),1,0) break if'modversion'in kw: version=self.cmd_and_log('%s --modversion %s'%(kw['path'],kw['modversion']),kw).strip() self.define('%s_VERSION'%Utils.quote_define_name(kw.get('uselib_store',kw['modversion'])),version) return version lst=[kw['path']] for key,val in kw.get('define_variable',{}).iteritems(): lst.append('--define-variable=%s=%s'%(key,val)) lst.append(kw.get('args','')) lst.append(kw['package']) cmd=' '.join(lst) ret=self.cmd_and_log(cmd,kw) if not'okmsg'in kw: kw['okmsg']='ok' self.define(self.have_define(kw.get('uselib_store',kw['package'])),1,0) parse_flags(ret,kw.get('uselib_store',kw['package'].upper()),kw.get('env',self.env)) return ret def check_cfg(self,*k,**kw): self.validate_cfg(kw) if'msg'in kw: self.check_message_1(kw['msg']) ret=None try: ret=self.exec_cfg(kw) except Configure.ConfigurationError,e: if'errmsg'in kw: self.check_message_2(kw['errmsg'],'YELLOW') if'mandatory'in kw and kw['mandatory']: if Logs.verbose>1: raise else: self.fatal('the configuration failed (see %r)'%self.log.name) else: kw['success']=ret if'okmsg'in kw: self.check_message_2(self.ret_msg(kw['okmsg'],kw)) return ret def validate_c(self,kw): if not'env'in kw: kw['env']=self.env.copy() env=kw['env'] if not'compiler'in kw: kw['compiler']='cc' if env['CXX_NAME']and Task.TaskBase.classes.get('cxx',None): kw['compiler']='cxx' if not self.env['CXX']: self.fatal('a c++ compiler is required') else: if not self.env['CC']: self.fatal('a c compiler is required') if not'type'in kw: kw['type']='cprogram' assert not(kw['type']!='cprogram'and kw.get('execute',0)),'can only execute programs' def to_header(dct): if'header_name'in dct: dct=Utils.to_list(dct['header_name']) return''.join(['#include <%s>\n'%x for x in dct]) return'' if not'compile_mode'in kw: kw['compile_mode']=(kw['compiler']=='cxx')and'cxx'or'cc' if not'compile_filename'in kw: kw['compile_filename']='test.c'+((kw['compile_mode']=='cxx')and'pp'or'') if'framework_name'in kw: try:TaskGen.task_gen.create_task_macapp except AttributeError:self.fatal('frameworks require the osx tool') fwkname=kw['framework_name'] if not'uselib_store'in kw: kw['uselib_store']=fwkname.upper() if not kw.get('no_header',False): if not'header_name'in kw: kw['header_name']=[] fwk='%s/%s.h'%(fwkname,fwkname) if kw.get('remove_dot_h',None): fwk=fwk[:-2] kw['header_name']=Utils.to_list(kw['header_name'])+[fwk] kw['msg']='Checking for framework %s'%fwkname kw['framework']=fwkname if'function_name'in kw: fu=kw['function_name'] if not'msg'in kw: kw['msg']='Checking for function %s'%fu kw['code']=to_header(kw)+SNIP1%fu if not'uselib_store'in kw: kw['uselib_store']=fu.upper() if not'define_name'in kw: kw['define_name']=self.have_define(fu) elif'type_name'in kw: tu=kw['type_name'] if not'msg'in kw: kw['msg']='Checking for type %s'%tu if not'header_name'in kw: kw['header_name']='stdint.h' kw['code']=to_header(kw)+SNIP2%{'type_name':tu} if not'define_name'in kw: kw['define_name']=self.have_define(tu.upper()) elif'header_name'in kw: if not'msg'in kw: kw['msg']='Checking for header %s'%kw['header_name'] l=Utils.to_list(kw['header_name']) assert len(l)>0,'list of headers in header_name is empty' kw['code']=to_header(kw)+SNIP3 if not'uselib_store'in kw: kw['uselib_store']=l[0].upper() if not'define_name'in kw: kw['define_name']=self.have_define(l[0]) if'lib'in kw: if not'msg'in kw: kw['msg']='Checking for library %s'%kw['lib'] if not'uselib_store'in kw: kw['uselib_store']=kw['lib'].upper() if'staticlib'in kw: if not'msg'in kw: kw['msg']='Checking for static library %s'%kw['staticlib'] if not'uselib_store'in kw: kw['uselib_store']=kw['staticlib'].upper() if'fragment'in kw: kw['code']=kw['fragment'] if not'msg'in kw: kw['msg']='Checking for custom code' if not'errmsg'in kw: kw['errmsg']='fail' for(flagsname,flagstype)in[('cxxflags','compiler'),('cflags','compiler'),('linkflags','linker')]: if flagsname in kw: if not'msg'in kw: kw['msg']='Checking for %s flags %s'%(flagstype,kw[flagsname]) if not'errmsg'in kw: kw['errmsg']='fail' if not'execute'in kw: kw['execute']=False if not'errmsg'in kw: kw['errmsg']='not found' if not'okmsg'in kw: kw['okmsg']='ok' if not'code'in kw: kw['code']=SNIP3 if not kw.get('success'):kw['success']=None assert'msg'in kw,'invalid parameters, read http://freehackers.org/~tnagy/wafbook/single.html#config_helpers_c' def post_check(self,*k,**kw): is_success=0 if kw['execute']: if kw['success']: is_success=kw['success'] else: is_success=(kw['success']==0) def define_or_stuff(): nm=kw['define_name'] if kw['execute']and kw.get('define_ret',None)and isinstance(is_success,str): self.define(kw['define_name'],is_success,quote=kw.get('quote',1)) else: self.define_cond(kw['define_name'],is_success) if'define_name'in kw: if'header_name'in kw or'function_name'in kw or'type_name'in kw or'fragment'in kw: define_or_stuff() if is_success and'uselib_store'in kw: import cc,cxx for k in set(cc.g_cc_flag_vars).union(cxx.g_cxx_flag_vars): lk=k.lower() if k=='CPPPATH':lk='includes' if k=='CXXDEFINES':lk='defines' if k=='CCDEFINES':lk='defines' if lk in kw: val=kw[lk] if isinstance(val,str): val=val.rstrip(os.path.sep) self.env.append_unique(k+'_'+kw['uselib_store'],val) def check(self,*k,**kw): self.validate_c(kw) self.check_message_1(kw['msg']) ret=None try: ret=self.run_c_code(*k,**kw) except Configure.ConfigurationError,e: self.check_message_2(kw['errmsg'],'YELLOW') if'mandatory'in kw and kw['mandatory']: if Logs.verbose>1: raise else: self.fatal('the configuration failed (see %r)'%self.log.name) else: kw['success']=ret self.check_message_2(self.ret_msg(kw['okmsg'],kw)) self.post_check(*k,**kw) if not kw.get('execute',False): return ret==0 return ret def run_c_code(self,*k,**kw): test_f_name=kw['compile_filename'] k=0 while k<10000: dir=os.path.join(self.blddir,'.conf_check_%d'%k) try: shutil.rmtree(dir) except OSError: pass try: os.stat(dir) except OSError: break k+=1 try: os.makedirs(dir) except: self.fatal('cannot create a configuration test folder %r'%dir) try: os.stat(dir) except: self.fatal('cannot use the configuration test folder %r'%dir) bdir=os.path.join(dir,'testbuild') if not os.path.exists(bdir): os.makedirs(bdir) env=kw['env'] dest=open(os.path.join(dir,test_f_name),'w') dest.write(kw['code']) dest.close() back=os.path.abspath('.') bld=Build.BuildContext() bld.log=self.log bld.all_envs.update(self.all_envs) bld.all_envs['default']=env bld.lst_variants=bld.all_envs.keys() bld.load_dirs(dir,bdir) os.chdir(dir) bld.rescan(bld.srcnode) o=bld.new_task_gen(features=[kw['compile_mode'],kw['type']],source=test_f_name,target='testprog') for k,v in kw.iteritems(): setattr(o,k,v) self.log.write("==>\n%s\n<==\n"%kw['code']) try: bld.compile() except Utils.WafError: ret=Utils.ex_stack() else: ret=0 os.chdir(back) if ret: self.log.write('command returned %r'%ret) self.fatal(str(ret)) if kw['execute']: lastprog=o.link_task.outputs[0].abspath(env) if kw['execute']: args=Utils.to_list(kw.get('exec_args',[])) try: data=Utils.cmd_output([lastprog]+args).strip() except ValueError,e: self.fatal(Utils.ex_stack()) ret=data return ret def check_cxx(self,*k,**kw): kw['compiler']='cxx' return self.check(*k,**kw) def check_cc(self,*k,**kw): kw['compiler']='cc' return self.check(*k,**kw) def define(self,define,value,quote=1): assert define and isinstance(define,str) tbl=self.env[DEFINES]or Utils.ordered_dict() if isinstance(value,str): if quote: tbl[define]='"%s"'%str(value) else: tbl[define]=value elif isinstance(value,int): tbl[define]=value else: raise TypeError('define %r -> %r must be a string or an int'%(define,value)) self.env[DEFINES]=tbl self.env[define]=value def undefine(self,define): assert define and isinstance(define,str) tbl=self.env[DEFINES]or Utils.ordered_dict() value=UNDEFINED tbl[define]=value self.env[DEFINES]=tbl self.env[define]=value def define_cond(self,name,value): if value: self.define(name,1) else: self.undefine(name) def is_defined(self,key): defines=self.env[DEFINES] if not defines: return False try: value=defines[key] except KeyError: return False else: return value!=UNDEFINED def get_define(self,define): try:return self.env[DEFINES][define] except KeyError:return None def have_define(self,name): return self.__dict__.get('HAVE_PAT','HAVE_%s')%Utils.quote_define_name(name) def write_config_header(self,configfile='',env='',guard='',top=False): if not configfile:configfile=WAF_CONFIG_H waf_guard=guard or'_%s_WAF'%Utils.quote_define_name(configfile) if not env:env=self.env if top: diff='' else: diff=Utils.diff_path(self.srcdir,self.curdir) full=os.sep.join([self.blddir,env.variant(),diff,configfile]) full=os.path.normpath(full) (dir,base)=os.path.split(full) try:os.makedirs(dir) except:pass dest=open(full,'w') dest.write('/* Configuration header created by Waf - do not edit */\n') dest.write('#ifndef %s\n#define %s\n\n'%(waf_guard,waf_guard)) dest.write(self.get_config_header()) env.append_value(CFG_FILES,os.path.join(diff,configfile)) dest.write('\n#endif /* %s */\n'%waf_guard) dest.close() def get_config_header(self): config_header=[] tbl=self.env[DEFINES]or Utils.ordered_dict() for key in tbl.allkeys: value=tbl[key] if value is None: config_header.append('#define %s'%key) elif value is UNDEFINED: config_header.append('/* #undef %s */'%key) else: config_header.append('#define %s %s'%(key,value)) return"\n".join(config_header) def find_cpp(conf): v=conf.env cpp=None if v['CPP']:cpp=v['CPP'] elif'CPP'in conf.environ:cpp=conf.environ['CPP'] if not cpp:cpp=conf.find_program('cpp',var='CPP') if not cpp:cpp=v['CC'] if not cpp:cpp=v['CXX'] v['CPP']=cpp def cc_add_flags(conf): conf.add_os_flags('CFLAGS','CCFLAGS') conf.add_os_flags('CPPFLAGS') conf.add_os_flags('LINKFLAGS') def cxx_add_flags(conf): conf.add_os_flags('CXXFLAGS') conf.add_os_flags('CPPFLAGS') conf.add_os_flags('LINKFLAGS') def cc_load_tools(conf): conf.check_tool('cc') def cxx_load_tools(conf): conf.check_tool('cxx') conf(ret_msg) conf(validate_cfg) conf(cmd_and_log) conf(exec_cfg) conf(check_cfg) conf(validate_c) conf(post_check) conf(check) conf(run_c_code) conf(check_cxx) conf(check_cc) conf(define) conf(undefine) conf(define_cond) conf(is_defined) conf(get_define) conf(have_define) conf(write_config_header) conf(get_config_header) conftest(find_cpp) conftest(cc_add_flags) conftest(cxx_add_flags) conftest(cc_load_tools) conftest(cxx_load_tools) libdesktop-agnostic-0.3.92/wafadmin/Tools/qt4.py0000644000175000017510000003015511226437331021013 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 try: from xml.sax import make_parser from xml.sax.handler import ContentHandler except ImportError: has_xml=False ContentHandler=object else: has_xml=True import os,sys import ccroot,cxx import TaskGen,Task,Utils,Runner,Options,Node from TaskGen import taskgen,feature,after,extension from Logs import error from Constants import* MOC_H=['.h','.hpp','.hxx','.hh'] EXT_RCC=['.qrc'] EXT_UI=['.ui'] EXT_QT4=['.cpp','.cc','.cxx','.C'] class qxx_task(Task.Task): before=['cxx_link','ar_link_static'] def __init__(self,*k,**kw): Task.Task.__init__(self,*k,**kw) self.moc_done=0 def scan(self): (nodes,names)=ccroot.scan(self) for x in nodes: if x.name.endswith('.moc'): nodes.remove(x) names.append(x.relpath_gen(self.inputs[0].parent)) return(nodes,names) def runnable_status(self): if self.moc_done: for t in self.run_after: if not t.hasrun: return ASK_LATER self.signature() return Task.Task.runnable_status(self) else: for t in self.run_after: if not t.hasrun: return ASK_LATER self.add_moc_tasks() return ASK_LATER def add_moc_tasks(self): node=self.inputs[0] tree=node.__class__.bld try: self.signature() except KeyError: pass else: delattr(self,'cache_sig') moctasks=[] mocfiles=[] variant=node.variant(self.env) try: tmp_lst=tree.raw_deps[self.unique_id()] tree.raw_deps[self.unique_id()]=[] except KeyError: tmp_lst=[] for d in tmp_lst: if not d.endswith('.moc'):continue if d in mocfiles: error("paranoia owns") continue mocfiles.append(d) ext='' try:ext=Options.options.qt_header_ext except AttributeError:pass if not ext: base2=d[:-4] paths=[node.parent.srcpath(self.env),node.parent.bldpath(self.env)] poss=[(x,y)for x in MOC_H for y in paths] for(i,path)in poss: try: os.stat(os.path.join(path,base2+i)) except OSError: pass else: ext=i break if not ext:raise Utils.WafError("no header found for %s which is a moc file"%str(d)) h_node=node.parent.find_resource(base2+i) m_node=h_node.change_ext('.moc') tree.node_deps[(self.inputs[0].parent.id,self.env.variant(),m_node.name)]=h_node task=Task.TaskBase.classes['moc'](self.env,normal=0) task.set_inputs(h_node) task.set_outputs(m_node) generator=tree.generator generator.outstanding.insert(0,task) generator.total+=1 moctasks.append(task) tmp_lst=tree.raw_deps[self.unique_id()]=mocfiles lst=tree.node_deps.get(self.unique_id(),()) for d in lst: name=d.name if name.endswith('.moc'): task=Task.TaskBase.classes['moc'](self.env,normal=0) task.set_inputs(tree.node_deps[(self.inputs[0].parent.id,self.env.variant(),name)]) task.set_outputs(d) generator=tree.generator generator.outstanding.insert(0,task) generator.total+=1 moctasks.append(task) self.run_after=moctasks self.moc_done=1 run=Task.TaskBase.classes['cxx'].__dict__['run'] def translation_update(task): outs=[a.abspath(task.env)for a in task.outputs] outs=" ".join(outs) lupdate=task.env['QT_LUPDATE'] for x in task.inputs: file=x.abspath(task.env) cmd="%s %s -ts %s"%(lupdate,file,outs) Utils.pprint('BLUE',cmd) task.generator.bld.exec_command(cmd) class XMLHandler(ContentHandler): def __init__(self): self.buf=[] self.files=[] def startElement(self,name,attrs): if name=='file': self.buf=[] def endElement(self,name): if name=='file': self.files.append(''.join(self.buf)) def characters(self,cars): self.buf.append(cars) def scan(self): node=self.inputs[0] parser=make_parser() curHandler=XMLHandler() parser.setContentHandler(curHandler) fi=open(self.inputs[0].abspath(self.env)) parser.parse(fi) fi.close() nodes=[] names=[] root=self.inputs[0].parent for x in curHandler.files: x=x.encode('utf8') nd=root.find_resource(x) if nd:nodes.append(nd) else:names.append(x) return(nodes,names) def create_rcc_task(self,node): rcnode=node.change_ext('_rc.cpp') rcctask=self.create_task('rcc') rcctask.inputs=[node] rcctask.outputs=[rcnode] cpptask=self.create_task('cxx') cpptask.inputs=[rcnode] cpptask.outputs=[rcnode.change_ext('.o')] self.compiled_tasks.append(cpptask) return cpptask def create_uic_task(self,node): uictask=self.create_task('ui4') uictask.inputs=[node] uictask.outputs=[self.path.find_or_declare(self.env['ui_PATTERN']%node.name[:-3])] class qt4_taskgen(cxx.cxx_taskgen): def __init__(self,*k,**kw): cxx.cxx_taskgen.__init__(self,*k,**kw) self.features.append('qt4') def add_lang(self,node): self.lang=self.to_list(getattr(self,'lang',[]))+[node] def apply_qt4(self): if getattr(self,'lang',None): update=getattr(self,'update',None) lst=[] trans=[] for l in self.to_list(self.lang): if not isinstance(l,Node.Node): l=self.path.find_resource(l+'.ts') t=self.create_task('ts2qm') t.set_inputs(l) t.set_outputs(l.change_ext('.qm')) lst.append(t.outputs[0]) if update: trans.append(t.inputs[0]) if update and Options.options.trans_qt4: u=Task.TaskCmd(translation_update,self.env,2) u.inputs=[a.inputs[0]for a in self.compiled_tasks] u.outputs=trans if getattr(self,'langname',None): t=Task.TaskBase.classes['qm2rcc'](self.env) t.set_inputs(lst) t.set_outputs(self.path.find_or_declare(self.langname+'.qrc')) t.path=self.path k=create_rcc_task(self,t.outputs[0]) self.link_task.inputs.append(k.outputs[0]) lst=[] for flag in self.to_list(self.env['CXXFLAGS']): if len(flag)<2:continue if flag[0:2]=='-D'or flag[0:2]=='-I': lst.append(flag) self.env['MOC_FLAGS']=lst def cxx_hook(self,node): task=self.create_task('qxx') self.compiled_tasks.append(task) try:obj_ext=self.obj_ext except AttributeError:obj_ext='_%d.o'%self.idx task.inputs=[node] task.outputs=[node.change_ext(obj_ext)] def process_qm2rcc(task): outfile=task.outputs[0].abspath(task.env) f=open(outfile,'w') f.write('\n\n') for k in task.inputs: f.write(' ') f.write(k.path_to_parent(task.path)) f.write('\n') f.write('\n') f.close() b=Task.simple_task_type b('moc','${QT_MOC} ${MOC_FLAGS} ${SRC} ${MOC_ST} ${TGT}',color='BLUE',vars=['QT_MOC','MOC_FLAGS'],shell=False) cls=b('rcc','${QT_RCC} -name ${SRC[0].name} ${SRC[0].abspath(env)} ${RCC_ST} -o ${TGT}',color='BLUE',before='cxx moc qxx_task',after="qm2rcc",shell=False) cls.scan=scan b('ui4','${QT_UIC} ${SRC} -o ${TGT}',color='BLUE',before='cxx moc qxx_task',shell=False) b('ts2qm','${QT_LRELEASE} ${QT_LRELEASE_FLAGS} ${SRC} -qm ${TGT}',color='BLUE',before='qm2rcc',shell=False) Task.task_type_from_func('qm2rcc',vars=[],func=process_qm2rcc,color='BLUE',before='rcc',after='ts2qm') def detect_qt4(conf): env=conf.env opt=Options.options qtdir=getattr(opt,'qtdir','') qtbin=getattr(opt,'qtbin','') qtlibs=getattr(opt,'qtlibs','') useframework=getattr(opt,'use_qt4_osxframework',True) if qtbin: paths=[qtbin] if not qtdir: qtdir=conf.environ.get('QT4_ROOT','') qtbin=os.path.join(qtdir,'bin') paths=[qtbin] if not qtdir: paths=os.environ.get('PATH','').split(os.pathsep) paths.append('/usr/share/qt4/bin/') try: lst=os.listdir('/usr/local/Trolltech/') except OSError: pass else: if lst: lst.sort() lst.reverse() qtdir='/usr/local/Trolltech/%s/'%lst[0] qtbin=os.path.join(qtdir,'bin') paths.append(qtbin) cand=None prev_ver=['4','0','0'] for qmk in['qmake-qt4','qmake4','qmake']: qmake=conf.find_program(qmk,path_list=paths) if qmake: version=Utils.cmd_output([qmake,'-query','QT_VERSION']).strip() if version: new_ver=version.split('.') if new_ver>prev_ver: cand=qmake prev_ver=new_ver if cand: qmake=cand else: conf.fatal('could not find qmake for qt4') conf.env.QMAKE=qmake qtincludes=Utils.cmd_output([qmake,'-query','QT_INSTALL_HEADERS']).strip() qtdir=Utils.cmd_output([qmake,'-query','QT_INSTALL_PREFIX']).strip()+os.sep qtbin=Utils.cmd_output([qmake,'-query','QT_INSTALL_BINS']).strip()+os.sep if not qtlibs: try: qtlibs=Utils.cmd_output([qmake,'-query','QT_LIBRARIES']).strip()+os.sep except ValueError: qtlibs=os.path.join(qtdir,'lib') def find_bin(lst,var): for f in lst: ret=conf.find_program(f,path_list=paths) if ret: env[var]=ret break vars="QtCore QtGui QtUiTools QtNetwork QtOpenGL QtSql QtSvg QtTest QtXml QtWebKit Qt3Support".split() framework_ok=False if sys.platform=="darwin"and useframework: for i in vars: e=conf.create_framework_configurator() e.path=[qtlibs,'/Library/Frameworks'] e.name=i e.remove_dot_h=True e.run() if not i=='QtCore': for r in env['CCFLAGS_'+i.upper()]: if r.startswith('-F'): env['CCFLAGS_'+i.upper()].remove(r) break if conf.is_defined('HAVE_QTOPENGL'): env.append_unique('FRAMEWORK_QTOPENGL','OpenGL') if conf.is_defined('HAVE_QTGUI'): env.append_unique('FRAMEWORK_QTGUI',['AppKit','ApplicationServices']) framework_ok=True if not conf.is_defined("HAVE_QTGUI"): if not qtincludes:qtincludes=os.path.join(qtdir,'include') env.QTINCLUDEPATH=qtincludes lst=[qtincludes,'/usr/share/qt4/include/','/opt/qt4/include'] conf.check(header_name='QtGui/QFont',define_name='HAVE_QTGUI',mandatory=1,includes=lst) find_bin(['uic-qt3','uic3'],'QT_UIC3') find_bin(['uic-qt4','uic'],'QT_UIC') if not env['QT_UIC']: conf.fatal('cannot find the uic compiler for qt4') try: version=Utils.cmd_output(env['QT_UIC']+" -version 2>&1").strip() except ValueError: conf.fatal('your uic compiler is for qt3, add uic for qt4 to your path') version=version.replace('Qt User Interface Compiler ','') version=version.replace('User Interface Compiler for Qt','') if version.find(" 3.")!=-1: conf.check_message('uic version','(too old)',0,option='(%s)'%version) sys.exit(1) conf.check_message('uic version','',1,option='(%s)'%version) find_bin(['moc-qt4','moc'],'QT_MOC') find_bin(['rcc'],'QT_RCC') find_bin(['lrelease-qt4','lrelease'],'QT_LRELEASE') find_bin(['lupdate-qt4','lupdate'],'QT_LUPDATE') env['UIC3_ST']='%s -o %s' env['UIC_ST']='%s -o %s' env['MOC_ST']='-o' env['ui_PATTERN']='ui_%s.h' env['QT_LRELEASE_FLAGS']=['-silent'] if not framework_ok: vars_debug=[a+'_debug'for a in vars] pkgconfig=env['pkg-config']or'PKG_CONFIG_PATH=%s:%s/pkgconfig:/usr/lib/qt4/lib/pkgconfig:/opt/qt4/lib/pkgconfig:/usr/lib/qt4/lib:/opt/qt4/lib pkg-config --silence-errors'%(qtlibs,qtlibs) for i in vars_debug+vars: try: conf.check_cfg(package=i,args='--cflags --libs',path=pkgconfig) except ValueError: pass def process_lib(vars_,coreval): for d in vars_: var=d.upper() if var=='QTCORE':continue value=env['LIBPATH_'+var] if value: core=env[coreval] accu=[] for lib in value: if lib in core:continue accu.append(lib) env['LIBPATH_'+var]=accu process_lib(vars,'LIBPATH_QTCORE') process_lib(vars_debug,'LIBPATH_QTCORE_DEBUG') if Options.options.want_rpath: def process_rpath(vars_,coreval): for d in vars_: var=d.upper() value=env['LIBPATH_'+var] if value: core=env[coreval] accu=[] for lib in value: if var!='QTCORE': if lib in core: continue accu.append('-Wl,--rpath='+lib) env['RPATH_'+var]=accu process_rpath(vars,'LIBPATH_QTCORE') process_rpath(vars_debug,'LIBPATH_QTCORE_DEBUG') env['QTLOCALE']=str(env['PREFIX'])+'/share/locale' def detect(conf): detect_qt4(conf) def set_options(opt): opt.add_option('--want-rpath',type='int',default=1,dest='want_rpath',help='set rpath to 1 or 0 [Default 1]') opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext') for i in'qtdir qtbin qtlibs'.split(): opt.add_option('--'+i,type='string',default='',dest=i) if sys.platform=="darwin": opt.add_option('--no-qt4-framework',action="store_false",help='do not use the framework version of Qt4 in OS X',dest='use_qt4_osxframework',default=True) opt.add_option('--translate',action="store_true",help="collect translation strings",dest="trans_qt4",default=False) extension(EXT_RCC)(create_rcc_task) extension(EXT_UI)(create_uic_task) extension('.ts')(add_lang) feature('qt4')(apply_qt4) after('apply_link')(apply_qt4) extension(EXT_QT4)(cxx_hook) libdesktop-agnostic-0.3.92/wafadmin/Tools/tex.py0000644000175000017510000001306511226437331021104 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,re import Utils,TaskGen,Task,Runner,Build from TaskGen import feature,before from Logs import error,warn,debug re_tex=re.compile(r'\\(?Pinclude|input|import|bringin){(?P[^{}]*)}',re.M) def scan(self): node=self.inputs[0] env=self.env nodes=[] names=[] if not node:return(nodes,names) code=Utils.readf(node.abspath(env)) curdirnode=self.curdirnode abs=curdirnode.abspath() for match in re_tex.finditer(code): path=match.group('file') if path: for k in['','.tex','.ltx']: debug('tex: trying %s%s'%(path,k)) try: os.stat(abs+os.sep+path+k) except OSError: continue found=path+k node=curdirnode.find_resource(found) if node: nodes.append(node) else: debug('tex: could not find %s'%path) names.append(path) debug("tex: found the following : %s and names %s"%(nodes,names)) return(nodes,names) g_bibtex_re=re.compile('bibdata',re.M) def tex_build(task,command='LATEX'): env=task.env bld=task.generator.bld com='%s %s'%(env[command],env.get_flat(command+'FLAGS')) if not env['PROMPT_LATEX']:com="%s %s"%(com,'-interaction=batchmode') node=task.inputs[0] reldir=node.bld_dir(env) srcfile=node.srcpath(env) lst=[] for c in Utils.split_path(reldir): if c:lst.append('..') sr=os.path.join(*(lst+[srcfile])) sr2=os.path.join(*(lst+[node.parent.srcpath(env)])) aux_node=node.change_ext('.aux') idx_node=node.change_ext('.idx') hash='' old_hash='' nm=aux_node.name docuname=nm[:len(nm)-4] latex_compile_cmd='cd %s && TEXINPUTS=%s:$TEXINPUTS %s %s'%(reldir,sr2,com,sr) warn('first pass on %s'%command) ret=bld.exec_command(latex_compile_cmd) if ret:return ret try: ct=Utils.readf(aux_node.abspath(env)) except(OSError,IOError): error('error bibtex scan') else: fo=g_bibtex_re.findall(ct) if fo: bibtex_compile_cmd='cd %s && BIBINPUTS=%s:$BIBINPUTS %s %s'%(reldir,sr2,env['BIBTEX'],docuname) warn('calling bibtex') ret=bld.exec_command(bibtex_compile_cmd) if ret: error('error when calling bibtex %s'%bibtex_compile_cmd) return ret try: idx_path=idx_node.abspath(env) os.stat(idx_path) except OSError: error('error file.idx scan') else: makeindex_compile_cmd='cd %s && %s %s'%(reldir,env['MAKEINDEX'],idx_path) warn('calling makeindex') ret=bld.exec_command(makeindex_compile_cmd) if ret: error('error when calling makeindex %s'%makeindex_compile_cmd) return ret i=0 while i<10: i+=1 old_hash=hash try: hash=Utils.h_file(aux_node.abspath(env)) except KeyError: error('could not read aux.h -> %s'%aux_node.abspath(env)) pass if hash and hash==old_hash:break warn('calling %s'%command) ret=bld.exec_command(latex_compile_cmd) if ret: error('error when calling %s %s'%(command,latex_compile_cmd)) return ret return 0 latex_vardeps=['LATEX','LATEXFLAGS'] def latex_build(task): return tex_build(task,'LATEX') pdflatex_vardeps=['PDFLATEX','PDFLATEXFLAGS'] def pdflatex_build(task): return tex_build(task,'PDFLATEX') class tex_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def apply_tex(self): if not getattr(self,'type',None)in['latex','pdflatex']: self.type='pdflatex' tree=self.bld outs=Utils.to_list(getattr(self,'outs',[])) self.env['PROMPT_LATEX']=getattr(self,'prompt',1) deps_lst=[] if getattr(self,'deps',None): deps=self.to_list(self.deps) for filename in deps: n=self.path.find_resource(filename) if not n in deps_lst:deps_lst.append(n) self.source=self.to_list(self.source) for filename in self.source: base,ext=os.path.splitext(filename) node=self.path.find_resource(filename) if not node:raise Utils.WafError('cannot find %s'%filename) if self.type=='latex': task=self.create_task('latex') task.set_inputs(node) task.set_outputs(node.change_ext('.dvi')) elif self.type=='pdflatex': task=self.create_task('pdflatex') task.set_inputs(node) task.set_outputs(node.change_ext('.pdf')) task.env=self.env task.curdirnode=self.path if deps_lst: variant=node.variant(self.env) try: lst=tree.node_deps[task.unique_id()] for n in deps_lst: if not n in lst: lst.append(n) except KeyError: tree.node_deps[task.unique_id()]=deps_lst if self.type=='latex': if'ps'in outs: pstask=self.create_task('dvips') pstask.set_inputs(task.outputs) pstask.set_outputs(node.change_ext('.ps')) if'pdf'in outs: pdftask=self.create_task('dvipdf') pdftask.set_inputs(task.outputs) pdftask.set_outputs(node.change_ext('.pdf')) elif self.type=='pdflatex': if'ps'in outs: pstask=self.create_task('pdf2ps') pstask.set_inputs(task.outputs) pstask.set_outputs(node.change_ext('.ps')) self.source=[] def detect(conf): v=conf.env for p in'tex latex pdflatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split(): conf.find_program(p,var=p.upper()) v[p.upper()+'FLAGS']='' v['DVIPSFLAGS']='-Ppdf' b=Task.simple_task_type b('tex','${TEX} ${TEXFLAGS} ${SRC}',color='BLUE',shell=False) b('bibtex','${BIBTEX} ${BIBTEXFLAGS} ${SRC}',color='BLUE',shell=False) b('dvips','${DVIPS} ${DVIPSFLAGS} ${SRC} -o ${TGT}',color='BLUE',after="latex pdflatex tex bibtex",shell=False) b('dvipdf','${DVIPDF} ${DVIPDFFLAGS} ${SRC} ${TGT}',color='BLUE',after="latex pdflatex tex bibtex",shell=False) b('pdf2ps','${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}',color='BLUE',after="dvipdf pdflatex",shell=False) b=Task.task_type_from_func cls=b('latex',latex_build,vars=latex_vardeps) cls.scan=scan cls=b('pdflatex',pdflatex_build,vars=pdflatex_vardeps) cls.scan=scan feature('tex')(apply_tex) before('apply_core')(apply_tex) libdesktop-agnostic-0.3.92/wafadmin/Tools/python.py0000644000175000017510000002621411226437331021625 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys import TaskGen,Utils,Utils,Runner,Options,Build from Logs import debug,warn,info from TaskGen import extension,taskgen,before,after,feature from Configure import conf EXT_PY=['.py'] FRAG_2=''' #ifdef __cplusplus extern "C" { #endif void Py_Initialize(void); void Py_Finalize(void); #ifdef __cplusplus } #endif int main() { Py_Initialize(); Py_Finalize(); return 0; } ''' def init_pyext(self): self.default_install_path='${PYTHONDIR}' self.uselib=self.to_list(getattr(self,'uselib','')) if not'PYEXT'in self.uselib: self.uselib.append('PYEXT') self.env['MACBUNDLE']=True def pyext_shlib_ext(self): self.env['shlib_PATTERN']=self.env['pyext_PATTERN'] def init_pyembed(self): self.uselib=self.to_list(getattr(self,'uselib','')) if not'PYEMBED'in self.uselib: self.uselib.append('PYEMBED') def process_py(self,node): if self.bld.is_install and self.install_path: if not hasattr(self,'_py_installed_files'): self._py_installed_files=[] installed_files=self.bld.install_files(self.install_path,node.abspath(self.env),self.env,self.chmod) self._py_installed_files.extend(installed_files) def byte_compile_py(self): if self.bld.is_install and self.install_path: installed_files=self._py_installed_files if not installed_files: return if self.bld.is_install<0: info("* removing byte compiled python files") for fname in installed_files: try: os.remove(fname+'c') except OSError: pass try: os.remove(fname+'o') except OSError: pass if self.bld.is_install>0: if self.env['PYC']or self.env['PYO']: info("* byte compiling python files") if self.env['PYC']: program=(""" import sys, py_compile for pyfile in sys.argv[1:]: py_compile.compile(pyfile, pyfile + 'c') """) argv=[self.env['PYTHON'],"-c",program] argv.extend(installed_files) retval=Utils.pproc.Popen(argv).wait() if retval: raise Utils.WafError("bytecode compilation failed") if self.env['PYO']: program=(""" import sys, py_compile for pyfile in sys.argv[1:]: py_compile.compile(pyfile, pyfile + 'o') """) argv=[self.env['PYTHON'],self.env['PYFLAGS_OPT'],"-c",program] argv.extend(installed_files) retval=Utils.pproc.Popen(argv).wait() if retval: raise Utils.WafError("bytecode compilation failed") class py_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def init_py(self): self.default_install_path='${PYTHONDIR}' def _get_python_variables(python_exe,variables,imports=['import sys']): program=list(imports) program.append('') for v in variables: program.append("print(repr(%s))"%v) os_env=dict(os.environ) try: del os_env['MACOSX_DEPLOYMENT_TARGET'] except KeyError: pass proc=Utils.pproc.Popen([python_exe,"-c",'\n'.join(program)],stdout=Utils.pproc.PIPE,env=os_env) output=proc.communicate()[0].split("\n") if proc.returncode: if Options.options.verbose: warn("Python program to extract python configuration variables failed:\n%s"%'\n'.join(["line %03i: %s"%(lineno+1,line)for lineno,line in enumerate(program)])) raise RuntimeError return_values=[] for s in output: s=s.strip() if not s: continue if s=='None': return_values.append(None) elif s[0]=="'"and s[-1]=="'": return_values.append(s[1:-1]) elif s[0].isdigit(): return_values.append(int(s)) else:break return return_values def check_python_headers(conf): if not conf.env['CC_NAME']and not conf.env['CXX_NAME']: conf.fatal('load a compiler first (gcc, g++, ..)') if not conf.env['PYTHON_VERSION']: conf.check_python_version() env=conf.env python=env['PYTHON'] assert python,("python is %r !"%(python,)) if Options.platform=='darwin': conf.check_tool('osx') try: v='prefix SO SYSLIBS LDFLAGS SHLIBS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET'.split() (python_prefix,python_SO,python_SYSLIBS,python_LDFLAGS,python_SHLIBS,python_LIBDIR,python_LIBPL,INCLUDEPY,Py_ENABLE_SHARED,python_MACOSX_DEPLOYMENT_TARGET)=_get_python_variables(python,["get_config_var('%s')"%x for x in v],['from distutils.sysconfig import get_config_var']) except RuntimeError: conf.fatal("Python development headers not found (-v for details).") conf.log.write("""Configuration returned from %r: python_prefix = %r python_SO = %r python_SYSLIBS = %r python_LDFLAGS = %r python_SHLIBS = %r python_LIBDIR = %r python_LIBPL = %r INCLUDEPY = %r Py_ENABLE_SHARED = %r MACOSX_DEPLOYMENT_TARGET = %r """%(python,python_prefix,python_SO,python_SYSLIBS,python_LDFLAGS,python_SHLIBS,python_LIBDIR,python_LIBPL,INCLUDEPY,Py_ENABLE_SHARED,python_MACOSX_DEPLOYMENT_TARGET)) if python_MACOSX_DEPLOYMENT_TARGET: conf.env['MACOSX_DEPLOYMENT_TARGET']=python_MACOSX_DEPLOYMENT_TARGET conf.environ['MACOSX_DEPLOYMENT_TARGET']=python_MACOSX_DEPLOYMENT_TARGET env['pyext_PATTERN']='%s'+python_SO if python_SYSLIBS is not None: for lib in python_SYSLIBS.split(): if lib.startswith('-l'): lib=lib[2:] env.append_value('LIB_PYEMBED',lib) if python_SHLIBS is not None: for lib in python_SHLIBS.split(): if lib.startswith('-l'): lib=lib[2:] env.append_value('LIB_PYEMBED',lib) if Options.platform!='darwin'and python_LDFLAGS: env.append_value('LINKFLAGS_PYEMBED',python_LDFLAGS.split()) result=False name='python'+env['PYTHON_VERSION'] if python_LIBDIR is not None: path=[python_LIBDIR] conf.log.write("\n\n# Trying LIBDIR: %r\n"%path) result=conf.check(lib=name,uselib='PYEMBED',libpath=path) if not result and python_LIBPL is not None: conf.log.write("\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n") path=[python_LIBPL] result=conf.check(lib=name,uselib='PYEMBED',libpath=path) if not result: conf.log.write("\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n") path=[os.path.join(python_prefix,"libs")] name='python'+env['PYTHON_VERSION'].replace('.','') result=conf.check(lib=name,uselib='PYEMBED',libpath=path) if result: env['LIBPATH_PYEMBED']=path env.append_value('LIB_PYEMBED',name) else: conf.log.write("\n\n### LIB NOT FOUND\n") if(sys.platform=='win32'or sys.platform.startswith('os2')or sys.platform=='darwin'or Py_ENABLE_SHARED): env['LIBPATH_PYEXT']=env['LIBPATH_PYEMBED'] env['LIB_PYEXT']=env['LIB_PYEMBED'] python_config=conf.find_program('python%s-config'%('.'.join(env['PYTHON_VERSION'].split('.')[:2])),var='PYTHON_CONFIG') if not python_config: python_config=conf.find_program('python-config-%s'%('.'.join(env['PYTHON_VERSION'].split('.')[:2])),var='PYTHON_CONFIG') includes=[] if python_config: for incstr in Utils.cmd_output("%s %s --includes"%(python,python_config)).strip().split(): if(incstr.startswith('-I')or incstr.startswith('/I')): incstr=incstr[2:] if incstr not in includes: includes.append(incstr) conf.log.write("Include path for Python extensions ""(found via python-config --includes): %r\n"%(includes,)) env['CPPPATH_PYEXT']=includes env['CPPPATH_PYEMBED']=includes else: conf.log.write("Include path for Python extensions ""(found via distutils module): %r\n"%(INCLUDEPY,)) env['CPPPATH_PYEXT']=[INCLUDEPY] env['CPPPATH_PYEMBED']=[INCLUDEPY] if env['CC_NAME']=='gcc': env.append_value('CCFLAGS_PYEMBED','-fno-strict-aliasing') env.append_value('CCFLAGS_PYEXT','-fno-strict-aliasing') if env['CXX_NAME']=='gcc': env.append_value('CXXFLAGS_PYEMBED','-fno-strict-aliasing') env.append_value('CXXFLAGS_PYEXT','-fno-strict-aliasing') test_env=env.copy() a=test_env.append_value a('CPPPATH',env['CPPPATH_PYEMBED']) a('LIBPATH',env['LIBPATH_PYEMBED']) a('LIB',env['LIB_PYEMBED']) a('LINKFLAGS',env['LINKFLAGS_PYEMBED']) a('CXXFLAGS',env['CXXFLAGS_PYEMBED']) a('CCFLAGS',env['CCFLAGS_PYEMBED']) conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',env=test_env,fragment=FRAG_2,errmsg='Could not find the python development headers',mandatory=1) def check_python_version(conf,minver=None): assert minver is None or isinstance(minver,tuple) python=conf.env['PYTHON'] assert python,("python is %r !"%(python,)) cmd=[python,"-c","import sys\nfor x in sys.version_info: print(str(x))"] debug('python: Running python command %r'%cmd) proc=Utils.pproc.Popen(cmd,stdout=Utils.pproc.PIPE) lines=proc.communicate()[0].split() assert len(lines)==5,"found %i lines, expected 5: %r"%(len(lines),lines) pyver_tuple=(int(lines[0]),int(lines[1]),int(lines[2]),lines[3],int(lines[4])) result=(minver is None)or(pyver_tuple>=minver) if result: pyver='.'.join([str(x)for x in pyver_tuple[:2]]) conf.env['PYTHON_VERSION']=pyver if'PYTHONDIR'in conf.environ: pydir=conf.environ['PYTHONDIR'] else: if sys.platform=='win32': (python_LIBDEST,pydir)=_get_python_variables(python,["get_config_var('LIBDEST')","get_python_lib(standard_lib=0, prefix=%r)"%conf.env['PREFIX']],['from distutils.sysconfig import get_config_var, get_python_lib']) else: python_LIBDEST=None (pydir,)=_get_python_variables(python,["get_python_lib(standard_lib=0, prefix=%r)"%conf.env['PREFIX']],['from distutils.sysconfig import get_config_var, get_python_lib']) if python_LIBDEST is None: if conf.env['LIBDIR']: python_LIBDEST=os.path.join(conf.env['LIBDIR'],"python"+pyver) else: python_LIBDEST=os.path.join(conf.env['PREFIX'],"lib","python"+pyver) if hasattr(conf,'define'): conf.define('PYTHONDIR',pydir) conf.env['PYTHONDIR']=pydir pyver_full='.'.join(map(str,pyver_tuple[:3])) if minver is None: conf.check_message_custom('Python version','',pyver_full) else: minver_str='.'.join(map(str,minver)) conf.check_message('Python version',">= %s"%(minver_str,),result,option=pyver_full) if not result: conf.fatal("Python too old.") def check_python_module(conf,module_name): result=not Utils.pproc.Popen([conf.env['PYTHON'],"-c","import %s"%module_name],stderr=Utils.pproc.PIPE,stdout=Utils.pproc.PIPE).wait() conf.check_message('Python module',module_name,result) if not result: conf.fatal("Python module not found.") def detect(conf): python=conf.find_program('python',var='PYTHON') if not python:return v=conf.env v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' v['PYFLAGS']='' v['PYFLAGS_OPT']='-O' v['PYC']=getattr(Options.options,'pyc',1) v['PYO']=getattr(Options.options,'pyo',1) def set_options(opt): opt.add_option('--nopyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]',dest='pyc') opt.add_option('--nopyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]',dest='pyo') before('apply_incpaths','apply_lib_vars','apply_type_vars')(init_pyext) feature('pyext')(init_pyext) before('apply_bundle')(init_pyext) before('apply_link','apply_lib_vars','apply_type_vars')(pyext_shlib_ext) after('apply_bundle')(pyext_shlib_ext) feature('pyext')(pyext_shlib_ext) before('apply_incpaths','apply_lib_vars','apply_type_vars')(init_pyembed) feature('pyembed')(init_pyembed) extension(EXT_PY)(process_py) feature('py')(byte_compile_py) before('apply_core')(init_py) after('vars_target_cprogram','vars_target_cstaticlib')(init_py) feature('py')(init_py) conf(check_python_headers) conf(check_python_version) conf(check_python_module) libdesktop-agnostic-0.3.92/wafadmin/Tools/javaw.py0000644000175000017510000001064311226437332021414 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import os,re from Configure import conf import TaskGen,Task,Utils from TaskGen import feature,before,taskgen class_check_source=''' public class Test { public static void main(String[] argv) { Class lib; if (argv.length < 1) { System.err.println("Missing argument"); System.exit(77); } try { lib = Class.forName(argv[0]); } catch (ClassNotFoundException e) { System.err.println("ClassNotFoundException"); System.exit(1); } lib = null; System.exit(0); } } ''' def jar_files(self): basedir=getattr(self,'basedir','.') destfile=getattr(self,'destfile','test.jar') jaropts=getattr(self,'jaropts',[]) dir=self.path.find_dir(basedir) if not dir:raise jaropts.append('-C') jaropts.append(dir.abspath(self.env)) jaropts.append('.') out=self.path.find_or_declare(destfile) tsk=self.create_task('jar_create') tsk.set_outputs(out) tsk.inputs=[x for x in dir.find_iter(src=0,bld=1)if x.id!=out.id] tsk.env['JAROPTS']=jaropts tsk.env['JARCREATE']='cf' def apply_java(self): Utils.def_attrs(self,jarname='',jaropts='',classpath='',source_root='.',source_re='[A-Za-z0-9]+\.java$',jar_mf_attributes={},jar_mf_classpath=[]) nodes_lst=[] if not self.classpath: if not self.env['CLASSPATH']: self.env['CLASSPATH']='..'+os.pathsep+'.' else: self.env['CLASSPATH']=self.classpath source_root_node=self.path.find_dir(self.source_root) re_foo=re.compile(self.source_re) def acc(node,name): return re_foo.search(name)>-1 def prune(node,name): if name=='.svn':return True return False src_nodes=[x for x in source_root_node.find_iter_impl(dir=False,accept_name=acc,is_prune=prune)] bld_nodes=[x.change_ext('.class')for x in src_nodes] self.env['OUTDIR']=[source_root_node.abspath(self.env)] tsk=self.create_task('javac') tsk.set_inputs(src_nodes) tsk.set_outputs(bld_nodes) if self.jarname: tsk=self.create_task('jar_create') tsk.set_inputs(bld_nodes) tsk.set_outputs(self.path.find_or_declare(self.jarname)) if not self.env['JAROPTS']: if self.jaropts: self.env['JAROPTS']=self.jaropts else: dirs='.' self.env['JAROPTS']=['-C',''.join(self.env['OUTDIR']),dirs] Task.simple_task_type('jar_create','${JAR} ${JARCREATE} ${TGT} ${JAROPTS}',color='GREEN') cls=Task.simple_task_type('javac','${JAVAC} -classpath ${CLASSPATH} -d ${OUTDIR} ${JAVACFLAGS} ${SRC}') cls.color='BLUE' def post_run_javac(self): par={} for x in self.inputs: par[x.parent.id]=x.parent inner={} for k in par.values(): path=k.abspath(self.env) lst=os.listdir(path) for u in lst: if u.find('$')>=0: inner_class_node=k.find_or_declare(u) inner[inner_class_node.id]=inner_class_node to_add=set(inner.keys())-set([x.id for x in self.outputs]) for x in to_add: self.outputs.append(inner[x]) return Task.Task.post_run(self) cls.post_run=post_run_javac def detect(conf): java_path=conf.environ['PATH'].split(os.pathsep) v=conf.env if'JAVA_HOME'in conf.environ: java_path=[os.path.join(conf.environ['JAVA_HOME'],'bin')]+java_path conf.env['JAVA_HOME']=[conf.environ['JAVA_HOME']] for x in'javac java jar'.split(): conf.find_program(x,var=x.upper(),path_list=java_path) conf.env[x.upper()]=conf.cmd_to_list(conf.env[x.upper()]) v['JAVA_EXT']=['.java'] if'CLASSPATH'in conf.environ: v['CLASSPATH']=conf.environ['CLASSPATH'] if not v['JAR']:conf.fatal('jar is required for making java packages') if not v['JAVAC']:conf.fatal('javac is required for compiling java classes') v['JARCREATE']='cf' def check_java_class(self,classname,with_classpath=None): import shutil javatestdir='.waf-javatest' classpath=javatestdir if self.env['CLASSPATH']: classpath+=os.pathsep+self.env['CLASSPATH'] if isinstance(with_classpath,str): classpath+=os.pathsep+with_classpath shutil.rmtree(javatestdir,True) os.mkdir(javatestdir) java_file=open(os.path.join(javatestdir,'Test.java'),'w') java_file.write(class_check_source) java_file.close() Utils.exec_command(self.env['JAVAC']+[os.path.join(javatestdir,'Test.java')],shell=False) cmd=self.env['JAVA']+['-cp',classpath,'Test',classname] self.log.write("%s\n"%str(cmd)) found=Utils.exec_command(cmd,shell=False,log=self.log) self.check_message('Java class %s'%classname,"",not found) shutil.rmtree(javatestdir,True) return found feature('jar')(jar_files) before('apply_core')(jar_files) feature('javac')(apply_java) before('apply_core')(apply_java) conf(check_java_class) libdesktop-agnostic-0.3.92/wafadmin/Tools/ocaml.py0000644000175000017510000002054111226437331021374 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,re import TaskGen,Utils,Task,Build from Logs import error from TaskGen import taskgen,feature,before,after,extension EXT_MLL=['.mll'] EXT_MLY=['.mly'] EXT_MLI=['.mli'] EXT_MLC=['.c'] EXT_ML=['.ml'] open_re=re.compile('^\s*open\s+([a-zA-Z]+)(;;){0,1}$',re.M) foo=re.compile(r"""(\(\*)|(\*\))|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^()*"'\\]*)""",re.M) def filter_comments(txt): meh=[0] def repl(m): if m.group(1):meh[0]+=1 elif m.group(2):meh[0]-=1 elif not meh[0]:return m.group(0) return'' return foo.sub(repl,txt) def scan(self): node=self.inputs[0] code=filter_comments(node.read(self.env)) global open_re names=[] import_iterator=open_re.finditer(code) if import_iterator: for import_match in import_iterator: names.append(import_match.group(1)) found_lst=[] raw_lst=[] for name in names: nd=None for x in self.incpaths: nd=x.find_resource(name.lower()+'.ml') if not nd:nd=x.find_resource(name+'.ml') if nd: found_lst.append(nd) break else: raw_lst.append(name) return(found_lst,raw_lst) native_lst=['native','all','c_object'] bytecode_lst=['bytecode','all'] class ocaml_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def init_ml(self): Utils.def_attrs(self,type='all',incpaths_lst=[],bld_incpaths_lst=[],mlltasks=[],mlytasks=[],mlitasks=[],native_tasks=[],bytecode_tasks=[],linktasks=[],bytecode_env=None,native_env=None,compiled_tasks=[],includes='',uselib='',are_deps_set=0) def init_envs_ml(self): self.islibrary=getattr(self,'islibrary',False) global native_lst,bytecode_lst self.native_env=None if self.type in native_lst: self.native_env=self.env.copy() if self.islibrary:self.native_env['OCALINKFLAGS']='-a' self.bytecode_env=None if self.type in bytecode_lst: self.bytecode_env=self.env.copy() if self.islibrary:self.bytecode_env['OCALINKFLAGS']='-a' if self.type=='c_object': self.native_env.append_unique('OCALINKFLAGS_OPT','-output-obj') def apply_incpaths_ml(self): inc_lst=self.includes.split() lst=self.incpaths_lst for dir in inc_lst: node=self.path.find_dir(dir) if not node: error("node not found: "+str(dir)) continue self.bld.rescan(node) if not node in lst:lst.append(node) self.bld_incpaths_lst.append(node) def apply_vars_ml(self): for i in self.incpaths_lst: if self.bytecode_env: app=self.bytecode_env.append_value app('OCAMLPATH','-I') app('OCAMLPATH',i.srcpath(self.env)) app('OCAMLPATH','-I') app('OCAMLPATH',i.bldpath(self.env)) if self.native_env: app=self.native_env.append_value app('OCAMLPATH','-I') app('OCAMLPATH',i.bldpath(self.env)) app('OCAMLPATH','-I') app('OCAMLPATH',i.srcpath(self.env)) varnames=['INCLUDES','OCAMLFLAGS','OCALINKFLAGS','OCALINKFLAGS_OPT'] for name in self.uselib.split(): for vname in varnames: cnt=self.env[vname+'_'+name] if cnt: if self.bytecode_env:self.bytecode_env.append_value(vname,cnt) if self.native_env:self.native_env.append_value(vname,cnt) def apply_link_ml(self): if self.bytecode_env: ext=self.islibrary and'.cma'or'.run' linktask=self.create_task('ocalink') linktask.bytecode=1 linktask.set_outputs(self.path.find_or_declare(self.target+ext)) linktask.obj=self linktask.env=self.bytecode_env self.linktasks.append(linktask) if self.native_env: if self.type=='c_object':ext='.o' elif self.islibrary:ext='.cmxa' else:ext='' linktask=self.create_task('ocalinkx') linktask.set_outputs(self.path.find_or_declare(self.target+ext)) linktask.obj=self linktask.env=self.native_env self.linktasks.append(linktask) self.compiled_tasks.append(linktask) def mll_hook(self,node): mll_task=self.create_task('ocamllex',self.native_env) mll_task.set_inputs(node) mll_task.set_outputs(node.change_ext('.ml')) self.mlltasks.append(mll_task) self.allnodes.append(mll_task.outputs[0]) def mly_hook(self,node): mly_task=self.create_task('ocamlyacc',self.native_env) mly_task.set_inputs(node) mly_task.set_outputs([node.change_ext('.ml'),node.change_ext('.mli')]) self.mlytasks.append(mly_task) self.allnodes.append(mly_task.outputs[0]) task=self.create_task('ocamlcmi',self.native_env) task.set_inputs(mly_task.outputs[1]) task.set_outputs(mly_task.outputs[1].change_ext('.cmi')) def mli_hook(self,node): task=self.create_task('ocamlcmi',self.native_env) task.set_inputs(node) task.set_outputs(node.change_ext('.cmi')) self.mlitasks.append(task) def mlc_hook(self,node): task=self.create_task('ocamlcc',self.native_env) task.set_inputs(node) task.set_outputs(node.change_ext('.o')) self.compiled_tasks.append(task) def ml_hook(self,node): if self.native_env: task=self.create_task('ocamlx',self.native_env) task.set_inputs(node) task.set_outputs(node.change_ext('.cmx')) task.obj=self task.incpaths=self.bld_incpaths_lst self.native_tasks.append(task) if self.bytecode_env: task=self.create_task('ocaml',self.bytecode_env) task.set_inputs(node) task.obj=self task.bytecode=1 task.incpaths=self.bld_incpaths_lst task.set_outputs(node.change_ext('.cmo')) self.bytecode_tasks.append(task) def compile_may_start(self): if not getattr(self,'flag_deps',''): self.flag_deps=1 if getattr(self,'bytecode',''):alltasks=self.obj.bytecode_tasks else:alltasks=self.obj.native_tasks self.signature() tree=self.generator.bld env=self.env for node in self.inputs: lst=tree.node_deps[self.unique_id()] for depnode in lst: for t in alltasks: if t==self:continue if depnode in t.inputs: self.set_run_after(t) delattr(self,'cache_sig') self.signature() return Task.Task.runnable_status(self) b=Task.simple_task_type cls=b('ocamlx','${OCAMLOPT} ${OCAMLPATH} ${OCAMLFLAGS} ${INCLUDES} -c -o ${TGT} ${SRC}',color='GREEN',shell=False) cls.runnable_status=compile_may_start cls.scan=scan b=Task.simple_task_type cls=b('ocaml','${OCAMLC} ${OCAMLPATH} ${OCAMLFLAGS} ${INCLUDES} -c -o ${TGT} ${SRC}',color='GREEN',shell=False) cls.runnable_status=compile_may_start cls.scan=scan b('ocamlcmi','${OCAMLC} ${OCAMLPATH} ${INCLUDES} -o ${TGT} -c ${SRC}',color='BLUE',before="ocaml ocamlcc ocamlx") b('ocamlcc','cd ${TGT[0].bld_dir(env)} && ${OCAMLOPT} ${OCAMLFLAGS} ${OCAMLPATH} ${INCLUDES} -c ${SRC[0].abspath(env)}',color='GREEN') b('ocamllex','${OCAMLLEX} ${SRC} -o ${TGT}',color='BLUE',before="ocamlcmi ocaml ocamlcc") b('ocamlyacc','${OCAMLYACC} -b ${TGT[0].bld_base(env)} ${SRC}',color='BLUE',before="ocamlcmi ocaml ocamlcc") def link_may_start(self): if not getattr(self,'order',''): if getattr(self,'bytecode',0):alltasks=self.obj.bytecode_tasks else:alltasks=self.obj.native_tasks seen=[] pendant=[]+alltasks while pendant: task=pendant.pop(0) if task in seen:continue for x in task.run_after: if not x in seen: pendant.append(task) break else: seen.append(task) self.inputs=[x.outputs[0]for x in seen] self.order=1 return Task.Task.runnable_status(self) act=b('ocalink','${OCAMLC} -o ${TGT} ${INCLUDES} ${OCALINKFLAGS} ${SRC}',color='YELLOW',after="ocaml ocamlcc") act.runnable_status=link_may_start act=b('ocalinkx','${OCAMLOPT} -o ${TGT} ${INCLUDES} ${OCALINKFLAGS_OPT} ${SRC}',color='YELLOW',after="ocamlx ocamlcc") act.runnable_status=link_may_start def detect(conf): opt=conf.find_program('ocamlopt',var='OCAMLOPT') occ=conf.find_program('ocamlc',var='OCAMLC') if(not opt)or(not occ): conf.fatal('The objective caml compiler was not found:\ninstall it or make it available in your PATH') conf.env['OCAMLC']=occ conf.env['OCAMLOPT']=opt conf.env['OCAMLLEX']=conf.find_program('ocamllex',var='OCAMLLEX') conf.env['OCAMLYACC']=conf.find_program('ocamlyacc',var='OCAMLYACC') conf.env['OCAMLFLAGS']='' conf.env['OCAMLLIB']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep conf.env['LIBPATH_OCAML']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep conf.env['CPPPATH_OCAML']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep conf.env['LIB_OCAML']='camlrun' feature('ocaml')(init_ml) feature('ocaml')(init_envs_ml) after('init_ml')(init_envs_ml) feature('ocaml')(apply_incpaths_ml) before('apply_vars_ml')(apply_incpaths_ml) after('init_envs_ml')(apply_incpaths_ml) feature('ocaml')(apply_vars_ml) before('apply_core')(apply_vars_ml) feature('ocaml')(apply_link_ml) after('apply_core')(apply_link_ml) extension(EXT_MLL)(mll_hook) extension(EXT_MLY)(mly_hook) extension(EXT_MLI)(mli_hook) extension(EXT_MLC)(mlc_hook) extension(EXT_ML)(ml_hook) libdesktop-agnostic-0.3.92/wafadmin/Tools/gnome.py0000644000175000017510000001460111226437331021406 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,re import TaskGen,Utils,Runner,Task,Build,Options,Logs import cc from Logs import error from TaskGen import taskgen,before,after,feature n1_regexp=re.compile('(.*)',re.M) n2_regexp=re.compile('(.*)',re.M) def postinstall_schemas(prog_name): if Build.bld.is_install: dir=Build.bld.get_install_path('${PREFIX}/etc/gconf/schemas/%s.schemas'%prog_name) if not Options.options.destdir: Utils.pprint('YELLOW','Installing GConf schema') command='gconftool-2 --install-schema-file=%s 1> /dev/null'%dir ret=Utils.exec_command(command) else: Utils.pprint('YELLOW','GConf schema not installed. After install, run this:') Utils.pprint('YELLOW','gconftool-2 --install-schema-file=%s'%dir) def postinstall_icons(): dir=Build.bld.get_install_path('${DATADIR}/icons/hicolor') if Build.bld.is_install: if not Options.options.destdir: Utils.pprint('YELLOW',"Updating Gtk icon cache.") command='gtk-update-icon-cache -q -f -t %s'%dir ret=Utils.exec_command(command) else: Utils.pprint('YELLOW','Icon cache not updated. After install, run this:') Utils.pprint('YELLOW','gtk-update-icon-cache -q -f -t %s'%dir) def postinstall_scrollkeeper(prog_name): if Build.bld.is_install: if os.access('/var/log/scrollkeeper.log',os.W_OK): dir1=Build.bld.get_install_path('${PREFIX}/var/scrollkeeper') dir2=Build.bld.get_install_path('${DATADIR}/omf/%s'%prog_name) command='scrollkeeper-update -q -p %s -o %s'%(dir1,dir2) ret=Utils.exec_command(command) def postinstall(prog_name='myapp',schemas=1,icons=1,scrollkeeper=1): if schemas:postinstall_schemas(prog_name) if icons:postinstall_icons() if scrollkeeper:postinstall_scrollkeeper(prog_name) class gnome_doc_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def init_gnome_doc(self): self.default_install_path='${PREFIX}/share' def apply_gnome_doc(self): self.env['APPNAME']=self.doc_module lst=self.to_list(self.doc_linguas) bld=self.bld for x in lst: tsk=self.create_task('xml2po') node=self.path.find_resource(x+'/'+x+'.po') src=self.path.find_resource('C/%s.xml'%self.doc_module) out=self.path.find_or_declare('%s/%s.xml'%(x,self.doc_module)) tsk.set_inputs([node,src]) tsk.set_outputs(out) tsk2=self.create_task('xsltproc2po') out2=self.path.find_or_declare('%s/%s-%s.omf'%(x,self.doc_module,x)) tsk2.set_outputs(out2) node=self.path.find_resource(self.doc_module+".omf.in") tsk2.inputs=[node,out] tsk2.run_after.append(tsk) if bld.is_install: path=self.install_path+'gnome/help/%s/%s'%(self.doc_module,x) bld.install_files(self.install_path+'omf',out2.abspath(self.env)) for y in self.to_list(self.doc_figures): try: os.stat(self.path.abspath()+'/'+x+'/'+y) bld.install_as(path+'/'+y,self.path.abspath()+'/'+x+'/'+y) except: bld.install_as(path+'/'+y,self.path.abspath()+'/C/'+y) bld.install_as(path+'/%s.xml'%self.doc_module,out.abspath(self.env)) class xml_to_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def init_xml_to(self): Utils.def_attrs(self,source='xmlfile',xslt='xlsltfile',target='hey',default_install_path='${PREFIX}',task_created=None) def apply_xml_to(self): xmlfile=self.path.find_resource(self.source) xsltfile=self.path.find_resource(self.xslt) tsk=self.create_task('xmlto') tsk.set_inputs([xmlfile,xsltfile]) tsk.set_outputs(xmlfile.change_ext('html')) tsk.install_path=self.install_path def sgml_scan(self): node=self.inputs[0] env=self.env variant=node.variant(env) fi=open(node.abspath(env),'r') content=fi.read() fi.close() name=n1_regexp.findall(content)[0] num=n2_regexp.findall(content)[0] doc_name=name+'.'+num if not self.outputs: self.outputs=[self.generator.path.find_or_declare(doc_name)] return([],[doc_name]) class gnome_sgml2man_taskgen(TaskGen.task_gen): def __init__(self,*k,**kw): TaskGen.task_gen.__init__(self,*k,**kw) def apply_gnome_sgml2man(self): assert(getattr(self,'appname',None)) def install_result(task): out=task.outputs[0] name=out.name ext=name[-1] env=task.env self.bld.install_files('${DATADIR}/man/man%s/'%ext,out.abspath(env),env) self.bld.rescan(self.path) for name in self.bld.cache_dir_contents[self.path.id]: base,ext=os.path.splitext(name) if ext!='.sgml':continue task=self.create_task('sgml2man') task.set_inputs(self.path.find_resource(name)) task.task_generator=self if self.bld.is_install:task.install=install_result task.scan() cls=Task.simple_task_type('sgml2man','${SGML2MAN} -o ${TGT[0].bld_dir(env)} ${SRC} > /dev/null',color='BLUE') cls.scan=sgml_scan cls.quiet=1 Task.simple_task_type('xmlto','${XMLTO} html -m ${SRC[1].abspath(env)} ${SRC[0].abspath(env)}') Task.simple_task_type('xml2po','${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',color='BLUE') xslt_magic="""${XSLTPROC2PO} -o ${TGT[0].abspath(env)} \ --stringparam db2omf.basename ${APPNAME} \ --stringparam db2omf.format docbook \ --stringparam db2omf.lang C \ --stringparam db2omf.dtd '-//OASIS//DTD DocBook XML V4.3//EN' \ --stringparam db2omf.omf_dir ${PREFIX}/share/omf \ --stringparam db2omf.help_dir ${PREFIX}/share/gnome/help \ --stringparam db2omf.omf_in ${SRC[0].abspath(env)} \ --stringparam db2omf.scrollkeeper_cl ${SCROLLKEEPER_DATADIR}/Templates/C/scrollkeeper_cl.xml \ ${DB2OMF} ${SRC[1].abspath(env)}""" Task.simple_task_type('xsltproc2po',xslt_magic,color='BLUE') def detect(conf): conf.check_tool('gnu_dirs glib2 dbus') sgml2man=conf.find_program('docbook2man',var='SGML2MAN') def getstr(varname): return getattr(Options.options,varname,'') conf.define('GNOMELOCALEDIR',os.path.join(conf.env['DATADIR'],'locale')) xml2po=conf.find_program('xml2po',var='XML2PO') xsltproc2po=conf.find_program('xsltproc',var='XSLTPROC2PO') conf.env['XML2POFLAGS']='-e -p' conf.env['SCROLLKEEPER_DATADIR']=Utils.cmd_output("scrollkeeper-config --pkgdatadir",silent=1).strip() conf.env['DB2OMF']=Utils.cmd_output("/usr/bin/pkg-config --variable db2omf gnome-doc-utils",silent=1).strip() def set_options(opt): opt.add_option('--want-rpath',type='int',default=1,dest='want_rpath',help='set rpath to 1 or 0 [Default 1]') feature('gnome_doc')(init_gnome_doc) feature('gnome_doc')(apply_gnome_doc) after('init_gnome_doc')(apply_gnome_doc) feature('xml_to')(init_xml_to) feature('xml_to')(apply_xml_to) after('init_xml_to')(apply_xml_to) feature('gnome_sgml2man')(apply_gnome_sgml2man) libdesktop-agnostic-0.3.92/wafadmin/Tools/preproc.py0000644000175000017510000003752011226437331021760 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import re,sys,os,string import Logs,Build,Utils from Logs import debug,error import traceback class PreprocError(Utils.WafError): pass POPFILE='-' go_absolute=0 standard_includes=['/usr/include'] if sys.platform=="win32": standard_includes=[] use_trigraphs=0 'apply the trigraph rules first' strict_quotes=0 g_optrans={'not':'!','and':'&&','bitand':'&','and_eq':'&=','or':'||','bitor':'|','or_eq':'|=','xor':'^','xor_eq':'^=','compl':'~',} re_lines=re.compile('^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*)\r*$',re.IGNORECASE|re.MULTILINE) re_mac=re.compile("^[a-zA-Z_]\w*") re_fun=re.compile('^[a-zA-Z_][a-zA-Z0-9_]*[(]') re_pragma_once=re.compile('^\s*once\s*',re.IGNORECASE) re_nl=re.compile('\\\\\r*\n',re.MULTILINE) re_cpp=re.compile(r"""(/\*[^*]*\*+([^/*][^*]*\*+)*/)|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)""",re.MULTILINE) trig_def=[('??'+a,b)for a,b in zip("=-/!'()<>",r'#~\|^[]{}')] chr_esc={'0':0,'a':7,'b':8,'t':9,'n':10,'f':11,'v':12,'r':13,'\\':92,"'":39} NUM='i' OP='O' IDENT='T' STR='s' CHAR='c' tok_types=[NUM,STR,IDENT,OP] exp_types=[r"""0[xX](?P[a-fA-F0-9]+)(?P[uUlL]*)|L*?'(?P(\\.|[^\\'])+)'|(?P\d+)[Ee](?P[+-]*?\d+)(?P[fFlL]*)|(?P\d*\.\d+)([Ee](?P[+-]*?\d+))?(?P[fFlL]*)|(?P\d+\.\d*)([Ee](?P[+-]*?\d+))?(?P[fFlL]*)|(?P0*)(?P\d+)(?P[uUlL]*)""",r'L?"([^"\\]|\\.)*"',r'[a-zA-Z_]\w*',r'%:%:|<<=|>>=|\.\.\.|<<|<%|<:|<=|>>|>=|\+\+|\+=|--|->|-=|\*=|/=|%:|%=|%>|==|&&|&=|\|\||\|=|\^=|:>|!=|##|[\(\)\{\}\[\]<>\?\|\^\*\+&=:!#;,%/\-\?\~\.]',] re_clexer=re.compile('|'.join(["(?P<%s>%s)"%(name,part)for name,part in zip(tok_types,exp_types)]),re.M) accepted='a' ignored='i' undefined='u' skipped='s' def repl(m): s=m.group(1) if s is not None:return' ' s=m.group(3) if s is None:return'' return s def filter_comments(filename): code=Utils.readf(filename) if use_trigraphs: for(a,b)in trig_def:code=code.split(a).join(b) code=re_nl.sub('',code) code=re_cpp.sub(repl,code) return[(m.group(2),m.group(3))for m in re.finditer(re_lines,code)] prec={} ops=['* / %','+ -','<< >>','< <= >= >','== !=','& | ^','&& ||',','] for x in range(len(ops)): syms=ops[x] for u in syms.split(): prec[u]=x def reduce_nums(val_1,val_2,val_op): try:a=0+val_1 except TypeError:a=int(val_1) try:b=0+val_2 except TypeError:b=int(val_2) d=val_op if d=='%':c=a%b elif d=='+':c=a+b elif d=='-':c=a-b elif d=='*':c=a*b elif d=='/':c=a/b elif d=='^':c=a^b elif d=='|':c=a|b elif d=='||':c=int(a or b) elif d=='&':c=a&b elif d=='&&':c=int(a and b) elif d=='==':c=int(a==b) elif d=='!=':c=int(a!=b) elif d=='<=':c=int(a<=b) elif d=='<':c=int(a':c=int(a>b) elif d=='>=':c=int(a>=b) elif d=='^':c=int(a^b) elif d=='<<':c=a<>':c=a>>b else:c=0 return c def get_num(lst): if not lst:raise PreprocError("empty list for get_num") (p,v)=lst[0] if p==OP: if v=='(': count_par=1 i=1 while i=prec[v]: num2=reduce_nums(num,num2,v) return get_term([(NUM,num2)]+lst) else: num3,lst=get_num(lst[1:]) num3=reduce_nums(num2,num3,v2) return get_term([(NUM,num),(p,v),(NUM,num3)]+lst) raise PreprocError("cannot reduce %r"%lst) def reduce_eval(lst): num,lst=get_term(lst) return(NUM,num) def stringize(lst): lst=[str(v2)for(p2,v2)in lst] return"".join(lst) def paste_tokens(t1,t2): p1=None if t1[0]==OP and t2[0]==OP: p1=OP elif t1[0]==IDENT and(t2[0]==IDENT or t2[0]==NUM): p1=IDENT elif t1[0]==NUM and t2[0]==NUM: p1=NUM if not p1: raise PreprocError('tokens do not make a valid paste %r and %r'%(t1,t2)) return(p1,t1[1]+t2[1]) def reduce_tokens(lst,defs,ban=[]): i=0 while i=len(lst): raise PreprocError("expected '(' after %r (got nothing)"%v) (p2,v2)=lst[i] if p2!=OP or v2!='(': raise PreprocError("expected '(' after %r"%v) del lst[i] one_param=[] count_paren=0 while i1: (p3,v3)=accu[-1] (p4,v4)=accu[-2] if v3=='##': accu.pop() if v4==','and pt.*)>|"(?P.*)")') def extract_include(txt,defs): m=re_include.search(txt) if m: if m.group('a'):return'<',m.group('a') if m.group('b'):return'"',m.group('b') toks=tokenize(txt) reduce_tokens(toks,defs,['waf_include']) if not toks: raise PreprocError("could not parse include %s"%txt) if len(toks)==1: if toks[0][0]==STR: return'"',toks[0][1] else: if toks[0][1]=='<'and toks[-1][1]=='>': return stringize(toks).lstrip('<').rstrip('>') raise PreprocError("could not parse include %s."%txt) def parse_char(txt): if not txt:raise PreprocError("attempted to parse a null char") if txt[0]!='\\': return ord(txt) c=txt[1] if c=='x': if len(txt)==4 and txt[3]in string.hexdigits:return int(txt[2:],16) return int(txt[2:],16) elif c.isdigit(): if c=='0'and len(txt)==2:return 0 for i in 3,2,1: if len(txt)>i and txt[1:1+i].isdigit(): return(1+i,int(txt[1:1+i],8)) else: try:return chr_esc[c] except KeyError:raise PreprocError("could not parse char literal '%s'"%txt) def tokenize(s): ret=[] for match in re_clexer.finditer(s): m=match.group for name in tok_types: v=m(name) if v: if name==IDENT: try:v=g_optrans[v];name=OP except KeyError: if v.lower()=="true": v=1 name=NUM elif v.lower()=="false": v=0 name=NUM elif name==NUM: if m('oct'):v=int(v,8) elif m('hex'):v=int(m('hex'),16) elif m('n0'):v=m('n0') else: v=m('char') if v:v=parse_char(v) else:v=m('n2')or m('n4') elif name==OP: if v=='%:':v='#' elif v=='%:%:':v='##' elif name==STR: v=v[1:-1] ret.append((name,v)) break return ret class c_parser(object): def __init__(self,nodepaths=None,defines=None): self.lines=[] if defines is None: self.defs={} else: self.defs=dict(defines) self.state=[] self.env=None self.count_files=0 self.currentnode_stack=[] self.nodepaths=nodepaths or[] self.nodes=[] self.names=[] self.curfile='' self.ban_includes=[] def tryfind(self,filename): self.curfile=filename found=self.currentnode_stack[-1].find_resource(filename) for n in self.nodepaths: if found: break found=n.find_resource(filename) if not found: if not filename in self.names: self.names.append(filename) else: self.nodes.append(found) if filename[-4:]!='.moc': self.addlines(found) return found def addlines(self,node): self.currentnode_stack.append(node.parent) filepath=node.abspath(self.env) self.count_files+=1 if self.count_files>30000:raise PreprocError("recursion limit exceeded") pc=self.parse_cache debug('preproc: reading file %r'%filepath) try: lns=pc[filepath] except KeyError: pass else: self.lines=lns+self.lines return try: lines=filter_comments(filepath) lines.append((POPFILE,'')) pc[filepath]=lines self.lines=lines+self.lines except IOError: raise PreprocError("could not read the file %s"%filepath) except Exception: if Logs.verbose>0: error("parsing %s failed"%filepath) traceback.print_exc() def start(self,node,env): debug('preproc: scanning %s (in %s)'%(node.name,node.parent.name)) self.env=env variant=node.variant(env) bld=node.__class__.bld try: self.parse_cache=bld.parse_cache except AttributeError: bld.parse_cache={} self.parse_cache=bld.parse_cache self.addlines(node) if env['DEFLINES']: self.lines=[('define',x)for x in env['DEFLINES']]+self.lines while self.lines: (kind,line)=self.lines.pop(0) if kind==POPFILE: self.currentnode_stack.pop() continue try: self.process_line(kind,line) except Exception,e: if Logs.verbose: debug('preproc: line parsing failed (%s): %s %s'%(e,line,Utils.ex_stack())) def process_line(self,token,line): ve=Logs.verbose if ve:debug('preproc: line is %s - %s state is %s'%(token,line,self.state)) state=self.state if token in['ifdef','ifndef','if']: state.append(undefined) elif token=='endif': state.pop() if not token in['else','elif','endif']: if skipped in self.state or ignored in self.state: return if token=='if': ret=eval_macro(tokenize(line),self.defs) if ret:state[-1]=accepted else:state[-1]=ignored elif token=='ifdef': m=re_mac.search(line) if m and m.group(0)in self.defs:state[-1]=accepted else:state[-1]=ignored elif token=='ifndef': m=re_mac.search(line) if m and m.group(0)in self.defs:state[-1]=ignored else:state[-1]=accepted elif token=='include'or token=='import': (kind,inc)=extract_include(line,self.defs) if inc in self.ban_includes:return if token=='import':self.ban_includes.append(inc) if ve:debug('preproc: include found %s (%s) '%(inc,kind)) if kind=='"'or not strict_quotes: self.tryfind(inc) elif token=='elif': if state[-1]==accepted: state[-1]=skipped elif state[-1]==ignored: if eval_macro(tokenize(line),self.defs): state[-1]=accepted elif token=='else': if state[-1]==accepted:state[-1]=skipped elif state[-1]==ignored:state[-1]=accepted elif token=='define': m=re_mac.search(line) if m: name=m.group(0) if ve:debug('preproc: define %s %s'%(name,line)) self.defs[name]=line else: raise PreprocError("invalid define line %s"%line) elif token=='undef': m=re_mac.search(line) if m and m.group(0)in self.defs: self.defs.__delitem__(m.group(0)) elif token=='pragma': if re_pragma_once.search(line.lower()): self.ban_includes.append(self.curfile) def get_deps(node,env,nodepaths=[]): gruik=c_parser(nodepaths) gruik.start(node,env) return(gruik.nodes,gruik.names) re_inc=re.compile('^[ \t]*(#|%:)[ \t]*(include)[ \t]*(.*)\r*$',re.IGNORECASE|re.MULTILINE) def lines_includes(filename): code=Utils.readf(filename) if use_trigraphs: for(a,b)in trig_def:code=code.split(a).join(b) code=re_nl.sub('',code) code=re_cpp.sub(repl,code) return[(m.group(2),m.group(3))for m in re.finditer(re_inc,code)] def get_deps_simple(node,env,nodepaths=[],defines={}): nodes=[] names=[] def find_deps(node): lst=lines_includes(node.abspath(env)) for(_,line)in lst: (t,filename)=extract_include(line,defines) if filename in names: continue if filename.endswith('.moc'): names.append(filename) found=None for n in nodepaths: if found: break found=n.find_resource(filename) if not found: if not filename in names: names.append(filename) elif not found in nodes: nodes.append(found) find_deps(node) find_deps(node) return(nodes,names) libdesktop-agnostic-0.3.92/wafadmin/Tools/icpc.py0000644000175000017510000000125711226437331021222 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys import Configure,Options,Utils import ccroot,ar,gxx from Configure import conftest def find_icpc(conf): if sys.platform=='cygwin': conf.fatal('The Intel compiler does not work on Cygwin') v=conf.env cxx=None if v['CXX']:cxx=v['CXX'] elif'CXX'in conf.environ:cxx=conf.environ['CXX'] if not cxx:cxx=conf.find_program('icpc',var='CXX') if not cxx:conf.fatal('Intel C++ Compiler (icpc) was not found') cxx=conf.cmd_to_list(cxx) ccroot.get_cc_version(conf,cxx,icc=True) v['CXX']=cxx v['CXX_NAME']='icc' detect=''' find_icpc find_ar gxx_common_flags gxx_modifier_darwin cxx_load_tools cxx_add_flags ''' conftest(find_icpc) libdesktop-agnostic-0.3.92/wafadmin/Tools/UnitTest.py0000644000175000017510000001005611226437331022060 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys import Build,TaskGen,Utils,Options,Logs class unit_test(object): def __init__(self): self.returncode_ok=0 self.num_tests_ok=0 self.num_tests_failed=0 self.num_tests_err=0 self.total_num_tests=0 self.max_label_length=0 self.unit_tests=Utils.ordered_dict() self.unit_test_results={} self.unit_test_erroneous={} self.change_to_testfile_dir=False self.want_to_see_test_output=False self.want_to_see_test_error=False self.run_if_waf_does='check' def run(self): self.num_tests_ok=0 self.num_tests_failed=0 self.num_tests_err=0 self.total_num_tests=0 self.max_label_length=0 self.unit_tests=Utils.ordered_dict() self.unit_test_results={} self.unit_test_erroneous={} ld_library_path=[] if not Options.commands[self.run_if_waf_does]:return for obj in Build.bld.all_task_gen: try: link_task=obj.link_task except AttributeError: pass else: lib_path=link_task.outputs[0].parent.abspath(obj.env) if lib_path not in ld_library_path: ld_library_path.append(lib_path) unit_test=getattr(obj,'unit_test','') if unit_test and'cprogram'in obj.features: try: output=obj.path filename=os.path.join(output.abspath(obj.env),obj.target) srcdir=output.abspath() label=os.path.join(output.bldpath(obj.env),obj.target) self.max_label_length=max(self.max_label_length,len(label)) self.unit_tests[label]=(filename,srcdir) except KeyError: pass self.total_num_tests=len(self.unit_tests) Utils.pprint('GREEN','Running the unit tests') count=0 result=1 for label in self.unit_tests.allkeys: file_and_src=self.unit_tests[label] filename=file_and_src[0] srcdir=file_and_src[1] count+=1 line=Build.bld.progress_line(count,self.total_num_tests,Logs.colors.GREEN,Logs.colors.NORMAL) if Options.options.progress_bar and line: sys.stderr.write(line) sys.stderr.flush() try: kwargs={} kwargs['env']=os.environ.copy() if self.change_to_testfile_dir: kwargs['cwd']=srcdir if not self.want_to_see_test_output: kwargs['stdout']=Utils.pproc.PIPE if not self.want_to_see_test_error: kwargs['stderr']=Utils.pproc.PIPE if ld_library_path: if sys.platform=='win32': kwargs['env']['PATH']=';'.join(ld_library_path+[os.environ.get('PATH','')]) else: kwargs['env']['LD_LIBRARY_PATH']=':'.join(ld_library_path+[os.environ.get('LD_LIBRARY_PATH','')]) pp=Utils.pproc.Popen(filename,**kwargs) pp.wait() result=int(pp.returncode==self.returncode_ok) if result: self.num_tests_ok+=1 else: self.num_tests_failed+=1 self.unit_test_results[label]=result self.unit_test_erroneous[label]=0 except OSError: self.unit_test_erroneous[label]=1 self.num_tests_err+=1 except KeyboardInterrupt: pass if Options.options.progress_bar:sys.stdout.write(Logs.colors.cursor_on) def print_results(self): if not Options.commands[self.run_if_waf_does]:return p=Utils.pprint if self.total_num_tests==0: p('YELLOW','No unit tests present') return for label in self.unit_tests.allkeys: filename=self.unit_tests[label] err=0 result=0 try:err=self.unit_test_erroneous[label] except KeyError:pass try:result=self.unit_test_results[label] except KeyError:pass n=self.max_label_length-len(label) if err:n+=4 elif result:n+=7 else:n+=3 line='%s %s'%(label,'.'*n) if err:p('RED','%sERROR'%line) elif result:p('GREEN','%sOK'%line) else:p('YELLOW','%sFAILED'%line) percentage_ok=float(self.num_tests_ok)/float(self.total_num_tests)*100.0 percentage_failed=float(self.num_tests_failed)/float(self.total_num_tests)*100.0 percentage_erroneous=float(self.num_tests_err)/float(self.total_num_tests)*100.0 p('NORMAL',''' Successful tests: %i (%.1f%%) Failed tests: %i (%.1f%%) Erroneous tests: %i (%.1f%%) Total number of tests: %i '''%(self.num_tests_ok,percentage_ok,self.num_tests_failed,percentage_failed,self.num_tests_err,percentage_erroneous,self.total_num_tests)) p('GREEN','Unit tests finished') libdesktop-agnostic-0.3.92/wafadmin/Tools/ccroot.py0000644000175000017510000003224611226437331021577 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,re import TaskGen,Task,Utils,preproc,Logs,Build,Options from Logs import error,debug,warn from Utils import md5 from TaskGen import taskgen,after,before,feature from Constants import* try: from cStringIO import StringIO except ImportError: from io import StringIO import config_c USE_TOP_LEVEL=False win_platform=sys.platform in('win32','cygwin') def get_cc_version(conf,cc,gcc=False,icc=False): cmd=cc+['-dM','-E','-'] try: p=Utils.pproc.Popen(cmd,stdin=Utils.pproc.PIPE,stdout=Utils.pproc.PIPE,stderr=Utils.pproc.PIPE) p.stdin.write('\n') out=p.communicate()[0] except: conf.fatal('could not determine the compiler version %r'%cmd) out=str(out) if gcc: if out.find('__INTEL_COMPILER')>=0: conf.fatal('The intel compiler pretends to be gcc') if out.find('__GNUC__')<0: conf.fatal('Could not determine the compiler type') if icc and out.find('__INTEL_COMPILER')<0: conf.fatal('Not icc/icpc') k={} if icc or gcc: out=out.split('\n') import shlex for line in out: lst=shlex.split(line) if len(lst)>2: key=lst[1] val=lst[2] k[key]=val conf.env['CC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__']) return k class DEBUG_LEVELS: ULTRADEBUG="ultradebug" DEBUG="debug" RELEASE="release" OPTIMIZED="optimized" CUSTOM="custom" ALL=[ULTRADEBUG,DEBUG,RELEASE,OPTIMIZED,CUSTOM] def scan(self): debug('ccroot: _scan_preprocessor(self, node, env, path_lst)') if len(self.inputs)==1: node=self.inputs[0] (nodes,names)=preproc.get_deps(node,self.env,nodepaths=self.env['INC_PATHS']) if Logs.verbose: debug('deps: deps for %s: %r; unresolved %r'%(str(node),nodes,names)) return(nodes,names) all_nodes=[] all_names=[] seen=[] for node in self.inputs: (nodes,names)=preproc.get_deps(node,self.env,nodepaths=self.env['INC_PATHS']) if Logs.verbose: debug('deps: deps for %s: %r; unresolved %r'%(str(node),nodes,names)) for x in nodes: if id(x)in seen:continue seen.append(id(x)) all_nodes.append(x) for x in names: if not x in all_names: all_names.append(x) return(all_nodes,all_names) class ccroot_abstract(TaskGen.task_gen): def __init__(self,*k,**kw): if len(k)>1: k=list(k) if k[1][0]!='c': k[1]='c'+k[1] TaskGen.task_gen.__init__(self,*k,**kw) def get_target_name(self): tp='program' for x in self.features: if x in['cshlib','cstaticlib']: tp=x.lstrip('c') pattern=self.env[tp+'_PATTERN'] if not pattern:pattern='%s' dir,name=os.path.split(self.target) if win_platform and getattr(self,'vnum','')and'cshlib'in self.features: name=name+'-'+self.vnum.split('.')[0] return os.path.join(dir,pattern%name) def install_implib(self): bld=self.outputs[0].__class__.bld bindir=self.install_path if not len(self.outputs)==2: raise ValueError('fail') dll=self.outputs[0] bld.install_as(bindir+os.sep+dll.name,dll.abspath(self.env),chmod=self.chmod,env=self.env) implib=self.outputs[1] libdir='${LIBDIR}' if not self.env['LIBDIR']: libdir='${PREFIX}/lib' if sys.platform=='cygwin': bld.symlink_as(libdir+'/'+implib.name,bindir+os.sep+dll.name,env=self.env) else: bld.install_as(libdir+'/'+implib.name,implib.abspath(self.env),env=self.env) def install_shlib(self): bld=self.outputs[0].__class__.bld nums=self.vnum.split('.') path=self.install_path if not path:return libname=self.outputs[0].name name3=libname+'.'+self.vnum name2=libname+'.'+nums[0] name1=libname filename=self.outputs[0].abspath(self.env) bld.install_as(os.path.join(path,name3),filename,env=self.env) bld.symlink_as(os.path.join(path,name2),name3) bld.symlink_as(os.path.join(path,name1),name3) def default_cc(self): Utils.def_attrs(self,includes='',defines='',rpaths='',uselib='',uselib_local='',add_objects='',p_flag_vars=[],p_type_vars=[],compiled_tasks=[],link_task=None) def apply_verif(self): if not(self.source or getattr(self,'add_objects',None)): raise Utils.WafError('no source files specified for %s'%self) if not self.target: raise Utils.WafError('no target for %s'%self) def vars_target_cprogram(self): self.default_install_path=self.env['BINDIR']or'${PREFIX}/bin' self.default_chmod=O755 def vars_target_cstaticlib(self): self.default_install_path=self.env['LIBDIR']or'${PREFIX}/lib${LIB_EXT}' def vars_target_cshlib(self): if win_platform: self.default_install_path=self.env['BINDIR']or'${PREFIX}/bin' self.default_chmod=O755 else: self.default_install_path=self.env['LIBDIR']or'${PREFIX}/lib${LIB_EXT}' def install_target_cstaticlib(self): if not self.bld.is_install:return self.link_task.install_path=self.install_path def install_target_cshlib(self): if getattr(self,'vnum','')and not win_platform: self.link_task.vnum=self.vnum self.link_task.install=install_shlib def apply_incpaths(self): lst=[] for lib in self.to_list(self.uselib): for path in self.env['CPPPATH_'+lib]: if not path in lst: lst.append(path) if preproc.go_absolute: for path in preproc.standard_includes: if not path in lst: lst.append(path) for path in self.to_list(self.includes): if not path in lst: if preproc.go_absolute or not os.path.isabs(path): lst.append(path) else: self.env.prepend_value('CPPPATH',path) for path in lst: node=None if os.path.isabs(path): if preproc.go_absolute: node=self.bld.root.find_dir(path) elif path[0]=='#': node=self.bld.srcnode if len(path)>1: node=node.find_dir(path[1:]) else: node=self.path.find_dir(path) if node: self.env.append_value('INC_PATHS',node) if USE_TOP_LEVEL: self.env.append_value('INC_PATHS',self.bld.srcnode) def apply_type_vars(self): for x in self.features: if not x in['cprogram','cstaticlib','cshlib']: continue x=x.lstrip('c') st=self.env[x+'_USELIB'] if st:self.uselib=self.uselib+' '+st for var in self.p_type_vars: compvar='%s_%s'%(x,var) value=self.env[compvar] if value:self.env.append_value(var,value) def apply_link(self): link=getattr(self,'link',None) if not link: if'cstaticlib'in self.features:link='ar_link_static' elif'cxx'in self.features:link='cxx_link' else:link='cc_link' if'cshlib'in self.features: if win_platform: link='dll_'+link elif getattr(self,'vnum',''): if sys.platform=='darwin': self.vnum='' else: link='vnum_'+link tsk=self.create_task(link) outputs=[t.outputs[0]for t in self.compiled_tasks] tsk.set_inputs(outputs) tsk.set_outputs(self.path.find_or_declare(get_target_name(self))) tsk.chmod=self.chmod self.link_task=tsk def apply_lib_vars(self): env=self.env uselib=self.to_list(self.uselib) seen=[] names=self.to_list(self.uselib_local)[:] while names: x=names.pop(0) if x in seen: continue y=self.name_to_obj(x) if not y: raise Utils.WafError("object '%s' was not found in uselib_local (required by '%s')"%(x,self.name)) if getattr(y,'uselib_local',None): lst=y.to_list(y.uselib_local) for u in lst: if not u in seen: names.append(u) y.post() seen.append(x) libname=y.target[y.target.rfind(os.sep)+1:] if'cshlib'in y.features or'cprogram'in y.features: env.append_value('LIB',libname) elif'cstaticlib'in y.features: env.append_value('STATICLIB',libname) if y.link_task is not None: self.link_task.set_run_after(y.link_task) dep_nodes=getattr(self.link_task,'dep_nodes',[]) self.link_task.dep_nodes=dep_nodes+y.link_task.outputs tmp_path=y.link_task.outputs[0].parent.bldpath(self.env) if not tmp_path in env['LIBPATH']:env.prepend_value('LIBPATH',tmp_path) morelibs=y.to_list(y.uselib) for v in morelibs: if v in uselib:continue uselib=[v]+uselib if getattr(y,'export_incdirs',None): cpppath_st=self.env['CPPPATH_ST'] for x in self.to_list(y.export_incdirs): node=y.path.find_dir(x) if not node: raise Utils.WafError('object %s: invalid folder %s in export_incdirs'%(y.target,x)) self.env.append_unique('INC_PATHS',node) for x in uselib: for v in self.p_flag_vars: val=self.env[v+'_'+x] if val:self.env.append_value(v,val) def apply_objdeps(self): if not getattr(self,'add_objects',None):return seen=[] names=self.to_list(self.add_objects) while names: x=names[0] if x in seen: names=names[1:] continue y=self.name_to_obj(x) if not y: raise Utils.WafError("object '%s' was not found in uselib_local (required by add_objects '%s')"%(x,self.name)) if getattr(y,'add_objects',None): added=0 lst=y.to_list(y.add_objects) lst.reverse() for u in lst: if u in seen:continue added=1 names=[u]+names if added:continue y.post() seen.append(x) for t in y.compiled_tasks: self.link_task.inputs.extend(t.outputs) def apply_obj_vars(self): v=self.env lib_st=v['LIB_ST'] staticlib_st=v['STATICLIB_ST'] libpath_st=v['LIBPATH_ST'] staticlibpath_st=v['STATICLIBPATH_ST'] rpath_st=v['RPATH_ST'] app=v.append_unique if v['FULLSTATIC']: v.append_value('LINKFLAGS',v['FULLSTATIC_MARKER']) for i in v['RPATH']: if i and rpath_st: app('LINKFLAGS',rpath_st%i) for i in v['LIBPATH']: app('LINKFLAGS',libpath_st%i) app('LINKFLAGS',staticlibpath_st%i) if v['STATICLIB']: v.append_value('LINKFLAGS',v['STATICLIB_MARKER']) k=[(staticlib_st%i)for i in v['STATICLIB']] app('LINKFLAGS',k) if not v['FULLSTATIC']: if v['STATICLIB']or v['LIB']: v.append_value('LINKFLAGS',v['SHLIB_MARKER']) app('LINKFLAGS',[lib_st%i for i in v['LIB']]) def apply_vnum(self): if sys.platform not in('win32','cygwin','darwin'): try: nums=self.vnum.split('.') except AttributeError: pass else: try:name3=self.soname except AttributeError:name3=self.link_task.outputs[0].name+'.'+nums[0] self.link_task.outputs.append(self.link_task.outputs[0].parent.find_or_declare(name3)) self.env.append_value('LINKFLAGS',(self.env['SONAME_ST']%name3).split()) def apply_implib(self): if win_platform: dll=self.link_task.outputs[0] implib=dll.parent.find_or_declare(self.env['implib_PATTERN']%os.path.split(self.target)[1]) self.link_task.outputs.append(implib) if sys.platform=='cygwin': pass elif sys.platform=='win32': self.env.append_value('LINKFLAGS',(self.env['IMPLIB_ST']%implib.bldpath(self.env)).split()) self.link_task.install=install_implib def process_obj_files(self): if not hasattr(self,'obj_files'):return for x in self.obj_files: node=self.path.find_resource(x) self.link_task.inputs.append(node) def add_obj_file(self,file): if not hasattr(self,'obj_files'):self.obj_files=[] if not'process_obj_files'in self.meths:self.meths.append('process_obj_files') self.obj_files.append(file) c_attrs={'cxxflag':'CXXFLAGS','cflag':'CCFLAGS','ccflag':'CCFLAGS','linkflag':'LINKFLAGS','ldflag':'LINKFLAGS','lib':'LIB','libpath':'LIBPATH','staticlib':'STATICLIB','staticlibpath':'STATICLIBPATH','rpath':'RPATH','framework':'FRAMEWORK','frameworkpath':'FRAMEWORKPATH'} def add_extra_flags(self): for x in self.__dict__.keys(): y=x.lower() if y[-1]=='s': y=y[:-1] if c_attrs.get(y,None): self.env.append_unique(c_attrs[y],getattr(self,x)) def link_vnum(self): clsname=self.__class__.__name__.replace('vnum_','') out=self.outputs self.outputs=out[1:] ret=Task.TaskBase.classes[clsname].__dict__['run'](self) self.outputs=out if ret: return ret try: os.remove(self.outputs[0].abspath(self.env)) except OSError: pass try: os.symlink(self.outputs[1].name,self.outputs[0].bldpath(self.env)) except: return 1 def post_dll_link(self): if sys.platform=='cygwin': try: os.remove(self.outputs[1].abspath(self.env)) except OSError: pass try: os.symlink(self.outputs[0].name,self.outputs[1].bldpath(self.env)) except: return 1 feature('cc','cxx')(default_cc) before('apply_core')(default_cc) feature('cprogram','dprogram','cstaticlib','dstaticlib','cshlib','dshlib')(apply_verif) feature('cprogram','dprogram')(vars_target_cprogram) before('apply_core')(vars_target_cprogram) feature('cstaticlib','dstaticlib')(vars_target_cstaticlib) before('apply_core')(vars_target_cstaticlib) feature('cshlib','dshlib')(vars_target_cshlib) before('apply_core')(vars_target_cshlib) feature('cprogram','dprogram','cstaticlib','dstaticlib','cshlib','dshlib')(install_target_cstaticlib) after('apply_objdeps','apply_link')(install_target_cstaticlib) feature('cshlib','dshlib')(install_target_cshlib) after('apply_link')(install_target_cshlib) feature('cc','cxx')(apply_incpaths) after('apply_type_vars','apply_lib_vars','apply_core')(apply_incpaths) feature('cc','cxx')(apply_type_vars) after('init_cc','init_cxx')(apply_type_vars) before('apply_lib_vars')(apply_type_vars) feature('cprogram','cshlib','cstaticlib')(apply_link) after('apply_core')(apply_link) feature('cc','cxx')(apply_lib_vars) after('apply_link','init_cc','init_cxx')(apply_lib_vars) feature('cprogram','cstaticlib','cshlib')(apply_objdeps) after('apply_obj_vars','apply_vnum','apply_implib','apply_link')(apply_objdeps) feature('cprogram','cshlib','cstaticlib')(apply_obj_vars) after('apply_lib_vars')(apply_obj_vars) feature('cshlib')(apply_vnum) after('apply_link')(apply_vnum) before('apply_lib_vars')(apply_vnum) feature('implib')(apply_implib) after('apply_link')(apply_implib) before('apply_lib_vars')(apply_implib) after('apply_link')(process_obj_files) taskgen(add_obj_file) feature('cc','cxx')(add_extra_flags) before('init_cxx','init_cc')(add_extra_flags) before('apply_lib_vars','apply_obj_vars','apply_incpaths','init_cc')(add_extra_flags) libdesktop-agnostic-0.3.92/wafadmin/Tools/compiler_cxx.py0000644000175000017510000000304611226437331022776 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,imp,types,ccroot import optparse import Utils,Configure,Options from Logs import debug cxx_compiler={'win32':['msvc','g++'],'cygwin':['g++'],'darwin':['g++'],'aix5':['g++'],'linux':['g++','icpc','sunc++'],'sunos':['g++','sunc++'],'irix':['g++'],'hpux':['g++'],'default':['g++']} def __list_possible_compiler(platform): try: return(cxx_compiler[platform]) except KeyError: return(cxx_compiler["default"]) def detect(conf): try:test_for_compiler=Options.options.check_cxx_compiler except AttributeError:raise Configure.ConfigurationError("Add set_options(opt): opt.tool_options('compiler_cxx')") for compiler in test_for_compiler.split(): try: conf.check_tool(compiler) except Configure.ConfigurationError,e: debug('compiler_cxx: %r'%e) else: if conf.env['CXX']: conf.check_message(compiler,'',True) conf.env['COMPILER_CXX']=compiler break conf.check_message(compiler,'',False) def set_options(opt): detected_platform=Options.platform possible_compiler_list=__list_possible_compiler(detected_platform) test_for_compiler=str(" ").join(possible_compiler_list) cxx_compiler_opts=opt.add_option_group("C++ Compiler Options") cxx_compiler_opts.add_option('--check-cxx-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C++ Compiler will be checked by default: "%s"'%(detected_platform,test_for_compiler),dest="check_cxx_compiler") for cxx_compiler in test_for_compiler.split(): opt.tool_options('%s'%cxx_compiler,option_group=cxx_compiler_opts) libdesktop-agnostic-0.3.92/wafadmin/Tools/perl.py0000644000175000017510000000574111226437331021250 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os import Task,Options,Utils from Configure import conf from TaskGen import extension,taskgen,feature,before xsubpp_str='${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}' EXT_XS=['.xs'] def init_perlext(self): self.uselib=self.to_list(getattr(self,'uselib','')) if not'PERL'in self.uselib:self.uselib.append('PERL') if not'PERLEXT'in self.uselib:self.uselib.append('PERLEXT') self.env['shlib_PATTERN']=self.env['perlext_PATTERN'] def xsubpp_file(self,node): gentask=self.create_task('xsubpp') gentask.set_inputs(node) outnode=node.change_ext('.c') gentask.set_outputs(outnode) self.allnodes.append(outnode) Task.simple_task_type('xsubpp',xsubpp_str,color='BLUE',before="cc cxx",shell=False) def check_perl_version(conf,minver=None): res=True if not getattr(Options.options,'perlbinary',None): perl=conf.find_program("perl",var="PERL") if not perl: return False else: perl=Options.options.perlbinary conf.env['PERL']=perl version=Utils.cmd_output(perl+" -e'printf \"%vd\", $^V'") if not version: res=False version="Unknown" elif not minver is None: ver=tuple(map(int,version.split("."))) if ver #include int main() { std::cout << BOOST_VERSION << std::endl; } ''' boost_libpath=['/usr/lib','/usr/local/lib','/opt/local/lib','/sw/lib','/lib'] boost_cpppath=['/usr/include','/usr/local/include','/opt/local/include','/sw/include'] STATIC_NOSTATIC='nostatic' STATIC_BOTH='both' STATIC_ONLYSTATIC='onlystatic' is_versiontag=re.compile('^\d+_\d+_?\d*$') is_threadingtag=re.compile('^mt$') is_abitag=re.compile('^[sgydpn]+$') is_toolsettag=re.compile('^(acc|borland|como|cw|dmc|darwin|gcc|hp_cxx|intel|kylix|vc|mgw|qcc|sun|vacpp)\d*$') def set_options(opt): opt.add_option('--boost-includes',type='string',default='',dest='boostincludes',help='path to the boost directory where the includes are e.g. /usr/local/include/boost-1_35') opt.add_option('--boost-libs',type='string',default='',dest='boostlibs',help='path to the directory where the boost libs are e.g. /usr/local/lib') def string_to_version(s): version=s.split('.') if len(version)<3:return 0 return int(version[0])*100000+int(version[1])*100+int(version[2]) def version_string(version): major=version/100000 minor=version/100%1000 minor_minor=version%100 if minor_minor==0: return"%d_%d"%(major,minor) else: return"%d_%d_%d"%(major,minor,minor_minor) def libfiles(lib,pattern,lib_paths): result=[] for lib_path in lib_paths: libname=pattern%('boost_'+lib+'*') result+=glob.glob(lib_path+'/'+libname) return result def get_boost_version_number(self,dir): try: return self.run_c_code(compiler='cxx',code=boost_code,includes=dir,execute=1,env=self.env.copy(),type='cprogram',compile_mode='cxx',compile_filename='test.cpp') except Configure.ConfigurationError,e: return-1 def set_default(kw,var,val): if not var in kw: kw[var]=val def tags_score(tags,kw): score=0 needed_tags={'threading':kw['tag_threading'],'abi':kw['tag_abi'],'toolset':kw['tag_toolset'],'version':kw['tag_version']} if kw['tag_toolset']is None: v=kw['env'] toolset=v['CXX_NAME'] if v['CXX_VERSION']: version_no=v['CXX_VERSION'].split('.') toolset+=version_no[0] if len(version_no)>1: toolset+=version_no[1] needed_tags['toolset']=toolset found_tags={} for tag in tags: if is_versiontag.match(tag):found_tags['version']=tag if is_threadingtag.match(tag):found_tags['threading']=tag if is_abitag.match(tag):found_tags['abi']=tag if is_toolsettag.match(tag):found_tags['toolset']=tag for tagname in needed_tags.iterkeys(): if needed_tags[tagname]is not None and tagname in found_tags: if re.compile(needed_tags[tagname]).match(found_tags[tagname]): score+=kw['score_'+tagname][0] else: score+=kw['score_'+tagname][1] return score def validate_boost(self,kw): ver=kw.get('version','') for x in'min_version max_version version'.split(): set_default(kw,x,ver) set_default(kw,'lib','') kw['lib']=Utils.to_list(kw['lib']) set_default(kw,'env',self.env) set_default(kw,'libpath',boost_libpath) set_default(kw,'cpppath',boost_cpppath) for x in'tag_threading tag_version tag_toolset'.split(): set_default(kw,x,None) set_default(kw,'tag_abi','^[^d]*$') set_default(kw,'score_threading',(10,-10)) set_default(kw,'score_abi',(10,-10)) set_default(kw,'score_toolset',(1,-1)) set_default(kw,'score_version',(100,-100)) set_default(kw,'score_min',0) set_default(kw,'static',STATIC_NOSTATIC) set_default(kw,'found_includes',False) set_default(kw,'min_score',0) set_default(kw,'errmsg','not found') set_default(kw,'okmsg','ok') def find_boost_includes(self,kw): boostPath=getattr(Options.options,'boostincludes','') if boostPath: boostPath=[os.path.normpath(os.path.expandvars(os.path.expanduser(boostPath)))] else: boostPath=Utils.to_list(kw['cpppath']) min_version=string_to_version(kw.get('min_version','')) max_version=string_to_version(kw.get('max_version',''))or(sys.maxint-1) version=0 for include_path in boostPath: boost_paths=glob.glob(os.path.join(include_path,'boost*')) for path in boost_paths: pathname=os.path.split(path)[-1] ret=-1 if pathname=='boost': path=include_path ret=self.get_boost_version_number(path) elif pathname.startswith('boost-'): ret=self.get_boost_version_number(path) ret=int(ret) if ret!=-1 and ret>=min_version and ret<=max_version and ret>version: boost_path=path version=ret if not version: self.fatal('boost headers not found! (required version min: %s max: %s)'%(kw['min_version'],kw['max_version'])) return False found_version=version_string(version) versiontag='^'+found_version+'$' if kw['tag_version']is None: kw['tag_version']=versiontag elif kw['tag_version']!=versiontag: warn('boost header version %r and tag_version %r do not match!'%(versiontag,kw['tag_version'])) env=self.env env['CPPPATH_BOOST']=boost_path env['BOOST_VERSION']=found_version self.found_includes=1 ret='Version %s (%s)'%(found_version,boost_path) return ret def find_boost_library(self,lib,kw): def find_library_from_list(lib,files): lib_pattern=re.compile('.*boost_(.*?)\..*') result=(None,None) resultscore=kw['min_score']-1 for file in files: m=lib_pattern.search(file,1) if m: libname=m.group(1) libtags=libname.split('-')[1:] currentscore=tags_score(libtags,kw) if currentscore>resultscore: result=(libname,file) resultscore=currentscore return result lib_paths=getattr(Options.options,'boostlibs','') if lib_paths: lib_paths=[os.path.normpath(os.path.expandvars(os.path.expanduser(lib_paths)))] else: lib_paths=Utils.to_list(kw['libpath']) v=kw.get('env',self.env) (libname,file)=(None,None) if kw['static']in[STATIC_NOSTATIC,STATIC_BOTH]: st_env_prefix='LIB' files=libfiles(lib,v['shlib_PATTERN'],lib_paths) (libname,file)=find_library_from_list(lib,files) if libname is None and kw['static']in[STATIC_ONLYSTATIC,STATIC_BOTH]: st_env_prefix='STATICLIB' staticLibPattern=v['staticlib_PATTERN'] if self.env['CC_NAME']=='msvc': staticLibPattern='lib'+staticLibPattern files=libfiles(lib,staticLibPattern,lib_paths) (libname,file)=find_library_from_list(lib,files) if libname is not None: v['LIBPATH_BOOST_'+lib.upper()]=[os.path.split(file)[0]] if self.env['CC_NAME']=='msvc'and os.path.splitext(file)[1]=='.lib': v[st_env_prefix+'_BOOST_'+lib.upper()]=['libboost_'+libname] else: v[st_env_prefix+'_BOOST_'+lib.upper()]=['boost_'+libname] return self.fatal('lib boost_'+lib+' not found!') def check_boost(self,*k,**kw): self.validate_boost(kw) ret=None try: if not kw.get('found_includes',None): self.check_message_1(kw.get('msg_includes','boost headers')) ret=self.find_boost_includes(kw) except Configure.ConfigurationError,e: if'errmsg'in kw: self.check_message_2(kw['errmsg'],'YELLOW') if'mandatory'in kw: if Logs.verbose>1: raise else: self.fatal('the configuration failed (see %r)'%self.log.name) else: if'okmsg'in kw: self.check_message_2(kw.get('okmsg_includes',ret)) for lib in kw['lib']: self.check_message_1('library boost_'+lib) try: self.find_boost_library(lib,kw) except Configure.ConfigurationError,e: ret=False if'errmsg'in kw: self.check_message_2(kw['errmsg'],'YELLOW') if'mandatory'in kw: if Logs.verbose>1: raise else: self.fatal('the configuration failed (see %r)'%self.log.name) else: if'okmsg'in kw: self.check_message_2(kw['okmsg']) return ret conf(get_boost_version_number) conf(validate_boost) conf(find_boost_includes) conf(find_boost_library) conf(check_boost) libdesktop-agnostic-0.3.92/wafadmin/Tools/compiler_d.py0000644000175000017510000000151711226437331022420 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,imp,types import Utils,Configure,Options def detect(conf): if getattr(Options.options,'check_dmd_first',None): test_for_compiler=['dmd','gdc'] else: test_for_compiler=['gdc','dmd'] for d_compiler in test_for_compiler: conf.check_tool(d_compiler) if conf.env['D_COMPILER']: conf.check_message("%s"%d_compiler,'',True) conf.env["COMPILER_D"]=d_compiler return conf.check_message("%s"%d_compiler,'',False) def set_options(opt): d_compiler_opts=opt.add_option_group("D Compiler Options") d_compiler_opts.add_option('--check-dmd-first',action="store_true",help='checks for the gdc compiler before dmd (default is the other way round)',dest='check_dmd_first',default=False) for d_compiler in['gdc','dmd']: opt.tool_options('%s'%d_compiler,option_group=d_compiler_opts) libdesktop-agnostic-0.3.92/data/desktop-agnostic.ini.in0000664000175000017510000000014111536677677022361 0ustar seagleseagle[DEFAULT] config = @CONFIG_BACKEND@ vfs = @VFS_BACKEND@ desktop-entry = @DESKTOP_ENTRY_BACKEND@ libdesktop-agnostic-0.3.92/data/wscript0000664000175000017510000000323211536677677017417 0ustar seagleseagle#!/usr/bin/env python # encoding: utf-8 import Options import Utils import misc def set_options(opt): opt.add_option('--with-glade', action='store_true', dest='glade', default=False, help='Installs the Glade catalog for the ' \ 'desktop-agnostic GTK widgets.') def configure(conf): conf.env['GLADE_SUPPORT'] = Options.options.glade if conf.env['GLADE_SUPPORT']: conf.check_cfg(package='gladeui-1.0', uselib_store='GLADEUI', mandatory=True, args='--cflags --libs') pkgconfig = 'pkg-config --variable catalogdir gladeui-1.0' conf.env['GLADEUI_CATALOGDIR'] = \ Utils.cmd_output(pkgconfig, silent=1).strip() def build(bld): pc = bld.new_task_gen('subst') pc.source = 'desktop-agnostic.pc.in' pc.target = 'desktop-agnostic.pc' pc.dict = { 'API_VERSION': bld.env['API_VERSION'], 'LIBDIR': bld.env['LIBDIR'], 'VERSION': bld.env['VERSION'], 'prefix': bld.env['PREFIX'], 'datarootdir': bld.env['DATADIR'], } pc.fun = misc.subst_func pc.install_path = '${LIBDIR}/pkgconfig' ini = bld.new_task_gen('subst') ini.source = 'desktop-agnostic.ini.in' ini.target = 'desktop-agnostic.ini' ini.dict = { 'CONFIG_BACKEND': bld.env['BACKENDS_CFG'][0], 'VFS_BACKEND': bld.env['BACKENDS_VFS'][0], 'DESKTOP_ENTRY_BACKEND': bld.env['BACKENDS_DE'][0], } ini.fun = misc.subst_func ini.install_path = '${SYSCONFDIR}/xdg/libdesktop-agnostic' if bld.env['GLADE_SUPPORT']: bld.install_files('${GLADEUI_CATALOGDIR}', 'desktop-agnostic.xml') libdesktop-agnostic-0.3.92/data/desktop-agnostic.xml0000664000175000017510000000120411536677677021776 0ustar seagleseagle libdesktop-agnostic-0.3.92/data/desktop-agnostic.pc.in0000664000175000017510000000074211536677677022213 0ustar seagleseagleprefix=@prefix@ exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include defsdir=@datarootdir@/pygtk/2.0/defs vapidir=@datarootdir@/vala/vapi Name: libdesktop-agnostic Description: GLib-based desktop-agnostic library Version: @VERSION@ Libs: -L${libdir} -ldesktop-agnostic -ldesktop-agnostic-vfs -ldesktop-agnostic-cfg -ldesktop-agnostic-fdo -ldesktop-agnostic-ui Cflags: -I${includedir}/libdesktop-agnostic-@API_VERSION@ Requires: glib-2.0 gmodule-2.0 gdk-2.0 libdesktop-agnostic-0.3.92/tests/test-ui-color-button-gtkbuilder.ui0000664000175000017510000000115011536677677024737 0ustar seagleseagle True True True True #ffff00000000 libdesktop-agnostic-0.3.92/tests/test-desktop-entry.vala0000664000175000017510000000423711536677677022672 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; using DesktopAgnostic.FDO; int main (string[] args) { Gdk.init (ref args); try { VFS.init (); if (args.length > 1) { bool hit_first_arg = false; foreach (unowned string arg in args) { if (!hit_first_arg) { hit_first_arg = true; continue; } VFS.File file = VFS.file_new_for_path (arg); DesktopEntry entry = desktop_entry_new_for_file (file); message ("Entry: %s", entry.name); message ("Entry exec line: %s", entry.get_string ("Exec")); if (entry.exists ()) { entry.launch (0, null); } else { critical ("Entry does not exist."); } } } else { DesktopEntry entry; VFS.File file; entry = FDO.desktop_entry_new (); entry.name = "hosts file"; entry.entry_type = DesktopEntryType.LINK; entry.set_string ("URL", "file:///etc/hosts"); file = VFS.file_new_for_path ("/tmp/desktop-agnostic-test.desktop"); entry.save (file); entry = null; } VFS.shutdown (); } catch (GLib.Error err) { critical ("Error: %s", err.message); } return 0; } // vim: set ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/tests/test-vfs-file.vala0000664000175000017510000000556111536677677021576 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; const string CONTENT = "Desktop Agnostic Library"; int main (string[] args) { Gdk.init (ref args); try { bool test_launch; unowned string path; VFS.File tmp; string file_path; VFS.File file; string contents; size_t length; string file_copy_path; VFS.File file_copy; string copy_contents; size_t copy_length; test_launch = (args.length > 1 && args[1] == "launch"); VFS.init (); path = Environment.get_tmp_dir (); tmp = VFS.file_new_for_path (path); assert (tmp.parent != null); assert (tmp.exists ()); assert (tmp.file_type == VFS.FileType.DIRECTORY); assert ((tmp.access_flags & VFS.AccessFlags.READ) != 0); assert (tmp.is_readable ()); assert ((tmp.access_flags & VFS.AccessFlags.WRITE) != 0); assert (tmp.is_writable ()); message ("URI: %s", tmp.uri); message ("Path: %s", tmp.path); message ("# of files: %u", tmp.enumerate_children ().length ()); file_path = Path.build_filename (path, "desktop-agnostic-test"); file = VFS.file_new_for_path (file_path); assert (file.parent != null && file.parent.uri == tmp.uri); tmp = null; file.replace_contents (CONTENT); file.load_contents (out contents, out length); assert (contents == CONTENT); if (test_launch) { assert (file.launch ()); } file_copy_path = "%s-copy".printf (file_path); file_copy = VFS.file_new_for_path (file_copy_path); assert (file.copy (file_copy, true)); file_copy.load_contents (out copy_contents, out copy_length); assert (contents == copy_contents); assert (length == copy_length); if (!test_launch) { assert (file_copy.remove ()); assert (!file_copy.exists ()); assert (file.remove ()); assert (!file.exists ()); } file = null; VFS.shutdown (); } catch (Error err) { critical ("Error: %s", err.message); } return 0; } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tests/wscript0000664000175000017510000000205711536677677017654 0ustar seagleseagle#!/usr/bin/python # encoding: utf-8 NEEDS_GDK = ['test-desktop-entry', 'test-vfs-file'] def build_test_program(bld, name, suffix): test = bld.new_task_gen('cc', 'program') test.source = name + '.vala' if name in NEEDS_GDK: test.packages = 'gdk-2.0' test.uselib = 'GDK' if suffix == '': test.uselib_local = 'desktop-agnostic' else: test.uselib_local = 'desktop-agnostic-%s' % suffix test.vapi_dirs = '../libdesktop-agnostic' test.includes = '..' test.target = name test.install_path = '' def build(bld): [build_test_program(bld, 'test-' + name, 'cfg') for name in ['color', 'config', 'config-bridge']] [build_test_program(bld, 'test-' + name, 'fdo') for name in ['desktop-entry']] [build_test_program(bld, 'test-' + name, 'vfs') for name in ['vfs-bookmarks-gtk', 'vfs-file', 'vfs-file-monitor', 'vfs-glob', 'vfs-trash', 'vfs-volume']] [build_test_program(bld, 'test-' + name, 'ui') for name in ['ui-color-button', 'ui-color-button-gtkbuilder']] libdesktop-agnostic-0.3.92/tests/test-vfs-bookmarks-gtk.vala0000664000175000017510000000400711536677677023424 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; using DesktopAgnostic.VFS; void print_bookmarks (GtkBookmarks parser) { if (parser.bookmarks == null) { message ("No bookmarks."); } else { message ("Bookmarks:"); foreach (unowned Bookmark b in parser.bookmarks) { string? path = b.file.path; if (path == null) { message ("* %s (%s)", b.file.uri, b.alias); } else { message ("* %s (%s)", path, b.alias); } } } } int main (string[] args) { VFS.Implementation vfs; GtkBookmarks parser; vfs = VFS.get_default (); vfs.init (); if (args.length < 2) { parser = new GtkBookmarks (); } else { try { VFS.File file = VFS.file_new_for_path (args[1]); parser = new GtkBookmarks (file); } catch (GLib.Error err) { critical ("Error: %s", err.message); return 1; } } print_bookmarks (parser); parser.changed.connect (print_bookmarks); MainLoop ml = new MainLoop (null, false); ml.run (); parser = null; vfs.shutdown (); return 0; } // vim: set et ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/tests/test-vfs-glob.vala0000664000175000017510000000321111536677677021570 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; int main (string[] args) { if (args.length < 2) { return 0; } Glob g = null; bool first_arg = false; foreach (unowned string arg in args) { // don't try to match the program arg if (!first_arg) { first_arg = true; continue; } try { if (g == null) { g = Glob.execute (arg); } else { g.append (arg); } foreach (unowned string path in g.get_paths ()) { stdout.printf ("%s\n", path); } } catch (GlobError err) { if (err is GlobError.NOMATCH) { critical ("Error: %s", err.message); return 1; } } } return 0; } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tests/test-color.schema-ini0000664000175000017510000000043511536677677022266 0ustar seagleseagle[DEFAULT/color] type = color default = red description = Some color. [DEFAULT/color_list] type = list-color default = red;green;blue description = Some color list. [DEFAULT/none] type = color default = description = no default color; should be a NULL object. ; vim: set ft=dosini : libdesktop-agnostic-0.3.92/tests/test-vfs-volume.vala0000664000175000017510000000266011536677677022163 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; public class TestVolume { static int main (string[] args) { try { VFS.init (); VFS.VolumeMonitor vm = VFS.volume_monitor_get_default (); foreach (unowned VFS.Volume vol in vm.volumes) { message ("Volume[%s] (Mounted=%s): %s", vol.name, vol.is_mounted ().to_string(), vol.uri.uri); } VFS.shutdown (); } catch (GLib.Error err) { critical ("Error: %s", err.message); } return 0; } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tests/test-ui-color-button.vala0000664000175000017510000000442711536677677023125 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; class TestColorButton : Gtk.Window { construct { Gtk.VBox box; Color color; Gtk.Label label; UI.ColorButton button; this.delete_event.connect (this.on_quit); box = new Gtk.VBox (false, 5); label = new Gtk.Label ("With default color"); box.add (label); color = new Color.from_string ("green"); color.alpha = ushort.MAX / 2; button = new UI.ColorButton.with_color (color); button.color_set.connect (this.on_color_set); box.add (button); label = new Gtk.Label ("Without default color"); box.add (label); button = new UI.ColorButton (); button.color_set.connect (this.on_color_set); box.add (button); this.add (box); } private bool on_quit (Gtk.Widget widget, Gdk.Event event) { Gtk.main_quit (); return true; } private void on_color_set (Gtk.ColorButton button) { UI.ColorButton real_button = button as UI.ColorButton; message ("Selected color: %s", real_button.da_color.to_string ()); assert (real_button.da_color.color.equal (real_button.color)); assert (real_button.da_color.alpha == real_button.alpha); Gtk.main_quit (); } public static int main (string[] args) { TestColorButton window; Gtk.init (ref args); window = new TestColorButton (); window.show_all (); Gtk.main (); return 0; } } // vim: set ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/tests/test-ui-color-button-gtkbuilder.vala0000664000175000017510000000354511536677677025257 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; private bool on_quit (Gtk.Widget widget, Gdk.Event event) { Gtk.main_quit (); return true; } private void on_color_set (Gtk.ColorButton button) { UI.ColorButton real_button = button as UI.ColorButton; message ("Selected color: %s", real_button.da_color.to_string ()); Gtk.main_quit (); } public static int main (string[] args) { Gtk.Builder builder; unowned Gtk.Window window; unowned UI.ColorButton button; Gtk.init (ref args); builder = new Gtk.Builder (); try { builder.add_from_file ("test-ui-color-button-gtkbuilder.ui"); window = builder.get_object ("window1") as Gtk.Window; window.delete_event.connect (on_quit); button = window.get_child () as UI.ColorButton; button.color_set.connect (on_color_set); window.show_all (); Gtk.main (); return 0; } catch (Error err) { critical ("Error: %s", err.message); return 1; } } // vim: set ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/tests/test-config.schema-ini0000664000175000017510000000236411536677677022420 0ustar seagleseagle[numeric/boolean] type = boolean default = true description = Test boolean key [numeric/integer] type = integer default = 3 description = Test integer key [numeric/float] type = float default = 3.14 description = Test float key [misc/string] type = string default = Foo bar description = Test string key [list/boolean] type = list-boolean default = true;false; description = Test boolean list key [list/integer] type = list-integer default = 1;2;3; description = Test integer list key [list/float] type = list-float default = 1.618;2.718;3.141; description = Test float list key [list/string] type = list-string default = foo;bar; description = Test string list key [empty/string] type = string default = description = Test string key (default blank, should be "") [empty/list-boolean] type = list-boolean default = description = Test boolean list key (default blank, should be NULL) [empty/list-integer] type = list-integer default = description = Test integer list key (default blank, should be NULL) [empty/list-float] type = list-float default = description = Test float list key (default blank, should be NULL) [empty/list-string] type = list-string default = description = Test string list key (default blank, should be NULL) ; vim: set ft=dosini : libdesktop-agnostic-0.3.92/tests/test-config.vala0000664000175000017510000003027011536677677021323 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; errordomain AssertionError { NOT_EQUAL, INVALID_TYPE, NOT_REACHED } const int EXIT_SUCCESS = 0; const int EXIT_ASSERTION = 1; const int EXIT_EXCEPTION = 2; class TestCase { Config.Backend cfg; uint notify_counter; MainLoop ml; int retval; public TestCase () throws Error { Config.Schema schema = new Config.Schema ("test-config.schema-ini"); this.cfg = Config.new ((owned)schema); this.notify_counter = 0; this.ml = new MainLoop (null, false); this.retval = 0; } void on_string_changed (string group, string key, Value value) { this.notify_counter++; } void on_string_changed2 (string group, string key, Value value) { if (((string)value).contains ("quux")) { this.notify_counter += 3; } } bool array_equals (ValueArray expected, ValueArray actual) throws AssertionError { bool equal = true; if (expected.n_values == actual.n_values) { for (uint i = 0; i < actual.n_values; i++) { assert_equals (expected.get_nth (i), actual.get_nth (i)); } } else { equal = false; } return equal; } void assert_equals (Value expected, Value actual) throws AssertionError { bool equal = true; if (actual.holds (typeof (bool))) { equal = (expected.get_boolean () == actual.get_boolean ()); } else if (actual.holds (typeof (int))) { equal = (expected.get_int () == actual.get_int ()); } else if (actual.holds (typeof (float))) { equal = (expected.get_float () == actual.get_float ()); } else if (actual.holds (typeof (string))) { equal = (expected.get_string () == actual.get_string ()); } else if (actual.holds (typeof (ValueArray))) { equal = array_equals ((ValueArray)expected, (ValueArray)actual); } else { throw new AssertionError.INVALID_TYPE ("Invalid value type (%s).", actual.type ().name ()); } if (!equal) { throw new AssertionError.NOT_EQUAL ("%s != %s", expected.strdup_contents (), actual.strdup_contents ()); } } void test_default_empty_list (string suffix) throws AssertionError, Error { ValueArray expected_array; Value expected; string key; expected_array = new ValueArray (0); expected = expected_array; key = "list-%s".printf (suffix); assert_equals (expected, cfg.get_value ("empty", key)); assert (array_equals (expected_array, cfg.get_list ("empty", key))); } void test_defaults () throws AssertionError, Error { Value expected, item_1, item_2, item_3; ValueArray expected_array; cfg.reset (); expected = true; assert_equals (expected, cfg.get_value ("numeric", "boolean")); assert ((bool)expected == cfg.get_bool ("numeric", "boolean")); expected = 3; assert_equals (expected, cfg.get_value ("numeric", "integer")); assert ((int)expected == cfg.get_int ("numeric", "integer")); expected = 3.14f; assert_equals (expected, cfg.get_value ("numeric", "float")); assert ((float)expected == cfg.get_float ("numeric", "float")); expected = "Foo bar"; assert_equals (expected, cfg.get_value ("misc", "string")); assert ((string)expected == cfg.get_string ("misc", "string")); expected = ""; assert_equals (expected, cfg.get_value ("empty", "string")); assert ((string)expected == cfg.get_string ("empty", "string")); expected_array = new ValueArray (2); item_1 = true; item_2 = false; expected_array.append (item_1); expected_array.append (item_2); expected = expected_array; assert_equals (expected, cfg.get_value ("list", "boolean")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "boolean"))); expected_array = new ValueArray (3); item_1 = 1; item_2 = 2; item_3 = 3; expected_array.append (item_1); expected_array.append (item_2); expected_array.append (item_3); expected = expected_array; assert_equals (expected, cfg.get_value ("list", "integer")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "integer"))); expected_array = new ValueArray (3); item_1 = 1.618f; item_2 = 2.718f; item_3 = 3.141f; expected_array.append (item_1); expected_array.append (item_2); expected_array.append (item_3); expected = expected_array; assert_equals (expected, cfg.get_value ("list", "float")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "float"))); expected_array = new ValueArray (2); item_1 = "foo"; item_2 = "bar"; expected_array.append (item_1); expected_array.append (item_2); expected = expected_array; assert_equals (expected, cfg.get_value ("list", "string")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "string"))); this.test_default_empty_list ("boolean"); this.test_default_empty_list ("integer"); this.test_default_empty_list ("float"); this.test_default_empty_list ("string"); } void test_set_empty_list (string key) throws AssertionError, Error { ValueArray old_value; ValueArray expected_array; Value expected; old_value = cfg.get_list ("list", key); expected_array = new ValueArray (0); expected = expected_array; // test setting via set_list () cfg.set_list ("list", key, expected_array); assert_equals (expected, cfg.get_value ("list", key)); assert (array_equals (expected_array, cfg.get_list ("list", key))); // reset to old value cfg.set_list ("list", key, old_value); assert (array_equals (old_value, cfg.get_list ("list", key))); // test setting via set_value () cfg.set_value ("list", key, expected); assert_equals (expected, cfg.get_value ("list", key)); assert (array_equals (expected_array, cfg.get_list ("list", key))); } void test_set () throws AssertionError, Error { Value expected, item_1, item_2, item_3; ValueArray expected_array; expected = false; cfg.set_bool ("numeric", "boolean", (bool)expected); assert_equals (expected, cfg.get_value ("numeric", "boolean")); assert ((bool)expected == cfg.get_bool ("numeric", "boolean")); expected = 10; cfg.set_int ("numeric", "integer", (int)expected); assert_equals (expected, cfg.get_value ("numeric", "integer")); assert ((int)expected == cfg.get_int ("numeric", "integer")); expected = 2.718f; cfg.set_float ("numeric", "float", (float)expected); assert_equals (expected, cfg.get_value ("numeric", "float")); assert ((float)expected == cfg.get_float ("numeric", "float")); expected = "Quux baz"; cfg.set_string ("misc", "string", (string)expected); assert_equals (expected, cfg.get_value ("misc", "string")); assert ((string)expected == cfg.get_string ("misc", "string")); expected_array = new ValueArray (3); item_1 = false; item_2 = true; item_3 = false; expected_array.append (item_1); expected_array.append (item_2); expected_array.append (item_3); expected = expected_array; cfg.set_list ("list", "boolean", (ValueArray)expected); assert_equals (expected, cfg.get_value ("list", "boolean")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "boolean"))); expected_array = new ValueArray (3); item_1 = 10; item_2 = 20; item_3 = 30; expected_array.append (item_1); expected_array.append (item_2); expected_array.append (item_3); expected = expected_array; cfg.set_list ("list", "integer", (ValueArray)expected); assert_equals (expected, cfg.get_value ("list", "integer")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "integer"))); expected_array = new ValueArray (3); item_1 = 10.5f; item_2 = 20.6f; item_3 = 30.7f; expected_array.append (item_1); expected_array.append (item_2); expected_array.append (item_3); expected = expected_array; cfg.set_list ("list", "float", (ValueArray)expected); assert_equals (expected, cfg.get_value ("list", "float")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "float"))); expected_array = new ValueArray (3); item_1 = "Quux"; item_2 = "Baz"; item_3 = "Foo"; expected_array.append (item_1); expected_array.append (item_2); expected_array.append (item_3); expected = expected_array; cfg.set_list ("list", "string", (ValueArray)expected); assert_equals (expected, cfg.get_value ("list", "string")); assert (array_equals ((ValueArray)expected, cfg.get_list ("list", "string"))); this.test_set_empty_list ("boolean"); this.test_set_empty_list ("integer"); this.test_set_empty_list ("float"); this.test_set_empty_list ("string"); } void update_notify_value (MainContext ctx, string value, uint counter_expected) throws AssertionError, Error { cfg.set_string ("misc", "string", value); Thread.usleep (250000); while (ctx.pending ()) { ctx.iteration (false); } assert (this.notify_counter == counter_expected); } void test_notify () throws AssertionError, Error { unowned MainContext ctx = this.ml.get_context (); cfg.notify_add ("misc", "string", this.on_string_changed); cfg.notify_add ("misc", "string", this.on_string_changed2); this.update_notify_value (ctx, "Bar foo", 1); this.update_notify_value (ctx, "Foo quux", 5); cfg.notify_remove ("misc", "string", this.on_string_changed); this.update_notify_value (ctx, "Bar quux", 8); cfg.notify_remove ("misc", "string", this.on_string_changed2); this.update_notify_value (ctx, "Baz foo", 8); } private static delegate void GetCfgFunc (Config.Backend cfg, string group, string key) throws Error; void test_invalid_func (GetCfgFunc func) throws AssertionError, Error { try { func (cfg, "foo", "bar"); throw new AssertionError.NOT_REACHED ("Key should have been nonexistent."); } catch (Error err) { if (!(err is Config.Error.KEY_NOT_FOUND)) { throw err; } } } void test_invalid () throws AssertionError, Error { this.test_invalid_func ((GetCfgFunc)cfg.get_bool); this.test_invalid_func ((GetCfgFunc)cfg.get_float); this.test_invalid_func ((GetCfgFunc)cfg.get_int); this.test_invalid_func ((GetCfgFunc)cfg.get_string); this.test_invalid_func ((GetCfgFunc)cfg.get_list); } public static int main (string[] args) { try { TestCase test = new TestCase (); test.test_defaults (); test.test_set (); test.test_invalid (); test.test_notify (); } catch (AssertionError assertion) { critical ("Assertion Error: %s", assertion.message); return EXIT_ASSERTION; } catch (Error err) { critical ("Error: %s", err.message); return EXIT_EXCEPTION; } return EXIT_SUCCESS; } } // vim: set et ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/tests/test-color.vala0000664000175000017510000000444111536677677021175 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; void print_color (Color? clr, string name) { if (clr == null) { message ("color '%s' is NULL", name); } else { message ("color '%s' = %s", name, clr.to_string ()); } } void print_cfg_color (Config.Backend cfg, string name) { Value val; val = cfg.get_value (Config.GROUP_DEFAULT, name); print_color (val as Color, name); } int main (string[] args) { try { try { Color green = new Color.from_string ("green"); assert (green.alpha == ushort.MAX); message ("green = %s", green.to_string ()); Color one_char_hex = new Color.from_string ("#f00f"); message ("red = %s", one_char_hex.to_string ()); } catch (ColorParseError err) { critical ("Color parse error: %s", err.message); } Config.Schema schema = new Config.Schema ("test-color.schema-ini"); Config.Backend cfg = Config.new (schema); print_cfg_color (cfg, "color"); print_cfg_color (cfg, "none"); Value val = cfg.get_value (Config.GROUP_DEFAULT, "color_list"); unowned ValueArray array = (ValueArray)val; for (uint i = 0; i < array.n_values; i++) { unowned Value v = array.get_nth (i); print_color (v as Color, "color_list[%u]".printf (i)); } } catch (Error err) { critical ("Error: %s", err.message); return 1; } return 0; } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tests/test-vfs-trash.vala0000664000175000017510000000302111536677677021765 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; public class TestTrash { static MainLoop mainloop; static void on_file_count_changed (VFS.Trash t) { message ("Number of files in the trash: %u\n", t.file_count); mainloop.quit (); } static int main (string[] args) { try { VFS.init (); unowned VFS.Trash t = VFS.trash_get_default (); t.file_count_changed += on_file_count_changed; mainloop = new MainLoop (null, true); mainloop.run (); VFS.shutdown (); } catch (GLib.Error err) { critical ("Error: %s", err.message); } return 0; } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tests/test-vfs-file-monitor.vala0000664000175000017510000000576611536677677023272 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; class TestFileMonitor { private static VFS.File file; private static VFS.FileMonitor monitor; private static void on_change (VFS.FileMonitor monitor, VFS.File file, VFS.File? other, VFS.FileMonitorEvent event) { string evt_str = "?"; switch (event) { case VFS.FileMonitorEvent.CHANGED: evt_str = "Changed"; break; case VFS.FileMonitorEvent.CREATED: evt_str = "Created"; break; case VFS.FileMonitorEvent.DELETED: evt_str = "Deleted"; break; case VFS.FileMonitorEvent.ATTRIBUTE_CHANGED: evt_str = "Attribute Changed"; break; case VFS.FileMonitorEvent.UNKNOWN: evt_str = "Unknown"; break; } message ("%s: %s", evt_str, file.uri); if (other != null) { message (" * other: %s", other.uri); } } private static bool do_emit () { try { string filename = Path.build_filename (file.path, "test-vfs-file.txt"); VFS.File other = VFS.file_new_for_path (filename); monitor.emit (other, VFS.FileMonitorEvent.CREATED); } catch (Error err) { critical ("Error: %s", err.message); } return false; } public static int main (string[] args) { if (args.length < 2) { stderr.printf ("Usage: %s [FILE | DIRECTORY FILE] \n", args[0]); return 1; } try { VFS.init (); unowned string path = args[1]; file = VFS.file_new_for_path (path); monitor = file.monitor (); monitor.changed += on_change; MainLoop mainloop = new MainLoop (null, false); if (args.length == 3 && file.file_type == VFS.FileType.DIRECTORY) { Timeout.add_seconds (2, do_emit); } mainloop.run (); monitor.cancel (); assert (monitor.cancelled); VFS.shutdown (); } catch (Error err) { critical ("VFS Error: %s", err.message); return 1; } return 0; } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tests/test-config-bridge.vala0000664000175000017510000001244711536677677022563 0ustar seagleseagle/* * 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 */ using GLib; using DesktopAgnostic; enum TestEnum { ZERO = 0, ONE, TWO } const string DEFAULT_STR = "Not expected string"; /** * Note: array test disabled until the following Vala bug is fixed: * http://bugzilla.gnome.org/show_bug.cgi?id=592493 */ private class Test : Object { public string str { get; set; } public int num { get; set; } public float dec { get; set; } public bool tf { get; set; } //public unowned ValueArray arr { get; set; } public TestEnum enum_val { get; set; } construct { this.str = DEFAULT_STR; this.num = 1; this.dec = 2.71f; this.tf = false; //this.arr = new ValueArray (0); this.enum_val = TestEnum.ZERO; } } private class TestDestruct : Test { private Config.Backend cfg; public int foo_counter = 0; public int str_counter = 0; public int num2 { get; set; } public static bool instance_exists = false; public TestDestruct (Config.Backend cfg) { this.num2 = 1; this.cfg = cfg; instance_exists = true; this.notify["str"].connect (this.on_str_notify_pre_bind); } private void on_str_notify_pre_bind (ParamSpec spec) { string str = this.str; assert (str != DEFAULT_STR); if (str == "foo") { this.foo_counter++; } else { this.str_counter++; } } public void add_post_bind_notify () { this.notify["str"].connect (this.on_str_notify_post_bind); } private void on_str_notify_post_bind (ParamSpec spec) { string str = this.str; assert (str != DEFAULT_STR); if (str == "foo") { this.foo_counter--; } else { this.str_counter--; } } ~TestDestruct () { unowned Config.Bridge bridge = Config.Bridge.get_default (); bridge.remove_all_for_object (this.cfg, this); instance_exists = false; } } private void bridge_assertions (Config.Backend cfg, Config.Bridge bridge, Test obj) throws Error { /*ValueArray new_array; Value array_item;*/ cfg.reset (); assert (cfg.get_string ("group", "string") == "foo"); bridge.bind (cfg, "group", "string", obj, "str", false); bridge.bind (cfg, "group", "number", obj, "num", true); if (obj is TestDestruct) { (obj as TestDestruct).add_post_bind_notify (); bridge.bind (cfg, "group", "number", obj, "num2", true); } bridge.bind (cfg, "group", "decimal", obj, "dec", false); bridge.bind (cfg, "group", "tf", obj, "tf", true); //bridge.bind (cfg, "group", "array", obj, "arr", false); bridge.bind (cfg, "group", "enum", obj, "enum_val", true); assert (obj.str == "foo"); assert (obj.num == 10); if (obj is TestDestruct) { assert ((obj as TestDestruct).num2 == 10); } assert (obj.dec == 3.14f); assert (obj.tf == true); //assert (obj.arr.n_values == 3); assert (obj.enum_val == TestEnum.ONE); obj.str = "Some new string"; obj.num = 100; obj.dec = 1.618f; obj.tf = false; /*new_array = new ValueArray (2); array_item = "z"; new_array.append (array_item); array_item = "y"; new_array.append (array_item); obj.arr = new_array;*/ obj.enum_val = TestEnum.TWO; assert (cfg.get_string ("group", "string") == obj.str); assert (cfg.get_int ("group", "number") != obj.num); assert (cfg.get_float ("group", "decimal") == obj.dec); assert (cfg.get_bool ("group", "tf") != obj.tf); //assert (cfg.get_list ("group", "array").n_values == obj.arr.n_values); assert (cfg.get_int ("group", "enum") != 2); if (obj is TestDestruct) { unowned TestDestruct td = obj as TestDestruct; assert (td.foo_counter == 1); assert (td.str_counter == 1); } } int main (string[] args) { try { Config.Schema schema = new Config.Schema ("test-config-bridge.schema-ini"); Config.Backend cfg = Config.new (schema); unowned Config.Bridge bridge = Config.Bridge.get_default (); Test t; TestDestruct td; t = new Test (); bridge_assertions (cfg, bridge, t); bridge.remove_all_for_object (cfg, t); cfg.reset (); td = new TestDestruct (cfg); bridge_assertions (cfg, bridge, td); td = null; assert (!TestDestruct.instance_exists); t = new Test (); bridge_assertions (cfg, bridge, t); td = new TestDestruct (cfg); bridge_assertions (cfg, bridge, td); td = null; assert (!TestDestruct.instance_exists); bridge.remove_all_for_object (cfg, t); } catch (Error err) { critical ("Error: %s", err.message); return 1; } return 0; } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tests/test-config-bridge.schema-ini0000664000175000017510000000071011536677677023643 0ustar seagleseagle[group/string] type = string default = foo description = some string. [group/number] type = integer default = 10 description = some number. [group/decimal] type = float default = 3.14 description = some decimal. [group/tf] type = boolean default = true description = some boolean. [group/array] type = list-string default = [a,b,c] description = some array. [group/enum] type = integer default = 1 description = some enumeration. # vim: set ft=cfg : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-trash-impl-gnome-vfs.vala0000664000175000017510000001636311536677677026466 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; using GnomeVFS; namespace DesktopAgnostic.VFS { private class TrashVolume : Object { private uint _file_count; public uint file_count { get { return this._file_count; } } private unowned Trash trash; private unowned MonitorHandle monitor; private unowned URI _uri; public URI uri { set { this._uri = value; this.reset_file_count (); if (this.monitor == null) { // add monitor monitor_add (out this.monitor, this.uri.to_string (URIHideOptions.NONE), MonitorType.DIRECTORY, this.update_file_count); } } get { return this._uri; } } public TrashVolume (Trash trash, URI uri) { this._file_count = 0; this.trash = trash; this.uri = uri; } private void update_file_count (MonitorHandle monitor, string monitor_uri, string info_uri, MonitorEventType event_type) { if (event_type != MonitorEventType.CREATED && event_type != MonitorEventType.DELETED) { return; } uint old_file_count = this._file_count; this.reset_file_count (); if (old_file_count != this._file_count) { this.trash.file_count_changed (); } } private void reset_file_count () { message ("reset_file_count"); unowned DirectoryHandle handle; Result res; this._file_count = 0; // iterate through folder contents res = directory_open_from_uri (out handle, this.uri, FileInfoOptions.NAME_ONLY); if (res == Result.OK) { GnomeVFS.FileInfo file_info; file_info = new GnomeVFS.FileInfo (); while ((res = directory_read_next (handle, file_info)) == Result.OK) { if (file_info.name != "." && file_info.name != "..") { this._file_count++; } } directory_close (handle); } } private static bool visit_callback (string rel_path, GnomeVFS.FileInfo info, bool recursing_will_loop, void** data, bool recurse) { unowned URI item; item = ((URI)(*data)).resolve_relative (rel_path); if (info.type == GnomeVFS.FileType.DIRECTORY) { TrashVolume.do_empty (item); } unlink_from_uri (item); return true; } private static void do_empty (URI dir) { Result res; res = directory_visit_uri (dir, FileInfoOptions.DEFAULT, DirectoryVisitOptions.LOOPCHECK, (DirectoryVisitFunc)TrashVolume.visit_callback, &dir); if (res != Result.OK) { warning ("Error occurred: %s", result_to_string (res)); } } public void empty () { if (this._uri == null) { warning ("URI is NULL!"); } TrashVolume.do_empty (this._uri); } } public class TrashGnomeVFS : Trash, Object { protected HashTable trash_dirs; construct { message ("GNOME VFS Impl."); this.trash_dirs = new HashTable (direct_hash, direct_equal); Idle.add (this.search_for_trash_dirs); } public uint file_count { get { uint total = 0; List values; values = this.trash_dirs.get_values (); foreach (unowned TrashVolume tv in values) { total += tv.file_count; } return total; } } public void send_to_trash (File uri) throws GLib.Error { URI g_uri, trash_uri; Result res; g_uri = (URI)uri.implementation; res = find_directory (g_uri, FindDirectoryKind.TRASH, out trash_uri, true, false, 0777); if (res == Result.OK) { URI new_uri = trash_uri.append_file_name (g_uri.extract_short_path_name ()); message ("Moving '%s' to '%s'...", g_uri.to_string (URIHideOptions.NONE), new_uri.to_string (URIHideOptions.NONE)); res = move_uri (g_uri, new_uri, false); if (res != Result.OK) { warning ("Error occurred: %s", result_to_string (res)); } } else { warning ("Error occurred: %s", result_to_string (res)); } } public void empty () { List values; values = this.trash_dirs.get_values (); foreach (unowned TrashVolume tv in values) { tv.empty (); } } private bool search_for_trash_dirs () { unowned GnomeVFS.VolumeMonitor volume_monitor; unowned List volumes; volume_monitor = get_volume_monitor (); volumes = volume_monitor.get_mounted_volumes (); foreach (unowned GnomeVFS.Volume volume in volumes) { this.check_volume_for_trash_dir (volume_monitor, volume); } volume_monitor.volume_mounted += this.check_volume_for_trash_dir; volume_monitor.volume_unmounted += this.remove_volume; this.file_count_changed (); return false; } private void check_volume_for_trash_dir (GnomeVFS.VolumeMonitor vm, GnomeVFS.Volume vol) { if (vol.handles_trash ()) { Result res; URI uri; URI trash_uri; uri = new URI (vol.get_activation_uri ()); res = find_directory (uri, FindDirectoryKind.TRASH, out trash_uri, false, true, 0777); if (res == Result.OK) { TrashVolume tv; tv = new TrashVolume (this, trash_uri); this.trash_dirs.insert (vol, (owned)tv); message ("Volume added"); } } } private void remove_volume (GnomeVFS.VolumeMonitor vm, GnomeVFS.Volume vol) { if (this.trash_dirs.lookup (vol) != null) { this.trash_dirs.remove (vol); } } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala0000664000175000017510000001611711536677677026455 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class FileThunarVFS : File { private ThunarVfs.Path _path; private ThunarVfs.Info _info; public override void* implementation { get { return (void*)this._path; } } private string _uri; protected override string? impl_path { owned get { return this._path.dup_string (); } } protected override string impl_uri { owned get { return this._uri; } } public override FileType file_type { get { FileType ft = FileType.UNKNOWN;; if (this._info != null) { if ((this._info.flags & ThunarVfs.FileFlags.SYMLINK) != 0) { ft = FileType.SYMBOLIC_LINK; } else { switch (this._info.type) { case ThunarVfs.FileType.REGULAR: ft = FileType.REGULAR; break; case ThunarVfs.FileType.DIRECTORY: ft = FileType.DIRECTORY; break; case ThunarVfs.FileType.SYMLINK: ft = FileType.SYMBOLIC_LINK; break; case ThunarVfs.FileType.PORT: case ThunarVfs.FileType.DOOR: case ThunarVfs.FileType.SOCKET: case ThunarVfs.FileType.BLOCKDEV: case ThunarVfs.FileType.CHARDEV: case ThunarVfs.FileType.FIFO: ft = FileType.SPECIAL; break; case ThunarVfs.FileType.UNKNOWN: ft = FileType.UNKNOWN; break; } } } return ft; } } private override AccessFlags access_flags { get { AccessFlags flags = AccessFlags.NONE; if (this._info != null) { if ((this._info.flags & ThunarVfs.FileFlags.READABLE) != 0) { flags |= AccessFlags.READ; } if ((this._info.flags & ThunarVfs.FileFlags.WRITABLE) != 0) { flags |= AccessFlags.WRITE; } if ((this._info.flags & ThunarVfs.FileFlags.EXECUTABLE) != 0) { flags |= AccessFlags.EXECUTE; } } return flags; } } public override File? parent { owned get { unowned ThunarVfs.Path? path; path = this._path.get_parent (); if (path == null) { return null; } else { File result; result = new FileThunarVFS (); result.init (path.dup_uri ()); return result; } } } protected override void init (string uri) { this._uri = uri; try { this._path = new ThunarVfs.Path (this._uri); try { this._info = new ThunarVfs.Info.for_path (this._path); } catch (GLib.FileError err) { this._info = null; } } catch (Error err) { critical ("VFS File Error (Thunar VFS): %s", err.message); } } public override bool exists () { return FileUtils.test (this.path, FileTest.EXISTS); } public override FileMonitor monitor () { return new FileMonitorThunarVFS (this); } public override bool load_contents (out string contents, out size_t length) throws Error { return FileUtils.get_contents (this.impl_path, out contents, out length); } public override bool replace_contents (string contents) throws Error { return FileUtils.set_contents (this.impl_path, contents); } public override bool launch () throws Error { unowned ThunarVfs.MimeDatabase mime_db; ThunarVfs.Info info; unowned ThunarVfs.MimeApplication mime_app; List paths = new List (); mime_db = ThunarVfs.MimeDatabase.get_default (); info = new ThunarVfs.Info.for_path (this._path); mime_app = mime_db.get_default_application (info.mime_info); paths.append (this._path); return mime_app.exec (Gdk.Screen.get_default (), paths); } /** * Note: not using a ThunarVfs.Job because they're async. */ public override SList enumerate_children () throws Error { SList children; Dir dir; unowned string child; if (this.file_type != FileType.DIRECTORY) { throw new FileError.INVALID_TYPE ("File '%s' is not a directory.", this.impl_path); } children = new SList (); dir = Dir.open (this.impl_path); while ((child = dir.read_name ()) != null) { string child_path; child_path = Path.build_filename (this.impl_path, child); children.append (file_new_for_path (child_path)); } return children; } /** * Note: not using a ThunarVfs.Job because they're async. */ public override bool copy (File destination, bool overwrite) throws Error { string data; size_t length; if (!overwrite && destination.exists ()) { throw new FileError.EXISTS ("The destination file (%s) exists.", this.impl_path); } return this.load_contents (out data, out length) && destination.replace_contents (data); } /** * Note: not using a ThunarVfs.Job because they're async. */ public override bool remove () throws Error { if (!this.exists ()) { throw new FileError.FILE_NOT_FOUND ("The file '%s' does not exist.", this.uri); } 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 ()); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-impl-gio.vala0000664000175000017510000000443311536677677024217 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class GIOImplementation : Object, Implementation { public string name { get { return "GIO"; } } public Type file_type { get { return typeof (FileGIO); } } public Type file_monitor_type { get { return typeof (FileMonitorGIO); } } public Type trash_type { get { return typeof (TrashGIO); } } public Type volume_type { get { return typeof (VolumeGIO); } } public void init () { } public SList files_from_uri_list (string uri_list) throws GLib.Error { SList files = new SList (); string[] uris = Uri.list_extract_uris (uri_list); foreach (unowned string uri in uris) { File file = file_new_for_uri (uri); files.append ((owned)file); } return files; } private VolumeMonitor vmonitor; public unowned VolumeMonitor volume_monitor_get_default () { if (vmonitor == null) { vmonitor = new VolumeMonitorGIO (); } return vmonitor; } public void shutdown () { } } } public Type register_plugin () { return typeof (DesktopAgnostic.VFS.GIOImplementation); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config.vala0000664000175000017510000002210311536677677023145 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; [CCode (cheader_filename = "libdesktop-agnostic/config.h")] namespace DesktopAgnostic.Config { /** * Errors which occur when setting/retrieving configuration options. */ public errordomain Error { NO_SCHEMA, INVALID_TYPE, KEY_NOT_FOUND, METADATA_NOT_FOUND, NOTIFY, DUPLICATE_BINDING } /** * The placeholder used for the default group. In some backends, this * indicates that the key associated with it is considered to be on the * "top level" of the schema. */ public const string GROUP_DEFAULT = "DEFAULT"; /** * The callback prototype used for notifications when configuration values * change. */ public delegate void NotifyFunc (string group, string key, Value value); /** * The abstract base class that defines what a configuration backend should * look like. */ public abstract class Backend : Object { public abstract string name { owned get; } private static HashTable _backend_metadata_keys; public static unowned HashTable get_backend_metadata_keys () { if (_backend_metadata_keys == null) { _backend_metadata_keys = new HashTable (str_hash, str_equal); } return _backend_metadata_keys; } private Schema? _schema = null; public Schema? schema { get { return this._schema; } construct { this._schema = value; } } private string? _instance_id; public string? instance_id { get { return this._instance_id; } construct { this._instance_id = value; } } /** * Resets the configuration to the default values. * @throws Error if something wrong happened during the reset */ public abstract void reset () throws GLib.Error; /** * Removes all of the configuration. * @throws Error if the config removal could not be completed. */ public abstract void remove () throws GLib.Error; /** * Adds a notification callback to the specified key. * @param group the group the key is associated with * @param key the config key to associate the callback with */ public abstract void notify_add (string group, string key, NotifyFunc callback) throws GLib.Error; /** * Manually executes all of the notification callbacks associated with the * specified key. * @param group the group the key is associated with * @param key the config key that is associated with the callback(s) */ public abstract new void notify (string group, string key) throws GLib.Error; /** * Removes the specified notification callback for the specified key. * @param group the group the key is associated with * @param key the config key that is associated with the callback * @param callback the callback to remove * @throws Error if the callback is not associated with the key, among * other things */ public abstract void notify_remove (string group, string key, NotifyFunc callback) throws GLib.Error; public abstract Value get_value (string group, string key) throws GLib.Error; /** * Sets the configuration option to the specified value. * @param group the group the key is associated with * @param key the config key that is associated with the value * @param value the new value of the configuration option * @throws Error if the group/key does not exist, the value type is not * supported, or something bad happened while trying to set the value */ public virtual void set_value (string group, string key, Value value) throws GLib.Error { SchemaOption option = this._schema.get_option (group, key); Type option_type; if (option == null) { throw new Error.KEY_NOT_FOUND ("Could not find group and/or key in schema."); } option_type = option.option_type; if (option_type == typeof (bool)) { this.set_bool (group, key, (bool)value); } else if (option_type == typeof (float)) { this.set_float (group, key, get_float_from_value (value)); } else if (option_type == typeof (int)) { this.set_int (group, key, get_int_from_value (value)); } else if (option_type == typeof (string)) { this.set_string (group, key, (string)value); } else if (option_type == typeof (ValueArray)) { this.set_list (group, key, (ValueArray)value); } else { SchemaType st = this.schema.find_type (option_type); if (st == null) { throw new Error.INVALID_TYPE ("Invalid config value type."); } else { this.set_string (group, key, st.serialize (value)); } } } public abstract bool get_bool (string group, string key) throws GLib.Error; public abstract void set_bool (string group, string key, bool value) throws GLib.Error; public abstract float get_float (string group, string key) throws GLib.Error; public abstract void set_float (string group, string key, float value) throws GLib.Error; public abstract int get_int (string group, string key) throws GLib.Error; public abstract void set_int (string group, string key, int value) throws GLib.Error; public abstract string get_string (string group, string key) throws GLib.Error; public abstract void set_string (string group, string key, string value) throws GLib.Error; public abstract ValueArray get_list (string group, string key) throws GLib.Error; public abstract void set_list (string group, string key, ValueArray value) throws GLib.Error; public static float get_float_from_value (Value value) throws Error { if (value.holds (typeof (float))) { return (float)value; } else if (Value.type_transformable (value.type (), typeof (float))) { Value converted = Value (typeof (float)); value.transform (ref converted); return (float)converted; } else { throw new Error.INVALID_TYPE ("Value given cannot be converted to a float: %s.", value.type ().name ()); } } public static int get_int_from_value (Value value) throws Error { if (value.holds (typeof (int))) { return (int)value; } else if (Value.type_transformable (value.type (), typeof (int))) { Value converted = Value (typeof (int)); value.transform (ref converted); return (int)converted; } else { throw new Error.INVALID_TYPE ("Value given cannot be converted to an integer: %s.", value.type ().name ()); } } } private static Type? module_type = null; /** * Retrieve the default config backend type. * @return Config.Backend-based type on succes, Type.INVALID on failure */ public Type get_type () throws GLib.Error { if (module_type == null) { module_type = get_module_type ("cfg", "config"); } return module_type; } /** * Convenience method for instantiating a configuration backend. * @return a Config.Backend object on success, %NULL on failure */ public Backend? @new (Schema schema) throws GLib.Error { Type type = get_type (); if (type == Type.INVALID) { return null; } else { return (Config.Backend)Object.new (type, "schema", schema); } } /** * Convenience method for instantiating a configuration backend with an * instance ID. * @return a Config.Backend object on success, %NULL on failure */ public Backend? @new_for_instance (string instance_id, Schema schema) throws GLib.Error { Type type = get_type (); if (type == Type.INVALID) { return null; } else { return (Config.Backend)Object.new (type, "schema", schema, "instance_id", instance_id); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/module.vala0000664000175000017510000002003511536677677023167 0ustar seagleseagle/* * 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 */ [CCode (cheader_filename = "libdesktop-agnostic/desktop-agnostic.h")] namespace DesktopAgnostic { public errordomain ModuleError { NO_GMODULE } private void debug_msg (string message) { if (Environment.get_variable ("DESKTOP_AGNOSTIC_MODULE_DEBUG") != null) { debug (message); } } private static Datalist modules; /** * Based on the PluginRegistrar class in * [[http://live.gnome.org/Vala/TypeModules]]. */ public class ModuleLoader : Object { private static string[] paths; private static delegate Type RegisterModuleFunction (); private static ModuleLoader? module_loader = null; static construct { paths = new string[] { Environment.get_variable ("DESKTOP_AGNOSTIC_MODULE_DIR"), Path.build_filename (Build.LIBDIR, "desktop-agnostic", "modules"), Path.build_filename (Environment.get_home_dir (), ".local", "lib", "desktop-agnostic") }; modules = Datalist (); } private static delegate Type GuessModuleFunction (ModuleLoader loader, string library_prefix); private Module? module_guesser; private ModuleLoader () { assert (Module.supported ()); this.module_guesser = null; } public static unowned ModuleLoader get_default () { if (module_loader == null) { module_loader = new ModuleLoader (); } return module_loader; } public static string[] get_search_paths () { return paths; } public Type load_from_path (string name, string path) { Module module = null; debug_msg ("Loading plugin with path: '%s'".printf (path)); module = Module.open (path, ModuleFlags.BIND_LAZY); if (module == null) { critical ("Could not load the module '%s': %s", path, Module.error ()); return Type.INVALID; } else { void* function = null; module.symbol ("register_plugin", out function); if (function == null) { critical ("Could not find entry function for '%s'.", path); return Type.INVALID; } else { RegisterModuleFunction register_plugin; register_plugin = (RegisterModuleFunction) function; modules.set_data (name, (owned)module); return register_plugin (); } } } public Type load (string name) { string path; Type module_type = Type.INVALID; foreach (unowned string prefix in this.paths) { if (prefix == null || !FileUtils.test (prefix, FileTest.IS_DIR)) { continue; } path = Module.build_path (Path.build_filename (prefix, Path.get_dirname (name)), Path.get_basename (name)); module_type = this.load_from_path (name, path); debug_msg ("Plugin type: %s".printf (module_type.name ())); if (module_type != Type.INVALID) { break; } } if (module_type == Type.INVALID) { // try the current directory, as a last resort path = Module.build_path (Environment.get_current_dir (), Path.get_basename (name)); module_type = this.load_from_path (name, path); if (module_type == Type.INVALID) { warning ("Could not locate the plugin '%s'.", name); } } return module_type; } public bool is_guess_module_loaded () { return this.module_guesser != null; } private Module? try_load_guess_module (string prefix) { string library = "libda-module-guesser"; string path; path = Module.build_path (prefix, library); return Module.open (path, ModuleFlags.BIND_LAZY); } public Type guess_module (string library_prefix) { void* function; unowned GuessModuleFunction guess_module; if (this.module_guesser == null) { // load the module guesser foreach (unowned string prefix in this.paths) { if (prefix == null || !FileUtils.test (prefix, FileTest.IS_DIR)) { continue; } this.module_guesser = this.try_load_guess_module (prefix); if (this.module_guesser != null) { break; } } if (this.module_guesser == null) { // try the current directory, as a last resort this.module_guesser = this.try_load_guess_module (Environment.get_current_dir ()); } } assert (this.module_guesser != null); this.module_guesser.symbol ("guess_module", out function); guess_module = (GuessModuleFunction)function; return guess_module (this, library_prefix); } } private static KeyFile module_config = null; public Type get_module_type (string prefix, string key) throws GLib.Error { unowned ModuleLoader? loader = null; string cfg_file = "desktop-agnostic.ini"; if (!Module.supported ()) { throw new ModuleError.NO_GMODULE ("libdesktop-agnostic requires GModule support."); } loader = ModuleLoader.get_default (); if (module_config == null && !loader.is_guess_module_loaded ()) { bool loaded_config = false; string system_path; string user_path; module_config = new KeyFile (); // load the system file first system_path = Path.build_filename (Build.SYSCONFDIR, "xdg", "libdesktop-agnostic", cfg_file); try { if (FileUtils.test (system_path, FileTest.EXISTS)) { debug_msg ("Loading module config from the system: '%s'".printf (system_path)); loaded_config = module_config.load_from_file (system_path, KeyFileFlags.NONE); } } catch (KeyFileError error) { warning ("KeyFile error: %s", error.message); } user_path = Path.build_filename (Environment.get_user_config_dir (), cfg_file); try { if (FileUtils.test (user_path, FileTest.EXISTS)) { debug_msg ("Loading module config from the user directory: '%s'".printf (user_path)); loaded_config |= module_config.load_from_file (user_path, KeyFileFlags.NONE); } } catch (KeyFileError error) { warning ("KeyFile error: %s", error.message); } } if (module_config.has_group ("DEFAULT")) { string library = "libda-%s-%s".printf (prefix, module_config.get_string ("DEFAULT", key)); return loader.load (library); } else { debug_msg ("No module config files found, falling back to guessing."); string library_prefix = "libda-%s-".printf (prefix); return loader.guess_module (library_prefix); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file.vala0000664000175000017510000001574511536677677023431 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { /** * File-related errors. */ public errordomain FileError { FILE_NOT_FOUND, EXISTS, INVALID_TYPE } /** * The kinds of files recognized by the File backends. */ public enum FileType { UNKNOWN = 0, REGULAR, DIRECTORY, SYMBOLIC_LINK, SPECIAL } public enum AccessFlags { NONE = 0, READ = 1 << 0, WRITE = 1 << 1, EXECUTE = 1 << 2 } /** * Abstract base class for representations of files. */ public abstract class File : Object { /** * The pointer to the implementation used. */ public abstract void* implementation { get; } /** * Implementation detail. Implementing classes override this to allow the * uri property to return the correct value. */ protected abstract string impl_uri { owned get; } /** * The URI that the object represents. */ public string uri { owned get { return this.impl_uri; } construct { if (value != null) { this.init (value); } } } /** * Implementation detail. Implementing classes override this to allow the * path property to return the correct value. */ protected abstract string? impl_path { owned get; } /** * The path that the object represents. */ public string? path { owned get { return this.impl_path; } construct { if (value != null) { this.init ("file://" + value); } } } /** * The kind of file that the object represents. */ public abstract FileType file_type { get; } /** * Access rights for the current user for the file. * @see AccessFlags */ public abstract AccessFlags access_flags { get; default = AccessFlags.NONE; } /** * The parent URI. If this is the root, returns %NULL. */ public abstract File? parent { owned get; } /** * Implementation detail. Implementing classes override this to properly * associate the URI with the implementation pointer. */ protected abstract void init (string uri); /** * Whether something exists at the URI that the object represents. */ public abstract bool exists (); /** * Whether the file is readable. */ public bool is_readable () { return (this.access_flags & AccessFlags.READ) != 0; } /** * Whether the file is writable. */ public bool is_writable () { return (this.access_flags & AccessFlags.WRITE) != 0; } /** * Whether the file is executable. */ public bool is_executable () { return (this.access_flags & AccessFlags.EXECUTE) != 0; } /** * Adds a monitor to the file. * @return the monitor associated with the file */ public abstract FileMonitor monitor (); /** * Loads the contents of the file to a string. * @return %TRUE on success, %FALSE on failure. */ public abstract bool load_contents (out string contents, out size_t length) throws Error; /** * Saves a string to the specified file, replacing any content that may * have been in it. * @return %TRUE on success, %FALSE on failure. */ public abstract bool replace_contents (string contents) throws Error; /** * Launches the specified file with the default MIME application. * @return %TRUE on successful launch, %FALSE on failure. */ public abstract bool launch () throws Error; /** * Retrieves a list of child file objects for a given object. Only * guaranteed to work on directories. * @return a list of child file objects */ public abstract SList enumerate_children () throws Error; /** * Copies a file to another URI. This is a synchronous operation. Only * guaranteed to work on files, not directories. * @param destination the destination of the copied file. * @param overwrite if a file exists at the destination, whether to * overwrite it. */ public abstract bool copy (File destination, bool overwrite) throws Error; /** * Removes the specified file. Only works on files, not directories. * @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? file_new_for_path (string path) throws Error { unowned Implementation? vfs = get_default (); if (vfs == null) { return null; } else { return (File)Object.new (vfs.file_type, "path", path); } } public File? file_new_for_uri (string uri) throws Error { unowned Implementation? vfs = get_default (); if (vfs == null) { return null; } else { 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 : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file-impl-gio.vala0000664000175000017510000002071511536677677025135 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class FileGIO : File { private GLib.File _file; public override void* implementation { get { return (void*)this._file; } } private string _uri; protected override string? impl_path { owned get { return this._file.get_path (); } } protected override string impl_uri { owned get { if (this._uri == null) { this._uri = this._file.get_uri (); } return this._uri; } } public override FileType file_type { get { FileType ft = FileType.UNKNOWN; if (this.exists ()) { // File.query_file_type requires GIO 2.18... FileInfo info; GLib.FileType gft; try { info = this._file.query_info (FILE_ATTRIBUTE_STANDARD_TYPE, FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null); gft = (GLib.FileType)info.get_attribute_uint32 (FILE_ATTRIBUTE_STANDARD_TYPE); switch (gft) { case GLib.FileType.REGULAR: ft = FileType.REGULAR; break; case GLib.FileType.DIRECTORY: case GLib.FileType.MOUNTABLE: ft = FileType.DIRECTORY; break; case GLib.FileType.SYMBOLIC_LINK: case GLib.FileType.SHORTCUT: ft = FileType.SYMBOLIC_LINK; break; case GLib.FileType.SPECIAL: ft = FileType.SPECIAL; break; case GLib.FileType.UNKNOWN: ft = FileType.UNKNOWN; break; } } catch (Error err) { warning ("An error occurred while querying the file type: %s", err.message); ft = FileType.UNKNOWN; } } return ft; } } public override AccessFlags access_flags { get { AccessFlags flags = AccessFlags.NONE; if (this.exists ()) { FileInfo info; try { string attrs; attrs = "%s,%s,%s".printf (FILE_ATTRIBUTE_ACCESS_CAN_READ, FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE); info = this._file.query_info (attrs, FileQueryInfoFlags.NONE, null); if (info.get_attribute_boolean (FILE_ATTRIBUTE_ACCESS_CAN_READ)) { flags |= AccessFlags.READ; } if (info.get_attribute_boolean (FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) { flags |= AccessFlags.WRITE; } if (info.get_attribute_boolean (FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE)) { flags |= AccessFlags.EXECUTE; } } catch (Error err) { warning ("An error occurred while querying the access flags: %s", err.message); } } return flags; } } public override File? parent { owned get { GLib.File? file; file = this._file.get_parent (); if (file == null) { return null; } else { File result; result = new FileGIO (); result.init (file.get_uri ()); return result; } } } protected override void init (string uri) { this._file = GLib.File.new_for_uri (uri); } public override bool exists () { return this._file.query_exists (null); } public override FileMonitor monitor () { return new FileMonitorGIO (this); } public override bool load_contents (out string contents, out size_t length) throws Error { return this._file.load_contents (null, out contents, out length, null); } public override bool replace_contents (string contents) throws Error { return this._file.replace_contents (contents, contents.size (), null, false, 0, null, null); } public override bool launch () throws Error { AppInfo app_info; List files = new List (); app_info = this._file.query_default_handler (null); files.append (this._file); return app_info.launch (files, null); } public override SList enumerate_children () throws Error { SList children; FileEnumerator enumerator; FileInfo info; children = new SList (); enumerator = this._file.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, FileQueryInfoFlags.NONE, null); while ((info = enumerator.next_file (null)) != null) { GLib.File gchild; File child; gchild = this._file.get_child (info.get_name ()); child = file_new_for_uri (gchild.get_uri ()); children.append ((owned)child); } return children; } public override bool copy (File destination, bool overwrite) throws Error { FileCopyFlags flags = 0; if (overwrite) { flags = FileCopyFlags.OVERWRITE; } return this._file.copy ((GLib.File)destination.implementation, flags, null, null); } public override bool remove () throws Error { if (!this.exists ()) { throw new FileError.FILE_NOT_FOUND ("The file '%s' does not exist.", this.uri); } 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; } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/color.vala0000664000175000017510000001536311536677677023030 0ustar seagleseagle/* * 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 */ using Gdk; [CCode (cheader_filename = "libdesktop-agnostic/desktop-agnostic.h")] namespace DesktopAgnostic { public errordomain ColorParseError { INVALID_INPUT, INVALID_ALPHA } /** * Note: cannot use ushort in properties as Value cannot be mapped to it. */ public class Color : Object { const string HTML_STRING = "#%02hx%02hx%02hx%02hx"; const ushort HTML_SCALE = 256; private Gdk.Color _color; public Gdk.Color color { get { return this._color; } set { this._color = value; } } private ushort ushortify (uint value) throws ColorParseError { if (value < 0 || value > ushort.MAX) { throw new ColorParseError.INVALID_INPUT ("RGB values must be between 0 and %hu.", ushort.MAX); } return (ushort)value; } public uint red { get { return this._color.red; } set { this._color.red = this.ushortify (value); } } public uint green { get { return this._color.green; } set { this._color.green = this.ushortify (value); } } public uint blue { get { return this._color.blue; } set { this._color.blue = this.ushortify (value); } } private ushort _alpha = ushort.MAX; public uint alpha { get { return this._alpha; } set { this._alpha = this.ushortify (value); } } public Color (Gdk.Color color, ushort alpha) { this._color = color; this._alpha = alpha; } public Color.from_values (ushort red, ushort green, ushort blue, ushort alpha) { this._color = Gdk.Color (); this._color.red = red; this._color.green = green; this._color.blue = blue; this._alpha = alpha; } /** * Parses color from string. * @see Gdk.Color.parse */ public Color.from_string (string spec) throws ColorParseError { this._color = Gdk.Color (); this._alpha = ushort.MAX; // MIN = transparent, MAX = opaque string color_data; if (spec.get_char () == '#') { size_t cd_len = 0; unowned string color_hex = spec.offset (1); // adapted from pango_color_parse (), licensed under the LGPL2.1+. cd_len = (size_t)color_hex.size (); if (cd_len % 4 != 0 || cd_len < 4 || cd_len > 16) { throw new ColorParseError.INVALID_INPUT ("Invalid input size."); } size_t hex_len = cd_len / 4; size_t offset = hex_len * 3; string rgb_hex = color_hex.substring (0, (long)offset); unowned string alpha_hex = color_hex.offset ((long)offset); if (alpha_hex.scanf ("%" + hex_len.to_string () + "hx", ref this._alpha) == 0) { throw new ColorParseError.INVALID_ALPHA ("Could not parse alpha section of input: %s", alpha_hex); } ushort bits = (ushort)cd_len; this._alpha <<= 16 - bits; while (bits < 16) { this._alpha |= (this._alpha >> bits); bits *= 2; } color_data = "#" + rgb_hex; } else { // assume color name + no alpha color_data = spec; } if (!Gdk.Color.parse (color_data, out this._color)) { throw new ColorParseError.INVALID_INPUT ("Could not parse color string: %s", spec); } } public string to_html_color () { return HTML_STRING.printf (this.red / HTML_SCALE, this.green / HTML_SCALE, this.blue / HTML_SCALE, this._alpha / HTML_SCALE); } /** * Behaves the same as Gdk.Color.to_string (), except that it adds * alpha data. * @see Gdk.Color.to_string */ public string to_string () { string gdk_str = this._color.to_string (); return "%s%04x".printf (gdk_str, this._alpha); } /** * Returns the color values as doubles, where 0.0 < value <= 1.0. */ public void get_cairo_color (out double red = null, out double green = null, out double blue = null, out double alpha = null) { if (&red != null) { red = gdk_value_to_cairo ((ushort)this.red); } if (&green != null) { green = gdk_value_to_cairo ((ushort)this.green); } if (&blue != null) { blue = gdk_value_to_cairo ((ushort)this.blue); } if (&alpha != null) { alpha = gdk_value_to_cairo (this._alpha); } } /** * Sets the color with values as doubles, where 0.0 < value <= 1.0. */ public void set_cairo_color (double red, double green, double blue, double alpha) { if (red > 0.0f && red <= 1.0f) { this.red = cairo_value_to_gdk (red); } if (green > 0.0f && green <= 1.0f) { this.green = cairo_value_to_gdk (green); } if (blue > 0.0f && blue <= 1.0f) { this.blue = cairo_value_to_gdk (blue); } if (alpha > 0.0f && alpha <= 1.0f) { this._alpha = cairo_value_to_gdk (alpha); } } /** * Converts a single RGBA value for cairo to its GDK/Pango equivalent. */ public static ushort cairo_value_to_gdk (double value) { return (ushort)(Math.lround (value * 65536) - 1); } /** * Converts a single RGBA value for GDK/Pango to its cairo equivalent. */ public static double gdk_value_to_cairo (ushort value) { return (value + 1) / 65536.0; } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/wscript0000664000175000017510000001613311536677677022457 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import Task from TaskGen import feature, taskgen import os deps = { 'cfg': { 'gconf': { 'uselib': 'GCONF', 'packages': 'gconf-2.0', 'packages_private': 'config-notify-delegate', }, 'keyfile': { 'packages_private': 'config-notify-delegate', }, 'memory': { 'packages_private': 'config-notify-delegate', } }, 'vfs': { 'gio': { 'uselib': 'GIO', 'packages': 'gio-2.0', }, 'thunar-vfs': { 'uselib': 'THUNAR_VFS DBUS_GLIB', 'packages': 'thunar-vfs-1 dbus-glib-1', }, 'gnome-vfs': { 'uselib': 'GNOME_VFS', 'packages': 'gnome-vfs-2.0', } }, 'fdo': { 'gio': { 'uselib': 'GIO_UNIX', 'packages': 'gio-unix-2.0', }, 'gnome': { 'uselib': 'GNOME_DESKTOP', 'packages': 'gnome-desktop-2.0', } } } @taskgen @feature('cc') def generate_typelib(self): if hasattr(self, 'gir'): node = self.path.find_resource('%s.gir' % self.gir) if not node: print "Not a valid GIR file!" return task = self.create_task('typelib') bld = task.generator.bld task.set_inputs(node) target = '%s.typelib' % self.gir tnode = node.parent.find_or_declare(target) task.set_outputs(tnode) dirname = os.path.join(bld.bdir, tnode.bld_dir(task.env)) task.generator.env['CURRENT_BUILD_DIR'] = dirname bld.install_files('${LIBDIR}/girepository-1.0', tnode.abspath(task.env), task.env) def create_typelib_task(): rule = 'LD_LIBRARY_PATH="${CURRENT_BUILD_DIR}" ${G_IR_COMPILER} ' + \ '-o ${TGT} ${SRC}' Task.simple_task_type('typelib', rule, after='cc_link') create_typelib_task() def task_module(type_name, src_prefix): def build_module(bld, name): module = bld.new_task_gen('cc', 'shlib') module.source = ' '.join(['%s-%s.vala' % (prefix, name) for prefix in src_prefix.split()]) if type_name in deps and name in deps[type_name]: module.uselib = deps[type_name][name].get('uselib', '') module.packages = deps[type_name][name].get('packages', '') module.packages_private = deps[type_name][name] \ .get('packages_private', '') ftype, sep, tail = type_name.partition('-') module.uselib_local = 'desktop-agnostic-%s' % ftype module.target = 'da-%s-%s' % (type_name, name) module.vapi_dirs = '../vapi' module.includes = '..' module.install_path = None bld.install_files('${LIBDIR}/desktop-agnostic/modules', bld.env['shlib_PATTERN'] % module.target) return build_module def set_options(opt): opt.add_option('--config-backends', type='string', help='Determines which configuration backend(s) will be ' \ 'built.', dest='config_backends', default='') opt.add_option('--vfs-backends', type='string', help='Determines which VFS backend(s) will be built.', dest='vfs_backends', default='') opt.add_option('--desktop-entry-backends', type='string', help='Determines which desktop entry backend(s) will be ' \ 'built.', dest='de_backends', default='') def build(bld): lib = bld.new_task_gen('cc', 'shlib') lib.source = ' '.join([ 'color.vala', 'module.vala', ]) lib.packages = 'gdk-2.0 gmodule-2.0' lib.target = 'desktop-agnostic' if bld.env['INTROSPECTION']: lib.gir = 'DesktopAgnostic-1.0' lib.uselib = 'M GDK GMODULE' lib.packages_private = 'build' lib.includes = '..' lib.vapi_dirs = '../vapi' lib.vnum = bld.env['VNUM'] vfs = bld.new_task_gen('cc', 'shlib') vfs.source = ' '.join([ 'vfs.vala', 'vfs-bookmarks-gtk.vala', 'vfs-file.vala', 'vfs-file-monitor.vala', 'vfs-glob.vala', 'vfs-trash.vala', 'vfs-volume.vala', ]) vfs.packages = 'desktop-agnostic posix' vfs.target = 'desktop-agnostic-vfs' vfs.header = 'vfs' if bld.env['INTROSPECTION']: vfs.gir = 'DesktopAgnosticVFS-1.0' vfs.uselib_local = 'desktop-agnostic' vfs.packages_private = 'posix-glob' vfs.includes = '..' vfs.vapi_dirs = '../vapi .' vfs.vnum = bld.env['VNUM'] cfg = bld.new_task_gen('cc', 'shlib') cfg.source = ' '.join([ 'config.vala', 'config-bridge.vala', 'config-client.vala', 'config-schema.vala', 'config-schema-option.vala', 'config-schema-type.vala', ]) cfg.packages = 'desktop-agnostic-vfs' cfg.target = 'desktop-agnostic-cfg' cfg.header = 'config' if bld.env['INTROSPECTION']: cfg.gir = 'DesktopAgnosticConfig-1.0' cfg.uselib_local = 'desktop-agnostic-vfs' cfg.packages_private = 'hashtable-gtype-key' cfg.includes = '..' cfg.vapi_dirs = '../vapi .' cfg.vnum = bld.env['VNUM'] fdo = bld.new_task_gen('cc', 'shlib') fdo.source = ' '.join([ 'desktop-entry.vala', ]) fdo.packages = 'desktop-agnostic-vfs' fdo.target = 'desktop-agnostic-fdo' fdo.header = 'fdo' if bld.env['INTROSPECTION']: fdo.gir = 'DesktopAgnosticFDO-1.0' fdo.uselib_local = 'desktop-agnostic-vfs' fdo.vapi_dirs = '.' fdo.includes = '..' fdo.vnum = bld.env['VNUM'] ui = bld.new_task_gen('cc', 'shlib') ui.source = ' '.join([ 'ui-color-button.vala', 'ui-icon-button.vala', 'ui-icon-chooser-dialog.vala', 'ui-launcher-editor-dialog.vala', ]) ui.packages = 'desktop-agnostic-fdo gtk+-2.0' ui.packages_private = 'build' ui.target = 'desktop-agnostic-ui' ui.header = 'ui' if bld.env['INTROSPECTION']: ui.gir = 'DesktopAgnosticUI-1.0' ui.uselib = 'GTK' ui.uselib_local = 'desktop-agnostic-fdo' ui.vapi_dirs = '. ../vapi' ui.includes = '..' ui.vnum = bld.env['VNUM'] [task_module('cfg', 'config-impl')(bld, name) for name in bld.env['BACKENDS_CFG']] [task_module('cfg-type', 'config-type')(bld, name) for name in ['color']] vfs_types = ['vfs-impl', 'vfs-file-impl', 'vfs-file-monitor-impl', 'vfs-trash-impl', 'vfs-volume-impl'] [task_module('vfs', ' '.join(vfs_types))(bld, name) for name in bld.env['BACKENDS_VFS']] [task_module('fdo', 'desktop-entry-impl')(bld, name) for name in bld.env['BACKENDS_DE']] mod_guess = bld.new_task_gen('cc', 'shlib') mod_guess.source = 'module-guesser.vala' mod_guess.uselib_local = 'desktop-agnostic-vfs' mod_guess.target = 'da-module-guesser' mod_guess.vapi_dirs = '../vapi' mod_guess.includes = '..' mod_guess.install_path = None bld.install_files('${LIBDIR}/desktop-agnostic/modules', bld.env['shlib_PATTERN'] % mod_guess.target) libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-client.vala0000664000175000017510000002617211536677677024433 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; namespace DesktopAgnostic.Config { public enum BindMethod { /** * Bind the global only to the property. */ GLOBAL, /** * Bind the instance only to the property. */ INSTANCE, /** * Bind the global to the property if the instance doesn't exist. */ FALLBACK, /** * Bind the global key to property_name-base, and the instance key * to property_name. */ BOTH } /** * A wrapper for {@link Config.Backend} and {@link Config.Bridge} * which handles calls to the global and/or instance objects * of {@link Config.Backend}. * * NOTE: Unknown bizarre behavior may occur if one instantiates two instances * of this class using the same schema, but different instance IDs. */ public class Client : Object { private Schema _schema; private Backend global; private Backend? instance; // properties public string? instance_id { get { if (this.instance == null) { return null; } else { return this.instance.instance_id; } } construct { if (value != null && !this.create_instance_config (value)) { warning ("The configuration schema has declared that there can only be a single configuration instance."); warning ("Not creating an instance config object."); } } } public string schema_filename { construct { if (value != null) { try { this._schema = new Schema (value); this.create_global_config (); } catch (GLib.Error err) { critical ("Config error: %s", err.message); } } } } // constructors public Client (string schema_filename) { GLib.Object (schema_filename: schema_filename); } public Client.for_instance (string schema_filename, string instance_id) throws GLib.Error { GLib.Object (schema_filename: schema_filename, instance_id: instance_id); } /** * Auto-determines whether an instance config object should be created. */ public Client.for_schema (Schema schema, string? instance_id) throws GLib.Error { this._schema = schema; this.create_global_config (); if (instance_id != null) { this.create_instance_config (instance_id); } } // helper methods private void create_global_config () { this.global = Config.new (this._schema); } /** * @return whether an instance config object was created. */ private bool create_instance_config (string instance_id) throws GLib.Error { Value single_instance = this._schema.get_metadata_option ("single_instance"); if ((bool)single_instance) { return false; } else { this.instance = Config.new_for_instance (instance_id, this._schema); return true; } } private unowned Backend get_backend (string group, string key) { if (this.instance == null || !this._schema.get_option (group, key).per_instance) { return this.global; } else { return this.instance; } } // methods public bool get_bool (string group, string key) throws GLib.Error { return this.get_backend (group, key).get_bool (group, key); } public void set_bool (string group, string key, bool value) throws GLib.Error { this.get_backend (group, key).set_bool (group, key, value); } public int get_int (string group, string key) throws GLib.Error { return this.get_backend (group, key).get_int (group, key); } public void set_int (string group, string key, int value) throws GLib.Error { this.get_backend (group, key).set_int (group, key, value); } public float get_float (string group, string key) throws GLib.Error { return this.get_backend (group, key).get_float (group, key); } public void set_float (string group, string key, float value) throws GLib.Error { this.get_backend (group, key).set_float (group, key, value); } public string get_string (string group, string key) throws GLib.Error { return this.get_backend (group, key).get_string (group, key); } public void set_string (string group, string key, string value) throws GLib.Error { this.get_backend (group, key).set_string (group, key, value); } public ValueArray get_list (string group, string key) throws GLib.Error { return this.get_backend (group, key).get_list (group, key); } public void set_list (string group, string key, ValueArray value) throws GLib.Error { this.get_backend (group, key).set_list (group, key, value); } /** * Retrieves the value of the configuration key. If the client has an * instance ID and the key cannot be found in the instance config, it * falls back to retrieving the value from the global config. */ public Value get_value (string group, string key) throws GLib.Error { Value? temp_val = null; Value val; try { if (this.instance != null && this._schema.get_option (group, key).per_instance) { temp_val = this.instance.get_value (group, key); } } catch (GLib.Error err) { if (!(err is Config.Error.KEY_NOT_FOUND)) { throw err; } } if (temp_val == null) { val = this.global.get_value (group, key); } else { val = temp_val; } return val; } public void set_value (string group, string key, Value value) throws GLib.Error { this.get_backend (group, key).set_value (group, key, value); } public void notify_add (string group, string key, NotifyFunc callback) throws GLib.Error { this.get_backend (group, key).notify_add (group, key, callback); } public new void notify (string group, string key) throws GLib.Error { this.get_backend (group, key).notify (group, key); } public void notify_remove (string group, string key, NotifyFunc callback) throws GLib.Error { this.get_backend (group, key).notify_remove (group, key, callback); } public void remove_instance () { this.instance = null; } public void reset (bool instance_only) throws GLib.Error { if (this.instance != null) { this.instance.reset (); } if (!instance_only) { this.global.reset (); } } /** * Binds a config key to a property of an object. * * @param group The configuration group. * @param key The configuration key. * @param obj The object to which to bind the config key. * @param property_name The name of the property to bind. Has an additional * use if //method// is {@link BindMethod.BOTH}. * @param read_only if TRUE, setting the object property does not propagate * to the config backend(s). * @param method The method of binding the config backend(s) to the object. * @see BindMethod */ public void bind (string group, string key, Object obj, string property_name, bool read_only, BindMethod method) throws Error { unowned Bridge bridge = Bridge.get_default (); unowned SchemaOption option = this._schema.get_option (group, key); if (option == null) { warning ("Could not find the schema option for %s/%s, not binding.", group, key); return; } if (method == BindMethod.GLOBAL || method == BindMethod.BOTH || (method == BindMethod.FALLBACK && (this.instance == null || !option.per_instance))) { string global_prop; if (method == BindMethod.BOTH) { global_prop = "%s-base".printf (property_name); } else { global_prop = property_name; } bridge.bind (this.global, group, key, obj, global_prop, read_only); } if (this.instance != null && option.per_instance && (method == BindMethod.INSTANCE || method == BindMethod.BOTH || method == BindMethod.FALLBACK)) { bridge.bind (this.instance, group, key, obj, property_name, read_only); } } /** * Removes the bindings between a config key and a GObject property. */ public void unbind (string group, string key, Object obj, string property_name, bool read_only, BindMethod method) throws Error { unowned Bridge bridge = Bridge.get_default (); unowned SchemaOption option = this._schema.get_option (group, key); if (option == null) { warning ("Could not find the schema option for %s/%s, not binding.", group, key); return; } if (method == BindMethod.GLOBAL || method == BindMethod.BOTH || (method == BindMethod.FALLBACK && (this.instance == null || !option.per_instance))) { string global_prop; if (method == BindMethod.BOTH) { global_prop = "%s-base".printf (property_name); } else { global_prop = property_name; } bridge.remove (this.global, group, key, obj, global_prop); } if (this.instance != null && option.per_instance && (method == BindMethod.INSTANCE || method == BindMethod.BOTH || method == BindMethod.FALLBACK)) { bridge.remove (this.instance, group, key, obj, property_name); } } /** * Removes all of the bindings for a given object. */ public void unbind_all_for_object (Object obj) throws GLib.Error { unowned Bridge bridge = Bridge.get_default (); if (this.instance != null) { bridge.remove_all_for_object (this.instance, obj); } bridge.remove_all_for_object (this.global, obj); } } } // vim: set et ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-volume.vala0000664000175000017510000000510711536677677024010 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; namespace DesktopAgnostic.VFS { public errordomain VolumeError { MOUNT, UNMOUNT, EJECT } public interface Volume : Object { public delegate void Callback (); /** * The name of the volume. */ public abstract string name { get; } /** * Usually, the mount point of the volume. */ public abstract File uri { get; } /** * Either an icon name usable with gtk.IconTheme, or an absolute path to * an image (either of which are associated with the volume). */ public abstract string? icon { owned get; } /** * Tells whether the volume is mounted. */ public abstract bool is_mounted (); public abstract void mount (Callback callback); public abstract bool mount_finish () throws VolumeError; public abstract void unmount (Callback callback); public abstract bool unmount_finish () throws VolumeError; public abstract bool can_eject (); public abstract void eject (Callback callback); public abstract bool eject_finish () throws VolumeError; } public interface VolumeMonitor : Object { public abstract void* implementation { get; } public abstract List volumes { owned get; } public abstract signal void volume_mounted (Volume volume); public abstract signal void volume_unmounted (Volume volume); } public unowned VFS.VolumeMonitor? volume_monitor_get_default () throws GLib.Error { unowned VFS.Implementation? vfs = get_default (); if (vfs == null) { return null; } else { return vfs.volume_monitor_get_default (); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-impl-thunar-vfs.vala0000664000175000017510000000473711536677677025545 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class ThunarVFSImplementation : Object, Implementation { public string name { get { return "Thunar VFS"; } } public Type file_type { get { return typeof (FileThunarVFS); } } public Type file_monitor_type { get { return typeof (FileMonitorThunarVFS); } } public Type trash_type { get { return typeof (TrashThunarVFS); } } public Type volume_type { get { return typeof (VolumeThunarVFS); } } public void init () { ThunarVfs.init (); } public SList files_from_uri_list (string uri_list) throws GLib.Error { SList files = new SList (); unowned List paths = ThunarVfs.PathList.from_string (uri_list); foreach (unowned ThunarVfs.Path path in paths) { unowned string uri = path.dup_uri (); File file = file_new_for_uri (uri); files.append ((owned)file); } return files; } private VolumeMonitor vmonitor; public unowned VolumeMonitor volume_monitor_get_default () { if (vmonitor == null) { vmonitor = new VolumeMonitorThunarVFS (); } return vmonitor; } public void shutdown () { ThunarVfs.shutdown (); } } } public Type register_plugin () { return typeof (DesktopAgnostic.VFS.ThunarVFSImplementation); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-notify-delegate.c0000664000175000017510000000477111536677677025535 0ustar seagleseagle/* * A configuration notification delegate structure. * * 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 typedef struct _DesktopAgnosticConfigNotifyDelegate { DesktopAgnosticConfigNotifyFunc callback; gpointer target; } DesktopAgnosticConfigNotifyDelegate; static DesktopAgnosticConfigNotifyDelegate * desktop_agnostic_config_notify_delegate_new (DesktopAgnosticConfigNotifyFunc callback, gpointer target) { DesktopAgnosticConfigNotifyDelegate *self = NULL; g_return_val_if_fail (callback != NULL, self); self = g_slice_new0 (DesktopAgnosticConfigNotifyDelegate); self->callback = callback; self->target = target; return self; } static void desktop_agnostic_config_notify_delegate_execute (DesktopAgnosticConfigNotifyDelegate *self, const gchar *group, const gchar *key, GValue *value) { self->callback (group, key, value, self->target); } static int desktop_agnostic_config_notify_delegate_compare (gpointer a, gpointer b) { DesktopAgnosticConfigNotifyDelegate *del_a; DesktopAgnosticConfigNotifyDelegate *del_b; del_a = (DesktopAgnosticConfigNotifyDelegate*)a; del_b = (DesktopAgnosticConfigNotifyDelegate*)b; if (del_a->callback == del_b->callback && del_a->target == del_b->target) { return 0; } else { return 1; } } static void desktop_agnostic_config_notify_delegate_free (DesktopAgnosticConfigNotifyDelegate *self) { g_slice_free (DesktopAgnosticConfigNotifyDelegate, self); } /* vim: set et ts=2 sts=2 sw=2 ai : */ libdesktop-agnostic-0.3.92/libdesktop-agnostic/hashtable-gtype-key.c0000664000175000017510000000442511536677677025055 0ustar seagleseagle/* * GType key functions for GHashTable. * * 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 /** * desktop_agnostic_config_gtype_equal: * @v1: a pointer to a #GType key. * @v2: a pointer to a #GType key to compare with @v1. * * Compares the two #GType values being pointed to and returns * %TRUE if they are equal. * It can be passed to g_hash_table_new() as the @key_equal_func * parameter, when using pointers to GType values as keys in a #GHashTable. * * Originally based on %g_int64_equal. * * Returns: %TRUE if the two keys match. */ static gboolean desktop_agnostic_config_gtype_equal (gconstpointer v1, gconstpointer v2) { /* this is the way that it would work if Vala didn't do GINT_TO_POINTER. return *((const GType*) v1) == *((const GType*) v2); */ return GPOINTER_TO_UINT (v1) == GPOINTER_TO_UINT (v2); } /** * desktop_agnostic_config_gtype_hash: * @v: a pointer to a #GType key * * Converts a pointer to a #GType to a hash value. * It can be passed to g_hash_table_new() as the @hash_func parameter, * when using pointers to GType values as keys in a #GHashTable. * * Originally based on %g_int64_hash. * * Returns: a hash value corresponding to the key. */ static guint desktop_agnostic_config_gtype_hash (gconstpointer v) { /* this is the way that it would work if Vala didn't do GINT_TO_POINTER. return (guint) *(const GType*) v; */ return (guint) GPOINTER_TO_UINT (v); } libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-impl-gconf.vala0000664000175000017510000004540611536677677025211 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.Config; namespace DesktopAgnostic.Config { private const string BACKEND_NAME = "GConf"; public class GConfBackend : Backend { private string schema_path; private string path; private unowned GConf.Client client; private uint connection_id; private Datalist> _notifiers; public override string name { owned get { return BACKEND_NAME; } } construct { this.client = GConf.Client.get_default (); } public override void constructed () { string opt_prefix = this.name + "."; string base_path; Schema schema = this.schema; this.connection_id = 0; this._notifiers = Datalist> (); base_path = schema.get_metadata_option (opt_prefix + "base_path").get_string (); this.schema_path = "/schemas%s/%s".printf (base_path, schema.app_name); if (this.instance_id == null) { this.path = "%s/%s".printf (base_path, schema.app_name); } else { string option = schema.get_metadata_option (opt_prefix + "base_instance_path").get_string (); this.path = "%s/%s/%s".printf (option.replace ("${base_path}", base_path), schema.app_name, this.instance_id); // associate instance with schema try { this.associate_schemas_in_dir (this.schema_path, this.path); } catch (GLib.Error err) { critical ("Error associating instance with schema: %s", err.message); } } // XXX gconf_client_add_dir is a bizarre API call that is needed for // notification support. This should probably be looked at in greater // detail. One thing's for sure: do not call it recursively. try { this.client.add_dir (this.path, GConf.ClientPreloadType.RECURSIVE); this.connection_id = this.client.notify_add (this.path, this.notify_proxy); } catch (GLib.Error err) { critical ("Config (GConf) error: %s", err.message); } } ~GConfBackend () { try { this.client.notify_remove (this.connection_id); this.client.remove_dir (this.path); } catch (GLib.Error err) { critical ("Config (GConf) error: %s", err.message); } } /** * Ported from #panel_applet_associate_schemas_in_dir (). */ private void associate_schemas_in_dir (string schema_dir, string pref_dir) throws GLib.Error { SList entries; SList subdirs; entries = this.client.all_entries (schema_dir); foreach (GConf.Entry entry in entries) { string schema_key; string key; GConf.Entry? pref_entry; string pref_schema_key; string cgroup; string ckey; SchemaOption option; schema_key = entry.get_key (); key = "%s/%s".printf (pref_dir, Path.get_basename (schema_key)); /* Associating a schema is potentially expensive, so let's try * to avoid this by doing it only when needed. So we check if * the key is already correctly associated. */ pref_entry = this.client.get_entry (key, null, true); this.parse_group_and_key (key, out cgroup, out ckey); option = this.schema.get_option (cgroup, ckey); if (option == null || !option.per_instance) { continue; } if (pref_entry == null) { pref_schema_key = null; } else { pref_schema_key = pref_entry.get_schema_name (); } if (schema_key != pref_schema_key) { this.client.engine.associate_schema (key, schema_key); if (pref_entry == null || pref_entry.get_value () == null || pref_entry.get_is_default ()) { /* unset the key: gconf_client_get_entry() * brought an invalid entry in the client * cache, and we want to fix this */ this.client.unset (key); } } } subdirs = this.client.all_dirs (schema_dir); foreach (unowned string dir in subdirs) { string base_key; string schema_subdir; string pref_subdir; base_key = Path.get_basename (dir); schema_subdir = "%s/%s".printf (schema_dir, base_key); pref_subdir = "%s/%s".printf (pref_dir, base_key); this.associate_schemas_in_dir (schema_subdir, pref_subdir); } } private string generate_key (string group, string? key) { string full_key; if (key == null) { if (group == GROUP_DEFAULT) { full_key = this.path; } else { full_key = "%s/%s".printf (this.path, group); } } else { if (group == GROUP_DEFAULT) { full_key = "%s/%s".printf (this.path, key); } else { full_key = "%s/%s/%s".printf (this.path, group, key); } } return full_key; } private void parse_group_and_key (string full_key, out string group, out string key) { unowned string key_to_parse = full_key.offset (this.path.length + 1); unowned string? last_slash = key_to_parse.rchr (key_to_parse.length, '/'); if (last_slash == null) { group = GROUP_DEFAULT; key = key_to_parse; } else { long offset = key_to_parse.pointer_to_offset (last_slash); group = key_to_parse.substring (0, offset); key = key_to_parse.offset (offset + 1); } } private GConf.ValueType type_to_valuetype (Type type) { GConf.ValueType vt; if (type == typeof (bool)) { vt = GConf.ValueType.BOOL; } else if (type == typeof (float)) { vt = GConf.ValueType.FLOAT; } else if (type == typeof (int)) { vt = GConf.ValueType.INT; } else if (type == typeof (string)) { vt = GConf.ValueType.STRING; } else if (type == typeof (ValueArray)) { vt = GConf.ValueType.LIST; } else if (this.schema.find_type (type) != null) { vt = GConf.ValueType.STRING; } else { vt = GConf.ValueType.INVALID; } return vt; } private GLib.Value gconfvalue_to_gvalue (string group, string key, GConf.Value gc_val) throws Error { SchemaOption? schema_option; Type type; GLib.Value value; schema_option = this.schema.get_option (group, key); if (schema_option == null) { throw new Error.KEY_NOT_FOUND ("The config key '%s/%s' does not exist in the schema.", group, key); } type = schema_option.option_type; if (type == typeof (bool)) { value = gc_val.get_bool (); } else if (type == typeof (float)) { value = (float)gc_val.get_float (); } else if (type == typeof (int)) { value = gc_val.get_int (); } else if (type == typeof (string)) { value = gc_val.get_string (); } else if (type == typeof (ValueArray)) { Type list_type; ValueArray array; value = Value (type); list_type = schema_option.list_type; array = this.slist_to_valuearray (gc_val.get_list (), list_type); value.set_boxed ((owned)array); } else { SchemaType st = this.schema.find_type (type); if (st == null) { throw new Error.INVALID_TYPE ("Invalid config value type."); } else { value = st.deserialize (gc_val.get_string ()); } } return value; } private GLib.ValueArray slist_to_valuearray (SList list, Type type) throws Error { GLib.ValueArray arr = new GLib.ValueArray (list.length ()); foreach (unowned GConf.Value gc_val in list) { GLib.Value val; if (type == typeof (bool)) { val = gc_val.get_bool (); } else if (type == typeof (float)) { val = (float)gc_val.get_float (); } else if (type == typeof (int)) { val = gc_val.get_int (); } else if (type == typeof (string)) { val = gc_val.get_string (); } else { SchemaType st = this.schema.find_type (type); if (st == null) { throw new Error.INVALID_TYPE ("Invalid config value type: %s.", type.name ()); } else { val = st.deserialize (gc_val.get_string ()); } } arr.append (val); } return arr; } private void notify_proxy (GConf.Client client, uint cnxn_id, GConf.Entry entry) { string full_key = entry.get_key (); string group; string key; Value value; this.parse_group_and_key (full_key, out group, out key); value = this.gconfvalue_to_gvalue (group, key, entry.get_value ()); unowned SList notify_func_list = this._notifiers.get_data (full_key); foreach (unowned NotifyDelegate notify_func in notify_func_list) { notify_func.execute (group, key, value); } } private void _ensure_key_exists (string group, string key) throws Error { if (this.schema.get_option (group, key) == null) { throw new Error.KEY_NOT_FOUND ("The config key '%s/%s' does not exist in the schema.", group, key); } } public override void remove () throws GLib.Error { this.client.recursive_unset (this.path, 0); } public override void notify_add (string group, string key, NotifyFunc callback) throws GLib.Error { NotifyDelegate notify; string full_key; unowned SList? callbacks; notify = new NotifyDelegate (callback); full_key = this.generate_key (group, key); callbacks = this._notifiers.get_data (full_key); callbacks.append ((owned)notify); this._notifiers.set_data (full_key, callbacks); } public override void notify (string group, string key) throws GLib.Error { string full_key = this.generate_key (group, key); unowned SList notifications; Value value; notifications = this._notifiers.get_data (full_key); value = this.get_value (group, key); foreach (unowned NotifyDelegate notify in notifications) { notify.execute (group, key, value); } } public override void notify_remove (string group, string key, NotifyFunc callback) throws GLib.Error { string full_key = this.generate_key (group, key); unowned SList funcs = this._notifiers.get_data (full_key); NotifyDelegate ndata = new NotifyDelegate (callback); unowned SList? node; node = funcs.find_custom (ndata, (CompareFunc)NotifyDelegate.compare); if (node != null) { node.data = null; funcs.delete_link (node); this._notifiers.set_data (full_key, funcs); } } public override void reset () throws GLib.Error { Schema schema = this.schema; foreach (unowned string group in schema.get_groups ()) { foreach (unowned string key in schema.get_keys (group)) { string full_key; GConf.Value val; full_key = this.generate_key (group, key); val = this.client.get_default_from_schema (full_key); this.client.set (full_key, val); } } } public override GLib.Value get_value (string group, string key) throws GLib.Error { string full_key; unowned GConf.Value? gc_val; GConf.Entry? entry; GLib.Value val; full_key = this.generate_key (group, key); entry = this.client.get_entry (full_key, null, true); gc_val = entry.get_value (); if (gc_val == null) { throw new Error.KEY_NOT_FOUND ("Could not find the key specified: %s.", full_key); } else { val = this.gconfvalue_to_gvalue (group, key, gc_val); } return val; } public override bool get_bool (string group, string key) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); return this.client.get_bool (full_key); } public override void set_bool (string group, string key, bool value) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); this.client.set_bool (full_key, value); } public override float get_float (string group, string key) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); return (float)this.client.get_float (full_key); } public override void set_float (string group, string key, float value) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); this.client.set_float (full_key, value); } public override int get_int (string group, string key) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); return this.client.get_int (full_key); } public override void set_int (string group, string key, int value) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); this.client.set_int (full_key, value); } public override string get_string (string group, string key) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); return this.client.get_string (full_key); } public override void set_string (string group, string key, string value) throws GLib.Error { string full_key; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); this.client.set_string (full_key, value); } public override GLib.ValueArray get_list (string group, string key) throws GLib.Error { string full_key; Type list_type; GConf.Value gc_val; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); list_type = this.schema.get_option (group, key).list_type; gc_val = this.client.get (full_key); return this.slist_to_valuearray (gc_val.get_list (), list_type); } public override void set_list (string group, string key, GLib.ValueArray value) throws GLib.Error { string full_key; Type type; this._ensure_key_exists (group, key); full_key = this.generate_key (group, key); type = this.schema.get_option (group, key).list_type; if (type == typeof (bool) || type == typeof (float) || type == typeof (int)) { SList list; GConf.Value val; GConf.ValueType gc_type = this.type_to_valuetype (type); list = new SList (); foreach (unowned GLib.Value list_val in value) { GConf.Value gc_val; gc_val = new GConf.Value (gc_type); if (type == typeof (bool)) { gc_val.set_bool (list_val.get_boolean ()); } else if (type == typeof (float)) { gc_val.set_float (get_float_from_value (list_val)); } else if (type == typeof (int)) { gc_val.set_int (get_int_from_value (list_val)); } else { // should not be reached throw new Error.INVALID_TYPE ("Invalid config value type: %s.", type.name ()); } list.append ((owned)gc_val); } val = new GConf.Value (GConf.ValueType.LIST); val.set_list_type (gc_type); val.set_list (list); this.client.set (full_key, val); } else // handle strings via the set_list method. { SchemaType? st = null; SList list; if (type != typeof (string)) { st = Schema.find_type (type); if (st == null) { throw new Error.INVALID_TYPE ("Invalid config value type: %s.", type.name ()); } } list = new SList (); foreach (unowned GLib.Value list_val in value) { if (st == null) { list.append ((string)list_val); } else { list.append (st.serialize (list_val)); } } this.client.set_list (full_key, GConf.ValueType.STRING, list); } } } } public Type register_plugin () { GLib.Value val; unowned HashTable backend_metadata_keys; val = "/apps"; backend_metadata_keys = Backend.get_backend_metadata_keys (); backend_metadata_keys.insert ("%s.base_path".printf (BACKEND_NAME), val); val = "${base_path}/instances"; backend_metadata_keys.insert ("%s.base_instance_path".printf (BACKEND_NAME), val); return typeof (GConfBackend); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-trash-impl-gio.vala0000664000175000017510000000744311536677677025342 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class TrashGIO : Trash, Object { private File trash; private FileMonitor monitor; private uint _file_count; construct { this.trash = file_new_for_uri ("trash://"); if (this.trash == null) { critical ("trash is NULL!!!!"); } this.monitor = this.trash.monitor (); this.monitor.changed += this.on_trash_changed; this._file_count = 0; this.update_file_count (); } public uint file_count { get { return this._file_count; } } private void on_trash_changed (FileMonitor monitor, File file, File? other_file, FileMonitorEvent event_type) { this.update_file_count (); } private void update_file_count () { GLib.File dir = (GLib.File)this.trash.implementation; dir.query_info_async (FILE_ATTRIBUTE_TRASH_ITEM_COUNT, FileQueryInfoFlags.NONE, Priority.DEFAULT, null, this.on_trash_count); } private void on_trash_count (Object? obj, AsyncResult res) { GLib.File dir = (GLib.File)obj; FileInfo file_info; try { 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 (); } catch (Error err) { warning ("Could not update file count: %s", err.message); } } private void do_empty (GLib.File dir) { FileEnumerator files = null; FileInfo info; try { string attrs = FILE_ATTRIBUTE_STANDARD_NAME + "," + FILE_ATTRIBUTE_STANDARD_TYPE; files = dir.enumerate_children (attrs, FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null); } catch (Error e) { warning ("Trash error: %s", e.message); } if (files == null) { return; } while ((info = files.next_file (null)) != null) { GLib.File child; child = dir.get_child (info.get_name ()); if (info.get_file_type () == GLib.FileType.DIRECTORY) { this.do_empty (child); } try { child.delete (null); } catch (Error e) { warning ("Trash error: %s", e.message); } } } public void send_to_trash (File uri) throws GLib.Error { GLib.File file = (GLib.File)uri.implementation; file.trash (null); } public void empty () { this.do_empty ((GLib.File)this.trash.implementation); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-impl-memory.vala0000664000175000017510000001525211536677677025421 0ustar seagleseagle/* * An in-memory implemenation 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 */ namespace DesktopAgnostic.Config { public class Memory : Backend { private Datalist values; private Datalist> _notifiers; public override string name { owned get { return "Memory"; } } construct { if (this.schema != null) { try { this.reset (); } catch (GLib.Error err) { critical ("Error: %s", err.message); } this._notifiers = Datalist> (); } } public override void reset () throws Error { Schema? schema = this.schema; if (schema == null) { throw new Error.NO_SCHEMA ("The schema was not loaded."); } this.values = Datalist (); foreach (string group in schema.get_groups ()) { foreach (string key in schema.get_keys (group)) { string full_key = "%s/%s".printf (group, key); SchemaOption option = schema.get_option (group, key); this.values.set_data (full_key, option.default_value); } } } public override void notify_add (string group, string key, NotifyFunc callback) throws GLib.Error { string full_key = "%s/%s".printf (group, key); unowned SList? funcs = this._notifiers.get_data (full_key); NotifyDelegate data = new NotifyDelegate (callback); funcs.append ((owned)data); this._notifiers.set_data (full_key, funcs); } public override void notify (string group, string key) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value value = this.get_value (group, key); unowned SList funcs = this._notifiers.get_data (full_key); foreach (unowned NotifyDelegate data in funcs) { if (data != null && data.callback != null) { data.execute (group, key, value); } } } public override void notify_remove (string group, string key, NotifyFunc callback) throws GLib.Error { string full_key = "%s/%s".printf (group, key); unowned SList funcs = this._notifiers.get_data (full_key); NotifyDelegate ndata = new NotifyDelegate (callback); unowned SList? node; node = funcs.find_custom (ndata, (CompareFunc)NotifyDelegate.compare); if (node != null) { node.data = null; funcs.delete_link (node); this._notifiers.set_data (full_key, funcs); } } public override void remove () throws GLib.Error { this.reset (); } public override Value get_value (string group, string key) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value? result = this.values.get_data (full_key); if (result == null) { throw new Error.KEY_NOT_FOUND ("Could not find the key specified: %s.", full_key); } else { return result; } } public override void set_value (string group, string key, Value value) throws GLib.Error { string full_key = "%s/%s".printf (group, key); unowned Value val = value; this.values.set_data (full_key, val); this.notify (group, key); } public override bool get_bool (string group, string key) throws GLib.Error { return this.get_value (group, key).get_boolean (); } public override void set_bool (string group, string key, bool value) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value val = this.get_value (group, key); val.set_boolean (value); this.values.set_data (full_key, val); this.notify (group, key); } public override float get_float (string group, string key) throws Error { return this.get_value (group, key).get_float (); } public override void set_float (string group, string key, float value) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value val = this.get_value (group, key); val.set_float (value); this.values.set_data (full_key, val); this.notify (group, key); } public override int get_int (string group, string key) throws GLib.Error { return this.get_value (group, key).get_int (); } public override void set_int (string group, string key, int value) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value val = this.get_value (group, key); val.set_int (value); this.values.set_data (full_key, val); this.notify (group, key); } public override string get_string (string group, string key) throws GLib.Error { return this.get_value (group, key).get_string (); } public override void set_string (string group, string key, string value) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value val = this.get_value (group, key); val.set_string (value); this.values.set_data (full_key, val); this.notify (group, key); } public override ValueArray get_list (string group, string key) throws GLib.Error { Value val = this.get_value (group, key); return ((ValueArray)val).copy (); } public override void set_list (string group, string key, ValueArray value) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value val = this.get_value (group, key); val.set_boxed (value); this.values.set_data (full_key, val); this.notify (group, key); } } } public Type register_plugin () { return typeof (DesktopAgnostic.Config.Memory); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/desktop-entry-impl-glib.vala0000664000175000017510000004047411536677677026375 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; namespace DesktopAgnostic.FDO { private const string GROUP = "Desktop Entry"; public class DesktopEntryGLib : 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; } } /** * Ported from EggDesktopFile. */ private string get_quoted_word (string word, bool in_single_quotes, bool in_double_quotes) { string result = ""; if (!in_single_quotes && !in_double_quotes) { result += "'"; } else if (!in_single_quotes && in_double_quotes) { result += "\"'"; } if (word.contains ("'")) { for (string s = word; s != null && s.len () > 0; s = s.next_char ()) { string chr = s.substring (0, 1); if (chr == "'") { result += "'\\''"; } else { result += chr; } } } else { result += word; } if (!in_single_quotes && !in_double_quotes) { result += "'"; } else if (!in_single_quotes && in_double_quotes) { result += "'\""; } return result; } /** * Ported from EggDesktopFile. */ private string do_percent_subst (string code, SList? documents, bool in_single_quotes, bool in_double_quotes) { switch (code) { case "%": return "%"; case "F": case "U": string result = ""; foreach (unowned string doc in documents) { result += " " + this.get_quoted_word (doc, in_single_quotes, in_double_quotes); } return result; case "f": case "u": if (documents == null) { return ""; } else { return " " + this.get_quoted_word (documents.data, in_single_quotes, in_double_quotes); } case "i": string? icon = this.icon; if (icon == null) { return ""; } else { return "--icon " + this.get_quoted_word (icon, in_single_quotes, in_double_quotes); } case "c": string? name = this.name; if (name == null) { return ""; } else { return this.get_quoted_word (name, in_single_quotes, in_double_quotes); } case "k": if (this._file == null) { return ""; } else { return this._file.uri; } case "D": case "N": case "d": case "n": case "v": case "m": // deprecated, skip return ""; default: warning ("Unrecognized %%-code '%%%s' in Exec.", code); return ""; } } /** * Ported from EggDesktopFile. */ private string? parse_exec (SList? documents) { string exec; string command = ""; bool escape, single_quot, double_quot; if (!this._keyfile.has_key (GROUP, "Exec")) { return null; } exec = this.get_string ("Exec"); escape = single_quot = double_quot = false; for (string s = exec; s != null && s.len () > 0; s = s.next_char ()) { string chr = s.substring (0, 1); if (escape) { escape = false; command += chr; } else if (chr == "\\") { if (!single_quot) { escape = true; } command += chr; } else if (chr == "'") { command += chr; if (!single_quot && !double_quot) { single_quot = true; } else if (single_quot) { single_quot = false; } } else if (chr == "\"") { command += chr; if (!single_quot && !double_quot) { double_quot = true; } else if (double_quot) { double_quot = false; } } else if (chr == "%") { string? pchr = s.substring (1, 1); if (pchr == null) { command += chr; } else { command += this.do_percent_subst (pchr, documents, single_quot, double_quot); s = s.next_char (); } } else { command += chr; } } return command; } private Pid do_app_launch (string? working_dir, SpawnFlags flags, SList? documents) throws GLib.Error { string[] argv; Pid pid; if (!Shell.parse_argv (this.parse_exec (documents), out argv)) { 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; } /** * Based on EggDesktopFile's egg_desktop_file_launch(). * @return the PID of the last process launched. */ public Pid launch (DesktopEntryLaunchFlags flags, SList? documents) throws GLib.Error { switch (this.entry_type) { case DesktopEntryType.APPLICATION: SpawnFlags sflags = SpawnFlags.SEARCH_PATH; string working_dir; Pid pid; if ((flags & DesktopEntryLaunchFlags.DO_NOT_REAP_CHILD) != 0) { sflags |= SpawnFlags.DO_NOT_REAP_CHILD; } if ((flags & DesktopEntryLaunchFlags.USE_CWD) != 0) { working_dir = Environment.get_current_dir (); } else { working_dir = Environment.get_home_dir (); } if ((flags & DesktopEntryLaunchFlags.ONLY_ONE) == 0 && documents != null) { pid = (Pid)0; foreach (unowned string doc in documents) { SList docs = new SList (); docs.append (doc); pid = this.do_app_launch (working_dir, sflags, docs); } } else { pid = this.do_app_launch (working_dir, sflags, documents); } return pid; case DesktopEntryType.LINK: if (documents != null) { throw new DesktopEntryError.NOT_LAUNCHABLE ("Cannot pass documents to a 'Link' desktop entry."); } string uri = this._keyfile.get_string (GROUP, "URL"); VFS.File file = VFS.file_new_for_uri (uri); file.launch (); return (Pid)0; default: throw new DesktopEntryError.NOT_LAUNCHABLE ("The desktop entry is unlaunchable."); } } 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.DesktopEntryGLib); } // vim: set ts=2 sts=2 sw=2 et ai cindent : libdesktop-agnostic-0.3.92/libdesktop-agnostic/ui-launcher-editor-dialog.vala0000664000175000017510000003266711536677677026655 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; using DesktopAgnostic.FDO; using Gtk; // make sure GETTEXT_PACKAGE is defined. private const string LAUNCHER_I18N_PACKAGE = Build.GETTEXT_PACKAGE; namespace DesktopAgnostic.UI { private class FixedTable : Table { public FixedTable (uint columns, uint rows) { this.n_columns = columns; this.n_rows = rows; this.homogeneous = false; } public new void attach_defaults (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.SHRINK, 0, 0); } public void attach_fill (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, 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; } public bool entry_type_sensitive { get; construct set; default = false; } private DesktopEntry _entry; public LauncherEditorDialog (VFS.File file, VFS.File? output = null, bool entry_type_sensitive = true) { GLib.Object (file: file, output: output, border_width: 4, entry_type_sensitive: entry_type_sensitive); } protected override void constructed () { this.title = _ ("Desktop Entry Editor"); this.icon_name = "gtk-preferences"; if (this._output == null) { this._output = file; } this._entry = desktop_entry_new_for_file (file); this.build_ui (); } private void build_ui () { FixedTable table; string icon; Button exec_button; Image exec_image; Label type_label, name_label, desc_label, exec_label; HBox exec_hbox; VBox advanced_vbox; bool is_application = true; // Action bar this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, STOCK_SAVE, ResponseType.APPLY); this.set_default_response (ResponseType.CANCEL); this.response.connect (this.on_response); // Form container 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 = 6; // Icon if (this._entry.key_exists ("Icon")) { icon = this._entry.icon; } else { icon = STOCK_MISSING_IMAGE; } this._icon = new IconButton (icon); this._icon.icon_selected.connect (this.on_icon_changed); 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:")); 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")) { this._name.set_text (this._entry.name); } this._name.changed.connect (this.on_name_changed); table.attach_expand (this._name, 2, 3, 1, 2); // Description desc_label = new Label.with_mnemonic (_ ("_Description:")); 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")) { this._desc.set_text (this._entry.get_string ("Comment")); } this._desc.changed.connect (this.on_desc_changed); table.attach_expand (this._desc, 2, 3, 2, 3); // Exec exec_label = new Label.with_mnemonic (_ ("_Command:")); _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); string key_name = is_application ? "Exec" : "URL"; if (this._entry.key_exists (key_name)) { this._exec.set_text (this._entry.get_string (key_name)); } this._exec.changed.connect (this.on_exec_changed); 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.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. 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")) { this._terminal.active = this._entry.get_boolean ("Terminal"); } this._terminal.toggled.connect (this.on_terminal_toggled); advanced_vbox.add (this._terminal); this._startup_notification = new CheckButton.with_mnemonic (_ ("Use _startup notification")); if (this._entry.key_exists ("StartupNotify")) { this._startup_notification.active = this._entry.get_boolean ("StartupNotify"); } this._startup_notification.toggled.connect (this.on_startup_notification_toggled); advanced_vbox.add (this._startup_notification); 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); } private void on_icon_changed (IconButton button) { this._entry.icon = button.icon; } 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; this._entry.name = entry.text; } private void on_desc_changed (Editable editable) { Entry entry = editable as Entry; this._entry.set_string ("Comment", entry.text); } private void on_exec_changed (Editable editable) { Entry entry = editable as Entry; string key_name = this._entry.entry_type == DesktopEntryType.LINK ? "URL" : "Exec"; this._entry.set_string (key_name, entry.text); } private void on_exec_browse (Button btn) { FileChooserDialog dialog; int response; 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 = is_link ? dialog.get_uri () : dialog.get_filename (); } dialog.destroy (); } private void on_terminal_toggled (ToggleButton button) { this._entry.set_boolean ("Terminal", button.active); } private void on_startup_notification_toggled (ToggleButton button) { this._entry.set_boolean ("StartupNotify", button.active); } /** * Pops up a "Save As" dialog. */ private bool change_output_file_prompt () { FileChooserDialog dialog; int response; bool try_to_save; dialog = new FileChooserDialog (_ ("Save As"), this, FileChooserAction.SAVE, STOCK_CANCEL, ResponseType.CANCEL, STOCK_SAVE_AS, ResponseType.ACCEPT); response = dialog.run (); if (response == ResponseType.ACCEPT) { this._output = VFS.file_new_for_uri (dialog.get_uri ()); try_to_save = true; } else { try_to_save = false; } dialog.destroy (); return try_to_save; } private void on_response (int response_id) { bool try_to_save = true; if (response_id == ResponseType.APPLY) { if (this._output.exists ()) { if (!this._output.is_writable ()) { try_to_save = this.change_output_file_prompt (); } } else { VFS.File? directory; directory = this._output.parent; if (directory == null || !directory.is_writable ()) { try_to_save = this.change_output_file_prompt (); } } if (try_to_save) { if (this._entry.entry_type == DesktopEntryType.UNKNOWN) { this._entry.entry_type = DesktopEntryType.APPLICATION; } try { this._entry.save (this._output); } catch (Error err) { MessageDialog dialog; dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR, ButtonsType.OK, _ ("An error occurred while trying to save the desktop entry:\n\n%s"), err.message); dialog.run (); dialog.destroy (); } } } this.hide (); } } } // vim:et:ai:cindent:ts=2 sts=2 sw=2 libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-bridge.vala0000664000175000017510000003262211536677677024406 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.Config { private class BindingNotifier : Object { public unowned Backend config; public BindingNotifier (Backend cfg) { this.config = cfg; } public void on_simple_value_changed (string group, string key, Value value) { unowned BindingListWrapper? bindings_list; string full_key; unowned Bridge bridge = Bridge.get_default (); full_key = "%s/%s/%s".printf (this.config.instance_id, group, key); bindings_list = bridge.get_all_bindings ().get_data (full_key) as BindingListWrapper; return_if_fail (bindings_list != null); foreach (unowned Binding binding in bindings_list.binding_list) { if (!binding.read_only) { SignalHandler.block (binding.obj, binding.notify_id); } binding.obj.set_property (binding.property_name, value); if (!binding.read_only) { SignalHandler.unblock (binding.obj, binding.notify_id); } } } public void on_list_changed (string group, string key, Value value) { unowned BindingListWrapper? bindings_list; string full_key; unowned Bridge bridge = Bridge.get_default (); full_key = "%s/%s/%s".printf (this.config.instance_id, group, key); bindings_list = bridge.get_all_bindings ().get_data (full_key) as BindingListWrapper; return_if_fail (bindings_list != null); foreach (unowned Binding binding in bindings_list.binding_list) { if (!binding.read_only) { SignalHandler.block (binding.obj, binding.notify_id); } binding.obj.set (binding.property_name, value.get_boxed ()); if (!binding.read_only) { SignalHandler.unblock (binding.obj, binding.notify_id); } } } public void on_serialized_object_changed (string group, string key, Value value) { unowned BindingListWrapper? bindings_list; string full_key; unowned Bridge bridge = Bridge.get_default (); full_key = "%s/%s/%s".printf (this.config.instance_id, group, key); bindings_list = bridge.get_all_bindings ().get_data (full_key) as BindingListWrapper; return_if_fail (bindings_list != null); foreach (unowned Binding binding in bindings_list.binding_list) { ParamSpec spec; SchemaType? st; spec = bridge.get_property_spec (binding.obj, binding.property_name); st = Schema.find_type (spec.value_type); if (st != null) { if (!binding.read_only) { SignalHandler.block (binding.obj, binding.notify_id); } binding.obj.set_property (binding.property_name, value); if (!binding.read_only) { SignalHandler.unblock (binding.obj, binding.notify_id); } } } } } private class BindingListWrapper : Object { public List binding_list = null; } private class Binding : Object { public unowned Backend cfg; public string group; public string key; public unowned Object obj; public string property_name; public ulong notify_id; public bool read_only; ~Binding () { if (!this.read_only && SignalHandler.is_connected (obj, this.notify_id)) { SignalHandler.disconnect (obj, this.notify_id); } this.obj = null; } } /** * Provides a convenient way for a GObject's properties and associated * configuration keys to be in sync for the duration of the object's life. */ public class Bridge : Object { private Datalist bindings; private static Bridge bridge = null; private Bridge () { this.bindings = Datalist (); } public unowned Datalist get_all_bindings () { return this.bindings; } /** * Retrieves the singleton that manages all of the bindings. */ public static unowned Bridge get_default () { if (bridge == null) { bridge = new Bridge (); } return bridge; } public static unowned ParamSpec? get_property_spec (Object obj, string property_name) { unowned ObjectClass obj_cls = (ObjectClass)(obj.get_type ().class_peek ()); return obj_cls.find_property (property_name); } private static delegate void NotifyFuncHandler (Config.Backend config, string group, string key, NotifyFunc func) throws GLib.Error; private void handle_notify_func (Config.Backend config, string group, string key, Object obj, string property_name, NotifyFuncHandler func) throws GLib.Error { unowned ParamSpec? spec; spec = get_property_spec (obj, property_name); if (spec != null) { this.handle_notify_func_with_param_spec (config, group, key, spec, func); } } private void handle_notify_func_with_param_spec (Config.Backend config, string group, string key, ParamSpec spec, NotifyFuncHandler func) throws GLib.Error { 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 ("lda-binding-notifier", notifier); } if (spec.value_type == typeof (bool) || spec.value_type == typeof (float) || spec.value_type == typeof (double) || spec.value_type == typeof (int) || spec.value_type == typeof (long) || spec is ParamSpecEnum || spec.value_type == typeof (string)) { func (config, group, key, notifier.on_simple_value_changed); } else if (spec.value_type == typeof (ValueArray)) { func (config, group, key, notifier.on_list_changed); } else { SchemaType st = Schema.find_type (spec.value_type); if (st == null) { throw new Error.INVALID_TYPE ("Invalid property type to bind: %s.", spec.value_type.name ()); } else { func (config, group, key, notifier.on_serialized_object_changed); } } } private static void cleanup_bindings (BindingListWrapper obj) { unowned Bridge bridge = Bridge.get_default (); foreach (Binding b in obj.binding_list) { bridge.remove (b.cfg, b.group, b.key, b.obj, b.property_name); } obj.unref (); } /** * Binds a specific object's property with a specific configuration key. */ public void bind (Backend config, string group, string key, Object obj, string property_name, bool read_only) throws GLib.Error { Binding binding; unowned ParamSpec? spec; binding = new Binding (); binding.cfg = config; binding.group = group; binding.key = key; binding.obj = obj; spec = get_property_spec (obj, property_name); if (spec != null) { string binding_key; unowned BindingListWrapper? bindings_list; binding.property_name = spec.name; binding_key = "%s/%s/%s".printf (config.instance_id, group, key); // FIXME: check duplicates void *obj_bindings = obj.get_data ("lda-bindings"); if (obj_bindings == null) { BindingListWrapper new_bindings_list = new BindingListWrapper (); new_bindings_list.binding_list.append (binding); obj.set_data_full ("lda-bindings", new_bindings_list.@ref (), (DestroyNotify) this.cleanup_bindings); } else { unowned BindingListWrapper object_bindings = (BindingListWrapper) obj_bindings; object_bindings.binding_list.append (binding); } obj.set_property (spec.name, config.get_value (group, key)); if (!read_only) { binding.notify_id = Signal.connect (obj, "notify::%s".printf (spec.name), (Callback)this.on_property_changed, binding); } binding.read_only = read_only; bindings_list = this.bindings.get_data (binding_key); if (bindings_list == null) { BindingListWrapper new_bindings_list = new BindingListWrapper (); new_bindings_list.binding_list.append (binding); this.bindings.set_data_full (binding_key, (owned)new_bindings_list, (DestroyNotify)Object.unref); this.handle_notify_func_with_param_spec (config, group, key, spec, config.notify_add); } else { bindings_list.binding_list.append (binding); } } else { unowned ParamSpec[] properties; string props_str; properties = ((ObjectClass)(obj.get_type ().class_peek ())).list_properties (); props_str = ""; foreach (unowned ParamSpec property in properties) { if (props_str != "") { props_str += ", "; } props_str += property.name; } warning ("Invalid property name for the object (%s). Valid properties (%d): %s", property_name, properties.length, props_str); } } /** * Removes a binding between a specific configuration key and a specific * object's property. */ public void remove (Backend config, string group, string key, Object obj, string property_name) throws GLib.Error { unowned BindingListWrapper? bindings_list; SList bindings_to_remove; uint pos = -1; string binding_key; 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 (); if (bindings_list == null) { // FIXME: throw error / warn_if_reached() ? return; } foreach (unowned Binding binding in bindings_list.binding_list) { pos++; if (binding.obj == obj) { bindings_to_remove.prepend (pos); // remove from the per-object list if (obj_bindings != null) { unowned List node; node = obj_bindings.binding_list.find (binding); if (node != null) { node.data = null; obj_bindings.binding_list.delete_link (node); } } } } foreach (uint binding_pos in bindings_to_remove) { unowned List node; node = bindings_list.binding_list.nth (binding_pos); node.data = null; bindings_list.binding_list.delete_link (node); } if (bindings_list.binding_list.length () == 0) { this.handle_notify_func (config, group, key, obj, property_name, config.notify_remove); this.bindings.remove_data (binding_key); } } /** * Removes all of the bindings related to a specific object. */ public void remove_all_for_object (Backend? config, Object obj) throws GLib.Error { void *data = obj.steal_data ("lda-bindings"); if (data != null) { unowned BindingListWrapper obj_bindings = (BindingListWrapper) data; foreach (Binding b in obj_bindings.binding_list) { this.remove (b.cfg, b.group, b.key, obj, b.property_name); } // now it's safe to unref the ListWrapper obj_bindings.unref (); } } private static void on_property_changed (Object obj, ParamSpec spec, Binding binding) { try { Value val = Value (spec.value_type); obj.get_property (spec.name, ref val); binding.cfg.set_value (binding.group, binding.key, val); } catch (GLib.Error err) { critical ("Configuration error: %s", err.message); } } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-volume-impl-gnome-vfs.vala0000664000175000017510000001666711536677677026663 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; namespace DesktopAgnostic.VFS { private struct VolumeResult { public bool succeeded; public string error; public string detailed_error; } public class VolumeGnomeVFS : Object, Volume { private GnomeVFS.Drive drive; public GnomeVFS.Drive implementation { construct { this.drive = value; } } public string name { get { return this.drive.get_display_name (); } } private File _uri; public File uri { get { if (this._uri == null) { string activation_uri = this.drive.get_activation_uri (); this._uri = file_new_for_uri (activation_uri); } return this._uri; } } public string? icon { owned get { return this.drive.get_icon (); } } public bool is_mounted () { return this.drive.is_mounted (); } private VolumeResult? result; private Volume.Callback _mount_callback; private void on_drive_mounted (bool succeeded, string error, string detailed_error) { this.result = VolumeResult (); result.succeeded = succeeded; result.error = error; result.detailed_error = detailed_error; this._mount_callback (); this._mount_callback = null; } public void mount (Volume.Callback callback) { if (this._mount_callback == null) { this._mount_callback = callback; this.drive.mount ((GnomeVFS.VolumeOpCallback)this.on_drive_mounted); } } public bool mount_finish () throws VolumeError { bool result = this.result.succeeded; if (!result) { string msg = "%s (%s)".printf (this.result.error, this.result.detailed_error); this.result = null; throw new VolumeError.MOUNT (msg); } this.result = null; return result; } private Volume.Callback _unmount_callback; private void on_drive_unmounted (bool succeeded, string error, string detailed_error) { this.result = VolumeResult (); result.succeeded = succeeded; result.error = error; result.detailed_error = detailed_error; this._unmount_callback (); this._unmount_callback = null; } public void unmount (Volume.Callback callback) { if (this._unmount_callback == null) { this._unmount_callback = callback; this.drive.unmount ((GnomeVFS.VolumeOpCallback)this.on_drive_unmounted); } } public bool unmount_finish () throws VolumeError { bool result = this.result.succeeded; if (!result) { string msg = "%s (%s)".printf (this.result.error, this.result.detailed_error); this.result = null; throw new VolumeError.UNMOUNT (msg); } this.result = null; return result; } public bool can_eject () { return true; } private Volume.Callback _eject_callback; private void on_drive_ejected (bool succeeded, string error, string detailed_error) { this.result = VolumeResult (); result.succeeded = succeeded; result.error = error; result.detailed_error = detailed_error; this._eject_callback (); this._eject_callback = null; } public void eject (Volume.Callback callback) { if (this._eject_callback == null) { this._eject_callback = callback; this.drive.eject ((GnomeVFS.VolumeOpCallback)this.on_drive_ejected); } } public bool eject_finish () throws VolumeError { bool result = this.result.succeeded; if (!result) { string msg = "%s (%s)".printf (this.result.error, this.result.detailed_error); this.result = null; throw new VolumeError.EJECT (msg); } this.result = null; return result; } } public class VolumeMonitorGnomeVFS : Object, VolumeMonitor { private GnomeVFS.VolumeMonitor monitor; private HashTable _volumes; construct { this.monitor = GnomeVFS.get_volume_monitor (); this._volumes = new HashTable (direct_hash, direct_equal); List drives = this.monitor.get_connected_drives (); foreach (unowned GnomeVFS.Drive drive in drives) { VFS.Volume vol = this.create_volume (drive); this._volumes.insert (drive, vol); } this.monitor.drive_connected += this.on_drive_connected; this.monitor.drive_disconnected += this.on_drive_disconnected; this.monitor.volume_mounted += this.on_volume_mounted; this.monitor.volume_unmounted += this.on_volume_unmounted; } private VFS.Volume create_volume (GnomeVFS.Drive drive) { return (VFS.Volume)Object.new (typeof (VolumeGnomeVFS), "implementation", drive); } private VFS.Volume check_volume (GnomeVFS.Drive drive) { VFS.Volume? vol = this._volumes.lookup (drive); if (vol == null) { vol = this.create_volume (drive); this._volumes.insert (drive, vol); } return vol; } private void on_drive_connected (GnomeVFS.VolumeMonitor vmonitor, GnomeVFS.Drive drive) { this.check_volume (drive); } private void on_drive_disconnected (GnomeVFS.VolumeMonitor vmonitor, GnomeVFS.Drive drive) { VFS.Volume? vol = this._volumes.lookup (drive); if (vol != null) { this._volumes.remove (drive); } } private VFS.Volume get_volume (GnomeVFS.Volume gvol) { return this.check_volume (gvol.get_drive ()); } private void on_volume_mounted (GnomeVFS.VolumeMonitor vmonitor, GnomeVFS.Volume gvol) { this.volume_mounted (this.get_volume (gvol)); } private void on_volume_unmounted (GnomeVFS.VolumeMonitor vmonitor, GnomeVFS.Volume gvol) { this.volume_unmounted (this.get_volume (gvol)); } public void* implementation { get { return (void*)this.monitor; } } public List volumes { owned get { return this._volumes.get_values (); } } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file-monitor.vala0000664000175000017510000000461311536677677025106 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { /** * The file monitor events that will be propagated to the signal handlers. */ public enum FileMonitorEvent { UNKNOWN = 0, CHANGED, CREATED, DELETED, ATTRIBUTE_CHANGED } /** * The base class for file/directory monitoring. */ public interface FileMonitor : Object { /** * Emits a file monitor event for the file backend associated with * the monitor. * @param other if the associated URI is a directory, the child file that * triggered the event. Otherwise, it should be NULL. * @param event the event type to emit. */ public abstract void emit (File? other, FileMonitorEvent event); /** * Prevent the monitor from monitoring any events from the URI associated * with it. * @return whether the monitor was successfully cancelled. */ public abstract bool cancel (); /** * Whether the monitor has been cancelled via cancel(). */ public abstract bool cancelled { get; } /** * The signal emitted when something changes * @param file the file associated with the monitor. * @param other if the URI associated with the monitor is a directory, the * child file that triggered the event. Otherwise, it should be NULL. * @param event the event type to send */ public signal void changed (File file, File? other, FileMonitorEvent event); } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/ui-color-button.vala0000664000175000017510000000654511536677677024756 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; namespace DesktopAgnostic.UI { public class ColorButton : Gtk.ColorButton { private static Color ZERO = new Color.from_values (0, 0, 0, ushort.MAX); private ulong da_color_signal; public Color da_color { get; set; default = ZERO; } public ColorButton.with_color (Color color) { this.color = color.color; this.alpha = color.alpha; this.on_color_set (); } protected override void constructed () { this.use_alpha = true; this.da_color_signal = Signal.connect (this, "notify::da-color", (Callback)this.on_da_color_changed, null); this.color_set.connect (this.on_color_set); } private void on_da_color_changed (ParamSpec pspec) { if (this._da_color == null) { this.color = ZERO.color; this.alpha = ZERO.alpha; } else { this.color = this.da_color.color; this.alpha = this.da_color.alpha; } } /** * Emits the non-internal signal callbacks for the da-color property. */ private void da_color_notify () { // don't run on_da_color_changed SignalHandler.block (this, this.da_color_signal); this.notify_property ("da-color"); SignalHandler.unblock (this, this.da_color_signal); } /** * Updates the da-color property when the color is updated via the UI. */ private void on_color_set () { if (this._da_color == null || this._da_color == ZERO) { this._da_color = new Color (this.color, (ushort)this.alpha); } else { this._da_color.color = this.color; this._da_color.alpha = this.alpha; } this.da_color_notify (); } public new void set_color (Gdk.Color color) { if (this._da_color == null || this._da_color == ZERO) { this._da_color = new Color (color, ushort.MAX); } else { this._da_color.alpha = alpha; } this.da_color_notify (); } public new void set_alpha (uint16 alpha) { if (this._da_color == null || this._da_color == ZERO) { this._da_color = new Color (ZERO.color, alpha); } else { this._da_color.alpha = alpha; } this.da_color_notify (); base.set_alpha (alpha); } } } // vim: set ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file-monitor-impl-gio.vala0000664000175000017510000000717611536677677026630 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class FileMonitorGIO : Object, FileMonitor { private GLib.FileMonitor monitor; public bool cancelled { get { return this.monitor.is_cancelled (); } } private File file; public FileMonitorGIO (FileGIO file) { this.file = file; GLib.File impl = (GLib.File)file.implementation; if (file.file_type == FileType.DIRECTORY) { this.monitor = impl.monitor_directory (FileMonitorFlags.NONE, null); } else { this.monitor = impl.monitor_file (FileMonitorFlags.NONE, null); } this.monitor.changed += this.monitor_callback; } private void monitor_callback (GLib.FileMonitor monitor, GLib.File file, GLib.File? other, GLib.FileMonitorEvent event_type) { File other_file = null; if (other != null) { other_file = file_new_for_uri (other.get_uri ()); } FileMonitorEvent da_event; switch (event_type) { case GLib.FileMonitorEvent.CHANGED: case GLib.FileMonitorEvent.CHANGES_DONE_HINT: da_event = FileMonitorEvent.CHANGED; break; case GLib.FileMonitorEvent.CREATED: da_event = FileMonitorEvent.CREATED; break; case GLib.FileMonitorEvent.DELETED: da_event = FileMonitorEvent.DELETED; break; case GLib.FileMonitorEvent.ATTRIBUTE_CHANGED: da_event = FileMonitorEvent.ATTRIBUTE_CHANGED; break; default: da_event = FileMonitorEvent.UNKNOWN; break; } this.changed (this.file, other_file, da_event); } public void emit (File? other, FileMonitorEvent event) { GLib.FileMonitorEvent gio_event; GLib.File other_file = null; switch (event) { case FileMonitorEvent.CHANGED: gio_event = GLib.FileMonitorEvent.CHANGED; break; case FileMonitorEvent.CREATED: gio_event = GLib.FileMonitorEvent.CREATED; break; case FileMonitorEvent.DELETED: gio_event = GLib.FileMonitorEvent.DELETED; break; case FileMonitorEvent.ATTRIBUTE_CHANGED: gio_event = GLib.FileMonitorEvent.ATTRIBUTE_CHANGED; break; default: return; } if (other != null) { other_file = (GLib.File)other.implementation; } this.monitor.emit_event ((GLib.File)this.file.implementation, other_file, gio_event); } public bool cancel () { return this.monitor.cancel (); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs.vala0000664000175000017510000000542011536677677022501 0ustar seagleseagle/* * 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 */ [CCode (cheader_filename = "libdesktop-agnostic/vfs.h")] namespace DesktopAgnostic.VFS { public interface Implementation : Object { /** * The (unique) name of the implementation. */ public abstract string name { get; } public abstract Type file_type { get; } public abstract Type file_monitor_type { get; } public abstract Type trash_type { get; } public abstract Type volume_type { get; } public abstract void init (); public abstract SList files_from_uri_list (string uri_list) throws GLib.Error; public abstract unowned VolumeMonitor volume_monitor_get_default (); public abstract void shutdown (); } private static Implementation vfs = null; public unowned VFS.Implementation? get_default () throws GLib.Error { if (vfs == null) { Type type = get_module_type ("vfs", "vfs"); if (type == Type.INVALID) { return null; } else { vfs = (VFS.Implementation)Object.new (type); } } return vfs; } /** * Initializes the VFS, if the backend needs it. */ public void init () throws GLib.Error { unowned VFS.Implementation? vfs = get_default (); if (vfs != null) { vfs.init (); } } /** * Shuts down the VFS, if the backend needs it. */ public void shutdown () throws GLib.Error { unowned VFS.Implementation? vfs = get_default (); if (vfs != null) { vfs.shutdown (); } } /** * Creates a list of files based on a newline-delimited list of URIs. */ public SList? files_from_uri_list (string uri_list) throws GLib.Error { unowned VFS.Implementation? vfs = get_default (); if (vfs == null) { return null; } else { return vfs.files_from_uri_list (uri_list); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-schema-option.vala0000664000175000017510000002772011536677677025723 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.Config { /** * A representation of one configuration option as defined by the schema. */ public class SchemaOption : Object { /** * The type of the configuration option. Can be one of the following types * (as represented by GType): boolean, integer, float, string, color, list * (AKA ValueArray). If something weird happened, the type is "invalid". */ public Type option_type { get; private set; } /** * If the configuration option type is a list (AKA ValueArray), the type * of values that the list holds. Can be one of the following: boolean, * integer, float, string, color. Otherwise, the list type is "invalid". */ public Type list_type { get; private set; } /** * The default value of the configuration option. Its value type depends on * the option type, and potentially the list type. */ public Value default_value { get; private set; } /** * The description of the configuration option. */ public string description { get; private set; } /** * A summary of the configuration option. This is an optional piece of * metadata. */ public string? summary { get; private set; } /** * The lower boundary (inclusive) of a configuration option. This is an * optional piece of metadata that is applicable for all types except * boolean. For numeric types, the standard usage is observed. For strings, * the value must be an integer that indicates its minimum length (in * characters). For lists, the value must be an integer that indicates the * minimum number of elements present. */ public Value? lower_boundary { get; private set; } /** * The upper boundary (inclusive) of a configuration option. This is an * optional piece of metadata that is applicable for all types except * boolean. For numeric types, the standard usage is observed. For strings, * the value must be an integer that indicates its maximum length (in * characters). For lists, the value must be an integer that indicates the * maximum number of elements present. */ public Value? upper_boundary { get; private set; } private ValueArray? _whitelist; /** * A list of values that the configuration option may only be set to. This * is an optional piece of metadata that is applicable for all types except * boolean. For simple types, the standard usage is observed. For lists, * this is a list of values that can only appear as elements in the list. * Note that if a blacklist is also present, then the whitelist takes * precedence. */ public ValueArray? whitelist { owned get { return this._whitelist.copy (); } } private ValueArray? _blacklist; /** * A list of values that the configuration option may not be set to. This is * an optional piece of metadata that is applicable for all types except * boolean. For simple types, the standard usage is observed. For lists, * this is a list of values that cannot appear as elements in the list. Note * that if a whitelist is also present, then the whitelist takes precedence. */ public ValueArray? blacklist { owned get { return this._blacklist.copy (); } } /** * Determines whether a configuration option is per instance, or applied * towards all instances of the configuration. Defaults to true. Note that * this option only applies if the "single_instance" metadata key is false. */ public bool per_instance { get; private set; default = true; } /** * Parses a schema option from the specification in the schema configuration * file. * @param schema the schema configuration file * @param group the group associated with the configuration option * @param key the name of the configuration option * @throws Error if any required field for the option is not present, or if * any value could not be parsed correctly */ public SchemaOption (ref KeyFile schema, string group, string key) throws GLib.Error { string full_key = group + "/" + key; this.parse_type (schema.get_value (full_key, "type")); this.parse_default_value (schema, full_key); this._description = this.parse_localized_value (schema, full_key, "description", true); this._summary = this.parse_localized_value (schema, full_key, "summary", false); // TODO handle optional upper/lower boundaries // TODO handle optional blacklist/whitelist if (schema.has_key (full_key, "per_instance")) { this.per_instance = schema.get_boolean (full_key, "per_instance"); } } /** * Determines which GType (and possibly list GType for list types) is described by a string. */ private void parse_type (string serialized) { if (serialized.has_prefix ("list-")) { this.option_type = typeof (ValueArray); unowned string subtype = serialized.offset (5); this.list_type = this.parse_simple_type_from_string (subtype); } else { this.option_type = this.parse_simple_type_from_string (serialized); this.list_type = Type.INVALID; } } /** * Converts a string into a simple type (i.e., not a list). */ private Type parse_simple_type_from_string (string serialized) { Type type; switch (serialized) { case "boolean": type = typeof (bool); break; case "integer": type = typeof (int); break; case "float": type = typeof (float); break; case "string": type = typeof (string); break; default: SchemaType st = Schema.find_type_by_name (serialized); if (st == null) { type = Type.INVALID; } else { type = st.schema_type; } break; } return type; } private void parse_default_value (KeyFile schema, string group) throws GLib.Error { string key = "default"; try { if (this.option_type == typeof (bool)) { this._default_value = schema.get_boolean (group, key); } else if (this.option_type == typeof (int)) { this._default_value = schema.get_integer (group, key); } else if (this.option_type == typeof (float)) { this._default_value = (float)schema.get_double (group, key); } else if (this.option_type == typeof (string)) { this._default_value = schema.get_string (group, key); } else { SchemaType st = Schema.find_type (this.option_type); if (st != null) { this._default_value = st.deserialize (schema.get_string (group, key)); } else if (this.option_type == typeof (ValueArray)) { ValueArray array = null; if (schema.get_value (group, key) == "") { // special case for empty arrays array = new ValueArray (0); } else if (this.list_type == typeof (bool)) { bool[] list = schema.get_boolean_list (group, key); array = new ValueArray (list.length); foreach (bool item in list) { Value val; val = item; array.append (val); } } else if (this.list_type == typeof (int)) { int[] list = schema.get_integer_list (group, key); array = new ValueArray (list.length); foreach (int item in list) { Value val; val = item; array.append (val); } } else if (this.list_type == typeof (float)) { double[] list = schema.get_double_list (group, key); array = new ValueArray (list.length); foreach (double item in list) { Value val; val = (float)item; array.append (val); } } else if (this.list_type == typeof (string)) { string[] list = schema.get_string_list (group, key); array = new ValueArray (list.length); foreach (unowned string item in list) { Value val; val = item; array.append (val); } } else { st = Schema.find_type (this.list_type); if (st == null) { throw new SchemaError.INVALID_LIST_TYPE ("Invalid option list type for %s: %s (given: '%s').", group, this.list_type.name (), schema.get_value (group, "type")); } else { string[] list = schema.get_string_list (group, key); array = new ValueArray (list.length); foreach (unowned string item in list) { array.append (st.deserialize (item)); } } } this._default_value = array; } else { throw new SchemaError.INVALID_TYPE ("Invalid option type for %s: %s (given: '%s').", group, this.option_type.name (), schema.get_value (group, "type")); } } } catch (KeyFileError err) { if (err is KeyFileError.INVALID_VALUE) { throw new KeyFileError.INVALID_VALUE ("%s (key: %s)", err.message, group); } else { throw err; } } } private string? parse_localized_value (KeyFile schema, string group, string key, bool mandatory) throws GLib.Error { string? result = null; if (schema.has_key (group, key)) { foreach (unowned string locale in Intl.get_language_names ()) { if (locale == "C") { result = schema.get_string (group, key); break; } try { result = schema.get_locale_string (group, key, locale); break; } catch (KeyFileError.KEY_NOT_FOUND err) { // do nothing } } } else if (mandatory) { throw new Error.METADATA_NOT_FOUND ("The metadata value '%s' for the config key '%s' was not found.", key, group); } return result; } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-glob.vala0000664000175000017510000001016611536677677023425 0ustar seagleseagle/* * 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 */ using POSIX; namespace DesktopAgnostic.VFS { public errordomain GlobError { NOSPACE, // ran out of memory ABORTED, // read error NOMATCH, // no found matches BAD_PATTERN, // invalid pattern BAD_FLAGS, // invalid flags ERRNO // via errno } public class Glob : Object { private glob_t glob; public size_t offset { get { return this.glob.offset; } } private string _pattern; public string pattern { get { return this._pattern; } set { if (value != "") { this._pattern = value; } else { throw new GlobError.BAD_PATTERN ("Invalid pattern."); } } } private int _flags = glob_t.MARK | glob_t.BRACE | glob_t.TILDE_CHECK; public int flags { get { return this._flags; } set { if (value >= 0) { this._flags = value; } else { throw new GlobError.BAD_FLAGS ("Invalid flags."); } } } public static Glob execute (string pattern) throws GlobError { Glob g = (Glob)Object.new (typeof (Glob), "pattern", pattern); g.run_glob (g._pattern, g._flags); return g; } public static Glob execute_with_flags (string pattern, int flags) throws GlobError { Glob g = (Glob)Object.new (typeof (Glob), "pattern", pattern, "flags", flags); g.run_glob (g._pattern, g._flags); return g; } public void append (string pattern) throws GlobError { this.run_glob (pattern, this._flags | glob_t.APPEND); } public unowned string[]? get_paths () { return this.glob.paths; } private void run_glob (string pattern, int flags) throws GlobError { int res = POSIX.glob (pattern, flags, (void*)on_glob_error, out this.glob); if (res != 0) { switch (res) { case glob_t.ERR_NOSPACE: throw new GlobError.NOSPACE ("Ran out of memory."); case glob_t.ERR_ABORTED: throw new GlobError.ABORTED ("Read error."); case glob_t.ERR_NOMATCH: throw new GlobError.NOMATCH ("No matches found."); default: critical ("Unknown error code: %d", res); break; } } } private static int on_glob_error (string path, int eerrno) { switch (eerrno) { case Posix.EACCES: case Posix.EBADF: case Posix.EMFILE: case Posix.ENFILE: case Posix.ENOENT: case Posix.ENOMEM: case Posix.ENOTDIR: case Posix.EFAULT: case Posix.EINVAL: case Posix.ELOOP: case Posix.ENAMETOOLONG: throw new GlobError.ERRNO ("Miscellaneous error for '%s' (%d): %s", path, eerrno, Posix.strerror (eerrno)); default: critical ("Unknown error code: %d", eerrno); break; } return 1; } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-impl-null.vala0000664000175000017510000000565711536677677025073 0ustar seagleseagle/* * A NULL implemenation of the Config interface. Used only for testing. * * 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 */ namespace DesktopAgnostic.Config { public class Null : Backend { public override string name { owned get { return "null"; } } public override void reset () throws Error { } public override void notify_add (string group, string key, NotifyFunc callback) throws GLib.Error { } public override void notify (string group, string key) throws GLib.Error { } public override void notify_remove (string group, string key, NotifyFunc callback) throws Error { } public override void remove () throws Error { } public override Value get_value (string group, string key) throws Error { Value value; value = Value (Type.INVALID); return value; } public override bool get_bool (string group, string key) throws Error { return false; } public override void set_bool (string group, string key, bool value) throws Error { } public override float get_float (string group, string key) throws Error { return (float)0.0; } public override void set_float (string group, string key, float value) throws Error { } public override int get_int (string group, string key) throws Error { return 0; } public override void set_int (string group, string key, int value) throws Error { } public override string get_string (string group, string key) throws Error { return ""; } public override void set_string (string group, string key, string value) throws Error { } public override ValueArray get_list (string group, string key) throws Error { return new ValueArray (0); } public override void set_list (string group, string key, ValueArray value) throws Error { } } } public Type register_plugin () { return typeof (DesktopAgnostic.Config.Null); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-schema.vala0000664000175000017510000003304511536677677024412 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; namespace DesktopAgnostic.Config { /** * Configuration schema error types. */ public errordomain SchemaError { PARSE, INVALID_METADATA_OPTION, INVALID_METADATA_TYPE, INVALID_TYPE, INVALID_LIST_TYPE, TYPE_NAME_EXISTS, TYPE_GTYPE_EXISTS } /** * A representation of a configuration schema, comprised of one or more * configuration options. */ public class Schema : Object { // static code private static HashTable type_registry = new HashTable ((HashFunc)gtype_hash, (EqualFunc)gtype_equal); private static HashTable name_registry = new HashTable (str_hash, str_equal); private static HashTable common_metadata_keys = new HashTable (str_hash, str_equal); static construct { // Loads the type modules via the module search paths + cwd. List type_modules; string[] paths; SList search_paths; type_modules = new List (); // pre-load the ModuleLoader static constructor ModuleLoader.get_default (); // pre-load the default config backend module. try { Config.get_type (); } catch (GLib.Error err) { // Do nothing. } // search for the config type modules paths = ModuleLoader.get_search_paths (); search_paths = new SList (); foreach (unowned string path in paths) { if (path != null) { search_paths.append (path); } } search_paths.append (Environment.get_current_dir ()); foreach (unowned string path in search_paths) { if (!FileUtils.test (path, FileTest.IS_DIR)) { continue; } string module_glob = Path.build_filename (path, "libda-cfg-type-*"); try { Glob found_modules; unowned string[] modules_paths; found_modules = Glob.execute (module_glob); modules_paths = found_modules.get_paths (); foreach (unowned string module in modules_paths) { if (type_modules.find (module) == null) { Type type; unowned ModuleLoader loader = ModuleLoader.get_default (); type = loader.load_from_path (Path.get_basename (module), module); if (type != Type.INVALID) { try { Object obj = Object.new (type); register_type ((SchemaType)((owned)obj)); type_modules.append (module); } catch (SchemaError err) { warning ("Schema error: %s", err.message); } } else { warning ("Could not load the config type module: %s", module); } } } } catch (GlobError err) { if (!(err is GlobError.NOMATCH)) { warning ("Glob-related error: %s", err.message); } } } // initialize the common metadata keys hashtable Value val = Value (typeof (bool)); val.set_boolean (true); common_metadata_keys.insert ("single_instance", val); // force the config module to load before creating the schema. try { Config.get_type (); } catch (GLib.Error err) { critical ("Config error: %s", err.message); } } // properties private string _filename; public string filename { /** * Sets the schema's file name and app name (assuming the file name * is valid). */ construct { string? basename = null; if (!value.has_suffix (".schema-ini")) { critical ("Schema files MUST have the extension '.schema-ini'."); return; } if (!FileUtils.test (value, FileTest.EXISTS)) { critical ("The file '%s' could not be found.", value); return; } this._filename = value; basename = Path.get_basename (value); this.app_name = basename.substring (0, basename.length - 11); } } [Description (nick = "Application name", blurb = "The name of the application associated with the schema")] public string app_name { get; private set; } private Datalist options; private HashTable> keys; private List valid_metadata_keys; private Datalist metadata_options; /** * Creates a new Schema object. * @param filename the name of the schema file to parse */ public Schema (string filename) throws GLib.Error { GLib.Object (filename: filename); unowned HashTable backend_metadata_keys; this.options = Datalist (); this.keys = new HashTable> (str_hash, str_equal); // populate the common metadata keys table this.valid_metadata_keys = new List (); this.metadata_options = Datalist (); foreach (unowned string key in common_metadata_keys.get_keys ()) { this.valid_metadata_keys.append (key); this.metadata_options.set_data (key, common_metadata_keys.lookup (key)); } // populate the backend-specific metadata keys table backend_metadata_keys = Backend.get_backend_metadata_keys (); foreach (unowned string key in backend_metadata_keys.get_keys ()) { this.valid_metadata_keys.append (key); this.metadata_options.set_data (key, backend_metadata_keys.lookup (key)); } this.parse (); } /** * Parses the schema file for configuration options and metadata. */ private void parse () throws GLib.Error { if (this._filename == null) { throw new SchemaError.PARSE ("A (valid) schema file was not given."); } else { KeyFile data = new KeyFile (); data.load_from_file (this._filename, KeyFileFlags.KEEP_TRANSLATIONS); foreach (unowned string group in data.get_groups ()) { if (group.contains ("/")) { // split option group & key, add to groups/keys lists unowned string last_slash = group.rchr (group.length, '/'); long offset = group.pointer_to_offset (last_slash); string option_group = group.substring (0, offset); unowned string option_key = group.offset (offset + 1); unowned List? list = this.keys.lookup (option_group); if (list == null) { List key_list = new List (); key_list.append (option_key); this.keys.insert (option_group, (owned)key_list); } else if (!this.exists (option_group, option_key)) { list.append (option_key); } else { throw new SchemaError.PARSE ("Duplicate key found in '%s': %s", option_group, option_key); } // create a new schema option and add to options list SchemaOption option = new SchemaOption (ref data, option_group, option_key); this.options.set_data (group, option); } else if (group == DesktopAgnostic.Config.GROUP_DEFAULT) { // parse the schema metadata foreach (unowned string key in data.get_keys (group)) { if (this.valid_metadata_keys.find_custom (key, (CompareFunc)strcmp) == null) { throw new SchemaError.INVALID_METADATA_OPTION ("The option '%s' is not a registered metadata option.", key); } else { Value cur_val, new_val; Type cur_val_type; cur_val = this.metadata_options.get_data (key); cur_val_type = cur_val.type (); new_val = Value (cur_val_type); if (cur_val_type == typeof (bool)) { new_val.set_boolean (data.get_boolean (group, key)); } else if (cur_val_type == typeof (int)) { new_val.set_int (data.get_integer (group, key)); } else if (cur_val_type == typeof (float)) { new_val.set_float ((float)data.get_double (group, key)); } else if (cur_val_type == typeof (string)) { new_val.set_string (data.get_string (group, key)); } else { throw new SchemaError.INVALID_METADATA_TYPE ("The metadata option type can only be a simple type."); } this.metadata_options.set_data (key, new_val); } } } else { throw new SchemaError.PARSE ("Invalid section in schema ('%s'), there is no group name: %s", this._filename, group); } } } } /** * Retrieves the configuration groups in the schema. * @return a list of zero or more groups */ public List? get_groups () { return this.keys.get_keys (); } /** * Retrieves the configuration keys for a specified group in the schema. * @param group the group name to search for keys associated with it * @return a list of zero or more keys */ public unowned List? get_keys (string group) { return this.keys.lookup (group); } /** * Determines if a specified group/key exists in the schema. * @param group the group that the key is associated with * @param key the configuration key to determine if it exists * @return whether the group/key exists */ public bool exists (string group, string key) { unowned List group_keys = this.keys.lookup (group); return group_keys != null && group_keys.find_custom (key, (CompareFunc)strcmp) != null; } /** * Retrieves the metadata associated with a specific group/key. * @param group the group that the key is associated with * @param key the configuration key to retrieve metadata from * @return an object which contains the option metadata */ public unowned SchemaOption get_option (string group, string key) { string full_key = group + "/" + key; return this.options.get_data (full_key); } /** * Retrieves the value of the specified metadata option. * @throws SchemaError if the option named specified is not registered */ public Value? get_metadata_option (string name) throws SchemaError { if (this.valid_metadata_keys.find_custom (name, (CompareFunc)strcmp) == null) { throw new SchemaError.INVALID_METADATA_OPTION ("The option '%s' is not a registered metadata option.", name); } else { return this.metadata_options.get_data (name); } } /** * Registers a configuration schema type with the class. This is usually * not called manually - the class loads all of the configuration schema * type modules that it can find when the class is first instantiated. */ public static void register_type (SchemaType st) throws SchemaError { if (type_registry.lookup (st.schema_type) != null) { throw new SchemaError.TYPE_GTYPE_EXISTS ("The GType associated with the SchemaType is already registered."); } else if (name_registry.lookup (st.name) != null) { throw new SchemaError.TYPE_NAME_EXISTS ("The name associated with the SchemaType is already registered."); } else { type_registry.insert (st.schema_type, st); name_registry.insert (st.name, st); } } /** * Looks for a registered SchemaType by its GType. */ public static unowned SchemaType? find_type (Type type) { return type_registry.lookup (type); } /** * Looks for a registered SchemaType by its declared name. */ public static unowned SchemaType? find_type_by_name (string name) { return name_registry.lookup (name); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/desktop-entry-impl-gio.vala0000664000175000017510000002301211536677677026223 0ustar seagleseagle/* * 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 : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-bookmarks-gtk.vala0000664000175000017510000001060111536677677025247 0ustar seagleseagle/* * 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 * . */ using DesktopAgnostic.VFS; namespace DesktopAgnostic.VFS { /** * A representation of a simple bookmark. */ public class Bookmark : Object { public File file { get; set; } public string? alias { get; set; } } /** * Parses .gtk-bookmarks files. */ public class GtkBookmarks : Object { private File _file; private FileMonitor _monitor; public File? file { construct { if (value == null) { string fname; fname = Path.build_filename (Environment.get_home_dir (), ".gtk-bookmarks"); this._file = file_new_for_path (fname); } else { this._file = value; } } } private SList? _bookmarks; public unowned SList? bookmarks { get { return this._bookmarks; } } /** * Creates a new parser object. * @param file the object representing the gtk bookmark file. if %NULL, * defaults to "~/.gtk-bookmarks" (defaults to %NULL) * @param monitor if %TRUE, monitors the file for changes, and notifies of * changes via the "changed" signal (defaults to %TRUE) */ public GtkBookmarks (File? file = null, bool monitor = true) { GLib.Object (file: file); if (this._file.exists ()) { this.parse (); } if (monitor) { this._monitor = this._file.monitor (); this._monitor.changed.connect (this.on_file_changed); } } private void parse () { this._bookmarks = new SList (); try { string contents; size_t length; string[] lines; this._file.load_contents (out contents, out length); lines = contents.split ("\n"); foreach (unowned string line in lines) { string[] tokens; if (line == "") { continue; } tokens = line.split (" ", 2); if (tokens != null && tokens[0] != null) { Bookmark bookmark = new Bookmark (); tokens[0].strip (); bookmark.file = file_new_for_uri (tokens[0]); if (tokens[1] == null) { bookmark.alias = null; } else { tokens[1].strip (); bookmark.alias = tokens[1]; } this._bookmarks.append ((owned)bookmark); } } } catch (Error err) { critical ("Could not load/parse GTK bookmarks file: %s", err.message); this._bookmarks = null; } } private void on_file_changed (FileMonitor monitor, File file, File? other, FileMonitorEvent event) { switch (event) { case FileMonitorEvent.CREATED: case FileMonitorEvent.CHANGED: this.parse (); this.changed (); break; case FileMonitorEvent.DELETED: this._bookmarks = null; this.changed (); break; default: // UNKNOWN, ATTRIBUTE_CHANGED // do nothing break; } } /** * Emitted when a monitor has been created for the bookmarks file, and its * contents have changed. */ public signal void changed (); } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/module-guesser.vala0000664000175000017510000000430411536677677024643 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; using DesktopAgnostic.VFS; /** * Given a valid library prefix, this function takes the first valid module * that is locates via the search paths and glob and loads it. */ public Type guess_module (ModuleLoader loader, string library_prefix) { string[] paths = loader.get_search_paths (); string module_glob_suffix = "%s*".printf (library_prefix); Type result = Type.INVALID; foreach (unowned string path_prefix in paths) { if (path_prefix == null || !FileUtils.test (path_prefix, FileTest.IS_DIR)) { continue; } string module_glob = Path.build_filename (path_prefix, module_glob_suffix); try { Glob found_modules; unowned string[] modules_paths; found_modules = Glob.execute (module_glob); modules_paths = found_modules.get_paths (); foreach (unowned string module in modules_paths) { result = loader.load_from_path (path_prefix, module); if (result != Type.INVALID) { break; } } } catch (GlobError err) { if (!(err is GlobError.NOMATCH)) { warning ("Glob-related eror: %s", err.message); } } if (result != Type.INVALID) { break; } } return result; } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/ui-icon-button.vala0000664000175000017510000000570011536677677024560 0ustar seagleseagle/* * 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 */ using Gtk; namespace DesktopAgnostic.UI { public class IconButton : Button { private string _icon; public string icon { get { return this._icon; } set { this._icon = value; if (Path.is_absolute (value)) { this._icon_type = IconType.FILE; this.image = new Image.from_file (value); } else { this._icon_type = IconType.THEMED; this.image = new Image.from_icon_name (value, IconSize.DIALOG); } } } private IconType _icon_type = IconType.NONE; public IconType icon_type { get { return this._icon_type; } } private IconChooserDialog _dialog = null; public IconButton (string icon) { this.icon = icon; } construct { this.clicked.connect (this.on_clicked); } /* ported from GTK+'s gtkcolorbutton.c, blob * 081e687cbaed1411eed71f1682968d6b3f09fd3f * see gtk_color_button_clicked(). */ private void on_clicked () { if (this._dialog == null) { unowned Widget parent; parent = this.get_toplevel (); this._dialog = new IconChooserDialog (); this._dialog.icon_selected.connect (this.on_icon_selected); if (parent.is_toplevel () && parent is Window) { unowned Window parent_window; parent_window = parent as Window; if (parent_window != this._dialog.transient_for) { this._dialog.transient_for = parent_window; } this._dialog.modal = parent_window.modal; } } this._dialog.present (); } private void on_icon_selected (IconChooserDialog dialog) { (this.image as Image).set_from_pixbuf (dialog.selected_pixbuf); this._icon = dialog.selected_icon; this._icon_type = dialog.selected_icon_type; this.icon_selected (); } public signal void icon_selected (); } } // vim:et:ai:cindent:ts=2 sts=2 sw=2 libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-trash.vala0000664000175000017510000000277011536677677023625 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public interface Trash : Object { public abstract uint file_count { get; } public signal void file_count_changed (); public abstract void send_to_trash (File file) throws GLib.Error; public abstract void empty (); } private static Trash? trash = null; public unowned Trash trash_get_default () throws GLib.Error { if (trash == null) { unowned VFS.Implementation vfs = VFS.get_default (); trash = (Trash)Object.new (vfs.trash_type); } return trash; } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/ui-icon-chooser-dialog.vala0000664000175000017510000003142311536677677026145 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; using Gtk; // make sure GETTEXT_PACKAGE is defined. private const string ICON_I18N_PACKAGE = Build.GETTEXT_PACKAGE; namespace DesktopAgnostic.UI { public enum IconType { NONE, THEMED, 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 = null; private IconView? _themed_viewer = null; private unowned IconView _viewer; public string selected_icon { get; private set; default = null; } public Gdk.Pixbuf selected_pixbuf { get; private set; default = null; } public IconType selected_icon_type { get; private set; default = IconType.NONE; } private enum Column { 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 (); } private void create_ui () { HBox choices; choices = new HBox (false, 5); 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.on_icon_type_toggled (); this.add_buttons (STOCK_CANCEL, ResponseType.CANCEL, STOCK_OK, ResponseType.OK); } private void add_icon_viewer (ref IconView viewer, bool themed) { ScrolledWindow scrolled; scrolled = new ScrolledWindow (null, null); scrolled.set_policy (PolicyType.NEVER, PolicyType.AUTOMATIC); viewer = this.create_icon_viewer (themed); viewer.show (); scrolled.add (viewer); this.vbox.pack_start (scrolled, true, true, 5); } private IconView create_icon_viewer (bool themed) { IconView viewer; LazyPixbufRenderer cell_pixbuf; CellRendererText cell_text; viewer = new IconView.with_model (this.create_model ()); // 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.0f; cell_text.wrap_mode = Pango.WrapMode.WORD; 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", Column.NAME); viewer.selection_mode = SelectionMode.SINGLE; return viewer; } private ListStore create_model () { // icon, name, data return new ListStore (Column.COUNT, typeof (Gdk.Pixbuf), typeof (string), typeof (string), typeof (bool)); } private void on_icon_type_toggled () { if (this._themed.active) { if (this._themed_viewer == null) { 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); this.add_icon_viewer (ref this._themed_viewer, true); 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._themed_viewer.parent.show (); this._themed_context.show (); this._viewer = this._themed_viewer; } else { 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; } } private void on_folder_changed (FileChooser chooser) { unowned ListStore model; string uri; VFS.File directory; SList children; model = this._file_viewer.model as ListStore; model.clear (); uri = chooser.get_uri (); directory = VFS.file_new_for_uri (uri); children = directory.enumerate_children (); foreach (unowned VFS.File child in children) { string path; string path_down; path = child.path; path_down = path.down (); if (path_down.has_suffix (".png") || path_down.has_suffix (".svg") || path_down.has_suffix (".jpg") || path_down.has_suffix (".jpeg") || path_down.has_suffix (".xpm")) { try { TreeIter iter; Gdk.Pixbuf pixbuf; pixbuf = new Gdk.Pixbuf.from_file_at_scale (path, 48, -1, true); model.append (out iter); model.set (iter, Column.PIXBUF, pixbuf, Column.PIXBUF_READY, true, Column.NAME, Path.get_basename (path), Column.DATA, path); } catch (FileError err) { // ignore } catch (Error err) { warning ("GDK Pixbuf error (%s): %s", path, err.message); } } } } private void on_icon_context_changed (ComboBox box) { unowned ListStore model; unowned IconTheme icon_theme; List icon_list; model = this._themed_viewer.model as ListStore; model.clear (); icon_theme = IconTheme.get_default (); icon_list = icon_theme.list_icons (box.get_active_text ()); icon_list.sort ((CompareFunc)strcmp); foreach (unowned string icon_name in icon_list) { TreeIter iter; model.append (out iter); model.set (iter, Column.PIXBUF, NO_ICON, Column.PIXBUF_READY, false, Column.NAME, icon_name, Column.DATA, icon_name); } } private void on_response (int response) { if (response == ResponseType.OK) { List? item; item = this._viewer.get_selected_items (); if (item == null) { string msg; MessageDialog dialog; msg = _ ("Please select an icon."); dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.ERROR, ButtonsType.OK, "%s", msg); dialog.title = _ ("Error"); dialog.run (); dialog.destroy (); return; } else { TreePath path; TreeModel model; bool res; TreeIter iter; path = item.data; model = this._viewer.model; res = model.get_iter (out iter, path); if (res) { Value pixbuf; Value data; model.get_value (iter, Column.PIXBUF, out pixbuf); model.get_value (iter, Column.DATA, out data); this.selected_pixbuf = (Gdk.Pixbuf)pixbuf; this.selected_icon = (string)data; if (this._viewer == this._file_viewer) { this.selected_icon_type = IconType.FILE; } else { this.selected_icon_type = IconType.THEMED; } this.icon_selected (); } else { warning ("Something wrong happened when converting tree path -> iter."); } } } this.hide (); } } } // vim:et:ai:cindent:ts=2 sts=2 sw=2 libdesktop-agnostic-0.3.92/libdesktop-agnostic/desktop-entry.vala0000664000175000017510000001416611536677677024522 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; [CCode (cheader_filename = "libdesktop-agnostic/fdo.h")] namespace DesktopAgnostic.FDO { /** * Flags used when launching an application from a desktop entry. */ public enum DesktopEntryLaunchFlags { // use documents to fill argv instead of launching one app per document ONLY_ONE = 1 << 0, // use current working directory instead of home directory USE_CWD = 1 << 1, // don't automatically reap child process DO_NOT_REAP_CHILD = 1 << 2 } /** * The kind of desktop entry. * * [[http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html]] */ public enum DesktopEntryType { UNKNOWN = 0, APPLICATION, LINK, DIRECTORY } /** * Generic, DesktopEntry-related errors. */ public errordomain DesktopEntryError { INVALID_FILE, NOT_LAUNCHABLE } /** * Converts a DesktopEntryType to its string counterpart. */ public static string desktop_entry_type_to_string (DesktopEntryType entry_type) { switch (entry_type) { case DesktopEntryType.APPLICATION: return "Application"; case DesktopEntryType.LINK: return "Link"; case DesktopEntryType.DIRECTORY: return "Directory"; default: return "Unknown"; } } public interface DesktopEntry : Object { // construction /** * The file object which points to the desktop entry file. Cannot be * constructed in conjunction with either keyfile or data. * Note: these are really construct-only, but construct-only properties * don't work with GModules. */ public abstract VFS.File? file { get; set construct; } /** * The URI of the desktop entry. Cannot be constructed with either file * or data. * Note: these are really construct-only, but construct-only properties * don't work with GModules. */ public abstract KeyFile keyfile { get; set construct; } /** * The raw data that is formatted according to the desktop entry * specification. Cannot be constructed in conjunction with either file or * keyfile. * Note: these are really construct-only, but construct-only properties * don't work with GModules. */ public abstract string data { set construct; } // manipulation /** * The type of desktop entry, corresponding to the "Type" key. */ public abstract DesktopEntryType entry_type { get; set; } public abstract string name { owned get; set; } public abstract string? icon { owned get; set; } public abstract bool key_exists (string key); public abstract bool get_boolean (string key); public abstract void set_boolean (string key, bool value); public abstract string? get_string (string key); public abstract void set_string (string key, string value); public abstract string? get_localestring (string key, string? locale); public abstract void set_localestring (string key, string locale, string value); [CCode (array_length = false, array_null_terminated = true)] public abstract string[]? get_string_list (string key); public abstract void set_string_list (string key, [CCode (array_length = false, array_null_terminated = true)] string[] value); // miscellaneous /** * Whether the path specified in the "Exec" key exists. if the entry type is * "Application", also checks to see if it's launchable. */ public abstract bool exists (); public abstract Pid launch (DesktopEntryLaunchFlags flags, SList? documents) throws GLib.Error; public abstract void save (VFS.File? new_file) throws GLib.Error; } private static Type? module_type = null; public Type get_type () throws GLib.Error { if (module_type == null) { module_type = get_module_type ("fdo", "desktop-entry"); } return module_type; } /** * Convenience method for creating a new desktop entry from scratch. */ public DesktopEntry? desktop_entry_new () throws GLib.Error { Type type = get_type (); if (type == Type.INVALID) { return null; } else { return (DesktopEntry)Object.new (type); } } /** * Convenience method for loading a desktop entry via a VFS.File. */ public DesktopEntry? desktop_entry_new_for_file (VFS.File file) throws GLib.Error { Type type = get_type (); if (type == Type.INVALID) { return null; } else { return (DesktopEntry)Object.new (type, "file", file); } } /** * Convenience method for loading a desktop entry from a KeyFile object. */ public DesktopEntry? desktop_entry_new_for_keyfile (KeyFile keyfile) throws GLib.Error { Type type = get_type (); if (type == Type.INVALID) { return null; } else { return (DesktopEntry)Object.new (type, "keyfile", keyfile); } } /** * Convenience method for loading a desktop entry from a string of data. */ public DesktopEntry? desktop_entry_new_for_data (string data) throws GLib.Error { Type type = get_type (); if (type == Type.INVALID) { return null; } else { return (DesktopEntry)Object.new (type, "data", data); } } } // vim: set ts=2 sts=2 sw=2 et ai cindent : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-impl-gnome-vfs.vala0000664000175000017510000000474311536677677025346 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class GnomeVFSImplementation : Object, Implementation { public string name { get { return "GNOME VFS"; } } public Type file_type { get { return typeof (FileGnomeVFS); } } public Type file_monitor_type { get { return typeof (FileMonitorGnomeVFS); } } public Type trash_type { get { return typeof (TrashGnomeVFS); } } public Type volume_type { get { return typeof (VolumeGnomeVFS); } } public void init () { GnomeVFS.init (); } public SList files_from_uri_list (string uri_list) throws GLib.Error { SList files = new SList (); unowned List uris = GnomeVFS.URI.list_parse (uri_list); foreach (unowned GnomeVFS.URI uri in uris) { string uri_str = uri.to_string (GnomeVFS.URIHideOptions.NONE); File file = file_new_for_uri (uri_str); files.append ((owned)file); } return files; } private VolumeMonitor vmonitor; public unowned VolumeMonitor volume_monitor_get_default () { if (vmonitor == null) { vmonitor = new VolumeMonitorGnomeVFS (); } return vmonitor; } public void shutdown () { GnomeVFS.shutdown (); } } } public Type register_plugin () { return typeof (DesktopAgnostic.VFS.GnomeVFSImplementation); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file-monitor-impl-thunar-vfs.vala0000664000175000017510000000720511536677677030140 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class FileMonitorThunarVFS : Object, FileMonitor { private unowned ThunarVfs.MonitorHandle handle; private File file; private bool _cancelled; public bool cancelled { get { return this._cancelled; } } public FileMonitorThunarVFS (FileThunarVFS file) { this.file = file; unowned ThunarVfs.Monitor mon = ThunarVfs.Monitor.get_default (); if (file.file_type == FileType.DIRECTORY) { this.handle = mon.add_directory ((ThunarVfs.Path)file.implementation, this.monitor_callback); } else { this.handle = mon.add_file ((ThunarVfs.Path)file.implementation, this.monitor_callback); } this._cancelled = false; } private void monitor_callback (ThunarVfs.Monitor monitor, ThunarVfs.MonitorHandle handle, ThunarVfs.MonitorEvent event, ThunarVfs.Path handle_path, ThunarVfs.Path event_path) { try { File event_file = file_new_for_uri (event_path.dup_uri ()); FileMonitorEvent da_event = FileMonitorEvent.UNKNOWN; switch (event) { case ThunarVfs.MonitorEvent.CHANGED: da_event = FileMonitorEvent.CHANGED; break; case ThunarVfs.MonitorEvent.CREATED: da_event = FileMonitorEvent.CREATED; break; case ThunarVfs.MonitorEvent.DELETED: da_event = FileMonitorEvent.DELETED; break; } this.changed (this.file, event_file, da_event); } catch (Error err) { critical ("Error: %s", err.message); } } public void emit (File? other, FileMonitorEvent event) { ThunarVfs.MonitorEvent tvfs_event; ThunarVfs.Path path; unowned ThunarVfs.Monitor mon = ThunarVfs.Monitor.get_default (); switch (event) { case FileMonitorEvent.CHANGED: tvfs_event = ThunarVfs.MonitorEvent.CHANGED; break; case FileMonitorEvent.CREATED: tvfs_event = ThunarVfs.MonitorEvent.CREATED; break; case FileMonitorEvent.DELETED: tvfs_event = ThunarVfs.MonitorEvent.DELETED; break; default: return; } if (other == null) { path = (ThunarVfs.Path)this.file.implementation; } else { path = (ThunarVfs.Path)other.implementation; } mon.feed (tvfs_event, path); } public bool cancel () { ThunarVfs.Monitor.get_default ().remove (this.handle); this._cancelled = true; return true; } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-type-color.vala0000664000175000017510000000732311536677677025247 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; namespace DesktopAgnostic.Config { public class ColorType : SchemaType { const string DEFAULT_KEY = "default"; public override string name { owned get { return "color"; } } public override Type schema_type { get { return typeof (Color); } } public override string serialize (Value val) throws SchemaError { unowned Color? color = (Color)val; if (color == null) { return ""; } else { return color.to_string (); } } public override Value deserialize (string serialized) throws SchemaError { Value val; if (serialized == "") { val = (Object)null; return val; } try { Color color = new Color.from_string (serialized); val = (owned)color; return val; } catch (ColorParseError err) { throw new SchemaError.PARSE ("Could not deserialize value: %s", err.message); } } public override Value parse_default_value (KeyFile schema, string group) throws SchemaError { return this.deserialize (schema.get_string (group, DEFAULT_KEY)); } public override ValueArray parse_default_list_value (KeyFile schema, string group) throws SchemaError { ValueArray array; try { string[] list = schema.get_string_list (group, DEFAULT_KEY); array = new ValueArray (list.length); foreach (unowned string item in list) { array.append (this.deserialize (item)); } return array; } catch (KeyFileError err) { throw new SchemaError.PARSE ("Could not parse the default list value: %s", err.message); } } } /** * Used for Value transforms. */ public static void color_to_string (Value src_value, out Value dest_value) { ColorType ct = new ColorType (); dest_value = ct.serialize (src_value); } /** * Used for Value transforms. */ public static void string_to_color (Value src_value, out Value dest_value) { ColorType ct = new ColorType (); dest_value = ct.deserialize ((string)src_value); } } public Type register_plugin () { Value.register_transform_func (typeof (DesktopAgnostic.Color), typeof (string), DesktopAgnostic.Config.color_to_string); Value.register_transform_func (typeof (string), typeof (DesktopAgnostic.Color), DesktopAgnostic.Config.string_to_color); return typeof (DesktopAgnostic.Config.ColorType); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-volume-impl-gio.vala0000664000175000017510000001744611536677677025534 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; namespace DesktopAgnostic.VFS { public class VolumeGIO : Object, Volume { private GLib.Volume vol; public GLib.Volume implementation { construct { this.vol = value; } } public string name { get { return this.vol.get_name (); } } private File _uri; public File uri { get { if (this._uri == null) { GLib.Mount? mount = this.vol.get_mount (); if (mount != null) { GLib.File file = mount.get_root (); this._uri = file_new_for_uri (file.get_uri ()); } } return this._uri; } } private string? _icon; public string? icon { owned get { if (this._icon == null) { GLib.Icon icon = this.vol.get_icon (); if (icon is GLib.ThemedIcon) { unowned string[] icon_names = (string[])(((GLib.ThemedIcon)icon).get_names ()); if (icon_names.length > 0) { this._icon = icon_names[0]; } else { // set fallback this._icon = "drive-harddisk"; } } else if (icon is GLib.FileIcon) { string path = ((GLib.FileIcon)icon).get_file ().get_path (); this._icon = path; } else { // set fallback warning ("Unknown icon type: %s", icon.get_type ().name ()); this._icon = "drive-harddisk"; } } return this._icon; } } public bool is_mounted () { return this.vol.get_mount () != null; } private Volume.Callback _mount_callback; private AsyncResult async_result; private void on_mount (Object? obj, AsyncResult res) { this.async_result = res; this._mount_callback (); this._mount_callback = null; } public void mount (Volume.Callback callback) { if (this._mount_callback == null) { this._mount_callback = callback; this.vol.mount (MountMountFlags.NONE, null, null, this.on_mount); } } public bool mount_finish () throws VolumeError { bool result = false; try { result = this.vol.mount.end (this.async_result); } catch (GLib.Error err) { throw new VolumeError.MOUNT (err.message); } this.async_result = null; return result; } private Volume.Callback _unmount_callback; private void on_unmount (Object? obj, AsyncResult res) { this.async_result = res; this._unmount_callback (); this._unmount_callback = null; } public void unmount (Volume.Callback callback) { if (this._unmount_callback == null) { unowned Mount? mount; this._unmount_callback = callback; mount = this.vol.get_mount (); if (mount != null) { mount.unmount (MountUnmountFlags.NONE, null, this.on_unmount); } } } public bool unmount_finish () throws VolumeError { bool result = false; try { result = this.vol.get_mount ().unmount.end (this.async_result); } catch (GLib.Error err) { throw new VolumeError.UNMOUNT (err.message); } this.async_result = null; return result; } public bool can_eject () { return this.vol.can_eject (); } private Volume.Callback _eject_callback; private void on_eject (Object? obj, AsyncResult res) { this.async_result = res; this._eject_callback (); this._eject_callback = null; } public void eject (Volume.Callback callback) { if (this._eject_callback == null) { this._eject_callback = callback; this.vol.eject (MountUnmountFlags.NONE, null, this.on_eject); } } public bool eject_finish () throws VolumeError { bool result = false; try { result = this.vol.eject.end (this.async_result); } catch (GLib.Error err) { throw new VolumeError.EJECT (err.message); } this.async_result = null; return result; } } public class VolumeMonitorGIO : Object, VolumeMonitor { private GLib.VolumeMonitor monitor; private HashTable _volumes; construct { this.monitor = GLib.VolumeMonitor.get (); this._volumes = new HashTable (direct_hash, direct_equal); List vols = this.monitor.get_volumes (); foreach (unowned GLib.Volume gvol in vols) { VFS.Volume vol = this.create_volume (gvol); this._volumes.insert (gvol, vol); } this.monitor.mount_added += this.on_mount_added; this.monitor.mount_removed += this.on_mount_removed; this.monitor.volume_added += this.on_volume_added; this.monitor.volume_removed += this.on_volume_removed; } private VFS.Volume create_volume (GLib.Volume vol) { return (VFS.Volume)Object.new (typeof (VolumeGIO), "implementation", vol); } private VFS.Volume check_volume (GLib.Volume gvol) { VFS.Volume? vol = this._volumes.lookup (gvol); if (vol == null) { vol = this.create_volume (gvol); this._volumes.insert (gvol, vol); } return vol; } private VFS.Volume? get_volume_from_mount (Mount mount) { GLib.Volume? gvol = mount.get_volume (); if (gvol == null) { return null; } else { return this.check_volume (gvol); } } private void on_mount_added (GLib.VolumeMonitor vmonitor, Mount mount) { VFS.Volume? volume = this.get_volume_from_mount (mount); if (volume != null) { this.volume_mounted (volume); } } private void on_mount_removed (GLib.VolumeMonitor vmonitor, Mount mount) { VFS.Volume? volume = this.get_volume_from_mount (mount); if (volume != null) { this.volume_unmounted (volume); } } private void on_volume_added (GLib.VolumeMonitor vmonitor, GLib.Volume gvol) { this.check_volume (gvol); } private void on_volume_removed (GLib.VolumeMonitor vmonitor, GLib.Volume gvol) { VFS.Volume? vol = this._volumes.lookup (gvol); if (vol != null) { this._volumes.remove (gvol); this.volume_unmounted (vol); } } public void* implementation { get { return (void*)this.monitor; } } public List volumes { owned get { return this._volumes.get_values (); } } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-trash-impl-thunar-vfs.vala0000664000175000017510000000744511536677677026663 0ustar seagleseagle/* * 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 */ using DBus; using ThunarVfs; [DBus (name = "org.xfce.Trash")] public interface Xfce.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); } namespace DesktopAgnostic.VFS { private enum TrashState { UNKNOWN = -1, EMPTY, FULL } public class TrashThunarVFS : Trash, GLib.Object { protected unowned ThunarVfs.Path trash; private Connection dbus; private Xfce.Trash xfce_trash; private uint _file_count; private Job job; construct { Monitor monitor; this.trash = ThunarVfs.Path.get_for_trash (); this.dbus = DBus.Bus.get (DBus.BusType.SESSION); this.xfce_trash = (Xfce.Trash)this.dbus.get_object ("org.xfce.Thunar", "/org/xfce/FileManager"); this.xfce_trash.TrashChanged += this.on_trash_changed; this._file_count = 0; this.update_file_count (TrashState.UNKNOWN); } private void on_trash_changed (bool full) { this.update_file_count (full ? TrashState.FULL : TrashState.EMPTY); } private void update_file_count (TrashState state) { if (state == TrashState.EMPTY) { this._file_count = 0; this.file_count_changed (); } else { try { this.job = deep_count (this.trash, DeepCountFlags.NONE); this.job.status_ready += this.on_trash_count; this.job.finished += this.on_job_finished; } catch (GLib.Error e) { warning ("Could not retrieve contents of Trash: %s", e.message); } } } private void on_job_finished (Job job) { this.job = null; } private void on_trash_count (Job job, uint64 total_size, uint file_count, uint dir_count, uint unreadable_dir_count) { // For some reason, the root trash directory is also counted. this._file_count = file_count + (dir_count - 1) + unreadable_dir_count; this.file_count_changed (); } public uint file_count { get { return this._file_count; } } public void send_to_trash (File file) throws GLib.Error { string[] uris = new string[] { file.uri }; this.xfce_trash.MoveToTrash (uris, ""); } public void empty () { try { this.xfce_trash.EmptyTrash (""); } catch (DBus.Error err) { critical ("VFS Trash Error (Thunar VFS): %s", err.message); } } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file-monitor-impl-gnome-vfs.vala0000664000175000017510000000752211536677677027746 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class FileMonitorGnomeVFS : Object, FileMonitor { private bool _cancelled; public bool cancelled { get { return this._cancelled; } } private unowned GnomeVFS.MonitorHandle handle; private File _file; public FileMonitorGnomeVFS (FileGnomeVFS file) { this._file = file; GnomeVFS.MonitorType mt; if (file.file_type == FileType.DIRECTORY) { mt = GnomeVFS.MonitorType.DIRECTORY; } else { mt = GnomeVFS.MonitorType.FILE; } GnomeVFS.monitor_add (out this.handle, file.uri, mt, this.monitor_callback); this._cancelled = false; } private void monitor_callback (GnomeVFS.MonitorHandle handle, string monitor_uri, string info_uri, GnomeVFS.MonitorEventType event) { File info_file = null; if (info_uri != null) { info_file = file_new_for_uri (info_uri); } FileMonitorEvent da_event; switch (event) { case GnomeVFS.MonitorEventType.CHANGED: da_event = FileMonitorEvent.CHANGED; break; case GnomeVFS.MonitorEventType.CREATED: da_event = FileMonitorEvent.CREATED; break; case GnomeVFS.MonitorEventType.DELETED: da_event = FileMonitorEvent.DELETED; break; case GnomeVFS.MonitorEventType.METADATA_CHANGED: da_event = FileMonitorEvent.ATTRIBUTE_CHANGED; break; default: return; } this.changed (this._file, info_file, da_event); } public void emit (File? other, FileMonitorEvent event) { // emit () is not implemented (sanely) by the GNOME VFS library. /* GnomeVFS.URI other_uri = null; if (other != null) { other_uri = (GnomeVFS.URI)other.implementation; } GnomeVFS.MonitorEventType gnome_event; switch (event) { case FileMonitorEvent.CHANGED: gnome_event = GnomeVFS.MonitorEventType.CHANGED; break; case FileMonitorEvent.CREATED: gnome_event = GnomeVFS.MonitorEventType.CREATED; break; case FileMonitorEvent.DELETED: gnome_event = GnomeVFS.MonitorEventType.DELETED; break; case FileMonitorEvent.ATTRIBUTE_CHANGED: gnome_event = GnomeVFS.MonitorEventType.METADATA_CHANGED; break; default: // don't do UNKNOWN return; } GnomeVFS.monitor_callback (?, other_uri, gnome_event); */ this.changed (this._file, other, event); } public bool cancel () { GnomeVFS.Result res = GnomeVFS.monitor_cancel (this.handle); this._cancelled = (res == GnomeVFS.Result.OK); return this._cancelled; } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-volume-impl-thunar-vfs.vala0000664000175000017510000001454011536677677027043 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; namespace DesktopAgnostic.VFS { public class VolumeThunarVFS : Object, Volume { private ThunarVfs.Volume vol; public ThunarVfs.Volume implementation { construct { this.vol = value; } } public string name { get { return this.vol.get_name (); } } private File _uri; public File uri { get { if (this._uri == null) { ThunarVfs.Path path = this.vol.get_mount_point (); this._uri = file_new_for_uri (path.dup_uri ()); } return this._uri; } } public string? icon { owned get { return this.vol.lookup_icon_name (Gtk.IconTheme.get_default ()); } } public VolumeThunarVFS.for_implementation (ThunarVfs.Volume impl) { GLib.Object (implementation: impl); } public bool is_mounted () { return this.vol.is_mounted (); } private Volume.Callback _mount_callback; public bool do_mount () { this._mount_callback (); this._mount_callback = null; return false; } public void mount (Volume.Callback callback) { if (this._mount_callback == null) { this._mount_callback = callback; Idle.add (this.do_mount); } } public bool mount_finish () throws VolumeError { bool result = false; try { result = this.vol.mount (null); } catch (Error err) { throw new VolumeError.MOUNT (err.message); } return result; } private Volume.Callback _unmount_callback; public bool do_unmount () { this._unmount_callback (); this._unmount_callback = null; return false; } public void unmount (Volume.Callback callback) { if (this._unmount_callback == null) { this._unmount_callback = callback; Idle.add (this.do_unmount); } } public bool unmount_finish () throws VolumeError { bool result = false; try { result = this.vol.unmount (null); } catch (Error err) { throw new VolumeError.UNMOUNT (err.message); } return result; } public bool can_eject () { return this.vol.is_ejectable (); } private Volume.Callback _eject_callback; public bool do_eject () { this._eject_callback (); this._eject_callback = null; return false; } public void eject (Volume.Callback callback) { if (this._eject_callback == null) { this._eject_callback = callback; Idle.add (this.do_eject); } } public bool eject_finish () throws VolumeError { bool result = false; try { result = this.vol.eject (null); } catch (Error err) { throw new VolumeError.EJECT (err.message); } return result; } } public class VolumeMonitorThunarVFS : Object, VolumeMonitor { private ThunarVfs.VolumeManager manager; private HashTable _volumes; construct { this.manager = ThunarVfs.VolumeManager.get_default (); this._volumes = new HashTable (direct_hash, direct_equal); unowned List vols = this.manager.get_volumes (); foreach (unowned ThunarVfs.Volume tvol in vols) { this._volumes.insert (tvol, this.create_volume (tvol)); } this.manager.volume_mounted += this.on_mount_added; this.manager.volume_unmounted += this.on_mount_removed; this.manager.volumes_added += this.on_volumes_added; this.manager.volumes_removed += this.on_volumes_removed; } private VFS.Volume create_volume (ThunarVfs.Volume vol) { return new VolumeThunarVFS.for_implementation (vol); } private VFS.Volume check_volume (ThunarVfs.Volume tvol) { VFS.Volume? vol = this._volumes.lookup (tvol); if (vol == null) { vol = this.create_volume (tvol); this._volumes.insert (tvol, vol); } return vol; } private void on_mount_added (ThunarVfs.VolumeManager manager, ThunarVfs.Volume vol) { this.volume_mounted (this.check_volume (vol)); } private void on_mount_removed (ThunarVfs.VolumeManager manager, ThunarVfs.Volume vol) { this.volume_unmounted (this.check_volume (vol)); } private void on_volumes_added (ThunarVfs.VolumeManager manager, void* ptr) { unowned List vols = (List)ptr; foreach (unowned ThunarVfs.Volume tvol in vols) { this.check_volume (tvol); } } private void on_volumes_removed (ThunarVfs.VolumeManager manager, void* ptr) { unowned List vols = (List)ptr; foreach (unowned ThunarVfs.Volume tvol in vols) { VFS.Volume? vol = this._volumes.lookup (tvol); if (vol != null) { this._volumes.remove (tvol); } } } public void* implementation { get { return (void*)this.manager; } } public List volumes { owned get { return this._volumes.get_values (); } } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-impl-keyfile.vala0000664000175000017510000005214411536677677025542 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; namespace DesktopAgnostic.Config { public class GKeyFile : Backend { private KeyFile _data; private VFS.File _keyfile; private VFS.FileMonitor _keyfile_monitor; private ulong _monitor_changed_id; private string _checksum; private bool _autosave; private Datalist> _notifiers; public override string name { owned get { return "GKeyFile"; } } construct { this._autosave = true; this._monitor_changed_id = 0; if (this.schema != null) { this._data = new KeyFile (); this._notifiers = Datalist> (); } } /** * Saves the current state of the configuration to the filesystem, * suppressing the "changed" signal from the file monitor. */ private void save_config () throws GLib.Error { string data; size_t length; data = this._data.to_data (out length); this._checksum = Checksum.compute_for_string (ChecksumType.SHA256, data, length); if (this._monitor_changed_id != 0) { // block changed signal SignalHandler.block (this._keyfile_monitor, this._monitor_changed_id); } // save config file this._keyfile.replace_contents (data); if (this._monitor_changed_id != 0) { // unblock changed signal SignalHandler.unblock (this._keyfile_monitor, this._monitor_changed_id); } } /** * Saves the current configuration state to the filesystem (if autosave is * on) and emits the notify signal. */ private void update_config (string group, string key) throws GLib.Error { if (this._autosave) { this.save_config (); } this.notify (group, key); } private void get_data_from_file (VFS.File file, out string contents, out size_t length, out string checksum) throws GLib.Error { file.load_contents (out contents, out length); checksum = Checksum.compute_for_string (ChecksumType.SHA256, contents, length); } private void load_data (VFS.File file) throws GLib.Error { string data; size_t length; this.get_data_from_file (file, out data, out length, out this._checksum); this._data.load_from_data (data, (ulong)length, KeyFileFlags.NONE); } private void set_value_from_keyfile (KeyFile keyfile, string group, string key) throws GLib.Error { SchemaOption option = this.schema.get_option (group, key); Type type = option.option_type; if (type == typeof (bool)) { this.set_bool (group, key, keyfile.get_boolean (group, key)); } else if (type == typeof (int)) { this.set_int (group, key, keyfile.get_integer (group, key)); } else if (type == typeof (float)) { this.set_float (group, key, (float)keyfile.get_double (group, key)); } else if (type == typeof (string)) { this.set_string (group, key, keyfile.get_string (group, key)); } else if (type == typeof (ValueArray)) { ValueArray arr; arr = this.generate_valuearray_from_keyfile (keyfile, group, key); this.set_list (group, key, arr); } else { SchemaType? st = Schema.find_type (type); if (st == null) { throw new Error.INVALID_TYPE ("'%s' is an invalid config type.", type.name ()); } Value val; val = st.deserialize (keyfile.get_string (group, key)); this.set_value (group, key, val); } } private ValueArray generate_valuearray_from_keyfile (KeyFile keyfile, string group, string key) throws KeyFileError, GLib.Error { SchemaOption? option; Type list_type; ValueArray arr; option = this.schema.get_option (group, key); if (option == null) { throw new Error.KEY_NOT_FOUND ("The key %s/%s is invalid.", group, key); } else if (!keyfile.has_key (group, key)) { return new ValueArray (0); } list_type = option.list_type; if (list_type == typeof (bool)) { bool[] list_data; Value val; list_data = keyfile.get_boolean_list (group, key); arr = new ValueArray (list_data.length); foreach (bool item in list_data) { val = item; arr.append (val); } } else if (list_type == typeof (int)) { int[] list_data; Value val; list_data = keyfile.get_integer_list (group, key); arr = new ValueArray (list_data.length); foreach (int item in list_data) { val = item; arr.append (val); } } else if (list_type == typeof (float)) { double[] list_data; Value val; list_data = (double[])keyfile.get_double_list (group, key); arr = new ValueArray (list_data.length); foreach (double item in list_data) { val = (float)item; arr.append (val); } } else if (list_type == typeof (string)) { string[] list_data; Value val; list_data = keyfile.get_string_list (group, key); arr = new ValueArray (list_data.length); foreach (string item in list_data) { val = item; arr.append (val); } } else { SchemaType? st = Schema.find_type (list_type); if (st == null) { throw new Error.INVALID_TYPE ("'%s' is an invalid config type.", list_type.name ()); } string[] list_data; list_data = keyfile.get_string_list (group, key); arr = new ValueArray (list_data.length); foreach (string item in list_data) { arr.append (st.deserialize (item)); } } return arr; } private void on_keyfile_changed (VFS.File file, VFS.File? other, VFS.FileMonitorEvent event, VFS.FileMonitor monitor) { switch (event) { case VFS.FileMonitorEvent.CREATED: // just set the data this.load_data (file); break; case VFS.FileMonitorEvent.CHANGED: // check to see if the contents have changed string data; size_t length; string checksum; this.get_data_from_file (file, out data, out length, out checksum); if (this._checksum != checksum) { // iterate through the config keys and determine which ones have changed unowned Schema schema = this.schema; KeyFile new_data = new KeyFile (); new_data.load_from_data (data, length, KeyFileFlags.NONE); this._autosave = false; foreach (unowned string group in schema.get_groups ()) { foreach (unowned string key in schema.get_keys (group)) { if (this._data.has_group (group)) { if ((this._data.has_key (group, key) && this._data.get_value (group, key) != new_data.get_value (group, key)) || schema.get_option (group, key).option_type == typeof (ValueArray)) { this.set_value_from_keyfile (new_data, group, key); } } } } this._autosave = true; } break; case VFS.FileMonitorEvent.DELETED: // reset & save to disk this.reset (); break; default: // do nothing break; } } private void ensure_directory (string path) { if (!FileUtils.test (path, FileTest.EXISTS)) { int d_errno = DirUtils.create_with_parents (path, 0755); if (d_errno != 0) { critical ("Config file error: %s", strerror (d_errno)); } } } private bool create_file_monitor () { this._keyfile_monitor = this._keyfile.monitor (); this._monitor_changed_id = Signal.connect_swapped (this._keyfile_monitor, "changed", (Callback)this.on_keyfile_changed, this); return false; } /** * Determines the path to the config file and creates/loads it. */ public override void constructed () { string base_path; string path; Schema schema = this.schema; base_path = Path.build_filename (Environment.get_user_config_dir (), "desktop-agnostic"); if (this.instance_id == null) { path = Path.build_filename (base_path, "%s.ini".printf (schema.app_name)); } else { path = Path.build_filename (base_path, "instances", "%s-%s.ini".printf (schema.app_name, this.instance_id)); } this._keyfile = VFS.file_new_for_path (path); try { if (this._keyfile.exists ()) { this.load_data (this._keyfile); } else { this.ensure_directory (Path.get_dirname (path)); this.reset (); } } catch (GLib.Error err) { critical ("Config error: %s", err.message); } // don't immediately create the file monitor, otherwise it will catch // the "config file created" signal. Idle.add (this.create_file_monitor); } ~GKeyFile () { this._keyfile_monitor.cancel (); SignalHandler.disconnect (this._keyfile_monitor, this._monitor_changed_id); } public override void reset () throws GLib.Error { unowned Schema? schema = this.schema; if (schema == null) { throw new Error.NO_SCHEMA ("The schema was not loaded."); } this._autosave = false; foreach (unowned string group in schema.get_groups ()) { foreach (unowned string key in schema.get_keys (group)) { SchemaOption option = schema.get_option (group, key); if (this.instance_id == null || option.per_instance) { this.set_value (group, key, option.default_value); } } } this._autosave = true; this.save_config (); } public override void notify_add (string group, string key, NotifyFunc callback) throws GLib.Error { string full_key = "%s/%s".printf (group, key); unowned SList? funcs = this._notifiers.get_data (full_key); NotifyDelegate data = new NotifyDelegate (callback); funcs.append ((owned)data); this._notifiers.set_data (full_key, funcs); } public override void notify (string group, string key) throws GLib.Error { string full_key = "%s/%s".printf (group, key); Value value = this.get_value (group, key); unowned SList funcs = this._notifiers.get_data (full_key); foreach (unowned NotifyDelegate data in funcs) { if (data != null && data.callback != null) { data.execute (group, key, value); } } } public override void notify_remove (string group, string key, NotifyFunc callback) throws GLib.Error { string full_key = "%s/%s".printf (group, key); unowned SList funcs = this._notifiers.get_data (full_key); NotifyDelegate ndata = new NotifyDelegate (callback); unowned SList? node; node = funcs.find_custom (ndata, (CompareFunc)NotifyDelegate.compare); if (node != null) { node.data = null; funcs.delete_link (node); this._notifiers.set_data (full_key, funcs); } } /** * Removes the config file from the file system. Implies reset(), but does * not save to disk. */ public override void remove () throws GLib.Error { this._keyfile.remove (); this.reset (); } public override Value get_value (string group, string key) throws GLib.Error { Schema schema = this.schema; SchemaOption option = schema.get_option (group, key); Type option_type; Value result; if (option == null) { throw new Error.KEY_NOT_FOUND ("Could not find group and/or key in schema."); } option_type = option.option_type; if (option_type == typeof (bool)) { result = this.get_bool (group, key); } else if (option_type == typeof (float)) { result = this.get_float (group, key); } else if (option_type == typeof (int)) { result = this.get_int (group, key); } else if (option_type == typeof (string)) { result = this.get_string (group, key); } else if (option_type == typeof (ValueArray)) { result = this.get_list (group, key); } else { SchemaType st = this.schema.find_type (option_type); if (st == null) { throw new Error.INVALID_TYPE ("'%s' is an invalid config type.", option_type.name ()); } else { result = st.deserialize (this.get_string (group, key)); } } return result; } public override bool get_bool (string group, string key) throws GLib.Error { try { return this._data.get_boolean (group, key); } catch (KeyFileError err) { if (err is KeyFileError.GROUP_NOT_FOUND || err is KeyFileError.KEY_NOT_FOUND) { throw new Error.KEY_NOT_FOUND (err.message); } else { throw err; } } } public override void set_bool (string group, string key, bool value) throws GLib.Error { if (!this._data.has_group (group) || !this._data.has_key (group, key) || this.get_bool (group, key) != value) { this._data.set_boolean (group, key, value); this.update_config (group, key); } } public override float get_float (string group, string key) throws Error { try { return (float)this._data.get_double (group, key); } catch (KeyFileError err) { if (err is KeyFileError.GROUP_NOT_FOUND || err is KeyFileError.KEY_NOT_FOUND) { throw new Error.KEY_NOT_FOUND (err.message); } else { throw err; } } } public override void set_float (string group, string key, float value) throws GLib.Error { if (!this._data.has_group (group) || !this._data.has_key (group, key) || this.get_float (group, key) != value) { this._data.set_double (group, key, value); this.update_config (group, key); } } public override int get_int (string group, string key) throws GLib.Error { try { return this._data.get_integer (group, key); } catch (KeyFileError err) { if (err is KeyFileError.GROUP_NOT_FOUND || err is KeyFileError.KEY_NOT_FOUND) { throw new Error.KEY_NOT_FOUND (err.message); } else { throw err; } } } public override void set_int (string group, string key, int value) throws GLib.Error { if (!this._data.has_group (group) || !this._data.has_key (group, key) || this.get_int (group, key) != value) { this._data.set_integer (group, key, value); this.update_config (group, key); } } public override string get_string (string group, string key) throws GLib.Error { try { return this._data.get_string (group, key); } catch (KeyFileError err) { if (err is KeyFileError.GROUP_NOT_FOUND || err is KeyFileError.KEY_NOT_FOUND) { throw new Error.KEY_NOT_FOUND (err.message); } else { throw err; } } } public override void set_string (string group, string key, string value) throws GLib.Error { if (!this._data.has_group (group) || !this._data.has_key (group, key) || this.get_string (group, key) != value) { this._data.set_string (group, key, value); this.update_config (group, key); } } public override ValueArray get_list (string group, string key) throws GLib.Error { try { return this.generate_valuearray_from_keyfile (this._data, group, key); } catch (KeyFileError err) { if (err is KeyFileError.GROUP_NOT_FOUND || err is KeyFileError.KEY_NOT_FOUND) { throw new Error.KEY_NOT_FOUND (err.message); } else { throw err; } } } public override void set_list (string group, string key, ValueArray value) throws GLib.Error { SchemaOption option = this.schema.get_option (group, key); Type list_type = option.list_type; if (this._data.has_group (group) && this._data.has_key (group, key)) { ValueArray old_value; old_value = this.get_list (group, key); if (old_value.n_values == value.n_values) { bool is_equal = true; for (uint i = 0; i < value.n_values; i++) { // FIXME ridiculously unreliable Value.equals algorithm unowned Value old_val; unowned Value new_val; old_val = old_value.get_nth (i); new_val = value.get_nth (i); if (old_val.type () != new_val.type () || old_val.strdup_contents () != new_val.strdup_contents ()) { is_equal = false; break; } } if (is_equal) { return; } } } 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. this._data.remove_key (group, key); } } else if (list_type == typeof (bool)) { bool[] list = {}; foreach (unowned Value val in value) { list += (bool)val; } this._data.set_boolean_list (group, key, list); } else if (list_type == typeof (int)) { int[] list = {}; foreach (unowned Value val in value) { list += get_int_from_value (val); } this._data.set_integer_list (group, key, list); } else if (list_type == typeof (float)) { double[] list = {}; foreach (unowned Value val in value) { list += get_float_from_value (val); } this._data.set_double_list (group, key, list); } else if (list_type == typeof (string)) { string[] list = {}; foreach (unowned Value val in value) { list += (string)val; } this._data.set_string_list (group, key, list); } else { SchemaType? st = Schema.find_type (list_type); if (st == null) { throw new Error.INVALID_TYPE ("'%s' is an invalid config type.", list_type.name ()); } string[] list = {}; foreach (unowned Value val in value) { list += st.serialize (val); } this._data.set_string_list (group, key, list); } this.update_config (group, key); } } } public Type register_plugin () { return typeof (DesktopAgnostic.Config.GKeyFile); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/config-schema-type.vala0000664000175000017510000000660111536677677025367 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.Config { /** * The definition of a custom schema type. That is, a schema type which is * neither one of the primitive types (boolean, integer, float, string) nor * a list. */ public abstract class SchemaType : Object { /** * The name of the schema type, used in the "type" and "list type" schema * options for for configuration keys. */ public abstract string name { owned get; } /** * The GType associated with the schema type. */ public abstract Type schema_type { get; } /** * Converts a value into a string, to store in the configuration backend. * @param val the value to convert to a string * @return the string-serialized version of the value * @throws SchemaError if the schema type and the value type are different, * or if the serialization fails */ public abstract string serialize (Value val) throws SchemaError; /** * Converts a serialized string into the corresponding value dictated by the * schema type. * @param serialized the string to convert into the value * @return a container containing the converted value * @throws SchemaError if the deserialization fails */ public abstract Value deserialize (string serialized) throws SchemaError; /** * Converts the default value specified by the schema into the corresponding * deserialized value. * @param schema the schema from which the default value will be parsed * @param group the configuration option's full group/key * @return the parsed default value * @throws SchemaError if the default value is not found, or could not be * parsed correctly. */ public abstract Value parse_default_value (KeyFile schema, string group) throws SchemaError; /** * Converts the default list value specified by the schema into the * corresponding deserialized value array. * @param schema the schema from which the default value will be parsed * @param group the configuration option's full group/key * @return the parsed default value(s) * @throws SchemaError if the default value is not found, or could not be * parsed correctly. */ public abstract ValueArray parse_default_list_value (KeyFile schema, string group) throws SchemaError; } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/vfs-file-impl-gnome-vfs.vala0000664000175000017510000002273611536677677026265 0ustar seagleseagle/* * 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 */ namespace DesktopAgnostic.VFS { public class FileGnomeVFS : File { private GnomeVFS.URI _uri; public override void* implementation { get { return (void*)this._uri; } } private string _uri_str; protected override string impl_uri { owned get { return this._uri_str; } } protected override string? impl_path { owned get { return this._uri.get_path (); } } public override FileType file_type { get { FileType ft; if (this.exists ()) { GnomeVFS.FileInfo info = new GnomeVFS.FileInfo (); GnomeVFS.get_file_info_uri (this._uri, info, GnomeVFS.FileInfoOptions.DEFAULT); switch (info.type) { case GnomeVFS.FileType.REGULAR: ft = FileType.REGULAR; break; case GnomeVFS.FileType.DIRECTORY: ft = FileType.DIRECTORY; break; case GnomeVFS.FileType.SYMBOLIC_LINK: ft = FileType.SYMBOLIC_LINK; break; case GnomeVFS.FileType.FIFO: case GnomeVFS.FileType.SOCKET: case GnomeVFS.FileType.CHARACTER_DEVICE: case GnomeVFS.FileType.BLOCK_DEVICE: ft = FileType.SPECIAL; break; case GnomeVFS.FileType.UNKNOWN: default: ft = FileType.UNKNOWN; break; } } else { ft = FileType.UNKNOWN; } return ft; } } public override AccessFlags access_flags { get { AccessFlags flags = AccessFlags.NONE; if (this.exists ()) { GnomeVFS.FileInfo info = new GnomeVFS.FileInfo (); GnomeVFS.FileInfoOptions options; options = GnomeVFS.FileInfoOptions.GET_ACCESS_RIGHTS; GnomeVFS.get_file_info_uri (this._uri, info, options); if ((info.permissions & GnomeVFS.FilePermissions.ACCESS_READABLE) != 0) { flags |= AccessFlags.READ; } if ((info.permissions & GnomeVFS.FilePermissions.ACCESS_WRITABLE) != 0) { flags |= AccessFlags.WRITE; } if ((info.permissions & GnomeVFS.FilePermissions.ACCESS_EXECUTABLE) != 0) { flags |= AccessFlags.EXECUTE; } } return flags; } } public override File? parent { owned get { unowned GnomeVFS.URI? uri; uri = this._uri.get_parent (); if (uri == null) { return null; } else { File result; result = new FileGnomeVFS (); result.init (uri.to_string (GnomeVFS.URIHideOptions.NONE)); return result; } } } protected override void init (string uri) { this._uri_str = uri; this._uri = new GnomeVFS.URI (uri); } public override bool exists () { return this._uri.exists (); } public override FileMonitor monitor () { return new FileMonitorGnomeVFS (this); } /** * @return %TRUE if it's an error */ private bool handle_error (GnomeVFS.Result res) throws Error { if (res == GnomeVFS.Result.OK) { return false; } else { Error err = (Error)new Error (Quark.from_string ("Gnome.VFS"), 0, GnomeVFS.result_to_string (res)); throw err; } } public override bool load_contents (out string contents, out size_t length) throws Error { GnomeVFS.FileInfo info; GnomeVFS.Result res; unowned GnomeVFS.Handle handle; char[] buffer; info = new GnomeVFS.FileInfo (); res = GnomeVFS.get_file_info_uri (this._uri, info, GnomeVFS.FileInfoOptions.DEFAULT); if (this.handle_error (res)) { return false; } res = GnomeVFS.open_uri (out handle, this._uri, GnomeVFS.OpenMode.READ); if (this.handle_error (res)) { return false; } buffer = new char[(int)info.size]; res = GnomeVFS.read (handle, (void*)buffer, info.size, null); if (this.handle_error (res)) { return false; } contents = (string)buffer; res = GnomeVFS.close (handle); if (this.handle_error (res)) { return false; } return true; } public override bool replace_contents (string contents) throws Error { GnomeVFS.Result res; unowned GnomeVFS.Handle handle; if (this.exists ()) { res = GnomeVFS.open_uri (out handle, this._uri, GnomeVFS.OpenMode.WRITE); } else { res = GnomeVFS.create_uri (out handle, this._uri, GnomeVFS.OpenMode.WRITE, true, 0644); } if (this.handle_error (res)) { return false; } res = GnomeVFS.write (handle, (void*)contents, (GnomeVFS.FileSize)contents.size (), null); if (this.handle_error (res)) { return false; } res = GnomeVFS.close (handle); if (this.handle_error (res)) { return false; } return true; } public override bool launch () throws Error { GnomeVFS.FileInfo info; unowned GnomeVFS.MimeApplication mime_app; List uris = new List (); info = new GnomeVFS.FileInfo (); GnomeVFS.get_file_info_uri (this._uri, info, GnomeVFS.FileInfoOptions.GET_MIME_TYPE); mime_app = GnomeVFS.mime_get_default_application_for_uri (this._uri_str, info.mime_type); uris.append (this._uri_str); return mime_app.launch (uris) == GnomeVFS.Result.OK; } public override SList enumerate_children () throws Error { SList result; unowned GnomeVFS.DirectoryHandle dir; GnomeVFS.Result res; result = new SList (); res = GnomeVFS.directory_open_from_uri (out dir, this._uri, GnomeVFS.FileInfoOptions.NAME_ONLY); if (res == GnomeVFS.Result.OK) { GnomeVFS.FileInfo file_info = new GnomeVFS.FileInfo (); while ((res = GnomeVFS.directory_read_next (dir, file_info)) == GnomeVFS.Result.OK) { if (file_info.name != "." && file_info.name != "..") { string full_uri; File child; full_uri = "%s/%s".printf (this._uri_str, GnomeVFS.escape_string (file_info.name)); child = file_new_for_uri (full_uri); result.append ((owned)child); } } GnomeVFS.directory_close (dir); } else { throw new FileError.INVALID_TYPE ("VFS Error: %s", GnomeVFS.result_to_string (res)); } return result; } public override bool copy (File destination, bool overwrite) throws Error { GnomeVFS.XferOverwriteMode overwrite_mode; GnomeVFS.Result res; if (overwrite) { overwrite_mode = GnomeVFS.XferOverwriteMode.REPLACE; } else { overwrite_mode = GnomeVFS.XferOverwriteMode.ABORT; } res = GnomeVFS.xfer_uri ((GnomeVFS.URI)this.implementation, (GnomeVFS.URI)destination.implementation, GnomeVFS.XferOptions.DEFAULT, GnomeVFS.XferErrorMode.ABORT, overwrite_mode, null); return (res == GnomeVFS.Result.OK); } public override bool remove () throws Error { if (!this.exists ()) { throw new FileError.FILE_NOT_FOUND ("The file '%s' does not exist.", this.uri); } 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 ()); } } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/libdesktop-agnostic/desktop-entry-impl-gnome.vala0000664000175000017510000001635611536677677026567 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.VFS; using Gnome; namespace DesktopAgnostic.FDO { public class DesktopEntryGNOME : DesktopEntry, Object { private DesktopItem item = null; private VFS.File _file = null; public VFS.File? file { get { return this._file; } set construct { if (value != null) { if (this.item == null) { string? path; this._file = value; path = value.path; if (path == null) { this.item = new DesktopItem.from_uri (value.uri, 0); } else { this.item = new DesktopItem.from_file (path, 0); } } else { warning ("The desktop entry has already been initialized."); } } } } private unowned KeyFile? _keyfile = null; public KeyFile keyfile { get { return this._keyfile; } set construct { if (value != null) { if (this.item == null) { string data; size_t length; this._keyfile = value; data = value.to_data (out length); this.item = new DesktopItem.from_string ("", data, (ssize_t)length, 0); } else { warning ("The desktop entry has already been initialized."); } } } } public string data { set construct { if (value != null && value != "") { if (this.item == null) { this.item = new DesktopItem.from_string ("", value, -1, 0); } else { warning ("The desktop entry has already been initialized."); } } } } public DesktopEntryType entry_type { get { DesktopEntryType result; switch (this.item.get_entry_type ()) { case DesktopItemType.APPLICATION: result = DesktopEntryType.APPLICATION; break; case DesktopItemType.LINK: result = DesktopEntryType.LINK; break; case DesktopItemType.DIRECTORY: result = DesktopEntryType.DIRECTORY; break; default: result = DesktopEntryType.UNKNOWN; break; } return result; } set { switch (value) { case DesktopEntryType.UNKNOWN: this.item.set_entry_type (DesktopItemType.OTHER); break; case DesktopEntryType.APPLICATION: this.item.set_entry_type (DesktopItemType.APPLICATION); break; case DesktopEntryType.LINK: this.item.set_entry_type (DesktopItemType.LINK); break; case DesktopEntryType.DIRECTORY: this.item.set_entry_type (DesktopItemType.DIRECTORY); break; } } } public string name { owned get { return this.item.get_string (DESKTOP_ITEM_NAME); } set { this.item.set_string (DESKTOP_ITEM_NAME, value); } } public string? icon { owned get { return this.item.get_icon (Gtk.IconTheme.get_default ()); } set { if (value == null) { warning ("Cannot set a NULL value for 'Icon'."); } else { this.item.set_string (DESKTOP_ITEM_ICON, value); } } } private override void constructed () { if (this.item == null) { this.item = new DesktopItem (); } } public bool key_exists (string key) { return this.item.attr_exists (key); } public bool get_boolean (string key) { return this.item.get_boolean (key); } public void set_boolean (string key, bool value) { this.item.set_boolean (key, value); } public string? get_string (string key) { return this.item.get_string (key); } public void set_string (string key, string value) { this.item.set_string (key, value); } public string? get_localestring (string key, string? locale) { if (locale == null) { return this.item.get_localestring (key); } return this.item.get_localestring_lang (key, locale); } public void set_localestring (string key, string locale, string value) { this.item.set_localestring_lang (key, locale, value); } [CCode (array_length = false, array_null_terminated = true)] public string[]? get_string_list (string key) { return (string[])this.item.get_strings (key); } public void set_string_list (string key, [CCode (array_length = false, array_null_terminated = true)] string[] value) { this.item.set_strings (key, value); } public bool exists () { return this.item.exists (); } public Pid launch (DesktopEntryLaunchFlags flags, SList? documents) throws GLib.Error { List file_list = new List (); DesktopItemLaunchFlags lflags = 0; foreach (unowned string document in documents) { file_list.append (document); } if ((flags & DesktopEntryLaunchFlags.ONLY_ONE) != 0) { lflags |= DesktopItemLaunchFlags.ONLY_ONE; } if ((flags & DesktopEntryLaunchFlags.USE_CWD) != 0) { lflags |= DesktopItemLaunchFlags.USE_CURRENT_DIR; } if ((flags & DesktopEntryLaunchFlags.DO_NOT_REAP_CHILD) != 0) { lflags |= DesktopItemLaunchFlags.DO_NOT_REAP_CHILD; } return (Pid)this.item.launch (file_list, lflags); } public void save (VFS.File? new_file) throws GLib.Error { string? uri = null; if (new_file != null) { uri = new_file.uri; } else if (this._file != null) { uri = this._file.uri; } else { throw new DesktopEntryError.INVALID_FILE ("No filename specified."); } this.item.save (uri, false); } } } public Type register_plugin () { return typeof (DesktopAgnostic.FDO.DesktopEntryGNOME); } // vim: set et ts=2 sts=2 sw=2 ai cindent : libdesktop-agnostic-0.3.92/vapi/build.vapi0000664000175000017510000000041711536677677020011 0ustar seagleseagle[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "build-config.h")] namespace Build { public const string GETTEXT_PACKAGE; public const string LIBDIR; public const string SYSCONFDIR; public const string VERSION; } // vim: set noet ts=8 sts=8 sw=8 : libdesktop-agnostic-0.3.92/vapi/config-notify-delegate.vapi0000664000175000017510000000256111536677677023237 0ustar seagleseagle/* * VAPI for a configuration notification delegate structure. * * 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 */ namespace DesktopAgnostic.Config { [CCode (cheader_filename = "config-notify-delegate.c", free_function = "desktop_agnostic_config_notify_delegate_free")] [Compact] class NotifyDelegate { public NotifyFunc callback; public NotifyDelegate (NotifyFunc callback); public void execute (string group, string key, GLib.Value value); public static int compare (void* a, void* b); } } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/vapi/hashtable-gtype-key.vapi0000664000175000017510000000230611536677677022560 0ustar seagleseagle/* * VAPI for GType key functions for GHashTable. * * 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 */ namespace DesktopAgnostic.Config { [CCode (cheader_filename = "hashtable-gtype-key.c")] public static bool gtype_equal (void* v1, void* v2); [CCode (cheader_filename = "hashtable-gtype-key.c")] public static uint gtype_hash (void* v); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/vapi/thunar-vfs-1.deps0000664000175000017510000000007011536677677021134 0ustar seagleseaglegio-2.0 cairo pango gdk-pixbuf-2.0 gdk-2.0 atk gtk+-2.0 libdesktop-agnostic-0.3.92/vapi/thunar-vfs-1.vapi0000664000175000017510000004554511536677677021160 0ustar seagleseagle/* thunar-vfs-1.vapi generated by vapigen, do not modify. */ [CCode (cprefix = "ThunarVfs", lower_case_cprefix = "thunar_vfs_")] namespace ThunarVfs { [Compact] [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class FileDevice { } [Compact] [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class FileSize { } [Compact] [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class FileTime { } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class Group : GLib.Object { public unowned ThunarVfs.GroupId get_id (); public unowned string get_name (); } [Compact] [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class GroupId { } [Compact] [CCode (ref_function = "thunar_vfs_info_ref", unref_function = "thunar_vfs_info_unref", type_id = "THUNAR_VFS_TYPE_INFO", cheader_filename = "thunar-vfs/thunar-vfs.h")] public class Info { public weak ThunarVfs.FileTime atime; public weak ThunarVfs.FileTime ctime; public weak string custom_icon; public weak ThunarVfs.FileDevice device; public weak string display_name; public ThunarVfs.FileFlags flags; public weak ThunarVfs.GroupId gid; public weak ThunarVfs.MimeInfo mime_info; public ThunarVfs.FileMode mode; public weak ThunarVfs.FileTime mtime; public weak ThunarVfs.Path path; public int ref_count; public weak ThunarVfs.FileSize size; public ThunarVfs.FileType type; public weak ThunarVfs.UserId uid; public unowned ThunarVfs.Info copy (); public bool execute (Gdk.Screen screen, GLib.List path_list, string working_directory) throws GLib.Error; [CCode (has_construct_function = false)] public Info.for_path (ThunarVfs.Path path) throws GLib.Error; public unowned string get_custom_icon (); public bool get_free_space (ThunarVfs.FileSize free_space_return); public unowned string get_metadata (ThunarVfs.InfoMetadata metadata) throws GLib.Error; public static void list_free (GLib.List info_list); public bool matches (ThunarVfs.Info b); public unowned string read_link () throws GLib.Error; public bool rename (string name) throws GLib.Error; public bool set_custom_icon (string custom_icon) throws GLib.Error; } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class InteractiveJob : ThunarVfs.Job { public uint64 reserved0; [NoWrapper] public virtual void reserved1 (); [NoWrapper] public virtual void reserved2 (); [NoWrapper] public virtual void reserved3 (); [NoWrapper] public virtual void reserved4 (); } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class Job : GLib.Object { public void cancel (); public bool cancelled (); [NoWrapper] public virtual void execute (); public unowned ThunarVfs.Job launch (); [NoWrapper] public virtual void reserved1 (); [NoWrapper] public virtual void reserved2 (); public virtual signal ThunarVfs.JobResponse ask (string message, ThunarVfs.JobResponse choices); public virtual signal ThunarVfs.JobResponse ask_replace (ThunarVfs.Info src_info, ThunarVfs.Info dst_info); public virtual signal void error (void* p0); public virtual signal void finished (); public virtual signal void info_message (string p0); public virtual signal bool infos_ready (GLib.List info_list); public virtual signal void new_files (void* p0); public virtual signal void percent (double p0); public virtual signal void status_ready (uint64 total_size, uint file_count, uint directory_count, uint unreadable_directory_count); } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class MimeAction : ThunarVfs.MimeHandler { } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class MimeApplication : ThunarVfs.MimeHandler { public static bool equal (void* a, void* b); [CCode (has_construct_function = false)] public MimeApplication.from_desktop_id (string desktop_id); [CCode (has_construct_function = false)] public MimeApplication.from_file (string path, string desktop_id); public unowned GLib.List get_actions (); public unowned string get_desktop_id (); public unowned string get_mime_types (); public static uint hash (void* mime_application); public bool is_usercreated (); } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class MimeDatabase : GLib.Object { public unowned ThunarVfs.MimeApplication add_application (ThunarVfs.MimeInfo info, string name, string exec) throws GLib.Error; public unowned GLib.List get_applications (ThunarVfs.MimeInfo info); public static unowned ThunarVfs.MimeDatabase get_default (); public unowned ThunarVfs.MimeApplication get_default_application (ThunarVfs.MimeInfo info); public unowned ThunarVfs.MimeInfo get_info (string mime_type); public unowned ThunarVfs.MimeInfo get_info_for_data (void* data, size_t length); public unowned ThunarVfs.MimeInfo get_info_for_file (string path, string name); public unowned ThunarVfs.MimeInfo get_info_for_name (string name); public unowned GLib.List get_infos_for_info (ThunarVfs.MimeInfo info); public bool remove_application (ThunarVfs.MimeApplication application) throws GLib.Error; public bool set_default_application (ThunarVfs.MimeInfo info, ThunarVfs.MimeApplication application) throws GLib.Error; } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class MimeHandler : GLib.Object { public bool exec (Gdk.Screen screen, GLib.List path_list) throws GLib.Error; public bool exec_with_env (Gdk.Screen screen, GLib.List path_list, string envp) throws GLib.Error; public unowned string get_command (); public ThunarVfs.MimeHandlerFlags get_flags (); public unowned string get_name (); public unowned string lookup_icon_name (Gtk.IconTheme icon_theme); public string command { get; construct; } public ThunarVfs.MimeHandlerFlags flags { get; construct; } [NoAccessorMethod] public string icon { owned get; construct; } public string name { get; construct; } } [Compact] [CCode (ref_function = "thunar_vfs_mime_info_ref", unref_function = "thunar_vfs_mime_info_unref", type_id = "THUNAR_VFS_TYPE_MIME_INFO", cheader_filename = "thunar-vfs/thunar-vfs.h")] public class MimeInfo { public weak string comment; public weak string icon_name; public int ref_count; [CCode (has_construct_function = false)] public MimeInfo (string name, ssize_t len); public static bool equal (void* a, void* b); public unowned string get_comment (); public unowned string get_media (); public unowned string get_name (); public unowned string get_subtype (); public static uint hash (void* info); public static void list_free (GLib.List info_list); public unowned string lookup_icon_name (Gtk.IconTheme icon_theme); } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class Monitor : GLib.Object { public unowned ThunarVfs.MonitorHandle add_directory (ThunarVfs.Path path, ThunarVfs.MonitorCallback callback); public unowned ThunarVfs.MonitorHandle add_file (ThunarVfs.Path path, ThunarVfs.MonitorCallback callback); public void feed (ThunarVfs.MonitorEvent event, ThunarVfs.Path path); public static unowned ThunarVfs.Monitor get_default (); public void remove (ThunarVfs.MonitorHandle handle); public void wait (); } [Compact] [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class MonitorHandle { } [Compact] [CCode (ref_function = "thunar_vfs_path_ref", unref_function = "thunar_vfs_path_unref", cheader_filename = "thunar-vfs/thunar-vfs.h")] public class Path { public int ref_count; [CCode (has_construct_function = false)] public Path (string identifier) throws GLib.Error; public unowned string dup_string (); public unowned string dup_uri (); public static bool equal (void* path_ptr_a, void* path_ptr_b); public static unowned ThunarVfs.Path get_for_home (); public static unowned ThunarVfs.Path get_for_root (); public static unowned ThunarVfs.Path get_for_trash (); public unowned string get_name (); public unowned ThunarVfs.Path? get_parent (); public ThunarVfs.PathScheme get_scheme (); public static uint hash (void* path_ptr); public bool is_ancestor (ThunarVfs.Path ancestor); public bool is_home (); public bool is_root (); public unowned ThunarVfs.Path relative (string name); public ssize_t to_string (string buffer, size_t bufsize) throws GLib.Error; public ssize_t to_uri (string buffer, size_t bufsize) throws GLib.Error; public void unref (); } [Compact] [CCode (copy_function = "thunar_vfs_path_list_copy", type_id = "THUNAR_VFS_TYPE_PATH_LIST", cheader_filename = "thunar-vfs/thunar-vfs.h")] public class PathList { public static unowned GLib.List append (GLib.List path_list, ThunarVfs.Path path); public static unowned GLib.List copy (GLib.List path_list); public static unowned GLib.List from_string (string uri_string) throws GLib.Error; public static unowned GLib.List prepend (GLib.List path_list, ThunarVfs.Path path); public static unowned string to_string (GLib.List path_list); } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class ThumbFactory : GLib.Object { [CCode (has_construct_function = false)] public ThumbFactory (ThunarVfs.ThumbSize size); public bool can_thumbnail (ThunarVfs.Info info); public unowned Gdk.Pixbuf generate_thumbnail (ThunarVfs.Info info); public bool has_failed_thumbnail (ThunarVfs.Info info); public unowned string lookup_thumbnail (ThunarVfs.Info info); public bool store_thumbnail (Gdk.Pixbuf pixbuf, ThunarVfs.Info info) throws GLib.Error; [NoAccessorMethod] public ThunarVfs.ThumbSize size { get; construct; } } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class User : GLib.Object { public unowned GLib.List get_groups (); public unowned ThunarVfs.UserId get_id (); public unowned string get_name (); public unowned ThunarVfs.Group get_primary_group (); public unowned string get_real_name (); public bool is_me (); } [Compact] [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class UserId { } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class UserManager : GLib.Object { public unowned GLib.List get_all_groups (); public static unowned ThunarVfs.UserManager get_default (); public unowned ThunarVfs.Group get_group_by_id (ThunarVfs.GroupId id); public unowned ThunarVfs.User get_user_by_id (ThunarVfs.UserId id); } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class Volume : GLib.Object { public bool eject (Gtk.Widget? window) throws GLib.Error; public ThunarVfs.VolumeKind get_kind (); public unowned ThunarVfs.Path get_mount_point (); public unowned string get_name (); public ThunarVfs.VolumeStatus get_status (); public bool is_disc (); public bool is_ejectable (); public bool is_mountable (); public bool is_mounted (); public bool is_present (); public bool is_removable (); public unowned string lookup_icon_name (Gtk.IconTheme icon_theme); public bool mount (Gtk.Widget? window) throws GLib.Error; public bool unmount (Gtk.Widget? window) throws GLib.Error; public virtual signal void changed (); public virtual signal void mounted (); public virtual signal void pre_unmount (); public virtual signal void unmounted (); } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public class VolumeManager : GLib.Object { public static unowned ThunarVfs.VolumeManager get_default (); public unowned ThunarVfs.Volume get_volume_by_info (ThunarVfs.Info info); public unowned GLib.List get_volumes (); public virtual signal void volume_mounted (ThunarVfs.Volume p0); public virtual signal void volume_pre_unmount (ThunarVfs.Volume p0); public virtual signal void volume_unmounted (ThunarVfs.Volume p0); public virtual signal void volumes_added (void* p0); public virtual signal void volumes_removed (void* p0); } [CCode (cprefix = "THUNAR_VFS_DEEP_COUNT_FLAGS_", cheader_filename = "thunar-vfs/thunar-vfs.h")] [Flags] public enum DeepCountFlags { NONE, FOLLOW_SYMLINKS } [CCode (cprefix = "THUNAR_VFS_FILE_FLAGS_", cheader_filename = "thunar-vfs/thunar-vfs.h")] [Flags] public enum FileFlags { NONE, SYMLINK, EXECUTABLE, HIDDEN, READABLE, WRITABLE } [CCode (cprefix = "THUNAR_VFS_FILE_MODE_", cheader_filename = "thunar-vfs/thunar-vfs.h")] [Flags] public enum FileMode { SUID, SGID, STICKY, USR_ALL, USR_READ, USR_WRITE, USR_EXEC, GRP_ALL, GRP_READ, GRP_WRITE, GRP_EXEC, OTH_ALL, OTH_READ, OTH_WRITE, OTH_EXEC } [CCode (cprefix = "THUNAR_VFS_FILE_TYPE_", cheader_filename = "thunar-vfs/thunar-vfs.h")] public enum FileType { PORT, DOOR, SOCKET, SYMLINK, REGULAR, BLOCKDEV, DIRECTORY, CHARDEV, FIFO, UNKNOWN } [CCode (cprefix = "THUNAR_VFS_INFO_METADATA_", has_type_id = "0", cheader_filename = "thunar-vfs/thunar-vfs.h")] public enum InfoMetadata { FILE_LINK_TARGET, TRASH_ORIGINAL_PATH, TRASH_DELETION_DATE } [CCode (cprefix = "THUNAR_VFS_INTERACTIVE_JOB_RESPONSE_", has_type_id = "0", cheader_filename = "thunar-vfs/thunar-vfs.h")] public enum InteractiveJobResponse { YES, YES_ALL, NO, CANCEL } [CCode (cprefix = "THUNAR_VFS_JOB_RESPONSE_", cheader_filename = "thunar-vfs/thunar-vfs.h")] [Flags] public enum JobResponse { YES, YES_ALL, NO, CANCEL, NO_ALL, RETRY } [CCode (cprefix = "THUNAR_VFS_MIME_HANDLER_", cheader_filename = "thunar-vfs/thunar-vfs.h")] [Flags] public enum MimeHandlerFlags { HIDDEN, REQUIRES_TERMINAL, SUPPORTS_STARTUP_NOTIFY, SUPPORTS_MULTI, SUPPORTS_URIS } [CCode (cprefix = "THUNAR_VFS_MONITOR_EVENT_", cheader_filename = "thunar-vfs/thunar-vfs.h")] public enum MonitorEvent { CHANGED, CREATED, DELETED } [CCode (cprefix = "THUNAR_VFS_PATH_SCHEME_", has_type_id = "0", cheader_filename = "thunar-vfs/thunar-vfs.h")] public enum PathScheme { FILE, TRASH, MASK } [CCode (cprefix = "THUNAR_VFS_THUMB_SIZE_", cheader_filename = "thunar-vfs/thunar-vfs.h")] public enum ThumbSize { NORMAL, LARGE } [CCode (cprefix = "THUNAR_VFS_VOLUME_KIND_", cheader_filename = "thunar-vfs/thunar-vfs.h")] public enum VolumeKind { UNKNOWN, CDROM, CDR, CDRW, DVDROM, DVDRAM, DVDR, DVDRW, DVDPLUSR, DVDPLUSRW, FLOPPY, HARDDISK, USBSTICK, AUDIO_PLAYER, AUDIO_CD, MEMORY_CARD, REMOVABLE_DISK } [CCode (cprefix = "THUNAR_VFS_VOLUME_STATUS_", cheader_filename = "thunar-vfs/thunar-vfs.h")] [Flags] public enum VolumeStatus { MOUNTED, PRESENT, MOUNTABLE } [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public delegate void MonitorCallback (ThunarVfs.Monitor monitor, ThunarVfs.MonitorHandle handle, ThunarVfs.MonitorEvent event, ThunarVfs.Path handle_path, ThunarVfs.Path event_path); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public const int THUNAR_VFS_MAJOR_VERSION; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public const int THUNAR_VFS_MICRO_VERSION; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public const int THUNAR_VFS_MINOR_VERSION; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public const int THUNAR_VFS_PATH_MAXSTRLEN; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public const int THUNAR_VFS_PATH_MAXURILEN; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned string canonicalize_filename (string filename); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job change_group (ThunarVfs.Path path, ThunarVfs.GroupId gid, bool recursive) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job change_mode (ThunarVfs.Path path, ThunarVfs.FileMode dir_mask, ThunarVfs.FileMode dir_mode, ThunarVfs.FileMode file_mask, ThunarVfs.FileMode file_mode, bool recursive) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job change_owner (ThunarVfs.Path path, ThunarVfs.UserId uid, bool recursive) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned string check_version (uint required_major, uint required_minor, uint required_micro); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job copy_file (ThunarVfs.Path source_path, ThunarVfs.Path target_path) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job copy_files (GLib.List source_path_list, GLib.List target_path_list) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job create_file (ThunarVfs.Path path) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job create_files (GLib.List path_list) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job deep_count (ThunarVfs.Path path, ThunarVfs.DeepCountFlags flags) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned string expand_filename (string filename) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned string humanize_size (ThunarVfs.FileSize size, string buffer, size_t buflen); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static void init (); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job link_file (ThunarVfs.Path source_path, ThunarVfs.Path target_path) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job link_files (GLib.List source_path_list, GLib.List target_path_list) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job listdir (ThunarVfs.Path path) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job make_directories (GLib.List path_list) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job make_directory (ThunarVfs.Path path) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job move_file (ThunarVfs.Path source_path, ThunarVfs.Path target_path) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job move_files (GLib.List source_path_list, GLib.List target_path_list) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static void shutdown (); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned string thumbnail_for_path (ThunarVfs.Path path, ThunarVfs.ThumbSize size); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static bool thumbnail_is_valid (string thumbnail, string uri, ThunarVfs.FileTime mtime); [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job unlink_file (ThunarVfs.Path path) throws GLib.Error; [CCode (cheader_filename = "thunar-vfs/thunar-vfs.h")] public static unowned ThunarVfs.Job unlink_files (GLib.List path_list) throws GLib.Error; } libdesktop-agnostic-0.3.92/vapi/posix-glob.vapi0000664000175000017510000000550211536677677020775 0ustar seagleseagle/* * Vala binding for POSIX glob() (with GNU extensions). * * 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 */ namespace POSIX { [CCode (cname = "glob_t", cheader_filename = "glob.h", destroy_function = "globfree")] public struct glob_t { // properties [CCode (cname = "gl_pathv", array_length_cname = "gl_pathc")] public string[]? paths; [CCode (cname = "gl_offs")] public size_t offset; // flags [CCode (cname = "GLOB_ERR")] public static const int ERR; [CCode (cname = "GLOB_MARK")] public static const int MARK; [CCode (cname = "GLOB_NOSORT")] public static const int NOSORT; [CCode (cname = "GLOB_DOOFFS")] public static const int DOOFFS; [CCode (cname = "GLOB_NOCHECK")] public static const int NOCHECK; [CCode (cname = "GLOB_APPEND")] public static const int APPEND; [CCode (cname = "GLOB_NOESCAPE")] public static const int NOESCAPE; // GNU-specific flags [CCode (cname = "GLOB_PERIOD")] public static const int PERIOD; [CCode (cname = "GLOB_MAGCHAR")] public static const int MAGCHAR; [CCode (cname = "GLOB_ALTDIRFUNC")] public static const int ALTDIRFUNC; [CCode (cname = "GLOB_BRACE")] public static const int BRACE; [CCode (cname = "GLOB_NOMAGIC")] public static const int NOMAGIC; [CCode (cname = "GLOB_TILDE")] public static const int TILDE; [CCode (cname = "GLOB_ONLYDIR")] public static const int ONLYDIR; [CCode (cname = "GLOB_TILDE_CHECK")] public static const int TILDE_CHECK; // error codes [CCode (cname = "GLOB_NOSPACE")] public static const int ERR_NOSPACE; [CCode (cname = "GLOB_ABORTED")] public static const int ERR_ABORTED; [CCode (cname = "GLOB_NOMATCH")] public static const int ERR_NOMATCH; } //public delegate int GlobErrFunc (string path, int errno); [CCode (cname = "glob")] public static int glob (string pattern, int flags, void* err_func, out glob_t g); } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/python/ui.defs0000664000175000017510000001157311536677677017700 0ustar seagleseagle;; -*- scheme -*- ; boxed definitions ... ; interface definitions ... ; object definitions ... (define-object ColorButton (in-module "DesktopAgnosticUI") (parent "GtkColorButton") (c-name "DesktopAgnosticUIColorButton") (gtype-id "DESKTOP_AGNOSTIC_UI_TYPE_COLOR_BUTTON") ) (define-object IconButton (in-module "DesktopAgnosticUI") (parent "GtkButton") (c-name "DesktopAgnosticUIIconButton") (gtype-id "DESKTOP_AGNOSTIC_UI_TYPE_ICON_BUTTON") ) (define-object IconChooserDialog (in-module "DesktopAgnosticUI") (parent "GtkDialog") (c-name "DesktopAgnosticUIIconChooserDialog") (gtype-id "DESKTOP_AGNOSTIC_UI_TYPE_ICON_CHOOSER_DIALOG") ) (define-object LauncherEditorDialog (in-module "DesktopAgnosticUI") (parent "GtkDialog") (c-name "DesktopAgnosticUILauncherEditorDialog") (gtype-id "DESKTOP_AGNOSTIC_UI_TYPE_LAUNCHER_EDITOR_DIALOG") ) ; pointer definitions ... ;; Enumerations and Flags ... (define-enum IconType (in-module "DesktopAgnosticUI") (c-name "DesktopAgnosticUIIconType") (gtype-id "DESKTOP_AGNOSTIC_UI_TYPE_ICON_TYPE") (values '("none" "DESKTOP_AGNOSTIC_UI_ICON_TYPE_NONE") '("themed" "DESKTOP_AGNOSTIC_UI_ICON_TYPE_THEMED") '("file" "DESKTOP_AGNOSTIC_UI_ICON_TYPE_FILE") ) ) ;; From ui.h (define-function color_button_get_type (c-name "desktop_agnostic_ui_color_button_get_type") (return-type "GType") ) (define-function color_button_new_with_color (c-name "desktop_agnostic_ui_color_button_new_with_color") (return-type "DesktopAgnosticUIColorButton*") (parameters '("DesktopAgnosticColor*" "color") ) ) (define-function color_button_construct_with_color (c-name "desktop_agnostic_ui_color_button_construct_with_color") (return-type "DesktopAgnosticUIColorButton*") (parameters '("GType" "object_type") '("DesktopAgnosticColor*" "color") ) ) (define-method set_alpha (of-object "DesktopAgnosticUIColorButton") (c-name "desktop_agnostic_ui_color_button_set_alpha") (return-type "none") (parameters '("guint16" "alpha") ) ) (define-function color_button_new (c-name "desktop_agnostic_ui_color_button_new") (is-constructor-of "DesktopAgnosticUIColorButton") (return-type "DesktopAgnosticUIColorButton*") ) (define-function color_button_construct (c-name "desktop_agnostic_ui_color_button_construct") (return-type "DesktopAgnosticUIColorButton*") (parameters '("GType" "object_type") ) ) (define-method get_da_color (of-object "DesktopAgnosticUIColorButton") (c-name "desktop_agnostic_ui_color_button_get_da_color") (return-type "DesktopAgnosticColor*") ) (define-method set_da_color (of-object "DesktopAgnosticUIColorButton") (c-name "desktop_agnostic_ui_color_button_set_da_color") (return-type "none") (parameters '("DesktopAgnosticColor*" "value") ) ) (define-function icon_button_get_type (c-name "desktop_agnostic_ui_icon_button_get_type") (return-type "GType") ) (define-function icon_button_new (c-name "desktop_agnostic_ui_icon_button_new") (is-constructor-of "DesktopAgnosticUIIconButton") (return-type "DesktopAgnosticUIIconButton*") (properties '("icon") ) ) (define-function icon_button_construct (c-name "desktop_agnostic_ui_icon_button_construct") (return-type "DesktopAgnosticUIIconButton*") (parameters '("GType" "object_type") '("const-char*" "icon") ) ) (define-function icon_type_get_type (c-name "desktop_agnostic_ui_icon_type_get_type") (return-type "GType") ) (define-method get_icon_type (of-object "DesktopAgnosticUIIconButton") (c-name "desktop_agnostic_ui_icon_button_get_icon_type") (return-type "DesktopAgnosticUIIconType") ) (define-function icon_chooser_dialog_get_type (c-name "desktop_agnostic_ui_icon_chooser_dialog_get_type") (return-type "GType") ) (define-function icon_chooser_dialog_new (c-name "desktop_agnostic_ui_icon_chooser_dialog_new") (is-constructor-of "DesktopAgnosticUIIconChooserDialog") (return-type "DesktopAgnosticUIIconChooserDialog*") ) (define-function icon_chooser_dialog_construct (c-name "desktop_agnostic_ui_icon_chooser_dialog_construct") (return-type "DesktopAgnosticUIIconChooserDialog*") (parameters '("GType" "object_type") ) ) (define-function launcher_editor_dialog_get_type (c-name "desktop_agnostic_ui_launcher_editor_dialog_get_type") (return-type "GType") ) (define-function launcher_editor_dialog_new (c-name "desktop_agnostic_ui_launcher_editor_dialog_new") (is-constructor-of "DesktopAgnosticUILauncherEditorDialog") (return-type "DesktopAgnosticUILauncherEditorDialog*") (properties '("file") '("output") ) ) (define-function launcher_editor_dialog_construct (c-name "desktop_agnostic_ui_launcher_editor_dialog_construct") (return-type "DesktopAgnosticUILauncherEditorDialog*") (parameters '("GType" "object_type") '("DesktopAgnosticVFSFile*" "file") '("DesktopAgnosticVFSFile*" "output") '("gboolean" "standalone") ) ) libdesktop-agnostic-0.3.92/python/wscript0000664000175000017510000001031311536677677020025 0ustar seagleseagle#!/usr/bin/python # encoding: utf-8 # --------------- # PyGObject bindings generator (until the gi module is stable) # copied/modified from gnome-python-desktop import Task from TaskGen import extension import Utils import misc import os import types GDK_DEFS = lambda bld: os.path.join(bld.env['PYGTK_DEFSDIR'], 'gdk-types.defs') def configure(conf): conf.check_python_headers() conf.check_cfg(package='pygobject-2.0', uselib_store='PYGOBJECT', atleast_version='2.12.0', mandatory=True, args='--cflags --libs') if not conf.find_program('pygobject-codegen-2.0', var='CODEGEN'): if not conf.find_program('pygtk-codegen-2.0', var='CODEGEN'): conf.fatal('Could not find the PyGObject/PyGTK code generator ' \ 'script') pkgconfig = 'pkg-config --variable defsdir pygtk-2.0' conf.env['PYGTK_DEFSDIR'] = Utils.cmd_output(pkgconfig, silent=1).strip() conf.check_cfg(package='pygobject-2.0', uselib_store='PYGLIB', atleast_version='2.15.2') def run_pyg_codegen(self): # stolen from TaskGen.exec_rule func, func_vars = Task.compile_fun('', self.generator.rule, shell=getattr(self.generator, 'shell', True)) func.code = self.generator.rule func(self) Task.task_type_from_func('pyg_codegen', run_pyg_codegen, ext_out='.c') @extension('.defs') def defs_hook(self, node): override_node = node.parent.find_resource('%s.override' % self.name) c_node = node.change_ext('.c') sources = [override_node, node] rule = ['${CODEGEN}'] if getattr(self, 'py_ssize_t_clean', True): rule += [' --py_ssize_t-clean'] for load in getattr(self, 'local_load_types', ()): sources += [node.parent.find_resource(load)] rule += ['--load-types', '${SRC[%i].abspath(env)}' % (len(sources) - 1)] for reg in getattr(self, 'local_register', ()): sources += [node.parent.find_resource(reg)] rule += ['--register', '${SRC[%i].abspath(env)}' % (len(sources) - 1)] for reg in getattr(self, 'register', ()): rule += ['--register', reg] if hasattr(self, 'prefix'): rule += ['--prefix', self.prefix] else: rule += ['--prefix', 'py%s' % self.name] rule += ['--override', '${SRC}', '>', '${TGT}'] self.rule = ' '.join(rule) task = self.create_task('pyg_codegen') task.inputs = sources task.outputs = [c_node] self.allnodes.append(c_node) def pyg_module(bld, module, dependencies, prefix=None, local_register=None): pyext = bld.new_task_gen('cc', 'shlib', 'pyext') pyext.source = '%s.defs %smodule.c' % (module, module) pyext.target = module if prefix is not None: pyext.prefix = prefix pyext.uselib = 'PYEXT PYGOBJECT' pyext.uselib_local = dependencies if local_register is not None: pyext.local_register = local_register pyext.includes = '..' pyext.install_path = '${PYTHONDIR}/desktopagnostic' defs_dir = '${DATADIR}/pygtk/2.0/defs' if module == 'desktopagnostic': bld.install_files(defs_dir, ['%s.defs' % module]) else: bld.install_as('%s/desktopagnostic_%s.defs' % (defs_dir, module), '%s.defs' % module, env=pyext.env) return pyext def build(bld): # Attach the 'codegen' and pyg_module methods to the build context bld.pyg_module = types.MethodType(pyg_module, bld) pyda = bld.pyg_module('desktopagnostic', 'desktop-agnostic') pyda.register = [GDK_DEFS(bld)] pyda.uselib += ' GDK' modules = (('config', 'cfg', None), ('vfs', 'vfs', None), ('fdo', 'fdo', ['vfs.defs']), ('ui', 'ui', ['desktopagnostic.defs', 'vfs.defs'])) for module, dep, lr in modules: pyext = bld.pyg_module(module, 'desktop-agnostic-%s' % dep, 'pydesktopagnostic_%s' % module, lr) init = bld.new_task_gen('subst') init.source = '__init__.py.in' init.target = '__init__.py' init.dict = { 'VERSION': bld.env['VERSION'], } init.fun = misc.subst_func init.install_path = '${PYTHONDIR}/desktopagnostic' # vim: set ts=4 sts=4 sw=4 et : libdesktop-agnostic-0.3.92/python/ui.override0000664000175000017510000000355011536677677020572 0ustar seagleseagle%% headers /* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include #include %% modulename desktopagnostic.ui %% import gobject.GObject as PyGObject_Type import desktopagnostic.Color as PyDesktopAgnosticColor_Type import desktopagnostic.vfs.File as PyDesktopAgnosticVFSFile_Type import gtk.Button as PyGtkButton_Type import gtk.ColorButton as PyGtkColorButton_Type import gtk.Dialog as PyGtkDialog_Type %% ignore-glob *_get_type *_error_quark *_construct* *_new_* %% define DesktopAgnosticUIColorButton.with_color onearg staticmethod static PyObject * _wrap_desktop_agnostic_u_i_color_button_with_color (PyObject *self, 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 */ py_ret = pygobject_new ((GObject *)ret); if (ret != NULL) g_object_unref (ret); return py_ret; } libdesktop-agnostic-0.3.92/python/vfs.defs0000664000175000017510000001704411536677677020060 0ustar seagleseagle;; -*- scheme -*- ; boxed definitions ... ; interface definitions ... (define-interface FileMonitor (in-module "DesktopAgnosticVFS") (c-name "DesktopAgnosticVFSFileMonitor") (gtype-id "DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR") (prerequisite "GObject") ) (define-interface Trash (in-module "DesktopAgnosticVFS") (c-name "DesktopAgnosticVFSTrash") (gtype-id "DESKTOP_AGNOSTIC_VFS_TYPE_TRASH") (prerequisite "GObject") ) ; object definitions ... (define-object File (in-module "DesktopAgnosticVFS") (parent "GObject") (c-name "DesktopAgnosticVFSFile") (gtype-id "DESKTOP_AGNOSTIC_VFS_TYPE_FILE") ) ; pointer definitions ... ;; Enumerations and Flags ... (define-enum AccessFlags (in-module "DesktopAgnosticVFS") (c-name "DesktopAgnosticVFSAccessFlags") (gtype-id "DESKTOP_AGNOSTIC_VFS_TYPE_ACCESS_FLAGS") (values '("none" "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_NONE") '("read" "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_READ") '("write" "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_WRITE") '("execute" "DESKTOP_AGNOSTIC_VFS_ACCESS_FLAGS_EXECUTE") ) ) (define-enum FileMonitorEvent (in-module "DesktopAgnosticVFS") (c-name "DesktopAgnosticVFSFileMonitorEvent") (gtype-id "DESKTOP_AGNOSTIC_VFS_TYPE_FILE_MONITOR_EVENT") (values '("unknown" "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_UNKNOWN") '("changed" "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CHANGED") '("created" "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_CREATED") '("deleted" "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_DELETED") '("attribute-changed" "DESKTOP_AGNOSTIC_VFS_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED") ) ) (define-enum FileType (in-module "DesktopAgnosticVFS") (c-name "DesktopAgnosticVFSFileType") (gtype-id "DESKTOP_AGNOSTIC_VFS_TYPE_FILE_TYPE") (values '("unknown" "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_UNKNOWN") '("regular" "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_REGULAR") '("directory" "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_DIRECTORY") '("symbolic-link" "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SYMBOLIC_LINK") '("special" "DESKTOP_AGNOSTIC_VFS_FILE_TYPE_SPECIAL") ) ) ;; Untyped enumerations and flags ... (define-enum FileError (in-module "DesktopAgnosticVFS") (c-name "DesktopAgnosticVFSFileError") (values '("file-not-found" "DESKTOP_AGNOSTIC_VFS_FILE_ERROR_FILE_NOT_FOUND") '("exists" "DESKTOP_AGNOSTIC_VFS_FILE_ERROR_EXISTS") '("invalid-type" "DESKTOP_AGNOSTIC_VFS_FILE_ERROR_INVALID_TYPE") ) ) ;; From vfs.h (define-function file_get_type (c-name "desktop_agnostic_vfs_file_get_type") (return-type "GType") ) (define-function file_error_quark (c-name "desktop_agnostic_vfs_file_error_quark") (return-type "GQuark") ) (define-function file_type_get_type (c-name "desktop_agnostic_vfs_file_type_get_type") (return-type "GType") ) (define-function file_monitor_event_get_type (c-name "desktop_agnostic_vfs_file_monitor_event_get_type") (return-type "GType") ) (define-function file_monitor_get_type (c-name "desktop_agnostic_vfs_file_monitor_get_type") (return-type "GType") ) (define-method exists (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_exists") (return-type "gboolean") ) (define-method is_readable (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_is_readable") (return-type "gboolean") ) (define-method is_writable (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_is_writable") (return-type "gboolean") ) (define-method is_executable (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_is_executable") (return-type "gboolean") ) (define-method monitor (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_monitor") (return-type "DesktopAgnosticVFSFileMonitor*") ) (define-method load_contents (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_load_contents") (return-type "gboolean") (parameters '("char**" "contents") '("gsize*" "length") '("GError**" "error") ) ) (define-method replace_contents (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_replace_contents") (return-type "gboolean") (parameters '("const-char*" "contents") '("GError**" "error") ) ) (define-method launch (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_launch") (return-type "gboolean") (parameters '("GError**" "error") ) ) (define-method enumerate_children (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_enumerate_children") (return-type "GSList*") (parameters '("GError**" "error") ) ) (define-method copy (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_copy") (return-type "gboolean") (parameters '("DesktopAgnosticVFSFile*" "destination") '("gboolean" "overwrite") '("GError**" "error") ) ) (define-method remove (of-object "DesktopAgnosticVFSFile") (c-name "desktop_agnostic_vfs_file_remove") (return-type "gboolean") (parameters '("GError**" "error") ) ) (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*") (parameters '("const-char*" "path") '("GError**" "error") ) ) (define-function file_new_for_uri (c-name "desktop_agnostic_vfs_file_new_for_uri") (return-type "DesktopAgnosticVFSFile*") (parameters '("const-char*" "uri") '("GError**" "error") ) ) (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") (return-type "none") (parameters '("DesktopAgnosticVFSFile*" "other") '("DesktopAgnosticVFSFileMonitorEvent" "event") ) ) (define-method cancel (of-object "DesktopAgnosticVFSFileMonitor") (c-name "desktop_agnostic_vfs_file_monitor_cancel") (return-type "gboolean") ) (define-function init (c-name "desktop_agnostic_vfs_init") (return-type "none") (parameters '("GError**" "error") ) ) (define-function trash_get_type (c-name "desktop_agnostic_vfs_trash_get_type") (return-type "GType") ) (define-method send_to_trash (of-object "DesktopAgnosticVFSTrash") (c-name "desktop_agnostic_vfs_trash_send_to_trash") (return-type "none") (parameters '("DesktopAgnosticVFSFile*" "file") '("GError**" "error") ) ) (define-method empty (of-object "DesktopAgnosticVFSTrash") (c-name "desktop_agnostic_vfs_trash_empty") (return-type "none") ) (define-function trash_get_default (c-name "desktop_agnostic_vfs_trash_get_default") (return-type "DesktopAgnosticVFSTrash*") (parameters '("GError**" "error") ) ) (define-function shutdown (c-name "desktop_agnostic_vfs_shutdown") (return-type "none") (parameters '("GError**" "error") ) ) libdesktop-agnostic-0.3.92/python/config.defs0000664000175000017510000001747511536677677020537 0ustar seagleseagle;; -*- scheme -*- ; boxed definitions ... ; interface definitions ... ; object definitions ... (define-object Client (in-module "DesktopAgnosticConfig") (parent "GObject") (c-name "DesktopAgnosticConfigClient") (gtype-id "DESKTOP_AGNOSTIC_CONFIG_TYPE_CLIENT") ) ; pointer definitions ... ;; Enumerations and Flags ... (define-enum BindMethod (in-module "DesktopAgnosticConfig") (c-name "DesktopAgnosticConfigBindMethod") (gtype-id "DESKTOP_AGNOSTIC_CONFIG_TYPE_BIND_METHOD") (values '("global" "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_GLOBAL") '("instance" "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_INSTANCE") '("fallback" "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK") '("both" "DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_BOTH") ) ) ;; Untyped enumerations and flags ... (define-enum SchemaError (in-module "DesktopAgnosticConfig") (c-name "DesktopAgnosticConfigSchemaError") (values '("parse" "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_PARSE") '("invalid-metadata-option" "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_OPTION") '("invalid-metadata-type" "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_METADATA_TYPE") '("invalid-type" "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_TYPE") '("invalid-list-type" "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_INVALID_LIST_TYPE") '("type-name-exists" "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_NAME_EXISTS") '("type-gtype-exists" "DESKTOP_AGNOSTIC_CONFIG_SCHEMA_ERROR_TYPE_GTYPE_EXISTS") ) ) (define-enum Error (in-module "DesktopAgnosticConfig") (c-name "DesktopAgnosticConfigError") (values '("no-schema" "DESKTOP_AGNOSTIC_CONFIG_ERROR_NO_SCHEMA") '("invalid-type" "DESKTOP_AGNOSTIC_CONFIG_ERROR_INVALID_TYPE") '("key-not-found" "DESKTOP_AGNOSTIC_CONFIG_ERROR_KEY_NOT_FOUND") ) ) ;; From config.h (define-function client_new (c-name "desktop_agnostic_config_client_new") (is-constructor-of "DesktopAgnosticConfigClient") (return-type "DesktopAgnosticConfigClient*") (properties '("schema_filename" (argname "schema_filename")) ) ) (define-function client_new_for_instance (c-name "desktop_agnostic_config_client_new_for_instance") (is-constructor-of "DesktopAgnosticConfigClient") (return-type "DesktopAgnosticConfigClient*") (parameters '("const-char*" "schema_filename") '("const-char*" "instance_id") '("GError**" "error") ) ) (define-method get_bool (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_get_bool") (return-type "gboolean") (parameters '("const-char*" "group") '("const-char*" "key") '("GError**" "error") ) ) (define-method set_bool (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_set_bool") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("gboolean" "value") '("GError**" "error") ) ) (define-method get_int (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_get_int") (return-type "gint") (parameters '("const-char*" "group") '("const-char*" "key") '("GError**" "error") ) ) (define-method set_int (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_set_int") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("gint" "value") '("GError**" "error") ) ) (define-method get_float (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_get_float") (return-type "float") (parameters '("const-char*" "group") '("const-char*" "key") '("GError**" "error") ) ) (define-method set_float (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_set_float") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("float" "value") '("GError**" "error") ) ) (define-method get_string (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_get_string") (return-type "char*") (parameters '("const-char*" "group") '("const-char*" "key") '("GError**" "error") ) ) (define-method set_string (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_set_string") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("const-char*" "value") '("GError**" "error") ) ) (define-method get_list (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_get_list") (return-type "GValueArray*") (parameters '("const-char*" "group") '("const-char*" "key") '("GError**" "error") ) ) (define-method set_list (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_set_list") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("GValueArray*" "value") '("GError**" "error") ) ) (define-method get_value (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_get_value") (return-type "GValue") (parameters '("const-char*" "group") '("const-char*" "key") '("GError**" "error") ) ) (define-method set_value (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_set_value") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("const-GValue*" "value") '("GError**" "error") ) ) (define-method notify_add (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_notify_add") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("DesktopAgnosticConfigNotifyFunc" "callback") '("void*" "callback_target") ) ) (define-method notify (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_notify") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("GError**" "error") ) ) (define-method notify_remove (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_notify_remove") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("DesktopAgnosticConfigNotifyFunc" "callback") '("void*" "callback_target") '("GError**" "error") ) ) (define-method remove_instance (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_remove_instance") (return-type "none") ) (define-method reset (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_reset") (return-type "none") (parameters '("gboolean" "instance_only") '("GError**" "error") ) ) (define-method bind (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_bind") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("GObject*" "obj") '("const-char*" "property_name") '("gboolean" "read_only") '("DesktopAgnosticConfigBindMethod" "method") '("GError**" "error") ) ) (define-method unbind (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_unbind") (return-type "none") (parameters '("const-char*" "group") '("const-char*" "key") '("GObject*" "obj") '("const-char*" "property_name") '("gboolean" "read_only") '("DesktopAgnosticConfigBindMethod" "method") '("GError**" "error") ) ) (define-method unbind_all_for_object (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_unbind_all_for_object") (return-type "none") (parameters '("GObject*" "obj") '("GError**" "error") ) ) (define-method get_instance_id (of-object "DesktopAgnosticConfigClient") (c-name "desktop_agnostic_config_client_get_instance_id") (return-type "const-char*") ) libdesktop-agnostic-0.3.92/python/fdomodule.c0000664000175000017510000000322211536677677020532 0ustar seagleseagle/* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include /* the following symbols are declared in fdo.c: */ void pydesktopagnostic_fdo_add_constants (PyObject *module, const gchar *strip_prefix); void pydesktopagnostic_fdo_register_classes (PyObject *d); void pyglib_pid_register_type (PyObject *d); extern PyMethodDef pydesktopagnostic_fdo_functions[]; DL_EXPORT (void) initfdo (void) { PyObject *m, *d; init_pygobject (); m = Py_InitModule ("desktopagnostic.fdo", pydesktopagnostic_fdo_functions); d = PyModule_GetDict (m); pydesktopagnostic_fdo_register_classes (d); pyglib_pid_register_type (d); pydesktopagnostic_fdo_add_constants (m, "DESKTOP_AGNOSTIC_FDO_"); if (PyErr_Occurred ()) { Py_FatalError ("Unable to initialise the desktopagnostic module"); } } libdesktop-agnostic-0.3.92/python/config.override0000664000175000017510000002572211536677677021427 0ustar seagleseagle%% headers /* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include #include %% modulename desktopagnostic.config %% import gobject.GObject as PyGObject_Type %% ignore-glob *_get_type %% override desktop_agnostic_config_client_get_value kwargs static PyObject * _wrap_desktop_agnostic_config_client_get_value (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "group", "key", NULL }; char *group, *key; PyObject *ret; GError *error = NULL; GValue value = { 0, }; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "ss:desktopagnostic.config.Client.get_value", kwlist, &group, &key)) { return NULL; } desktop_agnostic_config_client_get_value (DESKTOP_AGNOSTIC_CONFIG_CLIENT (self->obj), group, key, &value, &error); if (pyg_error_check (&error)) { return NULL; } ret = pyg_value_as_pyobject (&value, TRUE); g_value_unset (&value); return ret; } %% override desktop_agnostic_config_client_set_value kwargs static PyObject * _wrap_desktop_agnostic_config_client_set_value (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "group", "key", "value", NULL }; char *group, *key; PyObject *obj; GType type; GValue value = { 0, }; GError *error = NULL; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "ssO:desktopagnostic.config.Client.set_value", kwlist, &group, &key, &obj)) { return NULL; } if (PySequence_Check (obj) && !PyString_Check (obj) && !PyUnicode_Check (obj)) { type = G_TYPE_VALUE_ARRAY; } else { type = pyg_type_from_object ((PyObject *)obj->ob_type); } if (type == G_TYPE_INVALID) { return NULL; } g_value_init (&value, type); if (pyg_value_from_pyobject (&value, obj) != 0) { return NULL; } desktop_agnostic_config_client_set_value (DESKTOP_AGNOSTIC_CONFIG_CLIENT (self->obj), group, key, &value, &error); if (pyg_error_check (&error)) { return NULL; } Py_INCREF (Py_None); return Py_None; } %% override desktop_agnostic_config_client_get_list kwargs static PyObject * _wrap_desktop_agnostic_config_client_get_list (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "group", "key", NULL }; char *group, *key; PyObject *ret; guint i; GError *error = NULL; GValueArray *array; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "ss:desktopagnostic.config.Client.get_list", kwlist, &group, &key)) { return NULL; } array = desktop_agnostic_config_client_get_list (DESKTOP_AGNOSTIC_CONFIG_CLIENT (self->obj), group, key, &error); if (pyg_error_check (&error)) { return NULL; } ret = PyList_New (array->n_values); for (i = 0; i < array->n_values; i++) { PyList_SET_ITEM (ret, i, pyg_value_as_pyobject (array->values + i, TRUE)); } g_value_array_free (array); return ret; } %% override desktop_agnostic_config_client_set_list kwargs static PyObject * _wrap_desktop_agnostic_config_client_set_list (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "group", "key", "list", NULL }; char *group, *key; PyObject *obj; GValue value = { 0, }; GValueArray *array; GError *error = NULL; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "ssO!:desktopagnostic.config.Client.set_list", kwlist, &group, &key, &PyList_Type, &obj)) { return NULL; } g_value_init (&value, G_TYPE_VALUE_ARRAY); if (pyg_value_from_pyobject (&value, obj) != 0) { return NULL; } array = g_value_get_boxed (&value); desktop_agnostic_config_client_set_list (DESKTOP_AGNOSTIC_CONFIG_CLIENT (self->obj), group, key, array, &error); g_value_unset (&value); if (pyg_error_check (&error)) { return NULL; } Py_INCREF (Py_None); return Py_None; } %% override desktop_agnostic_config_client_notify_add kwargs typedef struct _NotifyData { gchar *group; gchar *key; gpointer data_tuple; } NotifyData; static GList *g_lda_notifications = NULL; NotifyData * pydesktopagnostic_notifications_find (const gchar *group, const gchar *key, PyObject *callback, PyObject *extra) { GList *it; for (it = g_lda_notifications; it; it = it->next) { NotifyData *data; PyObject *tuple; data = it->data; tuple = data->data_tuple; if (strcmp (group, data->group) || strcmp (key, data->key)) { continue; } if (extra) { PyObject *t_cb, *t_extra; int comp_result; if (PyTuple_Size (tuple) <= 1) { continue; } t_cb = PyTuple_GetItem (tuple, 0); t_extra = PyTuple_GetItem (tuple, 1); if (PyObject_Cmp (t_cb, callback, &comp_result) == -1) { continue; } if (comp_result != 0) { continue; } // if we're here the callback is ok if (PyObject_Cmp (t_extra, extra, &comp_result) == -1) { continue; } if (comp_result == 0) { return data; } } else // no extra param { PyObject *t_cb; int comp_result; if (PyTuple_Size (tuple) != 1) { continue; } t_cb = PyTuple_GetItem (tuple, 0); if (PyObject_Cmp (t_cb, callback, &comp_result) == -1) { continue; } if (comp_result == 0) { return data; } } } return NULL; } void pydesktopagnostic_config_client_notify_add (const gchar *group, const gchar *key, const GValue *value, gpointer user_data) { PyObject *tuple; PyObject *func; PyObject *userdata = NULL; PyObject *py_value; PyObject *ret; PyGILState_STATE state; tuple = (PyObject*) user_data; state = pyg_gil_state_ensure (); g_assert (PyTuple_Check (tuple)); func = PyTuple_GetItem (tuple, 0); if (PyTuple_Size (tuple) > 1) { userdata = PyTuple_GetItem (tuple, 1); } py_value = pyg_value_as_pyobject (value, TRUE); if (userdata) { ret = PyObject_CallFunction (func, "ssOO", group, key, py_value, userdata); } else { ret = PyObject_CallFunction (func, "ssO", group, key, py_value); } Py_DECREF (py_value); if (ret == NULL) { PyErr_Print (); } else { Py_DECREF (ret); } pyg_gil_state_release (state); } static PyObject * _wrap_desktop_agnostic_config_client_notify_add (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "group", "key", "func", "user_data", NULL }; gchar *group; gchar *key; PyObject *callback; PyObject *extra = NULL; PyObject *data; GError *error = NULL; NotifyData *ndata; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "ssO|O:desktopagnostic.config.Client.notify_add", kwlist, &group, &key, &callback, &extra)) { return NULL; } if (!PyCallable_Check (callback)) { PyErr_SetString (PyExc_TypeError, "Third argument not callable"); return NULL; } if (extra) { data = Py_BuildValue ("(OO)", callback, extra); } else { data = Py_BuildValue ("(O)", callback); } desktop_agnostic_config_client_notify_add (DESKTOP_AGNOSTIC_CONFIG_CLIENT (self->obj), group, key, pydesktopagnostic_config_client_notify_add, data, &error); if (pyg_error_check (&error)) { return NULL; } // to properly support notify_remove we need a global list of all // added notifications ndata = g_slice_new0 (NotifyData); ndata->group = g_strdup (group); ndata->key = g_strdup (key); ndata->data_tuple = data; g_lda_notifications = g_list_append (g_lda_notifications, ndata); Py_INCREF (Py_None); return Py_None; } %% override desktop_agnostic_config_client_notify_remove kwargs static PyObject * _wrap_desktop_agnostic_config_client_notify_remove (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "group", "key", "func", "user_data", NULL }; gchar *group; gchar *key; PyObject *callback; PyObject *extra = NULL; GError *error = NULL; NotifyData *ndata = NULL; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "ssO|O:desktopagnostic.config.Client.notify_remove", kwlist, &group, &key, &callback, &extra)) { return NULL; } ndata = pydesktopagnostic_notifications_find (group, key, callback, extra); if (ndata == NULL) { PyErr_SetString (PyExc_TypeError, "Unable to remove this callback and data pair!"); return NULL; } desktop_agnostic_config_client_notify_remove (DESKTOP_AGNOSTIC_CONFIG_CLIENT (self->obj), group, key, pydesktopagnostic_config_client_notify_add, ndata->data_tuple, &error); if (pyg_error_check (&error)) { return NULL; } g_free (ndata->group); g_free (ndata->key); Py_DECREF ((PyObject *)ndata->data_tuple); g_lda_notifications = g_list_remove (g_lda_notifications, ndata); g_slice_free (NotifyData, ndata); Py_INCREF (Py_None); return Py_None; } libdesktop-agnostic-0.3.92/python/desktopagnostic.override0000664000175000017510000001172411536677677023360 0ustar seagleseagle%% headers /* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include #include %% modulename desktopagnostic %% import gobject.GObject as PyGObject_Type %% ignore-glob *_get_type desktop_agnostic_color_cairo_value_to_gdk desktop_agnostic_color_gdk_value_to_cairo desktop_agnostic_color_new_from_values desktop_agnostic_color_new_from_string desktop_agnostic_module_loader_get_default %% define DesktopAgnosticColor.gdk_value_to_cairo onearg staticmethod static PyObject * _wrap_desktop_agnostic_color_gdk_value_to_cairo (PyObject *self, PyObject *arg) { int value; double ret; if (!PyInt_Check (arg)) { PyErr_SetString (PyExc_TypeError, "The parameter must be a unsigned short value."); return NULL; } value = (int)PyInt_AsLong (arg); if (value < 0 || value > G_MAXUSHORT) { PyErr_SetString (PyExc_TypeError, "The parameter must be a unsigned short value."); return NULL; } ret = desktop_agnostic_color_gdk_value_to_cairo (value); return PyFloat_FromDouble (ret); } %% define DesktopAgnosticColor.cairo_value_to_gdk onearg staticmethod static PyObject * _wrap_desktop_agnostic_color_cairo_value_to_gdk (PyObject *self, PyObject *arg) { int ret; double value; if (!PyFloat_Check (arg)) { PyErr_SetString (PyExc_TypeError, "The parameter must be a float value between 0.0 and 1.0."); return NULL; } value = PyFloat_AsDouble (arg); if (value < 0.0 || value > 1.0) { PyErr_SetString (PyExc_TypeError, "The parameter must be a float value between 0.0 and 1.0."); return NULL; } ret = desktop_agnostic_color_cairo_value_to_gdk ((float)value); return PyInt_FromLong (ret); } %% define DesktopAgnosticColor.from_values kwargs staticmethod static PyObject * _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; 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 static PyObject * _wrap_desktop_agnostic_color_from_string (PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "spec", NULL }; char *spec; GError *error = NULL; DesktopAgnosticColor *ret; PyObject *py_ret; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string", kwlist, &spec)) { return NULL; } ret = desktop_agnostic_color_new_from_string (spec, &error); if (pyg_error_check (&error)) { return NULL; } /* pygobject_new handles NULL checking */ py_ret = pygobject_new ((GObject *)ret); if (ret != NULL) g_object_unref (ret); return py_ret; } %% override-slot DesktopAgnosticColor.tp_str #define _wrap_desktop_agnostic_color_tp_str _wrap_desktop_agnostic_color_to_string %% define DesktopAgnosticModuleLoader.get_default noargs staticmethod static PyObject * _wrap_desktop_agnostic_module_loader_get_default (PyObject *self) { DesktopAgnosticModuleLoader *ret; ret = desktop_agnostic_module_loader_get_default (); /* pygobject_new handles NULL checking */ return pygobject_new ((GObject *)ret); } %% override desktop_agnostic_color_get_cairo_color noargs static PyObject * _wrap_desktop_agnostic_color_get_cairo_color (PyGObject *self) { gdouble red, green, blue, alpha; desktop_agnostic_color_get_cairo_color (DESKTOP_AGNOSTIC_COLOR (self->obj), &red, &green, &blue, &alpha); return Py_BuildValue("(ffff)", red, green, blue, alpha); } libdesktop-agnostic-0.3.92/python/vfsmodule.c0000664000175000017510000000310511536677677020560 0ustar seagleseagle/* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include /* the following symbols are declared in vfs.c: */ void pydesktopagnostic_vfs_add_constants (PyObject *module, const gchar *strip_prefix); void pydesktopagnostic_vfs_register_classes (PyObject *d); extern PyMethodDef pydesktopagnostic_vfs_functions[]; DL_EXPORT (void) initvfs (void) { PyObject *m, *d; init_pygobject (); m = Py_InitModule ("desktopagnostic.vfs", pydesktopagnostic_vfs_functions); d = PyModule_GetDict (m); pydesktopagnostic_vfs_register_classes (d); pydesktopagnostic_vfs_add_constants (m, "DESKTOP_AGNOSTIC_VFS_"); if (PyErr_Occurred ()) { Py_FatalError ("Unable to initialise the desktopagnostic module"); } } libdesktop-agnostic-0.3.92/python/fdo.override0000664000175000017510000002546411536677677020735 0ustar seagleseagle%% headers /* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #ifdef HAVE_PYGLIB #include #endif #include #include /* Taken from PyGObject 2.19.0 (LGPL 2.1+). */ #ifndef PYLIST_ASGLIBLIST /** * PYLIST_ASGLIBLIST * @type: the type of the GLib list e.g. GList or GSList * @prefix: the prefix of functions that manipulate a list of the type * given by type e.g. g_list or g_slist * * A macro that creates a type specific code block to be used to convert a * Python list to a GLib list (GList or GSList). The first two args of the * macro are used to specify the type and list function prefix so that the * type specific macros can be generated. * * The rest of the args are for the standard args for the type specific * macro(s) created from this macro. */ #define PYLIST_ASGLIBLIST(type,prefix,py_list,list,check_func,\ convert_func,child_free_func,errormsg,errorreturn) \ G_STMT_START \ { \ Py_ssize_t i, n_list; \ GFunc glib_child_free_func = (GFunc)child_free_func; \ \ if (!(py_list = PySequence_Fast(py_list, ""))) { \ errormsg; \ return errorreturn; \ } \ n_list = PySequence_Fast_GET_SIZE(py_list); \ for (i = 0; i < n_list; i++) { \ PyObject *py_item = PySequence_Fast_GET_ITEM(py_list, i); \ \ if (!check_func) { \ if (glib_child_free_func) \ prefix##_foreach(list, glib_child_free_func, NULL); \ prefix##_free(list); \ Py_DECREF(py_list); \ errormsg; \ return errorreturn; \ } \ list = prefix##_prepend(list, convert_func); \ }; \ Py_DECREF(py_list); \ list = prefix##_reverse(list); \ } \ G_STMT_END /** * PYLIST_ASGSLIST * @py_list: the Python list to be converted * @list: the #GSList list to be converted * @check_func: the expression that takes a #PyObject* arg (must be named * @py_item) and returns an int value indicating if the Python object matches * the required list item type (0 - %False or 1 - %True). An example is: * [[ * (PyString_Check(py_item)||PyUnicode_Check(py_item)) * ]] * @convert_func: the function that takes a #PyObject* arg (must be named * py_item) and returns a pointer to the converted list object. An example * is: * [[ * pygobject_get(py_item) * ]] * @child_free_func: the name of a #GFunc function that frees a GLib list * item or %NULL if the list item does not have to be freed. This function is * used to help free the items in a partially created list if there is an * error. An example is: * [[ * g_free * ]] * @errormsg: a function that sets up a Python error message. An example is: * [[ * PyErr_SetString(PyExc_TypeError, "strings must be a sequence of" "strings * or unicode objects") * ]] * @errorreturn: the value to return if an error occurs, e.g.: * [[ * %NULL * ]] * * A macro that creates code that converts a Python list to a #GSList. The * returned list must be freed using the appropriate list free function when * it's no longer needed. If an error occurs the child_free_func is used to * release the memory used by the list items and then the list memory is * freed. */ #define PYLIST_ASGSLIST(py_list,list,check_func,convert_func,child_free_func,\ errormsg,errorreturn) \ PYLIST_ASGLIBLIST(GSList,g_slist,py_list,list,check_func,convert_func,\ child_free_func,errormsg,errorreturn) #endif #ifndef PYGLIB_DEFINE_TYPE #define PYGLIB_DEFINE_TYPE(typename, symbol, csymbol) \ PyTypeObject symbol = { \ PyObject_HEAD_INIT(NULL) \ 0, \ typename, \ sizeof(csymbol), \ 0, \ }; #endif #ifndef PYGLIB_REGISTER_TYPE #define PYGLIB_REGISTER_TYPE(d, type, name) \ if (!type.tp_alloc) \ type.tp_alloc = PyType_GenericAlloc; \ if (!type.tp_new) \ type.tp_new = PyType_GenericNew; \ if (PyType_Ready(&type)) \ return; \ PyDict_SetItemString(d, name, (PyObject *)&type); #endif PYGLIB_DEFINE_TYPE("desktopagnostic.fdo.Pid", PyGPid_Type, PyIntObject) /* Modified from the function in PyGObject 2.19.0 * (LGPL 2.1+). */ static PyObject * pyg_pid_new (GPid pid) { PyIntObject *pygpid; pygpid = PyObject_NEW(PyIntObject, &PyGPid_Type); #if PY_VERSION_HEX >= 0x03000000 # warning "FIXME: figure out how to subclass long" #else ((PyIntObject*)pygpid)->ob_ival = pid; #endif return (PyObject *) pygpid; } static void pyg_pid_free(PyObject *gpid) { g_spawn_close_pid((GPid) PyInt_AsLong(gpid)); PyInt_Type.tp_free((void *) gpid); } static int pyg_pid_tp_init(PyObject *self, PyObject *args, PyObject *kwargs) { PyErr_SetString(PyExc_TypeError, "glib.Pid cannot be manually instantiated"); return -1; } void pyglib_pid_register_type(PyObject *d) { PyGPid_Type.tp_base = &PyInt_Type; PyGPid_Type.tp_flags = Py_TPFLAGS_DEFAULT; PyGPid_Type.tp_init = pyg_pid_tp_init; PyGPid_Type.tp_free = (freefunc)pyg_pid_free; PYGLIB_REGISTER_TYPE(d, PyGPid_Type, "Pid"); } %% modulename desktopagnostic.fdo %% import gobject.GObject as PyGObject_Type import desktopagnostic.vfs.File as PyDesktopAgnosticVFSFile_Type %% ignore-glob *_get_type *_keyfile *_error_quark desktop_agnostic_fdo_desktop_entry_new_for_* desktop_agnostic_fdo_desktop_entry_type_to_string %% define DesktopAgnosticFDODesktopEntry.new noargs staticmethod static PyObject * _wrap_desktop_agnostic_f_d_o_desktop_entry_new (PyObject *self) { DesktopAgnosticFDODesktopEntry *ret; GError *error = NULL; PyObject *py_ret; ret = desktop_agnostic_fdo_desktop_entry_new (&error); if (pyg_error_check (&error)) { return NULL; } /* pygobject_new handles NULL checking */ py_ret = pygobject_new ((GObject *)ret); if (ret != NULL) g_object_unref (ret); return py_ret; } %% define DesktopAgnosticFDODesktopEntry.for_data kwargs staticmethod static PyObject * _wrap_desktop_agnostic_f_d_o_desktop_entry_for_data (PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "data", NULL }; char *data; DesktopAgnosticFDODesktopEntry *ret; PyObject *py_ret; GError *error = NULL; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:FDODesktopEntry.new_for_data", kwlist, &data)) { return NULL; } ret = desktop_agnostic_fdo_desktop_entry_new_for_data (data, &error); if (pyg_error_check (&error)) { return NULL; } /* pygobject_new handles NULL checking */ py_ret = pygobject_new ((GObject *)ret); if (ret != NULL) g_object_unref (ret); return py_ret; } %% define DesktopAgnosticFDODesktopEntry.for_file onearg staticmethod static PyObject * _wrap_desktop_agnostic_f_d_o_desktop_entry_for_file (PyObject *self, 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), &error); if (pyg_error_check (&error)) { return NULL; } /* pygobject_new handles NULL checking */ py_ret = pygobject_new ((GObject *)ret); if (ret != NULL) g_object_unref (ret); return py_ret; } %% define DesktopAgnosticFDODesktopEntry.type_to_string onearg staticmethod static PyObject * _wrap_desktop_agnostic_f_d_o_desktop_entry_type_to_string (PyObject *self, PyObject *arg) { DesktopAgnosticFDODesktopEntryType entry_type; gchar *ret; if (pyg_enum_get_value (DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_TYPE, arg, (gpointer)&entry_type)) { return NULL; } ret = desktop_agnostic_fdo_desktop_entry_type_to_string (entry_type); if (ret) { PyObject *py_ret = PyString_FromString (ret); g_free (ret); return py_ret; } else { Py_INCREF (Py_None); return Py_None; } } %% override desktop_agnostic_fdo_desktop_entry_launch kwargs static PyObject * _wrap_desktop_agnostic_fdo_desktop_entry_launch (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "flags", "documents", NULL }; PyObject *py_flags = NULL; DesktopAgnosticFDODesktopEntryLaunchFlags flags; PyObject *py_documents = NULL; GSList *documents = NULL; GError *error = NULL; GPid pid; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "OO:FDODesktopEntry.launch", kwlist, &py_flags, &py_documents)) { return NULL; } if (pyg_enum_get_value (DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_LAUNCH_FLAGS, py_flags, (gpointer)&flags)) { return NULL; } if (py_documents != Py_None) { PYLIST_ASGSLIST(py_documents, documents, (PyString_Check (py_item) || PyUnicode_Check (py_item)), PyString_AsString (py_item), g_free, PyErr_SetString(PyExc_TypeError, "documents must be a sequence of " "strings or unicode objects"), NULL); } pid = desktop_agnostic_fdo_desktop_entry_launch (DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY (self->obj), flags, documents, &error); if (pyg_error_check (&error)) { return NULL; } return pyg_pid_new (pid); } libdesktop-agnostic-0.3.92/python/__init__.py.in0000664000175000017510000000165011536677677021131 0ustar seagleseagle# 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 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # requires python >= 2.5 from __future__ import absolute_import from desktopagnostic.desktopagnostic import * __version__ = '@VERSION@' libdesktop-agnostic-0.3.92/python/fdo.defs0000664000175000017510000001726411536677677020036 0ustar seagleseagle;; -*- scheme -*- ; boxed definitions ... ; interface definitions ... (define-interface DesktopEntry (in-module "DesktopAgnosticFDO") (c-name "DesktopAgnosticFDODesktopEntry") (gtype-id "DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY") (prerequisite "GObject") ) ; object definitions ... ; pointer definitions ... ;; Enumerations and Flags ... (define-enum DesktopEntryLaunchFlags (in-module "DesktopAgnosticFDO") (c-name "DesktopAgnosticFDODesktopEntryLaunchFlags") (gtype-id "DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_LAUNCH_FLAGS") (values '("only-one" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_ONLY_ONE") '("use-cwd" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_USE_CWD") '("do-not-reap-child" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_LAUNCH_FLAGS_DO_NOT_REAP_CHILD") ) ) (define-enum DesktopEntryType (in-module "DesktopAgnosticFDO") (c-name "DesktopAgnosticFDODesktopEntryType") (gtype-id "DESKTOP_AGNOSTIC_FDO_TYPE_DESKTOP_ENTRY_TYPE") (values '("unknown" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_UNKNOWN") '("application" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_APPLICATION") '("link" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_LINK") '("directory" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_TYPE_DIRECTORY") ) ) ;; Untyped enumerations and flags ... (define-enum DesktopEntryError (in-module "DesktopAgnosticFDO") (c-name "DesktopAgnosticFDODesktopEntryError") (values '("invalid-file" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_INVALID_FILE") '("not-launchable" "DESKTOP_AGNOSTIC_FDO_DESKTOP_ENTRY_ERROR_NOT_LAUNCHABLE") ) ) ;; From fdo.h (define-function desktop_entry_launch_flags_get_type (c-name "desktop_agnostic_fdo_desktop_entry_launch_flags_get_type") (return-type "GType") ) (define-function desktop_entry_type_get_type (c-name "desktop_agnostic_fdo_desktop_entry_type_get_type") (return-type "GType") ) (define-function desktop_entry_error_quark (c-name "desktop_agnostic_fdo_desktop_entry_error_quark") (return-type "GQuark") ) (define-function desktop_entry_type_to_string (c-name "desktop_agnostic_fdo_desktop_entry_type_to_string") (return-type "char*") (parameters '("DesktopAgnosticFDODesktopEntryType" "entry_type") ) ) (define-function desktop_entry_get_type (c-name "desktop_agnostic_fdo_desktop_entry_get_type") (return-type "GType") ) (define-method key_exists (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_key_exists") (return-type "gboolean") (parameters '("const-char*" "key") ) ) (define-method get_boolean (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_boolean") (return-type "gboolean") (parameters '("const-char*" "key") ) ) (define-method set_boolean (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_boolean") (return-type "none") (parameters '("const-char*" "key") '("gboolean" "value") ) ) (define-method get_string (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_string") (return-type "char*") (parameters '("const-char*" "key") ) ) (define-method set_string (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_string") (return-type "none") (parameters '("const-char*" "key") '("const-char*" "value") ) ) (define-method get_localestring (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_localestring") (return-type "char*") (parameters '("const-char*" "key") '("const-char*" "locale" (default "NULL") (null-ok)) ) ) (define-method set_localestring (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_localestring") (return-type "none") (parameters '("const-char*" "key") '("const-char*" "locale") '("const-char*" "value") ) ) (define-method exists (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_exists") (return-type "gboolean") ) (define-method launch (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_launch") (return-type "GPid") (parameters '("DesktopAgnosticFDODesktopEntryLaunchFlags" "flags") '("GSList*" "documents") '("GError**" "error") ) ) (define-method save (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_save") (return-type "none") (parameters '("DesktopAgnosticVFSFile*" "new_file") '("GError**" "error") ) ) (define-method get_file (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_file") (return-type "DesktopAgnosticVFSFile*") ) (define-method set_file (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_file") (return-type "none") (parameters '("DesktopAgnosticVFSFile*" "value") ) ) (define-method get_keyfile (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_keyfile") (return-type "GKeyFile*") ) (define-method set_keyfile (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_keyfile") (return-type "none") (parameters '("GKeyFile*" "value") ) ) (define-method set_data (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_data") (return-type "none") (parameters '("const-char*" "value") ) ) (define-method get_entry_type (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_entry_type") (return-type "DesktopAgnosticFDODesktopEntryType") ) (define-method set_entry_type (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_entry_type") (return-type "none") (parameters '("DesktopAgnosticFDODesktopEntryType" "value") ) ) (define-method get_name (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_name") (return-type "char*") ) (define-method set_name (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_name") (return-type "none") (parameters '("const-char*" "value") ) ) (define-method get_icon (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_get_icon") (return-type "char*") ) (define-method set_icon (of-object "DesktopAgnosticFDODesktopEntry") (c-name "desktop_agnostic_fdo_desktop_entry_set_icon") (return-type "none") (parameters '("const-char*" "value") ) ) (define-function get_type (c-name "desktop_agnostic_fdo_get_type") (return-type "GType") (parameters '("GError**" "error") ) ) (define-function desktop_entry_new (c-name "desktop_agnostic_fdo_desktop_entry_new") (is-constructor-of "DesktopAgnosticFDODesktopEntry") (return-type "DesktopAgnosticFDODesktopEntry*") (parameters '("GError**" "error") ) ) (define-function desktop_entry_new_for_file (c-name "desktop_agnostic_fdo_desktop_entry_new_for_file") (return-type "DesktopAgnosticFDODesktopEntry*") (parameters '("DesktopAgnosticVFSFile*" "file") '("GError**" "error") ) ) (define-function desktop_entry_new_for_keyfile (c-name "desktop_agnostic_fdo_desktop_entry_new_for_keyfile") (return-type "DesktopAgnosticFDODesktopEntry*") (parameters '("GKeyFile*" "keyfile") '("GError**" "error") ) ) (define-function desktop_entry_new_for_data (c-name "desktop_agnostic_fdo_desktop_entry_new_for_data") (return-type "DesktopAgnosticFDODesktopEntry*") (parameters '("const-char*" "data") '("GError**" "error") ) ) libdesktop-agnostic-0.3.92/python/uimodule.c0000664000175000017510000000257311536677677020407 0ustar seagleseagle/* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include /* the following symbols are declared in ui.c: */ void pydesktopagnostic_ui_register_classes (PyObject *d); extern PyMethodDef pydesktopagnostic_ui_functions[]; DL_EXPORT (void) initui (void) { PyObject *m, *d; init_pygobject (); m = Py_InitModule ("desktopagnostic.ui", pydesktopagnostic_ui_functions); d = PyModule_GetDict (m); pydesktopagnostic_ui_register_classes (d); if (PyErr_Occurred ()) { Py_FatalError ("Unable to initialise the desktopagnostic.ui module"); } } libdesktop-agnostic-0.3.92/python/desktopagnostic.defs0000664000175000017510000001322211536677677022455 0ustar seagleseagle;; -*- scheme -*- ; boxed definitions ... ; interface definitions ... ; object definitions ... (define-object Color (in-module "DesktopAgnostic") (parent "GObject") (c-name "DesktopAgnosticColor") (gtype-id "DESKTOP_AGNOSTIC_TYPE_COLOR") ) (define-object ModuleLoader (in-module "DesktopAgnostic") (parent "GObject") (c-name "DesktopAgnosticModuleLoader") (gtype-id "DESKTOP_AGNOSTIC_TYPE_MODULE_LOADER") ) ; pointer definitions ... ;; Enumerations and Flags ... ;; Untyped enumerations and flags ... (define-enum ModuleError (in-module "DesktopAgnostic") (c-name "DesktopAgnosticModuleError") (values '("gmodule" "DESKTOP_AGNOSTIC_MODULE_ERROR_NO_GMODULE") ) ) (define-enum ColorParseError (in-module "DesktopAgnostic") (c-name "DesktopAgnosticColorParseError") (values '("input" "DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_INPUT") '("alpha" "DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_ALPHA") ) ) ;; From desktop-agnostic.h (define-function color_get_type (c-name "desktop_agnostic_color_get_type") (return-type "GType") ) (define-function color_new (c-name "desktop_agnostic_color_new") (is-constructor-of "DesktopAgnosticColor") (return-type "DesktopAgnosticColor*") (properties '("color" (argname "color")) '("alpha" (argname "alpha")) ) ) (define-function color_new_from_values (c-name "desktop_agnostic_color_new_from_values") (return-type "DesktopAgnosticColor*") (parameters '("gushort" "red") '("gushort" "green") '("gushort" "blue") '("gushort" "alpha") ) ) (define-function color_new_from_string (c-name "desktop_agnostic_color_new_from_string") (return-type "DesktopAgnosticColor*") (parameters '("const-char*" "spec") '("GError**" "error") ) ) (define-method to_html_color (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_to_html_color") (return-type "char*") ) (define-method to_string (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_to_string") (return-type "char*") ) (define-method get_cairo_color (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_get_cairo_color") (return-type "none") (parameters '("double*" "red") '("double*" "green") '("double*" "blue") '("double*" "alpha") ) ) (define-method set_cairo_color (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_set_cairo_color") (return-type "none") (parameters '("double" "red") '("double" "green") '("double" "blue") '("double" "alpha") ) ) (define-function color_cairo_value_to_gdk (c-name "desktop_agnostic_color_cairo_value_to_gdk") (return-type "gushort") (parameters '("double" "value") ) ) (define-function color_gdk_value_to_cairo (c-name "desktop_agnostic_color_gdk_value_to_cairo") (return-type "double") (parameters '("gushort" "value") ) ) (define-method get_color (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_get_color") (return-type "none") (parameters '("GdkColor*" "value") ) ) (define-method set_color (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_set_color") (return-type "none") (parameters '("GdkColor*" "value") ) ) (define-method get_red (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_get_red") (return-type "gint") ) (define-method set_red (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_set_red") (return-type "none") (parameters '("gint" "value") ) ) (define-method get_green (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_get_green") (return-type "gint") ) (define-method set_green (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_set_green") (return-type "none") (parameters '("gint" "value") ) ) (define-method get_blue (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_get_blue") (return-type "gint") ) (define-method set_blue (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_set_blue") (return-type "none") (parameters '("gint" "value") ) ) (define-method get_alpha (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_get_alpha") (return-type "gint") ) (define-method set_alpha (of-object "DesktopAgnosticColor") (c-name "desktop_agnostic_color_set_alpha") (return-type "none") (parameters '("gint" "value") ) ) (define-function module_loader_get_type (c-name "desktop_agnostic_module_loader_get_type") (return-type "GType") ) (define-function module_loader_get_default (c-name "desktop_agnostic_module_loader_get_default") (return-type "DesktopAgnosticModuleLoader*") ) (define-method load_from_path (of-object "DesktopAgnosticModuleLoader") (c-name "desktop_agnostic_module_loader_load_from_path") (return-type "GType") (parameters '("const-char*" "name") '("const-char*" "path") ) ) (define-method load (of-object "DesktopAgnosticModuleLoader") (c-name "desktop_agnostic_module_loader_load") (return-type "GType") (parameters '("const-char*" "name") ) ) (define-method is_guess_module_loaded (of-object "DesktopAgnosticModuleLoader") (c-name "desktop_agnostic_module_loader_is_guess_module_loaded") (return-type "gboolean") ) (define-method guess_module (of-object "DesktopAgnosticModuleLoader") (c-name "desktop_agnostic_module_loader_guess_module") (return-type "GType") (parameters '("const-char*" "library_prefix") ) ) (define-function get_module_type (c-name "desktop_agnostic_get_module_type") (return-type "GType") (parameters '("const-char*" "prefix") '("const-char*" "key") '("GError**" "error") ) ) libdesktop-agnostic-0.3.92/python/desktopagnosticmodule.c0000664000175000017510000000307111536677677023165 0ustar seagleseagle/* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include /* the following symbols are declared in desktopagnostic.c: */ void pydesktopagnostic_add_constants (PyObject *module, const gchar *strip_prefix); void pydesktopagnostic_register_classes (PyObject *d); extern PyMethodDef pydesktopagnostic_functions[]; DL_EXPORT (void) initdesktopagnostic (void) { PyObject *m, *d; init_pygobject (); m = Py_InitModule ("desktopagnostic", pydesktopagnostic_functions); d = PyModule_GetDict (m); pydesktopagnostic_register_classes (d); pydesktopagnostic_add_constants (m, "DESKTOP_AGNOSTIC_"); if (PyErr_Occurred ()) { Py_FatalError ("Unable to initialise the desktopagnostic module"); } } libdesktop-agnostic-0.3.92/python/configmodule.c0000664000175000017510000000340611536677677021233 0ustar seagleseagle/* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include #include /* the following symbols are declared in config.c: */ void pydesktopagnostic_config_add_constants (PyObject *module, const gchar *strip_prefix); void pydesktopagnostic_config_register_classes (PyObject *d); extern PyMethodDef pydesktopagnostic_config_functions[]; DL_EXPORT (void) initconfig (void) { PyObject *m, *d; init_pygobject (); m = Py_InitModule ("desktopagnostic.config", pydesktopagnostic_config_functions); d = PyModule_GetDict (m); pydesktopagnostic_config_register_classes (d); pydesktopagnostic_config_add_constants (m, "DESKTOP_AGNOSTIC_CONFIG_"); PyModule_AddStringConstant (m, "GROUP_DEFAULT", DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT); if (PyErr_Occurred ()) { Py_FatalError ("Unable to initialise the desktopagnostic.config module"); } } libdesktop-agnostic-0.3.92/python/vfs.override0000664000175000017510000001774611536677677020767 0ustar seagleseagle%% headers /* * 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 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_BUILD_CONFIG_H #include "build-config.h" #endif #include #include /* Taken from PyGObject 2.19.0 (LGPL 2.1+). */ #ifndef PYLIST_FROMGLIBLIST /** * PYLIST_FROMGLIBLIST: * @type: the type of the GLib list e.g. #GList or #GSList * @prefix: the prefix of functions that manipulate a list of the type * given by type. * * A macro that creates a type specific code block which converts a GLib * list (#GSList or #GList) to a Python list. The first two args of the macro * are used to specify the type and list function prefix so that the type * specific macros can be generated. * * The rest of the args are for the standard args for the type specific * macro(s) created from this macro. */ #define PYLIST_FROMGLIBLIST(type,prefix,py_list,list,item_convert_func,\ list_free,list_item_free) \ G_STMT_START \ { \ gint i, len; \ PyObject *item; \ void (*glib_list_free)(type*) = list_free; \ GFunc glib_list_item_free = (GFunc)list_item_free; \ \ len = prefix##_length(list); \ py_list = PyList_New(len); \ for (i = 0; i < len; i++) { \ gpointer list_item = prefix##_nth_data(list, i); \ \ item = item_convert_func; \ PyList_SetItem(py_list, i, item); \ } \ if (glib_list_item_free != NULL) \ prefix##_foreach(list, glib_list_item_free, NULL); \ if (glib_list_free != NULL) \ glib_list_free(list); \ } G_STMT_END /** * PYLIST_FROMGSLIST: * @py_list: the name of the Python list * * @list: the #GSList to be converted to a Python list * * @item_convert_func: the function that converts a list item to a Python * object. The function must refer to the list item using "@list_item" and * must return a #PyObject* object. An example conversion function is: * [[ * PyString_FromString(list_item) * ]] * A more elaborate function is: * [[ * pyg_boxed_new(GTK_TYPE_RECENT_INFO, list_item, TRUE, TRUE) * ]] * @list_free: the name of a function that takes a single arg (the list) and * frees its memory. Can be %NULL if the list should not be freed. An example * is: * [[ * g_list_free * ]] * @list_item_free: the name of a #GFunc function that frees the memory used * by the items in the list or %NULL if the list items do not have to be * freed. A simple example is: * [[ * g_free * ]] * * A macro that adds code that converts a #GSList to a Python list. * */ #define PYLIST_FROMGSLIST(py_list,list,item_convert_func,list_free,\ list_item_free) \ PYLIST_FROMGLIBLIST(GSList,g_slist,py_list,list,item_convert_func,\ list_free,list_item_free) #endif %% modulename desktopagnostic.vfs %% import gobject.GObject as PyGObject_Type %% ignore-glob *_get_type *_error_quark desktop_agnostic_vfs_file_new_* desktop_agnostic_vfs_trash_get_default %% define DesktopAgnosticVFSFile.for_path onearg staticmethod static PyObject * _wrap_desktop_agnostic_v_f_s_file_for_path (PyObject *self, PyObject *arg) { char *path; DesktopAgnosticVFSFile *ret; PyObject *py_ret; GError *error = NULL; if (!PyString_Check (arg)) { PyErr_SetString (PyExc_TypeError, "The parameter must be a string."); return NULL; } path = PyString_AsString (arg); ret = desktop_agnostic_vfs_file_new_for_path (path, &error); if (pyg_error_check (&error)) { return NULL; } /* pygobject_new handles NULL checking */ 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; PyObject *py_ret; GError *error = NULL; if (!PyString_Check (arg)) { PyErr_SetString (PyExc_TypeError, "The parameter must be a string."); return NULL; } uri = PyString_AsString (arg); ret = desktop_agnostic_vfs_file_new_for_uri (uri, &error); if (pyg_error_check (&error)) { return NULL; } /* pygobject_new handles NULL checking */ 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), &error); if (pyg_error_check (&error)) { return NULL; } PYLIST_FROMGSLIST (py_children, children, pygobject_new ((GObject *)list_item), g_slist_free, g_object_unref); return py_children; } %% override desktop_agnostic_vfs_file_load_contents noargs static PyObject * _wrap_desktop_agnostic_vfs_file_load_contents (PyGObject *self) { gchar *data; size_t length; GError *error = NULL; desktop_agnostic_vfs_file_load_contents (DESKTOP_AGNOSTIC_VFS_FILE (self->obj), &data, &length, &error); if (pyg_error_check (&error)) { return NULL; } return PyString_FromStringAndSize (data, length); } %% override desktop_agnostic_vfs_file_get_icon_names noargs static PyObject * _wrap_desktop_agnostic_vfs_file_get_icon_names (PyGObject *self) { int i, res_length; char **result; PyObject *py_result; GError *error = NULL; result = desktop_agnostic_vfs_file_get_icon_names (DESKTOP_AGNOSTIC_VFS_FILE (self->obj), &res_length, &error); if (pyg_error_check (&error)) { return NULL; } py_result = PyList_New (res_length); for (i=0; i, 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" libdesktop-agnostic-0.3.92/po/wscript0000664000175000017510000000021311536677677017120 0ustar seagleseagle# -*- coding: utf-8 -*- # vim: set ft=python def build(bld): bld.new_task_gen(features='intltool_po', appname='libdesktop-agnostic') libdesktop-agnostic-0.3.92/po/LINGUAS0000664000175000017510000000007511536677677016535 0ustar seagleseagle# please keep this list sorted alphabetically en_US@piglatin libdesktop-agnostic-0.3.92/po/libdesktop-agnostic.pot0000664000175000017510000000444711536677677022210 0ustar seagleseagle# 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 "" libdesktop-agnostic-0.3.92/tools/wscript0000664000175000017510000000127011536677677017646 0ustar seagleseagle#!/usr/bin/python # encoding: utf-8 def build(bld): if 'gconf' in bld.env['BACKENDS_CFG']: schema = bld.new_task_gen('cc', 'program') schema.source = 'lda-schema-to-gconf.vala' schema.uselib_local = 'desktop-agnostic-cfg' schema.vapi_dirs = '../libdesktop-agnostic' schema.target = 'lda-schema-to-gconf' launcher = bld.new_task_gen('cc', 'program') launcher.source = 'lda-desktop-entry-editor.vala' launcher.packages = 'desktop-agnostic-ui' launcher.packages_private = 'build' launcher.uselib_local = 'desktop-agnostic-ui' launcher.vapi_dirs = '../libdesktop-agnostic ../vapi' launcher.target = 'lda-desktop-entry-editor' libdesktop-agnostic-0.3.92/tools/lda-schema-to-gconf.vala0000664000175000017510000001353011536677677022607 0ustar seagleseagle/* * 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 */ using DesktopAgnostic.Config; string schema_type_to_string (Type type) { if (type == typeof (bool)) { return "bool"; } else if (type == typeof (int)) { return "int"; } else if (type == typeof (float)) { return "float"; } else if (type == typeof (string)) { return "string"; } else if (type == typeof (ValueArray)) { return "list"; } else { return "string"; } } void value_array_to_string (Value src_value, out Value dest_value) { unowned ValueArray arr = (ValueArray)src_value; StringBuilder res = new StringBuilder ("["); for (uint i = 0; i < arr.n_values; i++) { unowned Value val = arr.get_nth (i); assert (Value.type_transformable (val.type (), typeof (string))); Value val_str = Value (typeof (string)); val.transform (ref val_str); if (i != 0) { res.append (","); } res.append ((string)val_str); } res.append ("]"); dest_value = res.str; } int main (string[] args) { unowned string? current_group = null; unowned string? current_key = null; if (args.length < 2) { return 1; } // register the ValueArray->string transform Value.register_transform_func (typeof (ValueArray), typeof (string), value_array_to_string); try { Type ct; Schema schema; StringBuilder gconf; ct = DesktopAgnostic.ModuleLoader.get_default ().load ("libda-cfg-gconf"); if (ct == Type.INVALID) { critical ("The GConf configuration module needs to be installed for %s to function correctly.", args[0]); return 1; } if (!FileUtils.test (args[1], FileTest.IS_REGULAR)) { critical ("The schema file '%s' does not seem to exist.", args[1]); return 1; } schema = new Schema (args[1]); gconf = new StringBuilder ("\n"); gconf.append ("\n \n"); foreach (unowned string group in schema.get_groups ()) { string base_path; string app_name; string path_prefix; current_group = group; base_path = schema.get_metadata_option ("GConf.base_path").get_string (); app_name = schema.app_name; if (group == GROUP_DEFAULT) { path_prefix = "%s/%s".printf (base_path, app_name); } else { path_prefix = "%s/%s/%s".printf (base_path, app_name, group); } foreach (unowned string key in schema.get_keys (group)) { SchemaOption option = schema.get_option (group, key); Type type = option.option_type; Value default_value = Value (typeof (string)); string? summary; current_key = key; gconf.append (" \n"); gconf.append (Markup.printf_escaped (" /schemas%s/%s\n", path_prefix, key)); gconf.append (Markup.printf_escaped (" %s/%s\n", path_prefix, key)); gconf.append (Markup.printf_escaped (" %s\n", app_name)); gconf.append (Markup.printf_escaped (" %s\n", schema_type_to_string (type))); if (type == typeof (ValueArray)) { Type list_type = option.list_type; gconf.append (Markup.printf_escaped (" %s\n", schema_type_to_string (list_type))); } option.default_value.transform (ref default_value); if (null == (string)default_value) { default_value = ""; } gconf.append (Markup.printf_escaped (" %s\n", (string)default_value)); gconf.append (" \n"); summary = option.summary; if (summary != null && summary != "") { gconf.append (Markup.printf_escaped (" %s\n", summary)); } gconf.append (Markup.printf_escaped (" %s\n", option.description)); gconf.append (" \n"); // TODO locale-specific summaries/descriptions gconf.append (" \n"); } } gconf.append (" \n\n"); if (args.length < 3) { stdout.printf ("%s", gconf.str); } else { FileUtils.set_contents (args[2], gconf.str, gconf.len); } } catch (GLib.Error err) { if (current_group == null || current_key == null) { critical ("Error: %s", err.message); } else { critical ("Error (%s/%s): %s", current_group, current_key, err.message); } return 1; } return 0; } // vim: set et ts=2 sts=2 sw=2 ai : libdesktop-agnostic-0.3.92/tools/lda-desktop-entry-editor.vala0000664000175000017510000000321311536677677023726 0ustar seagleseagle/* * 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 */ using DesktopAgnostic; using DesktopAgnostic.UI; const OptionEntry[] entries = { //{ 0, } }; public static int main (string[] args) { VFS.File file; VFS.File? output = null; LauncherEditorDialog editor; if (args.length < 2) { critical ("Usage: %s FILE [OUTPUT FILE]", args[0]); return 1; } try { VFS.init (); Gtk.init (ref args); file = VFS.file_new_for_path (args[1]); if (args.length > 2) { output = VFS.file_new_for_path (args[2]); } editor = new LauncherEditorDialog (file, output); editor.show_all (); editor.run (); VFS.shutdown (); } catch (Error err) { critical ("Error: %s", err.message); return 1; } return 0; } // vim:et:ai:cindent:ts=2 sts=2 sw=2 libdesktop-agnostic-0.3.92/docs/todo.rst0000664000175000017510000000154111536677677017520 0ustar seagleseagle==== TODO ==== Config ------ Convert get/set methods to use contract programming (requires) when possible KeyFile: check for added/deleted keys from schema when constructed Desktop Entry ------------- * add _for_(path|uri) constructors for convenience purposes? * add is_valid() method VFS: File --------- * content type discovery VFS: Volume ----------- * split up network mounts, when possible? * drive support, when possible? UI: Icon Chooser Dialog ----------------------- * if there are no icons but subfolders, there would be a centered (horiz+vert) icon + caption "select a subfolder", which, when clicked, shows the parent folder + expanded child folders in the folder selection dialog * if editing and the entry has an icon, show the icon with the proper location/category. * the last icon folder should be remembered (within a single session). libdesktop-agnostic-0.3.92/docs/conf.py0000664000175000017510000001427211536677677017325 0ustar seagleseagle# -*- coding: utf-8 -*- # # Desktop Agnostic Library documentation build configuration file, created by # sphinx-quickstart on Sat Apr 10 18:18:53 2010. # # This file is execfile()d with the current directory set to its containing # directory. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = u'libdesktop-agnostic' copyright = u'2010, Mark Lee' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.4.0' # The full version, including alpha/beta/rc tags. release = '0.4.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_trees = [] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. html_use_modindex = False # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'DesktopAgnosticLibrarydoc' # -- Options for LaTeX output ------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', 'DesktopAgnosticLibrary.tex', u'libdesktop-agnostic', u'Mark Lee', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True libdesktop-agnostic-0.3.92/docs/wscript0000664000175000017510000000127011536677677017436 0ustar seagleseagle#!/usr/bin/env python # encoding: utf-8 # vim: set ts=4 sts=4 sw=4 et : import Options def set_options(opt): opt.add_option('--enable-docs', action='store_true', dest='docs', default=False, help='Enables support for building the documentation ' '(requires Sphinx).') def configure(conf): conf.env['BUILD_DOCS'] = Options.options.docs if conf.env['BUILD_DOCS']: conf.check_tool('sphinx') def build(bld): # sphinx if bld.env['BUILD_DOCS']: sources = ['index', 'config-metadata', 'install', 'known-issues', 'todo'] bld.new_task_gen(features='sphinx', source=sources) libdesktop-agnostic-0.3.92/docs/config-metadata.rst0000664000175000017510000000461311536677677021601 0ustar seagleseagleConfiguration Metadata ====================== .. sidebar:: Note This document attempts to conform to the `RFC 2119 `_ standards for the terms "MUST" and "SHOULD". Each configuration schema has its own set of metadata, in addition to the metadata associated with each configuration option. There are three kinds of schema metadata: Common, backend-specific, and custom metadata. Common metadata is comprised of pre-defined keys not specific to a backend, and do not have a common prefix. Backend-specific metadata is comprised of pre-defined keys with a common prefix: the name property of the backend. Custom metadata follows the convention of message headers [#]_ and desktop file keys [#]_, in that they MUST begin with the prefix ``X-``. Here is the list of common metadata keys: .. sidebar:: Note In the following definitions, ``app_name`` refers to the "basename" of the schema file. For example, the ``app_name`` of the file ``foo-bar.schema-ini`` would be ``foo-bar``. This name SHOULD be filename-friendly on multiple platforms. ``single_instance`` Asserts that there can only be one instance of the configuration (defaults to true). If this value is false, then multiple instances of configuration options can be governed by the schema. Here is the list of backend-specific metadata keys: ``GConf.base_path`` The base path for the configuration options. The configuration options will reside in ``${base_path}/${app_name}``. This defaults to ``/apps``. ``GConf.base_instance_path`` The base path for the configuration data for multiple instances that are governed by the schema. Defaults to ``${base_path}/instances``. The configuration options will reside in ``${base_instance_path}/${app_name}/${instance_id}``. If this key exists when ``single_instance`` is true, a warning will be issued. The placeholder ``${base_path}`` and will be replaced with the proper variable value. All of this metadata is stored in the group ``DEFAULT``. Here is an example of what that section might look like: .. sourcecode:: ini [DEFAULT] single_instance = false GConf.base_path = /non/standard-prefix .. [#] `RFC 822, Section 4.7.5 `_ .. [#] `Desktop Entry Specification: Extending the format `_ .. vim: set ft=rst tw=80 lbr : libdesktop-agnostic-0.3.92/docs/index.rst0000664000175000017510000000040211536677677017655 0ustar seagleseagle=============================================== Welcome to libdesktop-agnostic's documentation! =============================================== Contents: .. toctree:: :maxdepth: 2 install config-metadata known-issues todo * :ref:`search` libdesktop-agnostic-0.3.92/docs/install.rst0000664000175000017510000000656711536677677020236 0ustar seagleseagle============ Installation ============ The following document details how to install libdesktop-agnostic. ------------- Debian/Ubuntu ------------- For Ubuntu users, there is a `PPA`_ with semi-regular releases: .. _PPA: https://launchpad.net/~malept/+archive/experimental If you wish to build from source, the preferred method is to use the Debian packaging method: 1. Install the build-time prerequisites. They are listed in ``debian/control``, under the ``Build-Depends`` entry. 2. Run ``debuild binary``. 3. Install the built packages with ``sudo dpkg -i``. The packages should be in the parent directory of the source directory. ------ Gentoo ------ For Gentoo users, an SCM version is available at the desktop-effects overlay. You can add it by installing `layman`_ and running the following commands (with administrative privileges):: layman -a desktop-effects echo ** x11-libs/libdesktop-agnostic >> /etc/portage/package.keywords emerge libdesktop-agnostic There are several USE flags for libdesktop-agnostic. Please consult the ``metadata.xml`` file in the directly where the ``libdesktop-agnostic-9999.ebuild`` is located for flag descriptions. .. _layman: http://layman.sf.net/ ------------- Prerequisites ------------- Build-only ~~~~~~~~~~ * Python 2.4 or later (requires the development files, for the Python bindings) * 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*) ~~~~~~~~~~~~~~~~~~~~~~~~~~ * GLib 2.12 or later * GTK 2.12 or later For the Python bindings: * PyGObject 2.12 or later * PyGTK 2.12 or later One of the following VFS libraries: * GIO 2.16 or later (recommended) * GNOME VFS 2.6 or later * Thunar VFS (also requires the D-Bus bindings for GLib [``dbus-glib``]) Build/Runtime (*optional*) ~~~~~~~~~~~~~~~~~~~~~~~~~~ * GConf (Needs GLib 2.14 or later, for ``GRegex`` support) * GNOME Desktop -------------------- Building the Package -------------------- libdesktop-agnostic uses Waf as its build system. It is bundled with the package. From the toplevel directory, run ``./waf --help`` to see all of the options available for the various commands. A regular user will just need to run the following:: ./waf configure --config-backends=[cfg] --vfs-backends=[vfs] --desktop-entry-backends=[de] ./waf ./waf install The preceding commands check the system for dependencies, build the library and test programs, and install the library to the default location (``/usr/local``). The placeholders (specified by the ``[bracketed]`` identifiers) should be replaced by a comma-separated list of backends. A list of valid backends follows: Config ~~~~~~ * ``gconf`` (recommended) * ``keyfile`` (uses GLib's GKeyFile, which is a .ini-like format) * ``memory`` (useful for testing applications) * ``null`` (only useful for people developing libdesktop-agnostic) VFS ~~~ * ``gio`` (recommended) * ``gnome-vfs`` * ``thunar-vfs`` Desktop Entry ~~~~~~~~~~~~~ * ``glib`` (recommended) * ``gnome`` --------------- Packaging Notes --------------- Packagers should package binary modules separately. A configuration file (``desktop-agnostic.ini``) is installed in ``$SYSCONFDIR/xdg/libdesktop-agnostic``. ``$SYSCONFDIR`` is usually ``/etc``. The default modules are the first modules listed in the respective backend flags passed to ``./waf configure``. libdesktop-agnostic-0.3.92/docs/known-issues.rst0000664000175000017510000000336611536677677021227 0ustar seagleseagle============ Known Issues ============ Build System ------------ The following compile warnings are known (line numbers may not be accurate): * This error (and other, similar ones) are due to a limitation in Vala [1]_:: desktop-entry-impl-glib.vala: In function ‘desktop_agnostic_desktop_entry_glib_implementation_real_set_string_list’: desktop-entry-impl-glib.vala: warning: passing argument 4 of ‘g_key_file_set_string_list’ from incompatible pointer type * These errors are also due to a limitation in Vala. Patches for Vala have been submitted [2]_ [3]_:: config-bridge.vala: In function ‘desktop_agnostic_config_bridge_bind’: 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`_ (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). .. _GNOME Bug #582092: http://bugzilla.gnome.org/show_bug.cgi?id=582092 .. _GNOME Bug #529866: http://bugzilla.gnome.org/show_bug.cgi?id=529866 .. _GNOME Bug #592108: http://bugzilla.gnome.org/show_bug.cgi?id=592108 * This kind of error is usually due to a limitation in Vala API generation:: libdesktop-agnostic/vfs-file-impl-thunar-vfs.vala:107.15-110.9: warning: unreachable catch clause detected Runtime ------- * ``lda-schema-to-gconf`` does not function properly on 64-bit systems if built with optimization flags higher than ``-O0``. See also: confirmed/in progress bugs at the `bug tracker`_. .. _bug tracker: https://bugs.launchpad.net/libdesktop-agnostic libdesktop-agnostic-0.3.92/.pc/.version0000664000175000017510000000000211733560021017173 0ustar seagleseagle2 libdesktop-agnostic-0.3.92/.pc/.quilt_patches0000664000175000017510000000001711733560021020361 0ustar seagleseagledebian/patches libdesktop-agnostic-0.3.92/.pc/.quilt_series0000664000175000017510000000000711733560021020223 0ustar seagleseagleseries libdesktop-agnostic-0.3.92/wafadmin/TaskGen.py0000644000175000017510000002411311226437331020534 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import os,traceback,copy import Build,Task,Utils,Logs,Options from Logs import debug,error,warn from Constants import* typos={'sources':'source','targets':'target','include':'includes','define':'defines','importpath':'importpaths','install_var':'install_path','install_subdir':'install_path','inst_var':'install_path','inst_dir':'install_path','feature':'features',} class register_obj(type): def __init__(cls,name,bases,dict): super(register_obj,cls).__init__(name,bases,dict) name=cls.__name__ suffix='_taskgen' if name.endswith(suffix): task_gen.classes[name.replace(suffix,'')]=cls class task_gen(object): __metaclass__=register_obj mappings={} mapped={} prec=Utils.DefaultDict(list) traits=Utils.DefaultDict(set) classes={} def __init__(self,*kw,**kwargs): self.prec=Utils.DefaultDict(list) self.source='' self.target='' self.meths=[] self.mappings={} self.features=list(kw) self.tasks=[] self.default_chmod=O644 self.default_install_path=None self.allnodes=[] self.bld=kwargs.get('bld',Build.bld) self.env=self.bld.env.copy() self.path=self.bld.path self.name='' self.idx=self.bld.idx[self.path.id]=self.bld.idx.get(self.path.id,0)+1 for key,val in kwargs.iteritems(): setattr(self,key,val) self.bld.task_manager.add_task_gen(self) self.bld.all_task_gen.append(self) def __str__(self): return(""%(self.name or self.target,self.__class__.__name__,str(self.path))) def __setattr__(self,name,attr): real=typos.get(name,name) if real!=name: warn('typo %s -> %s'%(name,real)) if Logs.verbose>0: traceback.print_stack() object.__setattr__(self,real,attr) def to_list(self,value): if isinstance(value,str):return value.split() else:return value def apply(self): keys=set(self.meths) self.features=Utils.to_list(self.features) for x in self.features+['*']: st=task_gen.traits[x] if not st: warn('feature %r does not exist - bind at least one method to it'%x) keys.update(st) prec={} prec_tbl=self.prec or task_gen.prec for x in prec_tbl: if x in keys: prec[x]=prec_tbl[x] tmp=[] for a in keys: for x in prec.values(): if a in x:break else: tmp.append(a) out=[] while tmp: e=tmp.pop() if e in keys:out.append(e) try: nlst=prec[e] except KeyError: pass else: del prec[e] for x in nlst: for y in prec: if x in prec[y]: break else: tmp.append(x) if prec:raise Utils.WafError("graph has a cycle %s"%str(prec)) out.reverse() self.meths=out debug('task_gen: posting %s %d'%(self,id(self))) for x in out: try: v=getattr(self,x) except AttributeError: raise Utils.WafError("tried to retrieve %s which is not a valid method"%x) debug('task_gen: -> %s (%d)'%(x,id(self))) v() def post(self): if not self.name: if isinstance(self.target,list): self.name=' '.join(self.target) else: self.name=self.target if getattr(self,'posted',None): return self.apply() debug('task_gen: posted %s'%self.name) self.posted=True def get_hook(self,ext): try:return self.mappings[ext] except KeyError: try:return task_gen.mappings[ext] except KeyError:return None def create_task(self,name,env=None): task=Task.TaskBase.classes[name](env or self.env,generator=self) self.tasks.append(task) return task def name_to_obj(self,name): return self.bld.name_to_obj(name,self.env) def find_sources_in_dirs(self,dirnames,excludes=[],exts=[]): err_msg="'%s' attribute must be a list" if not isinstance(excludes,list): raise Utils.WscriptError(err_msg%'excludes') if not isinstance(exts,list): raise Utils.WscriptError(err_msg%'exts') lst=[] dirnames=self.to_list(dirnames) ext_lst=exts or self.mappings.keys()+task_gen.mappings.keys() for name in dirnames: anode=self.path.find_dir(name) if not anode or not anode.is_child_of(self.bld.srcnode): raise Utils.WscriptError("Unable to use '%s' - either because it's not a relative path"", or it's not child of '%s'."%(name,self.bld.srcnode)) self.bld.rescan(anode) for name in self.bld.cache_dir_contents[anode.id]: if name.startswith('.'): continue (base,ext)=os.path.splitext(name) if ext in ext_lst and not name in lst and not name in excludes: lst.append((anode.relpath_gen(self.path)or'.')+os.path.sep+name) lst.sort() self.source=self.to_list(self.source) if not self.source:self.source=lst else:self.source+=lst def clone(self,env): newobj=task_gen(bld=self.bld) for x in self.__dict__: if x in['env','bld']: continue elif x in["path","features"]: setattr(newobj,x,getattr(self,x)) else: setattr(newobj,x,copy.copy(getattr(self,x))) newobj.__class__=self.__class__ if isinstance(env,str): newobj.env=self.bld.all_envs[env].copy() else: newobj.env=env.copy() return newobj def get_inst_path(self): return getattr(self,'_install_path',getattr(self,'default_install_path','')) def set_inst_path(self,val): self._install_path=val install_path=property(get_inst_path,set_inst_path) def get_chmod(self): return getattr(self,'_chmod',getattr(self,'default_chmod',O644)) def set_chmod(self,val): self._chmod=val chmod=property(get_chmod,set_chmod) def declare_extension(var,func): try: for x in Utils.to_list(var): task_gen.mappings[x]=func except: raise Utils.WscriptError('declare_extension takes either a list or a string %r'%var) task_gen.mapped[func.__name__]=func def declare_order(*k): assert(len(k)>1) n=len(k)-1 for i in xrange(n): f1=k[i] f2=k[i+1] if not f1 in task_gen.prec[f2]: task_gen.prec[f2].append(f1) def declare_chain(name='',action='',ext_in='',ext_out='',reentrant=1,color='BLUE',install=0,before=[],after=[],decider=None,rule=None,scan=None): action=action or rule if isinstance(action,str): act=Task.simple_task_type(name,action,color=color) else: act=Task.task_type_from_func(name,action,color=color) act.ext_in=tuple(Utils.to_list(ext_in)) act.ext_out=tuple(Utils.to_list(ext_out)) act.before=Utils.to_list(before) act.after=Utils.to_list(after) act.scan=scan def x_file(self,node): if decider: ext=decider(self,node) elif isinstance(ext_out,str): ext=ext_out if isinstance(ext,str): out_source=node.change_ext(ext) if reentrant: self.allnodes.append(out_source) elif isinstance(ext,list): out_source=[node.change_ext(x)for x in ext] if reentrant: for i in xrange(reentrant): self.allnodes.append(out_source[i]) else: raise Utils.WafError("do not know how to process %s"%str(ext)) tsk=self.create_task(name) tsk.set_inputs(node) tsk.set_outputs(out_source) if node.__class__.bld.is_install==INSTALL: tsk.install=install declare_extension(act.ext_in,x_file) def bind_feature(name,methods): lst=Utils.to_list(methods) task_gen.traits[name].update(lst) def taskgen(func): setattr(task_gen,func.__name__,func) def feature(*k): def deco(func): setattr(task_gen,func.__name__,func) for name in k: task_gen.traits[name].update([func.__name__]) return func return deco def before(*k): def deco(func): setattr(task_gen,func.__name__,func) for fun_name in k: if not func.__name__ in task_gen.prec[fun_name]: task_gen.prec[fun_name].append(func.__name__) return func return deco def after(*k): def deco(func): setattr(task_gen,func.__name__,func) for fun_name in k: if not fun_name in task_gen.prec[func.__name__]: task_gen.prec[func.__name__].append(fun_name) return func return deco def extension(var): def deco(func): setattr(task_gen,func.__name__,func) try: for x in Utils.to_list(var): task_gen.mappings[x]=func except: raise Utils.WafError('extension takes either a list or a string %r'%var) task_gen.mapped[func.__name__]=func return func return deco def apply_core(self): find_resource=self.path.find_resource for filename in self.to_list(self.source): x=self.get_hook(filename) if x: x(self,filename) else: node=find_resource(filename) if not node:raise Utils.WafError("source not found: '%s' in '%s'"%(filename,str(self.path))) self.allnodes.append(node) for node in self.allnodes: x=self.get_hook(node.suffix()) if not x: raise Utils.WafError("Cannot guess how to process %s (got mappings %r in %r) -> try conf.check_tool(..)?"%(str(node),self.__class__.mappings.keys(),self.__class__)) x(self,node) feature('*')(apply_core) def exec_rule(self): if not getattr(self,'rule',None): return try: self.meths.remove('apply_core') except ValueError: pass func=self.rule vars2=[] if isinstance(func,str): (func,vars2)=Task.compile_fun('',self.rule,shell=getattr(self,'shell',True)) func.code=self.rule vars=getattr(self,'vars',vars2) if not vars: if isinstance(self.rule,str): vars=self.rule else: vars=Utils.h_fun(self.rule) name=getattr(self,'name',None)or self.target or self.rule cls=Task.task_type_from_func(name,func,vars) tsk=self.create_task(name) if getattr(self,'target',None): cls.quiet=True tsk.outputs=[self.path.find_or_declare(x)for x in self.to_list(self.target)] if getattr(self,'source',None): cls.quiet=True tsk.inputs=[] for x in self.to_list(self.source): y=self.path.find_resource(x) if not y: raise Utils.WafError('input file %r could not be found (%r)'%(x,self.path.abspath())) tsk.inputs.append(y) if getattr(self,'always',None): Task.always_run(cls) if getattr(self,'scan',None): cls.scan=self.scan if getattr(self,'install_path',None): tsk.install_path=self.install_path if getattr(self,'cwd',None): tsk.cwd=self.cwd if getattr(self,'on_results',None): Task.update_outputs(cls) for x in['after','before']: setattr(cls,x,getattr(self,x,[])) feature('*')(exec_rule) before('apply_core')(exec_rule) def sequence_order(self): if self.meths and self.meths[-1]!='sequence_order': self.meths.append('sequence_order') return if getattr(self,'seq_start',None): return if getattr(self.bld,'prev',None): self.bld.prev.post() for x in self.bld.prev.tasks: for y in self.tasks: y.set_run_after(x) self.bld.prev=self feature('seq')(sequence_order) libdesktop-agnostic-0.3.92/wafadmin/Options.py0000644000175000017510000001276511226437331020645 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,imp,types,tempfile,optparse import Logs,Utils,Configure from Constants import* cmds='distclean configure build install clean uninstall check dist distcheck'.split() commands={} is_install=False options={} arg_line=[] launch_dir='' tooldir='' lockfile=os.environ.get('WAFLOCK','.lock-wscript') try:cache_global=os.path.abspath(os.environ['WAFCACHE']) except KeyError:cache_global='' platform=Utils.detect_platform() conf_file='conf-runs-%s-%d.pickle'%(platform,ABI) default_prefix=os.environ.get('PREFIX') if not default_prefix: if platform=='win32':default_prefix=tempfile.gettempdir() else:default_prefix='/usr/local/' default_jobs=os.environ.get('JOBS',-1) if default_jobs<1: try: if'SC_NPROCESSORS_ONLN'in os.sysconf_names: default_jobs=os.sysconf('SC_NPROCESSORS_ONLN') else: default_jobs=int(Utils.cmd_output(['sysctl','-n','hw.ncpu'])) except: default_jobs=int(os.environ.get('NUMBER_OF_PROCESSORS',1)) default_destdir=os.environ.get('DESTDIR','') def get_usage(self): cmds_str=[] module=Utils.g_module if module: tbl=module.__dict__ keys=list(tbl.keys()) keys.sort() if'build'in tbl: if not module.build.__doc__: module.build.__doc__='builds the project' if'configure'in tbl: if not module.configure.__doc__: module.configure.__doc__='configures the project' ban=['set_options','init','shutdown'] optlst=[x for x in keys if not x in ban and type(tbl[x])is type(parse_args_impl)and tbl[x].__doc__ and not x.startswith('_')] just=max([len(x)for x in optlst]) for x in optlst: cmds_str.append(' %s: %s'%(x.ljust(just),tbl[x].__doc__)) ret='\n'.join(cmds_str) else: ret=' '.join(cmds) return'''waf [command] [options] Main commands (example: ./waf build -j4) %s '''%ret setattr(optparse.OptionParser,'get_usage',get_usage) def create_parser(module=None): Logs.debug('options: create_parser is called') parser=optparse.OptionParser(conflict_handler="resolve",version='waf %s (%s)'%(WAFVERSION,WAFREVISION)) parser.formatter.width=Utils.get_term_cols() p=parser.add_option p('-j','--jobs',type='int',default=default_jobs,help='amount of parallel jobs (%r)'%default_jobs,dest='jobs') p('-k','--keep',action='store_true',default=False,help='keep running happily on independent task groups',dest='keep') p('-v','--verbose',action='count',default=0,help='verbosity level -v -vv or -vvv [default: 0]',dest='verbose') p('--nocache',action='store_true',default=False,help='ignore the WAFCACHE (if set)',dest='nocache') p('--zones',action='store',default='',help='debugging zones (task_gen, deps, tasks, etc)',dest='zones') p('-p','--progress',action='count',default=0,help='-p: progress bar; -pp: ide output',dest='progress_bar') p('--targets',action='store',default='',help='build given task generators, e.g. "target1,target2"',dest='compile_targets') gr=optparse.OptionGroup(parser,'configuration options') parser.add_option_group(gr) gr.add_option('-b','--blddir',action='store',default='',help='build dir for the project (configuration)',dest='blddir') gr.add_option('-s','--srcdir',action='store',default='',help='src dir for the project (configuration)',dest='srcdir') gr.add_option('--prefix',help='installation prefix (configuration) [default: %r]'%default_prefix,default=default_prefix,dest='prefix') gr=optparse.OptionGroup(parser,'installation options') parser.add_option_group(gr) gr.add_option('--destdir',help='installation root [default: %r]'%default_destdir,default=default_destdir,dest='destdir') gr.add_option('-f','--force',action='store_true',default=False,help='force file installation',dest='force') return parser def parse_args_impl(parser,_args=None): global options,commands,arg_line (options,args)=parser.parse_args(args=_args) arg_line=args commands={} for var in cmds:commands[var]=0 if not args: commands['build']=1 args.append('build') for arg in args: commands[arg]=True if'check'in args: idx=args.index('check') try: bidx=args.index('build') if bidx>idx: raise ValueError('build before check') except ValueError,e: args.insert(idx,'build') if args[0]!='init': args.insert(0,'init') if options.keep:options.jobs=1 if options.jobs<1:options.jobs=1 if'install'in sys.argv or'uninstall'in sys.argv: options.destdir=options.destdir and os.path.abspath(os.path.expanduser(options.destdir)) Logs.verbose=options.verbose Logs.init_log() if options.zones: Logs.zones=options.zones.split(',') if not Logs.verbose:Logs.verbose=1 elif Logs.verbose>0: Logs.zones=['runner'] if Logs.verbose>2: Logs.zones=['*'] class Handler(Utils.Context): parser=None def __init__(self,module=None): self.parser=create_parser(module) self.cwd=os.getcwd() Handler.parser=self def add_option(self,*k,**kw): self.parser.add_option(*k,**kw) def add_option_group(self,*k,**kw): return self.parser.add_option_group(*k,**kw) def get_option_group(self,opt_str): return self.parser.get_option_group(opt_str) def sub_options(self,*k,**kw): if not k:raise Utils.WscriptError('folder expected') self.recurse(k[0],name='set_options') def tool_options(self,*k,**kw): if not k[0]: raise Utils.WscriptError('invalid tool_options call %r %r'%(k,kw)) tools=Utils.to_list(k[0]) path=Utils.to_list(kw.get('tdir',kw.get('tooldir',tooldir))) for tool in tools: tool=tool.replace('++','xx') module=Utils.load_tool(tool,path) try: fun=module.set_options except AttributeError: pass else: fun(kw.get('option_group',self)) def parse_args(self,args=None): parse_args_impl(self.parser,args) libdesktop-agnostic-0.3.92/wafadmin/Runner.py0000644000175000017510000000704511226437331020456 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import sys,random,time,threading,traceback try:from Queue import Queue except ImportError:from queue import Queue import Build,Utils,Logs,Options from Logs import debug,error from Constants import* GAP=15 run_old=threading.Thread.run def run(*args,**kwargs): try: run_old(*args,**kwargs) except(KeyboardInterrupt,SystemExit): raise except: sys.excepthook(*sys.exc_info()) threading.Thread.run=run class TaskConsumer(threading.Thread): def __init__(self,m): threading.Thread.__init__(self) self.setDaemon(1) self.master=m self.start() def run(self): try: self.loop() except: pass def loop(self): m=self.master while 1: tsk=m.ready.get() if m.stop: m.out.put(tsk) continue try: tsk.generator.bld.printout(tsk.display()) if tsk.__class__.stat:ret=tsk.__class__.stat(tsk) else:ret=tsk.call_run() except Exception,e: tsk.err_msg=Utils.ex_stack() tsk.hasrun=EXCEPTION m.error_handler(tsk) m.out.put(tsk) continue if ret: tsk.err_code=ret tsk.hasrun=CRASHED else: try: tsk.post_run() except Utils.WafError: pass except Exception: tsk.err_msg=Utils.ex_stack() tsk.hasrun=EXCEPTION else: tsk.hasrun=SUCCESS if tsk.hasrun!=SUCCESS: m.error_handler(tsk) m.out.put(tsk) class Parallel(object): def __init__(self,bld,j=2): self.numjobs=j self.manager=bld.task_manager self.manager.current_group=0 self.total=self.manager.total() self.outstanding=[] self.maxjobs=MAXJOBS self.frozen=[] self.ready=Queue(0) self.out=Queue(0) self.count=0 self.processed=1 self.consumers=None self.stop=False self.error=False def get_next(self): if not self.outstanding: return None return self.outstanding.pop(0) def postpone(self,tsk): if random.randint(0,1): self.frozen.insert(0,tsk) else: self.frozen.append(tsk) def refill_task_list(self): while self.count>self.numjobs+GAP or self.count>=self.maxjobs: self.get_out() while not self.outstanding: if self.count: self.get_out() if self.frozen: self.outstanding+=self.frozen self.frozen=[] elif not self.count: (jobs,tmp)=self.manager.get_next_set() if jobs!=None:self.maxjobs=jobs if tmp:self.outstanding+=tmp break def get_out(self): ret=self.out.get() self.manager.add_finished(ret) if not self.stop and getattr(ret,'more_tasks',None): self.outstanding+=ret.more_tasks self.total+=len(ret.more_tasks) self.count-=1 def error_handler(self,tsk): if not Options.options.keep: self.stop=True self.error=True def start(self): while not self.stop: self.refill_task_list() tsk=self.get_next() if not tsk: if self.count: continue else: break if tsk.hasrun: self.processed+=1 self.manager.add_finished(tsk) continue try: st=tsk.runnable_status() except Exception,e: tsk.err_msg=Utils.ex_stack() tsk.hasrun=EXCEPTION self.processed+=1 self.error_handler(tsk) self.manager.add_finished(tsk) continue if st==ASK_LATER: self.postpone(tsk) elif st==SKIP_ME: self.processed+=1 tsk.hasrun=SKIPPED self.manager.add_finished(tsk) else: tsk.position=(self.processed,self.total) self.count+=1 self.ready.put(tsk) self.processed+=1 if not self.consumers: self.consumers=[TaskConsumer(self)for i in xrange(self.numjobs)] while self.error and self.count: self.get_out() assert(self.count==0 or self.stop) libdesktop-agnostic-0.3.92/wafadmin/Build.py0000644000175000017510000004405011226437331020241 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import os,sys,errno,re,glob,gc,datetime,shutil try:import cPickle except:import pickle as cPickle import Runner,TaskGen,Node,Scripting,Utils,Environment,Task,Logs,Options from Logs import debug,error,info from Constants import* SAVED_ATTRS='root srcnode bldnode node_sigs node_deps raw_deps task_sigs id_nodes'.split() bld=None class BuildError(Utils.WafError): def __init__(self,b=None,t=[]): self.bld=b self.tasks=t self.ret=1 Utils.WafError.__init__(self,self.format_error()) def format_error(self): lst=['Build failed'] for tsk in self.tasks: txt=tsk.format_error() if txt:lst.append(txt) return'\n'.join(lst) class BuildContext(Utils.Context): def __init__(self): global bld bld=self self.task_manager=Task.TaskManager() self.id_nodes=0 self.idx={} self.all_envs={} self.bdir='' self.path=None self.deps_man=Utils.DefaultDict(list) self.cache_node_abspath={} self.cache_scanned_folders={} self.uninstall=[] for v in'cache_node_abspath task_sigs node_deps raw_deps node_sigs'.split(): var={} setattr(self,v,var) self.cache_dir_contents={} self.all_task_gen=[] self.task_gen_cache_names={} self.cache_sig_vars={} self.log=None self.root=None self.srcnode=None self.bldnode=None class node_class(Node.Node): pass self.node_class=node_class self.node_class.__module__="Node" self.node_class.__name__="Nodu" self.node_class.bld=self self.is_install=None def __copy__(self): raise Utils.WafError('build contexts are not supposed to be cloned') def load(self): try: env=Environment.Environment(os.path.join(self.cachedir,'build.config.py')) except(IOError,OSError): pass else: if env['version']1:raise if data: for x in SAVED_ATTRS:setattr(self,x,data[x]) else: debug('build: Build cache loading failed') finally: if f:f.close() gc.enable() def save(self): gc.disable() self.root.__class__.bld=None Node.Nodu=self.node_class db=os.path.join(self.bdir,DBFILE) file=open(db+'.tmp','wb') data={} for x in SAVED_ATTRS:data[x]=getattr(self,x) cPickle.dump(data,file,-1) file.close() try:os.unlink(db) except OSError:pass os.rename(db+'.tmp',db) self.root.__class__.bld=self gc.enable() def clean(self): debug('build: clean called') precious=set([]) for env in self.all_envs.values(): for x in env[CFG_FILES]: node=self.srcnode.find_resource(x) if node: precious.add(node.id) def clean_rec(node): for x in node.childs.keys(): nd=node.childs[x] tp=nd.id&3 if tp==Node.DIR: clean_rec(nd) elif tp==Node.BUILD: if nd.id in precious:continue for env in self.all_envs.values(): try:os.remove(nd.abspath(env)) except OSError:pass node.childs.__delitem__(x) clean_rec(self.srcnode) for v in'node_sigs node_deps task_sigs raw_deps cache_node_abspath'.split(): setattr(self,v,{}) def compile(self): debug('build: compile called') self.flush() self.generator=Runner.Parallel(self,Options.options.jobs) def dw(on=True): if Options.options.progress_bar: if on:sys.stderr.write(Logs.colors.cursor_on) else:sys.stderr.write(Logs.colors.cursor_off) debug('build: executor starting') back=os.getcwd() os.chdir(self.bldnode.abspath()) try: try: dw(on=False) self.generator.start() except KeyboardInterrupt: dw() if self.generator.consumers: self.save() raise except Exception: dw() raise else: dw() if self.generator.consumers: self.save() if self.generator.error: raise BuildError(self,self.task_manager.tasks_done) finally: os.chdir(back) def install(self): debug('build: install called') self.flush() if self.is_install<0: lst=[] for x in self.uninstall: dir=os.path.dirname(x) if not dir in lst:lst.append(dir) lst.sort() lst.reverse() nlst=[] for y in lst: x=y while len(x)>4: if not x in nlst:nlst.append(x) x=os.path.dirname(x) nlst.sort() nlst.reverse() for x in nlst: try:os.rmdir(x) except OSError:pass def new_task_gen(self,*k,**kw): kw['bld']=self if len(k)==0: ret=TaskGen.task_gen(*k,**kw) else: cls_name=k[0] try:cls=TaskGen.task_gen.classes[cls_name] except KeyError:raise Utils.WscriptError('%s is not a valid task generator -> %s'%(cls_name,[x for x in TaskGen.task_gen.classes])) ret=cls(*k,**kw) return ret def load_envs(self): try: lst=Utils.listdir(self.cachedir) except OSError,e: if e.errno==errno.ENOENT: raise Utils.WafError('The project was not configured: run "waf configure" first!') else: raise if not lst: raise Utils.WafError('The cache directory is empty: reconfigure the project') for file in lst: if file.endswith(CACHE_SUFFIX): env=Environment.Environment(os.path.join(self.cachedir,file)) name=file[:-len(CACHE_SUFFIX)] self.all_envs[name]=env self.init_variants() for env in self.all_envs.values(): for f in env[CFG_FILES]: newnode=self.path.find_or_declare(f) try: hash=Utils.h_file(newnode.abspath(env)) except(IOError,AttributeError): error("cannot find "+f) hash=SIG_NIL self.node_sigs[env.variant()][newnode.id]=hash self.bldnode=self.root.find_dir(self.bldnode.abspath()) self.path=self.srcnode=self.root.find_dir(self.srcnode.abspath()) self.cwd=self.bldnode.abspath() def setup(self,tool,tooldir=None,funs=None): if isinstance(tool,list): for i in tool:self.setup(i,tooldir) return if not tooldir:tooldir=Options.tooldir file=None module=Utils.load_tool(tool,tooldir) if hasattr(module,"setup"):module.setup(self) if file:file.close() def init_variants(self): debug('build: init variants') lstvariants=[] for env in self.all_envs.values(): if not env.variant()in lstvariants: lstvariants.append(env.variant()) self.lst_variants=lstvariants debug('build: list of variants is %r'%lstvariants) for name in lstvariants+[0]: for v in'node_sigs cache_node_abspath'.split(): var=getattr(self,v) if not name in var: var[name]={} def load_dirs(self,srcdir,blddir,load_cache=1): assert(os.path.isabs(srcdir)) assert(os.path.isabs(blddir)) self.cachedir=os.path.join(blddir,CACHE_DIR) if srcdir==blddir: raise Utils.WafError("build dir must be different from srcdir: %s <-> %s "%(srcdir,blddir)) self.bdir=blddir self.load() if not self.root: Node.Nodu=self.node_class self.root=Node.Nodu('',None,Node.DIR) if not self.srcnode: self.srcnode=self.root.ensure_dir_node_from_path(srcdir) debug('build: srcnode is %s and srcdir %s'%(self.srcnode.name,srcdir)) self.path=self.srcnode try:os.makedirs(blddir) except OSError:pass if not self.bldnode: self.bldnode=self.root.ensure_dir_node_from_path(blddir) self.init_variants() def rescan(self,src_dir_node): if self.cache_scanned_folders.get(src_dir_node.id,None):return self.cache_scanned_folders[src_dir_node.id]=1 if hasattr(self,'repository'):self.repository(src_dir_node) if sys.platform=="win32"and not src_dir_node.name: return self.listdir_src(src_dir_node) h1=self.srcnode.height() h2=src_dir_node.height() lst=[] child=src_dir_node while h2>h1: lst.append(child.name) child=child.parent h2-=1 lst.reverse() for variant in self.lst_variants: sub_path=os.path.join(self.bldnode.abspath(),variant,*lst) try: self.listdir_bld(src_dir_node,sub_path,variant) except OSError: dict=self.node_sigs[variant] for node in src_dir_node.childs.values(): if node.id in dict: dict.__delitem__(node.id) if node.id!=self.bldnode.id: src_dir_node.childs.__delitem__(node.name) os.makedirs(sub_path) def listdir_src(self,parent_node): parent_path=parent_node.abspath() try: lst=set(Utils.listdir(parent_path)) except OSError: if not parent_node.childs: raise for x in parent_node.childs.values(): if x.id&3==Node.FILE: raise lst=set([]) self.cache_dir_contents[parent_node.id]=lst debug('build: folder contents %r'%lst) node_names=set([x.name for x in parent_node.childs.values()if x.id&3 in(Node.FILE,Node.DIR)]) cache=self.node_sigs[0] to_keep=lst&node_names for x in to_keep: node=parent_node.childs[x] if node.id&3==Node.DIR:continue try: cache[node.id]=Utils.h_file(parent_path+os.sep+node.name) except IOError: raise Utils.WafError("The file %s is not readable or has become a dir"%node.abspath()) to_remove=node_names-lst if to_remove: for name in to_remove: nd=parent_node.childs[name] if nd.id&3==Node.DIR: for x in nd.childs.values(): if x.id&3==Node.FILE: break else: continue self.remove_node(nd) def remove_node(self,node): if node.id&3==Node.DIR: for x in node.childs.values(): self.remove_node(x) if node.id!=self.bldnode.id: node.parent.childs.__delitem__(node.name) elif node.id&3==Node.FILE: if node.id in self.node_sigs[0]: self.node_sigs[0].__delitem__(node.id) node.parent.childs.__delitem__(node.name) else: for variant in self.lst_variants: if node.id in self.node_sigs[variant]: self.node_sigs[variant].__delitem__(node.id) node.parent.childs.__delitem__(node.name) def listdir_bld(self,parent_node,path,variant): i_existing_nodes=[x for x in parent_node.childs.values()if x.id&3==Node.BUILD] lst=set(Utils.listdir(path)) node_names=set([x.name for x in i_existing_nodes]) remove_names=node_names-lst ids_to_remove=[x.id for x in i_existing_nodes if x.name in remove_names] cache=self.node_sigs[variant] for nid in ids_to_remove: if nid in cache: cache.__delitem__(nid) def get_env(self): return self.env_of_name('default') def set_env(self,name,val): self.all_envs[name]=val env=property(get_env,set_env) def add_manual_dependency(self,path,value): if isinstance(path,Node.Node): node=path elif os.path.isabs(path): node=self.root.find_resource(path) else: node=self.path.find_resource(path) self.deps_man[node.id].append(value) def launch_node(self): try: return self.p_ln except AttributeError: self.p_ln=self.root.find_dir(Options.launch_dir) return self.p_ln def glob(self,pattern,relative=True): path=self.path.abspath() files=[self.root.find_resource(x)for x in glob.glob(path+os.sep+pattern)] if relative: files=[x.path_to_parent(self.path)for x in files if x] else: files=[x.abspath()for x in files if x] return files def add_group(self,*k): self.task_manager.add_group(*k) def set_group(self,*k,**kw): self.task_manager.set_group(*k,**kw) def hash_env_vars(self,env,vars_lst): idx=str(id(env))+str(vars_lst) try:return self.cache_sig_vars[idx] except KeyError:pass lst=[str(env[a])for a in vars_lst] ret=Utils.h_list(lst) debug("envhash: %r %r"%(ret,lst)) self.cache_sig_vars[idx]=ret return ret def name_to_obj(self,name,env): cache=self.task_gen_cache_names if not cache: for x in self.all_task_gen: vt=x.env.variant()+'_' if x.name: cache[vt+x.name]=x else: if isinstance(x.target,str): target=x.target else: target=' '.join(x.target) v=vt+target if not cache.get(v,None): cache[v]=x return cache.get(env.variant()+'_'+name,None) def flush(self,all=1): self.ini=datetime.datetime.now() self.task_gen_cache_names={} self.name_to_obj('',self.env) debug('build: delayed operation TaskGen.flush() called') if Options.options.compile_targets: debug('task_gen: posting objects listed in compile_targets') target_objects=Utils.DefaultDict(list) for target_name in Options.options.compile_targets.split(','): target_name=target_name.strip() for env in self.all_envs.values(): obj=self.name_to_obj(target_name,env) if obj: target_objects[target_name].append(obj) if not target_name in target_objects and all: raise Utils.WafError("target '%s' does not exist"%target_name) to_compile=[] for x in target_objects.values(): for y in x: to_compile.append(id(y)) for i in xrange(len(self.task_manager.groups)): g=self.task_manager.groups[i] self.task_manager.current_group=i for tg in g.tasks_gen: if id(tg)in to_compile: tg.post() else: debug('task_gen: posting objects (normal)') ln=self.launch_node() if ln.is_child_of(self.bldnode)or not ln.is_child_of(self.srcnode): ln=self.srcnode proj_node=self.root.find_dir(os.path.split(Utils.g_module.root_path)[0]) if proj_node.id!=self.srcnode.id: ln=self.srcnode for i in xrange(len(self.task_manager.groups)): g=self.task_manager.groups[i] self.task_manager.current_group=i for tg in g.tasks_gen: if not tg.path.is_child_of(ln): continue tg.post() def env_of_name(self,name): try: return self.all_envs[name] except KeyError: error('no such environment: '+name) return None def progress_line(self,state,total,col1,col2): n=len(str(total)) Utils.rot_idx+=1 ind=Utils.rot_chr[Utils.rot_idx%4] ini=self.ini pc=(100.*state)/total eta=Utils.get_elapsed_time(ini) fs="[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s]["%(n,n,ind) left=fs%(state,total,col1,pc,col2) right='][%s%s%s]'%(col1,eta,col2) cols=Utils.get_term_cols()-len(left)-len(right)+2*len(col1)+2*len(col2) if cols<7:cols=7 ratio=int((cols*state)/total)-1 bar=('='*ratio+'>').ljust(cols) msg=Utils.indicator%(left,bar,right) return msg def do_install(self,src,tgt,chmod=O644): if self.is_install>0: if not Options.options.force: try: st1=os.stat(tgt) st2=os.stat(src) except OSError: pass else: if st1.st_mtime>=st2.st_mtime and st1.st_size==st2.st_size: return False srclbl=src.replace(self.srcnode.abspath(None)+os.sep,'') info("* installing %s as %s"%(srclbl,tgt)) try:os.remove(tgt) except OSError:pass try: shutil.copy2(src,tgt) os.chmod(tgt,chmod) except IOError: try: os.stat(src) except(OSError,IOError): error('File %r does not exist'%src) raise Utils.WafError('Could not install the file %r'%tgt) return True elif self.is_install<0: info("* uninstalling %s"%tgt) self.uninstall.append(tgt) try:os.remove(tgt) except OSError:pass return True def get_install_path(self,path,env=None): if not env:env=self.env destdir=env.get_destdir() path=path.replace('/',os.sep) destpath=Utils.subst_vars(path,env) if destdir: destpath=os.path.join(destdir,destpath.lstrip(os.sep)) return destpath def install_files(self,path,files,env=None,chmod=O644,relative_trick=False): if env: assert isinstance(env,Environment.Environment),"invalid parameter" if not self.is_install:return[] if not path:return[] node=self.path if isinstance(files,str)and'*'in files: gl=node.abspath()+os.sep+files lst=glob.glob(gl) else: lst=Utils.to_list(files) env=env or self.env destpath=self.get_install_path(path,env) Utils.check_dir(destpath) installed_files=[] for filename in lst: if not os.path.isabs(filename): nd=node.find_resource(filename) if not nd: raise Utils.WafError("Unable to install the file `%s': not found in %s"%(filename,node)) if relative_trick: destfile=os.path.join(destpath,filename) Utils.check_dir(os.path.dirname(destfile)) else: destfile=os.path.join(destpath,nd.name) filename=nd.abspath(env) else: alst=Utils.split_path(filename) destfile=os.path.join(destpath,alst[-1]) if self.do_install(filename,destfile,chmod): installed_files.append(destfile) return installed_files def install_as(self,path,srcfile,env=None,chmod=O644): if env: assert isinstance(env,Environment.Environment),"invalid parameter" if not self.is_install:return False if not path:return False if not env:env=self.env node=self.path destpath=self.get_install_path(path,env) dir,name=os.path.split(destpath) Utils.check_dir(dir) if not os.path.isabs(srcfile): filenode=node.find_resource(srcfile) src=filenode.abspath(env) else: src=srcfile return self.do_install(src,destpath,chmod) def symlink_as(self,path,src,env=None): if not self.is_install:return if not path:return tgt=self.get_install_path(path,env) dir,name=os.path.split(tgt) Utils.check_dir(dir) if self.is_install>0: link=False if not os.path.islink(tgt): link=True elif os.readlink(tgt)!=src: link=True try:os.remove(tgt) except OSError:pass if link: info('* symlink %s (-> %s)'%(tgt,src)) os.symlink(src,tgt) return 0 else: try: info("* removing %s"%(tgt)) os.remove(tgt) return 0 except OSError: return 1 def exec_command(self,cmd,**kw): debug('runner: system command -> %s'%cmd) if self.log: self.log.write('%s\n'%cmd) kw['log']=self.log try: if not kw.get('cwd',None): kw['cwd']=self.cwd except AttributeError: self.cwd=kw['cwd']=self.bldnode.abspath() return Utils.exec_command(cmd,**kw) def printout(self,s): f=self.log or sys.stderr f.write(s) f.flush() def add_subdirs(self,dirs): self.recurse(dirs,'build') def pre_recurse(self,name_or_mod,path,nexdir): if not hasattr(self,'oldpath'): self.oldpath=[] self.oldpath.append(self.path) self.path=self.root.find_dir(nexdir) return{'bld':self,'ctx':self} def post_recurse(self,name_or_mod,path,nexdir): self.path=self.oldpath.pop() def pre_build(self): if hasattr(self,'pre_funs'): for m in self.pre_funs: m(self) def post_build(self): if hasattr(self,'post_funs'): for m in self.post_funs: m(self) def add_pre_fun(self,meth): try:self.pre_funs.append(meth) except AttributeError:self.pre_funs=[meth] def add_post_fun(self,meth): try:self.post_funs.append(meth) except AttributeError:self.post_funs=[meth] def use_the_magic(self): Task.algotype=Task.MAXPARALLEL Task.file_deps=Task.extract_deps libdesktop-agnostic-0.3.92/wafadmin/Environment.py0000644000175000017510000000715411226437331021512 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import os,copy,re import Logs,Options,Utils from Constants import* re_imp=re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$',re.M) class Environment(object): __slots__=("table","parent") def __init__(self,filename=None): self.table={} if filename: self.load(filename) def __contains__(self,key): if key in self.table:return True try:return self.parent.__contains__(key) except AttributeError:return False def __str__(self): keys=set() cur=self while cur: keys.update(cur.table.keys()) cur=getattr(cur,'parent',None) keys=list(keys) keys.sort() return"\n".join(["%r %r"%(x,self.__getitem__(x))for x in keys]) def __getitem__(self,key): try: while 1: x=self.table.get(key,None) if not x is None: return x self=self.parent except AttributeError: return[] def __setitem__(self,key,value): self.table[key]=value def __delitem__(self,key,value): del self.table[key] def set_variant(self,name): self.table[VARIANT]=name def variant(self): try: while 1: x=self.table.get(VARIANT,None) if not x is None: return x self=self.parent except AttributeError: return DEFAULT def copy(self): newenv=Environment() newenv.parent=self return newenv def get_flat(self,key): s=self[key] if isinstance(s,str):return s return' '.join(s) def _get_list_value_for_modification(self,key): try: value=self.table[key] except KeyError: try:value=self.parent[key] except AttributeError:value=[] if isinstance(value,list): value=copy.copy(value) else: value=[value] else: if not isinstance(value,list): value=[value] self.table[key]=value return value def append_value(self,var,value): current_value=self._get_list_value_for_modification(var) if isinstance(value,list): current_value.extend(value) else: current_value.append(value) def prepend_value(self,var,value): current_value=self._get_list_value_for_modification(var) if isinstance(value,list): current_value=value+current_value self.table[var]=current_value else: current_value.insert(0,value) def append_unique(self,var,value): current_value=self._get_list_value_for_modification(var) if isinstance(value,list): for value_item in value: if value_item not in current_value: current_value.append(value_item) else: if value not in current_value: current_value.append(value) def get_merged_dict(self): table_list=[] env=self while 1: table_list.insert(0,env.table) try:env=env.parent except AttributeError:break merged_table={} for table in table_list: merged_table.update(table) return merged_table def store(self,filename): file=open(filename,'w') merged_table=self.get_merged_dict() keys=list(merged_table.keys()) keys.sort() for k in keys:file.write('%s = %r\n'%(k,merged_table[k])) file.close() def load(self,filename): tbl=self.table code=Utils.readf(filename) for m in re_imp.finditer(code): g=m.group tbl[g(2)]=eval(g(3)) Logs.debug('env: %s'%str(self.table)) def get_destdir(self): if self.__getitem__('NOINSTALL'):return'' return Options.options.destdir def update(self,d): for k,v in d.iteritems(): self[k]=v def __getattr__(self,name): if name in self.__slots__: return object.__getattr__(self,name) else: return self[name] def __setattr__(self,name,value): if name in self.__slots__: object.__setattr__(self,name,value) else: self[name]=value def __detattr__(self,name): if name in self.__slots__: object.__detattr__(self,name) else: del self[name] libdesktop-agnostic-0.3.92/wafadmin/pproc.py0000644000175000017510000003471211226437332020332 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys mswindows=(sys.platform=="win32") import os import types import traceback import gc class CalledProcessError(Exception): def __init__(self,returncode,cmd): self.returncode=returncode self.cmd=cmd def __str__(self): return"Command '%s' returned non-zero exit status %d"%(self.cmd,self.returncode) if mswindows: import threading import msvcrt if 0: import pywintypes from win32api import GetStdHandle,STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE from win32api import GetCurrentProcess,DuplicateHandle,GetModuleFileName,GetVersion from win32con import DUPLICATE_SAME_ACCESS,SW_HIDE from win32pipe import CreatePipe from win32process import CreateProcess,STARTUPINFO,GetExitCodeProcess,STARTF_USESTDHANDLES,STARTF_USESHOWWINDOW,CREATE_NEW_CONSOLE from win32event import WaitForSingleObject,INFINITE,WAIT_OBJECT_0 else: from _subprocess import* class STARTUPINFO: dwFlags=0 hStdInput=None hStdOutput=None hStdError=None wShowWindow=0 class pywintypes: error=IOError else: import select import errno import fcntl import pickle __all__=["Popen","PIPE","STDOUT","call","check_call","CalledProcessError"] try: MAXFD=os.sysconf("SC_OPEN_MAX") except: MAXFD=256 try: False except NameError: False=0 True=1 _active=[] def _cleanup(): for inst in _active[:]: if inst.poll(_deadstate=sys.maxint)>=0: try: _active.remove(inst) except ValueError: pass PIPE=-1 STDOUT=-2 def call(*popenargs,**kwargs): return Popen(*popenargs,**kwargs).wait() def check_call(*popenargs,**kwargs): retcode=call(*popenargs,**kwargs) cmd=kwargs.get("args") if cmd is None: cmd=popenargs[0] if retcode: raise CalledProcessError(retcode,cmd) return retcode def list2cmdline(seq): result=[] needquote=False for arg in seq: bs_buf=[] if result: result.append(' ') needquote=(" "in arg)or("\t"in arg)or arg=="" if needquote: result.append('"') for c in arg: if c=='\\': bs_buf.append(c) elif c=='"': result.append('\\'*len(bs_buf)*2) bs_buf=[] result.append('\\"') else: if bs_buf: result.extend(bs_buf) bs_buf=[] result.append(c) if bs_buf: result.extend(bs_buf) if needquote: result.extend(bs_buf) result.append('"') return''.join(result) class Popen(object): def __init__(self,args,bufsize=0,executable=None,stdin=None,stdout=None,stderr=None,preexec_fn=None,close_fds=False,shell=False,cwd=None,env=None,universal_newlines=False,startupinfo=None,creationflags=0): _cleanup() self._child_created=False if not isinstance(bufsize,(int,long)): raise TypeError("bufsize must be an integer") if mswindows: if preexec_fn is not None: raise ValueError("preexec_fn is not supported on Windows platforms") if close_fds: raise ValueError("close_fds is not supported on Windows platforms") else: if startupinfo is not None: raise ValueError("startupinfo is only supported on Windows platforms") if creationflags!=0: raise ValueError("creationflags is only supported on Windows platforms") self.stdin=None self.stdout=None self.stderr=None self.pid=None self.returncode=None self.universal_newlines=universal_newlines (p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite)=self._get_handles(stdin,stdout,stderr) self._execute_child(args,executable,preexec_fn,close_fds,cwd,env,universal_newlines,startupinfo,creationflags,shell,p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite) if mswindows: if stdin is None and p2cwrite is not None: os.close(p2cwrite) p2cwrite=None if stdout is None and c2pread is not None: os.close(c2pread) c2pread=None if stderr is None and errread is not None: os.close(errread) errread=None if p2cwrite: self.stdin=os.fdopen(p2cwrite,'wb',bufsize) if c2pread: if universal_newlines: self.stdout=os.fdopen(c2pread,'rU',bufsize) else: self.stdout=os.fdopen(c2pread,'rb',bufsize) if errread: if universal_newlines: self.stderr=os.fdopen(errread,'rU',bufsize) else: self.stderr=os.fdopen(errread,'rb',bufsize) def _translate_newlines(self,data): data=data.replace("\r\n","\n") data=data.replace("\r","\n") return data def __del__(self,sys=sys): if not self._child_created: return self.poll(_deadstate=sys.maxint) if self.returncode is None and _active is not None: _active.append(self) def communicate(self,input=None): if[self.stdin,self.stdout,self.stderr].count(None)>=2: stdout=None stderr=None if self.stdin: if input: self.stdin.write(input) self.stdin.close() elif self.stdout: stdout=self.stdout.read() elif self.stderr: stderr=self.stderr.read() self.wait() return(stdout,stderr) return self._communicate(input) if mswindows: def _get_handles(self,stdin,stdout,stderr): if stdin is None and stdout is None and stderr is None: return(None,None,None,None,None,None) p2cread,p2cwrite=None,None c2pread,c2pwrite=None,None errread,errwrite=None,None if stdin is None: p2cread=GetStdHandle(STD_INPUT_HANDLE) if p2cread is not None: pass elif stdin is None or stdin==PIPE: p2cread,p2cwrite=CreatePipe(None,0) p2cwrite=p2cwrite.Detach() p2cwrite=msvcrt.open_osfhandle(p2cwrite,0) elif isinstance(stdin,int): p2cread=msvcrt.get_osfhandle(stdin) else: p2cread=msvcrt.get_osfhandle(stdin.fileno()) p2cread=self._make_inheritable(p2cread) if stdout is None: c2pwrite=GetStdHandle(STD_OUTPUT_HANDLE) if c2pwrite is not None: pass elif stdout is None or stdout==PIPE: c2pread,c2pwrite=CreatePipe(None,0) c2pread=c2pread.Detach() c2pread=msvcrt.open_osfhandle(c2pread,0) elif isinstance(stdout,int): c2pwrite=msvcrt.get_osfhandle(stdout) else: c2pwrite=msvcrt.get_osfhandle(stdout.fileno()) c2pwrite=self._make_inheritable(c2pwrite) if stderr is None: errwrite=GetStdHandle(STD_ERROR_HANDLE) if errwrite is not None: pass elif stderr is None or stderr==PIPE: errread,errwrite=CreatePipe(None,0) errread=errread.Detach() errread=msvcrt.open_osfhandle(errread,0) elif stderr==STDOUT: errwrite=c2pwrite elif isinstance(stderr,int): errwrite=msvcrt.get_osfhandle(stderr) else: errwrite=msvcrt.get_osfhandle(stderr.fileno()) errwrite=self._make_inheritable(errwrite) return(p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite) def _make_inheritable(self,handle): return DuplicateHandle(GetCurrentProcess(),handle,GetCurrentProcess(),0,1,DUPLICATE_SAME_ACCESS) def _find_w9xpopen(self): w9xpopen=os.path.join(os.path.dirname(GetModuleFileName(0)),"w9xpopen.exe") if not os.path.exists(w9xpopen): w9xpopen=os.path.join(os.path.dirname(sys.exec_prefix),"w9xpopen.exe") if not os.path.exists(w9xpopen): raise RuntimeError("Cannot locate w9xpopen.exe, which is needed for Popen to work with your shell or platform.") return w9xpopen def _execute_child(self,args,executable,preexec_fn,close_fds,cwd,env,universal_newlines,startupinfo,creationflags,shell,p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite): if not isinstance(args,types.StringTypes): args=list2cmdline(args) if startupinfo is None: startupinfo=STARTUPINFO() if None not in(p2cread,c2pwrite,errwrite): startupinfo.dwFlags|=STARTF_USESTDHANDLES startupinfo.hStdInput=p2cread startupinfo.hStdOutput=c2pwrite startupinfo.hStdError=errwrite if shell: startupinfo.dwFlags|=STARTF_USESHOWWINDOW startupinfo.wShowWindow=SW_HIDE comspec=os.environ.get("COMSPEC","cmd.exe") args=comspec+" /c "+args if(GetVersion()>=0x80000000L or os.path.basename(comspec).lower()=="command.com"): w9xpopen=self._find_w9xpopen() args='"%s" %s'%(w9xpopen,args) creationflags|=CREATE_NEW_CONSOLE try: hp,ht,pid,tid=CreateProcess(executable,args,None,None,1,creationflags,env,cwd,startupinfo) except pywintypes.error,e: raise WindowsError(*e.args) self._child_created=True self._handle=hp self.pid=pid ht.Close() if p2cread is not None: p2cread.Close() if c2pwrite is not None: c2pwrite.Close() if errwrite is not None: errwrite.Close() def poll(self,_deadstate=None): if self.returncode is None: if WaitForSingleObject(self._handle,0)==WAIT_OBJECT_0: self.returncode=GetExitCodeProcess(self._handle) return self.returncode def wait(self): if self.returncode is None: obj=WaitForSingleObject(self._handle,INFINITE) self.returncode=GetExitCodeProcess(self._handle) return self.returncode def _readerthread(self,fh,buffer): buffer.append(fh.read()) def _communicate(self,input): stdout=None stderr=None if self.stdout: stdout=[] stdout_thread=threading.Thread(target=self._readerthread,args=(self.stdout,stdout)) stdout_thread.setDaemon(True) stdout_thread.start() if self.stderr: stderr=[] stderr_thread=threading.Thread(target=self._readerthread,args=(self.stderr,stderr)) stderr_thread.setDaemon(True) stderr_thread.start() if self.stdin: if input is not None: self.stdin.write(input) self.stdin.close() if self.stdout: stdout_thread.join() if self.stderr: stderr_thread.join() if stdout is not None: stdout=stdout[0] if stderr is not None: stderr=stderr[0] if self.universal_newlines and hasattr(file,'newlines'): if stdout: stdout=self._translate_newlines(stdout) if stderr: stderr=self._translate_newlines(stderr) self.wait() return(stdout,stderr) else: def _get_handles(self,stdin,stdout,stderr): p2cread,p2cwrite=None,None c2pread,c2pwrite=None,None errread,errwrite=None,None if stdin is None: pass elif stdin==PIPE: p2cread,p2cwrite=os.pipe() elif isinstance(stdin,int): p2cread=stdin else: p2cread=stdin.fileno() if stdout is None: pass elif stdout==PIPE: c2pread,c2pwrite=os.pipe() elif isinstance(stdout,int): c2pwrite=stdout else: c2pwrite=stdout.fileno() if stderr is None: pass elif stderr==PIPE: errread,errwrite=os.pipe() elif stderr==STDOUT: errwrite=c2pwrite elif isinstance(stderr,int): errwrite=stderr else: errwrite=stderr.fileno() return(p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite) def _set_cloexec_flag(self,fd): try: cloexec_flag=fcntl.FD_CLOEXEC except AttributeError: cloexec_flag=1 old=fcntl.fcntl(fd,fcntl.F_GETFD) fcntl.fcntl(fd,fcntl.F_SETFD,old|cloexec_flag) def _close_fds(self,but): for i in xrange(3,MAXFD): if i==but: continue try: os.close(i) except: pass def _execute_child(self,args,executable,preexec_fn,close_fds,cwd,env,universal_newlines,startupinfo,creationflags,shell,p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite): if isinstance(args,types.StringTypes): args=[args] else: args=list(args) if shell: args=["/bin/sh","-c"]+args if executable is None: executable=args[0] errpipe_read,errpipe_write=os.pipe() self._set_cloexec_flag(errpipe_write) gc_was_enabled=gc.isenabled() gc.disable() try: self.pid=os.fork() except: if gc_was_enabled: gc.enable() raise self._child_created=True if self.pid==0: try: if p2cwrite: os.close(p2cwrite) if c2pread: os.close(c2pread) if errread: os.close(errread) os.close(errpipe_read) if p2cread: os.dup2(p2cread,0) if c2pwrite: os.dup2(c2pwrite,1) if errwrite: os.dup2(errwrite,2) if p2cread and p2cread not in(0,): os.close(p2cread) if c2pwrite and c2pwrite not in(p2cread,1): os.close(c2pwrite) if errwrite and errwrite not in(p2cread,c2pwrite,2): os.close(errwrite) if close_fds: self._close_fds(but=errpipe_write) if cwd is not None: os.chdir(cwd) if preexec_fn: apply(preexec_fn) if env is None: os.execvp(executable,args) else: os.execvpe(executable,args,env) except: exc_type,exc_value,tb=sys.exc_info() exc_lines=traceback.format_exception(exc_type,exc_value,tb) exc_value.child_traceback=''.join(exc_lines) os.write(errpipe_write,pickle.dumps(exc_value)) os._exit(255) if gc_was_enabled: gc.enable() os.close(errpipe_write) if p2cread and p2cwrite: os.close(p2cread) if c2pwrite and c2pread: os.close(c2pwrite) if errwrite and errread: os.close(errwrite) data=os.read(errpipe_read,1048576) os.close(errpipe_read) if data!="": os.waitpid(self.pid,0) child_exception=pickle.loads(data) raise child_exception def _handle_exitstatus(self,sts): if os.WIFSIGNALED(sts): self.returncode=-os.WTERMSIG(sts) elif os.WIFEXITED(sts): self.returncode=os.WEXITSTATUS(sts) else: raise RuntimeError("Unknown child exit status!") def poll(self,_deadstate=None): if self.returncode is None: try: pid,sts=os.waitpid(self.pid,os.WNOHANG) if pid==self.pid: self._handle_exitstatus(sts) except os.error: if _deadstate is not None: self.returncode=_deadstate return self.returncode def wait(self): if self.returncode is None: pid,sts=os.waitpid(self.pid,0) self._handle_exitstatus(sts) return self.returncode def _communicate(self,input): read_set=[] write_set=[] stdout=None stderr=None if self.stdin: self.stdin.flush() if input: write_set.append(self.stdin) else: self.stdin.close() if self.stdout: read_set.append(self.stdout) stdout=[] if self.stderr: read_set.append(self.stderr) stderr=[] input_offset=0 while read_set or write_set: rlist,wlist,xlist=select.select(read_set,write_set,[]) if self.stdin in wlist: bytes_written=os.write(self.stdin.fileno(),buffer(input,input_offset,512)) input_offset+=bytes_written if input_offset>=len(input): self.stdin.close() write_set.remove(self.stdin) if self.stdout in rlist: data=os.read(self.stdout.fileno(),1024) if data=="": self.stdout.close() read_set.remove(self.stdout) stdout.append(data) if self.stderr in rlist: data=os.read(self.stderr.fileno(),1024) if data=="": self.stderr.close() read_set.remove(self.stderr) stderr.append(data) if stdout is not None: stdout=''.join(stdout) if stderr is not None: stderr=''.join(stderr) if self.universal_newlines and hasattr(file,'newlines'): if stdout: stdout=self._translate_newlines(stdout) if stderr: stderr=self._translate_newlines(stderr) self.wait() return(stdout,stderr) libdesktop-agnostic-0.3.92/wafadmin/Task.py0000644000175000017510000004612711226437331020113 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import os,shutil,sys,re,random,datetime from Utils import md5 import Build,Runner,Utils,Node,Logs,Options from Logs import debug,warn,error from Constants import* algotype=NORMAL COMPILE_TEMPLATE_SHELL=''' def f(task): env = task.env wd = getattr(task, 'cwd', None) p = env.get_flat cmd = \'\'\' %s \'\'\' % s return task.exec_command(cmd, cwd=wd) ''' COMPILE_TEMPLATE_NOSHELL=''' def f(task): env = task.env wd = getattr(task, 'cwd', None) def to_list(xx): if isinstance(xx, str): return [xx] return xx lst = [] %s lst = [x for x in lst if x] return task.exec_command(lst, cwd=wd) ''' file_deps=Utils.nada class TaskManager(object): def __init__(self): self.groups=[] self.tasks_done=[] self.current_group=0 self.groups_names={} def get_next_set(self): ret=None while not ret and self.current_group0: self.set_order(keys[i],keys[j]) elif val<0: self.set_order(keys[j],keys[i]) def tasks_in_parallel(self): if not self.ready:self.prepare() keys=self.cstr_groups.keys() unconnected=[] remainder=[] for u in keys: for k in self.cstr_order.values(): if u in k: remainder.append(u) break else: unconnected.append(u) toreturn=[] for y in unconnected: toreturn.extend(self.cstr_groups[y]) for y in unconnected: try:self.cstr_order.__delitem__(y) except KeyError:pass self.cstr_groups.__delitem__(y) if not toreturn and remainder: raise Utils.WafError("circular order constraint detected %r"%remainder) return toreturn def tasks_by_max_jobs(self): if not self.ready:self.prepare() if not self.temp_tasks:self.temp_tasks=self.tasks_in_parallel() if not self.temp_tasks:return(None,None) maxjobs=MAXJOBS ret=[] remaining=[] for t in self.temp_tasks: m=getattr(t,"maxjobs",getattr(self.__class__,"maxjobs",MAXJOBS)) if m>maxjobs: remaining.append(t) elif m task failed (err #%d): %r"%(self.err_code,self) except AttributeError: return" -> task failed: %r"%self elif self.hasrun==MISSING: return" -> missing files: %r"%self else: return'' def install(self): bld=self.generator.bld d=self.attr('install') if self.attr('install_path'): lst=[a.relpath_gen(bld.srcnode)for a in self.outputs] perm=self.attr('chmod',O644) if self.attr('src'): lst+=[a.relpath_gen(bld.srcnode)for a in self.inputs] if self.attr('filename'): dir=self.install_path.rstrip(os.sep)+os.sep+self.attr('filename') bld.install_as(dir,lst[0],self.env,perm) else: bld.install_files(self.install_path,lst,self.env,perm) class Task(TaskBase): vars=[] def __init__(self,env,**kw): TaskBase.__init__(self,**kw) self.env=env self.inputs=[] self.outputs=[] self.deps_nodes=[] self.run_after=[] def __str__(self): env=self.env src_str=' '.join([a.nice_path(env)for a in self.inputs]) tgt_str=' '.join([a.nice_path(env)for a in self.outputs]) if self.outputs:sep=' -> ' else:sep='' return'%s: %s%s%s\n'%(self.__class__.__name__.replace('_task',''),src_str,sep,tgt_str) def __repr__(self): return"".join(['\n\t{task: ',self.__class__.__name__," ",",".join([x.name for x in self.inputs])," -> ",",".join([x.name for x in self.outputs]),'}']) def unique_id(self): try: return self.uid except AttributeError: m=md5() up=m.update up(self.__class__.__name__) up(self.env.variant()) p=None for x in self.inputs+self.outputs: if p!=x.parent.id: p=x.parent.id up(x.parent.abspath()) up(x.name) self.uid=m.digest() return self.uid def set_inputs(self,inp): if isinstance(inp,list):self.inputs+=inp else:self.inputs.append(inp) def set_outputs(self,out): if isinstance(out,list):self.outputs+=out else:self.outputs.append(out) def set_run_after(self,task): assert isinstance(task,TaskBase) self.run_after.append(task) def add_file_dependency(self,filename): node=self.generator.bld.current.find_resource(filename) self.deps_nodes.append(node) def signature(self): try:return self.cache_sig[0] except AttributeError:pass m=md5() exp_sig=self.sig_explicit_deps() m.update(exp_sig) imp_sig=self.scan and self.sig_implicit_deps()or SIG_NIL m.update(imp_sig) var_sig=self.sig_vars() m.update(var_sig) ret=m.digest() self.cache_sig=(ret,exp_sig,imp_sig,var_sig) return ret def runnable_status(self): if self.inputs and(not self.outputs): if not getattr(self.__class__,'quiet',None): warn("invalid task (no inputs OR outputs): override in a Task subclass or set the attribute 'quiet' %r"%self) for t in self.run_after: if not t.hasrun: return ASK_LATER env=self.env bld=self.generator.bld try: new_sig=self.signature() except KeyError: debug("task: something is wrong, computing the task %r signature failed"%self) return RUN_ME key=self.unique_id() try: prev_sig=bld.task_sigs[key][0] except KeyError: debug("task: task %r must run as it was never run before or the task code changed"%self) return RUN_ME try: for node in self.outputs: variant=node.variant(env) if bld.node_sigs[variant][node.id]!=new_sig: return RUN_ME except KeyError: debug("task: task %r must run as the output nodes do not exist"%self) return RUN_ME if Logs.verbose:self.debug_why(bld.task_sigs[key]) if new_sig!=prev_sig: return RUN_ME return SKIP_ME def post_run(self): bld=self.generator.bld env=self.env sig=self.signature() cnt=0 variant=env.variant() for node in self.outputs: try: os.stat(node.abspath(env)) except OSError: self.has_run=MISSING self.err_msg='-> missing file: %r'%node.abspath(env) raise Utils.WafError bld.node_sigs[variant][node.id]=sig if Options.cache_global: ssig=sig.encode('hex') dest=os.path.join(Options.cache_global,'%s_%d_%s'%(ssig,cnt,node.name)) try:shutil.copy2(node.abspath(env),dest) except IOError:warn('Could not write the file to the cache') cnt+=1 bld.task_sigs[self.unique_id()]=self.cache_sig def can_retrieve_cache(self): if not Options.cache_global:return None if Options.options.nocache:return None if not self.outputs:return None env=self.env sig=self.signature() cnt=0 for node in self.outputs: variant=node.variant(env) ssig=sig.encode('hex') orig=os.path.join(Options.cache_global,'%s_%d_%s'%(ssig,cnt,node.name)) try: shutil.copy2(orig,node.abspath(env)) os.utime(orig,None) except(OSError,IOError): debug('task: failed retrieving file') return None else: cnt+=1 for node in self.outputs: self.generator.bld.node_sigs[variant][node.id]=sig self.generator.bld.printout('restoring from cache %r\n'%node.bldpath(env)) return 1 def debug_why(self,old_sigs): new_sigs=self.cache_sig def v(x): return x.encode('hex') debug("Task %r"%self) msgs=['Task must run','* Source file or manual dependency','* Implicit dependency','* Environment variable'] tmp='task: -> %s: %s %s' for x in xrange(len(msgs)): if(new_sigs[x]!=old_sigs[x]): debug(tmp%(msgs[x],v(old_sigs[x]),v(new_sigs[x]))) def sig_explicit_deps(self): bld=self.generator.bld m=md5() for x in self.inputs+getattr(self,'dep_nodes',[]): if not x.parent.id in bld.cache_scanned_folders: bld.rescan(x.parent) variant=x.variant(self.env) m.update(bld.node_sigs[variant][x.id]) if bld.deps_man: additional_deps=bld.deps_man for x in self.inputs+self.outputs: try: d=additional_deps[x.id] except KeyError: continue for v in d: if isinstance(v,Node.Node): bld.rescan(v.parent) variant=v.variant(self.env) try: v=bld.node_sigs[variant][v.id] except KeyError: v='' elif hasattr(v,'__call__'): v=v() m.update(v) return m.digest() def sig_vars(self): m=md5() bld=self.generator.bld env=self.env act_sig=bld.hash_env_vars(env,self.__class__.vars) m.update(act_sig) dep_vars=getattr(self,'dep_vars',None) if dep_vars: m.update(bld.hash_env_vars(env,dep_vars)) return m.digest() scan=None def sig_implicit_deps(self): bld=self.generator.bld key=self.unique_id() prev_sigs=bld.task_sigs.get(key,()) if prev_sigs: try: if prev_sigs[2]==self.compute_sig_implicit_deps(): return prev_sigs[2] except(KeyError,OSError): pass (nodes,names)=self.scan() if Logs.verbose: debug('deps: scanner for %s returned %s %s'%(str(self),str(nodes),str(names))) bld.node_deps[key]=nodes bld.raw_deps[key]=names sig=self.compute_sig_implicit_deps() return sig def compute_sig_implicit_deps(self): m=md5() upd=m.update bld=self.generator.bld tstamp=bld.node_sigs env=self.env for k in bld.node_deps.get(self.unique_id(),[]): if not k.parent.id in bld.cache_scanned_folders: bld.rescan(k.parent) if k.id&3==2: upd(tstamp[0][k.id]) else: upd(tstamp[env.variant()][k.id]) return m.digest() def funex(c): dc={} exec(c,dc) return dc['f'] reg_act=re.compile(r"(?P\\)|(?P\$\$)|(?P\$\{(?P\w+)(?P.*?)\})",re.M) def compile_fun_shell(name,line): extr=[] def repl(match): g=match.group if g('dollar'):return"$" elif g('backslash'):return'\\\\' elif g('subst'):extr.append((g('var'),g('code')));return"%s" return None line=reg_act.sub(repl,line) parm=[] dvars=[] app=parm.append for(var,meth)in extr: if var=='SRC': if meth:app('task.inputs%s'%meth) else:app('" ".join([a.srcpath(env) for a in task.inputs])') elif var=='TGT': if meth:app('task.outputs%s'%meth) else:app('" ".join([a.bldpath(env) for a in task.outputs])') else: if not var in dvars:dvars.append(var) app("p('%s')"%var) if parm:parm="%% (%s) "%(',\n\t\t'.join(parm)) else:parm='' c=COMPILE_TEMPLATE_SHELL%(line,parm) debug('action: %s'%c) return(funex(c),dvars) def compile_fun_noshell(name,line): extr=[] def repl(match): g=match.group if g('dollar'):return"$" elif g('subst'):extr.append((g('var'),g('code')));return"<<|@|>>" return None line2=reg_act.sub(repl,line) params=line2.split('<<|@|>>') buf=[] dvars=[] app=buf.append for x in xrange(len(extr)): params[x]=params[x].strip() if params[x]: app("lst.extend(%r)"%params[x].split()) (var,meth)=extr[x] if var=='SRC': if meth:app('lst.append(task.inputs%s)'%meth) else:app("lst.extend([a.srcpath(env) for a in task.inputs])") elif var=='TGT': if meth:app('lst.append(task.outputs%s)'%meth) else:app("lst.extend([a.bldpath(env) for a in task.outputs])") else: app('lst.extend(to_list(env[%r]))'%var) if not var in dvars:dvars.append(var) if extr: if params[-1]: app("lst.extend(%r)"%params[-1].split()) fun=COMPILE_TEMPLATE_NOSHELL%"\n\t".join(buf) debug('action: %s'%fun) return(funex(fun),dvars) def compile_fun(name,line,shell=None): if line.find('<')>0 or line.find('>')>0 or line.find('&&')>0: shell=True if shell is None: if sys.platform=='win32': shell=False else: shell=True if shell: return compile_fun_shell(name,line) else: return compile_fun_noshell(name,line) def simple_task_type(name,line,color='GREEN',vars=[],ext_in=[],ext_out=[],before=[],after=[],shell=None): (fun,dvars)=compile_fun(name,line,shell) fun.code=line return task_type_from_func(name,fun,vars or dvars,color,ext_in,ext_out,before,after) def task_type_from_func(name,func,vars=[],color='GREEN',ext_in=[],ext_out=[],before=[],after=[]): params={'run':func,'vars':vars,'color':color,'name':name,'ext_in':Utils.to_list(ext_in),'ext_out':Utils.to_list(ext_out),'before':Utils.to_list(before),'after':Utils.to_list(after),} cls=type(Task)(name,(Task,),params) TaskBase.classes[name]=cls return cls def always_run(cls): old=cls.runnable_status def always(self): old(self) return RUN_ME cls.runnable_status=always def update_outputs(cls): old_post_run=cls.post_run def post_run(self): old_post_run(self) bld=self.outputs[0].__class__.bld bld.node_sigs[self.env.variant()][self.outputs[0].id]=Utils.h_file(self.outputs[0].abspath(self.env)) cls.post_run=post_run def extract_outputs(tasks): v={} for x in tasks: try: (ins,outs)=v[x.env.variant()] except KeyError: ins={} outs={} v[x.env.variant()]=(ins,outs) for a in getattr(x,'inputs',[]): try:ins[a.id].append(x) except KeyError:ins[a.id]=[x] for a in getattr(x,'outputs',[]): try:outs[a.id].append(x) except KeyError:outs[a.id]=[x] for(ins,outs)in v.values(): links=set(ins.iterkeys()).intersection(outs.iterkeys()) for k in links: for a in ins[k]: for b in outs[k]: a.set_run_after(b) def extract_deps(tasks): extract_outputs(tasks) out_to_task={} for x in tasks: v=x.env.variant() try: lst=x.outputs except AttributeError: pass else: for node in lst: out_to_task[(v,node.id)]=x dep_to_task={} for x in tasks: try: x.signature() except: pass variant=x.env.variant() key=x.unique_id() for k in x.generator.bld.node_deps.get(x.unique_id(),[]): try:dep_to_task[(v,k.id)].append(x) except KeyError:dep_to_task[(v,k.id)]=[x] deps=set(dep_to_task.keys()).intersection(set(out_to_task.keys())) for idx in deps: for k in dep_to_task[idx]: k.set_run_after(out_to_task[idx]) for x in tasks: try: delattr(x,'cache_sig') except AttributeError: pass libdesktop-agnostic-0.3.92/wafadmin/Logs.py0000644000175000017510000000455611226437331020115 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,re,logging,traceback,sys from Constants import* zones='' verbose=0 colors_lst={'USE':True,'BOLD':'\x1b[01;1m','RED':'\x1b[01;91m','GREEN':'\x1b[32m','YELLOW':'\x1b[33m','PINK':'\x1b[35m','BLUE':'\x1b[01;34m','CYAN':'\x1b[36m','NORMAL':'\x1b[0m','cursor_on':'\x1b[?25h','cursor_off':'\x1b[?25l',} got_tty=not os.environ.get('TERM','dumb')in['dumb','emacs'] if got_tty: try: got_tty=sys.stderr.isatty() except AttributeError: got_tty=False import Utils if not got_tty or sys.platform=='win32'or'NOCOLOR'in os.environ: colors_lst['USE']=False def get_color(cl): if not colors_lst['USE']:return'' return colors_lst.get(cl,'') class foo(object): def __getattr__(self,a): return get_color(a) def __call__(self,a): return get_color(a) colors=foo() re_log=re.compile(r'(\w+): (.*)',re.M) class log_filter(logging.Filter): def __init__(self,name=None): pass def filter(self,rec): rec.c1=colors.PINK rec.c2=colors.NORMAL rec.zone=rec.module if rec.levelno>=logging.INFO: if rec.levelno>=logging.ERROR: rec.c1=colors.RED elif rec.levelno>=logging.WARNING: rec.c1=colors.YELLOW else: rec.c1=colors.GREEN return True zone='' m=re_log.match(rec.msg) if m: zone=rec.zone=m.group(1) rec.msg=m.group(2) if zones: return getattr(rec,'zone','')in zones or'*'in zones elif not verbose>2: return False return True class formatter(logging.Formatter): def __init__(self): logging.Formatter.__init__(self,LOG_FORMAT,HOUR_FORMAT) def format(self,rec): if rec.levelno>=logging.WARNING or rec.levelno==logging.INFO: return'%s%s%s'%(rec.c1,rec.msg.decode('utf-8'),rec.c2) return logging.Formatter.format(self,rec) def debug(msg): if verbose: msg=msg.replace('\n',' ') logging.debug(msg) def error(msg): logging.error(msg) if verbose>1: if isinstance(msg,Utils.WafError): st=msg.stack else: st=traceback.extract_stack() if st: st=st[:-1] buf=[] for filename,lineno,name,line in st: buf.append(' File "%s", line %d, in %s'%(filename,lineno,name)) if line: buf.append(' %s'%line.strip()) if buf:logging.error("\n".join(buf)) warn=logging.warn info=logging.info def init_log(): log=logging.getLogger() log.handlers=[] hdlr=logging.StreamHandler() hdlr.setFormatter(formatter()) log.addHandler(hdlr) log.addFilter(log_filter()) log.setLevel(logging.DEBUG) libdesktop-agnostic-0.3.92/wafadmin/Utils.py0000644000175000017510000002615511226437331020310 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import sys if sys.hexversion < 0x020400f0: from sets import Set as set import os,sys,imp,string,errno,traceback,inspect,re,shutil,datetime,gc try:from UserDict import UserDict except ImportError:from collections import UserDict if sys.hexversion>=0x2060000 or os.name=='java': import subprocess as pproc else: import pproc import Logs from Constants import* is_win32=sys.platform=='win32' try: from collections import defaultdict as DefaultDict except ImportError: class DefaultDict(dict): def __init__(self,default_factory): super(DefaultDict,self).__init__() self.default_factory=default_factory def __getitem__(self,key): try: return super(DefaultDict,self).__getitem__(key) except KeyError: value=self.default_factory() self[key]=value return value class WafError(Exception): def __init__(self,*args): self.args=args self.stack=traceback.extract_stack() Exception.__init__(self,*args) def __str__(self): return str(len(self.args)==1 and self.args[0]or self.args) class WscriptError(WafError): def __init__(self,message,wscript_file=None): if wscript_file: self.wscript_file=wscript_file self.wscript_line=None else: (self.wscript_file,self.wscript_line)=self.locate_error() msg_file_line='' if self.wscript_file: msg_file_line="%s:"%self.wscript_file if self.wscript_line: msg_file_line+="%s:"%self.wscript_line err_message="%s error: %s"%(msg_file_line,message) WafError.__init__(self,err_message) def locate_error(self): stack=traceback.extract_stack() stack.reverse() for frame in stack: file_name=os.path.basename(frame[0]) is_wscript=(file_name==WSCRIPT_FILE or file_name==WSCRIPT_BUILD_FILE) if is_wscript: return(frame[0],frame[1]) return(None,None) indicator=is_win32 and'\x1b[A\x1b[K%s%s%s\r'or'\x1b[K%s%s%s\r' try: from fnv import new as md5 import Constants Constants.SIG_NIL='signofnv' def h_file(filename): m=md5() try: m.hfile(filename) x=m.digest() if x is None:raise OSError("not a file") return x except SystemError: raise OSError("not a file"+filename) except ImportError: try: from hashlib import md5 except ImportError: from md5 import md5 def h_file(filename): f=open(filename,'rb') m=md5() readBytes=100000 while(filename): filename=f.read(100000) m.update(filename) f.close() return m.digest() class ordered_dict(UserDict): def __init__(self,dict=None): self.allkeys=[] UserDict.__init__(self,dict) def __delitem__(self,key): self.allkeys.remove(key) UserDict.__delitem__(self,key) def __setitem__(self,key,item): if key not in self.allkeys:self.allkeys.append(key) UserDict.__setitem__(self,key,item) def exec_command(s,**kw): if'log'in kw: kw['stdout']=kw['stderr']=kw['log'] del(kw['log']) kw['shell']=isinstance(s,str) try: proc=pproc.Popen(s,**kw) return proc.wait() except OSError: return-1 if is_win32: old_log=exec_command def exec_command(s,**kw): if len(s)<2000:return old_log(s,**kw) if'log'in kw: kw['stdout']=kw['stderr']=kw['log'] del(kw['log']) kw['shell']=isinstance(s,str) startupinfo=pproc.STARTUPINFO() startupinfo.dwFlags|=pproc.STARTF_USESHOWWINDOW kw['startupinfo']=startupinfo proc=pproc.Popen(s,**kw) return proc.wait() listdir=os.listdir if is_win32: def listdir_win32(s): if re.match('^[A-Za-z]:$',s): s+=os.sep if not os.path.isdir(s): e=OSError() e.errno=errno.ENOENT raise e return os.listdir(s) listdir=listdir_win32 def waf_version(mini=0x010000,maxi=0x100000): ver=HEXVERSION try:min_val=mini+0 except TypeError:min_val=int(mini.replace('.','0'),16) if min_val>ver: Logs.error("waf version should be at least %s (%s found)"%(mini,ver)) sys.exit(0) try:max_val=maxi+0 except TypeError:max_val=int(maxi.replace('.','0'),16) if max_val= 2.3 but the raw source requires Python 2.4") def ex_stack(): exc_type,exc_value,tb=sys.exc_info() exc_lines=traceback.format_exception(exc_type,exc_value,tb) return''.join(exc_lines) def to_list(sth): if isinstance(sth,str): return sth.split() else: return sth g_loaded_modules={} g_module=None def load_module(file_path,name=WSCRIPT_FILE): try: return g_loaded_modules[file_path] except KeyError: pass module=imp.new_module(name) try: code=readf(file_path,m='rU') except(IOError,OSError): raise WscriptError('The file %s could not be opened!'%file_path) module.waf_hash_val=code module_dir=os.path.dirname(file_path) sys.path.insert(0,module_dir) exec(code,module.__dict__) sys.path.remove(module_dir) g_loaded_modules[file_path]=module return module def set_main_module(file_path): global g_module g_module=load_module(file_path,'wscript_main') g_module.root_path=file_path def to_hashtable(s): tbl={} lst=s.split('\n') for line in lst: if not line:continue mems=line.split('=') tbl[mems[0]]=mems[1] return tbl def get_term_cols(): return 80 try: import struct,fcntl,termios except ImportError: pass else: if Logs.got_tty: def myfun(): dummy_lines,cols=struct.unpack("HHHH",fcntl.ioctl(sys.stderr.fileno(),termios.TIOCGWINSZ,struct.pack("HHHH",0,0,0,0)))[:2] return cols try: myfun() except IOError: pass else: get_term_cols=myfun rot_idx=0 rot_chr=['\\','|','/','-'] def split_path(path): return path.split('/') def split_path_cygwin(path): if path.startswith('//'): ret=path.split('/')[2:] ret[0]='/'+ret[0] return ret return path.split('/') re_sp=re.compile('[/\\\\]') def split_path_win32(path): if path.startswith('\\\\'): ret=re.split(re_sp,path)[2:] ret[0]='\\'+ret[0] return ret return re.split(re_sp,path) if sys.platform=='cygwin': split_path=split_path_cygwin elif is_win32: split_path=split_path_win32 def copy_attrs(orig,dest,names,only_if_set=False): for a in to_list(names): u=getattr(orig,a,()) if u or not only_if_set: setattr(dest,a,u) def def_attrs(cls,**kw): ''' set attributes for class. @param cls [any class]: the class to update the given attributes in. @param kw [dictionary]: dictionary of attributes names and values. if the given class hasn't one (or more) of these attributes, add the attribute with its value to the class. ''' for k,v in kw.iteritems(): if not hasattr(cls,k): setattr(cls,k,v) quote_define_name_table=None def quote_define_name(path): global quote_define_name_table if not quote_define_name_table: invalid_chars=set([chr(x)for x in xrange(256)])-set(string.digits+string.uppercase) quote_define_name_table=string.maketrans(''.join(invalid_chars),'_'*len(invalid_chars)) return string.translate(string.upper(path),quote_define_name_table) def quote_whitespace(path): return(path.strip().find(' ')>0 and'"%s"'%path or path).replace('""','"') def trimquotes(s): if not s:return'' s=s.rstrip() if s[0]=="'"and s[-1]=="'":return s[1:-1] return s def h_list(lst): m=md5() m.update(str(lst)) return m.digest() def h_fun(fun): try: return fun.code except AttributeError: try: h=inspect.getsource(fun) except IOError: h="nocode" try: fun.code=h except AttributeError: pass return h def pprint(col,str,label='',sep=os.linesep): sys.stderr.write("%s%s%s %s%s"%(Logs.colors(col),str,Logs.colors.NORMAL,label,sep)) def check_dir(dir): try: os.stat(dir) except OSError: try: os.makedirs(dir) except OSError,e: raise WafError("Cannot create folder '%s' (original error: %s)"%(dir,e)) def cmd_output(cmd,**kw): silent=False if'silent'in kw: silent=kw['silent'] del(kw['silent']) if'e'in kw: tmp=kw['e'] del(kw['e']) kw['env']=tmp kw['shell']=isinstance(cmd,str) kw['stdout']=pproc.PIPE if silent: kw['stderr']=pproc.PIPE try: p=pproc.Popen(cmd,**kw) output=p.communicate()[0] except OSError,e: raise ValueError(str(e)) if p.returncode: if not silent: msg="command execution failed: %s -> %r"%(cmd,str(output)) raise ValueError(msg) output='' return output reg_subst=re.compile(r"(\\\\)|(\$\$)|\$\{([^}]+)\}") def subst_vars(expr,params): def repl_var(m): if m.group(1): return'\\' if m.group(2): return'$' try: return params.get_flat(m.group(3)) except AttributeError: return params[m.group(3)] return reg_subst.sub(repl_var,expr) def detect_platform(): s=sys.platform for x in'cygwin linux irix sunos hpux aix darwin'.split(): if s.find(x)>=0: return x if os.name in'posix java os2'.split(): return os.name return s def load_tool(tool,tooldir=None): if tooldir: assert isinstance(tooldir,list) sys.path=tooldir+sys.path try: try: return __import__(tool) except ImportError,e: raise WscriptError(e) finally: if tooldir: for d in tooldir: sys.path.remove(d) def readf(fname,m='r'): f=None try: f=open(fname,m) txt=f.read() finally: if f:f.close() return txt def nada(*k,**kw): pass def diff_path(top,subdir): top=os.path.normpath(top).replace('\\','/').split('/') subdir=os.path.normpath(subdir).replace('\\','/').split('/') if len(top)==len(subdir):return'' diff=subdir[len(top)-len(subdir):] return os.path.join(*diff) class Context(object): def set_curdir(self,dir): self.curdir_=dir def get_curdir(self): try: return self.curdir_ except AttributeError: self.curdir_=os.getcwd() return self.get_curdir() curdir=property(get_curdir,set_curdir) def recurse(self,dirs,name=''): if not name: name=inspect.stack()[1][3] if isinstance(dirs,str): dirs=to_list(dirs) for x in dirs: if os.path.isabs(x): nexdir=x else: nexdir=os.path.join(self.curdir,x) base=os.path.join(nexdir,WSCRIPT_FILE) try: txt=readf(base+'_'+name,m='rU') except(OSError,IOError): try: module=load_module(base) except OSError: raise WscriptError('No such script %s'%base) try: f=module.__dict__[name] except KeyError: raise WscriptError('No function %s defined in %s'%(name,base)) if getattr(self.__class__,'pre_recurse',None): self.pre_recurse(f,base,nexdir) old=self.curdir self.curdir=nexdir try: f(self) finally: self.curdir=old if getattr(self.__class__,'post_recurse',None): self.post_recurse(module,base,nexdir) else: dc={'ctx':self} if getattr(self.__class__,'pre_recurse',None): dc=self.pre_recurse(txt,base+'_'+name,nexdir) old=self.curdir self.curdir=nexdir try: exec(txt,dc) finally: self.curdir=old if getattr(self.__class__,'post_recurse',None): self.post_recurse(txt,base+'_'+name,nexdir) if is_win32: old=shutil.copy2 def copy2(src,dst): old(src,dst) shutil.copystat(src,src) setattr(shutil,'copy2',copy2) def get_elapsed_time(start): delta=datetime.datetime.now()-start days=int(delta.days) hours=int(delta.seconds/3600) minutes=int((delta.seconds-hours*3600)/60) seconds=delta.seconds-hours*3600-minutes*60+float(delta.microseconds)/1000/1000 result='' if days: result+='%dd'%days if days or hours: result+='%dh'%hours if days or hours or minutes: result+='%dm'%minutes return'%s%.3fs'%(result,seconds) if os.name=='java': try: gc.disable() gc.enable() except NotImplementedError: gc.disable=gc.enable libdesktop-agnostic-0.3.92/wafadmin/Configure.py0000644000175000017510000001424611226437331021127 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,shlex,sys,time try:import cPickle except ImportError:import pickle as cPickle import Environment,Utils,Options from Logs import warn from Constants import* conf_template='''# project %(app)s configured on %(now)s by # waf %(wafver)s (abi %(abi)s, python %(pyver)x on %(systype)s) # using %(args)s # ''' class ConfigurationError(Utils.WscriptError): pass autoconfig=False def find_file(filename,path_list): for directory in Utils.to_list(path_list): if os.path.exists(os.path.join(directory,filename)): return directory return'' def find_program_impl(env,filename,path_list=[],var=None,environ=None): if not environ: environ=os.environ try:path_list=path_list.split() except AttributeError:pass if var: if var in environ:env[var]=environ[var] if env[var]:return env[var] if not path_list:path_list=environ.get('PATH','').split(os.pathsep) ext=(Options.platform=='win32')and'.exe,.com,.bat,.cmd'or'' for y in[filename+x for x in ext.split(',')]: for directory in path_list: x=os.path.join(directory,y) if os.path.isfile(x): if var:env[var]=x return x return'' class ConfigurationContext(Utils.Context): tests={} error_handlers=[] def __init__(self,env=None,blddir='',srcdir=''): self.env=None self.envname='' self.environ=dict(os.environ) self.line_just=40 self.blddir=blddir self.srcdir=srcdir self.all_envs={} self.cwd=self.curdir=os.getcwd() self.tools=[] self.setenv(DEFAULT) self.lastprog='' self.hash=0 self.files=[] self.tool_cache=[] if self.blddir: self.post_init() def post_init(self): self.cachedir=os.path.join(self.blddir,CACHE_DIR) path=os.path.join(self.blddir,WAF_CONFIG_LOG) try:os.unlink(path) except(OSError,IOError):pass self.log=open(path,'w') app=getattr(Utils.g_module,'APPNAME','') if app: ver=getattr(Utils.g_module,'VERSION','') if ver: app="%s (%s)"%(app,ver) now=time.ctime() pyver=sys.hexversion systype=sys.platform args=" ".join(sys.argv) wafver=WAFVERSION abi=ABI self.log.write(conf_template%vars()) def __del__(self): if hasattr(self,'log')and self.log: self.log.close() def fatal(self,msg): raise ConfigurationError(msg) def check_tool(self,input,tooldir=None,funs=None): tools=Utils.to_list(input) if tooldir:tooldir=Utils.to_list(tooldir) for tool in tools: tool=tool.replace('++','xx') if tool=='java':tool='javaw' mag=(tool,id(self.env),funs) if mag in self.tool_cache: continue self.tool_cache.append(mag) module=Utils.load_tool(tool,tooldir) func=getattr(module,'detect',None) if func: if type(func)is type(find_file):func(self) else:self.eval_rules(funs or func) self.tools.append({'tool':tool,'tooldir':tooldir,'funs':funs}) def sub_config(self,k): self.recurse(k,name='configure') def pre_recurse(self,name_or_mod,path,nexdir): return{'conf':self,'ctx':self} def post_recurse(self,name_or_mod,path,nexdir): if not autoconfig: return self.hash=hash((self.hash,getattr(name_or_mod,'waf_hash_val',name_or_mod))) self.files.append(path) def store(self,file=''): if not os.path.isdir(self.cachedir): os.makedirs(self.cachedir) if not file: file=open(os.path.join(self.cachedir,'build.config.py'),'w') file.write('version = 0x%x\n'%HEXVERSION) file.write('tools = %r\n'%self.tools) file.close() if not self.all_envs: self.fatal('nothing to store in the configuration context!') for key in self.all_envs: tmpenv=self.all_envs[key] tmpenv.store(os.path.join(self.cachedir,key+CACHE_SUFFIX)) def set_env_name(self,name,env): self.all_envs[name]=env return env def retrieve(self,name,fromenv=None): try: env=self.all_envs[name] except KeyError: env=Environment.Environment() env['PREFIX']=os.path.abspath(os.path.expanduser(Options.options.prefix)) self.all_envs[name]=env else: if fromenv:warn("The environment %s may have been configured already"%name) return env def setenv(self,name): self.env=self.retrieve(name) self.envname=name def add_os_flags(self,var,dest=None): try:self.env.append_value(dest or var,Utils.to_list(self.environ[var])) except KeyError:pass def check_message_1(self,sr): self.line_just=max(self.line_just,len(sr)) self.log.write(sr+'\n\n') Utils.pprint('NORMAL',"%s :"%sr.ljust(self.line_just),sep='') def check_message_2(self,sr,color='GREEN'): Utils.pprint(color,sr) def check_message(self,th,msg,state,option=''): sr='Checking for %s %s'%(th,msg) self.check_message_1(sr) p=self.check_message_2 if state:p('ok '+option) else:p('not found','YELLOW') def check_message_custom(self,th,msg,custom,option='',color='PINK'): sr='Checking for %s %s'%(th,msg) self.check_message_1(sr) self.check_message_2(custom,color) def find_program(self,filename,path_list=[],var=None,mandatory=False): ret=find_program_impl(self.env,filename,path_list,var,environ=self.environ) self.check_message('program',filename,ret,ret) self.log.write('find program=%r paths=%r var=%r -> %r\n\n'%(filename,path_list,var,ret)) if not ret and mandatory: self.fatal('The program %s could not be found'%filename) return ret def cmd_to_list(self,cmd): if isinstance(cmd,str)and cmd.find(' '): try: os.stat(cmd) except OSError: return shlex.split(cmd) else: return[cmd] return cmd def __getattr__(self,name): r=self.__class__.__dict__.get(name,None) if r:return r if name and name.startswith('require_'): for k in['check_','find_']: n=name.replace('require_',k) ret=self.__class__.__dict__.get(n,None) if ret: def run(*k,**kw): r=ret(self,*k,**kw) if not r: self.fatal('requirement failure') return r return run self.fatal('No such method %r'%name) def eval_rules(self,rules): self.rules=Utils.to_list(rules) for x in self.rules: f=getattr(self,x) if not f:self.fatal("No such method '%s'."%x) try: f() except Exception,e: ret=self.err_handler(x,e) if ret==BREAK: break elif ret==CONTINUE: continue else: self.fatal(e) def err_handler(self,fun,error): pass def conf(f): setattr(ConfigurationContext,f.__name__,f) return f def conftest(f): ConfigurationContext.tests[f.__name__]=f return conf(f) libdesktop-agnostic-0.3.92/wafadmin/__init__.py0000644000175000017510000000005311226437332020735 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 libdesktop-agnostic-0.3.92/wafadmin/py3kfixes.py0000644000175000017510000000461611226437331021133 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os all_modifs={} def modif(dir,name,fun): if name=='*': lst=os.listdir(dir)+['Tools'+os.sep+x for x in os.listdir(os.path.join(dir,'Tools'))] for x in lst: if x.endswith('.py'): modif(dir,x,fun) return filename=os.path.join(dir,name) f=open(filename,'r') txt=f.read() f.close() txt=fun(txt) f=open(filename,'w') f.write(txt) f.close() def subst(filename): def do_subst(fun): global all_modifs try: all_modifs[filename]+=fun except KeyError: all_modifs[filename]=[fun] return fun return do_subst def r1(code): code=code.replace("'iluvcuteoverload'","b'iluvcuteoverload'") code=code.replace("ABI=7","ABI=37") return code def r2(code): code=code.replace("p.stdin.write('\\n')","p.stdin.write(b'\\n')") code=code.replace("out=str(out)","out=out.decode('utf-8')") return code def r3(code): code=code.replace("m.update(str(lst))","m.update(str(lst).encode())") return code def r4(code): code=code.replace("up(self.__class__.__name__)","up(self.__class__.__name__.encode())") code=code.replace("up(self.env.variant())","up(self.env.variant().encode())") code=code.replace("up(x.parent.abspath())","up(x.parent.abspath().encode())") code=code.replace("up(x.name)","up(x.name.encode())") code=code.replace('class TaskBase(object):\n\t__metaclass__=store_task_type','class TaskBase(object, metaclass=store_task_type):') code=code.replace('keys=self.cstr_groups.keys()','keys=list(self.cstr_groups.keys())') return code def r5(code): code=code.replace("cPickle.dump(data,file,-1)","cPickle.dump(data,file)") code=code.replace('for node in src_dir_node.childs.values():','for node in list(src_dir_node.childs.values()):') return code def r6(code): code=code.replace('xrange','range') code=code.replace('iteritems','items') code=code.replace('maxint','maxsize') code=code.replace('iterkeys','keys') code=code.replace('Error,e:','Error as e:') code=code.replace('Exception,e:','Exception as e:') return code def r7(code): code=code.replace('class task_gen(object):\n\t__metaclass__=register_obj','class task_gen(object, metaclass=register_obj):') return code def fixdir(dir): global all_modifs for k in all_modifs: for v in all_modifs[k]: modif(os.path.join(dir,'wafadmin'),k,v) subst('Constants.py')(r1) subst('Tools/ccroot.py')(r2) subst('Utils.py')(r3) subst('Task.py')(r4) subst('Build.py')(r5) subst('*')(r6) subst('TaskGen.py')(r7) libdesktop-agnostic-0.3.92/wafadmin/Node.py0000644000175000017510000003034011226437331020064 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,fnmatch,re import Utils UNDEFINED=0 DIR=1 FILE=2 BUILD=3 type_to_string={UNDEFINED:"unk",DIR:"dir",FILE:"src",BUILD:"bld"} prune_pats='.git .bzr .hg .svn _MTN _darcs CVS SCCS'.split() exclude_pats=prune_pats+'*~ #*# .#* %*% ._* .gitignore .cvsignore vssver.scc .DS_Store'.split() exclude_regs=''' **/*~ **/#*# **/.#* **/%*% **/._* **/CVS **/CVS/** **/.cvsignore **/SCCS **/SCCS/** **/vssver.scc **/.svn **/.svn/** **/.git **/.git/** **/.gitignore **/.bzr **/.bzr/** **/.hg **/.hg/** **/_MTN **/_MTN/** **/_darcs **/_darcs/** **/.DS_Store''' class Node(object): __slots__=("name","parent","id","childs") def __init__(self,name,parent,node_type=UNDEFINED): self.name=name self.parent=parent self.__class__.bld.id_nodes+=4 self.id=self.__class__.bld.id_nodes+node_type if node_type==DIR:self.childs={} if parent and name in parent.childs: raise Utils.WafError('node %s exists in the parent files %r already'%(name,parent)) if parent:parent.childs[name]=self def __setstate__(self,data): if len(data)==4: (self.parent,self.name,self.id,self.childs)=data else: (self.parent,self.name,self.id)=data def __getstate__(self): if getattr(self,'childs',None)is None: return(self.parent,self.name,self.id) else: return(self.parent,self.name,self.id,self.childs) def __str__(self): if not self.parent:return'' return"%s://%s"%(type_to_string[self.id&3],self.abspath()) def __repr__(self): return self.__str__() def __hash__(self): raise Utils.WafError('nodes, you are doing it wrong') def __copy__(self): raise Utils.WafError('nodes are not supposed to be cloned') def get_type(self): return self.id&3 def set_type(self,t): self.id=self.id+t-self.id&3 def dirs(self): return[x for x in self.childs.values()if x.id&3==DIR] def files(self): return[x for x in self.childs.values()if x.id&3==FILE] def get_dir(self,name,default=None): node=self.childs.get(name,None) if not node or node.id&3!=DIR:return default return node def get_file(self,name,default=None): node=self.childs.get(name,None) if not node or node.id&3!=FILE:return default return node def get_build(self,name,default=None): node=self.childs.get(name,None) if not node or node.id&3!=BUILD:return default return node def find_resource(self,lst): if isinstance(lst,str): lst=Utils.split_path(lst) if len(lst)==1: parent=self else: parent=self.find_dir(lst[:-1]) if not parent:return None self.__class__.bld.rescan(parent) name=lst[-1] node=parent.childs.get(name,None) if node: tp=node.id&3 if tp==FILE or tp==BUILD: return node else: return None tree=self.__class__.bld if not name in tree.cache_dir_contents[parent.id]: return None path=parent.abspath()+os.sep+name try: st=Utils.h_file(path) except IOError: return None child=self.__class__(name,parent,FILE) tree.node_sigs[0][child.id]=st return child def find_or_declare(self,lst): if isinstance(lst,str): lst=Utils.split_path(lst) if len(lst)==1: parent=self else: parent=self.find_dir(lst[:-1]) if not parent:return None self.__class__.bld.rescan(parent) name=lst[-1] node=parent.childs.get(name,None) if node: tp=node.id&3 if tp!=BUILD: raise Utils.WafError("find_or_declare returns a build node, not a source nor a directory %r"%lst) return node node=self.__class__(name,parent,BUILD) return node def find_dir(self,lst): if isinstance(lst,str): lst=Utils.split_path(lst) current=self for name in lst: self.__class__.bld.rescan(current) prev=current if not current.parent and name==current.name: continue elif not name: continue elif name=='.': continue elif name=='..': current=current.parent or current else: current=prev.childs.get(name,None) if current is None: dir_cont=self.__class__.bld.cache_dir_contents if prev.id in dir_cont and name in dir_cont[prev.id]: if not prev.name: if os.sep=='/': dirname=os.sep+name else: dirname=name else: dirname=prev.abspath()+os.sep+name if not os.path.isdir(dirname): return None current=self.__class__(name,prev,DIR) elif(not prev.name and len(name)==2 and name[1]==':')or name.startswith('\\\\'): current=self.__class__(name,prev,DIR) else: return None else: if current.id&3!=DIR: return None return current def ensure_dir_node_from_path(self,lst): if isinstance(lst,str): lst=Utils.split_path(lst) current=self for name in lst: if not name: continue elif name=='.': continue elif name=='..': current=current.parent or current else: prev=current current=prev.childs.get(name,None) if current is None: current=self.__class__(name,prev,DIR) return current def exclusive_build_node(self,path): lst=Utils.split_path(path) name=lst[-1] if len(lst)>1: parent=None try: parent=self.find_dir(lst[:-1]) except OSError: pass if not parent: parent=self.ensure_dir_node_from_path(lst[:-1]) self.__class__.bld.cache_scanned_folders[parent.id]=1 else: try: self.__class__.bld.rescan(parent) except OSError: pass else: parent=self node=parent.childs.get(name,None) if not node: node=self.__class__(name,parent,BUILD) return node def path_to_parent(self,parent): lst=[] p=self h1=parent.height() h2=p.height() while h2>h1: h2-=1 lst.append(p.name) p=p.parent if lst: lst.reverse() ret=os.path.join(*lst) else: ret='' return ret def find_ancestor(self,node): dist=self.height()-node.height() if dist<0:return node.find_ancestor(self) cand=self while dist>0: cand=cand.parent dist-=1 if cand==node:return cand cursor=node while cand.parent: cand=cand.parent cursor=cursor.parent if cand==cursor:return cand def relpath_gen(self,from_node): if self==from_node:return'.' if from_node.parent==self:return'..' ancestor=self.find_ancestor(from_node) lst=[] cand=self while not cand.id==ancestor.id: lst.append(cand.name) cand=cand.parent cand=from_node while not cand.id==ancestor.id: lst.append('..') cand=cand.parent lst.reverse() return os.sep.join(lst) def nice_path(self,env=None): tree=self.__class__.bld ln=tree.launch_node() if self.id&3==FILE:return self.relpath_gen(ln) else:return os.path.join(tree.bldnode.relpath_gen(ln),env.variant(),self.relpath_gen(tree.srcnode)) def is_child_of(self,node): p=self diff=self.height()-node.height() while diff>0: diff-=1 p=p.parent return p.id==node.id def variant(self,env): if not env:return 0 elif self.id&3==FILE:return 0 else:return env.variant() def height(self): d=self val=-1 while d: d=d.parent val+=1 return val def abspath(self,env=None): variant=(env and(self.id&3!=FILE)and env.variant())or 0 ret=self.__class__.bld.cache_node_abspath[variant].get(self.id,None) if ret:return ret if not variant: if not self.parent: val=os.sep=='/'and os.sep or'' elif not self.parent.name: val=(os.sep=='/'and os.sep or'')+self.name else: val=self.parent.abspath()+os.sep+self.name else: val=os.sep.join((self.__class__.bld.bldnode.abspath(),env.variant(),self.path_to_parent(self.__class__.bld.srcnode))) self.__class__.bld.cache_node_abspath[variant][self.id]=val return val def change_ext(self,ext): name=self.name k=name.rfind('.') if k>=0: name=name[:k]+ext else: name=name+ext return self.parent.find_or_declare([name]) def src_dir(self,env): return self.parent.srcpath(env) def bld_dir(self,env): return self.parent.bldpath(env) def bld_base(self,env): s=os.path.splitext(self.name)[0] return os.path.join(self.bld_dir(env),s) def bldpath(self,env=None): if self.id&3==FILE: return self.relpath_gen(self.__class__.bld.bldnode) if self.path_to_parent(self.__class__.bld.srcnode)is not'': return os.path.join(env.variant(),self.path_to_parent(self.__class__.bld.srcnode)) return env.variant() def srcpath(self,env=None): if self.id&3==BUILD: return self.bldpath(env) return self.relpath_gen(self.__class__.bld.bldnode) def read(self,env): return Utils.readf(self.abspath(env)) def dir(self,env): return self.parent.abspath(env) def file(self): return self.name def file_base(self): return os.path.splitext(self.name)[0] def suffix(self): k=max(0,self.name.rfind('.')) return self.name[k:] def find_iter_impl(self,src=True,bld=True,dir=True,accept_name=None,is_prune=None,maxdepth=25): self.__class__.bld.rescan(self) for name in self.__class__.bld.cache_dir_contents[self.id]: if accept_name(self,name): node=self.find_resource(name) if node: if src and node.id&3==FILE: yield node else: node=self.find_dir(name) if node and node.id!=self.__class__.bld.bldnode.id: if dir: yield node if not is_prune(self,name): if maxdepth: for k in node.find_iter_impl(src,bld,dir,accept_name,is_prune,maxdepth=maxdepth-1): yield k else: if not is_prune(self,name): node=self.find_resource(name) if not node: node=self.find_dir(name) if node and node.id!=self.__class__.bld.bldnode.id: if maxdepth: for k in node.find_iter_impl(src,bld,dir,accept_name,is_prune,maxdepth=maxdepth-1): yield k if bld: for node in self.childs.values(): if node.id==self.__class__.bld.bldnode.id: continue if node.id&3==BUILD: if accept_name(self,node.name): yield node raise StopIteration def find_iter(self,in_pat=['*'],ex_pat=exclude_pats,prune_pat=prune_pats,src=True,bld=True,dir=False,maxdepth=25,flat=False): if not(src or bld or dir): raise StopIteration if self.id&3!=DIR: raise StopIteration in_pat=Utils.to_list(in_pat) ex_pat=Utils.to_list(ex_pat) prune_pat=Utils.to_list(prune_pat) def accept_name(node,name): for pat in ex_pat: if fnmatch.fnmatchcase(name,pat): return False for pat in in_pat: if fnmatch.fnmatchcase(name,pat): return True return False def is_prune(node,name): for pat in prune_pat: if fnmatch.fnmatchcase(name,pat): return True return False ret=self.find_iter_impl(src,bld,dir,accept_name,is_prune,maxdepth=maxdepth) if flat: return" ".join([x.relpath_gen(self)for x in ret]) return ret def ant_glob(self,*k,**kw): src=kw.get('src',1) bld=kw.get('bld',1) dir=kw.get('dir',0) excl=kw.get('excl',exclude_regs) incl=k and k[0]or kw.get('incl','**') def to_pat(s): lst=Utils.to_list(s) ret=[] for x in lst: x=x.replace('//','/') if x.endswith('/'): x+='**' lst2=x.split('/') accu=[] for k in lst2: if k=='**': accu.append(k) else: k=k.replace('.','[.]').replace('*','.*').replace('?','.') k='^%s$'%k accu.append(re.compile(k)) ret.append(accu) return ret def filtre(name,nn): ret=[] for lst in nn: if not lst: pass elif lst[0]=='**': ret.append(lst) if len(lst)>1: if lst[1].match(name): ret.append(lst[2:]) else: ret.append([]) elif lst[0].match(name): ret.append(lst[1:]) return ret def accept(name,pats): nacc=filtre(name,pats[0]) nrej=filtre(name,pats[1]) if[]in nrej: nacc=[] return[nacc,nrej] def ant_iter(nodi,maxdepth=25,pats=[]): nodi.__class__.bld.rescan(nodi) for name in nodi.__class__.bld.cache_dir_contents[nodi.id]: npats=accept(name,pats) if npats and npats[0]: accepted=[]in npats[0] node=nodi.find_resource(name) if node and accepted: if src and node.id&3==FILE: yield node else: node=nodi.find_dir(name) if node and node.id!=nodi.__class__.bld.bldnode.id: if accepted and dir: yield node if maxdepth: for k in ant_iter(node,maxdepth=maxdepth-1,pats=npats): yield k if bld: for node in nodi.childs.values(): if node.id==nodi.__class__.bld.bldnode.id: continue if node.id&3==BUILD: npats=accept(node.name,pats) if npats and npats[0]and[]in npats[0]: yield node raise StopIteration ret=[x for x in ant_iter(self,pats=[to_pat(incl),to_pat(excl)])] if kw.get('flat',True): return" ".join([x.relpath_gen(self)for x in ret]) return ret class Nodu(Node): pass libdesktop-agnostic-0.3.92/wafadmin/Constants.py0000644000175000017510000000150011226437331021147 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 HEXVERSION=0x10508 WAFVERSION="1.5.8" WAFREVISION="6322:6325M" ABI=7 O644=420 O755=493 MAXJOBS=99999999 CACHE_DIR='c4che' CACHE_SUFFIX='.cache.py' DBFILE='.wafpickle-%d'%ABI WSCRIPT_FILE='wscript' WSCRIPT_BUILD_FILE='wscript_build' WAF_CONFIG_LOG='config.log' WAF_CONFIG_H='config.h' SIG_NIL='iluvcuteoverload' VARIANT='_VARIANT_' DEFAULT='default' SRCDIR='srcdir' BLDDIR='blddir' APPNAME='APPNAME' VERSION='VERSION' DEFINES='defines' UNDEFINED=() BREAK="break" CONTINUE="continue" JOBCONTROL="JOBCONTROL" MAXPARALLEL="MAXPARALLEL" NORMAL="NORMAL" NOT_RUN=0 MISSING=1 CRASHED=2 EXCEPTION=3 SKIPPED=8 SUCCESS=9 ASK_LATER=-1 SKIP_ME=-2 RUN_ME=-3 LOG_FORMAT="%(asctime)s %(c1)s%(zone)s%(c2)s %(message)s" HOUR_FORMAT="%H:%M:%S" TEST_OK=True CFG_FILES='cfg_files' INSTALL=1337 UNINSTALL=-1337 libdesktop-agnostic-0.3.92/wafadmin/Scripting.py0000644000175000017510000002610711226437331021147 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import os,sys,shutil,traceback,datetime,inspect import Utils,Configure,Build,Logs,Options,Environment,Task from Logs import error,warn,info from Constants import* g_gz='bz2' commands=[] def prepare_impl(t,cwd,ver,wafdir): Options.tooldir=[t] Options.launch_dir=cwd if'--version'in sys.argv: opt_obj=Options.Handler() opt_obj.curdir=cwd opt_obj.parse_args() sys.exit(0) msg1='Waf: Please run waf from a directory containing a file named "%s" or run distclean'%WSCRIPT_FILE build_dir_override=None candidate=None lst=os.listdir(cwd) search_for_candidate=True if WSCRIPT_FILE in lst: candidate=cwd elif'configure'in sys.argv and not WSCRIPT_BUILD_FILE in lst: calldir=os.path.abspath(os.path.dirname(sys.argv[0])) if WSCRIPT_FILE in os.listdir(calldir): candidate=calldir search_for_candidate=False else: error('arg[0] directory does not contain a wscript file') sys.exit(1) build_dir_override=cwd while search_for_candidate: if len(cwd)<=3: break dirlst=os.listdir(cwd) if WSCRIPT_FILE in dirlst: candidate=cwd if'configure'in sys.argv and candidate: break if Options.lockfile in dirlst: env=Environment.Environment() env.load(os.path.join(cwd,Options.lockfile)) try: os.stat(env['cwd']) except: candidate=cwd else: candidate=env['cwd'] break cwd=os.path.dirname(cwd) if not candidate: if'-h'in sys.argv or'--help'in sys.argv: warn('No wscript file found: the help message may be incomplete') opt_obj=Options.Handler() opt_obj.curdir=cwd opt_obj.parse_args() else: error(msg1) sys.exit(0) try: os.chdir(candidate) except OSError: raise Utils.WafError("the folder %r is unreadable"%candidate) Utils.set_main_module(os.path.join(candidate,WSCRIPT_FILE)) if build_dir_override: d=getattr(Utils.g_module,BLDDIR,None) if d: msg=' Overriding build directory %s with %s'%(d,build_dir_override) warn(msg) Utils.g_module.blddir=build_dir_override def set_def(obj,name=''): n=name or obj.__name__ if not n in Utils.g_module.__dict__: setattr(Utils.g_module,n,obj) for k in[dist,distclean,distcheck,build,clean,install,uninstall]: set_def(k) set_def(Configure.ConfigurationContext,'configure_context') for k in['build','clean','install','uninstall']: set_def(Build.BuildContext,k+'_context') opt_obj=Options.Handler(Utils.g_module) opt_obj.curdir=candidate try: f=Utils.g_module.set_options except AttributeError: pass else: opt_obj.sub_options(['']) opt_obj.parse_args() if not'init'in Utils.g_module.__dict__: Utils.g_module.init=Utils.nada if not'shutdown'in Utils.g_module.__dict__: Utils.g_module.shutdown=Utils.nada main() def prepare(t,cwd,ver,wafdir): if WAFVERSION!=ver: msg='Version mismatch: waf %s <> wafadmin %s (wafdir %s)'%(ver,WAFVERSION,wafdir) print('\033[91mError: %s\033[0m'%msg) sys.exit(1) try: prepare_impl(t,cwd,ver,wafdir) except Utils.WafError,e: error(str(e)) sys.exit(1) except KeyboardInterrupt: Utils.pprint('RED','Interrupted') sys.exit(68) def main(): global commands commands=Options.arg_line[:] while commands: x=commands.pop(0) ini=datetime.datetime.now() if x=='configure': fun=configure elif x=='build': fun=build else: fun=getattr(Utils.g_module,x,None) if not fun: raise Utils.WscriptError('No such command %r'%x) ctx=getattr(Utils.g_module,x+'_context',Utils.Context)() if x in['init','shutdown','dist','distclean','distcheck']: try: fun(ctx) except TypeError: fun() else: fun(ctx) ela='' if not Options.options.progress_bar: ela=' (%s)'%Utils.get_elapsed_time(ini) if x!='init'and x!='shutdown': info('%r finished successfully%s'%(x,ela)) if not commands and x!='shutdown': commands.append('shutdown') def configure(conf): src=getattr(Options.options,SRCDIR,None) if not src:src=getattr(Utils.g_module,SRCDIR,None) if not src: src='.' incomplete_src=1 src=os.path.abspath(src) bld=getattr(Options.options,BLDDIR,None) if not bld: bld=getattr(Utils.g_module,BLDDIR,None) if bld=='.': raise Utils.WafError('Setting blddir="." may cause distclean problems') if not bld: bld='build' incomplete_bld=1 bld=os.path.abspath(bld) try:os.makedirs(bld) except OSError:pass targets=Options.options.compile_targets Options.options.compile_targets=None Options.is_install=False conf.srcdir=src conf.blddir=bld conf.post_init() if'incomplete_src'in vars(): conf.check_message_1('Setting srcdir to') conf.check_message_2(src) if'incomplete_bld'in vars(): conf.check_message_1('Setting blddir to') conf.check_message_2(bld) conf.sub_config(['']) conf.store() env=Environment.Environment() env[BLDDIR]=bld env[SRCDIR]=src env['argv']=sys.argv env['commands']=Options.commands env['options']=Options.options.__dict__ env['hash']=conf.hash env['files']=conf.files env['environ']=dict(conf.environ) env['cwd']=os.path.split(Utils.g_module.root_path)[0] if Utils.g_module.root_path!=src: env.store(os.path.join(src,Options.lockfile)) env.store(Options.lockfile) Options.options.compile_targets=targets def clean(bld): '''removes the build files''' try: proj=Environment.Environment(Options.lockfile) except IOError: raise Utils.WafError('Nothing to clean (project not configured)') bld.load_dirs(proj[SRCDIR],proj[BLDDIR]) bld.load_envs() bld.is_install=0 bld.add_subdirs([os.path.split(Utils.g_module.root_path)[0]]) try: bld.clean() finally: bld.save() def check_configured(bld): if not Configure.autoconfig: return bld conf_cls=getattr(Utils.g_module,'configure_context',Utils.Context) bld_cls=getattr(Utils.g_module,'build_context',Utils.Context) def reconf(proj): back=(Options.commands,Options.options.__dict__,Logs.zones,Logs.verbose) Options.commands=proj['commands'] Options.options.__dict__=proj['options'] conf=conf_cls() conf.environ=proj['environ'] configure(conf) (Options.commands,Options.options.__dict__,Logs.zones,Logs.verbose)=back try: proj=Environment.Environment(Options.lockfile) except IOError: conf=conf_cls() configure(conf) else: try: bld=bld_cls() bld.load_dirs(proj[SRCDIR],proj[BLDDIR]) bld.load_envs() except Utils.WafError: reconf(proj) return bld_cls() try: proj=Environment.Environment(Options.lockfile) except IOError: raise Utils.WafError('Auto-config: project does not configure (bug)') h=0 try: for file in proj['files']: if file.endswith('configure'): h=hash((h,Utils.readf(file))) else: mod=Utils.load_module(file) h=hash((h,mod.waf_hash_val)) except(OSError,IOError): warn('Reconfiguring the project: a file is unavailable') reconf(proj) else: if(h!=proj['hash']): warn('Reconfiguring the project: the configuration has changed') reconf(proj) return bld_cls() def install(bld): '''installs the build files''' bld=check_configured(bld) Options.commands['install']=True Options.commands['uninstall']=False Options.is_install=True bld.is_install=INSTALL build_impl(bld) bld.install() def uninstall(bld): '''removes the installed files''' Options.commands['install']=False Options.commands['uninstall']=True Options.is_install=True bld.is_install=UNINSTALL try: def runnable_status(self): return SKIP_ME setattr(Task.Task,'runnable_status_back',Task.Task.runnable_status) setattr(Task.Task,'runnable_status',runnable_status) build_impl(bld) bld.install() finally: setattr(Task.Task,'runnable_status',Task.Task.runnable_status_back) def build(bld): bld=check_configured(bld) Options.commands['install']=False Options.commands['uninstall']=False Options.is_install=False bld.is_install=0 return build_impl(bld) def build_impl(bld): try: proj=Environment.Environment(Options.lockfile) except IOError: raise Utils.WafError("Project not configured (run 'waf configure' first)") bld.load_dirs(proj[SRCDIR],proj[BLDDIR]) bld.load_envs() info("Waf: Entering directory `%s'"%bld.bldnode.abspath()) bld.add_subdirs([os.path.split(Utils.g_module.root_path)[0]]) bld.pre_build() try: bld.compile() finally: if Options.options.progress_bar:print('') info("Waf: Leaving directory `%s'"%bld.bldnode.abspath()) bld.post_build() bld.install() excludes='.bzr .bzrignore .git .gitignore .svn CVS .cvsignore .arch-ids {arch} SCCS BitKeeper .hg _MTN _darcs Makefile Makefile.in config.log'.split() dist_exts='~ .rej .orig .pyc .pyo .bak .tar.bz2 tar.gz .zip .swp'.split() def dont_dist(name,src,build_dir): global excludes,dist_exts if(name.startswith(',,')or name.startswith('++')or name.startswith('.waf-1.')or(src=='.'and name==Options.lockfile)or name in excludes or name==build_dir): return True for ext in dist_exts: if name.endswith(ext): return True return False def copytree(src,dst,build_dir): names=os.listdir(src) os.makedirs(dst) for name in names: srcname=os.path.join(src,name) dstname=os.path.join(dst,name) if dont_dist(name,src,build_dir): continue if os.path.isdir(srcname): copytree(srcname,dstname,build_dir) else: shutil.copy2(srcname,dstname) def distclean(ctx=None): '''removes the build directory''' lst=os.listdir('.') for f in lst: if f==Options.lockfile: try: proj=Environment.Environment(f) shutil.rmtree(proj[BLDDIR]) except(OSError,IOError): pass try: os.remove(f) except(OSError,IOError): pass if f.startswith('.waf-'): shutil.rmtree(f,ignore_errors=True) def dist(appname='',version=''): '''makes a tarball for redistributing the sources''' import tarfile if not appname:appname=getattr(Utils.g_module,APPNAME,'noname') if not version:version=getattr(Utils.g_module,VERSION,'1.0') tmp_folder=appname+'-'+version arch_name=tmp_folder+'.tar.'+g_gz try: shutil.rmtree(tmp_folder) except(OSError,IOError): pass try: os.remove(arch_name) except(OSError,IOError): pass copytree('.',tmp_folder,getattr(Utils.g_module,BLDDIR,None)) dist_hook=getattr(Utils.g_module,'dist_hook',None) if dist_hook: back=os.getcwd() os.chdir(tmp_folder) try: dist_hook() finally: os.chdir(back) tar=tarfile.open(arch_name,'w:'+g_gz) tar.add(tmp_folder) tar.close() try:from hashlib import sha1 as sha except ImportError:from sha import sha try: digest=" (sha=%r)"%sha(Utils.readf(arch_name)).hexdigest() except: digest='' info('New archive created: %s%s'%(arch_name,digest)) if os.path.exists(tmp_folder):shutil.rmtree(tmp_folder) return arch_name def distcheck(appname='',version=''): '''checks if the sources compile (tarball from 'dist')''' import tempfile,tarfile if not appname:appname=getattr(Utils.g_module,APPNAME,'noname') if not version:version=getattr(Utils.g_module,VERSION,'1.0') waf=os.path.abspath(sys.argv[0]) tarball=dist(appname,version) t=tarfile.open(tarball) for x in t:t.extract(x) t.close() path=appname+'-'+version instdir=tempfile.mkdtemp('.inst','%s-%s'%(appname,version)) ret=Utils.pproc.Popen([waf,'configure','install','uninstall','--destdir='+instdir],cwd=path).wait() if ret: raise Utils.WafError('distcheck failed with code %i'%ret) if os.path.exists(instdir): raise Utils.WafError('distcheck succeeded, but files were left in %s'%instdir) shutil.rmtree(path) def add_subdir(dir,bld): bld.recurse(dir,'build') libdesktop-agnostic-0.3.92/COPYING.GPL-20000664000175000017510000004310311536677677016704 0ustar seagleseagle GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. libdesktop-agnostic-0.3.92/wscript0000664000175000017510000002707011537157073016474 0ustar seagleseagle#! /usr/bin/env python # encoding: utf-8 import intltool import Options import os import Scripting import shutil import sys import Utils import tarfile import Task import tempfile API_VERSION = '1.0' # the following two variables are used by the target "waf dist" VERSION = '0.3.92' VNUM = '0.4.0' CFG_BACKENDS = ','.join(['gconf', 'keyfile']) VFS_BACKENDS = ','.join(['gio', 'gnome-vfs', 'thunar-vfs']) FDO_BACKENDS = ','.join(['glib', 'gnome', 'gio']) DISTCHECK_FLAGS = '\t'.join(['--config-backends=%s' % CFG_BACKENDS, '--vfs-backends=%s' % VFS_BACKENDS, '--desktop-entry-backends=%s' % FDO_BACKENDS]) GEN_SRC_DIR = 'gen_src' if os.path.exists('.bzr'): try: from bzrlib.branch import Branch branch = Branch.open_containing('.')[0] revno = branch.revno() parent_url = branch.get_parent() if parent_url is None: # use the nick instead branch_name = branch.nick else: if parent_url[-1] == '/': parent_url = parent_url[:-1] branch_name = os.path.basename(parent_url) VERSION += '-bzr%d-%s' % (revno, branch_name) except ImportError: pass elif os.path.exists('BZR_VERSION'): # the BZR_VERSION file should contain only the following: # $revno-$branch_name VERSION += '-bzr' + open('BZR_VERSION').read() APPNAME = 'libdesktop-agnostic' # these variables are mandatory ('/' is converted automatically) srcdir = '.' blddir = 'build' config_backend = None def set_options(opt): [opt.tool_options(x) for x in ['compiler_cc', 'gnu_dirs']] opt.sub_options('data docs') opt.sub_options('libdesktop-agnostic') opt.add_option('--enable-debug', action='store_true', dest='debug', default=False, help='Enables the library to be built with debug symbols.') opt.add_option('--enable-extra-warnings', action='store_true', dest='extra_warnings', default=False, help='Shows extra warnings during compilation.') opt.add_option('--enable-profiling', action='store_true', 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=True) def configure(conf): print 'Configuring %s %s' % (APPNAME, VERSION) if len(Options.options.config_backends) == 0: conf.fatal('At least one configuration backend needs to be built.') conf.env['BACKENDS_CFG'] = Options.options.config_backends.split(',') if len(Options.options.vfs_backends) == 0: conf.fatal('At least one VFS backend needs to be built.') conf.env['BACKENDS_VFS'] = Options.options.vfs_backends.split(',') if len(Options.options.de_backends) == 0: conf.fatal('At least one desktop entry backend needs to be built.') conf.env['BACKENDS_DE'] = Options.options.de_backends.split(',') 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') conf.check_tool('compiler_cc intltool misc python vala') MIN_VALA_VERSION = (0, 10, 0) conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE', atleast_version='2.6.0', mandatory=True, args='--cflags --libs') conf.check_cfg(package='glib-2.0', uselib_store='GLIB', atleast_version='2.10.0', mandatory=True, args='--cflags --libs') conf.check_cfg(package='gobject-2.0', uselib_store='GOBJECT', atleast_version='2.12.0', mandatory=True, args='--cflags --libs') # Needed for the Color class conf.check(lib='m', uselib='MATH') conf.check_cfg(package='gdk-2.0', uselib_store='GDK', atleast_version='2.12.0', mandatory=True, args='--cflags --libs') conf.check_cfg(package='gtk+-2.0', uselib_store='GTK', atleast_version='2.12.0', mandatory=True, args='--cflags --libs') if 'gconf' in conf.env['BACKENDS_CFG']: conf.check_cfg(package='glib-2.0', uselib_store='GREGEX', atleast_version='2.14.0', mandatory=True, args='--cflags --libs') conf.check_cfg(package='gconf-2.0', uselib_store='GCONF', mandatory=True, args='--cflags --libs') if 'gio' in conf.env['BACKENDS_VFS']: conf.check_cfg(package='gio-2.0', uselib_store='GIO', atleast_version='2.16.0', mandatory=True, args='--cflags --libs') if 'thunar-vfs' in conf.env['BACKENDS_VFS']: conf.check_cfg(package='thunar-vfs-1', uselib_store='THUNAR_VFS', mandatory=True, args='--cflags --libs') conf.check_cfg(package='dbus-glib-1', uselib_store='DBUS_GLIB', mandatory=True, args='--cflags --libs') if 'gnome-vfs' in conf.env['BACKENDS_VFS']: conf.check_cfg(package='gnome-vfs-2.0', uselib_store='GNOME_VFS', atleast_version='2.6.0', mandatory=True, args='--cflags --libs') if 'gio' in conf.env['BACKENDS_DE']: conf.check_cfg(package='gio-unix-2.0', uselib_store='GIO_UNIX', atleast_version='2.18.0', mandatory=True, args='--cflags --libs') if 'gnome' in conf.env['BACKENDS_DE']: conf.check_cfg(package='gnome-desktop-2.0', 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 \ 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 version %d.%d.%d''' % ((str(conf.env['VALAC_VERSION']),) + MIN_VALA_VERSION)) # check for gobject-introspection conf.check_cfg(package='gobject-introspection-1.0', atleast_version='0.6.3', mandatory=True, args='--cflags --libs') pkgconfig = 'pkg-config --variable g_ir_compiler ' \ 'gobject-introspection-1.0' conf.env['G_IR_COMPILER'] = Utils.cmd_output(pkgconfig, silent=1).strip() conf.sub_config('data') conf.sub_config('docs') # manual Python bindings conf.sub_config('python') conf.define('API_VERSION', str(API_VERSION)) conf.define('VERSION', str(VERSION)) conf.define('GETTEXT_PACKAGE', APPNAME + '-1.0') conf.define('PACKAGE', APPNAME) conf.define('LIBDIR', conf.env['LIBDIR']) conf.define('SYSCONFDIR', conf.env['SYSCONFDIR']) if conf.env['DEBUG']: conf.env.append_value('VALAFLAGS', '-g') conf.env.append_value('CCFLAGS', '-ggdb') if conf.env['EXTRA_WARNINGS']: conf.env.append_value('CCFLAGS', '-Wall') conf.env.append_value('CCFLAGS', '-Wno-return-type') conf.env.append_value('CCFLAGS', '-Wno-unused') if conf.env['PROFILING']: conf.env.append_value('CCFLAGS', '-pg') conf.env.append_value('LINKFLAGS', '-pg') conf.env.append_value('CCFLAGS', '-D_GNU_SOURCE') conf.env.append_value('CCFLAGS', '-DHAVE_BUILD_CONFIG_H') conf.write_config_header('build-config.h') def build(bld): # process subfolders from here bld.add_subdirs('libdesktop-agnostic tools tests data python docs') if bld.env['INTLTOOL']: bld.add_subdirs('po') cls = Task.TaskBase.classes['valac'] old = cls.run def run(self): gen_src_dir = os.path.join(bld.srcnode.abspath(), GEN_SRC_DIR) if os.path.isdir(gen_src_dir) == False: return old(self) else: #print "restoring from pre-cache" # check if output timestamp is newer than inputs d = bld.path.abspath() latest_input = 0 for x in self.inputs: timestamp = os.path.getmtime(x.abspath(self.env)) if timestamp > latest_input: latest_input = timestamp # we need two passes to check that we have up-to-date C sources try: for x in self.outputs: subdir = x.parent.path_to_parent(x.__class__.bld.srcnode) src = os.path.join(d, GEN_SRC_DIR, subdir, x.name) timestamp = os.path.getmtime(src) if timestamp < latest_input: raise Exception("Source file needs to be regenerated!") except Exception: return old(self) for x in self.outputs: subdir = x.parent.path_to_parent(x.__class__.bld.srcnode) src = os.path.join(d, GEN_SRC_DIR, subdir, x.name) shutil.copy2(src, x.abspath(self.env)) return 0 cls.run = run def dist(appname='', version=''): # we need to reconfigure to include all backends Options.options.config_backends = CFG_BACKENDS Options.options.vfs_backends = VFS_BACKENDS Options.options.de_backends = FDO_BACKENDS Scripting.commands += ['configure', 'build', 'dist2'] def dist2(ctx): src_dir = os.path.abspath('.') bld_dir = os.path.join(src_dir, getattr(Utils.g_module, Scripting.BLDDIR)) gen_src_dir = os.path.join(src_dir, GEN_SRC_DIR) try: shutil.rmtree(gen_src_dir) except (OSError, IOError): pass os.makedirs(gen_src_dir) for dir, subdirs, filenames in os.walk(os.path.join(bld_dir, 'default')): dir_basename = os.path.basename(dir) if dir_basename in ['libdesktop-agnostic', 'tools', 'tests']: for filename in filenames: root, ext = os.path.splitext(filename) if ext in ['.c', '.h', '.gir', '.vapi', '.deps']: src = os.path.join(dir, filename) dst = os.path.join(gen_src_dir, dir_basename) if not os.path.exists(dst): os.makedirs(dst) shutil.copy2(src, os.path.join(dst, filename)) Scripting.g_gz = 'gz' tarball = Scripting.dist() # clean up shutil.rmtree(gen_src_dir) return tarball def distcheck(ctx): # no support for extra configure flags in distcheck, we need to add it dist() Scripting.commands.pop() # get rid of dist2, we'll call it ourselves Scripting.commands += ['distcheck2'] def distcheck2(ctx): appname = getattr(Utils.g_module, Scripting.APPNAME, 'noname') version = getattr(Utils.g_module, Scripting.VERSION, '1.0') waf = os.path.abspath(sys.argv[0]) # we need to call dist2(), dist() just appends to Scripting.commands list tarball = dist2(ctx) tbp = tarfile.open(tarball) # as in, tarball pointer [tbp.extract(filename) for filename in tbp] tbp.close() path = '%s-%s' % (appname, version) instdir = tempfile.mkdtemp('.inst', '%s-%s' % (appname, version)) conf_flags = DISTCHECK_FLAGS popen_params = [waf, 'configure'] + conf_flags.split() + \ ['build', 'install', 'uninstall', '--destdir=%s' % instdir] ret = Utils.pproc.Popen(popen_params, cwd=path).wait() if ret: raise Utils.WafError('distcheck failed with code %i' % ret) if os.path.exists(instdir): raise Utils.WafError('''\ distcheck succeeded, but files were left in %s''' % instdir) shutil.rmtree(path) libdesktop-agnostic-0.3.92/COPYING0000664000175000017510000006350011536677677016127 0ustar seagleseagle GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libdesktop-agnostic-0.3.92/waf0000775000175000017510000000745111733561156015561 0ustar seagleseagle#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2009 """ 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. """ import os, sys if sys.hexversion<0x203000f: raise ImportError("Waf requires Python >= 2.3") if 'PSYCOWAF' in os.environ: try:import psyco;psyco.full() except:pass VERSION="1.5.8" REVISION="c8cd776480bf49d9314284ce156067cc" INSTALL='' C1='#&' C2='#%' cwd = os.getcwd() join = os.path.join WAF='waf' def b(x): return x if sys.hexversion>0x300000f: WAF='waf3' def b(x): return x.encode() def err(m): print(('\033[91mError: %s\033[0m' % m)) sys.exit(1) def unpack_wafdir(dir): f = open(sys.argv[0],'rb') c = "corrupted waf (%d)" while 1: line = f.readline() if not line: err("run waf-light from a folder containing wafadmin") if line == b('#==>\n'): txt = f.readline() if not txt: err(c % 1) if f.readline()!=b('#<==\n'): err(c % 2) break if not txt: err(c % 3) txt = txt[1:-1].replace(b(C1), b('\n')).replace(b(C2), b('\r')) import shutil, tarfile try: shutil.rmtree(dir) except OSError: pass try: os.makedirs(join(dir, 'wafadmin', 'Tools')) except OSError: err("Cannot unpack waf lib into %s\nMove waf into a writeable directory" % dir) os.chdir(dir) tmp = 't.tbz2' t = open(tmp,'wb') t.write(txt) t.close() try: t = tarfile.open(tmp) for x in t: t.extract(x) t.close() except: os.chdir(cwd) try: shutil.rmtree(dir) except OSError: pass err("Waf cannot be unpacked, check that bzip2 support is present") os.chmod(join('wafadmin','Tools'), 493) os.unlink(tmp) if sys.hexversion>0x300000f: sys.path = [join(dir, 'wafadmin')] + sys.path import py3kfixes py3kfixes.fixdir(dir) os.chdir(cwd) def test(dir): try: os.stat(join(dir, 'wafadmin')); return os.path.abspath(dir) except OSError: pass def find_lib(): name = sys.argv[0] base = os.path.dirname(os.path.abspath(name)) #devs use $WAFDIR w=test(os.environ.get('WAFDIR', '')) if w: return w #waf-light if name.endswith('waf-light'): w = test(base) if w: return w err("waf-light requires wafadmin -> export WAFDIR=/folder") dir = "/lib/%s-%s-%s/" % (WAF, VERSION, REVISION) for i in [INSTALL,'/usr','/usr/local','/opt']: w = test(i+dir) if w: return w #waf-local s = '.%s-%s-%s' if sys.platform == 'win32': s = s[1:] dir = join(base, s % (WAF, VERSION, REVISION)) w = test(dir) if w: return w #unpack unpack_wafdir(dir) return dir wafdir = find_lib() w = join(wafdir, 'wafadmin') t = join(w, 'Tools') sys.path = [w, t] + sys.path import Scripting Scripting.prepare(t, cwd, VERSION, wafdir) sys.exit(0) libdesktop-agnostic-0.3.92/sphinx.py0000664000175000017510000000772711536677677016770 0ustar seagleseagle# -*- coding: utf-8 -*- '''A waf tool for building Sphinx documentation. .. moduleauthor:: Mark Lee ''' import Constants import Node import os import pproc import stat import Task import TaskGen import Utils class sphinx_task(Task.Task): '''The task that builds Sphinx documentation.''' def update_build_dir(self, node): '''Adapted from Waf 1.5.15 (wafadmin/Node.py).''' path = node.abspath(self.env) lst = Utils.listdir(path) try: node.__class__.bld.cache_dir_contents[node.id].update(lst) except KeyError: node.__class__.bld.cache_dir_contents[node.id] = set(lst) node.__class__.bld.cache_scanned_folders[node.id] = True for k in lst: npath = path + os.sep + k st = os.stat(npath) if stat.S_ISREG(st[stat.ST_MODE]): try: ick = node.find_or_declare(k) if ick.id not in node.__class__.bld \ .node_sigs[self.env.variant()]: node.__class__.bld \ .node_sigs[self.env.variant()][ick.id] = \ Constants.SIG_NIL except AttributeError: print 'WTF @ %s' % k elif stat.S_ISDIR(st[stat.ST_MODE]): child = node.find_dir(k) if not child: child = node.ensure_dir_node_from_path(k) self.update_build_dir(child) def run(self): doc_dir = self.inputs[0].parent rule = '"${SPHINX}" -b html "%s" "%s"' % (doc_dir.srcpath(), doc_dir.bldpath(self.env)) cmd = Utils.subst_vars(rule, self.env) proc = pproc.Popen(cmd, shell=True, stdin=pproc.PIPE) proc.communicate() self.update_build_dir(self.generator.path) return proc.returncode def install(self): base_builddir = self.inputs[0].parent.bldpath(self.env) exclude = Node.exclude_regs + '\n**/.buildinfo\n**/_static' def generate_glob(pattern, use_exclude=False): excl = [] if use_exclude: excl = exclude glob = self.generator.path.ant_glob(pattern, dir=False, src=False, excl=excl) return ' '.join([os.path.join('build', base_builddir, x) for x in glob.split()]) glob_base = generate_glob('*', True) glob_static = generate_glob('_static/*') glob_sources = ' '.join([os.path.join('docs', x) for x in self.generator.path \ .ant_glob('*.rst').split()]) self.generator.bld.install_files('${HTMLDIR}', glob_base) self.generator.bld.install_files('${HTMLDIR}/_static', glob_static) for rst in glob_sources.split(): basename = os.path.splitext(os.path.basename(rst))[0] self.generator.bld.install_as('${HTMLDIR}/_sources/%s.txt' % \ basename, rst) @TaskGen.extension('.rst') def rst_handler(task, node): # do nothing! pass @TaskGen.feature('sphinx') def process_sphinx(self): conf_file = getattr(self, 'sphinx_config', 'conf.py') node = self.path.find_resource(conf_file) if not node: raise ValueError('sphinx configuration file not found') # the task instance task = self.create_task('sphinx') source = self.source self.source = ['%s.rst' % s for s in source] self.target = ['objects.inv', 'search.html', 'searchindex.js'] + \ ['%s.html' % s for s in source] task.set_inputs([node] + [self.path.find_resource(f) for f in self.source]) task.set_outputs([self.path.find_or_declare(f) for f in self.target]) def detect(conf): conf.find_program('sphinx-build', mandatory=True, var='SPHINX') libdesktop-agnostic-0.3.92/INSTALL0000664000175000017510000000002611536677677016117 0ustar seagleseagleSee docs/install.rst. libdesktop-agnostic-0.3.92/vapi/packages/thunar-vfs-1/0000775000175000017510000000000011733560021022005 5ustar seagleseaglelibdesktop-agnostic-0.3.92/tests/python/0000775000175000017510000000000011733560020017517 5ustar seagleseaglelibdesktop-agnostic-0.3.92/gen_src/tests/0000775000175000017510000000000011733560020017616 5ustar seagleseaglelibdesktop-agnostic-0.3.92/gen_src/libdesktop-agnostic/0000775000175000017510000000000011733560021022422 5ustar seagleseaglelibdesktop-agnostic-0.3.92/gen_src/tools/0000775000175000017510000000000011733560021017615 5ustar seagleseaglelibdesktop-agnostic-0.3.92/vapi/packages/0000775000175000017510000000000011733560020017551 5ustar seagleseaglelibdesktop-agnostic-0.3.92/docs/_static/0000775000175000017510000000000011537206472017424 5ustar seagleseaglelibdesktop-agnostic-0.3.92/docs/_templates/0000775000175000017510000000000011537206472020133 5ustar seagleseaglelibdesktop-agnostic-0.3.92/wafadmin/Tools/0000755000175000017510000000000011733561312017725 5ustar seagleseaglelibdesktop-agnostic-0.3.92/data/0000775000175000017510000000000011733560020015745 5ustar seagleseaglelibdesktop-agnostic-0.3.92/tests/0000775000175000017510000000000011733560020016176 5ustar seagleseaglelibdesktop-agnostic-0.3.92/libdesktop-agnostic/0000775000175000017510000000000011733560020021001 5ustar seagleseaglelibdesktop-agnostic-0.3.92/gen_src/0000775000175000017510000000000011733560020016454 5ustar seagleseaglelibdesktop-agnostic-0.3.92/vapi/0000775000175000017510000000000011733560020015773 5ustar seagleseaglelibdesktop-agnostic-0.3.92/python/0000775000175000017510000000000011733560020016355 5ustar seagleseaglelibdesktop-agnostic-0.3.92/po/0000775000175000017510000000000011733560020015452 5ustar seagleseaglelibdesktop-agnostic-0.3.92/tools/0000775000175000017510000000000011733560020016174 5ustar seagleseaglelibdesktop-agnostic-0.3.92/docs/0000775000175000017510000000000011733560020015764 5ustar seagleseaglelibdesktop-agnostic-0.3.92/.pc/0000775000175000017510000000000011733560021015515 5ustar seagleseaglelibdesktop-agnostic-0.3.92/wafadmin/0000775000175000017510000000000011733561312016627 5ustar seagleseaglelibdesktop-agnostic-0.3.92/0000775000175000017510000000000011733562456015053 5ustar seagleseagle