40
41
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
42
43
struct _ContactsRevealer {
43
GtkViewport parent_instance;
44
GtkBin parent_instance;
44
45
ContactsRevealerPrivate * priv;
48
struct _ContactsRevealerClass {
49
GtkBinClass parent_class;
52
struct _ContactsRevealerPrivate {
53
GtkOrientation _orientation;
45
55
GdkWindow* bin_window;
46
56
GdkWindow* view_window;
47
GtkAdjustment* vadjustment;
48
gdouble amount_visible;
49
gdouble target_amount;
52
struct _ContactsRevealerClass {
53
GtkViewportClass parent_class;
56
struct _ContactsRevealerPrivate {
61
66
static gpointer contacts_revealer_parent_class = NULL;
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))
66
CONTACTS_REVEALER_DUMMY_PROPERTY
72
CONTACTS_REVEALER_DUMMY_PROPERTY,
73
CONTACTS_REVEALER_ORIENTATION,
74
CONTACTS_REVEALER_DURATION
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);
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);
109
gdouble transition_ease_out_quad (gdouble t, gdouble d) {
110
gdouble result = 0.0;
117
result = ((-1.0) * p) * (p - 2);
90
122
ContactsRevealer* contacts_revealer_construct (GType object_type) {
91
123
ContactsRevealer * self = NULL;
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);
140
static gpointer _g_object_ref0 (gpointer self) {
141
return self ? g_object_ref (self) : NULL;
145
static void contacts_revealer_get_child_allocation (ContactsRevealer* self, GtkAllocation* allocation, GtkAllocation* child_allocation) {
146
GtkAllocation _vala_child_allocation = {0};
147
GtkAllocation _tmp0_;
149
GtkAllocation _tmp2_;
151
GtkAllocation _tmp4_ = {0};
152
GtkWidget* _tmp5_ = NULL;
155
gboolean _tmp7_ = FALSE;
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;
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_);
173
if (_tmp8_ != NULL) {
175
gboolean _tmp10_ = FALSE;
177
_tmp10_ = gtk_widget_get_visible (_tmp9_);
184
GtkOrientation _tmp12_;
185
_tmp12_ = self->priv->_orientation;
186
if (_tmp12_ == GTK_ORIENTATION_HORIZONTAL) {
188
GtkAllocation _tmp14_;
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_;
198
GtkAllocation _tmp18_;
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_;
208
_g_object_unref0 (child);
209
if (child_allocation) {
210
*child_allocation = _vala_child_allocation;
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_;
223
GtkAllocation _tmp4_;
225
GtkAllocation _tmp6_;
227
GtkAllocation _tmp8_;
229
GdkVisual* _tmp10_ = NULL;
231
GdkWindowAttributesType attributes_mask;
232
GdkWindow* _tmp12_ = NULL;
233
GdkWindowAttr _tmp13_;
234
GdkWindowAttributesType _tmp14_;
239
GtkAllocation _tmp19_ = {0};
240
GtkAllocation child_allocation;
241
GtkAllocation _tmp20_;
242
GtkAllocation _tmp21_ = {0};
243
GtkAllocation _tmp22_;
245
GtkAllocation _tmp24_;
247
GtkOrientation _tmp26_;
249
GdkWindowAttr _tmp36_;
250
GdkWindowAttributesType _tmp37_;
253
GtkWidget* _tmp40_ = NULL;
257
GtkStyleContext* _tmp45_ = NULL;
258
GtkStyleContext* _tmp46_;
259
GtkStyleContext* context;
263
self = (ContactsRevealer*) base;
264
gtk_widget_set_realized ((GtkWidget*) self, TRUE);
265
gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
270
attributes.x = _tmp3_;
273
attributes.y = _tmp5_;
275
_tmp7_ = _tmp6_.width;
276
attributes.width = _tmp7_;
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_;
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_;
314
GtkAllocation _tmp29_;
316
_tmp27_ = allocation;
317
_tmp28_ = _tmp27_.height;
318
_tmp29_ = child_allocation;
319
_tmp30_ = _tmp29_.height;
320
attributes.y = _tmp28_ - _tmp30_;
322
GtkAllocation _tmp31_;
324
GtkAllocation _tmp33_;
326
_tmp31_ = allocation;
327
_tmp32_ = _tmp31_.width;
328
_tmp33_ = child_allocation;
329
_tmp34_ = _tmp33_.width;
330
attributes.x = _tmp32_ - _tmp34_;
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_);
344
if (_tmp42_ != NULL) {
348
_tmp44_ = self->priv->bin_window;
349
gtk_widget_set_parent_window (_tmp43_, _tmp44_);
351
_tmp45_ = gtk_widget_get_style_context ((GtkWidget*) self);
352
_tmp46_ = _g_object_ref0 (_tmp45_);
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);
365
static void contacts_revealer_real_unrealize (GtkWidget* base) {
366
ContactsRevealer * self;
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));
382
static void contacts_revealer_real_add (GtkContainer* base, GtkWidget* child) {
383
ContactsRevealer * self;
389
self = (ContactsRevealer*) base;
390
g_return_if_fail (child != NULL);
392
_tmp1_ = self->priv->bin_window;
393
gtk_widget_set_parent_window (_tmp0_, _tmp1_);
395
_tmp3_ = self->priv->current_pos;
396
gtk_widget_set_child_visible (_tmp2_, _tmp3_ != 0.0);
398
GTK_CONTAINER_CLASS (contacts_revealer_parent_class)->add ((GtkContainer*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), _tmp4_);
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);
409
GtkStyleContext* _tmp1_ = NULL;
410
GtkStyleContext* _tmp2_;
411
GtkStyleContext* context;
412
GtkStyleContext* _tmp3_;
414
GtkStyleContext* _tmp5_;
416
_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
417
_tmp2_ = _g_object_ref0 (_tmp1_);
420
_tmp4_ = self->priv->bin_window;
421
gtk_style_context_set_background (_tmp3_, _tmp4_);
423
_tmp6_ = self->priv->view_window;
424
gtk_style_context_set_background (_tmp5_, _tmp6_);
425
_g_object_unref0 (context);
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;
440
gboolean _tmp6_ = FALSE;
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_);
456
if (_tmp7_ != NULL) {
458
gboolean _tmp9_ = FALSE;
460
_tmp9_ = gtk_widget_get_visible (_tmp8_);
468
GtkAllocation _tmp12_;
470
_tmp12_ = child_allocation;
471
gtk_widget_size_allocate (_tmp11_, &_tmp12_);
473
_tmp13_ = gtk_widget_get_realized ((GtkWidget*) self);
475
gboolean _tmp14_ = FALSE;
477
GtkAllocation _tmp34_;
479
GtkAllocation _tmp36_;
481
GtkAllocation _tmp38_;
483
GtkAllocation _tmp40_;
487
GtkOrientation _tmp42_;
491
GtkAllocation _tmp54_;
493
GtkAllocation _tmp56_;
495
_tmp14_ = gtk_widget_get_mapped ((GtkWidget*) self);
497
gboolean _tmp15_ = FALSE;
498
GtkAllocation _tmp16_;
501
gboolean window_visible;
502
gboolean _tmp21_ = FALSE;
505
gboolean _tmp27_ = FALSE;
508
_tmp16_ = *allocation;
509
_tmp17_ = _tmp16_.width;
511
GtkAllocation _tmp18_;
513
_tmp18_ = *allocation;
514
_tmp19_ = _tmp18_.height;
515
_tmp15_ = _tmp19_ > 0;
520
window_visible = _tmp20_;
521
_tmp22_ = window_visible;
524
gboolean _tmp24_ = FALSE;
525
_tmp23_ = self->priv->view_window;
526
_tmp24_ = gdk_window_is_visible (_tmp23_);
534
_tmp26_ = self->priv->view_window;
535
gdk_window_hide (_tmp26_);
537
_tmp28_ = window_visible;
540
gboolean _tmp30_ = FALSE;
541
_tmp29_ = self->priv->view_window;
542
_tmp30_ = gdk_window_is_visible (_tmp29_);
550
_tmp32_ = self->priv->view_window;
551
gdk_window_show (_tmp32_);
554
_tmp33_ = self->priv->view_window;
555
_tmp34_ = *allocation;
557
_tmp36_ = *allocation;
559
_tmp38_ = *allocation;
560
_tmp39_ = _tmp38_.width;
561
_tmp40_ = *allocation;
562
_tmp41_ = _tmp40_.height;
563
gdk_window_move_resize (_tmp33_, _tmp35_, _tmp37_, _tmp39_, _tmp41_);
566
_tmp42_ = self->priv->_orientation;
567
if (_tmp42_ == GTK_ORIENTATION_HORIZONTAL) {
568
GtkAllocation _tmp43_;
570
GtkAllocation _tmp45_;
572
_tmp43_ = *allocation;
573
_tmp44_ = _tmp43_.height;
574
_tmp45_ = child_allocation;
575
_tmp46_ = _tmp45_.height;
576
bin_y = _tmp44_ - _tmp46_;
578
GtkAllocation _tmp47_;
580
GtkAllocation _tmp49_;
582
_tmp47_ = *allocation;
583
_tmp48_ = _tmp47_.width;
584
_tmp49_ = child_allocation;
585
_tmp50_ = _tmp49_.width;
586
bin_x = _tmp48_ - _tmp50_;
588
_tmp51_ = self->priv->bin_window;
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_);
597
_g_object_unref0 (child);
601
static void contacts_revealer_set_amount (ContactsRevealer* self, gdouble amount) {
603
gboolean _tmp1_ = FALSE;
606
gboolean new_visible;
607
GtkWidget* _tmp5_ = NULL;
610
gboolean _tmp7_ = FALSE;
613
g_return_if_fail (self != NULL);
615
self->priv->current_pos = _tmp0_;
621
_tmp3_ = self->priv->target_pos;
622
_tmp1_ = _tmp3_ != 0.0;
625
new_visible = _tmp4_;
626
_tmp5_ = gtk_bin_get_child ((GtkBin*) self);
627
_tmp6_ = _g_object_ref0 (_tmp5_);
630
if (_tmp8_ != NULL) {
633
gboolean _tmp11_ = FALSE;
634
_tmp9_ = new_visible;
636
_tmp11_ = gtk_widget_get_child_visible (_tmp10_);
637
_tmp7_ = _tmp9_ != _tmp11_;
646
_tmp14_ = new_visible;
647
gtk_widget_set_child_visible (_tmp13_, _tmp14_);
649
gtk_widget_queue_resize ((GtkWidget*) self);
650
_g_object_unref0 (child);
654
static void contacts_revealer_animate_step (ContactsRevealer* self, gint64 now) {
659
gdouble _tmp7_ = 0.0;
664
g_return_if_fail (self != NULL);
667
_tmp1_ = self->priv->end_time;
668
if (_tmp0_ < _tmp1_) {
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_));
680
_tmp7_ = transition_ease_out_quad (_tmp6_, 1.0);
682
_tmp8_ = self->priv->source_pos;
684
_tmp10_ = self->priv->target_pos;
685
_tmp11_ = self->priv->source_pos;
686
contacts_revealer_set_amount (self, _tmp8_ + (_tmp9_ * (_tmp10_ - _tmp11_)));
690
static gboolean contacts_revealer_animate_cb (ContactsRevealer* self) {
691
gboolean result = FALSE;
697
g_return_val_if_fail (self != NULL, FALSE);
698
_tmp0_ = g_get_monotonic_time ();
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;
113
714
static gboolean _contacts_revealer_animate_cb_gsource_func (gpointer self) {
115
716
result = contacts_revealer_animate_cb (self);
120
static void contacts_revealer_ensure_timer (ContactsRevealer* self) {
721
static void contacts_revealer_start_animation (ContactsRevealer* self, gdouble target) {
725
gboolean _tmp3_ = FALSE;
122
726
g_return_if_fail (self != NULL);
123
_tmp0_ = self->priv->timeout;
124
if (_tmp0_ == ((guint) 0)) {
128
_tmp1_ = self->amount_visible;
129
_tmp2_ = self->target_amount;
130
if (_tmp1_ == _tmp2_) {
727
_tmp0_ = self->priv->target_pos;
729
if (_tmp0_ == _tmp1_) {
733
self->priv->target_pos = _tmp2_;
734
_tmp3_ = gtk_widget_get_mapped ((GtkWidget*) self);
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)) {
752
_tmp9_ = gdk_threads_add_timeout ((guint) CONTACTS_REVEALER_frame_time, _contacts_revealer_animate_cb_gsource_func, self);
753
self->priv->timeout = _tmp9_;
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_);
760
contacts_revealer_set_amount (self, _tmp11_);
139
static void contacts_revealer_real_show (GtkWidget* base) {
140
ContactsRevealer * self;
765
static void contacts_revealer_stop_animation (ContactsRevealer* self) {
142
self = (ContactsRevealer*) base;
143
GTK_WIDGET_CLASS (contacts_revealer_parent_class)->show ((GtkWidget*) GTK_VIEWPORT (self));
144
_tmp0_ = self->target_amount;
146
contacts_revealer_reveal (self);
151
static void contacts_revealer_real_hide (GtkWidget* base) {
152
ContactsRevealer * self;
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)) {
161
_tmp1_ = self->priv->timeout;
162
g_source_remove (_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)) {
774
_tmp2_ = self->priv->timeout;
775
g_source_remove (_tmp2_);
163
776
self->priv->timeout = (guint) 0;
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);
787
GtkAllocation allocation = {0};
788
GtkAllocation _tmp1_ = {0};
789
gboolean _tmp2_ = FALSE;
790
GtkAllocation _tmp3_;
794
gtk_widget_get_allocation ((GtkWidget*) self, &_tmp1_);
797
_tmp4_ = _tmp3_.width;
799
GtkAllocation _tmp5_;
802
_tmp6_ = _tmp5_.height;
810
_tmp8_ = self->priv->view_window;
811
gdk_window_show (_tmp8_);
813
_tmp9_ = self->priv->target_pos;
814
contacts_revealer_start_animation (self, _tmp9_);
816
GTK_WIDGET_CLASS (contacts_revealer_parent_class)->map ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin));
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);
828
static gboolean contacts_revealer_real_draw (GtkWidget* base, cairo_t* cr) {
829
ContactsRevealer * self;
830
gboolean result = FALSE;
833
gboolean _tmp2_ = FALSE;
834
self = (ContactsRevealer*) base;
835
g_return_val_if_fail (cr != NULL, FALSE);
837
_tmp1_ = self->priv->bin_window;
838
_tmp2_ = gtk_cairo_should_draw_window (_tmp0_, _tmp1_);
842
GTK_WIDGET_CLASS (contacts_revealer_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_BIN, GtkBin), _tmp3_);
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);
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);
183
static gboolean contacts_revealer_animate_cb (ContactsRevealer* self) {
184
gboolean result = FALSE;
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_) {
198
gdouble _tmp5_ = 0.0;
199
_tmp2_ = self->target_amount;
200
_tmp3_ = self->amount_visible;
202
_tmp5_ = MIN (_tmp2_, _tmp3_ + _tmp4_);
203
self->amount_visible = _tmp5_;
208
gdouble _tmp9_ = 0.0;
209
_tmp6_ = self->target_amount;
210
_tmp7_ = self->amount_visible;
212
_tmp9_ = MAX (_tmp6_, _tmp7_ - _tmp8_);
213
self->amount_visible = _tmp9_;
215
gtk_widget_queue_resize ((GtkWidget*) self);
216
_tmp10_ = self->amount_visible;
217
_tmp11_ = self->target_amount;
218
if (_tmp10_ == _tmp11_) {
220
self->priv->timeout = (guint) 0;
221
_tmp12_ = self->amount_visible;
222
if (_tmp12_ == ((gdouble) 0)) {
223
gtk_widget_hide ((GtkWidget*) self);
857
contacts_revealer_start_animation (self, 0.0);
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;
299
GtkAdjustment* _tmp3_;
300
GtkAllocation _tmp4_;
927
gint _vala_minimum_width = 0;
928
gint _vala_natural_width = 0;
931
GtkOrientation _tmp2_;
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_);
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) {
941
_tmp3_ = _vala_natural_width;
942
_tmp4_ = self->priv->current_pos;
943
_vala_natural_width = (gint) (_tmp3_ * _tmp4_);
945
_tmp5_ = _vala_natural_width;
946
_vala_minimum_width = _tmp5_;
948
*minimum_width = _vala_minimum_width;
951
*natural_width = _vala_natural_width;
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;
963
GtkOrientation _tmp3_;
965
self = (ContactsRevealer*) base;
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) {
974
_tmp4_ = _vala_natural_width;
975
_tmp5_ = self->priv->current_pos;
976
_vala_natural_width = (gint) (_tmp4_ * _tmp5_);
978
_tmp6_ = _vala_natural_width;
979
_vala_minimum_width = _tmp6_;
981
*minimum_width = _vala_minimum_width;
984
*natural_width = _vala_natural_width;
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;
999
void contacts_revealer_set_orientation (ContactsRevealer* self, GtkOrientation value) {
1000
GtkOrientation _tmp0_;
1001
g_return_if_fail (self != NULL);
1003
self->priv->_orientation = _tmp0_;
1004
g_object_notify ((GObject *) self, "orientation");
1008
gint contacts_revealer_get_duration (ContactsRevealer* self) {
1011
g_return_val_if_fail (self != NULL, 0);
1012
_tmp0_ = self->priv->_duration;
1018
void contacts_revealer_set_duration (ContactsRevealer* self, gint value) {
1020
g_return_if_fail (self != NULL);
1022
self->priv->_duration = _tmp0_;
1023
g_object_notify ((GObject *) self, "duration");
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));
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;
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);