JanaStoreView

JanaStoreView — A store query interface

Functions

Signals

void added Run Last
void modified Run Last
void progress Run Last
void removed Run Last

Types and Values

Object Hierarchy

    GInterface
    ╰── JanaStoreView

Prerequisites

JanaStoreView requires GObject.

Description

JanaStoreView is the interface for a query, or 'view' on a JanaStore. A store view has functions to query a particular time range of components.

Functions

jana_store_view_get_range ()

void
jana_store_view_get_range (JanaStoreView *self,
                           JanaTime **start,
                           JanaTime **end);

Retrieves the range over which this JanaStoreView is set to span. A NULL start or end indicate an unbounded range.

Parameters

self

A JanaStoreView

 

start

Return location for the start of the view range, or NULL

 

end

Return location for the end of the view range, or NULL

 

jana_store_view_set_range ()

void
jana_store_view_set_range (JanaStoreView *self,
                           JanaTime *start,
                           JanaTime *end);

Sets the range for the JanaStoreView to span. A NULL parameter indicates that that end of the range should be unbounded (i.e. extended infinitely into the past or future). For event stores, this query will match against events that have occurences within this range; for note stores, this query will match against notes that were created or modified within this range.

Parameters

self

A JanaStoreView

 

start

The start of the range, or NULL

 

end

The end of the range, or NULL

 

jana_store_view_add_match ()

JanaStoreViewMatch *
jana_store_view_add_match (JanaStoreView *self,
                           JanaStoreViewField field,
                           const gchar *data);

Adds a matching query to the store view. This allows to search for components whose fields contain a particular string. The matching is done disregarding the case of letters in the string. field must contain a field that matches the component type being store by the underlying JanaStore, otherwise unexpected results may occur.

Parameters

self

A JanaStoreView

 

field

The field to match against

 

data

The matching string to use

 

Returns

A JanaStoreViewMatch, representing the matching query.


jana_store_view_get_matches ()

GList *
jana_store_view_get_matches (JanaStoreView *self);

Retrieves all matching queries that have been added to the store view. See jana_store_view_add_match().

Parameters

self

A JanaStoreView

 

Returns

A newly allocated GList, containing all the JanaStoreViewMatch structures added to the store view. This list must be freed with g_list_free().


jana_store_view_remove_match ()

void
jana_store_view_remove_match (JanaStoreView *self,
                              JanaStoreViewMatch *match);

Removes a matching query from a store view. match must have been returned by jana_store_view_add_match().

Parameters

self

A JanaStoreView

 

match

A JanaStoreViewMatch

 

jana_store_view_clear_matches ()

void
jana_store_view_clear_matches (JanaStoreView *self);

Removes all matching queries from a store view.

Parameters

self

A JanaStoreView

 

jana_store_view_start ()

void
jana_store_view_start (JanaStoreView *self);

Starts the view. No signals will be emitted prior to calling this function.

Parameters

self

A JanaStoreView

 

jana_store_view_get_store ()

JanaStore *
jana_store_view_get_store (JanaStoreView *self);

Retrieves the JanaStore that this view operates on.

Parameters

self

A JanaStoreView

 

Returns

The JanaStore that this view operates on.

Types and Values

JanaStoreView

typedef struct _JanaStoreView JanaStoreView;

The JanaStoreView struct contains only private data.


enum JanaStoreViewField

Enum values for different types of field to use in the jana_store_view_set_match() function. Using field values for incorrect JanaComponent types can have undefined results.

Members

JANA_STORE_VIEW_SUMMARY

An event summary

 

JANA_STORE_VIEW_LOCATION

An event location

 

JANA_STORE_VIEW_DESCRIPTION

An event description

 

JANA_STORE_VIEW_AUTHOR

A note author

 

JANA_STORE_VIEW_RECIPIENT

A note recipient

 

JANA_STORE_VIEW_BODY

A note body

 

JANA_STORE_VIEW_CATEGORY

A component category

 

JANA_STORE_VIEW_ANYFIELD

Match any field

 

Signal Details

The “added” signal

void
user_function (JanaStoreView *store_view,
               gpointer       components,
               gpointer       user_data)

The ::added signal is emitted when new components become visible in the scope of the store view.

Parameters

store_view

the store view that received the signal

 

components

A list of JanaComponents

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “modified” signal

void
user_function (JanaStoreView *store_view,
               gpointer       components,
               gpointer       user_data)

The ::modified signal is emitted when components that were previously in view have been modified in some way.

Parameters

store_view

the store view that received the signal

 

components

A list of JanaComponents

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “progress” signal

void
user_function (JanaStoreView *store_view,
               gint           percent,
               gpointer       user_data)

The ::progress signal is emitted periodically as the query progresses. When the query is complete, percent will be 100.

Parameters

store_view

the store view that received the signal

 

percent

Percentage completion of the current running query

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “removed” signal

void
user_function (JanaStoreView *store_view,
               gpointer       uids,
               gpointer       user_data)

The ::removed signal is emitted when components that were previously in view have been removed from the underling JanaStore.

Parameters

store_view

the store view that received the signal

 

uids

A list of uids

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

See Also

JanaStore