Add 4th line of history. Gradually shrink history font size.
[stopish] / src / stopish.c
index a201cd4..9b8b494 100644 (file)
@@ -29,6 +29,7 @@ static GtkWidget *timerLabel = NULL;
 static GtkWidget *timerHistoryLabel1 = NULL;
 static GtkWidget *timerHistoryLabel2 = NULL;
 static GtkWidget *timerHistoryLabel3 = NULL;
+static GtkWidget *timerHistoryLabel4 = NULL;
 static GSList *historyList = NULL;
 static int stopishMode = STOPISH_MODE_START;
 static int timerHandle = -1;
@@ -119,9 +120,10 @@ static GtkWindow *stopish_new( void )
 
     // main timer
     timerLabel = gtk_label_new( NULL );
+    gtk_widget_set_size_request( timerLabel, -1, 150 );
     gtk_label_set_markup( GTK_LABEL( timerLabel ),
                           "<span font_family=\"monospace\" size=\"xx-large\">00:00:00.0</span>" );
-    gtk_container_add( GTK_CONTAINER( vBox0 ), timerLabel );
+    gtk_box_pack_start( GTK_BOX( vBox0 ), timerLabel, FALSE, FALSE, 0 );
 
     // history area
     timerHistoryLabel1 = gtk_label_new( NULL );
@@ -130,6 +132,8 @@ static GtkWindow *stopish_new( void )
     gtk_box_pack_start( GTK_BOX( vBox0 ), timerHistoryLabel2, FALSE, FALSE, 0 );
     timerHistoryLabel3 = gtk_label_new( NULL );
     gtk_box_pack_start( GTK_BOX( vBox0 ), timerHistoryLabel3, FALSE, FALSE, 0 );
+    timerHistoryLabel4 = gtk_label_new( NULL );
+    gtk_box_pack_start( GTK_BOX( vBox0 ), timerHistoryLabel4, FALSE, FALSE, 0 );
     label = gtk_label_new( NULL );
     gtk_container_add( GTK_CONTAINER( vBox0 ), label );
 
@@ -199,6 +203,7 @@ static void reset_cb( GtkButton* button, gpointer data )
 {
     GSList *tempList;
     char *tempString;
+    char formatString[64];
 
     if ( stopishMode == STOPISH_MODE_RESUME )
         stopish_timer_resume(  );
@@ -217,15 +222,28 @@ static void reset_cb( GtkButton* button, gpointer data )
                         ( char * ) historyList->data );
     tempList = historyList;
     tempList = g_slist_next( tempList );
-    if ( tempList )
-        gtk_label_set_text( GTK_LABEL( timerHistoryLabel2 ),
-                            ( char * ) tempList->data );
+    if ( tempList ) {
+        sprintf( formatString, "<span size=\"small\">%s</span>",
+                 ( char * ) tempList->data );
+        gtk_label_set_markup( GTK_LABEL( timerHistoryLabel2 ),
+                              formatString );
+    }
     tempList = g_slist_next( tempList );
-    if ( tempList )
-        gtk_label_set_text( GTK_LABEL( timerHistoryLabel3 ),
-                            ( char * ) tempList->data );
+    if ( tempList ) {
+        sprintf( formatString, "<span size=\"x-small\">%s</span>",
+                 ( char * ) tempList->data );
+        gtk_label_set_markup( GTK_LABEL( timerHistoryLabel3 ),
+                              formatString );
+    }
+    tempList = g_slist_next( tempList );
+    if ( tempList ) {
+        sprintf( formatString, "<span size=\"xx-small\">%s</span>",
+                 ( char * ) tempList->data );
+        gtk_label_set_markup( GTK_LABEL( timerHistoryLabel4 ),
+                              formatString );
+    }
 
-    // remove the history time after the 3rd
+    // remove the history time after the 4th
     tempList = g_slist_next( tempList );
     if ( tempList ) {
         tempString = tempList->data;