r2003 - in trunk/src/target/OM-2007/applications/openmoko-footer: . src
alphaone at sita.openmoko.org
alphaone at sita.openmoko.org
Fri May 18 02:02:09 CEST 2007
Author: alphaone
Date: 2007-05-18 02:02:09 +0200 (Fri, 18 May 2007)
New Revision: 2003
Added:
trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.c
trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.h
Modified:
trunk/src/target/OM-2007/applications/openmoko-footer/ChangeLog
trunk/src/target/OM-2007/applications/openmoko-footer/src/Makefile.am
trunk/src/target/OM-2007/applications/openmoko-footer/src/taskmanager.c
Log:
* src/Makefile.am, src/taskitem.c, src/taskitem.h, src/taskmanager.c:
Add support for taskitems (consisting of an image and a label)
Modified: trunk/src/target/OM-2007/applications/openmoko-footer/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-footer/ChangeLog 2007-05-17 18:47:06 UTC (rev 2002)
+++ trunk/src/target/OM-2007/applications/openmoko-footer/ChangeLog 2007-05-18 00:02:09 UTC (rev 2003)
@@ -1,3 +1,12 @@
+2007-05-18 Daniel Willmann <daniel at totalueberwachung.de>
+
+ * src/Makefile.am:
+ * src/taskitem.c: Added.
+ * src/taskitem.h: Added.
+ * src/taskmanager.c:
+ (taskmanager_init):
+ Add support for taskitems (consisting of an image and a label)
+
2007-05-17 Daniel Willmann <daniel at totalueberwachung.de>
* src/Makefile.am:
Modified: trunk/src/target/OM-2007/applications/openmoko-footer/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-footer/src/Makefile.am 2007-05-17 18:47:06 UTC (rev 2002)
+++ trunk/src/target/OM-2007/applications/openmoko-footer/src/Makefile.am 2007-05-18 00:02:09 UTC (rev 2003)
@@ -6,7 +6,7 @@
bin_PROGRAMS = openmoko-footer
-openmoko_footer_SOURCES = main.c footer.c callbacks.c taskmanager.c misc.c
+openmoko_footer_SOURCES = main.c footer.c callbacks.c taskmanager.c taskitem.c misc.c
openmoko_footer_LDADD = @OPENMOKO_LIBS@
Added: trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.c 2007-05-17 18:47:06 UTC (rev 2002)
+++ trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.c 2007-05-18 00:02:09 UTC (rev 2003)
@@ -0,0 +1,52 @@
+/*
+ * Footer - Task item
+ *
+ * Authored by Daniel Willmann <daniel at totalueberwachung.de>
+ *
+ * Copyright (C) 2007 OpenMoko, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "taskitem.h"
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+void moko_task_item_init( MokoTaskItem *ti, gchar *name, GdkPixbuf *icon )
+{
+ GdkPixbuf *scaled_icon;
+
+ ti->box = gtk_vbox_new( FALSE, 0 );
+ ti->name = gtk_label_new( name );
+
+ scaled_icon = gdk_pixbuf_scale_simple ( icon, 140, 140, GDK_INTERP_BILINEAR );
+ ti->icon = gtk_image_new_from_pixbuf( scaled_icon );
+ g_object_unref( G_OBJECT(scaled_icon) );
+
+ gtk_box_pack_start( GTK_BOX(ti->box), GTK_WIDGET(ti->icon), TRUE, TRUE, 0 );
+ gtk_box_pack_start( GTK_BOX(ti->box), GTK_WIDGET(ti->name), TRUE, TRUE, 0 );
+}
+
+void moko_task_item_set_name( MokoTaskItem *ti, gchar *name )
+{
+ gtk_label_set_text( ti->name, name );
+
+}
+
+void moko_task_item_set_icon( MokoTaskItem *ti, GdkPixbuf *icon )
+{
+ GdkPixbuf *scaled_icon;
+ scaled_icon = gdk_pixbuf_scale_simple ( icon, 140, 140, GDK_INTERP_BILINEAR );
+ gtk_image_set_from_pixbuf( ti->icon, scaled_icon );
+ g_object_unref( G_OBJECT(scaled_icon) );
+}
Added: trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.h 2007-05-17 18:47:06 UTC (rev 2002)
+++ trunk/src/target/OM-2007/applications/openmoko-footer/src/taskitem.h 2007-05-18 00:02:09 UTC (rev 2003)
@@ -0,0 +1,37 @@
+/*
+ * Footer - Task item
+ *
+ * Authored by Daniel Willmann <daniel at totalueberwachung.de>
+ *
+ * Copyright (C) 2007 OpenMoko, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _TASKITEM_H_
+#define _TASKITEM_H_
+
+#include <gtk/gtk.h>
+
+typedef struct _MokoTaskItem
+{
+ GtkWidget *name;
+ GtkWidget *icon;
+ GtkWidget *box;
+} MokoTaskItem;
+
+
+void moko_task_item_init( MokoTaskItem *ti, gchar *name, GdkPixbuf *icon );
+void moko_task_item_set_name( MokoTaskItem *ti, gchar *name );
+void moko_task_item_set_icon( MokoTaskItem *ti, GdkPixbuf *icon );
+
+#endif
Modified: trunk/src/target/OM-2007/applications/openmoko-footer/src/taskmanager.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-footer/src/taskmanager.c 2007-05-17 18:47:06 UTC (rev 2002)
+++ trunk/src/target/OM-2007/applications/openmoko-footer/src/taskmanager.c 2007-05-18 00:02:09 UTC (rev 2003)
@@ -17,6 +17,7 @@
* Current Version: $Rev$ ($Date$) [$Author$]
*/
+#include "taskitem.h"
#include "taskmanager.h"
#include "callbacks.h"
@@ -32,6 +33,9 @@
{
Display *dpy;
GtkWidget *image;
+ GdkPixbuf *pixbuf;
+ GtkScrolledWindow *scroll;
+ MokoTaskItem *test;
dpy = GDK_DISPLAY();
@@ -65,5 +69,16 @@
tm->table = gtk_table_new( 3, 3, TRUE );
- moko_finger_window_set_contents( tm->window, GTK_WIDGET(tm->table) );
+ test = g_new0( MokoTaskItem, 1 );
+
+ pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/icon_app_history.png", NULL);
+ moko_task_item_init( test, "Testentry", pixbuf );
+ gtk_table_attach_defaults( tm->table, GTK_WIDGET(test->box), 0, 1, 0, 1);
+
+ scroll = gtk_scrolled_window_new( NULL, NULL );
+ gtk_scrolled_window_set_policy( scroll, GTK_POLICY_NEVER, GTK_POLICY_NEVER );
+ gtk_widget_set_size_request (GTK_WINDOW(scroll), -1, 400);
+ gtk_scrolled_window_add_with_viewport(GTK_CONTAINER(scroll), GTK_WIDGET(tm->table) );
+
+ moko_finger_window_set_contents( tm->window, GTK_WIDGET(scroll) );
}
More information about the commitlog
mailing list