~ubuntu-branches/ubuntu/trusty/gnome-contacts/trusty

« back to all changes in this revision

Viewing changes to src/contacts-revealer.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Jeremy Bicha, Michael Biebl
  • Date: 2013-09-19 18:23:06 UTC
  • mfrom: (1.3.10) (0.3.4 experimental)
  • mto: This revision was merged to the branch mainline in revision 40.
  • Revision ID: package-import@ubuntu.com-20130919182306-rcatwotzg94pr884
Tags: 3.8.3-1
[ Jeremy Bicha ]
* debian/control.in:
  - Drop alternate build-depends on valac-0.18 since it's no longer
    in Debian

[ Michael Biebl ]
* New upstream release.
* Loosen Build-Depends on libgnome-desktop-3-dev, we do not strictly require
  version (>= 3.6.0) which is not yet available in unstable.
* Bump Standards-Version to 3.9.4. No further changes.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* contacts-revealer.c generated by valac 0.15.1.23-684b1, the Vala compiler
 
1
/* contacts-revealer.c generated by valac 0.20.1, the Vala compiler
2
2
 * generated from contacts-revealer.vala, do not modify */
3
3
 
4
4
/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */
21
21
 
22
22
#include <glib.h>
23
23
#include <glib-object.h>
 
24
#include <float.h>
 
25
#include <math.h>
24
26
#include <gtk/gtk.h>
25
27
#include <gdk/gdk.h>
26
 
#include <float.h>
27
 
#include <math.h>
 
28
#include <cairo.h>
28
29
 
29
30
 
30
31
#define CONTACTS_TYPE_REVEALER (contacts_revealer_get_type ())
40
41
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
41
42
 
42
43
struct _ContactsRevealer {
43
 
        GtkViewport parent_instance;
 
44
        GtkBin parent_instance;
44
45
        ContactsRevealerPrivate * priv;
 
46
};
 
47
 
 
48
struct _ContactsRevealerClass {
 
49
        GtkBinClass parent_class;
 
50
};
 
51
 
 
52
struct _ContactsRevealerPrivate {
 
53
        GtkOrientation _orientation;
 
54
        gint _duration;
45
55
        GdkWindow* bin_window;
46
56
        GdkWindow* view_window;
47
 
        GtkAdjustment* vadjustment;
48
 
        gdouble amount_visible;
49
 
        gdouble target_amount;
50
 
};
51
 
 
52
 
struct _ContactsRevealerClass {
53
 
        GtkViewportClass parent_class;
54
 
};
55
 
 
56
 
struct _ContactsRevealerPrivate {
 
57
        gdouble current_pos;
 
58
        gdouble source_pos;
 
59
        gdouble target_pos;
57
60
        guint timeout;
 
61
        gint64 start_time;
 
62
        gint64 end_time;
58
63
};
59
64
 
60
65
 
61
66
static gpointer contacts_revealer_parent_class = NULL;
62
67
 
 
68
gdouble transition_ease_out_quad (gdouble t, gdouble d);
63
69
GType contacts_revealer_get_type (void) G_GNUC_CONST;
64
70
#define CONTACTS_REVEALER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_REVEALER, ContactsRevealerPrivate))
65
71
enum  {
66
 
        CONTACTS_REVEALER_DUMMY_PROPERTY
 
72
        CONTACTS_REVEALER_DUMMY_PROPERTY,
 
73
        CONTACTS_REVEALER_ORIENTATION,
 
74
        CONTACTS_REVEALER_DURATION
67
75
};
68
 
#define CONTACTS_REVEALER_animation_time 200
69
 
#define CONTACTS_REVEALER_animation_n_steps 8
 
76
#define CONTACTS_REVEALER_frame_time 17
70
77
ContactsRevealer* contacts_revealer_new (void);
71
78
ContactsRevealer* contacts_revealer_construct (GType object_type);
72
 
static void contacts_revealer_ensure_timer (ContactsRevealer* self);
 
79
static void contacts_revealer_get_child_allocation (ContactsRevealer* self, GtkAllocation* allocation, GtkAllocation* child_allocation);
 
80
GtkOrientation contacts_revealer_get_orientation (ContactsRevealer* self);
 
81
static void contacts_revealer_real_realize (GtkWidget* base);
 
82
static void contacts_revealer_real_unrealize (GtkWidget* base);
 
83
static void contacts_revealer_real_add (GtkContainer* base, GtkWidget* child);
 
84
static void contacts_revealer_real_style_updated (GtkWidget* base);
 
85
static void contacts_revealer_real_size_allocate (GtkWidget* base, GtkAllocation* allocation);
 
86
static void contacts_revealer_set_amount (ContactsRevealer* self, gdouble amount);
 
87
static void contacts_revealer_animate_step (ContactsRevealer* self, gint64 now);
73
88
static gboolean contacts_revealer_animate_cb (ContactsRevealer* self);
 
89
static void contacts_revealer_start_animation (ContactsRevealer* self, gdouble target);
 
90
gint contacts_revealer_get_duration (ContactsRevealer* self);
74
91
static gboolean _contacts_revealer_animate_cb_gsource_func (gpointer self);
75
 
static void contacts_revealer_real_show (GtkWidget* base);
 
92
static void contacts_revealer_stop_animation (ContactsRevealer* self);
 
93
static void contacts_revealer_real_map (GtkWidget* base);
 
94
static void contacts_revealer_real_unmap (GtkWidget* base);
 
95
static gboolean contacts_revealer_real_draw (GtkWidget* base, cairo_t* cr);
76
96
void contacts_revealer_reveal (ContactsRevealer* self);
77
 
static void contacts_revealer_real_hide (GtkWidget* base);
78
97
void contacts_revealer_unreveal (ContactsRevealer* self);
79
98
static void contacts_revealer_real_get_preferred_height (GtkWidget* base, gint* minimum_height, gint* natural_height);
80
99
static void contacts_revealer_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height);
81
 
static void contacts_revealer_real_size_allocate (GtkWidget* base, GtkAllocation* allocation);
 
100
static void contacts_revealer_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width);
 
101
static void contacts_revealer_real_get_preferred_width_for_height (GtkWidget* base, gint height, gint* minimum_width, gint* natural_width);
 
102
void contacts_revealer_set_orientation (ContactsRevealer* self, GtkOrientation value);
 
103
void contacts_revealer_set_duration (ContactsRevealer* self, gint value);
82
104
static void contacts_revealer_finalize (GObject* obj);
83
 
 
84
 
 
85
 
static gpointer _g_object_ref0 (gpointer self) {
86
 
        return self ? g_object_ref (self) : NULL;
 
105
static void _vala_contacts_revealer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
106
static void _vala_contacts_revealer_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 
107
 
 
108
 
 
109
gdouble transition_ease_out_quad (gdouble t, gdouble d) {
 
110
        gdouble result = 0.0;
 
111
        gdouble _tmp0_;
 
112
        gdouble _tmp1_;
 
113
        gdouble p;
 
114
        _tmp0_ = t;
 
115
        _tmp1_ = d;
 
116
        p = _tmp0_ / _tmp1_;
 
117
        result = ((-1.0) * p) * (p - 2);
 
118
        return result;
87
119
}
88
120
 
89
121
 
90
122
ContactsRevealer* contacts_revealer_construct (GType object_type) {
91
123
        ContactsRevealer * self = NULL;
92
124
        gdouble _tmp0_;
93
 
        GtkAdjustment* _tmp1_ = NULL;
94
 
        GtkAdjustment* _tmp2_;
95
125
        self = (ContactsRevealer*) g_object_new (object_type, NULL);
96
 
        gtk_viewport_set_shadow_type ((GtkViewport*) self, GTK_SHADOW_NONE);
97
 
        self->amount_visible = 0.0;
98
 
        _tmp0_ = self->amount_visible;
99
 
        self->target_amount = _tmp0_;
100
 
        _tmp1_ = gtk_viewport_get_vadjustment ((GtkViewport*) self);
101
 
        _tmp2_ = _g_object_ref0 (_tmp1_);
102
 
        _g_object_unref0 (self->vadjustment);
103
 
        self->vadjustment = _tmp2_;
 
126
        self->priv->current_pos = 0.0;
 
127
        _tmp0_ = self->priv->current_pos;
 
128
        self->priv->target_pos = _tmp0_;
 
129
        gtk_widget_set_has_window ((GtkWidget*) self, TRUE);
 
130
        gtk_widget_set_redraw_on_allocate ((GtkWidget*) self, FALSE);
104
131
        return self;
105
132
}
106
133
 
110
137
}
111
138
 
112
139
 
 
140
static gpointer _g_object_ref0 (gpointer self) {
 
141
        return self ? g_object_ref (self) : NULL;
 
142
}
 
143
 
 
144
 
 
145
static void contacts_revealer_get_child_allocation (ContactsRevealer* self, GtkAllocation* allocation, GtkAllocation* child_allocation) {
 
146
        GtkAllocation _vala_child_allocation = {0};
 
147
        GtkAllocation _tmp0_;
 
148
        gint _tmp1_;
 
149
        GtkAllocation _tmp2_;
 
150
        gint _tmp3_;
 
151
        GtkAllocation _tmp4_ = {0};
 
152
        GtkWidget* _tmp5_ = NULL;
 
153
        GtkWidget* _tmp6_;
 
154
        GtkWidget* child;
 
155
        gboolean _tmp7_ = FALSE;
 
156
        GtkWidget* _tmp8_;
 
157
        gboolean _tmp11_;
 
158
        g_return_if_fail (self != NULL);
 
159
        g_return_if_fail (allocation != NULL);
 
160
        _tmp0_ = *allocation;
 
161
        _tmp1_ = _tmp0_.width;
 
162
        _tmp2_ = *allocation;
 
163
        _tmp3_ = _tmp2_.height;
 
164
        _tmp4_.x = 0;
 
165
        _tmp4_.y = 0;
 
166
        _tmp4_.width = _tmp1_;
 
167
        _tmp4_.height = _tmp3_;
 
168
        _vala_child_allocation = _tmp4_;
 
169
        _tmp5_ = gtk_bin_get_child ((GtkBin*) self);
 
170
        _tmp6_ = _g_object_ref0 (_tmp5_);
 
171
        child = _tmp6_;
 
172
        _tmp8_ = child;
 
173
        if (_tmp8_ != NULL) {
 
174
                GtkWidget* _tmp9_;
 
175
                gboolean _tmp10_ = FALSE;
 
176
                _tmp9_ = child;
 
177
                _tmp10_ = gtk_widget_get_visible (_tmp9_);
 
178
                _tmp7_ = _tmp10_;
 
179
        } else {
 
180
                _tmp7_ = FALSE;
 
181
        }
 
182
        _tmp11_ = _tmp7_;
 
183
        if (_tmp11_) {
 
184
                GtkOrientation _tmp12_;
 
185
                _tmp12_ = self->priv->_orientation;
 
186
                if (_tmp12_ == GTK_ORIENTATION_HORIZONTAL) {
 
187
                        GtkWidget* _tmp13_;
 
188
                        GtkAllocation _tmp14_;
 
189
                        gint _tmp15_;
 
190
                        gint _tmp16_ = 0;
 
191
                        _tmp13_ = child;
 
192
                        _tmp14_ = _vala_child_allocation;
 
193
                        _tmp15_ = _tmp14_.width;
 
194
                        gtk_widget_get_preferred_height_for_width (_tmp13_, _tmp15_, NULL, &_tmp16_);
 
195
                        _vala_child_allocation.height = _tmp16_;
 
196
                } else {
 
197
                        GtkWidget* _tmp17_;
 
198
                        GtkAllocation _tmp18_;
 
199
                        gint _tmp19_;
 
200
                        gint _tmp20_ = 0;
 
201
                        _tmp17_ = child;
 
202
                        _tmp18_ = _vala_child_allocation;
 
203
                        _tmp19_ = _tmp18_.height;
 
204
                        gtk_widget_get_preferred_width_for_height (_tmp17_, _tmp19_, NULL, &_tmp20_);
 
205
                        _vala_child_allocation.width = _tmp20_;
 
206
                }
 
207
        }
 
208
        _g_object_unref0 (child);
 
209
        if (child_allocation) {
 
210
                *child_allocation = _vala_child_allocation;
 
211
        }
 
212
}
 
213
 
 
214
 
 
215
static void contacts_revealer_real_realize (GtkWidget* base) {
 
216
        ContactsRevealer * self;
 
217
        GtkAllocation allocation = {0};
 
218
        GtkAllocation _tmp0_ = {0};
 
219
        GdkWindowAttr _tmp1_ = {0};
 
220
        GdkWindowAttr attributes;
 
221
        GtkAllocation _tmp2_;
 
222
        gint _tmp3_;
 
223
        GtkAllocation _tmp4_;
 
224
        gint _tmp5_;
 
225
        GtkAllocation _tmp6_;
 
226
        gint _tmp7_;
 
227
        GtkAllocation _tmp8_;
 
228
        gint _tmp9_;
 
229
        GdkVisual* _tmp10_ = NULL;
 
230
        gint _tmp11_ = 0;
 
231
        GdkWindowAttributesType attributes_mask;
 
232
        GdkWindow* _tmp12_ = NULL;
 
233
        GdkWindowAttr _tmp13_;
 
234
        GdkWindowAttributesType _tmp14_;
 
235
        GdkWindow* _tmp15_;
 
236
        GdkWindow* _tmp16_;
 
237
        GdkWindow* _tmp17_;
 
238
        GdkWindow* _tmp18_;
 
239
        GtkAllocation _tmp19_ = {0};
 
240
        GtkAllocation child_allocation;
 
241
        GtkAllocation _tmp20_;
 
242
        GtkAllocation _tmp21_ = {0};
 
243
        GtkAllocation _tmp22_;
 
244
        gint _tmp23_;
 
245
        GtkAllocation _tmp24_;
 
246
        gint _tmp25_;
 
247
        GtkOrientation _tmp26_;
 
248
        GdkWindow* _tmp35_;
 
249
        GdkWindowAttr _tmp36_;
 
250
        GdkWindowAttributesType _tmp37_;
 
251
        GdkWindow* _tmp38_;
 
252
        GdkWindow* _tmp39_;
 
253
        GtkWidget* _tmp40_ = NULL;
 
254
        GtkWidget* _tmp41_;
 
255
        GtkWidget* child;
 
256
        GtkWidget* _tmp42_;
 
257
        GtkStyleContext* _tmp45_ = NULL;
 
258
        GtkStyleContext* _tmp46_;
 
259
        GtkStyleContext* context;
 
260
        GdkWindow* _tmp47_;
 
261
        GdkWindow* _tmp48_;
 
262
        GdkWindow* _tmp49_;
 
263
        self = (ContactsRevealer*) base;
 
264
        gtk_widget_set_realized ((GtkWidget*) self, TRUE);
 
265
        gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
 
266
        allocation = _tmp0_;
 
267
        attributes = _tmp1_;
 
268
        _tmp2_ = allocation;
 
269
        _tmp3_ = _tmp2_.x;
 
270
        attributes.x = _tmp3_;
 
271
        _tmp4_ = allocation;
 
272
        _tmp5_ = _tmp4_.y;
 
273
        attributes.y = _tmp5_;
 
274
        _tmp6_ = allocation;
 
275
        _tmp7_ = _tmp6_.width;
 
276
        attributes.width = _tmp7_;
 
277
        _tmp8_ = allocation;
 
278
        _tmp9_ = _tmp8_.height;
 
279
        attributes.height = _tmp9_;
 
280
        attributes.window_type = GDK_WINDOW_CHILD;
 
281
        attributes.wclass = GDK_INPUT_OUTPUT;
 
282
        _tmp10_ = gtk_widget_get_visual ((GtkWidget*) self);
 
283
        attributes.visual = _tmp10_;
 
284
        _tmp11_ = gtk_widget_get_events ((GtkWidget*) self);
 
285
        attributes.event_mask = _tmp11_ | GDK_EXPOSURE_MASK;
 
286
        attributes_mask = (GDK_WA_X | GDK_WA_Y) | GDK_WA_VISUAL;
 
287
        _tmp12_ = gtk_widget_get_parent_window ((GtkWidget*) self);
 
288
        _tmp13_ = attributes;
 
289
        _tmp14_ = attributes_mask;
 
290
        _tmp15_ = gdk_window_new (_tmp12_, &_tmp13_, _tmp14_);
 
291
        _g_object_unref0 (self->priv->view_window);
 
292
        self->priv->view_window = _tmp15_;
 
293
        _tmp16_ = self->priv->view_window;
 
294
        _tmp17_ = _g_object_ref0 (_tmp16_);
 
295
        gtk_widget_set_window ((GtkWidget*) self, _tmp17_);
 
296
        _tmp18_ = self->priv->view_window;
 
297
        gdk_window_set_user_data (_tmp18_, (GObject*) self);
 
298
        child_allocation = _tmp19_;
 
299
        _tmp20_ = allocation;
 
300
        contacts_revealer_get_child_allocation (self, &_tmp20_, &_tmp21_);
 
301
        child_allocation = _tmp21_;
 
302
        attributes.x = 0;
 
303
        attributes.y = 0;
 
304
        _tmp22_ = child_allocation;
 
305
        _tmp23_ = _tmp22_.width;
 
306
        attributes.width = _tmp23_;
 
307
        _tmp24_ = child_allocation;
 
308
        _tmp25_ = _tmp24_.height;
 
309
        attributes.height = _tmp25_;
 
310
        _tmp26_ = self->priv->_orientation;
 
311
        if (_tmp26_ == GTK_ORIENTATION_HORIZONTAL) {
 
312
                GtkAllocation _tmp27_;
 
313
                gint _tmp28_;
 
314
                GtkAllocation _tmp29_;
 
315
                gint _tmp30_;
 
316
                _tmp27_ = allocation;
 
317
                _tmp28_ = _tmp27_.height;
 
318
                _tmp29_ = child_allocation;
 
319
                _tmp30_ = _tmp29_.height;
 
320
                attributes.y = _tmp28_ - _tmp30_;
 
321
        } else {
 
322
                GtkAllocation _tmp31_;
 
323
                gint _tmp32_;
 
324
                GtkAllocation _tmp33_;
 
325
                gint _tmp34_;
 
326
                _tmp31_ = allocation;
 
327
                _tmp32_ = _tmp31_.width;
 
328
                _tmp33_ = child_allocation;
 
329
                _tmp34_ = _tmp33_.width;
 
330
                attributes.x = _tmp32_ - _tmp34_;
 
331
        }
 
332
        _tmp35_ = self->priv->view_window;
 
333
        _tmp36_ = attributes;
 
334
        _tmp37_ = attributes_mask;
 
335
        _tmp38_ = gdk_window_new (_tmp35_, &_tmp36_, _tmp37_);
 
336
        _g_object_unref0 (self->priv->bin_window);
 
337
        self->priv->bin_window = _tmp38_;
 
338
        _tmp39_ = self->priv->bin_window;
 
339
        gdk_window_set_user_data (_tmp39_, (GObject*) self);
 
340
        _tmp40_ = gtk_bin_get_child ((GtkBin*) self);
 
341
        _tmp41_ = _g_object_ref0 (_tmp40_);
 
342
        child = _tmp41_;
 
343
        _tmp42_ = child;
 
344
        if (_tmp42_ != NULL) {
 
345
                GtkWidget* _tmp43_;
 
346
                GdkWindow* _tmp44_;
 
347
                _tmp43_ = child;
 
348
                _tmp44_ = self->priv->bin_window;
 
349
                gtk_widget_set_parent_window (_tmp43_, _tmp44_);
 
350
        }
 
351
        _tmp45_ = gtk_widget_get_style_context ((GtkWidget*) self);
 
352
        _tmp46_ = _g_object_ref0 (_tmp45_);
 
353
        context = _tmp46_;
 
354
        _tmp47_ = self->priv->view_window;
 
355
        gtk_style_context_set_background (context, _tmp47_);
 
356
        _tmp48_ = self->priv->bin_window;
 
357
        gtk_style_context_set_background (context, _tmp48_);
 
358
        _tmp49_ = self->priv->bin_window;
 
359
        gdk_window_show (_tmp49_);
 
360
        _g_object_unref0 (context);
 
361
        _g_object_unref0 (child);
 
362
}
 
363
 
 
364
 
 
365
static void contacts_revealer_real_unrealize (GtkWidget* base) {
 
366
        ContactsRevealer * self;
 
367
        GdkWindow* _tmp0_;
 
368
        GdkWindow* _tmp1_;
 
369
        GdkWindow* _tmp2_;
 
370
        self = (ContactsRevealer*) base;
 
371
        _tmp0_ = self->priv->view_window;
 
372
        gdk_window_set_user_data (_tmp0_, (GObject*) self);
 
373
        _tmp1_ = self->priv->view_window;
 
374
        _tmp2_ = _g_object_ref0 (_tmp1_);
 
375
        gdk_window_destroy (_tmp2_);
 
376
        _g_object_unref0 (self->priv->view_window);
 
377
        self->priv->view_window = NULL;
 
378
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->unrealize ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin));
 
379
}
 
380
 
 
381
 
 
382
static void contacts_revealer_real_add (GtkContainer* base, GtkWidget* child) {
 
383
        ContactsRevealer * self;
 
384
        GtkWidget* _tmp0_;
 
385
        GdkWindow* _tmp1_;
 
386
        GtkWidget* _tmp2_;
 
387
        gdouble _tmp3_;
 
388
        GtkWidget* _tmp4_;
 
389
        self = (ContactsRevealer*) base;
 
390
        g_return_if_fail (child != NULL);
 
391
        _tmp0_ = child;
 
392
        _tmp1_ = self->priv->bin_window;
 
393
        gtk_widget_set_parent_window (_tmp0_, _tmp1_);
 
394
        _tmp2_ = child;
 
395
        _tmp3_ = self->priv->current_pos;
 
396
        gtk_widget_set_child_visible (_tmp2_, _tmp3_ != 0.0);
 
397
        _tmp4_ = child;
 
398
        GTK_CONTAINER_CLASS (contacts_revealer_parent_class)->add ((GtkContainer*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), _tmp4_);
 
399
}
 
400
 
 
401
 
 
402
static void contacts_revealer_real_style_updated (GtkWidget* base) {
 
403
        ContactsRevealer * self;
 
404
        gboolean _tmp0_ = FALSE;
 
405
        self = (ContactsRevealer*) base;
 
406
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->style_updated ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin));
 
407
        _tmp0_ = gtk_widget_get_realized ((GtkWidget*) self);
 
408
        if (_tmp0_) {
 
409
                GtkStyleContext* _tmp1_ = NULL;
 
410
                GtkStyleContext* _tmp2_;
 
411
                GtkStyleContext* context;
 
412
                GtkStyleContext* _tmp3_;
 
413
                GdkWindow* _tmp4_;
 
414
                GtkStyleContext* _tmp5_;
 
415
                GdkWindow* _tmp6_;
 
416
                _tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
 
417
                _tmp2_ = _g_object_ref0 (_tmp1_);
 
418
                context = _tmp2_;
 
419
                _tmp3_ = context;
 
420
                _tmp4_ = self->priv->bin_window;
 
421
                gtk_style_context_set_background (_tmp3_, _tmp4_);
 
422
                _tmp5_ = context;
 
423
                _tmp6_ = self->priv->view_window;
 
424
                gtk_style_context_set_background (_tmp5_, _tmp6_);
 
425
                _g_object_unref0 (context);
 
426
        }
 
427
}
 
428
 
 
429
 
 
430
static void contacts_revealer_real_size_allocate (GtkWidget* base, GtkAllocation* allocation) {
 
431
        ContactsRevealer * self;
 
432
        GtkAllocation _tmp0_;
 
433
        GtkAllocation _tmp1_ = {0};
 
434
        GtkAllocation child_allocation;
 
435
        GtkAllocation _tmp2_;
 
436
        GtkAllocation _tmp3_ = {0};
 
437
        GtkWidget* _tmp4_ = NULL;
 
438
        GtkWidget* _tmp5_;
 
439
        GtkWidget* child;
 
440
        gboolean _tmp6_ = FALSE;
 
441
        GtkWidget* _tmp7_;
 
442
        gboolean _tmp10_;
 
443
        gboolean _tmp13_ = FALSE;
 
444
        self = (ContactsRevealer*) base;
 
445
        g_return_if_fail (allocation != NULL);
 
446
        _tmp0_ = *allocation;
 
447
        gtk_widget_set_allocation ((GtkWidget*) self, &_tmp0_);
 
448
        child_allocation = _tmp1_;
 
449
        _tmp2_ = *allocation;
 
450
        contacts_revealer_get_child_allocation (self, &_tmp2_, &_tmp3_);
 
451
        child_allocation = _tmp3_;
 
452
        _tmp4_ = gtk_bin_get_child ((GtkBin*) self);
 
453
        _tmp5_ = _g_object_ref0 (_tmp4_);
 
454
        child = _tmp5_;
 
455
        _tmp7_ = child;
 
456
        if (_tmp7_ != NULL) {
 
457
                GtkWidget* _tmp8_;
 
458
                gboolean _tmp9_ = FALSE;
 
459
                _tmp8_ = child;
 
460
                _tmp9_ = gtk_widget_get_visible (_tmp8_);
 
461
                _tmp6_ = _tmp9_;
 
462
        } else {
 
463
                _tmp6_ = FALSE;
 
464
        }
 
465
        _tmp10_ = _tmp6_;
 
466
        if (_tmp10_) {
 
467
                GtkWidget* _tmp11_;
 
468
                GtkAllocation _tmp12_;
 
469
                _tmp11_ = child;
 
470
                _tmp12_ = child_allocation;
 
471
                gtk_widget_size_allocate (_tmp11_, &_tmp12_);
 
472
        }
 
473
        _tmp13_ = gtk_widget_get_realized ((GtkWidget*) self);
 
474
        if (_tmp13_) {
 
475
                gboolean _tmp14_ = FALSE;
 
476
                GdkWindow* _tmp33_;
 
477
                GtkAllocation _tmp34_;
 
478
                gint _tmp35_;
 
479
                GtkAllocation _tmp36_;
 
480
                gint _tmp37_;
 
481
                GtkAllocation _tmp38_;
 
482
                gint _tmp39_;
 
483
                GtkAllocation _tmp40_;
 
484
                gint _tmp41_;
 
485
                gint bin_x;
 
486
                gint bin_y;
 
487
                GtkOrientation _tmp42_;
 
488
                GdkWindow* _tmp51_;
 
489
                gint _tmp52_;
 
490
                gint _tmp53_;
 
491
                GtkAllocation _tmp54_;
 
492
                gint _tmp55_;
 
493
                GtkAllocation _tmp56_;
 
494
                gint _tmp57_;
 
495
                _tmp14_ = gtk_widget_get_mapped ((GtkWidget*) self);
 
496
                if (_tmp14_) {
 
497
                        gboolean _tmp15_ = FALSE;
 
498
                        GtkAllocation _tmp16_;
 
499
                        gint _tmp17_;
 
500
                        gboolean _tmp20_;
 
501
                        gboolean window_visible;
 
502
                        gboolean _tmp21_ = FALSE;
 
503
                        gboolean _tmp22_;
 
504
                        gboolean _tmp25_;
 
505
                        gboolean _tmp27_ = FALSE;
 
506
                        gboolean _tmp28_;
 
507
                        gboolean _tmp31_;
 
508
                        _tmp16_ = *allocation;
 
509
                        _tmp17_ = _tmp16_.width;
 
510
                        if (_tmp17_ > 0) {
 
511
                                GtkAllocation _tmp18_;
 
512
                                gint _tmp19_;
 
513
                                _tmp18_ = *allocation;
 
514
                                _tmp19_ = _tmp18_.height;
 
515
                                _tmp15_ = _tmp19_ > 0;
 
516
                        } else {
 
517
                                _tmp15_ = FALSE;
 
518
                        }
 
519
                        _tmp20_ = _tmp15_;
 
520
                        window_visible = _tmp20_;
 
521
                        _tmp22_ = window_visible;
 
522
                        if (!_tmp22_) {
 
523
                                GdkWindow* _tmp23_;
 
524
                                gboolean _tmp24_ = FALSE;
 
525
                                _tmp23_ = self->priv->view_window;
 
526
                                _tmp24_ = gdk_window_is_visible (_tmp23_);
 
527
                                _tmp21_ = _tmp24_;
 
528
                        } else {
 
529
                                _tmp21_ = FALSE;
 
530
                        }
 
531
                        _tmp25_ = _tmp21_;
 
532
                        if (_tmp25_) {
 
533
                                GdkWindow* _tmp26_;
 
534
                                _tmp26_ = self->priv->view_window;
 
535
                                gdk_window_hide (_tmp26_);
 
536
                        }
 
537
                        _tmp28_ = window_visible;
 
538
                        if (_tmp28_) {
 
539
                                GdkWindow* _tmp29_;
 
540
                                gboolean _tmp30_ = FALSE;
 
541
                                _tmp29_ = self->priv->view_window;
 
542
                                _tmp30_ = gdk_window_is_visible (_tmp29_);
 
543
                                _tmp27_ = !_tmp30_;
 
544
                        } else {
 
545
                                _tmp27_ = FALSE;
 
546
                        }
 
547
                        _tmp31_ = _tmp27_;
 
548
                        if (_tmp31_) {
 
549
                                GdkWindow* _tmp32_;
 
550
                                _tmp32_ = self->priv->view_window;
 
551
                                gdk_window_show (_tmp32_);
 
552
                        }
 
553
                }
 
554
                _tmp33_ = self->priv->view_window;
 
555
                _tmp34_ = *allocation;
 
556
                _tmp35_ = _tmp34_.x;
 
557
                _tmp36_ = *allocation;
 
558
                _tmp37_ = _tmp36_.y;
 
559
                _tmp38_ = *allocation;
 
560
                _tmp39_ = _tmp38_.width;
 
561
                _tmp40_ = *allocation;
 
562
                _tmp41_ = _tmp40_.height;
 
563
                gdk_window_move_resize (_tmp33_, _tmp35_, _tmp37_, _tmp39_, _tmp41_);
 
564
                bin_x = 0;
 
565
                bin_y = 0;
 
566
                _tmp42_ = self->priv->_orientation;
 
567
                if (_tmp42_ == GTK_ORIENTATION_HORIZONTAL) {
 
568
                        GtkAllocation _tmp43_;
 
569
                        gint _tmp44_;
 
570
                        GtkAllocation _tmp45_;
 
571
                        gint _tmp46_;
 
572
                        _tmp43_ = *allocation;
 
573
                        _tmp44_ = _tmp43_.height;
 
574
                        _tmp45_ = child_allocation;
 
575
                        _tmp46_ = _tmp45_.height;
 
576
                        bin_y = _tmp44_ - _tmp46_;
 
577
                } else {
 
578
                        GtkAllocation _tmp47_;
 
579
                        gint _tmp48_;
 
580
                        GtkAllocation _tmp49_;
 
581
                        gint _tmp50_;
 
582
                        _tmp47_ = *allocation;
 
583
                        _tmp48_ = _tmp47_.width;
 
584
                        _tmp49_ = child_allocation;
 
585
                        _tmp50_ = _tmp49_.width;
 
586
                        bin_x = _tmp48_ - _tmp50_;
 
587
                }
 
588
                _tmp51_ = self->priv->bin_window;
 
589
                _tmp52_ = bin_x;
 
590
                _tmp53_ = bin_y;
 
591
                _tmp54_ = child_allocation;
 
592
                _tmp55_ = _tmp54_.width;
 
593
                _tmp56_ = child_allocation;
 
594
                _tmp57_ = _tmp56_.height;
 
595
                gdk_window_move_resize (_tmp51_, _tmp52_, _tmp53_, _tmp55_, _tmp57_);
 
596
        }
 
597
        _g_object_unref0 (child);
 
598
}
 
599
 
 
600
 
 
601
static void contacts_revealer_set_amount (ContactsRevealer* self, gdouble amount) {
 
602
        gdouble _tmp0_;
 
603
        gboolean _tmp1_ = FALSE;
 
604
        gdouble _tmp2_;
 
605
        gboolean _tmp4_;
 
606
        gboolean new_visible;
 
607
        GtkWidget* _tmp5_ = NULL;
 
608
        GtkWidget* _tmp6_;
 
609
        GtkWidget* child;
 
610
        gboolean _tmp7_ = FALSE;
 
611
        GtkWidget* _tmp8_;
 
612
        gboolean _tmp12_;
 
613
        g_return_if_fail (self != NULL);
 
614
        _tmp0_ = amount;
 
615
        self->priv->current_pos = _tmp0_;
 
616
        _tmp2_ = amount;
 
617
        if (_tmp2_ != 0.0) {
 
618
                _tmp1_ = TRUE;
 
619
        } else {
 
620
                gdouble _tmp3_;
 
621
                _tmp3_ = self->priv->target_pos;
 
622
                _tmp1_ = _tmp3_ != 0.0;
 
623
        }
 
624
        _tmp4_ = _tmp1_;
 
625
        new_visible = _tmp4_;
 
626
        _tmp5_ = gtk_bin_get_child ((GtkBin*) self);
 
627
        _tmp6_ = _g_object_ref0 (_tmp5_);
 
628
        child = _tmp6_;
 
629
        _tmp8_ = child;
 
630
        if (_tmp8_ != NULL) {
 
631
                gboolean _tmp9_;
 
632
                GtkWidget* _tmp10_;
 
633
                gboolean _tmp11_ = FALSE;
 
634
                _tmp9_ = new_visible;
 
635
                _tmp10_ = child;
 
636
                _tmp11_ = gtk_widget_get_child_visible (_tmp10_);
 
637
                _tmp7_ = _tmp9_ != _tmp11_;
 
638
        } else {
 
639
                _tmp7_ = FALSE;
 
640
        }
 
641
        _tmp12_ = _tmp7_;
 
642
        if (_tmp12_) {
 
643
                GtkWidget* _tmp13_;
 
644
                gboolean _tmp14_;
 
645
                _tmp13_ = child;
 
646
                _tmp14_ = new_visible;
 
647
                gtk_widget_set_child_visible (_tmp13_, _tmp14_);
 
648
        }
 
649
        gtk_widget_queue_resize ((GtkWidget*) self);
 
650
        _g_object_unref0 (child);
 
651
}
 
652
 
 
653
 
 
654
static void contacts_revealer_animate_step (ContactsRevealer* self, gint64 now) {
 
655
        gdouble t;
 
656
        gint64 _tmp0_;
 
657
        gint64 _tmp1_;
 
658
        gdouble _tmp6_;
 
659
        gdouble _tmp7_ = 0.0;
 
660
        gdouble _tmp8_;
 
661
        gdouble _tmp9_;
 
662
        gdouble _tmp10_;
 
663
        gdouble _tmp11_;
 
664
        g_return_if_fail (self != NULL);
 
665
        t = 1.0;
 
666
        _tmp0_ = now;
 
667
        _tmp1_ = self->priv->end_time;
 
668
        if (_tmp0_ < _tmp1_) {
 
669
                gint64 _tmp2_;
 
670
                gint64 _tmp3_;
 
671
                gint64 _tmp4_;
 
672
                gint64 _tmp5_;
 
673
                _tmp2_ = now;
 
674
                _tmp3_ = self->priv->start_time;
 
675
                _tmp4_ = self->priv->end_time;
 
676
                _tmp5_ = self->priv->start_time;
 
677
                t = (_tmp2_ - _tmp3_) / ((gdouble) (_tmp4_ - _tmp5_));
 
678
        }
 
679
        _tmp6_ = t;
 
680
        _tmp7_ = transition_ease_out_quad (_tmp6_, 1.0);
 
681
        t = _tmp7_;
 
682
        _tmp8_ = self->priv->source_pos;
 
683
        _tmp9_ = t;
 
684
        _tmp10_ = self->priv->target_pos;
 
685
        _tmp11_ = self->priv->source_pos;
 
686
        contacts_revealer_set_amount (self, _tmp8_ + (_tmp9_ * (_tmp10_ - _tmp11_)));
 
687
}
 
688
 
 
689
 
 
690
static gboolean contacts_revealer_animate_cb (ContactsRevealer* self) {
 
691
        gboolean result = FALSE;
 
692
        gint64 _tmp0_ = 0LL;
 
693
        gint64 now;
 
694
        gint64 _tmp1_;
 
695
        gdouble _tmp2_;
 
696
        gdouble _tmp3_;
 
697
        g_return_val_if_fail (self != NULL, FALSE);
 
698
        _tmp0_ = g_get_monotonic_time ();
 
699
        now = _tmp0_;
 
700
        _tmp1_ = now;
 
701
        contacts_revealer_animate_step (self, _tmp1_);
 
702
        _tmp2_ = self->priv->current_pos;
 
703
        _tmp3_ = self->priv->target_pos;
 
704
        if (_tmp2_ == _tmp3_) {
 
705
                self->priv->timeout = (guint) 0;
 
706
                result = FALSE;
 
707
                return result;
 
708
        }
 
709
        result = TRUE;
 
710
        return result;
 
711
}
 
712
 
 
713
 
113
714
static gboolean _contacts_revealer_animate_cb_gsource_func (gpointer self) {
114
715
        gboolean result;
115
716
        result = contacts_revealer_animate_cb (self);
117
718
}
118
719
 
119
720
 
120
 
static void contacts_revealer_ensure_timer (ContactsRevealer* self) {
121
 
        guint _tmp0_;
 
721
static void contacts_revealer_start_animation (ContactsRevealer* self, gdouble target) {
 
722
        gdouble _tmp0_;
 
723
        gdouble _tmp1_;
 
724
        gdouble _tmp2_;
 
725
        gboolean _tmp3_ = FALSE;
122
726
        g_return_if_fail (self != NULL);
123
 
        _tmp0_ = self->priv->timeout;
124
 
        if (_tmp0_ == ((guint) 0)) {
125
 
                gdouble _tmp1_;
126
 
                gdouble _tmp2_;
127
 
                guint _tmp3_ = 0U;
128
 
                _tmp1_ = self->amount_visible;
129
 
                _tmp2_ = self->target_amount;
130
 
                if (_tmp1_ == _tmp2_) {
131
 
                        return;
 
727
        _tmp0_ = self->priv->target_pos;
 
728
        _tmp1_ = target;
 
729
        if (_tmp0_ == _tmp1_) {
 
730
                return;
 
731
        }
 
732
        _tmp2_ = target;
 
733
        self->priv->target_pos = _tmp2_;
 
734
        _tmp3_ = gtk_widget_get_mapped ((GtkWidget*) self);
 
735
        if (_tmp3_) {
 
736
                gdouble _tmp4_;
 
737
                gint64 _tmp5_ = 0LL;
 
738
                gint64 _tmp6_;
 
739
                gint _tmp7_;
 
740
                guint _tmp8_;
 
741
                gint64 _tmp10_;
 
742
                _tmp4_ = self->priv->current_pos;
 
743
                self->priv->source_pos = _tmp4_;
 
744
                _tmp5_ = g_get_monotonic_time ();
 
745
                self->priv->start_time = _tmp5_;
 
746
                _tmp6_ = self->priv->start_time;
 
747
                _tmp7_ = self->priv->_duration;
 
748
                self->priv->end_time = _tmp6_ + (_tmp7_ * 1000);
 
749
                _tmp8_ = self->priv->timeout;
 
750
                if (_tmp8_ == ((guint) 0)) {
 
751
                        guint _tmp9_ = 0U;
 
752
                        _tmp9_ = gdk_threads_add_timeout ((guint) CONTACTS_REVEALER_frame_time, _contacts_revealer_animate_cb_gsource_func, self);
 
753
                        self->priv->timeout = _tmp9_;
132
754
                }
133
 
                _tmp3_ = gdk_threads_add_timeout ((guint) (CONTACTS_REVEALER_animation_time / CONTACTS_REVEALER_animation_n_steps), _contacts_revealer_animate_cb_gsource_func, self);
134
 
                self->priv->timeout = _tmp3_;
 
755
                _tmp10_ = self->priv->start_time;
 
756
                contacts_revealer_animate_step (self, _tmp10_);
 
757
        } else {
 
758
                gdouble _tmp11_;
 
759
                _tmp11_ = target;
 
760
                contacts_revealer_set_amount (self, _tmp11_);
135
761
        }
136
762
}
137
763
 
138
764
 
139
 
static void contacts_revealer_real_show (GtkWidget* base) {
140
 
        ContactsRevealer * self;
 
765
static void contacts_revealer_stop_animation (ContactsRevealer* self) {
141
766
        gdouble _tmp0_;
142
 
        self = (ContactsRevealer*) base;
143
 
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->show ((GtkWidget*) GTK_VIEWPORT (self));
144
 
        _tmp0_ = self->target_amount;
145
 
        if (_tmp0_ != 1.0) {
146
 
                contacts_revealer_reveal (self);
147
 
        }
148
 
}
149
 
 
150
 
 
151
 
static void contacts_revealer_real_hide (GtkWidget* base) {
152
 
        ContactsRevealer * self;
153
 
        guint _tmp0_;
154
 
        self = (ContactsRevealer*) base;
155
 
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->hide ((GtkWidget*) GTK_VIEWPORT (self));
156
 
        self->target_amount = (gdouble) 0;
157
 
        self->amount_visible = (gdouble) 0;
158
 
        _tmp0_ = self->priv->timeout;
159
 
        if (_tmp0_ != ((guint) 0)) {
160
 
                guint _tmp1_;
161
 
                _tmp1_ = self->priv->timeout;
162
 
                g_source_remove (_tmp1_);
 
767
        guint _tmp1_;
 
768
        g_return_if_fail (self != NULL);
 
769
        _tmp0_ = self->priv->target_pos;
 
770
        self->priv->current_pos = _tmp0_;
 
771
        _tmp1_ = self->priv->timeout;
 
772
        if (_tmp1_ != ((guint) 0)) {
 
773
                guint _tmp2_;
 
774
                _tmp2_ = self->priv->timeout;
 
775
                g_source_remove (_tmp2_);
163
776
                self->priv->timeout = (guint) 0;
164
777
        }
165
778
}
166
779
 
167
780
 
 
781
static void contacts_revealer_real_map (GtkWidget* base) {
 
782
        ContactsRevealer * self;
 
783
        gboolean _tmp0_ = FALSE;
 
784
        self = (ContactsRevealer*) base;
 
785
        _tmp0_ = gtk_widget_get_mapped ((GtkWidget*) self);
 
786
        if (!_tmp0_) {
 
787
                GtkAllocation allocation = {0};
 
788
                GtkAllocation _tmp1_ = {0};
 
789
                gboolean _tmp2_ = FALSE;
 
790
                GtkAllocation _tmp3_;
 
791
                gint _tmp4_;
 
792
                gboolean _tmp7_;
 
793
                gdouble _tmp9_;
 
794
                gtk_widget_get_allocation ((GtkWidget*) self, &_tmp1_);
 
795
                allocation = _tmp1_;
 
796
                _tmp3_ = allocation;
 
797
                _tmp4_ = _tmp3_.width;
 
798
                if (_tmp4_ > 0) {
 
799
                        GtkAllocation _tmp5_;
 
800
                        gint _tmp6_;
 
801
                        _tmp5_ = allocation;
 
802
                        _tmp6_ = _tmp5_.height;
 
803
                        _tmp2_ = _tmp6_ > 0;
 
804
                } else {
 
805
                        _tmp2_ = FALSE;
 
806
                }
 
807
                _tmp7_ = _tmp2_;
 
808
                if (_tmp7_) {
 
809
                        GdkWindow* _tmp8_;
 
810
                        _tmp8_ = self->priv->view_window;
 
811
                        gdk_window_show (_tmp8_);
 
812
                }
 
813
                _tmp9_ = self->priv->target_pos;
 
814
                contacts_revealer_start_animation (self, _tmp9_);
 
815
        }
 
816
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->map ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin));
 
817
}
 
818
 
 
819
 
 
820
static void contacts_revealer_real_unmap (GtkWidget* base) {
 
821
        ContactsRevealer * self;
 
822
        self = (ContactsRevealer*) base;
 
823
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->unmap ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin));
 
824
        contacts_revealer_stop_animation (self);
 
825
}
 
826
 
 
827
 
 
828
static gboolean contacts_revealer_real_draw (GtkWidget* base, cairo_t* cr) {
 
829
        ContactsRevealer * self;
 
830
        gboolean result = FALSE;
 
831
        cairo_t* _tmp0_;
 
832
        GdkWindow* _tmp1_;
 
833
        gboolean _tmp2_ = FALSE;
 
834
        self = (ContactsRevealer*) base;
 
835
        g_return_val_if_fail (cr != NULL, FALSE);
 
836
        _tmp0_ = cr;
 
837
        _tmp1_ = self->priv->bin_window;
 
838
        _tmp2_ = gtk_cairo_should_draw_window (_tmp0_, _tmp1_);
 
839
        if (_tmp2_) {
 
840
                cairo_t* _tmp3_;
 
841
                _tmp3_ = cr;
 
842
                GTK_WIDGET_CLASS (contacts_revealer_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), _tmp3_);
 
843
        }
 
844
        result = TRUE;
 
845
        return result;
 
846
}
 
847
 
 
848
 
168
849
void contacts_revealer_reveal (ContactsRevealer* self) {
169
850
        g_return_if_fail (self != NULL);
170
 
        self->target_amount = 1.0;
171
 
        gtk_widget_show ((GtkWidget*) self);
172
 
        contacts_revealer_ensure_timer (self);
 
851
        contacts_revealer_start_animation (self, 1.0);
173
852
}
174
853
 
175
854
 
176
855
void contacts_revealer_unreveal (ContactsRevealer* self) {
177
856
        g_return_if_fail (self != NULL);
178
 
        self->target_amount = 0.0;
179
 
        contacts_revealer_ensure_timer (self);
180
 
}
181
 
 
182
 
 
183
 
static gboolean contacts_revealer_animate_cb (ContactsRevealer* self) {
184
 
        gboolean result = FALSE;
185
 
        gdouble delta;
186
 
        gdouble _tmp0_;
187
 
        gdouble _tmp1_;
188
 
        gdouble _tmp10_;
189
 
        gdouble _tmp11_;
190
 
        g_return_val_if_fail (self != NULL, FALSE);
191
 
        delta = 1.0 / CONTACTS_REVEALER_animation_n_steps;
192
 
        _tmp0_ = self->amount_visible;
193
 
        _tmp1_ = self->target_amount;
194
 
        if (_tmp0_ < _tmp1_) {
195
 
                gdouble _tmp2_;
196
 
                gdouble _tmp3_;
197
 
                gdouble _tmp4_;
198
 
                gdouble _tmp5_ = 0.0;
199
 
                _tmp2_ = self->target_amount;
200
 
                _tmp3_ = self->amount_visible;
201
 
                _tmp4_ = delta;
202
 
                _tmp5_ = MIN (_tmp2_, _tmp3_ + _tmp4_);
203
 
                self->amount_visible = _tmp5_;
204
 
        } else {
205
 
                gdouble _tmp6_;
206
 
                gdouble _tmp7_;
207
 
                gdouble _tmp8_;
208
 
                gdouble _tmp9_ = 0.0;
209
 
                _tmp6_ = self->target_amount;
210
 
                _tmp7_ = self->amount_visible;
211
 
                _tmp8_ = delta;
212
 
                _tmp9_ = MAX (_tmp6_, _tmp7_ - _tmp8_);
213
 
                self->amount_visible = _tmp9_;
214
 
        }
215
 
        gtk_widget_queue_resize ((GtkWidget*) self);
216
 
        _tmp10_ = self->amount_visible;
217
 
        _tmp11_ = self->target_amount;
218
 
        if (_tmp10_ == _tmp11_) {
219
 
                gdouble _tmp12_;
220
 
                self->priv->timeout = (guint) 0;
221
 
                _tmp12_ = self->amount_visible;
222
 
                if (_tmp12_ == ((gdouble) 0)) {
223
 
                        gtk_widget_hide ((GtkWidget*) self);
224
 
                }
225
 
                result = FALSE;
226
 
                return result;
227
 
        }
228
 
        result = TRUE;
229
 
        return result;
 
857
        contacts_revealer_start_animation (self, 0.0);
230
858
}
231
859
 
232
860
 
236
864
        gint _vala_natural_height = 0;
237
865
        gint _tmp0_ = 0;
238
866
        gint _tmp1_ = 0;
239
 
        gint _tmp2_;
240
 
        gdouble _tmp3_;
241
 
        gint _tmp4_;
242
 
        gdouble _tmp5_;
 
867
        GtkOrientation _tmp2_;
 
868
        gint _tmp5_;
243
869
        self = (ContactsRevealer*) base;
244
 
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->get_preferred_height ((GtkWidget*) GTK_VIEWPORT (self), &_tmp0_, &_tmp1_);
 
870
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->get_preferred_height ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), &_tmp0_, &_tmp1_);
245
871
        _vala_minimum_height = _tmp0_;
246
872
        _vala_natural_height = _tmp1_;
247
 
        _tmp2_ = _vala_minimum_height;
248
 
        _tmp3_ = self->amount_visible;
249
 
        _vala_minimum_height = (gint) (_tmp2_ * _tmp3_);
250
 
        _tmp4_ = _vala_natural_height;
251
 
        _tmp5_ = self->amount_visible;
252
 
        _vala_natural_height = (gint) (_tmp4_ * _tmp5_);
 
873
        _tmp2_ = self->priv->_orientation;
 
874
        if (_tmp2_ == GTK_ORIENTATION_HORIZONTAL) {
 
875
                gint _tmp3_;
 
876
                gdouble _tmp4_;
 
877
                _tmp3_ = _vala_natural_height;
 
878
                _tmp4_ = self->priv->current_pos;
 
879
                _vala_natural_height = (gint) (_tmp3_ * _tmp4_);
 
880
        }
 
881
        _tmp5_ = _vala_natural_height;
 
882
        _vala_minimum_height = _tmp5_;
253
883
        if (minimum_height) {
254
884
                *minimum_height = _vala_minimum_height;
255
885
        }
266
896
        gint _tmp0_;
267
897
        gint _tmp1_ = 0;
268
898
        gint _tmp2_ = 0;
269
 
        gint _tmp3_;
270
 
        gdouble _tmp4_;
271
 
        gint _tmp5_;
272
 
        gdouble _tmp6_;
 
899
        GtkOrientation _tmp3_;
 
900
        gint _tmp6_;
273
901
        self = (ContactsRevealer*) base;
274
902
        _tmp0_ = width;
275
 
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->get_preferred_height_for_width ((GtkWidget*) GTK_VIEWPORT (self), _tmp0_, &_tmp1_, &_tmp2_);
 
903
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->get_preferred_height_for_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), _tmp0_, &_tmp1_, &_tmp2_);
276
904
        _vala_minimum_height = _tmp1_;
277
905
        _vala_natural_height = _tmp2_;
278
 
        _tmp3_ = _vala_minimum_height;
279
 
        _tmp4_ = self->amount_visible;
280
 
        _vala_minimum_height = (gint) (_tmp3_ * _tmp4_);
281
 
        _tmp5_ = _vala_natural_height;
282
 
        _tmp6_ = self->amount_visible;
283
 
        _vala_natural_height = (gint) (_tmp5_ * _tmp6_);
 
906
        _tmp3_ = self->priv->_orientation;
 
907
        if (_tmp3_ == GTK_ORIENTATION_HORIZONTAL) {
 
908
                gint _tmp4_;
 
909
                gdouble _tmp5_;
 
910
                _tmp4_ = _vala_natural_height;
 
911
                _tmp5_ = self->priv->current_pos;
 
912
                _vala_natural_height = (gint) (_tmp4_ * _tmp5_);
 
913
        }
 
914
        _tmp6_ = _vala_natural_height;
 
915
        _vala_minimum_height = _tmp6_;
284
916
        if (minimum_height) {
285
917
                *minimum_height = _vala_minimum_height;
286
918
        }
290
922
}
291
923
 
292
924
 
293
 
static void contacts_revealer_real_size_allocate (GtkWidget* base, GtkAllocation* allocation) {
 
925
static void contacts_revealer_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width) {
294
926
        ContactsRevealer * self;
295
 
        GtkAllocation _tmp0_;
296
 
        GtkAdjustment* _tmp1_;
297
 
        gdouble _tmp2_ = 0.0;
298
 
        gdouble upper;
299
 
        GtkAdjustment* _tmp3_;
300
 
        GtkAllocation _tmp4_;
 
927
        gint _vala_minimum_width = 0;
 
928
        gint _vala_natural_width = 0;
 
929
        gint _tmp0_ = 0;
 
930
        gint _tmp1_ = 0;
 
931
        GtkOrientation _tmp2_;
301
932
        gint _tmp5_;
302
933
        self = (ContactsRevealer*) base;
303
 
        g_return_if_fail (allocation != NULL);
304
 
        _tmp0_ = *allocation;
305
 
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->size_allocate ((GtkWidget*) GTK_VIEWPORT (self), &_tmp0_);
306
 
        _tmp1_ = self->vadjustment;
307
 
        _tmp2_ = gtk_adjustment_get_upper (_tmp1_);
308
 
        upper = _tmp2_;
309
 
        _tmp3_ = self->vadjustment;
310
 
        _tmp4_ = *allocation;
311
 
        _tmp5_ = _tmp4_.height;
312
 
        gtk_adjustment_set_value (_tmp3_, upper - _tmp5_);
 
934
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->get_preferred_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), &_tmp0_, &_tmp1_);
 
935
        _vala_minimum_width = _tmp0_;
 
936
        _vala_natural_width = _tmp1_;
 
937
        _tmp2_ = self->priv->_orientation;
 
938
        if (_tmp2_ == GTK_ORIENTATION_VERTICAL) {
 
939
                gint _tmp3_;
 
940
                gdouble _tmp4_;
 
941
                _tmp3_ = _vala_natural_width;
 
942
                _tmp4_ = self->priv->current_pos;
 
943
                _vala_natural_width = (gint) (_tmp3_ * _tmp4_);
 
944
        }
 
945
        _tmp5_ = _vala_natural_width;
 
946
        _vala_minimum_width = _tmp5_;
 
947
        if (minimum_width) {
 
948
                *minimum_width = _vala_minimum_width;
 
949
        }
 
950
        if (natural_width) {
 
951
                *natural_width = _vala_natural_width;
 
952
        }
 
953
}
 
954
 
 
955
 
 
956
static void contacts_revealer_real_get_preferred_width_for_height (GtkWidget* base, gint height, gint* minimum_width, gint* natural_width) {
 
957
        ContactsRevealer * self;
 
958
        gint _vala_minimum_width = 0;
 
959
        gint _vala_natural_width = 0;
 
960
        gint _tmp0_;
 
961
        gint _tmp1_ = 0;
 
962
        gint _tmp2_ = 0;
 
963
        GtkOrientation _tmp3_;
 
964
        gint _tmp6_;
 
965
        self = (ContactsRevealer*) base;
 
966
        _tmp0_ = height;
 
967
        GTK_WIDGET_CLASS (contacts_revealer_parent_class)->get_preferred_width_for_height ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), _tmp0_, &_tmp1_, &_tmp2_);
 
968
        _vala_minimum_width = _tmp1_;
 
969
        _vala_natural_width = _tmp2_;
 
970
        _tmp3_ = self->priv->_orientation;
 
971
        if (_tmp3_ == GTK_ORIENTATION_VERTICAL) {
 
972
                gint _tmp4_;
 
973
                gdouble _tmp5_;
 
974
                _tmp4_ = _vala_natural_width;
 
975
                _tmp5_ = self->priv->current_pos;
 
976
                _vala_natural_width = (gint) (_tmp4_ * _tmp5_);
 
977
        }
 
978
        _tmp6_ = _vala_natural_width;
 
979
        _vala_minimum_width = _tmp6_;
 
980
        if (minimum_width) {
 
981
                *minimum_width = _vala_minimum_width;
 
982
        }
 
983
        if (natural_width) {
 
984
                *natural_width = _vala_natural_width;
 
985
        }
 
986
}
 
987
 
 
988
 
 
989
GtkOrientation contacts_revealer_get_orientation (ContactsRevealer* self) {
 
990
        GtkOrientation result;
 
991
        GtkOrientation _tmp0_;
 
992
        g_return_val_if_fail (self != NULL, 0);
 
993
        _tmp0_ = self->priv->_orientation;
 
994
        result = _tmp0_;
 
995
        return result;
 
996
}
 
997
 
 
998
 
 
999
void contacts_revealer_set_orientation (ContactsRevealer* self, GtkOrientation value) {
 
1000
        GtkOrientation _tmp0_;
 
1001
        g_return_if_fail (self != NULL);
 
1002
        _tmp0_ = value;
 
1003
        self->priv->_orientation = _tmp0_;
 
1004
        g_object_notify ((GObject *) self, "orientation");
 
1005
}
 
1006
 
 
1007
 
 
1008
gint contacts_revealer_get_duration (ContactsRevealer* self) {
 
1009
        gint result;
 
1010
        gint _tmp0_;
 
1011
        g_return_val_if_fail (self != NULL, 0);
 
1012
        _tmp0_ = self->priv->_duration;
 
1013
        result = _tmp0_;
 
1014
        return result;
 
1015
}
 
1016
 
 
1017
 
 
1018
void contacts_revealer_set_duration (ContactsRevealer* self, gint value) {
 
1019
        gint _tmp0_;
 
1020
        g_return_if_fail (self != NULL);
 
1021
        _tmp0_ = value;
 
1022
        self->priv->_duration = _tmp0_;
 
1023
        g_object_notify ((GObject *) self, "duration");
313
1024
}
314
1025
 
315
1026
 
316
1027
static void contacts_revealer_class_init (ContactsRevealerClass * klass) {
317
1028
        contacts_revealer_parent_class = g_type_class_peek_parent (klass);
318
1029
        g_type_class_add_private (klass, sizeof (ContactsRevealerPrivate));
319
 
        GTK_WIDGET_CLASS (klass)->show = contacts_revealer_real_show;
320
 
        GTK_WIDGET_CLASS (klass)->hide = contacts_revealer_real_hide;
 
1030
        GTK_WIDGET_CLASS (klass)->realize = contacts_revealer_real_realize;
 
1031
        GTK_WIDGET_CLASS (klass)->unrealize = contacts_revealer_real_unrealize;
 
1032
        GTK_CONTAINER_CLASS (klass)->add = contacts_revealer_real_add;
 
1033
        GTK_WIDGET_CLASS (klass)->style_updated = contacts_revealer_real_style_updated;
 
1034
        GTK_WIDGET_CLASS (klass)->size_allocate = contacts_revealer_real_size_allocate;
 
1035
        GTK_WIDGET_CLASS (klass)->map = contacts_revealer_real_map;
 
1036
        GTK_WIDGET_CLASS (klass)->unmap = contacts_revealer_real_unmap;
 
1037
        GTK_WIDGET_CLASS (klass)->draw = contacts_revealer_real_draw;
321
1038
        GTK_WIDGET_CLASS (klass)->get_preferred_height = contacts_revealer_real_get_preferred_height;
322
1039
        GTK_WIDGET_CLASS (klass)->get_preferred_height_for_width = contacts_revealer_real_get_preferred_height_for_width;
323
 
        GTK_WIDGET_CLASS (klass)->size_allocate = contacts_revealer_real_size_allocate;
 
1040
        GTK_WIDGET_CLASS (klass)->get_preferred_width = contacts_revealer_real_get_preferred_width;
 
1041
        GTK_WIDGET_CLASS (klass)->get_preferred_width_for_height = contacts_revealer_real_get_preferred_width_for_height;
 
1042
        G_OBJECT_CLASS (klass)->get_property = _vala_contacts_revealer_get_property;
 
1043
        G_OBJECT_CLASS (klass)->set_property = _vala_contacts_revealer_set_property;
324
1044
        G_OBJECT_CLASS (klass)->finalize = contacts_revealer_finalize;
 
1045
        g_object_class_install_property (G_OBJECT_CLASS (klass), CONTACTS_REVEALER_ORIENTATION, g_param_spec_enum ("orientation", "orientation", "orientation", GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
1046
        g_object_class_install_property (G_OBJECT_CLASS (klass), CONTACTS_REVEALER_DURATION, g_param_spec_int ("duration", "duration", "duration", G_MININT, G_MAXINT, 250, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
325
1047
}
326
1048
 
327
1049
 
328
1050
static void contacts_revealer_instance_init (ContactsRevealer * self) {
329
1051
        self->priv = CONTACTS_REVEALER_GET_PRIVATE (self);
 
1052
        self->priv->_orientation = GTK_ORIENTATION_HORIZONTAL;
 
1053
        self->priv->_duration = 250;
330
1054
}
331
1055
 
332
1056
 
333
1057
static void contacts_revealer_finalize (GObject* obj) {
334
1058
        ContactsRevealer * self;
335
 
        self = CONTACTS_REVEALER (obj);
336
 
        _g_object_unref0 (self->bin_window);
337
 
        _g_object_unref0 (self->view_window);
338
 
        _g_object_unref0 (self->vadjustment);
 
1059
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_REVEALER, ContactsRevealer);
 
1060
        _g_object_unref0 (self->priv->bin_window);
 
1061
        _g_object_unref0 (self->priv->view_window);
339
1062
        G_OBJECT_CLASS (contacts_revealer_parent_class)->finalize (obj);
340
1063
}
341
1064
 
345
1068
        if (g_once_init_enter (&contacts_revealer_type_id__volatile)) {
346
1069
                static const GTypeInfo g_define_type_info = { sizeof (ContactsRevealerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_revealer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsRevealer), 0, (GInstanceInitFunc) contacts_revealer_instance_init, NULL };
347
1070
                GType contacts_revealer_type_id;
348
 
                contacts_revealer_type_id = g_type_register_static (GTK_TYPE_VIEWPORT, "ContactsRevealer", &g_define_type_info, 0);
 
1071
                contacts_revealer_type_id = g_type_register_static (GTK_TYPE_BIN, "ContactsRevealer", &g_define_type_info, 0);
349
1072
                g_once_init_leave (&contacts_revealer_type_id__volatile, contacts_revealer_type_id);
350
1073
        }
351
1074
        return contacts_revealer_type_id__volatile;
352
1075
}
353
1076
 
354
1077
 
 
1078
static void _vala_contacts_revealer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
1079
        ContactsRevealer * self;
 
1080
        self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_REVEALER, ContactsRevealer);
 
1081
        switch (property_id) {
 
1082
                case CONTACTS_REVEALER_ORIENTATION:
 
1083
                g_value_set_enum (value, contacts_revealer_get_orientation (self));
 
1084
                break;
 
1085
                case CONTACTS_REVEALER_DURATION:
 
1086
                g_value_set_int (value, contacts_revealer_get_duration (self));
 
1087
                break;
 
1088
                default:
 
1089
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
1090
                break;
 
1091
        }
 
1092
}
 
1093
 
 
1094
 
 
1095
static void _vala_contacts_revealer_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
 
1096
        ContactsRevealer * self;
 
1097
        self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_REVEALER, ContactsRevealer);
 
1098
        switch (property_id) {
 
1099
                case CONTACTS_REVEALER_ORIENTATION:
 
1100
                contacts_revealer_set_orientation (self, g_value_get_enum (value));
 
1101
                break;
 
1102
                case CONTACTS_REVEALER_DURATION:
 
1103
                contacts_revealer_set_duration (self, g_value_get_int (value));
 
1104
                break;
 
1105
                default:
 
1106
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
1107
                break;
 
1108
        }
 
1109
}
 
1110
 
 
1111
 
355
1112