r2785 - in trunk/src/target/OM-2007.2/applications/openmoko-calculator2: . src

mickey at sita.openmoko.org mickey at sita.openmoko.org
Wed Aug 22 17:21:04 CEST 2007


Author: mickey
Date: 2007-08-22 17:21:03 +0200 (Wed, 22 Aug 2007)
New Revision: 2785

Added:
   trunk/src/target/OM-2007.2/applications/openmoko-calculator2/ChangeLog
Removed:
   trunk/src/target/OM-2007.2/applications/openmoko-calculator2/openmoko-calculator.pro
Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-calculator2/README
   trunk/src/target/OM-2007.2/applications/openmoko-calculator2/src/calc-main.c
Log:
openmoko-calculator2:
* set label for calulator table, so we can identify from style
* rename Clear All/Clear to CE/C to have more space in general


Added: trunk/src/target/OM-2007.2/applications/openmoko-calculator2/ChangeLog
===================================================================

Modified: trunk/src/target/OM-2007.2/applications/openmoko-calculator2/README
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-calculator2/README	2007-08-22 15:02:15 UTC (rev 2784)
+++ trunk/src/target/OM-2007.2/applications/openmoko-calculator2/README	2007-08-22 15:21:03 UTC (rev 2785)
@@ -3,8 +3,8 @@
 be useful.
 
 Notes:
- * Pango markup is used currently to manage font size for the display
-of for button labels, maybe styles would be more appropriate.
+ * Pango markup is used currently to manage font size for the display,
+   maybe styles would be more appropriate.
 
 Thank you for your attention,
 

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-calculator2/openmoko-calculator.pro
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-calculator2/openmoko-calculator.pro	2007-08-22 15:02:15 UTC (rev 2784)
+++ trunk/src/target/OM-2007.2/applications/openmoko-calculator2/openmoko-calculator.pro	2007-08-22 15:21:03 UTC (rev 2785)
@@ -1,10 +0,0 @@
-TEMPLATE = app
-DEPENDPATH += src
-INCLUDEPATH += . src
-
-# Input
-HEADERS += src/calc-main.h
-SOURCES += src/calc-main.c
-
-MOKOCONFIG = mokoui
-include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )

Modified: trunk/src/target/OM-2007.2/applications/openmoko-calculator2/src/calc-main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-calculator2/src/calc-main.c	2007-08-22 15:02:15 UTC (rev 2784)
+++ trunk/src/target/OM-2007.2/applications/openmoko-calculator2/src/calc-main.c	2007-08-22 15:21:03 UTC (rev 2785)
@@ -68,7 +68,7 @@
 #define CALC_ROWS 5
 #define CALC_COLS 4
 static const gchar *label[CALC_ROWS][CALC_COLS] = {
-    {N_("Clear All"), N_("Clear"), "/", "*" },
+    {N_("CE"), N_("C"), "/", "*" },
     {"7", "8", "9", "+"},
     {"4", "5", "6", "-"},
     {"1", "2", "3", "="},
@@ -81,25 +81,6 @@
     { one, two, three, equal},
     { zero, point, minus, notimplemented},
   };
-#if 1
-gchar *wnames[CALC_ROWS][CALC_COLS] = {
-  {"mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-dialer", "mokofingerbutton-dialer"},
-  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", "mokofingerbutton-dialer", "mokofingerbutton-dialer"},
-  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", "mokofingerbutton-dialer", "mokofingerbutton-dialer"},
-  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", "mokofingerbutton-dialer", "mokofingerbutton-big"},
-  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", "mokofingerbutton-dialer", "none"},
-};
-#else
-/* Alternative styling - more flashy */
-gchar *wnames[CALC_ROWS][CALC_COLS] = {
-  {"mokofingerbutton-black", "mokofingerbutton-black", "mokofingerbutton-orange", "mokofingerbutton-orange"},
-  {"mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-orange"},
-  {"mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-orange"},
-  {"mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-black"},
-  {"mokofingerbutton-orange", "mokofingerbutton-orange", "mokofingerbutton-orange", "none"},
-};
-#endif
-
 /*
  * Signal function and static helpers
  */
@@ -236,7 +217,7 @@
       update_display(the_state.current_operand);
     } else if (the_state.last_operand != 0.0) {
       the_state.last_operand *= -1;
-      update_display(the_state.last_operand);	
+      update_display(the_state.last_operand);
     }
     /* else: no-op */
     break;
@@ -294,36 +275,35 @@
   int i, j;
 
   table = gtk_table_new (CALC_ROWS, CALC_COLS, TRUE);
+  gtk_widget_set_name (table, "calculator-table" );
 
   for (j = 0; j < CALC_COLS; j++)
     for (i = 0; i < CALC_ROWS; i++)
     {
-      GtkWidget* button = gtk_button_new();
-      GtkWidget* blabel = gtk_label_new(NULL);
-      gtk_label_set_markup(GTK_LABEL(blabel),gettext(label[i][j]));
-      gtk_container_add(GTK_CONTAINER(button),blabel);
+      GtkWidget* button = gtk_button_new_with_label( gettext(label[i][j]) );
+      //GtkWidget* blabel = gtk_label_new(NULL);
+      //gtk_label_set_markup(GTK_LABEL(blabel),gettext(label[i][j]));
+      //gtk_container_add(GTK_CONTAINER(button),blabel);
 
       g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(calc_button_pressed),&(ops[i][j]));
-      /* TODO: Check if this changes the aspect */
-      gtk_widget_set_name(button, wnames[i][j]);
 
-      if ((j == (CALC_COLS-1)) && (i == (CALC_ROWS-2))) {
-	/* Last button spans two cells vertically */
-	gtk_table_attach_defaults (GTK_TABLE (table), button,
-				   j, j + 1, i, i + 2);
-	i++;
-      } else {
-	gtk_table_attach_defaults (GTK_TABLE (table), button,
-				   j, j + 1, i, i + 1);	
-      }
-    }
+        if ((j == (CALC_COLS-1)) && (i == (CALC_ROWS-2))) {
+        /* Last button spans two cells vertically */
+        gtk_table_attach_defaults (GTK_TABLE (table), button,
+                        j, j + 1, i, i + 2);
+        i++;
+            } else {
+        gtk_table_attach_defaults (GTK_TABLE (table), button,
+                        j, j + 1, i, i + 1);
+            }
+        }
   return table;
 }
 
 /*
  * Command line options definition
  */
-static GOptionEntry entries[] = 
+static GOptionEntry entries[] =
 {
   /* No options right now except the default ones from GTK */
   { NULL }
@@ -343,17 +323,17 @@
     gtk_init( &argc, &argv );
     if (argc != 1)
       {
-	/* Add init code. */
-	GError *error = NULL;
-	GOptionContext *context = g_option_context_new ("");
-	
-	g_option_context_add_main_entries (context, entries, NULL);
-	g_option_context_add_group (context, gtk_get_option_group (TRUE));
-	g_option_context_parse (context, &argc, &argv, &error);
-	
-	g_option_context_free (context);
-      }
-	
+    /* Add init code. */
+    GError *error = NULL;
+    GOptionContext *context = g_option_context_new ("");
+
+    g_option_context_add_main_entries (context, entries, NULL);
+    g_option_context_add_group (context, gtk_get_option_group (TRUE));
+    g_option_context_parse (context, &argc, &argv, &error);
+
+    g_option_context_free (context);
+        }
+
     setlocale (LC_ALL, "");
     bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
     textdomain (GETTEXT_PACKAGE);
@@ -392,7 +372,7 @@
     gtk_widget_set_name (main_frame, "calculator-frame");
     gtk_container_add (GTK_CONTAINER (main_frame), vbox);
     gtk_container_add (GTK_CONTAINER (window), main_frame);
-    
+
     /* show everything and run main loop */
     gtk_widget_show_all( GTK_WIDGET(window) );
     calc_debug( "calculator entering main loop" );





More information about the commitlog mailing list