Ideas for high level Tracker API

All sync APIs? Use g_task_run_in_thread() to make them async? Doesn't tie in with GTK very well in that case.

Using Vala it's not hard to create async and sync variants, it just makes the API look messy.

Tags

This is for managing nao:hasTag properties.

void tracker_tags_add (const char *resource_uri, const char **tags);

void tracker_tags_delete (const char *resource_uri, const char **tags);

const char **tracker_tags_list_for_resource (const char *resource_uri); }}}

We also need TrackerTagsNotifier, which would watch a given resource and emit tags-added and tags-removed signals as appropriate.

Loading TrackerResource from the database

/* tracker_resource_load:
 *
 * Query information about a resource from the Tracker database.
 *
 */
TrackerResource *tracker_sparql_connection_load_resource (TrackerSparqlConnection *connection, const char *uri, int depth);

Based on the tracker-search.c code from the Tracker CLI tool.

typedef struct {
    const char *resource_uri;
    const char *filesystem_path;
    const char *title;
    /* Reserve some space ? */
} TrackerSearchResult;

typedef enum {
    TRACKER_SEARCH_FLAGS_NONE = 0,
    TRACKER_SEARCH_FLAGS_INCLUDE_STOPWORDS = 1 << 0,
    TRACKER_SEARCH_FLAGS_MATCH_ALL_TERMS = 1 << 1,  /* Default is to match ANY */
    TRACKER_SEARCH_FLAGS_NO_FULLTEXT_SEARCH = 1 << 2
}

typedef enum {
    TRACKER_SEARCH_CATEGORY_BOOKMARKS = 1 << 0,
    TRACKER_SEARCH_CATEGORY_CONTACTS = 1 << 1,
    TRACKER_SEARCH_CATEGORY_DOCUMENTS = 1 << 2,
    TRACKER_SEARCH_CATEGORY_EMAILS = 1 << 3,
    TRACKER_SEARCH_CATEGORY_FEEDS = 1 << 4,
    TRACKER_SEARCH_CATEGORY_FILES = 1 << 5,
    TRACKER_SEARCH_CATEGORY_FOLDERS = 1 << 6,
    TRACKER_SEARCH_CATEGORY_IMAGES = 1 << 7,
    TRACKER_SEARCH_CATEGORY_MUSIC = 1 << 8,
    TRACKER_SEARCH_CATEGORY_MUSIC_ALBUMS = 1 << 9,
    TRACKER_SEARCH_CATEGORY_MUSIC_ARTISTS = 1 << 10,
    TRACKER_SEARCH_CATEGORY_SOFTWARE = 1 << 11,
    TRACKER_SEARCH_CATEGORY_SOFTWARE_CATEGORIES = 1 << 12,
    TRACKER_SEARCH_CATEGORY_VIDEOS = 1 << 13,
    TRACKER_SEARCH_CATEGORY_ALL = ~0
}

/* No need for a TrackerSparqlConnection here... we'll call
 * tracker_sparql_connection_get() ourselves.
 *
 * Returns GList of TrackerSearchResult.
 */
GList *tracker_search (const char *text, int offset, int limit, TrackerSearchFlags flags);
GList *tracker_search_full (const char *terms, int offset, int limit, TrackerSearchCategory category, TrackerSearchFlags flags);

Projects/Tracker/Roadmap/ApiIdeas (last edited 2017-04-12 22:47:01 by SamThursfield)