[gnome-builder] projects: make IdeProjectInfo public API



commit 4b76b091da98cdc2f9550a99a439d39ec81f7750
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 17 14:42:08 2017 -0800

    projects: make IdeProjectInfo public API
    
    We need this for the upcoming refactoring to allow plugins to
    extend what shows up in the greeter.

 src/libide/ide.h                       |    1 +
 src/libide/projects/ide-project-info.c |   51 ++++++++++++++++++++++++++++++++
 src/libide/projects/ide-project-info.h |   27 +++++++++++++++++
 3 files changed, 79 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/ide.h b/src/libide/ide.h
index bb3692a..63f7b37 100644
--- a/src/libide/ide.h
+++ b/src/libide/ide.h
@@ -127,6 +127,7 @@ G_BEGIN_DECLS
 #include "projects/ide-project-edit.h"
 #include "projects/ide-project-file.h"
 #include "projects/ide-project-files.h"
+#include "projects/ide-project-info.h"
 #include "projects/ide-project-item.h"
 #include "projects/ide-project.h"
 #include "projects/ide-recent-projects.h"
diff --git a/src/libide/projects/ide-project-info.c b/src/libide/projects/ide-project-info.c
index 0d4d10a..23979ee 100644
--- a/src/libide/projects/ide-project-info.c
+++ b/src/libide/projects/ide-project-info.c
@@ -49,6 +49,7 @@ struct _IdeProjectInfo
   gchar      *name;
   gchar      *description;
   gchar     **languages;
+  IdeVcsUri  *vcs_uri;
 
   gint        priority;
 
@@ -69,6 +70,7 @@ enum {
   PROP_LAST_MODIFIED_AT,
   PROP_NAME,
   PROP_PRIORITY,
+  PROP_VCS_URI,
   LAST_PROP
 };
 
@@ -383,6 +385,10 @@ ide_project_info_get_property (GObject    *object,
       g_value_set_int (value, ide_project_info_get_priority (self));
       break;
 
+    case PROP_VCS_URI:
+      g_value_set_boxed (value, ide_project_info_get_vcs_uri (self));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -438,6 +444,10 @@ ide_project_info_set_property (GObject      *object,
       ide_project_info_set_priority (self, g_value_get_int (value));
       break;
 
+    case PROP_VCS_URI:
+      ide_project_info_set_vcs_uri (self, g_value_get_boxed (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -524,6 +534,13 @@ ide_project_info_class_init (IdeProjectInfoClass *klass)
                       0,
                       (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  properties [PROP_VCS_URI] =
+    g_param_spec_boxed ("vcs-uri",
+                        "Vcs Uri",
+                        "The vcs uri of the project, in case it is not local",
+                        IDE_TYPE_VCS_URI,
+                        (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
   g_object_class_install_properties (object_class, LAST_PROP, properties);
 }
 
@@ -571,3 +588,37 @@ ide_project_info_compare (IdeProjectInfo *info1,
   else
     return strcasecmp (name1, name2);
 }
+
+/**
+ * ide_project_info_get_vcs_uri:
+ * @self: an #IdeProjectInfo
+ *
+ * Gets the #IdeVcsUri for the project info. This should be set with the
+ * remote URI for the version control system. It can be used to clone the
+ * project when activated from the greeter.
+ *
+ * Returns: (transfer none) (nullable): a #IdeVcsUri or %NULL
+ *
+ * Since: 3.28
+ */
+IdeVcsUri *
+ide_project_info_get_vcs_uri (IdeProjectInfo *self)
+{
+  g_return_val_if_fail (IDE_IS_PROJECT_INFO (self), NULL);
+
+  return self->vcs_uri;
+}
+
+void
+ide_project_info_set_vcs_uri (IdeProjectInfo *self,
+                              IdeVcsUri      *vcs_uri)
+{
+  g_return_if_fail (IDE_IS_PROJECT_INFO (self));
+
+  if (self->vcs_uri != vcs_uri)
+    {
+      g_clear_pointer (&self->vcs_uri, ide_vcs_uri_unref);
+      self->vcs_uri = ide_vcs_uri_ref (vcs_uri);
+      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_VCS_URI]);
+    }
+}
diff --git a/src/libide/projects/ide-project-info.h b/src/libide/projects/ide-project-info.h
index d73b080..ddc29c6 100644
--- a/src/libide/projects/ide-project-info.h
+++ b/src/libide/projects/ide-project-info.h
@@ -20,7 +20,10 @@
 
 #include <gio/gio.h>
 
+#include "ide-version-macros.h"
+
 #include "doap/ide-doap.h"
+#include "vcs/ide-vcs-uri.h"
 
 G_BEGIN_DECLS
 
@@ -28,34 +31,58 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IdeProjectInfo, ide_project_info, IDE, PROJECT_INFO, GObject)
 
+IDE_AVAILABLE_IN_ALL
 gint         ide_project_info_compare                (IdeProjectInfo  *info1,
                                                       IdeProjectInfo  *info2);
+IDE_AVAILABLE_IN_ALL
 GFile        *ide_project_info_get_file              (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 IdeDoap      *ide_project_info_get_doap              (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 const gchar  *ide_project_info_get_build_system_name (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 const gchar  *ide_project_info_get_description       (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 GFile        *ide_project_info_get_directory         (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 gboolean      ide_project_info_get_is_recent         (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 gint          ide_project_info_get_priority          (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 GDateTime    *ide_project_info_get_last_modified_at  (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 const gchar * const *
               ide_project_info_get_languages         (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 const gchar  *ide_project_info_get_name              (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_3_28
+IdeVcsUri    *ide_project_info_get_vcs_uri           (IdeProjectInfo  *self);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_file              (IdeProjectInfo  *self,
                                                       GFile           *file);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_build_system_name (IdeProjectInfo  *self,
                                                       const gchar     *build_system_name);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_description       (IdeProjectInfo  *self,
                                                       const gchar     *description);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_directory         (IdeProjectInfo  *self,
                                                       GFile           *directory);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_is_recent         (IdeProjectInfo  *self,
                                                       gboolean         is_recent);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_languages         (IdeProjectInfo  *self,
                                                       gchar          **languages);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_name              (IdeProjectInfo  *self,
                                                       const gchar     *name);
+IDE_AVAILABLE_IN_ALL
 void          ide_project_info_set_priority          (IdeProjectInfo  *self,
                                                       gint             priority);
+IDE_AVAILABLE_IN_3_28
+void          ide_project_info_set_vcs_uri           (IdeProjectInfo  *self,
+                                                      IdeVcsUri       *uri);
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]