Re: [gnome-hispano] tomboy-shell-extension



On Tue, 2013-10-22 at 13:43 +0200, Aleksander Morgado wrote:
On 22/10/13 12:20, Rodrigo Moya wrote:
#include <gio/gio.h>

static void
on_name_appeared (GDBusConnection *connection,
                  const gchar *name,
                  const gchar *name_owner,
                  gpointer user_data)
{
  g_print ("Name %s appeared\n", name);
}

static void
on_name_vanished (GDBusConnection *connection,
                  const gchar *name,
                  gpointer user_data)
{
  g_print ("Name %s vanished\n", name);
}

int
main (int argc, char *argv[])
{
  GMainLoop *loop;
  guint watcher_id;

  g_type_init ();

  watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
                                 "org.mpris.MediaPlayer2",
                                 0,
                                 on_name_appeared,
                                 on_name_vanished,
                                 NULL,
                                 NULL);
  loop = g_main_loop_new (NULL, TRUE);

  g_main_loop_run (loop);

  return 0;
}

pero en JavaScript :-)


TambiƩn puedes crear directamente un proxy para la interfaz que vayas a
usar y luego ver si el name-owner existe o no.

this._proxy.connect('notify::g-name-owner', Lang.bind(this, function() {
   if (this._proxy.g_name_owner)
      global.log('Tomboy running');
   else
      global.log('Tomboy not running');
}

mucho mejor, si



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