[anjuta] git: Rework the clone command so that it is structured like all of the other commands
- From: James Liggett <jrliggett src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjuta] git: Rework the clone command so that it is structured like all of the other commands
- Date: Mon, 10 Aug 2009 00:53:48 +0000 (UTC)
commit ad5ccc432c036d0ed65906251abbc703324a51f3
Author: James Liggett <jrliggett cox net>
Date: Sun Aug 9 15:56:13 2009 -0700
git: Rework the clone command so that it is structured like all of the other commands
plugins/git/git-clone-command.c | 63 +++++++++++++++-----------------------
plugins/git/git-clone-command.h | 8 ++++-
2 files changed, 31 insertions(+), 40 deletions(-)
---
diff --git a/plugins/git/git-clone-command.c b/plugins/git/git-clone-command.c
index d6924c5..8fbb96a 100644
--- a/plugins/git/git-clone-command.c
+++ b/plugins/git/git-clone-command.c
@@ -24,49 +24,44 @@
#include "git-clone-command.h"
-
-G_DEFINE_TYPE (GitCloneCommand, git_clone_command, GIT_TYPE_COMMAND);
-
-typedef struct _GitCloneCommandPrivate GitCloneCommandPrivate;
-
-struct _GitCloneCommandPrivate
+struct _GitCloneCommandPriv
{
- gchar *uri;
+ gchar *url;
gchar *repository_name;
};
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIT_TYPE_CLONE_COMMAND, GitCloneCommandPrivate))
+G_DEFINE_TYPE (GitCloneCommand, git_clone_command, GIT_TYPE_COMMAND);
static guint
git_clone_command_run (AnjutaCommand *command)
{
- GitCloneCommandPrivate *priv;
- GitCommand *self;
+ GitCloneCommand *self;
- priv = GET_PRIVATE (command);
- self = GIT_COMMAND (command);
+ self = GIT_CLONE_COMMAND (command);
- git_command_add_arg (self, "clone");
- git_command_add_arg (self, priv->uri);
- git_command_add_arg (self, priv->repository_name);
+ git_command_add_arg (GIT_COMMAND (self), "clone");
+ git_command_add_arg (GIT_COMMAND (self), self->priv->url);
+ git_command_add_arg (GIT_COMMAND (self), self->priv->repository_name);
return 0;
}
static void
-git_clone_command_init (GitCloneCommand *object)
+git_clone_command_init (GitCloneCommand *self)
{
- /* TODO: Add initialization code here */
+ self->priv = g_new0 (GitCloneCommandPriv, 1);
}
static void
git_clone_command_finalize (GObject *object)
{
- GitCloneCommandPrivate *priv = GET_PRIVATE (object);
+ GitCloneCommand *self;
+
+ self = GIT_CLONE_COMMAND (object);
- g_free (priv->uri);
- g_free (priv->repository_name);
+ g_free (self->priv->url);
+ g_free (self->priv->repository_name);
+ g_free (self->priv);
G_OBJECT_CLASS (git_clone_command_parent_class)->finalize (object);
}
@@ -81,29 +76,21 @@ git_clone_command_class_init (GitCloneCommandClass *klass)
object_class->finalize = git_clone_command_finalize;
parent_class->output_handler = git_command_send_output_to_info;
command_class->run = git_clone_command_run;
-
- g_type_class_add_private (klass, sizeof (GitCloneCommandPrivate));
}
GitCloneCommand *
-git_clone_command_new (const gchar *uri, const gchar *working_directory,
+git_clone_command_new (const gchar *working_directory, const gchar *url,
const gchar *repository_name)
{
- GitCloneCommand *clone_command;
- GitCloneCommandPrivate *priv;
+ GitCloneCommand *self;
- g_assert (uri != NULL);
- g_assert (working_directory != NULL);
- g_assert (repository_name != NULL);
-
- clone_command = g_object_new (GIT_TYPE_CLONE_COMMAND,
- "working-directory", working_directory,
- "single-line-output", TRUE,
- NULL);
+ self = g_object_new (GIT_TYPE_CLONE_COMMAND,
+ "working-directory", working_directory,
+ "single-line-output", TRUE,
+ NULL);
- priv = GET_PRIVATE (clone_command);
- priv->uri = g_strdup (uri);
- priv->repository_name = g_strdup (repository_name);
+ self->priv->url = g_strdup (url);
+ self->priv->repository_name = g_strdup (repository_name);
- return clone_command;
+ return self;
}
\ No newline at end of file
diff --git a/plugins/git/git-clone-command.h b/plugins/git/git-clone-command.h
index 9d17c11..238b8df 100644
--- a/plugins/git/git-clone-command.h
+++ b/plugins/git/git-clone-command.h
@@ -39,6 +39,7 @@ G_BEGIN_DECLS
typedef struct _GitCloneCommandClass GitCloneCommandClass;
typedef struct _GitCloneCommand GitCloneCommand;
+typedef struct _GitCloneCommandPriv GitCloneCommandPriv;
struct _GitCloneCommandClass
{
@@ -48,12 +49,15 @@ struct _GitCloneCommandClass
struct _GitCloneCommand
{
GitCommand parent_instance;
+
+ GitCloneCommandPriv *priv;
};
GType git_clone_command_get_type (void) G_GNUC_CONST;
-GitCloneCommand *git_clone_command_new (const gchar *uri, const gchar *working_directory,
- const gchar *repository_name);
+GitCloneCommand *git_clone_command_new (const gchar *working_directory,
+ const gchar *url,
+ const gchar *repository_name);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]