[libgd] main-view: emit selection-changed when a row is deleted
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd] main-view: emit selection-changed when a row is deleted
- Date: Tue, 5 Mar 2013 19:13:33 +0000 (UTC)
commit 33561eea68af66209af8426c9ff55cc3143f0ab5
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Mar 5 14:12:05 2013 -0500
main-view: emit selection-changed when a row is deleted
When a row is deleted from the model, it could be part of our selection,
so emit the selection-changed signal to clients.
libgd/gd-main-view.c | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/libgd/gd-main-view.c b/libgd/gd-main-view.c
index 8e23083..e710bb1 100644
--- a/libgd/gd-main-view.c
+++ b/libgd/gd-main-view.c
@@ -672,6 +672,16 @@ on_view_selection_changed (GtkWidget *view,
}
static void
+on_row_deleted_cb (GtkTreeModel *model,
+ GtkTreePath *path,
+ gpointer user_data)
+{
+ GdMainView *self = user_data;
+
+ g_signal_emit (self, signals[VIEW_SELECTION_CHANGED], 0);
+}
+
+static void
gd_main_view_apply_model (GdMainView *self)
{
GdMainViewGeneric *generic = get_generic (self);
@@ -788,12 +798,22 @@ gd_main_view_set_model (GdMainView *self,
{
if (model != self->priv->model)
{
+ if (self->priv->model)
+ g_signal_handlers_disconnect_by_func (self->priv->model,
+ on_row_deleted_cb, self);
+
g_clear_object (&self->priv->model);
if (model)
- self->priv->model = g_object_ref (model);
+ {
+ self->priv->model = g_object_ref (model);
+ g_signal_connect (self->priv->model, "row-deleted",
+ G_CALLBACK (on_row_deleted_cb), self);
+ }
else
- self->priv->model = NULL;
+ {
+ self->priv->model = NULL;
+ }
gd_main_view_apply_model (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODEL]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]