r4322 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src/common src/dialer

thomas at sita.openmoko.org thomas at sita.openmoko.org
Tue Apr 8 10:57:43 CEST 2008


Author: thomas
Date: 2008-04-08 10:57:41 +0200 (Tue, 08 Apr 2008)
New Revision: 4322

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/dialer-main.c
Log:
2008-04-08  Thomas Wood  <thomas at openedhand.com>

	* src/common/Makefile.am: Add missing header file
	* src/dialer/dialer-main.c: (program_log), (main): Create the history
	widget after everything else has loaded, unless it is explicitly
	requested at runtime


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2008-04-08 00:27:52 UTC (rev 4321)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2008-04-08 08:57:41 UTC (rev 4322)
@@ -1,3 +1,10 @@
+2008-04-08  Thomas Wood  <thomas at openedhand.com>
+
+	* src/common/Makefile.am: Add missing header file
+	* src/dialer/dialer-main.c: (program_log), (main): Create the history
+	widget after everything else has loaded, unless it is explicitly
+	requested at runtime
+
 2008-04-07  Erin Yueh  <erin_yueh at openmoko.com>
 
 	*  src/phone-kit/moko-dialer.c: (moko_dialer_dial)

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am	2008-04-08 00:27:52 UTC (rev 4321)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am	2008-04-08 08:57:41 UTC (rev 4322)
@@ -9,4 +9,5 @@
 	moko-contacts.c moko-contacts.h \
 	moko-dialer-panel.c moko-dialer-panel.h \
 	moko-dialer-textview.c moko-dialer-textview.h \
-	moko-digit-button.c moko-digit-button.h
+	moko-digit-button.c moko-digit-button.h \
+	dialer-defines.h

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/dialer-main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/dialer-main.c	2008-04-08 00:27:52 UTC (rev 4321)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/dialer-main.c	2008-04-08 08:57:41 UTC (rev 4322)
@@ -29,10 +29,13 @@
 {
   GtkWidget *notebook;
   GtkWidget *history;
+
+  GtkWidget *history_placeholder;
   
   GtkWidget *main_window;
 
   DBusGProxy *dialer_proxy;
+  MokoJournal *journal;
 } DialerData;
 
 static gboolean show_missed;
@@ -98,6 +101,18 @@
   g_free (str);
 }
 
+gboolean
+create_history_window (DialerData *data)
+{
+  /* create the history window in an idle callback, if we don't need it straight
+   * away */
+  data->history = moko_history_new (data->journal);
+  g_signal_connect (data->history, "dial_number", G_CALLBACK (dial_clicked_cb), data);
+  gtk_container_add (GTK_CONTAINER (data->history_placeholder), data->history);
+  return FALSE;
+
+}
+
 int main (int argc, char **argv)
 {
   GtkWidget *window, *keypad;
@@ -153,7 +168,7 @@
 
   /* Set up the journal */
   program_log ("load journal");
-  journal = moko_journal_open_default ();
+  data->journal = journal = moko_journal_open_default ();
   if (!journal || !moko_journal_load_from_storage (journal))
   {
     g_warning ("Could not load journal");
@@ -180,20 +195,32 @@
   gtk_notebook_append_page (GTK_NOTEBOOK (data->notebook), keypad, gtk_image_new_from_file (PKGDATADIR"/dtmf.png"));
   gtk_container_child_set (GTK_CONTAINER (data->notebook), keypad, "tab-expand", TRUE, NULL);
 
-  /* History */
+
   program_log ("create history widget");
-  data->history = moko_history_new (journal);
-  g_signal_connect (data->history, "dial_number", G_CALLBACK (dial_clicked_cb), data);
-  gtk_notebook_append_page (GTK_NOTEBOOK (data->notebook), data->history,
-                            gtk_image_new_from_icon_name ("moko-call-history",
-                                                      GTK_ICON_SIZE_BUTTON));
-  gtk_container_child_set (GTK_CONTAINER (data->notebook), data->history,
-                           "tab-expand", TRUE,
-                           NULL);
+  if (!show_missed)
+  {
+    /* set a temporary widget while we create the real history widget */
+    data->history_placeholder = gtk_alignment_new (0, 0, 1, 1);
+    gtk_notebook_append_page (GTK_NOTEBOOK (data->notebook), data->history_placeholder,
+                              gtk_image_new_from_icon_name ("moko-call-history",
+                                                        GTK_ICON_SIZE_BUTTON));
+    gtk_container_child_set (GTK_CONTAINER (data->notebook), data->history_placeholder,
+                             "tab-expand", TRUE,
+                             NULL);
+    /* wait until everything else finishes before creating the history widget */
+    g_idle_add ((GSourceFunc) create_history_window, data);
+  }
+  else
+  {
+    /* we need to show the history window right now, so don't delay creation */
+    create_history_window (data);
+  }
 
   program_log ("show window");
   gtk_widget_show_all (window);
 
+
+  /* History */
   if (show_missed)
     gtk_notebook_set_current_page (GTK_NOTEBOOK (data->notebook), 1);
   else





More information about the commitlog mailing list