void Plugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) {
    Q_ASSERT(uri == QLatin1String("org.hildon.multimedia"));

    QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
    
    // Disable mafw syslog logging
    mafw_log_init(NULL);
}
Beispiel #2
0
gint
main (gint   argc,
      gchar *argv[])
{
	setpriority (PRIO_PROCESS, 0, 10);
	mafw_log_init(NULL);
        if (!init_ui (&argc, &argv)) {
           return -2;
        }

        if (!init_app ()) {
           return -3;
        }

        gtk_main ();

        return 0;
}
Beispiel #3
0
/**
 * Runs @runner and returns whether any tests failed.  Doesn't run tests
 * in separate processes if @nofork.
 */
int checkmore_run(SRunner *runner, gboolean nofork)
{
	int nfailed;

	g_type_init();
	mafw_log_init(NULL);

	/* In certain cases you may require or simply prefer nonforking. */
	if (nofork)
		srunner_set_fork_status(runner, CK_NOFORK);

#ifdef __ARMEL__
	/* qemu doesn't like uncaught signals. */
	signal(SIGABRT, SIG_IGN);
#endif

	/*
	 * On timeout `check' kill()s the entire process group sometimes,
	 * including itself, and more problematically, including the parent,
	 * which is rather annoying when you try to run tests from your
	 * editor.  To prevent that get a new process group now.  It is not
	 * a problem if the test is run from a shell because it sets a new
	 * pgroup unconditionally.
	 */
	setpgid(0, 0);

	/* srunner_free() frees the Suite and all TCase:s as well.
	 * The $CK_VERBOSITY environment variable may be used to
	 * control amount of output (defaults to CK_NORMAL). */
	srunner_run_all(runner, CK_ENV);
	nfailed = srunner_ntests_failed(runner);
	srunner_free(runner);

	/* Assuming that nothing else is run after this function, let's unref
	 * the internal mainloop. */
	if (Mainloop) {
		g_main_loop_unref(Mainloop);
		Mainloop = NULL;
	}

	return nfailed != 0;
}
int
main (int argc, gchar *argv[])
{
	if (!check_command_line (argc, argv,
				 &command, &playlist_name, &object_id)) {
		g_error ("Please, provide one of these sets of arguments:\n"
			 "  create <playlist-name>\n"
			 "  remove <playlist-name>\n"
			 "  show <playlist-name>\n"
                         "  add-item <playlist-name> <object-id>\n",
			 "  remove-item <playlist-name> <object-id>\n");
	}

	g_type_init ();
	mafw_log_init (G_LOG_DOMAIN ":ALL");

	g_timeout_add (100, execute_command, NULL);
	main_loop = g_main_loop_new (NULL, FALSE);
	g_main_loop_run (main_loop);

	return 0;
}
Beispiel #5
0
/* The main function */
int main(int arch, const char *argv[])
{
	int ifd;
	unsigned i;
	MafwRegistry *regi;

	/* Don't log debug messages. */
	mafw_log_init(":warning");

	/* Init wrapping */
	g_type_init();
	regi = MAFW_REGISTRY(mafw_registry_get_instance());
	mafw_shared_init(regi, NULL);
	wrapper_init();

	/* Load the plugins specified on the command line. */
	if ((ifd = inotify_init()) < 0)
		g_warning("inotify_init: %m");
	for (i = 1; argv[i]; i++) {
		DIR *hdir;
		gchar entry[PATH_MAX];
		const struct dirent *dent;

		strncpy(entry, argv[i], PATH_MAX);
		if (entry[PATH_MAX - 1] != '\0') {
			g_warning("Argument %d is too long, skipping", i-1);
			continue;
		}

		hdir = opendir(entry);
		if (hdir != NULL) {
			while ((dent = readdir(hdir)) != NULL) {
				gchar *path;

				/* Try to ignore non-shared object files. */
				if (!g_str_has_suffix(dent->d_name, ".so")
				    && !strstr(dent->d_name, ".so."))
					continue;
				path = g_strjoin("/", entry, dent->d_name,
						 NULL);
				if (load(regi, path))
					watch(ifd, path);
				g_free(path);
			} /* while */
			closedir(hdir);
			watch(ifd, entry);
		} else if (errno == ENOTDIR) {
			if (load(regi, entry))
				watch(ifd, entry);
		} else if (errno == ENOENT)
			load(regi, entry);
		else
			g_error("%s: %m", entry);
	} /* for */

	/* Watch $ifd. */
	if (ifd >= 0)
		g_io_add_watch(g_io_channel_unix_new(ifd), G_IO_IN,
			       (GIOFunc)renaissance, argv);

	/* The main loop should not return. */
	g_main_loop_run(g_main_loop_new(NULL, FALSE));
	return 1;
}
/*
 * Loads MAFW plugins.
 *
 * This function lods out-of-process extensions and hooks to
 * renderer/source-added and renderer/source-removed signals
 * for dynamic extension discovery and removal.
 *
 * Also, this function allows loading of in-process extensions
 * defined through an environment variable.
 *
 * The object_id parameter is used to play that object as soon
 * as the renderer of interest is loaded.
 */
gboolean static
app_init (gchar *playlist_name)
{
        GError *error = NULL;
	gchar **plugins = NULL;
	GList *extension_list = NULL;
	MafwRegistry *registry = NULL;

	/* ----- Basic MAFW setup ---- */

	/* Init GType */
        g_type_init ();

	/* Init MAFW log (show all messages) */
	mafw_log_init (G_LOG_DOMAIN ":ALL");

	/* ---- Start out-of-process plugin loading ---- */

	g_print ("[INFO] Checking for out-of-process plugins...\n");

	/* Check available plugins  */
	registry = MAFW_REGISTRY (mafw_registry_get_instance());
	if (registry == NULL) {
		g_error ("app_init: Failed to get MafwRegistry reference\n");
		return FALSE;
	}

	/* Start out-of-process extension discovery */
	mafw_shared_init (registry, &error);
	if (error != NULL)
	{
		g_warning ("Ext. discovery failed: %s",
			   error->message);
		g_error_free(error);
		error = NULL;
	}

	/* Connect to extension discovery signals. These signals will be
	   emitted when new extensions are started or removed */
	g_signal_connect (registry,
			  "renderer_added",
			  G_CALLBACK(renderer_added_cb), playlist_name);

	g_signal_connect (registry,
			  "renderer_removed",
			  G_CALLBACK(renderer_removed_cb), NULL);

	g_signal_connect (registry,
			  "source_added",
			  G_CALLBACK(source_added_cb), NULL);

	g_signal_connect (registry,
			  "source_removed",
			  G_CALLBACK(source_removed_cb), NULL);

	/* Also, check for already started extensions */
	extension_list = mafw_registry_get_renderers(registry);
	while (extension_list)
	{
		renderer_added_cb (registry,
				   G_OBJECT(extension_list->data), NULL);
		extension_list = g_list_next(extension_list);
	}

	extension_list = mafw_registry_get_sources(registry);
	while (extension_list)
	{
		source_added_cb (registry,
				 G_OBJECT(extension_list->data), NULL);
		extension_list = g_list_next(extension_list);
	}


	/* ---- Start in-process plugin loading ---- */

	/* MAFW_INP_PLUGINS shold contain a list of paths
	   to plugin files to be loaded in-process */

	g_print ("[INFO] Checking for in-process plugins...\n");
	if (g_getenv("MAFW_INP_PLUGINS") != NULL) {
		plugins = g_strsplit (g_getenv ("MAFW_INP_PLUGINS"),
				      G_SEARCHPATH_SEPARATOR_S,
				      0);

		for (; NULL != *plugins; plugins++) {
			g_print ("[INFO] Loading in-process plugin %s...\n",
				 *plugins);

			mafw_registry_load_plugin (MAFW_REGISTRY(registry),
						   *plugins,
						   &error);

			if (error != NULL) {
				gchar* msg;
				msg = g_strdup_printf (
					"Unable to load inp. plugin %s: %s",
					*plugins,
					error->message);

				g_warning ("Plugin loading failed: %s", msg);

				g_free(msg);
				g_error_free(error);
				error = NULL;
			}
		}
	} else {
		g_print ("[INFO]     No in-process plugins requested.\n");
	}
}