gnome-edu r17 - trunk/garfunkel/src
- From: brunobol svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-edu r17 - trunk/garfunkel/src
- Date: Tue, 26 Aug 2008 01:21:33 +0000 (UTC)
Author: brunobol
Date: Tue Aug 26 01:21:33 2008
New Revision: 17
URL: http://svn.gnome.org/viewvc/gnome-edu?rev=17&view=rev
Log:
Garfunkel - Some improvements
Modified:
trunk/garfunkel/src/garfunkel.c
trunk/garfunkel/src/main.c
Modified: trunk/garfunkel/src/garfunkel.c
==============================================================================
--- trunk/garfunkel/src/garfunkel.c (original)
+++ trunk/garfunkel/src/garfunkel.c Tue Aug 26 01:21:33 2008
@@ -65,13 +65,19 @@
static gboolean garfunkel_key_press (GtkWidget *widget, GdkEventKey *event);
static gboolean garfunkel_button_press (GtkWidget *widget, GdkEventButton *event);
static void garfunkel_sequence_increment (Garfunkel *garfunkel);
+static void garfunkel_sequence_drop (Garfunkel *garfunkel);
static void garfunkel_sequence_blink (Garfunkel *garfunkel);
+
static void
garfunkel_init (Garfunkel* garfunkel)
{
- gtk_widget_add_events (GTK_WIDGET (garfunkel), GDK_KEY_PRESS_MASK);
- gtk_widget_add_events (GTK_WIDGET (garfunkel), GDK_BUTTON_PRESS_MASK);
+ gtk_widget_set_events (GTK_WIDGET (garfunkel),
+ gtk_widget_get_events (GTK_WIDGET (garfunkel))
+ | GDK_KEY_PRESS_MASK
+ | GDK_BUTTON_PRESS_MASK);
+
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET (garfunkel), GTK_CAN_FOCUS);
garfunkel->priv = g_new0 (GarfunkelPrivate, 1);
@@ -80,7 +86,10 @@
garfunkel->priv->user_sequence = NULL;
}
-static void garfunkel_finalize(GObject* object) {
+
+static void
+garfunkel_finalize(GObject* object)
+{
Garfunkel * garfunkel = (Garfunkel *) object;
g_object_unref (garfunkel->priv->svg_handle);
@@ -89,7 +98,9 @@
}
-static void garfunkel_class_init (GarfunkelClass *klass) {
+static void
+garfunkel_class_init (GarfunkelClass *klass)
+{
GObjectClass *obj_class;
GtkWidgetClass *widget_class;
@@ -106,7 +117,8 @@
GtkWidget *
-garfunkel_new( void ) {
+garfunkel_new( void )
+{
Garfunkel * garfunkel;
GarfunkelPrivate * gp= NULL;
@@ -119,12 +131,13 @@
filename = g_build_filename (DEFAULT_THEME_DIR, "garfunkel.svg");
gp->svg_handle = rsvg_handle_new_from_file (filename, NULL);
-
+
g_free (filename);
return (GTK_WIDGET (garfunkel));
}
+
static void
garfunkel_draw (GtkWidget *widget, cairo_t *cr)
{
@@ -176,6 +189,7 @@
rsvg_handle_render_cairo_sub (gp->svg_handle, cr, "#yellow");
}
+
static gboolean
garfunkel_expose (GtkWidget *widget, GdkEventExpose *event)
{
@@ -196,6 +210,7 @@
return FALSE;
}
+
static void
garfunkel_redraw (Garfunkel *garfunkel)
{
@@ -250,6 +265,10 @@
static gboolean
garfunkel_key_press (GtkWidget *widget, GdkEventKey *event)
{
+ g_print ("teste\n");
+
+ garfunkel_sequence_drop ((Garfunkel *) widget);
+
return FALSE;
}
@@ -280,7 +299,20 @@
color = g_random_int_range (0, 4);
- gp->sequence = g_slist_append (gp->sequence, GINT_TO_POINTER (1 << color));
+ gp->sequence = g_slist_append (gp->sequence, (gpointer) (1 << color));
+}
+
+
+static void
+garfunkel_sequence_drop (Garfunkel *garfunkel)
+{
+// GarfunkelPrivate * gp= NULL;
+
+// gp = garfunkel->priv;
+
+// g_list_free (gp->sequence);
+
+// gp->sequence = NULL;
}
@@ -297,7 +329,7 @@
while(tmplist){
- garfunkel_blink (garfunkel, GPOINTER_TO_INT (tmplist->data), GFK_BLINK_SPEED_NORMAL);
+ garfunkel_blink (garfunkel, (gint) (tmplist->data), GFK_BLINK_SPEED_NORMAL);
tmplist = g_slist_next(tmplist);
}
Modified: trunk/garfunkel/src/main.c
==============================================================================
--- trunk/garfunkel/src/main.c (original)
+++ trunk/garfunkel/src/main.c Tue Aug 26 01:21:33 2008
@@ -39,7 +39,7 @@
gtk_set_locale ();
gtk_init (&argc, &argv);
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
@@ -55,6 +55,8 @@
gtk_container_add (GTK_CONTAINER (window), garfunkel);
gtk_widget_show_all (window);
+
+ gtk_widget_grab_focus (garfunkel);
gdk_threads_enter();
gtk_main();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]