[anjuta/libgit2-glib] git: Properly set repositories for GitCommand objects
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/libgit2-glib] git: Properly set repositories for GitCommand objects
- Date: Fri, 19 Jul 2013 04:47:15 +0000 (UTC)
commit b638ee462992bcd1faf8ca8fd5d3aec712b102ab
Author: James Liggett <jrliggett cox net>
Date: Wed Jul 17 22:13:59 2013 -0700
git: Properly set repositories for GitCommand objects
plugins/git/git-command.c | 22 ++++++++++++++++++----
plugins/git/git-command.h | 6 +++---
2 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/plugins/git/git-command.c b/plugins/git/git-command.c
index 213295e..f83c608 100644
--- a/plugins/git/git-command.c
+++ b/plugins/git/git-command.c
@@ -21,6 +21,7 @@
struct _GitCommandPrivate
{
+ GgitRepository *repository;
};
@@ -33,7 +34,7 @@ enum
-G_DEFINE_TYPE (GitCommand, git_command, ANJUTA_TYPE_ASYNC_TASK);
+G_DEFINE_TYPE (GitCommand, git_command, ANJUTA_TYPE_THREAD_POOL_TASK);
static void
git_command_init (GitCommand *git_command)
@@ -54,12 +55,20 @@ git_command_finalize (GObject *object)
static void
git_command_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
+ GitCommand *self;
+
g_return_if_fail (GIT_IS_COMMAND (object));
+ self = GIT_COMMAND (object);
+
switch (prop_id)
{
case PROP_REPOSITORY:
- /* TODO: Add setter for "repository" property here */
+ if (self->priv->repository)
+ g_object_unref (self->priv->repository);
+
+ self->priv->repository = GGIT_REPOSITORY (g_value_get_object (value));
+
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -70,12 +79,16 @@ git_command_set_property (GObject *object, guint prop_id, const GValue *value, G
static void
git_command_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
+ GitCommand *self;
+
g_return_if_fail (GIT_IS_COMMAND (object));
+ self = GIT_COMMAND (object);
+
switch (prop_id)
{
case PROP_REPOSITORY:
- /* TODO: Add getter for "repository" property here */
+ g_value_set_object (value, self->priv->repository);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -100,7 +113,8 @@ git_command_class_init (GitCommandClass *klass)
"repository",
"Git repository that this command operates on",
GGIT_TYPE_REPOSITORY,
- G_PARAM_CONSTRUCT_ONLY));
+
G_PARAM_READABLE |
+
G_PARAM_WRITABLE));
}
diff --git a/plugins/git/git-command.h b/plugins/git/git-command.h
index 5cf60cb..7538e1a 100644
--- a/plugins/git/git-command.h
+++ b/plugins/git/git-command.h
@@ -21,7 +21,7 @@
#define _GIT_COMMAND_H_
#include <glib-object.h>
-#include <libanjuta/anjuta-async-task.h>
+#include <libanjuta/anjuta-thread-pool-task.h>
#include <libgit2-glib/ggit-repository.h>
G_BEGIN_DECLS
@@ -40,12 +40,12 @@ typedef struct _GitCommandPrivate GitCommandPrivate;
struct _GitCommandClass
{
- AnjutaAsyncTaskClass parent_class;
+ AnjutaThreadPoolTaskClass parent_class;
};
struct _GitCommand
{
- AnjutaAsyncTask parent_instance;
+ AnjutaThreadPoolTask parent_instance;
GitCommandPrivate *priv;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]