ObtLink *link = it->data;
+ if (self->update_func)
+ self->update_func(
+ self, OBT_LINKBASE_REMOVED, link, self->update_data);
+
if (obt_link_type(link) == OBT_LINK_TYPE_APPLICATION) {
const GQuark *cats;
gulong i, n;
ObtLink *link = it->data;
+ if (self->update_func)
+ self->update_func(
+ self, OBT_LINKBASE_REMOVED, link, self->update_data);
+
if (obt_link_type(link) == OBT_LINK_TYPE_APPLICATION) {
const GQuark *cats;
gulong i, n;
ObtLinkBaseEntry *e = g_slice_new(ObtLinkBaseEntry);
e->priority = *priority;
e->link = link;
+
+ if (self->update_func)
+ self->update_func(
+ self, OBT_LINKBASE_ADDED, link, self->update_data);
+
list = g_slist_insert_before(list, it, e);
/* this will free 'id' */
}
g_free(id);
-
- if (self->update_func)
- self->update_func(self, self->update_data);
}
ObtLinkBase* obt_linkbase_new(ObtPaths *paths, const gchar *locale,
lb->update_func = func;
lb->update_data = data;
}
+
+GSList *obt_linkbase_category(ObtLinkBase *lb, GQuark category)
+{
+ ObtLinkBaseCategory *cat;
+
+ cat = g_hash_table_lookup(lb->categories, &category);
+ if (!cat) return NULL;
+ else return cat->links;
+}
G_BEGIN_DECLS
+struct _ObtLink;
+
typedef struct _ObtLinkBase ObtLinkBase;
-typedef void (*ObtLinkBaseUpdateFunc)(ObtLinkBase *lb, gpointer data);
+typedef enum {
+ OBT_LINKBASE_ADDED,
+ OBT_LINKBASE_REMOVED,
+} ObtLinkBaseUpdateType;
+
+typedef void (*ObtLinkBaseUpdateFunc)(ObtLinkBase *lb,
+ ObtLinkBaseUpdateType type,
+ struct _ObtLink *link,
+ gpointer data);
/*! Create a new database of ObtLinks.
@param paths An ObtPaths structure.
void obt_linkbase_set_update_func(ObtLinkBase *lb, ObtLinkBaseUpdateFunc func,
gpointer data);
+/*! Returns a list of all known ObtLink* which belong in the given category. */
+GSList *obt_linkbase_category(ObtLinkBase *lb, GQuark category);
+
G_END_DECLS
#endif