Re: [Vala] Question about signal connection



Johan wrote:
Hi,
I wanna check if a file has been changed, and then take some action.
However I am not getting the trick with the signal connection.
the code below returns:
(process:18773): GLib-GObject-WARNING **: IA__g_object_connect: invalid
signal spec "changed"

well I have checked the specs of GLIB and everything seems to be
correct, maybe something with the Vala notation?

I appreciate any help!
johan

using GLib;
using Gtk;

public class HelloVala: GLib.Object {
int handler2 (FileMonitor monitor,
                  File file, File other_file, FileMonitorEvent
event_type) {
   return 0;
  }

public static int main (string[] args) {
   var file = File.new_for_path ("test.png");
   var monitor = file.monitor_file(FileMonitorFlags.NONE);
   monitor.connect("changed",handler2);
   return 0;
   }
}

public class HelloVala: GLib.Object {
    static void handler2 (FileMonitor monitor, File file, File? other_file,
                          FileMonitorEvent event_type) {
        // ...
    }

    public static int main (string[] args) {
        var file = File.new_for_path ("test.png");
        var monitor = file.monitor_file (FileMonitorFlags.NONE);
        monitor.changed.connect (handler2);
        return 0;
    }
}


Best regards,

Frederik



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]