[rhythmbox] display-page-model: add page-inserted signal
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] display-page-model: add page-inserted signal
- Date: Mon, 19 Mar 2012 23:07:56 +0000 (UTC)
commit a6b7476465116d01923509d77cf37b83cd75dcda
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue Mar 20 09:05:24 2012 +1000
display-page-model: add page-inserted signal
It's too hard to use the GtkTreeModel row-inserted signal, because
the visibility filtering performed by the filter model often means
you just get a row-inserted signal for a page group, rather than
one for each of the pages inside it.
sources/rb-display-page-model.c | 23 +++++++++++++++++++++++
sources/rb-display-page-model.h | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/sources/rb-display-page-model.c b/sources/rb-display-page-model.c
index 3f43aa5..ac9504c 100644
--- a/sources/rb-display-page-model.c
+++ b/sources/rb-display-page-model.c
@@ -70,6 +70,7 @@
enum
{
DROP_RECEIVED,
+ PAGE_INSERTED,
LAST_SIGNAL
};
@@ -670,6 +671,7 @@ rb_display_page_model_add_page (RBDisplayPageModel *page_model, RBDisplayPage *p
RB_DISPLAY_PAGE_MODEL_COLUMN_PLAYING, FALSE,
RB_DISPLAY_PAGE_MODEL_COLUMN_PAGE, page,
-1);
+ g_signal_emit (G_OBJECT (page_model), rb_display_page_model_signals[PAGE_INSERTED], 0, page, &iter);
g_signal_connect_object (page, "notify::name", G_CALLBACK (page_notify_cb), page_model, 0);
g_signal_connect_object (page, "notify::visibility", G_CALLBACK (page_notify_cb), page_model, 0);
@@ -872,6 +874,27 @@ rb_display_page_model_class_init (RBDisplayPageModelClass *klass)
3,
RB_TYPE_DISPLAY_PAGE, G_TYPE_INT, G_TYPE_POINTER);
+ /**
+ * RBDisplayPageModel::page-inserted:
+ * @model: the #RBDisplayPageModel
+ * @page: the #RBDisplayPage that was inserted
+ * @iter: a #GtkTreeIter indicating the page position
+ *
+ * Emitted when a new page is inserted into the model.
+ * Use this instead of GtkTreeModel::row-inserted as this
+ * doesn't get complicated by visibility filtering.
+ */
+ rb_display_page_model_signals[PAGE_INSERTED] =
+ g_signal_new ("page-inserted",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (RBDisplayPageModelClass, page_inserted),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE,
+ 2,
+ RB_TYPE_DISPLAY_PAGE, GTK_TYPE_TREE_ITER);
+
if (!drag_target_list) {
drag_target_list = gtk_target_list_new (dnd_targets, G_N_ELEMENTS (dnd_targets));
}
diff --git a/sources/rb-display-page-model.h b/sources/rb-display-page-model.h
index 29e26b0..09e357b 100644
--- a/sources/rb-display-page-model.h
+++ b/sources/rb-display-page-model.h
@@ -67,6 +67,9 @@ struct _RBDisplayPageModelClass
RBDisplayPage *target,
GtkTreeViewDropPosition pos,
GtkSelectionData *data);
+ void (*page_inserted) (RBDisplayPageModel *model,
+ RBDisplayPage *page,
+ GtkTreeIter *iter);
};
GType rb_display_page_model_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]