Updated Spanish translation
[anjuta-git-plugin.git] / plugins / subversion / svn-resolve-command.c
blob0b93f5337fc7022e3f0e0c720cbdcf70b758d35f
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 * anjuta
4 * Copyright (C) James Liggett 2007 <jrliggett@cox.net>
5 *
6 * anjuta is free software.
7 *
8 * You may redistribute it and/or modify it under the terms of the
9 * GNU General Public License, as published by the Free Software
10 * Foundation; either version 2 of the License, or (at your option)
11 * any later version.
13 * anjuta is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with anjuta. If not, write to:
20 * The Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02110-1301, USA.
25 #include "svn-resolve-command.h"
27 struct _SvnResolveCommandPriv
29 GList *paths;
30 gboolean recursive;
33 G_DEFINE_TYPE (SvnResolveCommand, svn_resolve_command, SVN_TYPE_COMMAND);
35 static void
36 svn_resolve_command_init (SvnResolveCommand *self)
38 self->priv = g_new0 (SvnResolveCommandPriv, 1);
41 static void
42 svn_resolve_command_finalize (GObject *object)
44 SvnResolveCommand *self;
46 self = SVN_RESOLVE_COMMAND (object);
48 svn_command_free_path_list (self->priv->paths);
49 g_free (self->priv);
51 G_OBJECT_CLASS (svn_resolve_command_parent_class)->finalize (object);
54 static guint
55 svn_resolve_command_run (AnjutaCommand *command)
57 SvnResolveCommand *self;
58 SvnCommand *svn_command;
59 GList *current_path;
60 svn_error_t *error;
62 self = SVN_RESOLVE_COMMAND (command);
63 svn_command = SVN_COMMAND (command);
64 current_path = self->priv->paths;
66 while (current_path)
68 error = svn_client_resolved (current_path->data,
69 self->priv->recursive,
70 svn_command_get_client_context (svn_command),
71 svn_command_get_pool (svn_command));
73 if (error)
75 svn_command_set_error (svn_command, error);
76 return 1;
79 current_path = g_list_next (current_path);
82 return 0;
85 static void
86 svn_resolve_command_class_init (SvnResolveCommandClass *klass)
88 GObjectClass *object_class = G_OBJECT_CLASS (klass);
89 AnjutaCommandClass *command_class = ANJUTA_COMMAND_CLASS (klass);
91 object_class->finalize = svn_resolve_command_finalize;
92 command_class->run = svn_resolve_command_run;
96 SvnResolveCommand *
97 svn_resolve_command_new (GList *paths, gboolean recursive)
99 SvnResolveCommand *self;
101 self = g_object_new (SVN_TYPE_RESOLVE_COMMAND, NULL);
102 self->priv->paths = svn_command_copy_path_list (paths);
103 self->priv->recursive = recursive;
105 return self;
108 void
109 svn_resolve_command_destroy (SvnResolveCommand *self)
111 g_object_unref (self);