Ejemplo n.º 1
0
/**
 * tracker_extract_module_manager_get_mimetype_handlers:
 * @mimetype: a mimetype string
 *
 * Returns a #TrackerMimetypeInfo struct containing information about
 * the modules that handle @mimetype, or %NULL if no modules handle
 * @mimetype.
 *
 * The modules are ordered from most to least specific, and the
 * returned #TrackerMimetypeInfo already points to the first
 * module.
 *
 * Returns: (transfer full): (free-function: tracker_mimetype_info_free): (allow-none):
 * A #TrackerMimetypeInfo holding the information about the different
 * modules handling @mimetype, or %NULL if no modules handle @mimetype.
 *
 * Since: 0.12
 **/
TrackerMimetypeInfo *
tracker_extract_module_manager_get_mimetype_handlers (const gchar *mimetype)
{
	TrackerMimetypeInfo *info;
	GList *mimetype_rules;

	g_return_val_if_fail (mimetype != NULL, NULL);

	mimetype_rules = lookup_rules (mimetype);

	if (!mimetype_rules) {
		return NULL;
	}

	info = g_slice_new0 (TrackerMimetypeInfo);
	info->rules = mimetype_rules;
	info->cur = info->rules;

	if (!initialize_first_module (info)) {
		tracker_mimetype_info_free (info);
		info = NULL;
	}

	return info;
}
Ejemplo n.º 2
0
void ruleif_init(OhmPlugin *plugin)
{
    (void)plugin;

    ENTER;
    
    lookup_rules();

    LEAVE;
}
Ejemplo n.º 3
0
int ruleif_notification_request(const char *what, ...)
{
    va_list  ap;
    char    *argv[16];
    char  ***retval;
    char    *name;
    int      type;
    void    *value;
    int      i;
    int      status;
    int      success = FALSE;

    if (notreq < 0)
        lookup_rules();

    if (notreq >= 0) {
        retval = NULL;

        argv[i=0] = (char *)'s';
        argv[++i] = (char *)what;

        status = rule_eval(notreq, &retval, (void **)argv, (i+1)/2);

        OHM_DEBUG(DBG_RULE, "rule_eval returned %d (retval %p)",status,retval);

        if (status <= 0) {
            if (retval && status < 0)
                rules_dump_result(retval);
        }
        else {
            if (OHM_LOGGED(INFO))
                rules_dump_result(retval);

            if (retval && retval[0] != NULL && retval[1] == NULL) {

                success = TRUE;

                va_start(ap, what);

                while ((name = va_arg(ap, char *)) != NULL) {
                    type  = va_arg(ap, int);
                    value = va_arg(ap, void *);

                    if (!copy_value(name, type, value, retval[0])) {
                        success = FALSE;
                        break;
                    }
                }
                    
                va_end(ap);                    
            }
        }
Ejemplo n.º 4
0
GModule *
tracker_extract_module_manager_get_for_mimetype (const gchar                  *mimetype,
                                                 TrackerExtractInitFunc       *init_func,
                                                 TrackerExtractShutdownFunc   *shutdown_func,
                                                 TrackerExtractMetadataFunc   *extract_func)
{
	ModuleInfo *module_info = NULL;
	GList *mimetype_rules;

	if (init_func) {
		*init_func = NULL;
	}

	if (shutdown_func) {
		*shutdown_func = NULL;
	}

	if (extract_func) {
		*extract_func = NULL;
	}

	if (!initialized &&
	    !tracker_extract_module_manager_init ()) {
		return NULL;
	}

	mimetype_rules = lookup_rules (mimetype);

	if (!mimetype_rules) {
		return NULL;
	}

	module_info = load_module (mimetype_rules->data, FALSE);

	if (!module_info) {
		return NULL;
	}

	if (extract_func) {
		*extract_func = module_info->extract_func;
	}

	if (init_func) {
		*init_func = module_info->init_func;
	}

	if (shutdown_func) {
		*shutdown_func = module_info->shutdown_func;
	}

	return module_info->module;
}
Ejemplo n.º 5
0
gboolean
tracker_extract_module_manager_mimetype_is_handled (const gchar *mimetype)
{
	GList *mimetype_rules;

	if (!initialized &&
	    !tracker_extract_module_manager_init ()) {
		return FALSE;
	}

	mimetype_rules = lookup_rules (mimetype);

	return mimetype_rules != NULL;
}
Ejemplo n.º 6
0
GStrv
tracker_extract_module_manager_get_fallback_rdf_types (const gchar *mimetype)
{
	GList *l, *list = lookup_rules (mimetype);
	GArray *res = g_array_new (TRUE, TRUE, sizeof (gchar *));
	gchar **types;

	for (l = list; l; l = l->next) {
		RuleInfo *r_info = l->data;

		if (r_info->fallback_rdf_type != NULL) {
			gchar *val = g_strdup (r_info->fallback_rdf_type);
			g_array_append_val (res, val);
		}
	}

	types = (GStrv) res->data;
	g_array_free (res, FALSE);

	return types;
}