[gnome-builder/wip/greeter] project-info: add ide_project_info_get_is_recent()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/greeter] project-info: add ide_project_info_get_is_recent()
- Date: Sun, 10 May 2015 05:31:20 +0000 (UTC)
commit d5635164f3c7bbb8826638e48cd46fd08e61712a
Author: Christian Hergert <christian hergert me>
Date: Sat May 9 22:27:02 2015 -0700
project-info: add ide_project_info_get_is_recent()
A bit of information to know whether or not the project has been opened.
libide/ide-project-info.c | 41 +++++++++++++++++++++++++++++++++++++++++
libide/ide-project-info.h | 5 ++++-
libide/ide-recent-projects.c | 1 +
3 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-project-info.c b/libide/ide-project-info.c
index 737acf2..7f2da77 100644
--- a/libide/ide-project-info.c
+++ b/libide/ide-project-info.c
@@ -46,6 +46,8 @@ struct _IdeProjectInfo
gchar *name;
gint priority;
+
+ guint is_recent : 1;
};
G_DEFINE_TYPE (IdeProjectInfo, ide_project_info, G_TYPE_OBJECT)
@@ -54,6 +56,7 @@ enum {
PROP_0,
PROP_DIRECTORY,
PROP_FILE,
+ PROP_IS_RECENT,
PROP_LAST_MODIFIED_AT,
PROP_NAME,
PROP_PRIORITY,
@@ -189,6 +192,29 @@ ide_project_info_set_name (IdeProjectInfo *self,
}
}
+gboolean
+ide_project_info_get_is_recent (IdeProjectInfo *self)
+{
+ g_return_if_fail (IDE_IS_PROJECT_INFO (self));
+
+ return self->is_recent;
+}
+
+void
+ide_project_info_set_is_recent (IdeProjectInfo *self,
+ gboolean is_recent)
+{
+ g_return_if_fail (IDE_IS_PROJECT_INFO (self));
+
+ is_recent = !!is_recent;
+
+ if (self->is_recent != is_recent)
+ {
+ self->is_recent = is_recent;
+ g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_IS_RECENT]);
+ }
+}
+
static void
ide_project_info_finalize (GObject *object)
{
@@ -220,6 +246,10 @@ ide_project_info_get_property (GObject *object,
g_value_set_object (value, ide_project_info_get_file (self));
break;
+ case PROP_IS_RECENT:
+ g_value_set_boolean (value, ide_project_info_get_is_recent (self));
+ break;
+
case PROP_LAST_MODIFIED_AT:
g_value_set_boxed (value, ide_project_info_get_last_modified_at (self));
break;
@@ -255,6 +285,10 @@ ide_project_info_set_property (GObject *object,
ide_project_info_set_file (self, g_value_get_object (value));
break;
+ case PROP_IS_RECENT:
+ ide_project_info_set_is_recent (self, g_value_get_boolean (value));
+ break;
+
case PROP_LAST_MODIFIED_AT:
ide_project_info_set_last_modified_at (self, g_value_get_boxed (value));
break;
@@ -302,6 +336,13 @@ ide_project_info_class_init (IdeProjectInfoClass *klass)
G_TYPE_FILE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ gParamSpecs [PROP_IS_RECENT] =
+ g_param_spec_boolean ("is-recent",
+ _("Is Recent"),
+ _("Is Recent"),
+ FALSE,
+ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
gParamSpecs [PROP_LAST_MODIFIED_AT] =
g_param_spec_boxed ("last-modified-at",
_("Last Modified At"),
diff --git a/libide/ide-project-info.h b/libide/ide-project-info.h
index 9616474..49a4c09 100644
--- a/libide/ide-project-info.h
+++ b/libide/ide-project-info.h
@@ -31,17 +31,20 @@ gint ide_project_info_compare (IdeProjectInfo *info1,
IdeProjectInfo *info2);
GFile *ide_project_info_get_file (IdeProjectInfo *self);
GFile *ide_project_info_get_directory (IdeProjectInfo *self);
+gboolean ide_project_info_get_is_recent (IdeProjectInfo *self);
gint ide_project_info_get_priority (IdeProjectInfo *self);
+GDateTime *ide_project_info_get_last_modified_at (IdeProjectInfo *self);
const gchar *ide_project_info_get_name (IdeProjectInfo *self);
void ide_project_info_set_file (IdeProjectInfo *self,
GFile *file);
void ide_project_info_set_directory (IdeProjectInfo *self,
GFile *directory);
+void ide_project_info_set_is_recent (IdeProjectInfo *self,
+ gboolean is_recent);
void ide_project_info_set_name (IdeProjectInfo *self,
const gchar *name);
void ide_project_info_set_priority (IdeProjectInfo *self,
gint priority);
-GDateTime *ide_project_info_get_last_modified_at (IdeProjectInfo *self);
G_END_DECLS
diff --git a/libide/ide-recent-projects.c b/libide/ide-recent-projects.c
index dcba064..c285b46 100644
--- a/libide/ide-recent-projects.c
+++ b/libide/ide-recent-projects.c
@@ -170,6 +170,7 @@ ide_recent_projects_load_recent (IdeRecentProjects *self,
project_info = g_object_new (IDE_TYPE_PROJECT_INFO,
"directory", directory,
"file", project_file,
+ "is-recent", TRUE,
"last-modified-at", last_modified_at,
"name", name,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]