1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) James Liggett 2007 <jrliggett@cox.net>
6 * Portions based on the original Subversion plugin
7 * Copyright (C) Johannes Schmid 2005
9 * anjuta is free software.
11 * You may redistribute it and/or modify it under the terms of the
12 * GNU General Public License, as published by the Free Software
13 * Foundation; either version 2 of the License, or (at your option)
16 * anjuta is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 * See the GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with anjuta. If not, write to:
23 * The Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor
25 * Boston, MA 02110-1301, USA.
28 #include "svn-add-command.h"
30 struct _SvnAddCommandPriv
37 G_DEFINE_TYPE (SvnAddCommand
, svn_add_command
, SVN_TYPE_COMMAND
);
40 svn_add_command_init (SvnAddCommand
*self
)
42 self
->priv
= g_new0 (SvnAddCommandPriv
, 1);
46 svn_add_command_finalize (GObject
*object
)
50 self
= SVN_ADD_COMMAND (object
);
52 svn_command_free_path_list (self
->priv
->paths
);
55 G_OBJECT_CLASS (svn_add_command_parent_class
)->finalize (object
);
59 svn_add_command_run (AnjutaCommand
*command
)
62 SvnCommand
*svn_command
;
66 self
= SVN_ADD_COMMAND (command
);
67 svn_command
= SVN_COMMAND (command
);
68 current_path
= self
->priv
->paths
;
72 error
= svn_client_add2 (current_path
->data
,
74 self
->priv
->recursive
,
75 svn_command_get_client_context (svn_command
),
76 svn_command_get_pool (svn_command
));
80 svn_command_set_error (svn_command
, error
);
84 current_path
= g_list_next (current_path
);
91 svn_add_command_class_init (SvnAddCommandClass
*klass
)
93 GObjectClass
*object_class
= G_OBJECT_CLASS (klass
);
94 AnjutaCommandClass
*command_class
= ANJUTA_COMMAND_CLASS (klass
);
96 object_class
->finalize
= svn_add_command_finalize
;
97 command_class
->run
= svn_add_command_run
;
102 svn_add_command_new_path (const gchar
*path
, gboolean force
, gboolean recursive
)
106 self
= g_object_new (SVN_TYPE_ADD_COMMAND
, NULL
);
107 self
->priv
->paths
= g_list_append (self
->priv
->paths
,
108 svn_command_make_canonical_path (SVN_COMMAND (self
),
110 self
->priv
->force
= force
;
111 self
->priv
->recursive
= recursive
;
117 svn_add_command_new_list (GList
*paths
, gboolean force
, gboolean recursive
)
122 self
= g_object_new (SVN_TYPE_ADD_COMMAND
, NULL
);
123 current_path
= paths
;
127 self
->priv
->paths
= g_list_append (self
->priv
->paths
,
128 svn_command_make_canonical_path (SVN_COMMAND (self
),
129 current_path
->data
));
130 current_path
= g_list_next (current_path
);
133 self
->priv
->force
= force
;
134 self
->priv
->recursive
= recursive
;
140 svn_add_command_destroy (SvnAddCommand
*self
)
142 g_object_unref (self
);