4 * This file is part of maevies
5 * Copyright (C) 2009 spenap <spenap@gmail.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
19 #include "maevies_window.h"
21 static void hello_item_clicked(GtkButton *button, gpointer data);
23 G_DEFINE_TYPE(MaeviesWindow, maevies_window, HILDON_TYPE_WINDOW)
25 static void maevies_window_dispose(GObject *object) {
27 MaeviesWindow *self = MAEVIES_WINDOW(object);
30 * Note that the child widgets are destroyed automatically.
33 G_OBJECT_CLASS (maevies_window_parent_class)->dispose(object);
36 static void maevies_window_finalize(GObject *object) {
37 G_OBJECT_CLASS (maevies_window_parent_class)->finalize(object);
40 static void maevies_window_class_init(MaeviesWindowClass *klass) {
41 GObjectClass *object_class = G_OBJECT_CLASS (klass);
43 object_class->dispose = maevies_window_dispose;
44 object_class->finalize = maevies_window_finalize;
47 static void maevies_window_init(MaeviesWindow *self) {
49 /* Create button and add it to main view */
50 self->hello_item = gtk_button_new_with_label("Hello World!!!");
51 gtk_container_add(GTK_CONTAINER(self), self->hello_item);
53 g_signal_connect(G_OBJECT(self->hello_item), "clicked", G_CALLBACK(hello_item_clicked),
57 self->movie = maevies_movie_new("Zombieland");
60 MaeviesWindow* maevies_window_new(osso_context_t *osso) {
61 MaeviesWindow *self = MAEVIES_WINDOW(g_object_new(MAEVIES_TYPE_WINDOW,
64 /* Avoid adding extra code such as this to a _new() function when writing
65 * widgets that should be reusable. This should really be a GObject property.
72 static void hello_item_clicked(GtkButton* button, gpointer data) {
74 MaeviesWindow *self = MAEVIES_WINDOW(data);
75 gchar *has_stingers = NULL;
79 movie_get_info(self->movie, NULL);
82 if (self->movie->has_stingers)
83 has_stingers = "Con escenas";
85 has_stingers = "Sin escenas";
87 gtk_button_set_label(button, has_stingers);