r307 - in trunk/src/target/OM-2007/applications/openmoko-appmanager: . src

caowai_song at gta01.hmw-consulting.de caowai_song at gta01.hmw-consulting.de
Tue Dec 5 10:27:26 CET 2006


Author: caowai_song
Date: 2006-12-05 09:26:55 +0000 (Tue, 05 Dec 2006)
New Revision: 307

Modified:
   trunk/src/target/OM-2007/applications/openmoko-appmanager/configure.ac
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/application-menu.c
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.c
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.h
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.c
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.h
   trunk/src/target/OM-2007/applications/openmoko-appmanager/src/package-list.c
Log:
Resume the dependence of the libipkg


Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/configure.ac
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/configure.ac	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/configure.ac	2006-12-05 09:26:55 UTC (rev 307)
@@ -13,8 +13,10 @@
 # base deps
 PKG_CHECK_MODULES(OPENMOKO, openmoko-libs >= 0.0.1,,
                  AC_MSG_ERROR([*** Required OpenMoko Libraries >= 0.0.1 not installed ***]))
-LIBS="$LIBS $GTK_LIBS"
-CFLAGS="$CFLAGS $OPENMOKO_CFLAGS"
+PKG_CHECK_MODULES(LIBIPKG, libipkg,,
+                exit)
+LIBS="$LIBS $GTK_LIBS $LIBIPKG_LIBS"
+CFLAGS="$CFLAGS $OPENMOKO_CFLAGS $LIBIPKG_CFLAGS -DIPKG_LIB"
 
 # output stuff
 AC_OUTPUT([

Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/Makefile.am	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/Makefile.am	2006-12-05 09:26:55 UTC (rev 307)
@@ -5,11 +5,12 @@
 openmoko_appmanager_SOURCES = appmanager-window.c\
                               application-menu.c\
                               filter-menu.c\
+                              ipkgapi.c\
                               navigation-area.c\
                               tool-box.c\
                               detail-area.c\
                               appmanager-data.c\
+                              package-list.c\
                               pixbuf-list.c
 
 openmoko_appmanager_LDADD = @OPENMOKO_LIBS@
-

Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/application-menu.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/application-menu.c	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/application-menu.c	2006-12-05 09:26:55 UTC (rev 307)
@@ -76,45 +76,47 @@
 GtkMenu *
 application_menu_new (ApplicationManagerData *appdata)
 {
-  GtkMenu *menu;
-  GtkWidget   *menuitem1;
-  GtkWidget   *menuitem2;
-  GtkWidget   *menuitem3;
-  GtkWidget   *menuitem4;
-  GtkWidget   *menuitem5;
+  GtkMenu     *appmenu;
+  GtkWidget   *showstatus;
+  GtkWidget   *showsource;
+  GtkWidget   *installsingleapp;
+  GtkWidget   *showhelp;
+  GtkWidget   *quit;
 
-  g_debug ("Init the application menu");
-  menu = GTK_MENU (gtk_menu_new ());
+  g_debug ("Init the application appmenu");
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
-  menuitem1 = gtk_menu_item_new_with_mnemonic (_("Shows tatus"));
-  gtk_widget_show (menuitem1);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem1);
-  g_signal_connect ((gpointer) menuitem1, "activate",
+  appmenu = GTK_MENU (gtk_menu_new ());
+
+  showstatus = gtk_menu_item_new_with_mnemonic (_("Shows tatus"));
+  gtk_widget_show (showstatus);
+  gtk_container_add (GTK_CONTAINER (appmenu), showstatus);
+  g_signal_connect ((gpointer) showstatus, "activate",
                     G_CALLBACK (on_showstatus_activate), appdata);
 
-  menuitem2 = gtk_menu_item_new_with_mnemonic (_("Show source"));
-  gtk_widget_show (menuitem2);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem2);
-  g_signal_connect ((gpointer) menuitem2, "activate",
+  showsource = gtk_menu_item_new_with_mnemonic (_("Show source"));
+  gtk_widget_show (showsource);
+  gtk_container_add (GTK_CONTAINER (appmenu), showsource);
+  g_signal_connect ((gpointer) showsource, "activate",
                     G_CALLBACK (on_showsource_activate), appdata);
 
-  menuitem3 = gtk_menu_item_new_with_mnemonic (_("Install single application"));
-  gtk_widget_show (menuitem3);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem3);
-  g_signal_connect ((gpointer) menuitem3, "activate",
+  installsingleapp = gtk_menu_item_new_with_mnemonic (_("Install single application"));
+  gtk_widget_show (installsingleapp);
+  gtk_container_add (GTK_CONTAINER (appmenu), installsingleapp);
+  g_signal_connect ((gpointer) installsingleapp, "activate",
                     G_CALLBACK (on_install_single_application_activate), appdata);
 
-  menuitem4 = gtk_menu_item_new_with_mnemonic (_("Show help"));
-  gtk_widget_show (menuitem4);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem4);
-  g_signal_connect ((gpointer) menuitem4, "activate",
+  showhelp = gtk_menu_item_new_with_mnemonic (_("Show help"));
+  gtk_widget_show (showhelp);
+  gtk_container_add (GTK_CONTAINER (appmenu), showhelp);
+  g_signal_connect ((gpointer) showhelp, "activate",
                     G_CALLBACK (on_showhelp_activate), appdata);
 
-  menuitem5 = gtk_menu_item_new_with_mnemonic (_("Quit"));
-  gtk_widget_show (menuitem5);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem5);
-  g_signal_connect ((gpointer) menuitem5, "activate",
+  quit = gtk_menu_item_new_with_mnemonic (_("Quit"));
+  gtk_widget_show (quit);
+  gtk_container_add (GTK_CONTAINER (appmenu), quit);
+  g_signal_connect ((gpointer) quit, "activate",
                     G_CALLBACK (on_quit_activate), appdata);
 
-  return menu;
+  return appmenu;
 }

Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.c	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.c	2006-12-05 09:26:55 UTC (rev 307)
@@ -36,6 +36,7 @@
   gint  i;
 
   data->mwindow = NULL;
+  data->filtermenu = NULL;
   data->tvpkglist = NULL;
   data->tvdetail = NULL;
   data->pkglist = NULL;
@@ -85,33 +86,6 @@
 ApplicationManagerData *
 application_manager_data_new (void)
 {
-/*
-  ApplicationManagerData *data;
-  int i;
-
-  data = g_malloc (sizeof (ApplicationManagerData));
-  if (data == NULL)
-    {
-      g_debug ("Can not malloc memory for the init data struct, process will be abort");
-      return NULL;
-    }
-
-  data->mwindow = NULL;
-  data->tvpkglist = NULL;
-  data->tvdetail = NULL;
-  data->pkglist = NULL;
-  data->sectionlist = NULL;
-  data->installedlist = NULL;
-  data->upgradelist = NULL;
-  data->selectedlist = NULL;
-
-  for (i = 0; i < N_COUNT_PKG_STATUS; i++)
-    {
-      data->statuspix[i] = NULL;
-    }
-
-  return data;
-*/
   return MOKO_APPLICATION_MANAGER_DATA (g_object_new \
                                         (moko_type_application_manager_data_get_type (), \
                                         NULL));
@@ -132,6 +106,20 @@
 }
 
 /**
+ * @brief Set the filter menu to the application manager data
+ * @param appdata The application manager data struct
+ * @param filtermenu The filter menu
+ */
+void 
+application_manager_data_set_filter_menu (ApplicationManagerData *appdata,
+                                          GtkMenu *filtermenu)
+{
+  g_return_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata));
+
+  appdata->filtermenu = filtermenu;
+}
+
+/**
  * @brief Set the treeview widget of package list to the 
  * application manager data
  * @param appdata The application manager data struct
@@ -315,12 +303,25 @@
 MokoPanedWindow *
 application_manager_get_main_window (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->mwindow;
 }
 
 /**
+ * @brief Get the filter menu from the application manager data
+ * @param appdata The application manager data
+ * @return The filter menu
+ */
+GtkMenu *
+application_manager_get_filter_menu (ApplicationManagerData *appdata)
+{
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
+
+  return appdata->filtermenu;
+}
+
+/**
  * @brief Get the treeview widget of the package list from 
  * the application manager data
  *
@@ -330,7 +331,7 @@
 GtkWidget *
 application_manager_get_tvpkglist (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->tvpkglist;
 }
@@ -345,7 +346,7 @@
 GtkWidget *
 application_manager_get_tvdetail (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->tvdetail;
 }
@@ -360,7 +361,7 @@
 gpointer 
 application_manager_data_get_pkglist (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->pkglist;
 }
@@ -373,7 +374,7 @@
 gpointer 
 application_manager_data_get_sectionlist (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->sectionlist;
 }
@@ -386,7 +387,7 @@
 gpointer 
 application_manager_data_get_installedlist (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->installedlist;
 }
@@ -399,7 +400,7 @@
 gpointer 
 application_manager_data_get_upgradelist (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->upgradelist;
 }
@@ -412,7 +413,7 @@
 gpointer 
 application_manager_data_get_selectedlist (ApplicationManagerData *appdata)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
   return appdata->selectedlist;
 }
@@ -427,7 +428,7 @@
 application_manager_data_get_status_pixbuf (ApplicationManagerData *appdata, 
                                             guint id)
 {
-  g_return_val_if_fail (appdata != NULL, NULL);
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
   g_return_val_if_fail (id < N_COUNT_PKG_STATUS, NULL);
 
   return appdata->statuspix[id];

Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.h	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/appmanager-data.h	2006-12-05 09:26:55 UTC (rev 307)
@@ -55,6 +55,7 @@
   GObject          parent;             ///<! The parent of the struct
 
   MokoPanedWindow  *mwindow;           ///<! The main window
+  GtkMenu          *filtermenu;        ///<! The filter menu
   GtkWidget        *tvpkglist;         ///<! The treeview of the package list
   GtkWidget        *tvdetail;          ///<! The textview of the details info
   gpointer         pkglist;            ///<! The package list get from lib ipkg
@@ -80,6 +81,9 @@
 void application_manager_data_set_main_window (ApplicationManagerData *appdata, 
                                                MokoPanedWindow *window);
 
+void application_manager_data_set_filter_menu (ApplicationManagerData *appdata,
+                                               GtkMenu *filtermenu);
+
 void application_manager_data_set_tvpkglist (ApplicationManagerData *appdata,
                                              GtkWidget *tvpkglist);
 
@@ -106,6 +110,9 @@
 MokoPanedWindow *
      application_manager_get_main_window (ApplicationManagerData *appdata);
 
+GtkMenu *
+     application_manager_get_filter_menu (ApplicationManagerData *appdata);
+
 GtkWidget *
      application_manager_get_tvpkglist (ApplicationManagerData *appdata);
 

Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.c	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.c	2006-12-05 09:26:55 UTC (rev 307)
@@ -58,6 +58,15 @@
 }
 
 /**
+ * @brief The callback function of the dynamic menuitem.
+ */
+void 
+on_dynamic_menu_item_activate (GtkMenuItem *menuitem, gpointer userdata)
+{
+  g_debug ("Click the dynamic menuitem");
+}
+
+/**
  * @brief Create a new filter menu for the application manager
  * 
  * At this function, it only can create the static menu items.
@@ -68,40 +77,62 @@
 GtkMenu *
 filter_menu_new (ApplicationManagerData *appdata)
 {
-  GtkMenu   *menu;
-  GtkWidget *menuitem1;
-  GtkWidget *menuitem2;
-  GtkWidget *menuitem3;
-  GtkWidget *menuitem4;
+  GtkMenu   *filtermenu;
+  GtkWidget *searchresult;
+  GtkWidget *installed;
+  GtkWidget *upgradeable;
+  GtkWidget *selected;
 
-  g_debug ("Init the filter menu");
+  g_debug ("Init the filter filtermenu");
+  g_return_val_if_fail (MOKO_IS_APPLICATION_MANAGER_DATA (appdata), NULL);
 
-  menu = GTK_MENU (gtk_menu_new ());
+  filtermenu = GTK_MENU (gtk_menu_new ());
 
-  menuitem1 = gtk_menu_item_new_with_label (_("Search Results"));
-  gtk_widget_show (menuitem1);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem1);
-  g_signal_connect ((gpointer) menuitem1, "activate",
+  searchresult = gtk_menu_item_new_with_label (_("Search Results"));
+  gtk_widget_show (searchresult);
+  gtk_container_add (GTK_CONTAINER (filtermenu), searchresult);
+  g_signal_connect ((gpointer) searchresult, "activate",
                     G_CALLBACK (on_search_result_activate), appdata);
 
-  menuitem2 = gtk_menu_item_new_with_label (_("Installed"));
-  gtk_widget_show (menuitem2);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem2);
-  g_signal_connect ((gpointer) menuitem2, "activate",
+  installed = gtk_menu_item_new_with_label (_("Installed"));
+  gtk_widget_show (installed);
+  gtk_container_add (GTK_CONTAINER (filtermenu), installed);
+  g_signal_connect ((gpointer) installed, "activate",
                     G_CALLBACK (on_installed_activate), appdata);
 
-  menuitem3 = gtk_menu_item_new_with_label (_("Upgradeable"));
-  gtk_widget_show (menuitem3);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem3);
-  g_signal_connect ((gpointer) menuitem3, "activate",
+  upgradeable = gtk_menu_item_new_with_label (_("Upgradeable"));
+  gtk_widget_show (upgradeable);
+  gtk_container_add (GTK_CONTAINER (filtermenu), upgradeable);
+  g_signal_connect ((gpointer) upgradeable, "activate",
                     G_CALLBACK (on_upgradeable_activate), appdata);
 
-  menuitem4 = gtk_menu_item_new_with_label (_("Selected"));
-  gtk_widget_show (menuitem4);
-  gtk_container_add (GTK_CONTAINER (menu), menuitem4);
-  g_signal_connect ((gpointer) menuitem4, "activate",
+  selected = gtk_menu_item_new_with_label (_("Selected"));
+  gtk_widget_show (selected);
+  gtk_container_add (GTK_CONTAINER (filtermenu), selected);
+  g_signal_connect ((gpointer) selected, "activate",
                     G_CALLBACK (on_selected_activate), appdata);
 
-  return menu;
+  return filtermenu;
 }
 
+/**
+ * @brief Add a menu item to the filter menu
+ * 
+ * @param filtermenu The filter menu
+ * @param name The label name of the menu item
+ */
+void 
+filter_menu_add_item (GtkMenu *filtermenu, const gchar *name, 
+                      ApplicationManagerData *appdata)
+{
+  GtkWidget *dymenuitem;
+
+  g_return_if_fail (GTK_IS_MENU (filtermenu));
+
+  dymenuitem = gtk_menu_item_new_with_label (name);
+  gtk_widget_show (dymenuitem);
+  gtk_container_add (GTK_CONTAINER (filtermenu), dymenuitem);
+  g_signal_connect ((gpointer) dymenuitem, "activate",
+                    G_CALLBACK (on_dynamic_menu_item_activate), appdata);
+
+}

Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.h	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/filter-menu.h	2006-12-05 09:26:55 UTC (rev 307)
@@ -27,5 +27,8 @@
 
 GtkMenu *filter_menu_new (ApplicationManagerData *appdata);
 
+void filter_menu_add_item (GtkMenu *filtermenu, const gchar *name,
+                           ApplicationManagerData *appdata);
+
 #endif
 

Modified: trunk/src/target/OM-2007/applications/openmoko-appmanager/src/package-list.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-appmanager/src/package-list.c	2006-12-05 09:13:09 UTC (rev 306)
+++ trunk/src/target/OM-2007/applications/openmoko-appmanager/src/package-list.c	2006-12-05 09:26:55 UTC (rev 307)
@@ -304,9 +304,9 @@
   PKG_LIST_HEAD *pkglist;
 
   SectionList *sectionlist = NULL;
-  //PackageList *installed = NULL;
-  //PackageList *upgrade = NULL;
-  //PackageList *selected = NULL;
+  PackageList *installed = NULL;
+  PackageList *upgrade = NULL;
+  PackageList *selected = NULL;
 
   // Get the package list from application manager data
   pkglist = (PKG_LIST_HEAD *) application_manager_data_get_pkglist (appdata);
@@ -325,7 +325,33 @@
   package_list_clear_old_index (appdata);
 
   sectionlist = g_malloc (sizeof (SectionList));
+  if (sectionlist == NULL)
+    {
+      g_debug ("Can not malloc memory for the section list");
+      return OP_ERROR;
+    }
 
+  installed = g_malloc (sizeof (PackageList));
+  if (installed == NULL)
+    {
+      g_debug ("Can not malloc memory for the package list");
+      return OP_ERROR;
+    }
+
+  upgrade = g_malloc (sizeof (PackageList));
+  if (upgrade == NULL)
+    {
+      g_debug ("Can not malloc memory for the package list");
+      return OP_ERROR;
+    }
+
+  selected = g_malloc (sizeof (PackageList));
+  if (selected == NULL)
+    {
+      g_debug ("Can not malloc memory for the package list");
+      return OP_ERROR;
+    }
+
   return OP_SUCCESS;
 }
 





More information about the commitlog mailing list