[gnome-builder] recent: notify has-selection when row selection property changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] recent: notify has-selection when row selection property changes
- Date: Sun, 14 Jan 2018 10:30:32 +0000 (UTC)
commit 6ae7ef5d954a44b994739aa619652eae78b64fcb
Author: Christian Hergert <chergert redhat com>
Date: Sun Jan 14 02:29:30 2018 -0800
recent: notify has-selection when row selection property changes
This fixes an issue where clicking on the checkbox of the greeter's
recent section would not update the remove button stage.
Fixes #348
src/plugins/recent/gbp-recent-section.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/recent/gbp-recent-section.c b/src/plugins/recent/gbp-recent-section.c
index 2d0c7754d..4eb5ccdec 100644
--- a/src/plugins/recent/gbp-recent-section.c
+++ b/src/plugins/recent/gbp-recent-section.c
@@ -351,6 +351,17 @@ G_DEFINE_TYPE_WITH_CODE (GbpRecentSection, gbp_recent_section, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (IDE_TYPE_GREETER_SECTION,
greeter_section_iface_init))
+static void
+gbp_recent_section_notify_row_selected (GbpRecentSection *self,
+ GParamSpec *pspec,
+ GbpRecentProjectRow *row)
+{
+ g_assert (GBP_IS_RECENT_SECTION (self));
+ g_assert (GBP_IS_RECENT_PROJECT_ROW (row));
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_HAS_SELECTION]);
+}
+
static void
gbp_recent_section_row_activated (GbpRecentSection *self,
GbpRecentProjectRow *row,
@@ -366,8 +377,6 @@ gbp_recent_section_row_activated (GbpRecentSection *self,
g_object_get (row, "selected", &selected, NULL);
g_object_set (row, "selected", !selected, NULL);
-
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_HAS_SELECTION]);
}
else
{
@@ -384,14 +393,22 @@ create_widget_func (gpointer item,
{
IdeProjectInfo *project_info = item;
GbpRecentProjectRow *row;
+ GbpRecentSection *self = user_data;
g_assert (IDE_IS_PROJECT_INFO (project_info));
+ g_assert (GBP_IS_RECENT_SECTION (self));
row = g_object_new (GBP_TYPE_RECENT_PROJECT_ROW,
"project-info", project_info,
"visible", TRUE,
NULL);
+ g_signal_connect_object (row,
+ "notify::selected",
+ G_CALLBACK (gbp_recent_section_notify_row_selected),
+ self,
+ G_CONNECT_SWAPPED);
+
return GTK_WIDGET (row);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]