~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to libgimpwidgets/gimpmemsizeentry.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
  LAST_SIGNAL
39
39
};
40
40
 
41
 
static void  gimp_memsize_entry_class_init    (GimpMemsizeEntryClass *klass);
42
 
static void  gimp_memsize_entry_init          (GimpMemsizeEntry      *entry);
43
 
static void  gimp_memsize_entry_finalize      (GObject               *object);
44
 
 
45
 
static void  gimp_memsize_entry_adj_callback  (GtkAdjustment         *adj,
46
 
                                               GimpMemsizeEntry      *entry);
47
 
static void  gimp_memsize_entry_unit_callback (GtkWidget             *widget,
48
 
                                               GimpMemsizeEntry      *entry);
49
 
 
50
 
 
51
 
static guint         gimp_memsize_entry_signals[LAST_SIGNAL] = { 0 };
52
 
static GtkHBoxClass *parent_class                            = NULL;
53
 
 
54
 
 
55
 
GType
56
 
gimp_memsize_entry_get_type (void)
57
 
{
58
 
  static GType entry_type = 0;
59
 
 
60
 
  if (! entry_type)
61
 
    {
62
 
      static const GTypeInfo entry_info =
63
 
      {
64
 
        sizeof (GimpMemsizeEntryClass),
65
 
        (GBaseInitFunc) NULL,
66
 
        (GBaseFinalizeFunc) NULL,
67
 
        (GClassInitFunc) gimp_memsize_entry_class_init,
68
 
        NULL,           /* class_finalize */
69
 
        NULL,           /* class_data     */
70
 
        sizeof (GimpMemsizeEntry),
71
 
        0,              /* n_preallocs    */
72
 
        (GInstanceInitFunc) gimp_memsize_entry_init,
73
 
      };
74
 
 
75
 
      entry_type = g_type_register_static (GTK_TYPE_HBOX, "GimpMemsizeEntry",
76
 
                                           &entry_info, 0);
77
 
    }
78
 
 
79
 
  return entry_type;
80
 
}
 
41
 
 
42
static void  gimp_memsize_entry_finalize      (GObject          *object);
 
43
 
 
44
static void  gimp_memsize_entry_adj_callback  (GtkAdjustment    *adj,
 
45
                                               GimpMemsizeEntry *entry);
 
46
static void  gimp_memsize_entry_unit_callback (GtkWidget        *widget,
 
47
                                               GimpMemsizeEntry *entry);
 
48
 
 
49
 
 
50
G_DEFINE_TYPE (GimpMemsizeEntry, gimp_memsize_entry, GTK_TYPE_HBOX)
 
51
 
 
52
#define parent_class gimp_memsize_entry_parent_class
 
53
 
 
54
static guint gimp_memsize_entry_signals[LAST_SIGNAL] = { 0 };
 
55
 
81
56
 
82
57
static void
83
58
gimp_memsize_entry_class_init (GimpMemsizeEntryClass *klass)
84
59
{
85
 
  GObjectClass *object_class;
86
 
 
87
 
  parent_class = g_type_class_peek_parent (klass);
88
 
 
89
 
  object_class = G_OBJECT_CLASS (klass);
 
60
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
90
61
 
91
62
  object_class->finalize = gimp_memsize_entry_finalize;
92
63
 
 
64
  klass->value_changed   = NULL;
 
65
 
93
66
  gimp_memsize_entry_signals[VALUE_CHANGED] =
94
 
    g_signal_new ("value_changed",
95
 
                  G_TYPE_FROM_CLASS (klass),
96
 
                  G_SIGNAL_RUN_FIRST,
97
 
                  G_STRUCT_OFFSET (GimpMemsizeEntryClass, value_changed),
98
 
                  NULL, NULL,
99
 
                  g_cclosure_marshal_VOID__VOID,
100
 
                  G_TYPE_NONE, 0);
101
 
 
102
 
  klass->value_changed = NULL;
 
67
    g_signal_new ("value-changed",
 
68
                  G_TYPE_FROM_CLASS (klass),
 
69
                  G_SIGNAL_RUN_FIRST,
 
70
                  G_STRUCT_OFFSET (GimpMemsizeEntryClass, value_changed),
 
71
                  NULL, NULL,
 
72
                  g_cclosure_marshal_VOID__VOID,
 
73
                  G_TYPE_NONE, 0);
103
74
}
104
75
 
105
76
static void
131
102
 
132
103
static void
133
104
gimp_memsize_entry_adj_callback (GtkAdjustment    *adj,
134
 
                                 GimpMemsizeEntry *entry)
 
105
                                 GimpMemsizeEntry *entry)
135
106
{
136
107
  guint64 size = gtk_adjustment_get_value (adj);
137
108
 
142
113
 
143
114
static void
144
115
gimp_memsize_entry_unit_callback (GtkWidget        *widget,
145
 
                                  GimpMemsizeEntry *entry)
 
116
                                  GimpMemsizeEntry *entry)
146
117
{
147
118
  guint  shift;
148
119
 
182
153
 **/
183
154
GtkWidget *
184
155
gimp_memsize_entry_new (guint64  value,
185
 
                        guint64  lower,
186
 
                        guint64  upper)
 
156
                        guint64  lower,
 
157
                        guint64  upper)
187
158
{
188
159
  GimpMemsizeEntry *entry;
 
160
  GtkObject        *adj;
189
161
  guint             shift;
190
162
 
191
163
#if _MSC_VER < 1300
210
182
  entry->upper = upper;
211
183
  entry->shift = shift;
212
184
 
213
 
  entry->spinbutton = gimp_spin_button_new ((GtkObject **) &entry->adjustment,
 
185
  entry->spinbutton = gimp_spin_button_new (&adj,
214
186
                                            CAST (value >> shift),
215
187
                                            CAST (lower >> shift),
216
188
                                            CAST (upper >> shift),
218
190
 
219
191
#undef CAST
220
192
 
221
 
  g_object_ref (entry->adjustment);
222
 
  gtk_object_sink (GTK_OBJECT (entry->adjustment));
 
193
  entry->adjustment = GTK_ADJUSTMENT (adj);
 
194
  g_object_ref_sink (entry->adjustment);
223
195
 
224
196
  gtk_entry_set_width_chars (GTK_ENTRY (entry->spinbutton), 10);
225
197
  gtk_box_pack_start (GTK_BOX (entry), entry->spinbutton, FALSE, FALSE, 0);
226
198
  gtk_widget_show (entry->spinbutton);
227
199
 
228
 
  g_signal_connect (entry->adjustment, "value_changed",
 
200
  g_signal_connect (entry->adjustment, "value-changed",
229
201
                    G_CALLBACK (gimp_memsize_entry_adj_callback),
230
202
                    entry);
231
203
 
256
228
 **/
257
229
void
258
230
gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
259
 
                              guint64           value)
 
231
                              guint64           value)
260
232
{
261
233
  guint shift;
262
234