r323 - in trunk/src/target/OM-2007/applications/openmoko-taskmanager: . openmoko-footer openmoko-footer/src

tongsong_li at gta01.hmw-consulting.de tongsong_li at gta01.hmw-consulting.de
Thu Dec 7 03:19:03 CET 2006


Author: tongsong_li
Date: 2006-12-07 02:18:33 +0000 (Thu, 07 Dec 2006)
New Revision: 323

Added:
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/AUTHORS
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/NEWS
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/README
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/autogen.sh
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/configure.ac
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/openmoko-footer.pro
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.h
Log:


Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/AUTHORS
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/AUTHORS	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/AUTHORS	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,2 @@
+Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+Sun Zhiyong <sunzhiyong at fic-sh.com.cn>


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/AUTHORS
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/ChangeLog
===================================================================


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/ChangeLog
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/Makefile.am	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/Makefile.am	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,2 @@
+SUBDIRS = src
+


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/Makefile.am
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/NEWS
===================================================================


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/NEWS
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/README
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/README	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/README	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,3 @@
+Notes:
+1. before you run the application load OpenMoko-theme (gtk RC files) to your memory.
+2. make sure you have install the openmoko-taskmanager application, and patch the matchbox-window-manager(more see openmoko-taskmanager).


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/README
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/autogen.sh
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/autogen.sh	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/autogen.sh	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,4 @@
+#! /bin/sh
+autoreconf -v --install || exit 1
+glib-gettextize --force --copy || exit 1
+./configure --enable-maintainer-mode "$@"


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/autogen.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/configure.ac
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/configure.ac	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/configure.ac	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,27 @@
+AC_PREREQ(2.53)
+AC_INIT(%(APPNAME), %(APPVERSION), %(APPCONTACT))
+AM_INIT_AUTOMAKE()
+AC_CONFIG_SRCDIR(src/main.c)
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_PROG_CC
+AC_STDC_HEADERS
+AC_PROG_LIBTOOL
+
+# base deps
+PKG_CHECK_MODULES(OPENMOKO, openmoko-libs >= 0.0.1,,
+                 AC_MSG_ERROR([*** Required OpenMoko Libraries >= 0.0.1 not installed ***]))
+PKG_CHECK_MODULES(DBUSGLIB, dbus-glib-1,,
+			exit)
+PKG_CHECK_MODULES(DBUS, dbus-1,,
+			exit)			
+LIBS="$LIBS $GTK_LIBS $DBUSGLIB_LIBS $DBUS" 
+CFLAGS="$CFLAGS $OPENMOKO_CFLAGS $DBUSGLIB_CFLAGS $DBUS_DFALGS"
+
+# output stuff
+AC_OUTPUT([
+Makefile
+src/Makefile
+])


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/configure.ac
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/openmoko-footer.pro
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/openmoko-footer.pro	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/openmoko-footer.pro	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,10 @@
+HEADERS = footer.h callbacks.h misc.h main.h
+SOURCES = footer.c callbacks.c misc.c main.c
+
+PKGCONFIG += gtk+-2.0 dbus-glib-1
+
+SERVICES = services.xml
+
+DEFINES += DBUS_API_SUBJECT_TO_CHANGE
+
+include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/openmoko-footer.pro
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/Makefile.am	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/Makefile.am	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,8 @@
+INCLUDES = -DPKGDATADIR=\"$(pkgdatadir)\" @OPENMOKO_CFLAGS@ -Wall -std=c99 -pedantic
+
+bin_PROGRAMS = openmoko-footer
+
+openmoko_footer_SOURCES = main.c footer.c callbacks.c misc.c
+
+openmoko_footer_LDADD = @OPENMOKO_LIBS@
+


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/Makefile.am
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.c	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.c	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,152 @@
+/**
+ * @file callbacks.c
+ * @brief callbacks of openmoko-taskmanager based on callbacks.c.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * 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.
+ */
+ #include <glib.h>
+
+#include "callbacks.h"
+#include "footer.h"
+
+/* footer */
+/**
+*@brief footer leftbutton clicked callback function
+*@param widget	GtkWidget reference
+*@param my_data	user data
+*@return none
+*/
+void 
+footer_leftbutton_clicked(GtkWidget *widget, gpointer my_data) {	
+    switch (fork()) {
+    	  case 0:
+    	      setpgid(0, 0); /* Stop us killing child */
+    	      execvp("openmoko-taskmanager", NULL);
+    	      exit(1);
+    	  case -1:
+    	  	g_debug ("Failed to fork()");
+    	  	break;
+    	  }
+    }
+
+
+
+/**
+*@brief footer rightbutton clicked callback function
+*@param widget	GtkWidget reference
+*@param my_data	user data
+*@return none
+*/
+void 
+footer_rightbutton_clicked(GtkWidget *widget, gpointer my_data) {
+    XEvent ev;
+    int done = 0;
+    Bool finish = FALSE;
+    struct timeval then, now;
+    Time click_time=800;
+    Display *dpy;
+
+    dpy = GDK_DISPLAY ();
+
+    gettimeofday(&then, NULL);
+    
+ //check the buttoen event type: tap "done = 1 "; tap with hold "done = 2";
+ //Fixme : when double clicked, there is three outputs, two "tab" and one" tab hold". 
+  while (!done ) {
+    if (XCheckMaskEvent(dpy,ButtonReleaseMask, &ev))
+      if (ev.type == ButtonRelease) {
+      	 done=1;
+      }
+    gettimeofday(&now, NULL);
+    if ( (now.tv_usec-then.tv_usec) > (click_time*1000) ) {
+    	done=2;
+    }
+  }
+  /*check buttoen event type: tap "done = 1 "; tap with hold "done = 0"; activate done >1 ??.
+  do{
+  	gettimeofday(&now, NULL);
+  	if (XCheckMaskEvent(dpy,ButtonReleaseMask, &ev))
+  	  if (ev.type == ButtonRelease){
+      	    done ++;
+  	  }
+  }while ((now.tv_usec-then.tv_usec) < (click_time*1000) 
+  		&& (now.tv_sec == then.tv_sec));
+  */
+  
+  //function for "tap" action, execute "openmoko-clocks application".
+  if (done == 1){  
+  	g_debug ("tab");
+    mbcommand(dpy, MB_CMD_NEXT, NULL);
+    return;
+  }
+  //function for "tap with hold" action, pop a popupmenu to change time format.
+  else if (done == 2){
+  	g_debug ("tab hold");
+     mbcommand(dpy, MB_CMD_PREV, NULL);
+  }
+  /* Fixme : click event
+  else if (done >1){
+  	g_debug ("clicked");
+  	mbcommand(dpy, MB_CMD_DESKTOP, NULL);
+  }
+  */
+}
+
+
+/* dbus */
+/**
+*@brief dbus filter function, which use to receive and filter dbus message.
+*@param connection	DBusConnection
+*@param message		DBusMessage
+*@param user_data	
+*@return none
+*/
+DBusHandlerResult signal_filter(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+    g_debug( "signal_filter called" );
+    g_debug( "type of message was %d", dbus_message_get_type(message));
+    g_debug( "path of message was %s", dbus_message_get_path(message));
+    g_debug( "interface of message was %s", dbus_message_get_interface(message));
+
+    /* Application object is the user data */
+    OMTaskManager* app = user_data;
+
+    /* A signal from the bus saying we are about to be disconnected */
+    if (dbus_message_is_signal
+        (message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
+        /* Tell the main loop to quit */
+        g_main_loop_quit(app->loop);
+        /* We have handled this message, don't pass it on */
+        return DBUS_HANDLER_RESULT_HANDLED;
+        }
+        /* A message on our interface */
+        else if (dbus_message_is_signal(message, "org.openmoko.dbus.TaskManager", "push_statusbar_message")) {
+            DBusError error;
+            char *s;
+            dbus_error_init (&error);
+            if (dbus_message_get_args
+                (message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+                g_debug("Setting status bar text to '%s", s);
+                footer_set_status( app->footer, s );
+                //FIXME: SIGSEGV, when uncommented. It now leaks! :M:
+                //dbus_free(s);
+                } else {
+                    g_print("Ping received, but error getting message: %s", error.message);
+                    dbus_error_free (&error);
+                }
+                return DBUS_HANDLER_RESULT_HANDLED;
+        }
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.c
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.h	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.h	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,46 @@
+/**
+ * @file callbacks.h
+ * @brief callbacks of openmoko-taskmanager based on callbacks.h.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * 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.
+ */
+#include <gtk/gtk.h>
+#include <X11/Xlib.h>
+#include <dbus/dbus.h>
+#include <gdk/gdk.h>
+#include <glib/gthread.h>
+#include <pthread.h>
+#include <sys/time.h>
+
+#include "main.h"
+#include "misc.h"
+
+//#define G_THREADS_ENABLED
+
+#define TASK_MANAGER_PROPERTY_WIDTH		200
+#define TASK_MANAGER_PROPERTY_HEIGHT	564 
+#define TASK_MANAGER_PROPERTY_X		0
+#define TASK_MANAGER_PROPERTY_Y 		45 
+
+/* footer */
+void 
+footer_leftbutton_clicked(GtkWidget *widget, gpointer my_data);
+
+void 
+footer_rightbutton_clicked(GtkWidget *widget, gpointer my_data);
+
+/* dbus */
+DBusHandlerResult 
+signal_filter (DBusConnection *connection, DBusMessage *message, void *user_data);


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/callbacks.h
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.c	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.c	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,197 @@
+/**
+ * @file Footer.c
+ * @brief openmoko-taskmanager UI based on this file.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * 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.
+ */
+#include "footer.h"
+
+enum {
+    FOOTER_SIGNAL,
+    LAST_SIGNAL
+};
+
+static void footer_class_init          (FooterClass *klass);
+static void footer_init                (Footer      *f);
+
+static guint footer_signals[LAST_SIGNAL] = { 0 };
+
+/**
+*@brief retrun fooer type.
+*@param none
+*@return GType
+*/
+GType footer_get_type (void) /* Typechecking */
+{
+    static GType f_type = 0;
+
+    if (!f_type)
+    {
+        static const GTypeInfo f_info =
+        {
+            sizeof (FooterClass),
+            NULL, /* base_init */
+            NULL, /* base_finalize */
+            (GClassInitFunc) footer_class_init,
+            NULL, /* class_finalize */
+            NULL, /* class_data */
+            sizeof (Footer),
+            0,
+            (GInstanceInitFunc) footer_init,
+            NULL
+        };
+
+        f_type = g_type_register_static(GTK_TYPE_HBOX, "Footer", &f_info, 0);
+    }
+
+    return f_type;
+}
+
+/**
+*@brief initialize footer class.
+*@param klass	FooterClass
+*@return none
+*/
+static void footer_class_init (FooterClass *Klass) /* Class Initialization */
+{
+    footer_signals[FOOTER_SIGNAL] = g_signal_new ("footer",
+            G_TYPE_FROM_CLASS (Klass),
+            G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+            G_STRUCT_OFFSET (FooterClass, footer),
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 0);
+}
+
+/**
+*@brief initialize footer UI.
+*@param f	Footer instance
+*@return none
+*/
+static void footer_init (Footer *f) /* Instance Construction */
+{
+  PangoFontDescription* PangoFontDesc;
+  //PangoLayout* PangoLayoud;
+  
+/*left image*/
+    f->LeftEventBox = gtk_event_box_new (); 
+    gtk_widget_show (GTK_WIDGET (f->LeftEventBox));
+    gtk_event_box_set_visible_window (GTK_EVENT_BOX(f->LeftEventBox),FALSE);
+    gtk_box_pack_start (GTK_BOX (f), GTK_WIDGET(f->LeftEventBox), FALSE, FALSE, BUTTON_PADDING);
+    gtk_widget_set_events (GTK_EVENT_BOX (f->LeftEventBox), GDK_BUTTON_PRESS_MASK);
+       
+
+    f->LeftImage = gtk_image_new_from_stock ("icon_app_history", GTK_ICON_SIZE_BUTTON);
+    gtk_widget_show (GTK_WIDGET (f->LeftImage));
+    gtk_container_add (f->LeftEventBox, f->LeftImage);
+
+/*Label to show dbus message */
+    f->CenterLabel = gtk_label_new("OpenMoko Taskmanager");
+    gtk_widget_show (GTK_WIDGET (f->CenterLabel));
+    gtk_widget_set_name (GTK_WIDGET (f->CenterLabel), "label_footer");
+    gtk_misc_set_alignment (GTK_MISC (f->CenterLabel), LABEL_ALIGNMENT_X, LABEL_ALIGNMENT_Y);
+    gtk_label_set_single_line_mode (f->CenterLabel, TRUE);
+    if (PangoFontDesc = pango_font_description_from_string (FONT_STRING)){
+	pango_font_description_set_size (PangoFontDesc, FONT_SIZE);
+	gtk_widget_modify_font (GTK_WIDGET (f->CenterLabel), PangoFontDesc);
+    }
+    gtk_label_set_ellipsize (f->CenterLabel, PANGO_ELLIPSIZE_END);
+    gtk_box_pack_start (GTK_BOX (f), GTK_WIDGET (f->CenterLabel), TRUE, TRUE, LABEL_PADDING);
+    gtk_label_set_text (f->CenterLabel, "OpenMoko Task Manager");
+
+/*right image*/
+    f->RightEventBox = gtk_event_box_new (); 
+    gtk_widget_show (f->RightEventBox);
+    gtk_event_box_set_visible_window (GTK_EVENT_BOX(f->RightEventBox),FALSE);
+    gtk_box_pack_end (GTK_BOX (f), GTK_WIDGET(f->RightEventBox), FALSE, FALSE, BUTTON_PADDING);
+    gtk_widget_set_events (f->RightEventBox,GDK_BUTTON_PRESS_MASK);
+       
+
+    f->RightImage = gtk_image_new_from_stock ("icon_app_toggle", GTK_ICON_SIZE_BUTTON);
+    gtk_widget_show (GTK_WIDGET (f->RightImage));
+    gtk_container_add (GTK_CONTAINER (f->RightEventBox), f->RightImage);
+
+ 
+/*progressbar*/ 
+/*
+    f->progressbar = gtk_progress_bar_new();
+    gtk_widget_show (f->progressbar);
+    gtk_progress_bar_set_bar_style (f->progressbar, GTK_PROGRESS_CONTINUOUS);
+    gtk_box_pack_start( f, GTK_WIDGET(f->progressbar), TRUE, TRUE, 0 );
+    gtk_progress_bar_set_fraction (f->progressbar, 0.5);
+    gtk_progress_bar_set_text (f->progressbar, "OpenMoko TaskManager");
+    */
+
+}
+
+/**
+*@brief create Footer widget object.
+*@param none
+*@return footer widget of GtkWidget type.
+*/
+GtkWidget* footer_new() /* Construction */
+{
+    return GTK_WIDGET(g_object_new(footer_get_type(), NULL));
+}
+
+/**
+*@brief clear footer widget
+*/
+void footer_clear(Footer *f) /* Destruction */
+{
+     if (!f) g_free (f);
+}
+
+/**
+*@brief set footer progressbar status.
+*@param f	Footer reference
+*@param s	string which is consist of status message and progressbar percent,
+*			the string of message and percent is connected by symbol "@".
+*@return none
+*/
+void footer_set_status(Footer *f, const char* s)
+{
+//    gtk_statusbar_push( f->statusbar, 1, s );
+    gtk_label_set_text (f->CenterLabel, s);
+    /*char message[128];
+    char str_fraction[3];
+    char* p_fraction;
+    int StrLength;
+    gdouble fraction;
+    int i;
+    
+    strcpy(message,s);
+    if(p_fraction = strrchr(s, '@'))
+	StrLength = strlen(s)-strlen(p_fraction);
+    else StrLength = strlen(s);
+
+    memcpy(message,s,StrLength);
+    message[StrLength] = '\0';
+    for (i=0; i<4; i++)
+         str_fraction[i] = s[StrLength+1+i];
+    str_fraction[3] = '\0';
+    
+    fraction = atoi(str_fraction)/(double)100;
+                                       
+    g_print ("messsage is : %s\nthe char pointer is : %s\nlength of s and p_fraction: %d\nfraction is %lf:",message,p_fraction,StrLength,fraction );
+
+    gtk_progress_bar_set_text (f->progressbar, message);
+
+    if(fraction<=1 && fraction>=0)
+         gtk_progress_bar_set_fraction (f->progressbar, fraction);
+         */
+         
+}                   


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.c
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.h	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.h	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,102 @@
+/**
+ * @file Footer.h
+ * @brief openmoko-taskmanager UI based on this file.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * 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.
+ */
+#ifndef OPENMOKO_FOOTER_H
+#define OPENMOKO_FOOTER_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkprogressbar.h>
+#include <gtk/gtkbutton.h>
+
+G_BEGIN_DECLS
+
+/*Footer property and position*/
+#define FOOTER_PROPERTY_WIDTH 480
+#define FOOTER_PROPERTY_HEIGHT 32
+#define FOOTER_PROPERTY_X 0
+#define FOOTER_PROPERTY_Y (640-FOOTER_PROPERTY_HEIGHT)
+#define FOOTER_BUTTON_ICON_WIDTH 32 
+#define FOOTER_BUTTON_ICON_HEIGHT 32
+#define BUTTON_PADDING 15
+#define LABEL_PADDING 25
+#define LABEL_ALIGNMENT_X 0
+#define LABEL_ALIGNMENT_Y 0.7
+
+/*Pango Font spec*/
+//#define FONT_STRING ("-*-*bold-r-normal-*-120-*-*-*-*-iso8859-1")
+#define FONT_STRING ""
+#define FONT_SIZE 12*PANGO_SCALE
+#define FONT_MAX_LENGTH 3
+
+#define FOOTER_TYPE            (footer_get_type())
+#define FOOTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOOTER_TYPE, Footer))
+#define FOOTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FOOTER_TYPE, FooterClass))
+#define IS_FOOTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOOTER_TYPE))
+#define IS_FOOTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOOTER_TYPE))
+
+typedef struct _Footer       Footer;
+typedef struct _FooterClass  FooterClass;
+
+/**
+ * @typedef OMFooterApp
+ *
+ * Opaque structure used for representing an Openmoko footer app UI.
+ */ 
+/*struct _Footer
+{
+    GtkHBox hbox;
+    GtkButton* leftbutton;
+    GtkWidget* leftbtnalign;
+    GtkHBox* leftbtnhbox;
+    GtkImage* leftbtnimage;
+    GtkProgressBar* progressbar;
+    GtkButton* rightbutton;
+    GtkWidget* rightbtnalign;
+    GtkHBox* rightbtnhbox;
+    GtkImage* rightbtnimage;
+};*/
+struct _Footer
+{
+    GtkHBox hbox;
+    
+    GtkEventBox* LeftEventBox;
+    GtkImage* LeftImage;
+    GtkLabel* CenterLabel;
+    GtkEventBox* RightEventBox;
+    GtkImage* RightImage; 
+};
+
+struct _FooterClass
+{
+    GtkHBoxClass parent_class;
+    
+    void (*footer) (Footer *f);
+};
+
+GType          footer_get_type        (void);
+//GtkWidget*     footer_new             (void);
+void           footer_clear           (Footer *f);
+
+void           footer_set_status      (Footer *f, const char* s);
+
+G_END_DECLS
+
+#endif /* OPENMOKO_FOOTER_H */


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/footer.h
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.c	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.c	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,77 @@
+/**
+ * @file main.c
+ * @brief openmoko-taskmanager based on main.c.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * 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.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "main.h"
+
+int main( int argc, char **argv )
+{
+    OMTaskManager* app;
+    DBusError error;
+    dbus_error_init(&error);
+
+    if (!(app = g_malloc ( sizeof (OMTaskManager)))){
+    		fprintf (stderr,"Openmoko-taskmanager: footer UI initialized failed, app space malloc failed!");
+    		exit (-1);
+    	}
+
+    app->bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
+    if (!app->bus) {
+        g_warning ("Failed to connect to the D-BUS daemon: %s", error.message);
+        dbus_error_free(&error);
+        return 1;
+    }
+	app->loop = g_main_loop_new( NULL, FALSE );
+    
+    gtk_init (&argc, &argv);
+
+///initialize TOP LEVEL WINDOW 
+    app->toplevel_win = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+    gtk_widget_set_name (app->toplevel_win, "bg_footer");
+    gtk_window_set_title (app->toplevel_win, "OpenMoko Task Manager");
+    gtk_window_set_type_hint (GTK_WINDOW(app->toplevel_win), GDK_WINDOW_TYPE_HINT_DOCK);
+    gtk_window_set_default_size (app->toplevel_win, FOOTER_PROPERTY_WIDTH, FOOTER_PROPERTY_HEIGHT);
+    gtk_widget_set_uposition (app->toplevel_win, FOOTER_PROPERTY_X, FOOTER_PROPERTY_Y);
+    
+///initialize OpenMoko Footer Widget
+    app->footer = FOOTER(footer_new()); 
+    gtk_widget_show_all (app->footer);
+    g_signal_connect ( G_OBJECT (app->footer->LeftEventBox), "button_press_event",
+    					G_CALLBACK (footer_leftbutton_clicked), app);
+    g_signal_connect ( G_OBJECT (app->footer->RightEventBox), "button_press_event",
+    					G_CALLBACK (footer_rightbutton_clicked), app);
+
+///Add OpenMoko Footer to Top Level windonw
+    gtk_container_add( GTK_CONTAINER(app->toplevel_win), GTK_WIDGET(app->footer) );
+    // this violates the privacy concept, but it's a demo for now...
+  
+    dbus_connection_setup_with_g_main (app->bus, NULL);
+    dbus_bus_add_match (app->bus, "type='signal',interface='org.openmoko.dbus.TaskManager'", &error );
+    dbus_connection_add_filter (app->bus, signal_filter, app, NULL );
+
+    gtk_widget_show_all (app->toplevel_win);
+   
+    g_main_loop_run ( app->loop );
+            
+    g_free( app );
+    
+    return 0;
+}


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.c
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.h	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.h	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,45 @@
+/**
+ * @file main.h
+ * @brief openmoko-taskmanager head files based on main.h.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * 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.
+ */
+
+#ifndef OM_TASK_MANAGER_H
+#define OM_TASK_MANAGER_H
+
+#include "footer.h"
+#include "callbacks.h"
+
+#include <glib/gmain.h>
+#include <gdk/gdk.h>
+#include <dbus/dbus.h>
+#include <gtk/gtkwidget.h>
+
+/**
+ * @typedef OMTaskManager
+ *
+ * Opaque structure used for representing an Openmoko Task Manager App. 
+ */ 
+/* Types */
+typedef struct _OMTaskManager 
+{
+	DBusConnection* bus;
+    	GMainLoop* loop;
+    	GtkWidget* toplevel_win;
+    	Footer* footer;
+} OMTaskManager;
+
+#endif /* OMTaskManager.h */


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/main.h
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.c	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.c	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,47 @@
+#include "misc.h"
+
+void
+mbcommand(Display *dpy, int cmd_id, char *data) {
+
+   XEvent	ev;
+   Window	root;
+   Atom theme_prop, cmd_prop, desktop_manager_atom;
+
+   desktop_manager_atom = XInternAtom(dpy, "_NET_DESKTOP_MANGER",False);
+
+   root = DefaultRootWindow(dpy);
+   
+    if (cmd_id == MB_CMD_DESKTOP)
+     {
+       /* Check if desktop is running */
+       if (!XGetSelectionOwner(dpy, desktop_manager_atom))
+	 {
+	   fprintf(stderr, "Desktop not running, exiting...\n");
+	   switch (fork())
+	     {
+	     case 0:
+	       execvp ("mbdesktop", NULL);
+	       break;
+	     case -1:
+	       fprintf(stderr, "failed to exec mbdesktop");
+	       break;
+	     }
+	   exit(0);
+	 }
+     }
+   
+   cmd_prop = XInternAtom(dpy, "_MB_COMMAND", False);
+         
+   memset(&ev, '\0', sizeof ev);
+   ev.xclient.type = ClientMessage;
+   ev.xclient.window = root; 	/* we send it _from_ root as we have no win  */
+   ev.xclient.message_type = cmd_prop;
+   ev.xclient.format = 8;
+
+   ev.xclient.data.l[0] = cmd_id;
+
+   XSendEvent(dpy, root, False, 
+	      SubstructureRedirectMask|SubstructureNotifyMask, &ev);
+
+}
+


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.c
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.h	2006-12-07 00:20:12 UTC (rev 322)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.h	2006-12-07 02:18:33 UTC (rev 323)
@@ -0,0 +1,34 @@
+#ifndef _FOOTER_MISC_H
+#define _FOOTER_MISC_H
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MB_CMD_SET_THEME     1
+#define MB_CMD_EXIT          2
+#define MB_CMD_DESKTOP       3
+#define MB_CMD_NEXT          4
+#define MB_CMD_PREV          5
+#define MB_CMD_SHOW_EXT_MENU 6
+#define MB_CMD_MISC          7
+#define MB_CMD_COMPOSITE     8
+#define MB_CMB_KEYS_RELOAD   9
+
+#define MB_CMD_PANEL_TOGGLE_VISIBILITY 1
+#define MB_CMD_PANEL_SIZE              2
+#define MB_CMD_PANEL_ORIENTATION       3
+
+#define MB_PANEL_ORIENTATION_NORTH     1
+#define MB_PANEL_ORIENTATION_EAST      2
+#define MB_PANEL_ORIENTATION_SOUTH     3
+#define MB_PANEL_ORIENTATION_WEST      4
+
+void
+mbcommand(Display *dpy, int cmd_id, char *data);
+
+#endif


Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/openmoko-footer/src/misc.h
___________________________________________________________________
Name: svn:executable
   + *





More information about the commitlog mailing list