r3369 - in trunk/src/target/OM-2007.2/applications/openmoko-appmanager2: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Wed Nov 7 16:38:57 CET 2007


Author: thomas
Date: 2007-11-07 16:38:56 +0100 (Wed, 07 Nov 2007)
New Revision: 3369

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/appmanager-window.c
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c
Log:
* src/appmanager-window.c: (main): Request a package list update if the
package list could not be opened.

* src/tool-box.c: (on_upgrade_clicked): Use the upgrade button to
update the package list


Modified: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog	2007-11-07 15:37:20 UTC (rev 3368)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog	2007-11-07 15:38:56 UTC (rev 3369)
@@ -1,5 +1,13 @@
 2007-11-07  Thomas Wood  <thomas at openedhand.com>
 
+	* src/appmanager-window.c: (main): Request a package list update if the
+	package list could not be opened.
+
+	* src/tool-box.c: (on_upgrade_clicked): Use the upgrade button to
+	update the package list
+
+2007-11-07  Thomas Wood  <thomas at openedhand.com>
+
 	* src/ipkg-utils.c:
 	* src/ipkg-utils.h:
 

Modified: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/appmanager-window.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/appmanager-window.c	2007-11-07 15:37:20 UTC (rev 3368)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/appmanager-window.c	2007-11-07 15:38:56 UTC (rev 3369)
@@ -31,6 +31,8 @@
 #include "select-menu.h"
 #include "search-bar.h"
 
+#include "ipkg-utils.h"
+
 /*
  * @brief The start function.
  */
@@ -131,16 +133,46 @@
   /* Load the list of all package in the memory */
   ret = init_package_list (appdata);
   if (ret != OP_SUCCESS)
-    {
-      g_debug ("Can not initialize libipkg, result was %d, aborting.", ret);
-      return -1;
-    }
+  {
+    g_debug ("Can not initialize libipkg, result was %d, aborting.", ret);
+    return -1;
+  }
+
   ret = package_list_build_index (appdata);
   if (ret != OP_SUCCESS)
+  {
+    GtkWidget *dlg;
+      
+    dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION,
+                                  GTK_BUTTONS_YES_NO,
+                                  "Package list not available. "
+                                  "Would you like to update it now?");
+    if (gtk_dialog_run (GTK_DIALOG (dlg)) == GTK_RESPONSE_YES)
     {
+      /* update the package list */
+      update_package_list (appdata);
+
+      /* try to reload the package list */
+      ret = reinit_package_list (appdata);
+      ret = package_list_build_index (appdata);
+
+      gtk_widget_destroy (dlg);
+
+      if (ret != OP_SUCCESS)
+      {
+        dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+                                "Could not update the package list");
+        gtk_dialog_run (GTK_DIALOG (dlg));
+        gtk_widget_destroy (dlg);
+        return -1;
+      }
+    }
+    else      
+    {
       g_debug ("Can not build index for packages, aborting.");
       return -1;
     }
+  }
 
   /* Add section list to the filter menu */
   package_list_add_section_to_filter_menu (appdata);

Modified: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c	2007-11-07 15:37:20 UTC (rev 3368)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c	2007-11-07 15:38:56 UTC (rev 3369)
@@ -35,6 +35,8 @@
 void 
 on_upgrade_clicked (GtkButton *bupgrade, gpointer data)
 {
+  update_package_list (data);
+  /*
   GtkWidget *dialog;
 
   g_debug ("Clicked the button upgrade");
@@ -50,6 +52,7 @@
   gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (dialog);
   g_debug ("destroy a dialog");
+  */
 }
 
 





More information about the commitlog mailing list