~ubuntu-branches/ubuntu/oneiric/gedit-plugins/oneiric

« back to all changes in this revision

Viewing changes to plugins/bookmarks/messages/gedit-bookmarks-message-remove.c

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette, YunQiang Su, Josselin Mouette
  • Date: 2011-06-02 19:15:39 UTC
  • mfrom: (7.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110602191539-ykgin1sr7nl4h4fy
Tags: 3.0.3-1
[ YunQiang Su ]
* New upstream stable release.
* Update build-dependencies accordingly.
* Update dependencies to use gir modules for Python.
* Switch to 3.0 source format.
* Update standards version.

[ Josselin Mouette ]
* Pass the correct paths to dh_pysupport.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * gedit-bookmarks-message-remove.c
 
3
 * This file is part of gedit
 
4
 *
 
5
 * Copyright (C) 2011 - Paolo Borelli
 
6
 *
 
7
 * gedit is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * gedit is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with gedit; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor,
 
20
 * Boston, MA  02110-1301  USA
 
21
 */
 
22
 
 
23
#include <gtk/gtk.h>
 
24
#include <gedit/gedit-view.h>
 
25
#include "gedit-bookmarks-message-remove.h"
 
26
 
 
27
#define GEDIT_BOOKMARKS_MESSAGE_REMOVE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_BOOKMARKS_MESSAGE_REMOVE, GeditBookmarksMessageRemovePrivate))
 
28
 
 
29
enum
 
30
{
 
31
        PROP_0,
 
32
 
 
33
        PROP_VIEW,
 
34
        PROP_ITER,
 
35
};
 
36
 
 
37
struct _GeditBookmarksMessageRemovePrivate
 
38
{
 
39
        GeditView *view;
 
40
        GtkTextIter *iter;
 
41
};
 
42
 
 
43
G_DEFINE_TYPE (GeditBookmarksMessageRemove, gedit_bookmarks_message_remove, GEDIT_TYPE_MESSAGE)
 
44
 
 
45
static void
 
46
gedit_bookmarks_message_remove_finalize (GObject *obj)
 
47
{
 
48
        GeditBookmarksMessageRemove *msg = GEDIT_BOOKMARKS_MESSAGE_REMOVE (obj);
 
49
 
 
50
        if (msg->priv->view)
 
51
        {
 
52
                g_object_unref (msg->priv->view);
 
53
        }
 
54
        if (msg->priv->iter)
 
55
        {
 
56
                g_object_unref (msg->priv->iter);
 
57
        }
 
58
 
 
59
        G_OBJECT_CLASS (gedit_bookmarks_message_remove_parent_class)->finalize (obj);
 
60
}
 
61
 
 
62
static void
 
63
gedit_bookmarks_message_remove_get_property (GObject    *obj,
 
64
                                             guint       prop_id,
 
65
                                             GValue     *value,
 
66
                                             GParamSpec *pspec)
 
67
{
 
68
        GeditBookmarksMessageRemove *msg;
 
69
 
 
70
        msg = GEDIT_BOOKMARKS_MESSAGE_REMOVE (obj);
 
71
 
 
72
        switch (prop_id)
 
73
        {
 
74
                case PROP_VIEW:
 
75
                        g_value_set_object (value, msg->priv->view);
 
76
                        break;
 
77
                case PROP_ITER:
 
78
                        g_value_set_boxed (value, msg->priv->iter);
 
79
                        break;
 
80
        }
 
81
}
 
82
 
 
83
static void
 
84
gedit_bookmarks_message_remove_set_property (GObject      *obj,
 
85
                                             guint         prop_id,
 
86
                                             GValue const *value,
 
87
                                             GParamSpec   *pspec)
 
88
{
 
89
        GeditBookmarksMessageRemove *msg;
 
90
 
 
91
        msg = GEDIT_BOOKMARKS_MESSAGE_REMOVE (obj);
 
92
 
 
93
        switch (prop_id)
 
94
        {
 
95
                case PROP_VIEW:
 
96
                {
 
97
                        if (msg->priv->view)
 
98
                        {
 
99
                                g_object_unref (msg->priv->view);
 
100
                        }
 
101
                        msg->priv->view = g_value_dup_object (value);
 
102
                        break;
 
103
                }
 
104
                case PROP_ITER:
 
105
                {
 
106
                        if (msg->priv->iter)
 
107
                        {
 
108
                                g_boxed_free (GTK_TYPE_TEXT_ITER, msg->priv->iter);
 
109
                        }
 
110
                        msg->priv->iter = g_boxed_copy (GTK_TYPE_TEXT_ITER, value);
 
111
                        break;
 
112
                }
 
113
        }
 
114
}
 
115
 
 
116
static void
 
117
gedit_bookmarks_message_remove_class_init (GeditBookmarksMessageRemoveClass *klass)
 
118
{
 
119
        GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
120
 
 
121
        object_class->finalize = gedit_bookmarks_message_remove_finalize;
 
122
 
 
123
        object_class->get_property = gedit_bookmarks_message_remove_get_property;
 
124
        object_class->set_property = gedit_bookmarks_message_remove_set_property;
 
125
 
 
126
        g_object_class_install_property (object_class,
 
127
                                         PROP_VIEW,
 
128
                                         g_param_spec_object ("view",
 
129
                                                              "View",
 
130
                                                              "View",
 
131
                                                              GEDIT_TYPE_VIEW,
 
132
                                                              G_PARAM_READWRITE |
 
133
                                                              G_PARAM_CONSTRUCT |
 
134
                                                              G_PARAM_STATIC_STRINGS));
 
135
 
 
136
        g_object_class_install_property (object_class,
 
137
                                         PROP_ITER,
 
138
                                         g_param_spec_boxed ("iter",
 
139
                                                              "Iter",
 
140
                                                              "Iter",
 
141
                                                              GTK_TYPE_TEXT_ITER,
 
142
                                                              G_PARAM_READWRITE |
 
143
                                                              G_PARAM_CONSTRUCT |
 
144
                                                              G_PARAM_STATIC_STRINGS));
 
145
 
 
146
        g_type_class_add_private (object_class, sizeof (GeditBookmarksMessageRemovePrivate));
 
147
}
 
148
 
 
149
static void
 
150
gedit_bookmarks_message_remove_init (GeditBookmarksMessageRemove *message)
 
151
{
 
152
        message->priv = GEDIT_BOOKMARKS_MESSAGE_REMOVE_GET_PRIVATE (message);
 
153
}