/*
- Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2008-2011 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
gint index);
void
(*clear) (KatzeArray* array);
+
+ void
+ (*update) (KatzeArray* array);
};
G_DEFINE_TYPE (KatzeArray, katze_array, KATZE_TYPE_ITEM);
REMOVE_ITEM,
MOVE_ITEM,
CLEAR,
+ UPDATE,
LAST_SIGNAL
};
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ * KatzeArray::update:
+ * @array: the object on which the signal is emitted
+ *
+ * The array changed and any display widgets should
+ * be updated.
+ *
+ * Since: 0.3.0
+ **/
+ signals[UPDATE] = g_signal_new (
+ "update",
+ G_TYPE_FROM_CLASS (class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ 0,
+ 0,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = katze_array_finalize;
g_signal_emit (array, signals[CLEAR], 0);
}
+
+/**
+ * katze_array_update:
+ * @array: a #KatzeArray
+ *
+ * Indicates that the array changed and any display
+ * widgets should be updated.
+ *
+ * Since: 0.3.0
+ **/
+void
+katze_array_update (KatzeArray* array)
+{
+ g_return_if_fail (KATZE_IS_ARRAY (array));
+
+ g_signal_emit (array, signals[UPDATE], 0);
+}
GTK_TREE_STORE (model), NULL, NULL, bookmarks->filter);
}
+static void
+midori_bookmarks_update_cb (KatzeArray* array,
+ MidoriBookmarks* bookmarks)
+{
+ GtkTreeModel* model = gtk_tree_view_get_model (GTK_TREE_VIEW (bookmarks->treeview));
+ gtk_tree_store_clear (GTK_TREE_STORE (model));
+ midori_bookmarks_read_from_db_to_model (bookmarks,
+ GTK_TREE_STORE (model), NULL, NULL, bookmarks->filter);
+}
+
+
static void
midori_bookmarks_row_changed_cb (GtkTreeModel* model,
GtkTreePath* path,
G_CALLBACK (midori_bookmarks_add_item_cb), bookmarks);
g_signal_connect (bookmarks->array, "remove-item",
G_CALLBACK (midori_bookmarks_remove_item_cb), bookmarks);
+ g_signal_connect (bookmarks->array, "update",
+ G_CALLBACK (midori_bookmarks_update_cb), bookmarks);
g_signal_connect_after (model, "row-changed",
G_CALLBACK (midori_bookmarks_row_changed_cb),
bookmarks);