Re: [Vala] does not exist in the context of



You should write at the beginning of the code:
using DBus;
and when you compile the code, you should include - dbus-glib-1.

On Tue, Jun 15, 2010 at 8:54 PM, Dennis Kerrisk <dennis psaudio com> wrote:

               I get this error:
rygel-main.vala:263.23-263.34: error: The name `DbusService2' does not
exist in the context of `Rygel.Main.main'
      service2 = new DbusService2();
                     ^^^^^^^^^^^^
In the code below. Can anybody help me?????




  private static int main (string[] args) {
       Main main;
       DBusService service;
       DBusService2 service2;
       NetworkManagerService nm_service;

       try {
           nm_service = new NetworkManagerService ();
       } catch (DBus.Error err) {
           warning ("Failed to start D-Bus service: %s", err.message);
       }
                                   try {
       var conn1 = DBus.Bus.get(DBus.BusType.SESSION);
       dynamic DBus.Object bus = conn1.get_object("org.freedesktop.DBus",
                                                 "/org/freedesktop/DBus",
                                                 "org.freedesktop.DBus");
       // try to register service in session bus
       uint reply = bus.request_name("org.gnome.Rygel2", (uint) 0);
       assert(reply == DBus.RequestNameReply.PRIMARY_OWNER);
       // start service
      service2 = new DbusService2();
      conn1.register_object("/org/gnome/Rygel2", service2);
      stdout.printf("dak DBUS Connected  to /org/gnome/Rygel2\n");
       // start main loop
   } catch (DBus.Error err) {
       stdout.printf("dak DBUS Error: %s\n", err.message);
   }

       try {
           // Parse commandline options
           CmdlineConfig.parse_args (ref args);

           main = Main.get_default ();
           service = DBusService.get_default ();
       } catch (DBus.Error err) {
           warning ("Failed to start D-Bus service: %s", err.message);
       } catch (CmdlineConfigError.VERSION_ONLY err) {
           return 0;
       } catch (GLib.Error err) {
           error ("%s", err.message);

           return -1;
       }

       int exit_code = main.run ();

       return exit_code;
   }
}


Dennis Kerrisk | Design Engineer  |   PS Audio
4826 Sterling Drive, Boulder, CO 80301
Ph 720-406-8946 x123
www.psaudio.com<http://www.psaudio.com>
dennis psaudio com<mailto:jim psaudio com>


_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




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