/* fadable-box.c generated by valac 0.16.1, the Vala compiler * generated from fadable-box.vala, do not modify */ /* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*- * * Copyright (C) 2011,2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Michael Terry */ #include #include #include #include #include #include #define TYPE_FADABLE (fadable_get_type ()) #define FADABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FADABLE, Fadable)) #define IS_FADABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FADABLE)) #define FADABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FADABLE, FadableIface)) typedef struct _Fadable Fadable; typedef struct _FadableIface FadableIface; #define TYPE_FADE_TRACKER (fade_tracker_get_type ()) #define FADE_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FADE_TRACKER, FadeTracker)) #define FADE_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FADE_TRACKER, FadeTrackerClass)) #define IS_FADE_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FADE_TRACKER)) #define IS_FADE_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FADE_TRACKER)) #define FADE_TRACKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FADE_TRACKER, FadeTrackerClass)) typedef struct _FadeTracker FadeTracker; typedef struct _FadeTrackerClass FadeTrackerClass; #define TYPE_FADABLE_BOX (fadable_box_get_type ()) #define FADABLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FADABLE_BOX, FadableBox)) #define FADABLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FADABLE_BOX, FadableBoxClass)) #define IS_FADABLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FADABLE_BOX)) #define IS_FADABLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FADABLE_BOX)) #define FADABLE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FADABLE_BOX, FadableBoxClass)) typedef struct _FadableBox FadableBox; typedef struct _FadableBoxClass FadableBoxClass; typedef struct _FadableBoxPrivate FadableBoxPrivate; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) struct _FadableIface { GTypeInterface parent_iface; FadeTracker* (*get_fade_tracker) (Fadable* self); void (*set_fade_tracker) (Fadable* self, FadeTracker* value); }; struct _FadableBox { GtkBox parent_instance; FadableBoxPrivate * priv; }; struct _FadableBoxClass { GtkBoxClass parent_class; }; struct _FadableBoxPrivate { FadeTracker* _fade_tracker; }; static gpointer fadable_box_parent_class = NULL; static FadableIface* fadable_box_fadable_parent_iface = NULL; GType fade_tracker_get_type (void) G_GNUC_CONST; GType fadable_get_type (void) G_GNUC_CONST; GType fadable_box_get_type (void) G_GNUC_CONST; #define FADABLE_BOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_FADABLE_BOX, FadableBoxPrivate)) enum { FADABLE_BOX_DUMMY_PROPERTY, FADABLE_BOX_FADE_TRACKER }; static gboolean fadable_box_real_draw (GtkWidget* base, cairo_t* c); FadeTracker* fadable_get_fade_tracker (Fadable* self); gdouble fade_tracker_get_alpha (FadeTracker* self); FadableBox* fadable_box_new (void); FadableBox* fadable_box_construct (GType object_type); static GObject * fadable_box_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); FadeTracker* fade_tracker_new (GtkWidget* widget); FadeTracker* fade_tracker_construct (GType object_type, GtkWidget* widget); void fadable_set_fade_tracker (Fadable* self, FadeTracker* value); static void _fadable_box___lambda4_ (FadableBox* self); static void __fadable_box___lambda4__fade_tracker_done (FadeTracker* _sender, gpointer self); static void fadable_box_finalize (GObject* obj); static void _vala_fadable_box_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void _vala_fadable_box_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); static gboolean fadable_box_real_draw (GtkWidget* base, cairo_t* c) { FadableBox * self; gboolean result = FALSE; cairo_t* _tmp0_; cairo_t* _tmp1_; cairo_t* _tmp2_; cairo_t* _tmp3_; FadeTracker* _tmp4_; FadeTracker* _tmp5_; gdouble _tmp6_; gdouble _tmp7_; self = (FadableBox*) base; g_return_val_if_fail (c != NULL, FALSE); _tmp0_ = c; cairo_push_group (_tmp0_); _tmp1_ = c; GTK_WIDGET_CLASS (fadable_box_parent_class)->draw ((GtkWidget*) GTK_BOX (self), _tmp1_); _tmp2_ = c; cairo_pop_group_to_source (_tmp2_); _tmp3_ = c; _tmp4_ = fadable_get_fade_tracker ((Fadable*) self); _tmp5_ = _tmp4_; _tmp6_ = fade_tracker_get_alpha (_tmp5_); _tmp7_ = _tmp6_; cairo_paint_with_alpha (_tmp3_, _tmp7_); result = FALSE; return result; } FadableBox* fadable_box_construct (GType object_type) { FadableBox * self = NULL; self = (FadableBox*) g_object_new (object_type, NULL); return self; } FadableBox* fadable_box_new (void) { return fadable_box_construct (TYPE_FADABLE_BOX); } static FadeTracker* fadable_box_real_get_fade_tracker (Fadable* base) { FadeTracker* result; FadableBox* self; FadeTracker* _tmp0_; self = (FadableBox*) base; _tmp0_ = self->priv->_fade_tracker; result = _tmp0_; return result; } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } static void fadable_box_real_set_fade_tracker (Fadable* base, FadeTracker* value) { FadableBox* self; FadeTracker* _tmp0_; FadeTracker* _tmp1_; self = (FadableBox*) base; _tmp0_ = value; _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_fade_tracker); self->priv->_fade_tracker = _tmp1_; g_object_notify ((GObject *) self, "fade-tracker"); } static void _fadable_box___lambda4_ (FadableBox* self) { g_signal_emit_by_name (self, "fade-done"); } static void __fadable_box___lambda4__fade_tracker_done (FadeTracker* _sender, gpointer self) { _fadable_box___lambda4_ (self); } static GObject * fadable_box_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; FadableBox * self; FadeTracker* _tmp0_; FadeTracker* _tmp1_; FadeTracker* _tmp2_; FadeTracker* _tmp3_; parent_class = G_OBJECT_CLASS (fadable_box_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = FADABLE_BOX (obj); _tmp0_ = fade_tracker_new ((GtkWidget*) self); _tmp1_ = _tmp0_; fadable_set_fade_tracker ((Fadable*) self, _tmp1_); _g_object_unref0 (_tmp1_); _tmp2_ = fadable_get_fade_tracker ((Fadable*) self); _tmp3_ = _tmp2_; g_signal_connect_object (_tmp3_, "done", (GCallback) __fadable_box___lambda4__fade_tracker_done, self, 0); return obj; } static void fadable_box_class_init (FadableBoxClass * klass) { fadable_box_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (FadableBoxPrivate)); GTK_WIDGET_CLASS (klass)->draw = fadable_box_real_draw; G_OBJECT_CLASS (klass)->get_property = _vala_fadable_box_get_property; G_OBJECT_CLASS (klass)->set_property = _vala_fadable_box_set_property; G_OBJECT_CLASS (klass)->constructor = fadable_box_constructor; G_OBJECT_CLASS (klass)->finalize = fadable_box_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), FADABLE_BOX_FADE_TRACKER, g_param_spec_object ("fade-tracker", "fade-tracker", "fade-tracker", TYPE_FADE_TRACKER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_signal_new ("fade_done", TYPE_FADABLE_BOX, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } static void fadable_box_fadable_interface_init (FadableIface * iface) { fadable_box_fadable_parent_iface = g_type_interface_peek_parent (iface); iface->get_fade_tracker = fadable_box_real_get_fade_tracker; iface->set_fade_tracker = fadable_box_real_set_fade_tracker; } static void fadable_box_instance_init (FadableBox * self) { self->priv = FADABLE_BOX_GET_PRIVATE (self); } static void fadable_box_finalize (GObject* obj) { FadableBox * self; self = FADABLE_BOX (obj); _g_object_unref0 (self->priv->_fade_tracker); G_OBJECT_CLASS (fadable_box_parent_class)->finalize (obj); } GType fadable_box_get_type (void) { static volatile gsize fadable_box_type_id__volatile = 0; if (g_once_init_enter (&fadable_box_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (FadableBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fadable_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FadableBox), 0, (GInstanceInitFunc) fadable_box_instance_init, NULL }; static const GInterfaceInfo fadable_info = { (GInterfaceInitFunc) fadable_box_fadable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; GType fadable_box_type_id; fadable_box_type_id = g_type_register_static (GTK_TYPE_BOX, "FadableBox", &g_define_type_info, 0); g_type_add_interface_static (fadable_box_type_id, TYPE_FADABLE, &fadable_info); g_once_init_leave (&fadable_box_type_id__volatile, fadable_box_type_id); } return fadable_box_type_id__volatile; } static void _vala_fadable_box_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { FadableBox * self; self = FADABLE_BOX (object); switch (property_id) { case FADABLE_BOX_FADE_TRACKER: g_value_set_object (value, fadable_get_fade_tracker ((Fadable*) self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void _vala_fadable_box_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { FadableBox * self; self = FADABLE_BOX (object); switch (property_id) { case FADABLE_BOX_FADE_TRACKER: fadable_set_fade_tracker ((Fadable*) self, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }