code-analyzer: Fixed bgo#667903 - Code Analyzer Crashes
[anjuta.git] / plugins / git / git-stash.c
blobc66d9fd8f7017df210f71f989661d842e5f89e0e
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 * anjuta
4 * Copyright (C) James Liggett 2008 <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 "git-stash.h"
27 struct _GitStashPriv
29 gchar *id;
30 gchar *message;
31 guint number;
34 G_DEFINE_TYPE (GitStash, git_stash, G_TYPE_OBJECT);
36 static void
37 git_stash_init (GitStash *self)
39 self->priv = g_new0 (GitStashPriv, 1);
42 static void
43 git_stash_finalize (GObject *object)
45 GitStash *self;
47 self = GIT_STASH (object);
49 g_free (self->priv->id);
50 g_free (self->priv->message);
51 g_free (self->priv);
53 G_OBJECT_CLASS (git_stash_parent_class)->finalize (object);
56 static void
57 git_stash_class_init (GitStashClass *klass)
59 GObjectClass* object_class = G_OBJECT_CLASS (klass);
61 object_class->finalize = git_stash_finalize;
64 GitStash *
65 git_stash_new (const gchar *id, const gchar *message, guint number)
67 GitStash *self;
69 self = g_object_new (GIT_TYPE_STASH, NULL);
71 self->priv->id = g_strdup (id);
72 self->priv->message = g_strdup (message);
73 self->priv->number = number;
75 return self;
78 gchar *
79 git_stash_get_id (GitStash *self)
81 return g_strdup (self->priv->id);
84 gchar *
85 git_stash_get_message (GitStash *self)
87 return g_strdup (self->priv->message);
90 guint
91 git_stash_get_number (GitStash *self)
93 return self->priv->number;