~ubuntu-branches/debian/squeeze/gthumb/squeeze

« back to all changes in this revision

Viewing changes to .pc/18-build_with_gtk2.19.patch/gthumb/gth-file-tool.c

  • Committer: Bazaar Package Importer
  • Author(s): David Paleino
  • Date: 2010-03-15 07:43:28 UTC
  • Revision ID: james.westby@ubuntu.com-20100315074328-p67h2vhsteg2c06h
Tags: 3:2.11.2.1-2
* debian/patches/:
  - 18-build_with_gtk2.19.patch added (Closes: #573424)
* debian/rules:
  - disable clutter at configure time (Closes: #573700, #573723)
* debian/control:
  - remove Build-Dependencies on clutter things

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
2
 
 
3
/*
 
4
 *  GThumb
 
5
 *
 
6
 *  Copyright (C) 2009 Free Software Foundation, Inc.
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; either version 2 of the License, or
 
11
 *  (at your option) any later version.
 
12
 *
 
13
 *  This program 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.  See the
 
16
 *  GNU General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU General Public License
 
19
 *  along with this program; if not, write to the Free Software
 
20
 *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
 
21
 */
 
22
 
 
23
#include <config.h>
 
24
#include "gth-file-tool.h"
 
25
 
 
26
 
 
27
enum {
 
28
        SHOW_OPTIONS,
 
29
        HIDE_OPTIONS,
 
30
        LAST_SIGNAL
 
31
};
 
32
 
 
33
 
 
34
static gpointer parent_class = NULL;
 
35
static guint gth_file_tool_signals[LAST_SIGNAL] = { 0 };
 
36
 
 
37
 
 
38
struct _GthFileToolPrivate {
 
39
        GtkWidget  *window;
 
40
        const char *icon_name;
 
41
        const char *button_text;
 
42
        const char *options_title;
 
43
        gboolean    separator;
 
44
};
 
45
 
 
46
 
 
47
static void
 
48
gth_file_tool_base_update_sensitivity (GthFileTool *self)
 
49
{
 
50
        /* void */
 
51
}
 
52
 
 
53
 
 
54
static void
 
55
gth_file_tool_base_activate (GthFileTool *self)
 
56
{
 
57
        /* void*/
 
58
}
 
59
 
 
60
 
 
61
static GtkWidget *
 
62
gth_file_tool_base_get_options (GthFileTool *self)
 
63
{
 
64
        return NULL;
 
65
}
 
66
 
 
67
 
 
68
static void
 
69
gth_file_tool_base_destroy_options (GthFileTool *self)
 
70
{
 
71
        /* void */
 
72
}
 
73
 
 
74
 
 
75
static void
 
76
gth_file_tool_finalize (GObject *object)
 
77
{
 
78
        GthFileTool *self;
 
79
 
 
80
        g_return_if_fail (object != NULL);
 
81
        g_return_if_fail (GTH_IS_FILE_TOOL (object));
 
82
 
 
83
        self = (GthFileTool *) object;
 
84
 
 
85
        /* Chain up */
 
86
        G_OBJECT_CLASS (parent_class)->finalize (object);
 
87
}
 
88
 
 
89
 
 
90
static void
 
91
gth_file_tool_class_init (GthFileToolClass *klass)
 
92
{
 
93
        GObjectClass *gobject_class;
 
94
 
 
95
        parent_class = g_type_class_peek_parent (klass);
 
96
        g_type_class_add_private (klass, sizeof (GthFileToolPrivate));
 
97
 
 
98
        gobject_class = (GObjectClass*) klass;
 
99
        gobject_class->finalize = gth_file_tool_finalize;
 
100
 
 
101
        klass->update_sensitivity = gth_file_tool_base_update_sensitivity;
 
102
        klass->activate = gth_file_tool_base_activate;
 
103
        klass->get_options = gth_file_tool_base_get_options;
 
104
        klass->destroy_options = gth_file_tool_base_destroy_options;
 
105
 
 
106
        gth_file_tool_signals[SHOW_OPTIONS] =
 
107
                        g_signal_new ("show-options",
 
108
                                      G_TYPE_FROM_CLASS (klass),
 
109
                                      G_SIGNAL_RUN_LAST,
 
110
                                      G_STRUCT_OFFSET (GthFileToolClass, show_options),
 
111
                                      NULL, NULL,
 
112
                                      g_cclosure_marshal_VOID__VOID,
 
113
                                      G_TYPE_NONE,
 
114
                                      0);
 
115
        gth_file_tool_signals[HIDE_OPTIONS] =
 
116
                        g_signal_new ("hide-options",
 
117
                                      G_TYPE_FROM_CLASS (klass),
 
118
                                      G_SIGNAL_RUN_LAST,
 
119
                                      G_STRUCT_OFFSET (GthFileToolClass, hide_options),
 
120
                                      NULL, NULL,
 
121
                                      g_cclosure_marshal_VOID__VOID,
 
122
                                      G_TYPE_NONE,
 
123
                                      0);
 
124
}
 
125
 
 
126
 
 
127
static void
 
128
gth_file_tool_instance_init (GthFileTool *self)
 
129
{
 
130
        self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_FILE_TOOL, GthFileToolPrivate);
 
131
        self->priv->icon_name = NULL;
 
132
        self->priv->button_text = NULL;
 
133
        self->priv->options_title = NULL;
 
134
 
 
135
        gtk_button_set_relief (GTK_BUTTON (self), GTK_RELIEF_NONE);
 
136
}
 
137
 
 
138
 
 
139
GType
 
140
gth_file_tool_get_type (void) {
 
141
        static GType type_id = 0;
 
142
        if (type_id == 0) {
 
143
                static const GTypeInfo g_define_type_info = {
 
144
                        sizeof (GthFileToolClass),
 
145
                        (GBaseInitFunc) NULL,
 
146
                        (GBaseFinalizeFunc) NULL,
 
147
                        (GClassInitFunc) gth_file_tool_class_init,
 
148
                        (GClassFinalizeFunc) NULL,
 
149
                        NULL,
 
150
                        sizeof (GthFileTool),
 
151
                        0,
 
152
                        (GInstanceInitFunc) gth_file_tool_instance_init,
 
153
                        NULL
 
154
                };
 
155
                type_id = g_type_register_static (GTK_TYPE_BUTTON, "GthFileTool", &g_define_type_info, 0);
 
156
        }
 
157
        return type_id;
 
158
}
 
159
 
 
160
 
 
161
void
 
162
gth_file_tool_construct (GthFileTool *self,
 
163
                         const char  *icon_name,
 
164
                         const char  *button_text,
 
165
                         const char  *options_title,
 
166
                         gboolean     separator)
 
167
{
 
168
        GtkWidget *hbox;
 
169
        GtkWidget *icon;
 
170
        GtkWidget *label;
 
171
 
 
172
        self->priv->icon_name = icon_name;
 
173
        self->priv->button_text = button_text;
 
174
        self->priv->options_title = options_title;
 
175
        self->priv->separator = separator;
 
176
 
 
177
        hbox = gtk_hbox_new (FALSE, 6);
 
178
 
 
179
        icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
 
180
        gtk_widget_show (icon);
 
181
        gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
 
182
 
 
183
        label = gtk_label_new (button_text);
 
184
        gtk_widget_show (label);
 
185
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
 
186
 
 
187
        gtk_widget_show (hbox);
 
188
        gtk_container_add (GTK_CONTAINER (self), hbox);
 
189
}
 
190
 
 
191
 
 
192
GtkWidget *
 
193
gth_file_tool_get_window (GthFileTool *self)
 
194
{
 
195
        if (self->priv->window == NULL) {
 
196
                self->priv->window = gtk_widget_get_toplevel (GTK_WIDGET (self));
 
197
                if (! GTK_WIDGET_TOPLEVEL (self->priv->window))
 
198
                        self->priv->window = NULL;
 
199
        }
 
200
        return self->priv->window;
 
201
}
 
202
 
 
203
 
 
204
const char *
 
205
gth_file_tool_get_icon_name (GthFileTool *self)
 
206
{
 
207
        return self->priv->icon_name;
 
208
}
 
209
 
 
210
 
 
211
void
 
212
gth_file_tool_activate (GthFileTool *self)
 
213
{
 
214
        GTH_FILE_TOOL_GET_CLASS (self)->activate (self);
 
215
}
 
216
 
 
217
 
 
218
void
 
219
gth_file_tool_update_sensitivity (GthFileTool *self)
 
220
{
 
221
        GTH_FILE_TOOL_GET_CLASS (self)->update_sensitivity (self);
 
222
}
 
223
 
 
224
 
 
225
void
 
226
gth_file_tool_show_options (GthFileTool *self)
 
227
{
 
228
        g_signal_emit (self, gth_file_tool_signals[SHOW_OPTIONS], 0, NULL);
 
229
}
 
230
 
 
231
 
 
232
void
 
233
gth_file_tool_hide_options (GthFileTool *self)
 
234
{
 
235
        g_signal_emit (self, gth_file_tool_signals[HIDE_OPTIONS], 0, NULL);
 
236
}
 
237
 
 
238
 
 
239
GtkWidget *
 
240
gth_file_tool_get_options (GthFileTool *self)
 
241
{
 
242
        return GTH_FILE_TOOL_GET_CLASS (self)->get_options (self);
 
243
}
 
244
 
 
245
 
 
246
const char *
 
247
gth_file_tool_get_options_title (GthFileTool *self)
 
248
{
 
249
        return self->priv->options_title;
 
250
}
 
251
 
 
252
 
 
253
gboolean
 
254
gth_file_tool_has_separator (GthFileTool *self)
 
255
{
 
256
        return self->priv->separator;
 
257
}
 
258
 
 
259
 
 
260
void
 
261
gth_file_tool_destroy_options (GthFileTool *self)
 
262
{
 
263
        GTH_FILE_TOOL_GET_CLASS (self)->destroy_options (self);
 
264
}