[gnome-builder] greeter: allow selecting rows by clicking on them during selection mode
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] greeter: allow selecting rows by clicking on them during selection mode
- Date: Fri, 22 May 2015 00:55:08 +0000 (UTC)
commit 3729aac600c012fbef75615e029b5a770e5ba136
Author: Christian Hergert <christian hergert me>
Date: Thu May 21 17:55:02 2015 -0700
greeter: allow selecting rows by clicking on them during selection mode
src/greeter/gb-greeter-project-row.c | 16 ++++++++++++++++
src/greeter/gb-greeter-window.c | 9 +++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/greeter/gb-greeter-project-row.c b/src/greeter/gb-greeter-project-row.c
index a9677c8..1301eaf 100644
--- a/src/greeter/gb-greeter-project-row.c
+++ b/src/greeter/gb-greeter-project-row.c
@@ -48,6 +48,7 @@ G_DEFINE_TYPE (GbGreeterProjectRow, gb_greeter_project_row, GTK_TYPE_LIST_BOX_RO
enum {
PROP_0,
PROP_PROJECT_INFO,
+ PROP_SELECTED,
PROP_SELECTION_MODE,
LAST_PROP
};
@@ -250,6 +251,10 @@ gb_greeter_project_row_get_property (GObject *object,
g_value_set_object (value, gb_greeter_project_row_get_project_info (self));
break;
+ case PROP_SELECTED:
+ g_object_get_property (G_OBJECT (self->checkbox), "active", value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -265,6 +270,10 @@ gb_greeter_project_row_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_SELECTED:
+ g_object_set_property (G_OBJECT (self->checkbox), "active", value);
+ break;
+
case PROP_SELECTION_MODE:
gb_greeter_project_row_set_selection_mode (self, g_value_get_boolean (value));
break;
@@ -296,6 +305,13 @@ gb_greeter_project_row_class_init (GbGreeterProjectRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GbGreeterProjectRow, languages_box);
gtk_widget_class_bind_template_child (widget_class, GbGreeterProjectRow, title_label);
+ gParamSpecs [PROP_SELECTED] =
+ g_param_spec_boolean ("selected",
+ _("Selected"),
+ _("Selected"),
+ FALSE,
+ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
gParamSpecs [PROP_SELECTION_MODE] =
g_param_spec_boolean ("selection-mode",
_("Selection Mode"),
diff --git a/src/greeter/gb-greeter-window.c b/src/greeter/gb-greeter-window.c
index 8b56ded..f62d522 100644
--- a/src/greeter/gb-greeter-window.c
+++ b/src/greeter/gb-greeter-window.c
@@ -365,6 +365,15 @@ gb_greeter_window__row_activated (GbGreeterWindow *self,
g_assert (GB_IS_GREETER_PROJECT_ROW (row));
g_assert (GTK_IS_LIST_BOX (list_box));
+ if (ide_str_equal0 (egg_state_machine_get_state (self->state_machine), "selection"))
+ {
+ gboolean selected = FALSE;
+
+ g_object_get (row, "selected", &selected, NULL);
+ g_object_set (row, "selected", !selected, NULL);
+ return;
+ }
+
app = g_application_get_default ();
project_info = gb_greeter_project_row_get_project_info (row);
project_file = ide_project_info_get_file (project_info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]