Package: valac-0.22 Version: 0.22.1-2 Severity: normal Dear Maintainer,
While building the enclosed xdg-autostart.vala file, I noticed some warnings issued by the C compiler and pointing out the use of deprecated function: xdg-autostart.vala.c: In function 'main': xdg-autostart.vala.c:704:2: warning: 'g_type_init' is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:669) [-Wdeprecated-declarations] g_type_init (); ^ Or incompatible pointer casts: xdg-autostart.vala.c: In function ‘autostart_xdg_autostart’: xdg-autostart.vala.c:632:18: warning: assignment from incompatible pointer type [enabled by default] _tmp4_ = _tmp3_ = g_get_system_config_dirs (); ^ xdg-autostart.vala.c:668:3: warning: passing argument 2 of ‘g_hash_table_foreach’ from incompatible pointer type [enabled by default] g_hash_table_foreach (_tmp13_, _autostart_launch_file_gh_func, NULL); ^ I assume these warnings are caused by the the compilation of GLib vala code into outdated GLib C code. Best wishes, Fabien -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (500, 'testing'), (100, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages valac-0.22 depends on: ii libc6 2.17-97 ii libglib2.0-0 2.38.2-5 ii libglib2.0-dev 2.38.2-5 ii libvala-0.22-0 0.22.1-2 ii valac-0.22-vapi 0.22.1-2 valac-0.22 recommends no packages. valac-0.22 suggests no packages. -- no debconf information
// valac xdg-autostart.vala --disable-assert -Xcc "-march=generic -Os" /* * xdg-autostart * Copyright (c) 2011-2013 Fabrice THIROUX <fabrice.thir...@free.fr>. * * This program 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 3 of the License, or any * later version. See http://www.gnu.org/copyleft/lgpl.html the full text * of the license. * * 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. */ class Autostart { static string desktop; static void launch_file (string key, string filename) { string[] show_list; string? exec; bool found; KeyFile kf = new KeyFile(); try { if (kf.load_from_file (filename, KeyFileFlags.NONE)) { try { message ("Processing %s file.", filename); /* Hidden desktop file don't have to be launched */ if (kf.get_boolean ("Desktop Entry", "Hidden")) { message ("Hidden attribute set, aborting."); return; } } catch (KeyFileError e) {} try { /* Check if the desktop file is launched in current desktop environment */ if (kf.has_key ("Desktop Entry", "OnlyShowIn")) { show_list = kf.get_string_list ("Desktop Entry", "OnlyShowIn"); found = false; foreach (string de in show_list) { if (de == desktop) { found = true; break; } } /* Current desktop is not found in the OnlyShowIn list */ if (found == false) { message ("Not found in OnlyShowIn list, aborting."); return; } } /* Check if the desktop file is not launched in current desktop environment */ else if (kf.has_key ("Desktop Entry", "NotShowIn")) { show_list = kf.get_string_list ("Desktop Entry", "NotShowIn"); foreach (string de in show_list) { if (de == desktop) { message ("Found in NotShowIn list, aborting."); return; } } } /* Lookup for TryExec file and check if it's found in path */ if (kf.has_key ("Desktop Entry", "TryExec")) { exec = kf.get_string ("Desktop Entry", "TryExec"); if (exec != null) { if (Environment.find_program_in_path (exec) == null) { message ("Can't find %s from TryExec key, aborting.", exec); return; // Exec is not found in path => exit } } } /* Find the command line to launch and launch it */ exec = kf.get_string ("Desktop Entry", "Exec"); try { Process.spawn_command_line_async (exec); message ("Launching: %s (%s)", exec, key); } catch (SpawnError e) { warning ("Error: %s\n", e.message); } } catch (KeyFileError e) { warning ("KeyFileError: %s\n", e.message); } } } catch (FileError e) { warning ("Error: %s\n", e.message); } } static void get_files_in_dir (HashTable<string, string> table, string directory) { unowned string filename; string dir_path = Path.build_filename (directory, "autostart"); try { Dir d = Dir.open (dir_path, 0); while ((filename = d.read_name ()) != null) { if (filename.has_suffix (".desktop")) { table.replace (filename, Path.build_filename (dir_path, filename)); } } } catch (FileError e) { warning ("Error: %s\n", e.message); } } static void xdg_autostart () { HashTable<string, string> table = new HashTable<string, string> (str_hash, str_equal); weak string[] dirs = Environment.get_system_config_dirs (); foreach (string dir in dirs) { get_files_in_dir (table, dir); } get_files_in_dir (table, Environment.get_user_config_dir ()); if (table.size() > 0) { table.for_each (launch_file); } } static int main (string[] args) { if (args.length > 1) { desktop = args[1]; } else { desktop = "Openbox"; } xdg_autostart (); return 0; } }