1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
| /* main.c generated by valac, the Vala compiler
* generated from main.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#define TYPE_IBUTTON (ibutton_get_type ())
#define IBUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBUTTON, iButton))
#define IBUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IBUTTON, iButtonClass))
#define IS_IBUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBUTTON))
#define IS_IBUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IBUTTON))
#define IBUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IBUTTON, iButtonClass))
typedef struct _iButton iButton;
typedef struct _iButtonClass iButtonClass;
typedef struct _iButtonPrivate iButtonPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define TYPE_WINDOW (window_get_type ())
#define WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WINDOW, Window))
#define WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WINDOW, WindowClass))
#define IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WINDOW))
#define IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WINDOW))
#define WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WINDOW, WindowClass))
typedef struct _Window Window;
typedef struct _WindowClass WindowClass;
typedef struct _WindowPrivate WindowPrivate;
struct _iButton {
GtkButton parent_instance;
iButtonPrivate * priv;
};
struct _iButtonClass {
GtkButtonClass parent_class;
};
struct _iButtonPrivate {
GtkImage* image;
char* _normal;
char* _actif;
char* _clic;
};
struct _Window {
GtkWindow parent_instance;
WindowPrivate * priv;
};
struct _WindowClass {
GtkWindowClass parent_class;
};
static gpointer ibutton_parent_class = NULL;
static gpointer window_parent_class = NULL;
GType ibutton_get_type (void);
#define IBUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IBUTTON, iButtonPrivate))
enum {
IBUTTON_DUMMY_PROPERTY,
IBUTTON_NORMAL,
IBUTTON_ACTIF,
IBUTTON_CLIC
};
iButton* ibutton_new (const char* normal, const char* actif, const char* clic);
iButton* ibutton_construct (GType object_type, const char* normal, const char* actif, const char* clic);
const char* ibutton_get_normal (iButton* self);
static void ibutton_set_normal (iButton* self, const char* value);
const char* ibutton_get_actif (iButton* self);
static void ibutton_set_actif (iButton* self, const char* value);
const char* ibutton_get_clic (iButton* self);
static void ibutton_set_clic (iButton* self, const char* value);
static gboolean _lambda0_ (iButton* self);
static gboolean __lambda0__gtk_widget_enter_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self);
static gboolean _lambda1_ (iButton* self);
static gboolean __lambda1__gtk_widget_leave_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self);
static gboolean _lambda2_ (iButton* self);
static gboolean __lambda2__gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
static gboolean _lambda3_ (iButton* self);
static gboolean __lambda3__gtk_widget_button_release_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
static GObject * ibutton_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void ibutton_finalize (GObject* obj);
static void ibutton_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void ibutton_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GType window_get_type (void);
enum {
WINDOW_DUMMY_PROPERTY
};
Window* window_new (void);
Window* window_construct (GType object_type);
static void _gtk_main_quit_gtk_object_destroy (GtkObject* _sender, gpointer self);
static GObject * window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
void _vala_main (char** args, int args_length1);
iButton* ibutton_construct (GType object_type, const char* normal, const char* actif, const char* clic) {
iButton * self;
g_return_val_if_fail (normal != NULL, NULL);
g_return_val_if_fail (actif != NULL, NULL);
g_return_val_if_fail (clic != NULL, NULL);
self = (iButton*) g_object_new (object_type, "normal", normal, "actif", actif, "clic", clic, NULL);
return self;
}
iButton* ibutton_new (const char* normal, const char* actif, const char* clic) {
return ibutton_construct (TYPE_IBUTTON, normal, actif, clic);
}
const char* ibutton_get_normal (iButton* self) {
const char* result;
g_return_val_if_fail (self != NULL, NULL);
result = self->priv->_normal;
return result;
}
static void ibutton_set_normal (iButton* self, const char* value) {
char* _tmp0_;
g_return_if_fail (self != NULL);
self->priv->_normal = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_normal), _tmp0_);
g_object_notify ((GObject *) self, "normal");
}
const char* ibutton_get_actif (iButton* self) {
const char* result;
g_return_val_if_fail (self != NULL, NULL);
result = self->priv->_actif;
return result;
}
static void ibutton_set_actif (iButton* self, const char* value) {
char* _tmp0_;
g_return_if_fail (self != NULL);
self->priv->_actif = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_actif), _tmp0_);
g_object_notify ((GObject *) self, "actif");
}
const char* ibutton_get_clic (iButton* self) {
const char* result;
g_return_val_if_fail (self != NULL, NULL);
result = self->priv->_clic;
return result;
}
static void ibutton_set_clic (iButton* self, const char* value) {
char* _tmp0_;
g_return_if_fail (self != NULL);
self->priv->_clic = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_clic), _tmp0_);
g_object_notify ((GObject *) self, "clic");
}
static gboolean _lambda0_ (iButton* self) {
gboolean result = FALSE;
gtk_image_set_from_stock (self->priv->image, self->priv->_actif, GTK_ICON_SIZE_BUTTON);
}
static gboolean __lambda0__gtk_widget_enter_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self) {
return _lambda0_ (self);
}
static gboolean _lambda1_ (iButton* self) {
gboolean result = FALSE;
gtk_image_set_from_stock (self->priv->image, self->priv->_normal, GTK_ICON_SIZE_BUTTON);
}
static gboolean __lambda1__gtk_widget_leave_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self) {
return _lambda1_ (self);
}
static gboolean _lambda2_ (iButton* self) {
gboolean result = FALSE;
gtk_image_set_from_stock (self->priv->image, self->priv->_clic, GTK_ICON_SIZE_BUTTON);
}
static gboolean __lambda2__gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
return _lambda2_ (self);
}
static gboolean _lambda3_ (iButton* self) {
gboolean result = FALSE;
gtk_image_set_from_stock (self->priv->image, self->priv->_normal, GTK_ICON_SIZE_BUTTON);
}
static gboolean __lambda3__gtk_widget_button_release_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
return _lambda3_ (self);
}
static GObject * ibutton_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
GObject * obj;
GObjectClass * parent_class;
iButton * self;
parent_class = G_OBJECT_CLASS (ibutton_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = IBUTTON (obj);
{
GtkImage* _tmp0_;
gtk_button_set_relief ((GtkButton*) self, GTK_RELIEF_NONE);
self->priv->image = (_tmp0_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (self->priv->_normal, GTK_ICON_SIZE_BUTTON)), _g_object_unref0 (self->priv->image), _tmp0_);
gtk_container_add ((GtkContainer*) self, (GtkWidget*) self->priv->image);
g_signal_connect_object ((GtkWidget*) self, "enter-notify-event", (GCallback) __lambda0__gtk_widget_enter_notify_event, self, 0);
g_signal_connect_object ((GtkWidget*) self, "leave-notify-event", (GCallback) __lambda1__gtk_widget_leave_notify_event, self, 0);
g_signal_connect_object ((GtkWidget*) self, "button-press-event", (GCallback) __lambda2__gtk_widget_button_press_event, self, 0);
g_signal_connect_object ((GtkWidget*) self, "button-release-event", (GCallback) __lambda3__gtk_widget_button_release_event, self, 0);
}
return obj;
}
static void ibutton_class_init (iButtonClass * klass) {
ibutton_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (iButtonPrivate));
G_OBJECT_CLASS (klass)->get_property = ibutton_get_property;
G_OBJECT_CLASS (klass)->set_property = ibutton_set_property;
G_OBJECT_CLASS (klass)->constructor = ibutton_constructor;
G_OBJECT_CLASS (klass)->finalize = ibutton_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), IBUTTON_NORMAL, g_param_spec_string ("normal", "normal", "normal", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), IBUTTON_ACTIF, g_param_spec_string ("actif", "actif", "actif", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), IBUTTON_CLIC, g_param_spec_string ("clic", "clic", "clic", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
static void ibutton_instance_init (iButton * self) {
self->priv = IBUTTON_GET_PRIVATE (self);
}
static void ibutton_finalize (GObject* obj) {
iButton * self;
self = IBUTTON (obj);
_g_object_unref0 (self->priv->image);
_g_free0 (self->priv->_normal);
_g_free0 (self->priv->_actif);
_g_free0 (self->priv->_clic);
G_OBJECT_CLASS (ibutton_parent_class)->finalize (obj);
}
GType ibutton_get_type (void) {
static volatile gsize ibutton_type_id__volatile = 0;
if (g_once_init_enter (&ibutton_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (iButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ibutton_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (iButton), 0, (GInstanceInitFunc) ibutton_instance_init, NULL };
GType ibutton_type_id;
ibutton_type_id = g_type_register_static (GTK_TYPE_BUTTON, "iButton", &g_define_type_info, 0);
g_once_init_leave (&ibutton_type_id__volatile, ibutton_type_id);
}
return ibutton_type_id__volatile;
}
static void ibutton_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
iButton * self;
self = IBUTTON (object);
switch (property_id) {
case IBUTTON_NORMAL:
g_value_set_string (value, ibutton_get_normal (self));
break;
case IBUTTON_ACTIF:
g_value_set_string (value, ibutton_get_actif (self));
break;
case IBUTTON_CLIC:
g_value_set_string (value, ibutton_get_clic (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void ibutton_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
iButton * self;
self = IBUTTON (object);
switch (property_id) {
case IBUTTON_NORMAL:
ibutton_set_normal (self, g_value_get_string (value));
break;
case IBUTTON_ACTIF:
ibutton_set_actif (self, g_value_get_string (value));
break;
case IBUTTON_CLIC:
ibutton_set_clic (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
Window* window_construct (GType object_type) {
Window * self;
self = g_object_newv (object_type, 0, NULL);
return self;
}
Window* window_new (void) {
return window_construct (TYPE_WINDOW);
}
static void _gtk_main_quit_gtk_object_destroy (GtkObject* _sender, gpointer self) {
gtk_main_quit ();
}
static GObject * window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
GObject * obj;
GObjectClass * parent_class;
Window * self;
parent_class = G_OBJECT_CLASS (window_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = WINDOW (obj);
{
iButton* _tmp1_;
g_signal_connect ((GtkObject*) self, "destroy", (GCallback) _gtk_main_quit_gtk_object_destroy, NULL);
gtk_container_add ((GtkContainer*) self, (GtkWidget*) (_tmp1_ = g_object_ref_sink (ibutton_new (GTK_STOCK_FILE, GTK_STOCK_NEW, GTK_STOCK_QUIT))));
_g_object_unref0 (_tmp1_);
}
return obj;
}
static void window_class_init (WindowClass * klass) {
window_parent_class = g_type_class_peek_parent (klass);
G_OBJECT_CLASS (klass)->constructor = window_constructor;
}
static void window_instance_init (Window * self) {
}
GType window_get_type (void) {
static volatile gsize window_type_id__volatile = 0;
if (g_once_init_enter (&window_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (WindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Window), 0, (GInstanceInitFunc) window_instance_init, NULL };
GType window_type_id;
window_type_id = g_type_register_static (GTK_TYPE_WINDOW, "Window", &g_define_type_info, 0);
g_once_init_leave (&window_type_id__volatile, window_type_id);
}
return window_type_id__volatile;
}
void _vala_main (char** args, int args_length1) {
Window* _tmp0_;
gtk_init (&args_length1, &args);
gtk_widget_show_all ((GtkWidget*) (_tmp0_ = g_object_ref_sink (window_new ())));
_g_object_unref0 (_tmp0_);
gtk_main ();
}
int main (int argc, char ** argv) {
g_type_init ();
_vala_main (argv, argc);
return 0;
} |
Partager