Changeset 4423
- Timestamp:
- 05/09/08 18:13:50 (5 years ago)
- Location:
- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2
- Files:
-
- 13 edited
-
ChangeLog (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
src/Makefile.am (modified) (2 diffs)
-
src/appmanager-data.c (modified) (1 diff)
-
src/appmanager-data.h (modified) (2 diffs)
-
src/appmanager-window.c (modified) (1 diff)
-
src/detail-area.c (modified) (7 diffs)
-
src/detail-area.h (modified) (1 diff)
-
src/navigation-area.c (modified) (6 diffs)
-
src/package-store.c (modified) (2 diffs)
-
src/package-store.h (modified) (2 diffs)
-
src/search-bar.c (modified) (7 diffs)
-
src/tool-box.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
r3442 r4423 1 2008-05-09 Thomas Wood <thomas@openedhand.com> 2 3 * configure.ac: 4 * src/Makefile.am: 5 * src/appmanager-data.c: (application_manager_data_init): 6 * src/appmanager-data.h: 7 * src/appmanager-window.c: (main): 8 * src/detail-area.c: (detail_area_new), (format_depends_list), 9 (detail_area_update_info): 10 * src/detail-area.h: 11 * src/navigation-area.c: (on_selection_changed), 12 (model_filter_func): 13 * src/package-store.c: 14 * src/package-store.h: 15 * src/search-bar.c: (combo_changed_cb), (searchbar_toggled_cb), 16 (search_bar_new): 17 * src/tool-box.c: (on_upgrade_clicked), (on_install_clicked), 18 (on_remove_clicked): 19 20 Convert to libopkg API 21 1 22 2007-11-19 Thomas Wood <thomas@openedhand.com> 2 23 -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/configure.ac
r3090 r4423 14 14 PKG_CHECK_MODULES(OPENMOKO, libmokoui2,, 15 15 AC_MSG_ERROR([*** Required OpenMoko Libraries not installed ***])) 16 PKG_CHECK_MODULES(LIBIPKG, libipkg,, 17 exit) 18 PKG_CHECK_MODULES(GTHREAD, gthread-2.0,, 19 exit) 20 LIBS="$LIBS $GTK_LIBS $LIBIPKG_LIBS $GTHREAD_LIBS" 21 CFLAGS="$CFLAGS $OPENMOKO_CFLAGS $LIBIPKG_CFLAGS -DIPKG_LIB" 16 PKG_CHECK_MODULES(LIBOPKG, libopkg = 0.1.3) 17 PKG_CHECK_MODULES(GTHREAD, gthread-2.0) 18 LIBS="$LIBS $GTK_LIBS $LIBOPKG_LIBS $GTHREAD_LIBS" 19 CFLAGS="$CFLAGS $OPENMOKO_CFLAGS $LIBOPKG_CFLAGS -DOPKG_LIB" 22 20 23 21 # output stuff -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/Makefile.am
r3380 r4423 4 4 5 5 openmoko_appmanager_SOURCES = appmanager-window.c\ 6 ipkgapi.c\7 6 navigation-area.c\ 8 7 tool-box.c\ … … 12 11 install-dialog.c \ 13 12 search-bar.c \ 14 ipkg-utils.c \15 13 am-progress-dialog.c \ 16 14 package-store.c -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/appmanager-data.c
r3380 r4423 60 60 data->searchhistory = NULL; 61 61 62 data->opkg = opkg_new (); 63 #if 0 64 opkg_set_option (data->opkg, "offline_root", "/tmp"); 65 opkg_re_read_config_files (data->opkg); 66 #endif 62 67 } 63 68 -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/appmanager-data.h
r3431 r4423 22 22 23 23 #include <gtk/gtk.h> 24 #include <libopkg/opkg.h> 24 25 25 26 #include "pixbuf-list.h" … … 53 54 typedef struct _ApplicationManagerData { 54 55 GObject parent; /* The parent of the struct */ 56 57 opkg_t *opkg; 55 58 56 59 GtkWidget *mwindow; /* The main window */ -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/appmanager-window.c
r3431 r4423 71 71 72 72 /* create the package list store */ 73 pkg_list = package_store_new ( );73 pkg_list = package_store_new (appdata->opkg); 74 74 75 75 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/detail-area.c
r3382 r4423 21 21 22 22 #include <moko-finger-scroll.h> 23 #include <libopkg/opkg.h> 23 24 24 25 #include "detail-area.h" 25 26 #include "navigation-area.h" 26 27 #include "ipkgapi.h"28 27 29 28 /* … … 56 55 } 57 56 57 #if 0 58 58 /* 59 59 * @brief Format the depends list of package. … … 84 84 dest[i] = 0; 85 85 } 86 86 #endif 87 87 /* 88 88 * @brief Update the detail area infomation base on the package that selected … … 92 92 void 93 93 detail_area_update_info (ApplicationManagerData *appdata, 94 IPK_PACKAGE*pkg)94 opkg_package_t *pkg) 95 95 { 96 96 GtkWidget *textview; … … 100 100 GtkTextTagTable *tagtable; 101 101 gint pstart, pend; 102 char *depends;102 /* char *depends; */ 103 103 104 104 g_debug ("Update the info in the detail area"); … … 182 182 183 183 /* Set the depends */ 184 /* XXX: doeso the user really care about depends? 184 185 depends = pkg->depends; 185 186 if (depends != NULL) … … 207 208 g_free (dep); 208 209 } 210 */ 209 211 if (pix) 210 212 g_object_unref (pix); -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/detail-area.h
r3380 r4423 22 22 23 23 #include <gtk/gtk.h> 24 #include <libopkg/opkg.h> 24 25 25 26 #include "appmanager-data.h" 26 #include "ipkgapi.h"27 27 28 28 GtkWidget *detail_area_new (ApplicationManagerData *appdata); 29 29 30 30 void detail_area_update_info (ApplicationManagerData *appdata, 31 IPK_PACKAGE*pkg);31 opkg_package_t *pkg); 32 32 33 33 #endif -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
r3440 r4423 28 28 #include "package-store.h" 29 29 #include "select-menu.h" 30 31 #include "ipkgapi.h" 30 #include <libopkg/opkg.h> 31 32 32 33 33 /* … … 40 40 GtkTreeModel *model; 41 41 GtkTreeIter iter; 42 IPK_PACKAGE*pkg;42 opkg_package_t *pkg; 43 43 44 44 g_debug ("Call the on_treeview_cursor_changed"); … … 49 49 detail_area_update_info (data, pkg); 50 50 51 if (pkg-> state_status == SS_INSTALLED)51 if (pkg->installed) 52 52 { 53 53 gtk_widget_set_sensitive (GTK_WIDGET (data->install_btn), FALSE); … … 74 74 model_filter_func (GtkTreeModel *model, GtkTreeIter *iter, ApplicationManagerData *data) 75 75 { 76 IPK_PACKAGE*pkg;76 opkg_package_t *pkg; 77 77 78 78 if (!data->searchbar_needle) … … 87 87 if (data->searchbar_search_type == SEARCH_ON_SECTION) 88 88 { 89 return (g_str_equal (pkg->section, data->searchbar_needle)); 89 /* return (g_str_equal (pkg->section, data->searchbar_needle)); */ 90 /* FIXME: search on group tag? */ 90 91 } 91 92 else if (data->searchbar_search_type == SEARCH_ON_NAME) … … 99 100 else if (data->searchbar_search_type == SEARCH_ON_STATUS) 100 101 { 101 return (pkg-> state_status== GPOINTER_TO_INT (data->searchbar_needle));102 return (pkg->installed == GPOINTER_TO_INT (data->searchbar_needle)); 102 103 } 103 104 -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.c
r3384 r4423 19 19 20 20 #include "package-store.h" 21 #include "ipkgapi.h"21 #include <libopkg/opkg.h> 22 22 #include <glib.h> 23 23 24 void 25 opkg_package_callback (opkg_t *opkg, opkg_package_t *pkg, void *user_data) 26 { 27 GtkListStore *store = GTK_LIST_STORE (user_data); 28 29 gtk_list_store_insert_with_values (store, NULL, -1, 30 COL_STATUS, pkg->installed, 31 COL_NAME, pkg->name, 32 COL_POINTER, pkg, 33 -1); 34 } 35 24 36 GtkTreeModel * 25 package_store_new ( )37 package_store_new (opkg_t *opkg) 26 38 { 27 39 GtkListStore *store; 28 IPK_PACKAGE *pkg;29 PKG_LIST_HEAD list;30 int ret;31 GRegex *regex;32 33 ipkg_initialize (0);34 40 35 41 /* status, name, size, pkg */ … … 37 43 G_TYPE_STRING, G_TYPE_POINTER); 38 44 39 ret = ipkg_list_available_cmd (&list); 40 g_return_val_if_fail (ret >= 0, NULL); 41 42 pkg = list.pkg_list; 43 44 regex = g_regex_new ("(-doc$|-dev$|-dbg$|-locale)", G_REGEX_OPTIMIZE, 0, NULL); 45 46 while (pkg) 47 { 48 if (!g_regex_match (regex, pkg->name, 0, NULL)) 49 gtk_list_store_insert_with_values (store, NULL, -1, 50 COL_STATUS, pkg->state_status, 51 COL_NAME, pkg->name, 52 COL_POINTER, pkg, 53 -1); 54 pkg = pkg->next; 55 } 56 57 g_regex_unref (regex); 45 opkg_list_packages (opkg, opkg_package_callback, store); 58 46 59 47 return GTK_TREE_MODEL (store); -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/package-store.h
r3381 r4423 22 22 23 23 #include <gtk/gtk.h> 24 #include <libopkg/opkg.h> 24 25 25 26 enum { … … 31 32 32 33 33 GtkTreeModel * package_store_new ( );34 GtkTreeModel * package_store_new (opkg_t *opkg); 34 35 35 36 #endif /* PACKAGE_STORE_H */ -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/search-bar.c
r3441 r4423 22 22 #include "package-store.h" 23 23 24 #include "ipkgapi.h"24 #include <libopkg/opkg.h> 25 25 26 26 static gboolean … … 92 92 data->searchbar_search_type = SEARCH_ON_STATUS; 93 93 if (active == FILTER_INSTALLED) 94 data->searchbar_needle = GINT_TO_POINTER ( SS_INSTALLED);94 data->searchbar_needle = GINT_TO_POINTER (1); 95 95 else 96 data->searchbar_needle = GINT_TO_POINTER ( SS_NOT_INSTALLED);96 data->searchbar_needle = GINT_TO_POINTER (0); 97 97 } 98 98 else … … 125 125 combo_changed_cb (searchbar, NULL, data); 126 126 } 127 127 /* 128 128 gboolean 129 129 section_search_hash (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, GHashTable *hash) 130 130 { 131 IPK_PACKAGE*pkg;131 opkg_package_t *pkg; 132 132 133 133 gtk_tree_model_get (model, iter, COL_POINTER, &pkg, -1); … … 151 151 section_search_slist (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, GSList **head) 152 152 { 153 IPK_PACKAGE*pkg;153 opkg_package_t *pkg; 154 154 155 155 gtk_tree_model_get (model, iter, COL_POINTER, &pkg, -1); … … 163 163 return FALSE; 164 164 } 165 165 */ 166 166 void 167 167 slist_insert (gchar *value, GtkListStore *list) … … 178 178 GtkCellRenderer *renderer; 179 179 /* GHashTable *hash; */ 180 GSList *slist = NULL;180 /* GSList *slist = NULL; */ 181 181 182 182 filter = gtk_list_store_new (1, G_TYPE_STRING); … … 194 194 g_hash_table_unref (hash); 195 195 #endif 196 196 /* 197 197 gtk_tree_model_foreach (pkg_list, (GtkTreeModelForeachFunc) section_search_slist, &slist); 198 198 slist = g_slist_sort (slist, (GCompareFunc) strcmp); 199 199 g_slist_foreach (slist, (GFunc) slist_insert, filter); 200 200 g_slist_free (slist); 201 201 */ 202 202 203 203 renderer = gtk_cell_renderer_text_new (); -
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c
r3442 r4423 33 33 on_upgrade_clicked (GtkButton *bupgrade, gpointer data) 34 34 { 35 /* 35 36 GList *list; 36 37 int upgrades; 37 38 38 update_package_list (data); 39 39 … … 60 60 g_list_free (list); 61 61 62 /*63 GtkWidget *dialog;64 65 g_debug ("Clicked the button upgrade");66 package_list_mark_all_upgradeable (MOKO_APPLICATION_MANAGER_DATA (data));67 navigation_area_rebuild_from_latest (MOKO_APPLICATION_MANAGER_DATA (data));68 69 g_debug ("Create a dialog");70 dialog = gtk_message_dialog_new (NULL,71 GTK_DIALOG_DESTROY_WITH_PARENT,72 GTK_MESSAGE_INFO,73 GTK_BUTTONS_OK,74 _("Marked all upgradeable packages"));75 gtk_dialog_run (GTK_DIALOG (dialog));76 gtk_widget_destroy (dialog);77 g_debug ("destroy a dialog");78 62 */ 79 63 } … … 87 71 GtkTreeIter iter; 88 72 gchar *name; 73 GtkWidget *dialog; 89 74 90 75 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tvpkglist)); … … 95 80 gtk_tree_model_get (model, &iter, COL_NAME, &name, -1); 96 81 97 install_package (data, name); 82 if (opkg_install_package (data->opkg, name, NULL, NULL) == 0) 83 dialog = gtk_message_dialog_new (NULL,0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s was installed", name); 84 else 85 dialog = gtk_message_dialog_new (NULL,0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s could not be installed", name); 86 gtk_dialog_run (GTK_DIALOG (dialog)); 87 gtk_widget_destroy (dialog); 98 88 } 99 89 … … 105 95 GtkTreeIter iter; 106 96 gchar *name; 97 GtkWidget *dialog; 107 98 108 99 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tvpkglist)); … … 113 104 gtk_tree_model_get (model, &iter, COL_NAME, &name, -1); 114 105 115 remove_package (data, name); 106 if (opkg_remove_package (data->opkg, name, NULL, NULL) == 0) 107 dialog = gtk_message_dialog_new (NULL,0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s was removed", name); 108 else 109 dialog = gtk_message_dialog_new (NULL,0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s could not be removed", name); 110 gtk_dialog_run (GTK_DIALOG (dialog)); 111 gtk_widget_destroy (dialog); 112 116 113 } 117 114
Note: See TracChangeset
for help on using the changeset viewer.
