示例#1
0
static void
notification_cb (NotifyNotification *notification,
                 gchar              *action,
                 gpointer            user_data)
{
  GAppLaunchContext *ctx;
  GDesktopAppInfo *app;
  GError *error;

  /* TODO: Hmm, would be nice to set the screen, timestamp etc etc */
  ctx = g_app_launch_context_new ();

  app = g_desktop_app_info_new ("gnome-online-accounts-panel.desktop");

  error = NULL;
  if (!g_app_info_launch (G_APP_INFO (app),
                          NULL, /* files */
                          ctx,
                          &error))
    {
      goa_warning ("Error launching: %s (%s, %d)",
                   error->message, g_quark_to_string (error->domain), error->code);
      g_error_free (error);
    }
  g_object_unref (app);
  g_object_unref (ctx);
}
static VALUE
rg_initialize(VALUE self)
{
        G_INITIALIZE(self, g_app_launch_context_new());

        return Qnil;
}
GAppLaunchContext *
giggle_create_app_launch_context (GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,14,0)
	GdkAppLaunchContext *context;
	GdkScreen           *screen = NULL;

	context = gdk_app_launch_context_new ();

	if (widget) {
		screen = gtk_widget_get_screen (widget);
		gdk_app_launch_context_set_screen (context, screen);
	}

	return G_APP_LAUNCH_CONTEXT (context);
#else
	return g_app_launch_context_new ();
#endif
}