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

thomas at sita.openmoko.org thomas at sita.openmoko.org
Fri Nov 9 10:19:08 CET 2007


Author: thomas
Date: 2007-11-09 10:19:06 +0100 (Fri, 09 Nov 2007)
New Revision: 3381

Added:
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.c
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.h
Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
Log:
* src/package-store.c:
* src/package-store.h:

Add package-store to the repository


Modified: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog	2007-11-08 17:42:57 UTC (rev 3380)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog	2007-11-09 09:19:06 UTC (rev 3381)
@@ -1,3 +1,10 @@
+2007-11-09  Thomas Wood  <thomas at openedhand.com>
+
+	* src/package-store.c:
+	* src/package-store.h:
+
+	Add package-store to the repository
+
 2007-11-08  Thomas Wood  <thomas at openedhand.com>
 
 	* src/Makefile.am:

Added: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.c	2007-11-08 17:42:57 UTC (rev 3380)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.c	2007-11-09 09:19:06 UTC (rev 3381)
@@ -0,0 +1,54 @@
+/*
+ *  @file package-store.c
+ *  @brief A GTK+ list store that contains the list of available packages
+ *
+ *  Copyright (C) 2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Authors:
+ *    OpenedHand Ltd. <info at openedhand.com>
+ */
+
+#include "package-store.h"
+#include "ipkgapi.h"
+#include <glib.h>
+
+GtkTreeModel *
+package_store_new ()
+{
+  GtkListStore *store;
+  IPK_PACKAGE *pkg;
+  PKG_LIST_HEAD list;
+  int ret;
+  
+  ipkg_initialize (0);
+  
+  /* status, name, size, pkg */
+  store = gtk_list_store_new (NUM_COL, G_TYPE_INT,
+                              G_TYPE_STRING, G_TYPE_POINTER);
+
+  ret = ipkg_list_available_cmd (&list);
+  g_return_val_if_fail (ret >= 0, NULL);
+  
+  pkg = list.pkg_list;
+  
+  while (pkg)
+  {
+    gtk_list_store_insert_with_values (store, NULL, -1,
+                                       COL_STATUS, pkg->state_status,
+                                       COL_NAME, pkg->name,
+                                       COL_POINTER, pkg,
+                                       -1);
+    pkg = pkg->next;
+  }
+
+  return GTK_TREE_MODEL (store);
+}

Added: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.h	2007-11-08 17:42:57 UTC (rev 3380)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.h	2007-11-09 09:19:06 UTC (rev 3381)
@@ -0,0 +1,35 @@
+/*
+ *  @file package-store.h
+ *  @brief A GTK+ list store that contains the list of available packages
+ *
+ *  Copyright (C) 2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Authors:
+ *    OpenedHand Ltd. <info at openedhand.com>
+ */
+
+#ifndef PACKAGE_STORE_H
+#define PACKAGE_STORE_H
+
+#include <gtk/gtk.h>
+
+enum {
+  COL_STATUS = 0,
+  COL_NAME,
+  COL_POINTER,
+  NUM_COL
+};
+
+
+GtkTreeModel * package_store_new ();
+
+#endif /* PACKAGE_STORE_H */





More information about the commitlog mailing list