[gnome-packagekit/glib2: 2/79] moo
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-packagekit/glib2: 2/79] moo
- Date: Tue, 6 Oct 2009 09:45:14 +0000 (UTC)
commit 18159243d0690947b09ae2c50b2fec8aef05ce11
Author: Richard Hughes <richard hughsie com>
Date: Wed Sep 9 16:28:13 2009 +0100
moo
configure.ac | 4 +-
src/gpk-animated-icon.c | 2 +-
src/gpk-application.c | 218 ++++++-------------------------------
src/gpk-auto-refresh.c | 2 +-
src/gpk-backend-status.c | 34 ++++---
src/gpk-cell-renderer-info.c | 2 +-
src/gpk-cell-renderer-info.h | 2 +-
src/gpk-cell-renderer-restart.c | 2 +-
src/gpk-cell-renderer-restart.h | 2 +-
src/gpk-check-update.c | 94 ++++-------------
src/gpk-common.c | 52 +++++-----
src/gpk-common.h | 8 +-
src/gpk-dbus-task.c | 225 ++++++++-------------------------------
src/gpk-dbus-task.h | 2 +-
src/gpk-dbus.c | 2 +-
src/gpk-desktop.c | 2 +-
src/gpk-desktop.h | 2 +-
src/gpk-dialog.c | 42 ++++----
src/gpk-dialog.h | 4 +-
src/gpk-enum.c | 2 +-
src/gpk-enum.h | 90 +---------------
src/gpk-error.c | 2 +-
src/gpk-firmware.c | 38 ++-----
src/gpk-hardware.c | 15 +--
src/gpk-helper-chooser.c | 22 ++---
src/gpk-helper-chooser.h | 4 +-
src/gpk-helper-deps-install.c | 4 +-
src/gpk-helper-deps-install.h | 6 +-
src/gpk-helper-deps-remove.c | 4 +-
src/gpk-helper-deps-remove.h | 6 +-
src/gpk-helper-deps-update.c | 16 ++--
src/gpk-helper-deps-update.h | 6 +-
src/gpk-helper-eula.c | 6 +-
src/gpk-helper-media-change.h | 2 +-
src/gpk-helper-repo-signature.c | 8 +-
src/gpk-helper-run.c | 8 +-
src/gpk-helper-untrusted.h | 2 +-
src/gpk-inhibit.c | 2 +-
src/gpk-install-catalog.c | 2 +-
src/gpk-log.c | 22 ++---
src/gpk-modal-dialog.c | 33 +++---
src/gpk-modal-dialog.h | 4 +-
src/gpk-prefs.c | 2 +-
src/gpk-repo.c | 8 +--
src/gpk-service-pack.c | 50 ++-------
src/gpk-update-icon.c | 2 +-
src/gpk-update-viewer.c | 136 ++++++------------------
src/gpk-watch.c | 28 ++---
48 files changed, 337 insertions(+), 894 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 827a3b1..f889d61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,7 @@ AM_GLIB_GNU_GETTEXT
dnl ---------------------------------------------------------------------------
dnl - Library dependencies
dnl ---------------------------------------------------------------------------
-PACKAGEKIT_REQUIRED=0.4.4 # when changing, nuke some compatability entries in gpk-enum.h
+PACKAGEKIT_REQUIRED=0.5.3 # when changing, nuke some compatability entries in gpk-enum.h
GLIB_REQUIRED=2.14.0
GTK_REQUIRED=2.16.0
DBUS_REQUIRED=1.1.2
@@ -132,7 +132,7 @@ AC_SUBST(GIO_REQUIRED)
dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
dnl ---------------------------------------------------------------------------
-PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib >= $PACKAGEKIT_REQUIRED)
+PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= $PACKAGEKIT_REQUIRED)
AC_SUBST(PACKAGEKIT_CFLAGS)
AC_SUBST(PACKAGEKIT_LIBS)
diff --git a/src/gpk-animated-icon.c b/src/gpk-animated-icon.c
index 8217b59..90c8468 100644
--- a/src/gpk-animated-icon.c
+++ b/src/gpk-animated-icon.c
@@ -24,7 +24,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 0f000d2..eea03b7 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -29,7 +29,7 @@
#include <gconf/gconf-client.h>
#include <math.h>
#include <string.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
@@ -103,7 +103,7 @@ struct GpkApplicationPrivate
PkSearchType search_type;
PkSearchMode search_mode;
PkActionMode action;
- PkPackageList *package_list;
+ GPtrArray *package_list;
GtkWidget *image_status;
GpkHelperRepoSignature *helper_repo_signature;
GpkHelperEula *helper_eula;
@@ -454,7 +454,6 @@ static gboolean
gpk_application_install (GpkApplication *application)
{
gboolean ret;
- PkPackageId *id;
gchar *package_id_selected = NULL;
gchar *summary_selected = NULL;
@@ -472,7 +471,7 @@ gpk_application_install (GpkApplication *application)
ret = pk_package_list_contains (application->priv->package_list, package_id_selected);
if (ret) {
egg_debug ("removed %s from package list", package_id_selected);
- pk_package_list_remove (application->priv->package_list, package_id_selected);
+ g_ptr_array_remove (application->priv->package_list, package_id_selected);
/* correct buttons */
gpk_application_allow_install (application, FALSE);
@@ -496,9 +495,7 @@ gpk_application_install (GpkApplication *application)
application->priv->action = PK_ACTION_INSTALL;
/* add to list */
- id = pk_package_id_new_from_string (package_id_selected);
- pk_package_list_add (application->priv->package_list, PK_INFO_ENUM_AVAILABLE, id, summary_selected);
- pk_package_id_free (id);
+ g_ptr_array_add_xxxwithrecount (application->priv->package_list, PK_INFO_ENUM_AVAILABLE, package_id_selected, summary_selected);
/* correct buttons */
gpk_application_allow_install (application, FALSE);
@@ -550,14 +547,6 @@ gpk_application_menu_files_cb (GtkAction *action, GpkApplication *application)
goto out;
}
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* set correct view */
package_ids = pk_package_ids_from_id (package_id_selected);
ret = pk_client_get_files (application->priv->client_primary, package_ids, &error);
@@ -578,7 +567,7 @@ static gboolean
gpk_application_remove (GpkApplication *application)
{
gboolean ret;
- PkPackageId *id;
+ gchar *id;
gchar *package_id_selected = NULL;
gchar *summary_selected = NULL;
@@ -596,7 +585,7 @@ gpk_application_remove (GpkApplication *application)
ret = pk_package_list_contains (application->priv->package_list, package_id_selected);
if (ret) {
egg_debug ("removed %s from package list", package_id_selected);
- pk_package_list_remove (application->priv->package_list, package_id_selected);
+ g_ptr_array_remove (application->priv->package_list, package_id_selected);
/* correct buttons */
gpk_application_allow_install (application, TRUE);
@@ -617,9 +606,7 @@ gpk_application_remove (GpkApplication *application)
}
application->priv->action = PK_ACTION_REMOVE;
- id = pk_package_id_new_from_string (package_id_selected);
- pk_package_list_add (application->priv->package_list, PK_INFO_ENUM_AVAILABLE, id, summary_selected);
- pk_package_id_free (id);
+ g_ptr_array_add_xxxwithrecount (application->priv->package_list, PK_INFO_ENUM_AVAILABLE, package_id_selected, summary_selected);
/* correct buttons */
gpk_application_allow_install (application, TRUE);
@@ -707,14 +694,6 @@ gpk_application_menu_requires_cb (GtkAction *action, GpkApplication *application
goto out;
}
- /* cancel any previous request */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to cancel, and adding to queue: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* get the requires */
package_ids = pk_package_ids_from_id (package_id_selected);
#if !PK_CHECK_VERSION(0,5,2)
@@ -750,14 +729,6 @@ gpk_application_menu_depends_cb (GtkAction *action, GpkApplication *application)
goto out;
}
- /* cancel any previous request */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to cancel, and adding to queue: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* get the depends */
package_ids = pk_package_ids_from_id (package_id_selected);
#if !PK_CHECK_VERSION(0,5,2)
@@ -1002,13 +973,12 @@ gpk_application_details_cb (PkClient *client, PkDetailsObj *details, GpkApplicat
* gpk_application_add_obj_to_results:
**/
static void
-gpk_application_add_obj_to_results (GpkApplication *application, const PkPackageObj *obj)
+gpk_application_add_obj_to_results (GpkApplication *application, const PkItemPackage *obj)
{
GtkTreeIter iter;
gchar *summary;
const gchar *icon = NULL;
gchar *text;
- gchar *package_id;
gboolean in_queue;
gboolean installed;
gboolean checkbox;
@@ -1019,13 +989,12 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkPackage
/* format if required */
egg_markdown_set_output (application->priv->markdown, EGG_MARKDOWN_OUTPUT_PANGO);
summary = egg_markdown_parse (application->priv->markdown, obj->summary);
- package_id = pk_package_id_to_string (obj->id);
/* mark as got so we don't warn */
application->priv->has_package = TRUE;
/* are we in the package list? */
- in_queue = pk_package_list_contains (application->priv->package_list, package_id);
+ in_queue = pk_package_list_contains (application->priv->package_list, obj->package_id);
installed = (obj->info == PK_INFO_ENUM_INSTALLED) || (obj->info == PK_INFO_ENUM_COLLECTION_INSTALLED);
if (installed)
@@ -1038,14 +1007,14 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkPackage
pk_bitfield_add (state, GPK_STATE_COLLECTION);
/* use the application icon if available */
- icon = gpk_desktop_guess_icon_name (application->priv->desktop, obj->id->name);
+ icon = gpk_desktop_guess_icon_name (application->priv->desktop, obj->package_id->name);
if (icon == NULL)
icon = gpk_application_state_get_icon (state);
checkbox = gpk_application_state_get_checkbox (state);
/* use two lines */
- text = gpk_package_id_format_twoline (obj->id, summary);
+ text = gpk_package_id_format_twoline (obj->package_id, summary);
/* can we modify this? */
enabled = gpk_application_get_checkbox_enable (application, state);
@@ -1057,7 +1026,7 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkPackage
PACKAGES_COLUMN_CHECKBOX_VISIBLE, enabled,
PACKAGES_COLUMN_TEXT, text,
PACKAGES_COLUMN_SUMMARY, obj->summary,
- PACKAGES_COLUMN_ID, package_id,
+ PACKAGES_COLUMN_ID, obj->package_id,
PACKAGES_COLUMN_IMAGE, icon,
-1);
@@ -1067,7 +1036,6 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkPackage
gtk_main_iteration ();
}
- g_free (package_id);
g_free (summary);
g_free (text);
}
@@ -1076,13 +1044,13 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkPackage
* gpk_application_package_cb:
**/
static void
-gpk_application_package_cb (PkClient *client, const PkPackageObj *obj, GpkApplication *application)
+gpk_application_package_cb (PkClient *client, const PkItemPackage *obj, GpkApplication *application)
{
PkRoleEnum role;
g_return_if_fail (GPK_IS_APPLICATION (application));
- egg_debug ("package = %s:%s:%s", pk_info_enum_to_text (obj->info), obj->id->name, obj->summary);
+ egg_debug ("package = %s:%s:%s", pk_info_enum_to_text (obj->info), obj->package_id->name, obj->summary);
/* ignore not search data */
#if PK_CHECK_VERSION(0,5,1)
@@ -1179,7 +1147,7 @@ gpk_application_suggest_better_search (GpkApplication *application)
* gpk_application_finished_get_depends:
**/
static void
-gpk_application_finished_get_depends (GpkApplication *application, PkPackageList *list)
+gpk_application_finished_get_depends (GpkApplication *application, GPtrArray *list)
{
GtkWindow *window;
gchar *name = NULL;
@@ -1200,7 +1168,7 @@ gpk_application_finished_get_depends (GpkApplication *application, PkPackageList
/* empty list */
window = GTK_WINDOW (gtk_builder_get_object (application->priv->builder, "window_manager"));
- if (pk_package_list_get_size (list) == 0) {
+ if (xxxarray- (list) == 0) {
gpk_error_dialog_modal (window,
/* TRANSLATORS: no packages returned */
_("No packages"),
@@ -1209,7 +1177,7 @@ gpk_application_finished_get_depends (GpkApplication *application, PkPackageList
goto out;
}
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
package_ids = pk_package_ids_from_id (package_id_selected);
name = gpk_dialog_package_id_name_join_locale (package_ids);
/* TRANSLATORS: title: show the number of other packages we depend on */
@@ -1241,7 +1209,7 @@ out:
* gpk_application_finished_get_requires:
**/
static void
-gpk_application_finished_get_requires (GpkApplication *application, PkPackageList *list)
+gpk_application_finished_get_requires (GpkApplication *application, GPtrArray *list)
{
GtkWindow *window;
gchar *name = NULL;
@@ -1262,7 +1230,7 @@ gpk_application_finished_get_requires (GpkApplication *application, PkPackageLis
/* empty list */
window = GTK_WINDOW (gtk_builder_get_object (application->priv->builder, "window_manager"));
- if (pk_package_list_get_size (list) == 0) {
+ if (xxxarray- (list) == 0) {
gpk_error_dialog_modal (window,
/* TRANSLATORS: no packages returned */
_("No packages"),
@@ -1271,7 +1239,7 @@ gpk_application_finished_get_requires (GpkApplication *application, PkPackageLis
goto out;
}
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
package_ids = pk_package_ids_from_id (package_id_selected);
name = gpk_dialog_package_id_name_join_locale (package_ids);
/* TRANSLATORS: title: how many packages require this package */
@@ -1310,24 +1278,6 @@ gpk_application_perform_search_idle_cb (GpkApplication *application)
}
/**
- * gpk_application_primary_requeue:
- **/
-static gboolean
-gpk_application_primary_requeue (GpkApplication *application)
-{
- gboolean ret;
- GError *error = NULL;
-
- /* retry new action */
- ret = pk_client_requeue (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("Failed to requeue: %s", error->message);
- g_error_free (error);
- }
- return ret;
-}
-
-/**
* gpk_application_select_exact_match:
*
* NOTE: we have to do this in the finished_cb, as if we do this as we return
@@ -1343,7 +1293,7 @@ gpk_application_select_exact_match (GpkApplication *application, const gchar *te
GtkTreeModel *model;
GtkTreeSelection *selection = NULL;
gchar *package_id;
- PkPackageId *id;
+ gchar *id;
g_return_if_fail (GPK_IS_APPLICATION (application));
@@ -1358,7 +1308,7 @@ gpk_application_select_exact_match (GpkApplication *application, const gchar *te
if (package_id != NULL) {
/* exact match, so select and scroll */
- id = pk_package_id_new_from_string (package_id);
+ id = xxxnotneededanymore (package_id);
if (g_strcmp0 (id->name, text) == 0) {
selection = gtk_tree_view_get_selection (treeview);
gtk_tree_selection_select_iter (selection, &iter);
@@ -1366,7 +1316,7 @@ gpk_application_select_exact_match (GpkApplication *application, const gchar *te
gtk_tree_view_scroll_to_cell (treeview, path, NULL, FALSE, 0.5f, 0.5f);
gtk_tree_path_free (path);
}
- pk_package_id_free (id);
+ g_free (id);
/* no point continuing for a second match */
if (selection != NULL)
@@ -1386,8 +1336,8 @@ gpk_application_run_installed (GpkApplication *application)
{
guint i;
guint len;
- PkPackageList *list;
- const PkPackageObj *obj;
+ GPtrArray *list;
+ const PkItemPackage *obj;
GPtrArray *array;
gchar **package_ids = NULL;
@@ -1396,9 +1346,9 @@ gpk_application_run_installed (GpkApplication *application)
list = pk_client_get_package_list (application->priv->client_primary);
len = PK_OBJ_LIST (list)->len;
for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
if (obj->info == PK_INFO_ENUM_INSTALLING)
- g_ptr_array_add (array, pk_package_id_to_string (obj->id));
+ g_ptr_array_add (array, g_strdup (obj->package_id));
}
/* nothing to show */
@@ -1426,7 +1376,7 @@ gpk_application_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runti
{
GtkWidget *widget;
PkRoleEnum role;
- PkPackageList *list;
+ GPtrArray *list;
g_return_if_fail (GPK_IS_APPLICATION (application));
@@ -1639,14 +1589,6 @@ gpk_application_perform_search_name_details_file (GpkApplication *application)
}
egg_debug ("find %s", application->priv->search_text);
- /* reset */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to reset client: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
-
/* do the search */
if (application->priv->search_type == PK_SEARCH_NAME) {
ret = pk_client_search_name (application->priv->client_primary,
@@ -1692,14 +1634,6 @@ gpk_application_perform_search_others (GpkApplication *application)
g_return_val_if_fail (GPK_IS_APPLICATION (application), FALSE);
g_return_val_if_fail (application->priv->group != NULL, FALSE);
- /* cancel this, we don't care about old results that are pending */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to reset client: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
-
if (application->priv->search_mode == PK_MODE_GROUP) {
ret = pk_client_search_group (application->priv->client_primary,
application->priv->filters_current,
@@ -1731,8 +1665,8 @@ gpk_application_populate_selected (GpkApplication *application)
{
guint i;
guint len;
- PkPackageList *list;
- const PkPackageObj *obj;
+ GPtrArray *list;
+ const PkItemPackage *obj;
list = application->priv->package_list;
len = PK_OBJ_LIST (list)->len;
@@ -1745,7 +1679,7 @@ gpk_application_populate_selected (GpkApplication *application)
/* dump queue to package window */
for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
gpk_application_add_obj_to_results (application, obj);
}
out:
@@ -2022,14 +1956,6 @@ gpk_application_button_apply_cb (GtkWidget *widget, GpkApplication *application)
package_ids = pk_package_list_to_strv (application->priv->package_list);
if (application->priv->action == PK_ACTION_INSTALL) {
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to cancel: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install */
#if PK_CHECK_VERSION(0,5,2)
ret = pk_client_simulate_install_packages (application->priv->client_primary, package_ids, &error);
@@ -2048,13 +1974,6 @@ gpk_application_button_apply_cb (GtkWidget *widget, GpkApplication *application)
gtk_widget_set_sensitive (widget, FALSE);
}
if (application->priv->action == PK_ACTION_REMOVE) {
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to cancel: %s", error->message);
- g_error_free (error);
- goto out;
- }
/* install */
#if !PK_CHECK_VERSION(0,5,2)
@@ -2259,14 +2178,6 @@ gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkAp
widget = GTK_WIDGET (gtk_builder_get_object (application->priv->builder, "menuitem_run"));
gtk_widget_set_sensitive (widget, ret);
- /* cancel any previous request */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to cancel, and adding to queue: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* get the details */
package_ids = pk_package_ids_from_id (package_id);
ret = pk_client_get_details (application->priv->client_primary, package_ids, &error);
@@ -2664,14 +2575,6 @@ gpk_application_menu_refresh_cb (GtkAction *action, GpkApplication *application)
g_return_if_fail (GPK_IS_APPLICATION (application));
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* set correct view */
ret = pk_client_refresh_cache (application->priv->client_primary, TRUE, &error);
if (!ret) {
@@ -3038,14 +2941,6 @@ gpk_application_repo_signature_event_cb (GpkHelperRepoSignature *helper_repo_sig
goto out;
}
- /* reset client */
- ret = pk_client_reset (application->priv->client_secondary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install signature */
ret = pk_client_install_signature (application->priv->client_secondary, PK_SIGTYPE_ENUM_GPG, key_id, package_id, &error);
if (!ret) {
@@ -3070,14 +2965,6 @@ gpk_application_eula_event_cb (GpkHelperEula *helper_eula, GtkResponseType type,
goto out;
}
- /* reset client */
- ret = pk_client_reset (application->priv->client_secondary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install signature */
ret = pk_client_accept_eula (application->priv->client_secondary, eula_id, &error);
if (!ret) {
@@ -3104,14 +2991,6 @@ gpk_application_deps_remove_event_cb (GpkHelperDepsRemove *helper_deps_remove, G
goto out;
}
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* actually remove packages this time */
package_ids = pk_package_list_to_strv (application->priv->package_list);
ret = pk_client_remove_packages (application->priv->client_primary, package_ids, TRUE, FALSE, &error);
@@ -3143,14 +3022,6 @@ gpk_application_deps_install_event_cb (GpkHelperDepsInstall *helper_deps_install
goto out;
}
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* actually remove packages this time */
package_ids = pk_package_list_to_strv (application->priv->package_list);
#if PK_CHECK_VERSION(0,5,0)
@@ -3547,18 +3418,8 @@ gpk_application_create_group_list_categories (GpkApplication *application)
goto out;
}
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* get categories supported */
- pk_client_set_synchronous (application->priv->client_primary, TRUE, NULL);
ret = pk_client_get_categories (application->priv->client_primary, &error);
- pk_client_set_synchronous (application->priv->client_primary, FALSE, NULL);
if (!ret) {
egg_warning ("failed to get categories: %s", error->message);
g_error_free (error);
@@ -3617,7 +3478,7 @@ gpk_application_files_cb (PkClient *client, const gchar *package_id,
gchar *title;
GtkWindow *window;
GtkWidget *dialog;
- PkPackageId *id;
+ gchar *id;
gchar *package_id_selected = NULL;
gboolean ret;
@@ -3637,7 +3498,7 @@ gpk_application_files_cb (PkClient *client, const gchar *package_id,
g_ptr_array_sort (array, (GCompareFunc) gpk_application_strcmp_indirect);
/* title */
- id = pk_package_id_new_from_string (package_id_selected);
+ id = xxxnotneededanymore (package_id_selected);
/* TRANSLATORS: title: how many files are installed by the application */
title = g_strdup_printf (ngettext ("%i file installed by %s",
"%i files installed by %s",
@@ -3657,7 +3518,7 @@ gpk_application_files_cb (PkClient *client, const gchar *package_id,
g_ptr_array_foreach (array, (GFunc) g_free, NULL);
g_ptr_array_free (array, TRUE);
g_strfreev (files);
- pk_package_id_free (id);
+ g_free (id);
out:
g_free (package_id_selected);
}
@@ -3692,7 +3553,7 @@ gpk_application_init (GpkApplication *application)
application->priv->details_event_id = 0;
application->priv->status_id = 0;
application->priv->status_last = PK_STATUS_ENUM_UNKNOWN;
- application->priv->package_list = pk_package_list_new ();
+ application->priv->package_list = g_ptr_array_new_with_free_func_xxx ();
application->priv->gconf_client = gconf_client_get_default ();
application->priv->repos = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -3741,7 +3602,6 @@ gpk_application_init (GpkApplication *application)
/* this is what we use mainly */
application->priv->client_primary = pk_client_new ();
- pk_client_set_use_buffer (application->priv->client_primary, TRUE, NULL);
g_signal_connect (application->priv->client_primary, "files",
G_CALLBACK (gpk_application_files_cb), application);
g_signal_connect (application->priv->client_primary, "package",
@@ -4213,14 +4073,6 @@ gpk_application_init (GpkApplication *application)
if (!ret)
gpk_application_create_group_list_enum (application);
- /* reset client */
- ret = pk_client_reset (application->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out_build;
- }
-
/* get repos, so we can show the full name in the software source box */
ret = pk_client_get_repo_list (application->priv->client_primary, PK_FILTER_ENUM_NONE, &error);
if (!ret) {
diff --git a/src/gpk-auto-refresh.c b/src/gpk-auto-refresh.c
index 7711f00..0a730c1 100644
--- a/src/gpk-auto-refresh.c
+++ b/src/gpk-auto-refresh.c
@@ -34,7 +34,7 @@
#endif /* HAVE_UNISTD_H */
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <devkit-power-gobject/devicekit-power.h>
#include "egg-debug.h"
diff --git a/src/gpk-backend-status.c b/src/gpk-backend-status.c
index eb2aa21..dc0de24 100644
--- a/src/gpk-backend-status.c
+++ b/src/gpk-backend-status.c
@@ -21,16 +21,16 @@
#include "config.h"
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
+//#include <errno.h>
+#include <locale.h>
+//#include <string.h>
+//#include <unistd.h>
#include <stdlib.h>
-#include <glib.h>
+//#include <glib.h>
#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
+//#include <dbus/dbus-glib.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
-#include <locale.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
@@ -96,7 +96,6 @@ main (int argc, char *argv[])
if (! g_thread_supported ()) {
g_thread_init (NULL);
}
- dbus_g_thread_init ();
g_type_init ();
context = g_option_context_new (NULL);
@@ -116,17 +115,21 @@ main (int argc, char *argv[])
loop = g_main_loop_new (NULL, FALSE);
control = pk_control_new ();
- roles = pk_control_get_actions (control, NULL);
- filters = pk_control_get_filters (control, NULL);
-
- /* general stuff */
- ret = pk_control_get_backend_detail (control, &name, &author, NULL);
+ ret = pk_control_get_properties_sync (control, &error);
if (!ret) {
/* TRANSLATORS: backend is broken, and won't tell us what it supports */
egg_warning (_("Exiting as backend details could not be retrieved"));
return 1;
}
+ /* get values */
+ g_object_get (control,
+ "roles", &roles,
+ "filters", &filters,
+ "backend-name", &name,
+ "backend-author", &author,
+ NULL);
+
/* get UI */
builder = gtk_builder_new ();
retval = gtk_builder_add_from_file (builder, GPK_DATA "/gpk-backend-status.ui", &error);
@@ -152,8 +155,6 @@ main (int argc, char *argv[])
gtk_label_set_label (GTK_LABEL (widget), name);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_author"));
gtk_label_set_label (GTK_LABEL (widget), author);
- g_free (name);
- g_free (author);
/* actions */
if (pk_bitfield_contain (roles, PK_ROLE_ENUM_CANCEL)) {
@@ -282,6 +283,9 @@ main (int argc, char *argv[])
}
out_build:
+ g_free (name);
+ g_free (author);
+
g_object_unref (builder);
g_object_unref (control);
diff --git a/src/gpk-cell-renderer-info.c b/src/gpk-cell-renderer-info.c
index 16a3a7d..80cc8cd 100644
--- a/src/gpk-cell-renderer-info.c
+++ b/src/gpk-cell-renderer-info.c
@@ -24,7 +24,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
diff --git a/src/gpk-cell-renderer-info.h b/src/gpk-cell-renderer-info.h
index ec20ca0..b088571 100644
--- a/src/gpk-cell-renderer-info.h
+++ b/src/gpk-cell-renderer-info.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#define GPK_TYPE_CELL_RENDERER_INFO (gpk_cell_renderer_info_get_type())
#define GPK_CELL_RENDERER_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPK_TYPE_CELL_RENDERER_INFO, GpkCellRendererInfo))
diff --git a/src/gpk-cell-renderer-restart.c b/src/gpk-cell-renderer-restart.c
index 83f5209..8c6d4aa 100644
--- a/src/gpk-cell-renderer-restart.c
+++ b/src/gpk-cell-renderer-restart.c
@@ -24,7 +24,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
diff --git a/src/gpk-cell-renderer-restart.h b/src/gpk-cell-renderer-restart.h
index 0b1edfa..edd418a 100644
--- a/src/gpk-cell-renderer-restart.h
+++ b/src/gpk-cell-renderer-restart.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#define GPK_TYPE_CELL_RENDERER_RESTART (gpk_cell_renderer_restart_get_type())
#define GPK_CELL_RENDERER_RESTART(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPK_TYPE_CELL_RENDERER_RESTART, GpkCellRendererRestart))
diff --git a/src/gpk-check-update.c b/src/gpk-check-update.c
index d8a652f..e6c723d 100644
--- a/src/gpk-check-update.c
+++ b/src/gpk-check-update.c
@@ -37,7 +37,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <libnotify/notify.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <canberra-gtk.h>
#include "egg-debug.h"
@@ -346,13 +346,6 @@ gpk_check_update_update_system (GpkCheckUpdate *cupdate)
gboolean ret;
GError *error = NULL;
- ret = pk_client_reset (cupdate->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
#if PK_CHECK_VERSION(0,5,0)
ret = pk_client_update_system (cupdate->priv->client_primary, TRUE, &error);
#else
@@ -432,13 +425,6 @@ gpk_check_update_libnotify_cb (NotifyNotification *notification, gchar *action,
}
} else if (g_strcmp0 (action, "update-just-security") == 0) {
- ret = pk_client_reset (cupdate->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* just update the important updates */
package_ids = pk_package_ids_from_array (cupdate->priv->important_updates_array);
#if PK_CHECK_VERSION(0,5,0)
@@ -564,28 +550,28 @@ gpk_check_update_critical_updates_warning (GpkCheckUpdate *cupdate, const gchar
* gpk_check_update_client_info_to_bitfield:
**/
static PkBitfield
-gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, PkPackageList *list)
+gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, GPtrArray *list)
{
guint i;
guint length;
PkBitfield infos = 0;
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), PK_INFO_ENUM_UNKNOWN);
/* shortcut */
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
if (length == 0)
return PK_INFO_ENUM_UNKNOWN;
/* add each status to a list */
for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
if (obj == NULL) {
egg_warning ("not found obj %i", i);
break;
}
- egg_debug ("%s %s", obj->id->name, pk_info_enum_to_text (obj->info));
+ egg_debug ("%s %s", obj->package_id->name, pk_info_enum_to_text (obj->info));
pk_bitfield_add (infos, obj->info);
}
return infos;
@@ -595,7 +581,7 @@ gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, PkPackageList
* gpk_check_update_get_best_update_icon:
**/
static const gchar *
-gpk_check_update_get_best_update_icon (GpkCheckUpdate *cupdate, PkPackageList *list)
+gpk_check_update_get_best_update_icon (GpkCheckUpdate *cupdate, GPtrArray *list)
{
gint value;
PkBitfield infos;
@@ -718,13 +704,6 @@ gpk_check_update_query_updates (GpkCheckUpdate *cupdate, gboolean policy_action)
goto out;
}
- ret = pk_client_reset (cupdate->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
ret = pk_client_get_updates (cupdate->priv->client_primary, PK_FILTER_ENUM_NONE, &error);
if (!ret) {
egg_warning ("cannot get updates: %s", error->message);
@@ -791,9 +770,9 @@ gpk_check_update_policy_all_idle_cb (GpkCheckUpdate *cupdate)
* gpk_check_update_process_updates:
**/
static gboolean
-gpk_check_update_process_updates (GpkCheckUpdate *cupdate, PkPackageList *list, gboolean policy_action)
+gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboolean policy_action)
{
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
guint length;
guint i;
guint more;
@@ -823,7 +802,7 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, PkPackageList *list,
security_array = g_ptr_array_new ();
/* find packages */
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
egg_debug ("length=%i", length);
/* we have no updates */
@@ -835,23 +814,22 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, PkPackageList *list,
/* find the security updates first */
for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
if (obj->info == PK_INFO_ENUM_SECURITY) {
/* add to array */
- package_id = pk_package_id_to_string (obj->id);
- g_ptr_array_add (security_array, package_id);
+ g_ptr_array_add (security_array, g_strdup (obj->package_id));
}
}
/* get the security update text */
for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
if (obj->info != PK_INFO_ENUM_SECURITY)
continue;
/* don't use a huge notification that won't fit on the screen */
g_string_append_printf (status_security, "<b>%s</b> - %s\n",
- obj->id->name, obj->summary);
+ obj->package_id->name, obj->summary);
if (++showing == GPK_CHECK_UPDATE_MAX_NUMBER_SECURITY_ENTRIES) {
more = security_array->len - showing;
/* TRANSLATORS: we have a notification that won't fit, so append on how many other we are not showing */
@@ -938,13 +916,6 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, PkPackageList *list,
goto out;
}
- ret = pk_client_reset (cupdate->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* convert */
package_ids = pk_package_ids_from_array (security_array);
#if PK_CHECK_VERSION(0,5,0)
@@ -1080,13 +1051,6 @@ gpk_check_update_auto_refresh_cache_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate
g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
- ret = pk_client_reset (cupdate->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
ret = pk_client_refresh_cache (cupdate->priv->client_primary, TRUE, &error);
if (!ret) {
egg_warning ("cannot refresh cache: %s", error->message);
@@ -1119,13 +1083,6 @@ gpk_check_update_auto_get_upgrades_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate
gboolean ret;
GError *error = NULL;
- ret = pk_client_reset (cupdate->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
ret = pk_client_get_distro_upgrades (cupdate->priv->client_primary, &error);
if (!ret) {
egg_warning ("cannot get updates: %s", error->message);
@@ -1283,14 +1240,6 @@ gpk_check_update_repo_signature_event_cb (GpkHelperRepoSignature *helper_repo_si
goto out;
}
- /* reset client */
- ret = pk_client_reset (cupdate->priv->client_secondary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install signature */
ret = pk_client_install_signature (cupdate->priv->client_secondary, PK_SIGTYPE_ENUM_GPG, key_id, package_id, &error);
if (!ret) {
@@ -1349,15 +1298,15 @@ gpk_check_update_finished_notify (GpkCheckUpdate *cupdate, PkClient *client)
PkRestartEnum restart;
guint i;
guint length;
- PkPackageList *list;
- const PkPackageObj *obj;
+ GPtrArray *list;
+ const PkItemPackage *obj;
GString *message_text;
guint skipped_number = 0;
const gchar *message;
/* check we got some packages */
list = pk_client_get_package_list (client);
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
egg_debug ("length=%i", length);
if (length == 0) {
egg_debug ("no updates");
@@ -1368,13 +1317,13 @@ gpk_check_update_finished_notify (GpkCheckUpdate *cupdate, PkClient *client)
/* find any we skipped */
for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
egg_debug ("%s, %s, %s", pk_info_enum_to_text (obj->info),
- obj->id->name, obj->summary);
+ obj->package_id->name, obj->summary);
if (obj->info == PK_INFO_ENUM_BLOCKED) {
skipped_number++;
g_string_append_printf (message_text, "<b>%s</b> - %s\n",
- obj->id->name, obj->summary);
+ obj->package_id->name, obj->summary);
}
}
g_object_unref (list);
@@ -1445,7 +1394,7 @@ static void
gpk_check_update_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime, GpkCheckUpdate *cupdate)
{
PkRoleEnum role;
- PkPackageList *list;
+ GPtrArray *list;
PkObjList *array;
pk_client_get_role (client, &role, NULL, NULL);
@@ -1563,7 +1512,6 @@ gpk_check_update_init (GpkCheckUpdate *cupdate)
/* use an asynchronous query object */
cupdate->priv->client_primary = pk_client_new ();
- pk_client_set_use_buffer (cupdate->priv->client_primary, TRUE, NULL);
g_signal_connect (cupdate->priv->client_primary, "finished",
G_CALLBACK (gpk_check_update_finished_cb), cupdate);
g_signal_connect (cupdate->priv->client_primary, "error-code",
diff --git a/src/gpk-common.c b/src/gpk-common.c
index 3a331d3..ed073a7 100644
--- a/src/gpk-common.c
+++ b/src/gpk-common.c
@@ -29,7 +29,7 @@
#include <sys/types.h>
#include <gtk/gtk.h>
#include <dbus/dbus-glib.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <locale.h>
#include "egg-debug.h"
@@ -276,7 +276,7 @@ gpk_window_set_parent_xid (GtkWindow *window, guint32 xid)
* Return value: "<b>GTK Toolkit</b>\ngtk2-2.12.2 (i386)"
**/
gchar *
-gpk_package_id_format_twoline (const PkPackageId *id, const gchar *summary)
+gpk_package_id_format_twoline (const gchar *id, const gchar *summary)
{
gchar *summary_safe;
gchar *text;
@@ -310,7 +310,7 @@ gpk_package_id_format_twoline (const PkPackageId *id, const gchar *summary)
* Return value: "<b>GTK Toolkit</b> (gtk2)"
**/
gchar *
-gpk_package_id_format_oneline (const PkPackageId *id, const gchar *summary)
+gpk_package_id_format_oneline (const gchar *id, const gchar *summary)
{
gchar *summary_safe;
gchar *text;
@@ -330,7 +330,7 @@ gpk_package_id_format_oneline (const PkPackageId *id, const gchar *summary)
* gpk_package_id_name_version:
**/
gchar *
-gpk_package_id_name_version (const PkPackageId *id)
+gpk_package_id_name_version (const gchar *id)
{
gchar *text;
GString *string;
@@ -353,17 +353,17 @@ gchar *
gpk_package_get_name (const gchar *package_id)
{
gchar *package = NULL;
- PkPackageId *id;
+ gchar *id;
- /* pk_package_id_new_from_string can't accept NULL */
+ /* xxxnotneededanymore can't accept NULL */
if (package_id == NULL)
return NULL;
- id = pk_package_id_new_from_string (package_id);
+ id = xxxnotneededanymore (package_id);
if (id == NULL)
package = g_strdup (package_id);
else
package = g_strdup (id->name);
- pk_package_id_free (id);
+ g_free (id);
return package;
}
@@ -620,11 +620,11 @@ gpk_strv_join_locale (gchar **array)
static GtkTreeModel *
gpk_package_entry_completion_model_new (void)
{
- PkPackageList *list;
+ GPtrArray *list;
guint i;
guint length;
gboolean ret;
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
GHashTable *hash;
gpointer data;
GtkListStore *store;
@@ -632,27 +632,27 @@ gpk_package_entry_completion_model_new (void)
store = gtk_list_store_new (1, G_TYPE_STRING);
hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- list = pk_package_list_new ();
+ list = g_ptr_array_new_with_free_func_xxx ();
ret = pk_obj_list_from_file (PK_OBJ_LIST(list), PK_SYSTEM_PACKAGE_LIST_FILENAME);
if (!ret) {
egg_warning ("no package list, try refreshing");
return NULL;
}
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
egg_debug ("loading %i autocomplete items", length);
for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
- if (obj == NULL || obj->id == NULL || obj->id->name == NULL) {
+ obj = g_ptr_array_index (list, i);
+ if (obj == NULL || obj->package_id == NULL || obj->package_id->name == NULL) {
egg_warning ("obj invalid!");
break;
}
- data = g_hash_table_lookup (hash, (gpointer) obj->id->name);
+ data = g_hash_table_lookup (hash, (gpointer) obj->package_id->name);
if (data == NULL) {
/* append just the name */
- g_hash_table_insert (hash, g_strdup (obj->id->name), GINT_TO_POINTER (1));
+ g_hash_table_insert (hash, g_strdup (obj->package_id->name), GINT_TO_POINTER (1));
gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, obj->id->name, -1);
+ gtk_list_store_set (store, &iter, 0, obj->package_id->name, -1);
}
}
g_hash_table_unref (hash);
@@ -730,7 +730,7 @@ void
gpk_common_test (gpointer data)
{
gchar *text;
- PkPackageId *id;
+ gchar *id;
EggTest *test = (EggTest *) data;
if (!egg_test_start (test, "GpkCommon"))
@@ -869,9 +869,9 @@ gpk_common_test (gpointer data)
**************** package name text **************
************************************************************/
egg_test_title (test, "package id pretty valid package id, no summary");
- id = pk_package_id_new_from_string ("simon;0.0.1;i386;data");
+ id = xxxnotneededanymore ("simon;0.0.1;i386;data");
text = gpk_package_id_format_twoline (id, NULL);
- pk_package_id_free (id);
+ g_free (id);
if (text != NULL && strcmp (text, "simon-0.0.1 (i386)") == 0)
egg_test_success (test, NULL);
else
@@ -880,9 +880,9 @@ gpk_common_test (gpointer data)
/************************************************************/
egg_test_title (test, "package id pretty valid package id, no summary 2");
- id = pk_package_id_new_from_string ("simon;0.0.1;;data");
+ id = xxxnotneededanymore ("simon;0.0.1;;data");
text = gpk_package_id_format_twoline (id, NULL);
- pk_package_id_free (id);
+ g_free (id);
if (text != NULL && strcmp (text, "simon-0.0.1") == 0)
egg_test_success (test, NULL);
else
@@ -891,9 +891,9 @@ gpk_common_test (gpointer data)
/************************************************************/
egg_test_title (test, "package id pretty valid package id, no summary 3");
- id = pk_package_id_new_from_string ("simon;;;data");
+ id = xxxnotneededanymore ("simon;;;data");
text = gpk_package_id_format_twoline (id, NULL);
- pk_package_id_free (id);
+ g_free (id);
if (text != NULL && strcmp (text, "simon") == 0)
egg_test_success (test, NULL);
else
@@ -902,9 +902,9 @@ gpk_common_test (gpointer data)
/************************************************************/
egg_test_title (test, "package id pretty valid package id, no summary 4");
- id = pk_package_id_new_from_string ("simon;0.0.1;;data");
+ id = xxxnotneededanymore ("simon;0.0.1;;data");
text = gpk_package_id_format_twoline (id, "dude");
- pk_package_id_free (id);
+ g_free (id);
if (text != NULL && strcmp (text, "<b>dude</b>\nsimon-0.0.1") == 0)
egg_test_success (test, NULL);
else
diff --git a/src/gpk-common.h b/src/gpk-common.h
index e2e71f0..dad1fe8 100644
--- a/src/gpk-common.h
+++ b/src/gpk-common.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "gpk-animated-icon.h"
#include "gpk-enum.h"
@@ -94,11 +94,11 @@ void gtk_text_buffer_insert_markup (GtkTextBuffer *buffer,
GtkTextIter *iter,
const gchar *markup);
gchar *gpk_package_get_name (const gchar *package_id);
-gchar *gpk_package_id_format_twoline (const PkPackageId *id,
+gchar *gpk_package_id_format_twoline (const gchar *id,
const gchar *summary);
-gchar *gpk_package_id_format_oneline (const PkPackageId *id,
+gchar *gpk_package_id_format_oneline (const gchar *id,
const gchar *summary);
-gchar *gpk_package_id_name_version (const PkPackageId *id);
+gchar *gpk_package_id_name_version (const gchar *id);
gchar *gpk_time_to_localised_string (guint time_secs);
gchar *gpk_time_to_imprecise_string (guint time_secs);
diff --git a/src/gpk-dbus-task.c b/src/gpk-dbus-task.c
index 7f86fa5..46f9976 100644
--- a/src/gpk-dbus-task.c
+++ b/src/gpk-dbus-task.c
@@ -32,7 +32,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <libnotify/notify.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
@@ -208,14 +208,6 @@ gpk_dbus_task_repo_signature_event_cb (GpkHelperRepoSignature *helper_repo_signa
goto out;
}
- /* reset client */
- ret = pk_client_reset (task->priv->client_secondary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install signature */
ret = pk_client_install_signature (task->priv->client_secondary, PK_SIGTYPE_ENUM_GPG, key_id, package_id, &error);
if (!ret) {
@@ -240,14 +232,6 @@ gpk_dbus_task_eula_event_cb (GpkHelperEula *helper_eula, GtkResponseType type, c
goto out;
}
- /* reset client */
- ret = pk_client_reset (task->priv->client_secondary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install signature */
ret = pk_client_accept_eula (task->priv->client_secondary, eula_id, &error);
if (!ret) {
@@ -463,16 +447,6 @@ gpk_dbus_task_install_package_ids (GpkDbusTask *task)
if (task->priv->show_progress)
gpk_modal_dialog_present (task->priv->dialog);
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this should never happen, low level failure */
- gpk_dbus_task_error_msg (task, _("Failed to reset client to perform action"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -544,16 +518,6 @@ gpk_dbus_task_install_package_ids_dep_check (GpkDbusTask *task)
if (task->priv->show_progress)
gpk_modal_dialog_present (task->priv->dialog);
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this is an internal error, and should not be seen */
- gpk_dbus_task_error_msg (task, _("Failed to reset client"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -655,13 +619,13 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
const gchar *name = NULL;
GError *error = NULL;
GError *error_local = NULL;
- PkPackageList *list = NULL;
- const PkPackageObj *obj;
+ GPtrArray *list = NULL;
+ const PkItemPackage *obj;
gboolean already_installed = FALSE;
gchar *title = NULL;
gchar *message = NULL;
gchar *text = NULL;
- PkPackageId *id = NULL;
+ gchar *id = NULL;
gchar *info_url = NULL;
GtkResponseType button;
gchar *package_id = NULL;
@@ -739,7 +703,7 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
/* found nothing? */
list = pk_client_get_package_list (task->priv->client_primary);
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
if (len == 0) {
if (task->priv->show_warning) {
info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_MIME);
@@ -776,7 +740,7 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
role == PK_ROLE_ENUM_SEARCH_FILE) {
/* found nothing? */
list = pk_client_get_package_list (task->priv->client_primary);
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
if (len == 0) {
if (task->priv->show_warning) {
info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_DEFAULT);
@@ -805,13 +769,13 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
/* see what we've got already */
for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
if (obj->info == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
- id = obj->id;
+ id = obj->package_id;
} else if (obj->info == PK_INFO_ENUM_AVAILABLE) {
- egg_debug ("package '%s' resolved to:", obj->id->name);
- id = obj->id;
+ egg_debug ("package '%s' resolved to:", obj->package_id->name);
+ id = obj->package_id;
}
}
@@ -833,11 +797,8 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
goto out;
}
- /* install this specific package */
- package_id = pk_package_id_to_string (id);
/* convert to data */
- task->priv->package_ids = pk_package_ids_from_id (package_id);
- g_free (package_id);
+ task->priv->package_ids = pk_package_ids_from_id (id);
/* install these packages with deps */
g_idle_add ((GSourceFunc) gpk_dbus_task_install_package_ids_dep_check_idle_cb, task);
@@ -851,14 +812,14 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
#else
if (role == PK_ROLE_ENUM_GET_DEPENDS) {
#endif
- PkPackageList *new;
+ GPtrArray *new;
/* these are the new packages */
list = pk_client_get_package_list (task->priv->client_primary);
- new = pk_package_list_new ();
- len = pk_package_list_get_size (list);
+ new = g_ptr_array_new_with_free_func_xxx ();
+ len = xxxarray- (list);
for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
#if PK_CHECK_VERSION(0,5,2)
/* not interesting */
@@ -868,14 +829,14 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
#endif
/* is this package already local */
- if (g_strcmp0 (obj->id->data, "local") == 0)
+ if (g_strcmp0 (obj->package_id->data, "local") == 0)
continue;
- pk_package_list_add (new, obj->info, obj->id, obj->summary);
+ g_ptr_array_add_xxxwithrecount (new, obj->info, obj->package_id, obj->summary);
}
/* these are the new packages */
- len = pk_package_list_get_size (new);
+ len = xxxarray- (new);
if (len == 0) {
egg_debug ("no deps");
goto skip_checks;
@@ -979,7 +940,7 @@ skip_checks:
/* one or more entry? */
len = PK_OBJ_LIST(list)->len;
if (len > 0)
- name = pk_package_list_get_obj (list, 0)->id->name;
+ name = g_ptr_array_index (list, 0)->id->name;
egg_warning ("doing async return");
dbus_g_method_return (task->priv->context, (len > 0), name);
goto out;
@@ -991,7 +952,7 @@ skip_checks:
/* found nothing? */
list = pk_client_get_package_list (task->priv->client_primary);
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
if (len == 0) {
if (task->priv->show_warning) {
//FIXME: shows package_id in UI
@@ -1023,12 +984,12 @@ skip_checks:
/* see what we've got already */
for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
if (obj->info == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
} else if (obj->info == PK_INFO_ENUM_AVAILABLE) {
- egg_debug ("package '%s' resolved", obj->id->name);
- id = obj->id;
+ egg_debug ("package '%s' resolved", obj->package_id->name);
+ id = obj->package_id;
//TODO: we need to list these in a gpk-dbus_task-chooser
}
}
@@ -1224,7 +1185,7 @@ gpk_dbus_task_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar
* gpk_dbus_task_package_cb:
**/
static void
-gpk_dbus_task_package_cb (PkClient *client, const PkPackageObj *obj, GpkDbusTask *task)
+gpk_dbus_task_package_cb (PkClient *client, const PkItemPackage *obj, GpkDbusTask *task)
{
gchar *text;
g_return_if_fail (GPK_IS_DBUS_TASK (task));
@@ -1232,7 +1193,7 @@ gpk_dbus_task_package_cb (PkClient *client, const PkPackageObj *obj, GpkDbusTask
if (!task->priv->show_progress)
return;
- text = gpk_package_id_format_twoline (obj->id, obj->summary);
+ text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
gpk_modal_dialog_set_message (task->priv->dialog, text);
g_free (text);
}
@@ -1298,16 +1259,6 @@ gpk_dbus_task_install_package_files_internal (GpkDbusTask *task, gboolean truste
/* FIXME: we need to move this into PkClient sooner or later */
task->priv->last_exit_code = PK_ERROR_ENUM_UNKNOWN;
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this should never happen, low level failure */
- gpk_dbus_task_error_msg (task, _("Failed to reset client to perform action"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -1899,14 +1850,6 @@ gpk_dbus_task_is_installed (GpkDbusTask *task, const gchar *package_name)
task->priv->role = GPK_DBUS_TASK_ROLE_IS_INSTALLED;
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to reset: %s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -1941,14 +1884,6 @@ gpk_dbus_task_search_file (GpkDbusTask *task, const gchar *search_file)
task->priv->role = GPK_DBUS_TASK_ROLE_SEARCH_FILE;
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to reset: %s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -2031,16 +1966,6 @@ gpk_dbus_task_install_files_dep_check (GpkDbusTask *task)
if (task->priv->show_progress)
gpk_modal_dialog_present (task->priv->dialog);
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this is an internal error, and should not be seen */
- gpk_dbus_task_error_msg (task, _("Failed to reset client"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -2215,16 +2140,6 @@ skip_checks:
if (task->priv->show_progress)
gpk_modal_dialog_present (task->priv->dialog);
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this is an internal error, and should not be seen */
- gpk_dbus_task_error_msg (task, _("Failed to reset client"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -2327,16 +2242,6 @@ skip_checks:
gpk_modal_dialog_set_title (task->priv->dialog, _("Searching for file"));
gpk_modal_dialog_set_image_status (task->priv->dialog, PK_STATUS_ENUM_WAIT);
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this is an internal error, and should not be seen */
- gpk_dbus_task_error_msg (task, _("Failed to reset client"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -2364,21 +2269,16 @@ out:
/**
* gpk_dbus_task_install_gstreamer_codec_part:
**/
-static PkPackageObj *
+static PkItemPackage *
gpk_dbus_task_install_gstreamer_codec_part (GpkDbusTask *task, const gchar *codec_name, const gchar *codec_desc, GError **error)
{
- PkPackageList *list = NULL;
+ GPtrArray *list = NULL;
gboolean ret;
- PkPackageObj *new_obj = NULL;
- const PkPackageObj *obj;
+ PkItemPackage *new_obj = NULL;
+ const PkItemPackage *obj;
guint len;
gchar *title;
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, error);
- if (!ret)
- return NULL;
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -2388,18 +2288,16 @@ gpk_dbus_task_install_gstreamer_codec_part (GpkDbusTask *task, const gchar *code
g_free (title);
/* get codec packages, FIXME: synchronous! */
- pk_client_set_synchronous (task->priv->client_primary, TRUE, NULL);
ret = pk_client_what_provides (task->priv->client_primary,
pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED,
PK_FILTER_ENUM_ARCH,
PK_FILTER_ENUM_NEWEST, -1),
PK_PROVIDES_ENUM_CODEC, codec_desc, error);
- pk_client_set_synchronous (task->priv->client_primary, FALSE, NULL);
if (!ret)
return NULL;
list = pk_client_get_package_list (task->priv->client_primary);
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
/* found nothing? */
if (len == 0) {
@@ -2412,7 +2310,7 @@ gpk_dbus_task_install_gstreamer_codec_part (GpkDbusTask *task, const gchar *code
egg_warning ("choosing one of the provides as more than one match");
/* always use the first one */
- obj = pk_package_list_get_obj (list, 0);
+ obj = g_ptr_array_index (list, 0);
if (obj == NULL)
egg_error ("obj cannot be NULL");
@@ -2538,11 +2436,11 @@ gpk_dbus_task_install_gstreamer_resources (GpkDbusTask *task, gchar **codec_name
GError *error_local = NULL;
guint i;
guint len;
- PkPackageObj *obj_new;
+ PkItemPackage *obj_new;
gchar **parts;
GtkResponseType button;
gchar *info_url;
- PkPackageList *list = NULL;
+ GPtrArray *list = NULL;
const gchar *title;
const gchar *message;
@@ -2580,7 +2478,7 @@ skip_checks:
gpk_modal_dialog_present (task->priv->dialog);
/* save the objects to download in a list */
- list = pk_package_list_new ();
+ list = g_ptr_array_new_with_free_func_xxx ();
len = g_strv_length (codec_names);
for (i=0; i<len; i++) {
@@ -2741,16 +2639,6 @@ skip_checks:
if (task->priv->show_progress)
gpk_modal_dialog_present (task->priv->dialog);
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this is an internal error, and should not be seen */
- gpk_dbus_task_error_msg (task, _("Failed to reset client"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -2873,8 +2761,8 @@ void
gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *task, gchar **fonts)
{
gboolean ret;
- PkPackageList *list = NULL;
- PkPackageList *list_tmp = NULL;
+ GPtrArray *list = NULL;
+ GPtrArray *list_tmp = NULL;
GtkResponseType button;
gchar *info_url;
GError *error = NULL;
@@ -2986,30 +2874,18 @@ skip_checks:
gpk_modal_dialog_present (task->priv->dialog);
/* do each one */
- list = pk_package_list_new ();
+ list = g_ptr_array_new_with_free_func_xxx ();
for (i=0; i<len; i++) {
- /* reset */
- ret = pk_client_reset (task->priv->client_primary, &error_local);
- if (!ret) {
- /* TRANSLATORS: this is an internal error, and should not be seen */
- gpk_dbus_task_error_msg (task, _("Failed to reset client"), error_local);
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error_local->message);
- dbus_g_method_return_error (task->priv->context, error);
- goto out;
- }
-
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
/* action: FIXME: synchronous */
- pk_client_set_synchronous (task->priv->client_primary, TRUE, NULL);
ret = pk_client_what_provides (task->priv->client_primary,
pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED,
PK_FILTER_ENUM_ARCH,
PK_FILTER_ENUM_NEWEST, -1),
PK_PROVIDES_ENUM_FONT, fonts[i], &error_local);
- pk_client_set_synchronous (task->priv->client_primary, FALSE, NULL);
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_dbus_task_error_msg (task, _("Failed to search for provides"), error_local);
@@ -3025,7 +2901,7 @@ skip_checks:
}
/* found nothing? */
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
if (len == 0) {
if (task->priv->show_warning) {
info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_FONT);
@@ -3128,7 +3004,7 @@ gpk_dbus_task_install_catalogs (GpkDbusTask *task, gchar **filenames)
GtkResponseType button;
gchar *message;
const gchar *title;
- PkPackageList *list = NULL;
+ GPtrArray *list = NULL;
PkCatalog *catalog;
guint len;
@@ -3180,7 +3056,7 @@ skip_checks:
g_object_unref (catalog);
/* nothing to do? */
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
if (len == 0) {
/* show UI */
if (task->priv->show_warning) {
@@ -3243,24 +3119,14 @@ gpk_dbus_task_get_package_for_exec (GpkDbusTask *task, const gchar *exec)
gboolean ret;
GError *error = NULL;
guint length;
- PkPackageList *list = NULL;
- const PkPackageObj *obj;
-
- /* reset dbus_task */
- ret = pk_client_reset (task->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
+ GPtrArray *list = NULL;
+ const PkItemPackage *obj;
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
/* find the package name */
- pk_client_set_synchronous (task->priv->client_primary, TRUE, NULL);
ret = pk_client_search_file (task->priv->client_primary, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), exec, &error);
- pk_client_set_synchronous (task->priv->client_primary, FALSE, NULL);
if (!ret) {
egg_warning ("failed to search file: %s", error->message);
g_error_free (error);
@@ -3269,7 +3135,7 @@ gpk_dbus_task_get_package_for_exec (GpkDbusTask *task, const gchar *exec)
/* get the list of packages */
list = pk_client_get_package_list (task->priv->client_primary);
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
/* nothing found */
if (length == 0) {
@@ -3282,8 +3148,8 @@ gpk_dbus_task_get_package_for_exec (GpkDbusTask *task, const gchar *exec)
egg_warning ("not one return, using first");
/* copy name */
- obj = pk_package_list_get_obj (list, 0);
- package = g_strdup (obj->id->name);
+ obj = g_ptr_array_index (list, 0);
+ package = g_strdup (obj->package_id->name);
egg_debug ("got package %s", package);
out:
@@ -3458,7 +3324,6 @@ gpk_dbus_task_init (GpkDbusTask *task)
task->priv->roles = pk_control_get_actions (task->priv->control, NULL);
task->priv->client_primary = pk_client_new ();
- pk_client_set_use_buffer (task->priv->client_primary, TRUE, NULL);
g_signal_connect (task->priv->client_primary, "finished",
G_CALLBACK (gpk_dbus_task_finished_cb), task);
g_signal_connect (task->priv->client_primary, "progress-changed",
diff --git a/src/gpk-dbus-task.h b/src/gpk-dbus-task.h
index 3c1576a..2341a08 100644
--- a/src/gpk-dbus-task.h
+++ b/src/gpk-dbus-task.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <dbus/dbus-glib.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
diff --git a/src/gpk-dbus.c b/src/gpk-dbus.c
index b1f3130..0adb6d5 100644
--- a/src/gpk-dbus.c
+++ b/src/gpk-dbus.c
@@ -38,7 +38,7 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <gconf/gconf-client.h>
#include "egg-debug.h"
diff --git a/src/gpk-desktop.c b/src/gpk-desktop.c
index 4762fc2..a290dde 100644
--- a/src/gpk-desktop.c
+++ b/src/gpk-desktop.c
@@ -24,7 +24,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <locale.h>
#include <string.h>
diff --git a/src/gpk-desktop.h b/src/gpk-desktop.h
index a660341..2e18b2e 100644
--- a/src/gpk-desktop.h
+++ b/src/gpk-desktop.h
@@ -23,7 +23,7 @@
#define __GPK_DESKTOP_H
#include <glib.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
diff --git a/src/gpk-dialog.c b/src/gpk-dialog.c
index 4ccc4ce..d7b5faf 100644
--- a/src/gpk-dialog.c
+++ b/src/gpk-dialog.c
@@ -24,7 +24,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <gconf/gconf-client.h>
#include "egg-debug.h"
@@ -51,20 +51,20 @@ gpk_dialog_package_id_name_join_locale (gchar **package_ids)
guint i;
guint length;
gchar *text;
- PkPackageId *ident;
GPtrArray *array;
gchar **array_strv;
+ gchar **split;
length = g_strv_length (package_ids);
array = g_ptr_array_new ();
for (i=0; i<length; i++) {
- ident = pk_package_id_new_from_string (package_ids[i]);
- if (ident == NULL) {
+ split = pk_package_id_split (package_ids[i]);
+ if (split == NULL) {
egg_warning ("failed to split %s", package_ids[i]);
continue;
}
- g_ptr_array_add (array, g_strdup (ident->name));
- pk_package_id_free (ident);
+ g_ptr_array_add (array, g_strdup (split[0]));
+ g_strfreev (split);
}
array_strv = pk_ptr_array_to_strv (array);
text = gpk_strv_join_locale (array_strv);
@@ -82,39 +82,39 @@ gpk_dialog_package_id_name_join_locale (gchar **package_ids)
* gpk_dialog_package_list_to_list_store:
**/
static GtkListStore *
-gpk_dialog_package_list_to_list_store (PkPackageList *list)
+gpk_dialog_package_list_to_list_store (GPtrArray *list)
{
GtkListStore *store;
GtkTreeIter iter;
- const PkPackageObj *obj;
+ const PkItemPackage *item;
PkDesktop *desktop;
const gchar *icon;
gchar *package_id;
gchar *text;
- guint length;
guint i;
+ gchar **split;
desktop = pk_desktop_new ();
store = gtk_list_store_new (GPK_DIALOG_STORE_LAST, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- length = pk_package_list_get_size (list);
/* add each well */
- for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
- text = gpk_package_id_format_twoline (obj->id, obj->summary);
- package_id = pk_package_id_to_string (obj->id);
+ for (i=0; i<list->len; i++) {
+ item = g_ptr_array_index (list, i);
+ text = gpk_package_id_format_twoline (item->package_id, item->summary);
/* get the icon */
- icon = gpk_desktop_guess_icon_name (desktop, obj->id->name);
+ split = pk_package_id_split (item->package_id);
+ icon = gpk_desktop_guess_icon_name (desktop, split[0]);
if (icon == NULL)
icon = gpk_info_enum_to_icon_name (PK_INFO_ENUM_INSTALLED);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
GPK_DIALOG_STORE_IMAGE, icon,
- GPK_DIALOG_STORE_ID, package_id,
+ GPK_DIALOG_STORE_ID, item->package_id,
GPK_DIALOG_STORE_TEXT, text,
-1);
+ g_strfreev (split);
g_free (text);
g_free (package_id);
}
@@ -170,12 +170,11 @@ gpk_dialog_widget_unrealize_unref_cb (GtkWidget *widget, GObject *obj)
* gpk_dialog_embed_package_list_widget:
**/
gboolean
-gpk_dialog_embed_package_list_widget (GtkDialog *dialog, PkPackageList *list)
+gpk_dialog_embed_package_list_widget (GtkDialog *dialog, GPtrArray *list)
{
GtkWidget *scroll;
GtkListStore *store;
GtkWidget *widget;
- guint length;
const guint row_height = 48;
/* convert to a store */
@@ -196,11 +195,10 @@ gpk_dialog_embed_package_list_widget (GtkDialog *dialog, PkPackageList *list)
gtk_container_set_border_width (GTK_CONTAINER (scroll), 6);
/* only allow more space if there are a large number of items */
- length = pk_package_list_get_size (list);
- if (length > 5) {
+ if (list->len > 5) {
gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, (row_height * 5) + 8);
- } else if (length > 1) {
- gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, (row_height * length) + 8);
+ } else if (list->len > 1) {
+ gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, (row_height * list->len) + 8);
}
/* add scrolled window */
diff --git a/src/gpk-dialog.h b/src/gpk-dialog.h
index 786bfc4..0ca8021 100644
--- a/src/gpk-dialog.h
+++ b/src/gpk-dialog.h
@@ -24,12 +24,12 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
gboolean gpk_dialog_embed_package_list_widget (GtkDialog *dialog,
- PkPackageList *list);
+ GPtrArray *list);
gboolean gpk_dialog_embed_file_list_widget (GtkDialog *dialog,
GPtrArray *files);
gboolean gpk_dialog_embed_do_not_show_widget (GtkDialog *dialog,
diff --git a/src/gpk-enum.c b/src/gpk-enum.c
index 1b145d2..2157a78 100644
--- a/src/gpk-enum.c
+++ b/src/gpk-enum.c
@@ -23,7 +23,7 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
diff --git a/src/gpk-enum.h b/src/gpk-enum.h
index bb47d24..0b19666 100644
--- a/src/gpk-enum.h
+++ b/src/gpk-enum.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007-2008 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2007-2009 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -23,7 +23,7 @@
#define __GPK_ENUM_H
#include <glib-object.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
@@ -55,88 +55,10 @@ typedef enum {
GPK_INFO_ENUM_UNKNOWN
} GpkInfoStatusEnum;
-/* for very old versions of PackageKit */
-#ifndef PK_CHECK_VERSION
-#define PK_CHECK_VERSION(major, minor, micro) 0
-#endif
-
-/* constants defined in 0.4.5 */
-#if (!PK_CHECK_VERSION(0,4,5))
-#define PK_INFO_ENUM_FINISHED (PK_INFO_ENUM_COLLECTION_AVAILABLE + 1)
-#endif
-
-/* constants defined in 0.4.7 */
-#if (!PK_CHECK_VERSION(0,4,7))
-typedef guint PkMediaTypeEnum;
-#define PK_MEDIA_TYPE_ENUM_CD (0)
-#define PK_MEDIA_TYPE_ENUM_DVD (1)
-#define PK_MEDIA_TYPE_ENUM_DISC (2)
-#define PK_MEDIA_TYPE_ENUM_UNKNOWN (3)
-#define PK_EXIT_ENUM_MEDIA_CHANGE_REQUIRED (PK_EXIT_ENUM_KILLED + 1)
-#define PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED (PK_ERROR_ENUM_NO_SPACE_ON_DEVICE + 1)
-#endif
-
-/* constants defined in 0.4.8 */
-#if (!PK_CHECK_VERSION(0,4,8))
-#define PK_ERROR_ENUM_NOT_AUTHORIZED (PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED + 1)
-#endif
-
-/* constants defined in 0.4.9 */
-#if (!PK_CHECK_VERSION(0,4,9))
-#define PK_ERROR_ENUM_UPDATE_NOT_FOUND (PK_ERROR_ENUM_NOT_AUTHORIZED + 1)
-#define PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED (PK_ERROR_ENUM_UPDATE_NOT_FOUND + 1)
-#define PK_ERROR_ENUM_CANNOT_UPDATE_REPO_UNSIGNED (PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED + 1)
-#define PK_STATUS_ENUM_WAITING_FOR_AUTH (PK_STATUS_ENUM_WAITING_FOR_LOCK + 1)
-#undef PK_STATUS_ENUM_UNKNOWN
-#define PK_STATUS_ENUM_UNKNOWN (PK_STATUS_ENUM_WAITING_FOR_AUTH + 1)
-#endif
-
-/* constants defined in 0.5.0 */
-#if (!PK_CHECK_VERSION(0,5,0))
-#define PK_EXIT_ENUM_NEED_UNTRUSTED (PK_EXIT_ENUM_MEDIA_CHANGE_REQUIRED + 1)
-#define PK_ERROR_ENUM_CANNOT_GET_FILELIST (PK_ERROR_ENUM_CANNOT_UPDATE_REPO_UNSIGNED + 1)
-#define PK_ERROR_ENUM_CANNOT_GET_REQUIRES (PK_ERROR_ENUM_CANNOT_GET_FILELIST + 1)
-#define PK_ERROR_ENUM_CANNOT_DISABLE_REPOSITORY (PK_ERROR_ENUM_CANNOT_GET_REQUIRES + 1)
-#endif
-
-/* functions defined in 0.5.0 */
-#if (!PK_CHECK_VERSION(0,5,0))
-#define pk_error_code_is_need_untrusted gpk_error_code_is_need_untrusted
-#define pk_client_set_only_trusted(c,t)
-#endif
-
-/* constants defined in 0.5.1 */
-#if (!PK_CHECK_VERSION(0,5,1))
-#define PK_RESTART_ENUM_SECURITY_SESSION (PK_RESTART_ENUM_SYSTEM + 1)
-#define PK_RESTART_ENUM_SECURITY_SYSTEM (PK_RESTART_ENUM_SECURITY_SESSION + 1)
-#define PK_STATUS_ENUM_SCAN_PROCESS_LIST (PK_STATUS_ENUM_WAITING_FOR_AUTH + 1)
-#define PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES (PK_STATUS_ENUM_SCAN_PROCESS_LIST + 1)
-#define PK_STATUS_ENUM_CHECK_LIBRARIES (PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES + 1)
-#undef PK_STATUS_ENUM_UNKNOWN
-#define PK_STATUS_ENUM_UNKNOWN (PK_STATUS_ENUM_CHECK_LIBRARIES + 1)
-#endif
-
-/* constants defined in 0.5.2 */
-#if (!PK_CHECK_VERSION(0,5,2))
-#define PK_ERROR_ENUM_RESTRICTED_DOWNLOAD (PK_ERROR_ENUM_CANNOT_DISABLE_REPOSITORY + 1)
-#define PK_ERROR_ENUM_PACKAGE_FAILED_TO_CONFIGURE (PK_ERROR_ENUM_RESTRICTED_DOWNLOAD + 1)
-#define PK_ERROR_ENUM_PACKAGE_FAILED_TO_BUILD (PK_ERROR_ENUM_PACKAGE_FAILED_TO_CONFIGURE + 1)
-#define PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL (PK_ERROR_ENUM_PACKAGE_FAILED_TO_BUILD + 1)
-#define PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE (PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL + 1)
-#define PK_MESSAGE_ENUM_AUTOREMOVE_IGNORED (PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED + 1)
-#define PK_MESSAGE_ENUM_REPO_METADATA_DOWNLOAD_FAILED (PK_MESSAGE_ENUM_AUTOREMOVE_IGNORED + 1)
-#define PK_PROVIDES_ENUM_POSTSCRIPT_DRIVER (PK_PROVIDES_ENUM_HARDWARE_DRIVER + 1)
-#define PK_ROLE_ENUM_SIMULATE_INSTALL_FILES (PK_ROLE_ENUM_GET_OLD_TRANSACTIONS + 1)
-#define PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES (PK_ROLE_ENUM_SIMULATE_INSTALL_FILES + 1)
-#define PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES (PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES + 1)
-#define PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES (PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES + 1)
-#undef PK_ROLE_ENUM_UNKNOWN
-#define PK_ROLE_ENUM_UNKNOWN (PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES + 1)
-#undef PK_INFO_ENUM_UNKNOWN
-#define PK_INFO_ENUM_REINSTALLING (PK_INFO_ENUM_FINISHED + 1)
-#define PK_INFO_ENUM_DOWNGRADING (PK_INFO_ENUM_REINSTALLING + 1)
-#define PK_INFO_ENUM_UNKNOWN (PK_INFO_ENUM_DOWNGRADING + 1)
-#endif
+/* constants defined in 0.5.3 */
+//#if (!PK_CHECK_VERSION(0,5,3))
+//#define PK_INFO_ENUM_UNKNOWN (PK_INFO_ENUM_DOWNGRADING + 1)
+//#endif
void gpk_enum_test (gpointer data);
const gchar *gpk_role_enum_to_localised_past (PkRoleEnum role)
diff --git a/src/gpk-error.c b/src/gpk-error.c
index 069b6da..9556770 100644
--- a/src/gpk-error.c
+++ b/src/gpk-error.c
@@ -26,7 +26,7 @@
#include <string.h>
#include <unistd.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
diff --git a/src/gpk-firmware.c b/src/gpk-firmware.c
index a02b663..34cd520 100644
--- a/src/gpk-firmware.c
+++ b/src/gpk-firmware.c
@@ -38,7 +38,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <libnotify/notify.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#ifdef GPK_BUILD_GUDEV
#include <gudev/gudev.h>
#endif
@@ -68,7 +68,7 @@ struct GpkFirmwarePrivate
GFileMonitor *monitor;
GPtrArray *array_requested;
PkClient *client_primary;
- PkPackageList *packages_found;
+ GPtrArray *packages_found;
guint timeout_id;
};
@@ -181,12 +181,6 @@ gpk_firmware_install_file (GpkFirmware *firmware)
/* install all of the firmware files */
package_ids = pk_package_list_to_strv (firmware->priv->packages_found);
- ret = pk_client_reset (firmware->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to reset: %s", error->message);
- g_error_free (error);
- goto out;
- }
#if PK_CHECK_VERSION(0,5,0)
ret = pk_client_install_packages (firmware->priv->client_primary, TRUE, package_ids, &error);
#else
@@ -336,27 +330,16 @@ gpk_firmware_libnotify_cb (NotifyNotification *notification, gchar *action, gpoi
* @firmware: This class instance
* @filename: Firmware to search for
**/
-static PkPackageObj *
+static PkItemPackage *
gpk_firmware_check_available (GpkFirmware *firmware, const gchar *filename)
{
gboolean ret;
guint length = 0;
- PkPackageList *list = NULL;
+ GPtrArray *list = NULL;
GError *error = NULL;
- PkPackageObj *obj = NULL;
+ PkItemPackage *obj = NULL;
PkBitfield filter;
- /* actually check we can provide the firmware */
- ret = pk_client_reset (firmware->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to reset: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* say bodge */
- pk_client_set_synchronous (firmware->priv->client_primary, TRUE, NULL);
-
/* search for newest not installed package */
filter = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_NEWEST, -1);
ret = pk_client_search_file (firmware->priv->client_primary, filter, filename, &error);
@@ -372,13 +355,13 @@ gpk_firmware_check_available (GpkFirmware *firmware, const gchar *filename)
/* make sure we have one package */
list = pk_client_get_package_list (firmware->priv->client_primary);
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
if (length == 0)
egg_debug ("no package providing %s found", filename);
else if (length != 1)
egg_warning ("not one package providing %s found (%i)", filename, length);
else
- obj = pk_package_obj_copy (pk_package_list_get_obj (list, 0));
+ obj = pk_package_obj_copy (g_ptr_array_index (list, 0));
out:
if (list != NULL)
g_object_unref (list);
@@ -398,7 +381,7 @@ gpk_firmware_timeout_cb (gpointer data)
NotifyNotification *notification;
GPtrArray *array;
GError *error = NULL;
- PkPackageObj *obj = NULL;
+ PkItemPackage *obj = NULL;
const GpkFirmwareRequest *req;
gboolean has_data = FALSE;
@@ -418,7 +401,7 @@ gpk_firmware_timeout_cb (gpointer data)
}
/* nothing to do */
- if (pk_package_list_get_size (firmware->priv->packages_found) == 0) {
+ if (xxxarray- (firmware->priv->packages_found) == 0) {
egg_debug ("no packages providing any of the missing firmware");
goto out;
}
@@ -1023,12 +1006,11 @@ gpk_firmware_init (GpkFirmware *firmware)
firmware->priv = GPK_FIRMWARE_GET_PRIVATE (firmware);
firmware->priv->timeout_id = 0;
- firmware->priv->packages_found = pk_package_list_new ();
+ firmware->priv->packages_found = g_ptr_array_new_with_free_func_xxx ();
firmware->priv->array_requested = g_ptr_array_new ();
firmware->priv->gconf_client = gconf_client_get_default ();
firmware->priv->consolekit = egg_console_kit_new ();
firmware->priv->client_primary = pk_client_new ();
- pk_client_set_use_buffer (firmware->priv->client_primary, TRUE, NULL);
g_signal_connect (firmware->priv->client_primary, "error-code",
G_CALLBACK (gpk_firmware_error_code_cb), firmware);
diff --git a/src/gpk-hardware.c b/src/gpk-hardware.c
index dc26a66..749bf42 100644
--- a/src/gpk-hardware.c
+++ b/src/gpk-hardware.c
@@ -39,7 +39,7 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
@@ -79,7 +79,6 @@ gpk_hardware_install_package (GpkHardware *hardware)
client = pk_client_new ();
/* FIXME: this needs to be async and connect up to the repo signature stuff */
- pk_client_set_synchronous (client, TRUE, NULL);
#if PK_CHECK_VERSION(0,5,0)
ret = pk_client_install_packages (client, TRUE, hardware->priv->package_ids, &error);
#else
@@ -126,13 +125,11 @@ gpk_hardware_check_for_driver_available (GpkHardware *hardware, const gchar *udi
NotifyNotification *notification;
GError *error = NULL;
gchar *package = NULL;
- PkPackageList *list = NULL;
- const PkPackageObj *obj = NULL;
+ GPtrArray *list = NULL;
+ const PkItemPackage *obj = NULL;
PkClient *client = NULL;
client = pk_client_new ();
- pk_client_set_synchronous (client, TRUE, NULL);
- pk_client_set_use_buffer (client, TRUE, NULL);
ret = pk_client_what_provides (client, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED),
PK_PROVIDES_ENUM_HARDWARE_DRIVER, udi, &error);
if (!ret) {
@@ -144,15 +141,15 @@ gpk_hardware_check_for_driver_available (GpkHardware *hardware, const gchar *udi
/* If there are no driver packages available just return */
list = pk_client_get_package_list (client);
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
if (length == 0) {
egg_debug ("no drivers available");
goto out;
}
/* only install the first one? */
- obj = pk_package_list_get_obj (list, 0);
- package = gpk_package_id_format_oneline (obj->id, obj->summary);
+ obj = g_ptr_array_index (list, 0);
+ package = gpk_package_id_format_oneline (obj->package_id, obj->summary);
/* save list */
if (hardware->priv->package_ids != NULL)
diff --git a/src/gpk-helper-chooser.c b/src/gpk-helper-chooser.c
index 2edf1a3..51ba4a8 100644
--- a/src/gpk-helper-chooser.c
+++ b/src/gpk-helper-chooser.c
@@ -23,7 +23,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "gpk-helper-chooser.h"
#include "gpk-marshal.h"
@@ -159,41 +159,37 @@ pk_treeview_add_general_columns (GtkTreeView *treeview)
* Return value: if we agreed
**/
gboolean
-gpk_helper_chooser_show (GpkHelperChooser *helper, PkPackageList *list)
+gpk_helper_chooser_show (GpkHelperChooser *helper, GPtrArray *list)
{
GtkWidget *widget;
gchar *text;
const gchar *icon_name;
guint len;
guint i;
- const PkPackageObj *obj;
- gchar *package_id;
+ const PkItemPackage *obj;
GtkTreeIter iter;
g_return_val_if_fail (GPK_IS_HELPER_CHOOSER (helper), FALSE);
g_return_val_if_fail (list != NULL, FALSE);
/* see what we've got already */
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (list, i);
- egg_debug ("package '%s' got:", obj->id->name);
+ obj = g_ptr_array_index (list, i);
+ egg_debug ("package '%s' got:", obj->package_id->name);
/* put formatted text into treeview */
gtk_list_store_append (helper->priv->list_store, &iter);
- text = gpk_package_id_format_twoline (obj->id, obj->summary);
+ text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
/* get the icon */
- icon_name = gpk_desktop_guess_icon_name (helper->priv->desktop, obj->id->name);
+ icon_name = gpk_desktop_guess_icon_name (helper->priv->desktop, obj->package_id->name);
if (icon_name == NULL)
icon_name = gpk_info_enum_to_icon_name (obj->info);
- package_id = pk_package_id_to_string (obj->id);
gtk_list_store_set (helper->priv->list_store, &iter,
GPK_CHOOSER_COLUMN_TEXT, text,
- GPK_CHOOSER_COLUMN_ID, package_id, -1);
- g_free (package_id);
- package_id = NULL;
+ GPK_CHOOSER_COLUMN_ID, obj->package_id, -1);
gtk_list_store_set (helper->priv->list_store, &iter, GPK_CHOOSER_COLUMN_ICON, icon_name, -1);
g_free (text);
}
diff --git a/src/gpk-helper-chooser.h b/src/gpk-helper-chooser.h
index 2c108b5..a918036 100644
--- a/src/gpk-helper-chooser.h
+++ b/src/gpk-helper-chooser.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
@@ -58,7 +58,7 @@ GpkHelperChooser *gpk_helper_chooser_new (void);
gboolean gpk_helper_chooser_set_parent (GpkHelperChooser *helper,
GtkWindow *window);
gboolean gpk_helper_chooser_show (GpkHelperChooser *helper,
- PkPackageList *list);
+ GPtrArray *list);
G_END_DECLS
diff --git a/src/gpk-helper-deps-install.c b/src/gpk-helper-deps-install.c
index ccfc8f6..dbc547a 100644
--- a/src/gpk-helper-deps-install.c
+++ b/src/gpk-helper-deps-install.c
@@ -57,7 +57,7 @@ G_DEFINE_TYPE (GpkHelperDepsInstall, gpk_helper_deps_install, G_TYPE_OBJECT)
* Return value: if we agreed
**/
gboolean
-gpk_helper_deps_install_show (GpkHelperDepsInstall *helper, PkPackageList *packages, PkPackageList *deps_list)
+gpk_helper_deps_install_show (GpkHelperDepsInstall *helper, GPtrArray *packages, GPtrArray *deps_list)
{
gchar *name = NULL;
gchar *title = NULL;
@@ -69,7 +69,7 @@ gpk_helper_deps_install_show (GpkHelperDepsInstall *helper, PkPackageList *packa
GtkResponseType response;
/* empty list */
- length = pk_package_list_get_size (deps_list);
+ length = xxxarray- (deps_list);
if (length == 0) {
g_signal_emit (helper, signals [GPK_HELPER_DEPS_INSTALL_EVENT], 0, GTK_RESPONSE_YES);
goto out;
diff --git a/src/gpk-helper-deps-install.h b/src/gpk-helper-deps-install.h
index 1e16327..cafe7f3 100644
--- a/src/gpk-helper-deps-install.h
+++ b/src/gpk-helper-deps-install.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
@@ -57,8 +57,8 @@ GpkHelperDepsInstall *gpk_helper_deps_install_new (void);
gboolean gpk_helper_deps_install_set_parent (GpkHelperDepsInstall *helper,
GtkWindow *window);
gboolean gpk_helper_deps_install_show (GpkHelperDepsInstall *helper,
- PkPackageList *packages,
- PkPackageList *deps_list);
+ GPtrArray *packages,
+ GPtrArray *deps_list);
G_END_DECLS
diff --git a/src/gpk-helper-deps-remove.c b/src/gpk-helper-deps-remove.c
index dce44de..16820b3 100644
--- a/src/gpk-helper-deps-remove.c
+++ b/src/gpk-helper-deps-remove.c
@@ -55,7 +55,7 @@ G_DEFINE_TYPE (GpkHelperDepsRemove, gpk_helper_deps_remove, G_TYPE_OBJECT)
* Return value: if we agreed
**/
gboolean
-gpk_helper_deps_remove_show (GpkHelperDepsRemove *helper, PkPackageList *packages, PkPackageList *deps_list)
+gpk_helper_deps_remove_show (GpkHelperDepsRemove *helper, GPtrArray *packages, GPtrArray *deps_list)
{
gchar *name = NULL;
gchar *title = NULL;
@@ -66,7 +66,7 @@ gpk_helper_deps_remove_show (GpkHelperDepsRemove *helper, PkPackageList *package
GtkResponseType response;
/* empty list */
- length = pk_package_list_get_size (deps_list);
+ length = xxxarray- (deps_list);
if (length == 0) {
g_signal_emit (helper, signals [GPK_HELPER_DEPS_REMOVE_EVENT], 0, GTK_RESPONSE_YES);
goto out;
diff --git a/src/gpk-helper-deps-remove.h b/src/gpk-helper-deps-remove.h
index 8f1b2e5..0df6470 100644
--- a/src/gpk-helper-deps-remove.h
+++ b/src/gpk-helper-deps-remove.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
@@ -57,8 +57,8 @@ GpkHelperDepsRemove *gpk_helper_deps_remove_new (void);
gboolean gpk_helper_deps_remove_set_parent (GpkHelperDepsRemove *helper,
GtkWindow *window);
gboolean gpk_helper_deps_remove_show (GpkHelperDepsRemove *helper,
- PkPackageList *packages,
- PkPackageList *deps_list);
+ GPtrArray *packages,
+ GPtrArray *deps_list);
G_END_DECLS
diff --git a/src/gpk-helper-deps-update.c b/src/gpk-helper-deps-update.c
index d5b8eda..13023fb 100644
--- a/src/gpk-helper-deps-update.c
+++ b/src/gpk-helper-deps-update.c
@@ -41,7 +41,7 @@ struct GpkHelperDepsUpdatePrivate
{
GtkWindow *window;
GConfClient *gconf_client;
- PkPackageList *list;
+ GPtrArray *list;
};
enum {
@@ -58,7 +58,7 @@ G_DEFINE_TYPE (GpkHelperDepsUpdate, gpk_helper_deps_update, G_TYPE_OBJECT)
* Return value: if we agreed
**/
gboolean
-gpk_helper_deps_update_show (GpkHelperDepsUpdate *helper, PkPackageList *deps_list)
+gpk_helper_deps_update_show (GpkHelperDepsUpdate *helper, GPtrArray *deps_list)
{
gchar *title = NULL;
const gchar *message = NULL;
@@ -66,25 +66,25 @@ gpk_helper_deps_update_show (GpkHelperDepsUpdate *helper, PkPackageList *deps_li
gboolean ret;
GtkWidget *dialog;
GtkResponseType response;
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
guint i;
/* save deps list */
if (helper->priv->list != NULL)
g_object_unref (helper->priv->list);
- helper->priv->list = pk_package_list_new ();;
+ helper->priv->list = g_ptr_array_new_with_free_func_xxx ();;
/* copy only installing, updating etc */
- length = pk_package_list_get_size (deps_list);
+ length = xxxarray- (deps_list);
for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (deps_list, i);
+ obj = g_ptr_array_index (deps_list, i);
if (obj->info == PK_INFO_ENUM_INSTALLING ||
obj->info == PK_INFO_ENUM_UPDATING)
- pk_package_list_add (helper->priv->list, obj->info, obj->id, obj->summary);
+ g_ptr_array_add_xxxwithrecount (helper->priv->list, obj->info, obj->package_id, obj->summary);
}
/* empty list */
- length = pk_package_list_get_size (helper->priv->list);
+ length = xxxarray- (helper->priv->list);
if (length == 0) {
g_signal_emit (helper, signals [GPK_HELPER_DEPS_UPDATE_EVENT], 0, GTK_RESPONSE_YES, helper->priv->list);
goto out;
diff --git a/src/gpk-helper-deps-update.h b/src/gpk-helper-deps-update.h
index 6f01c3c..7ca603c 100644
--- a/src/gpk-helper-deps-update.h
+++ b/src/gpk-helper-deps-update.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
@@ -49,7 +49,7 @@ typedef struct
{
void (* event) (GpkHelperDepsUpdate *helper,
GtkResponseType type,
- PkPackageList *deps_list);
+ GPtrArray *deps_list);
GObjectClass parent_class;
} GpkHelperDepsUpdateClass;
@@ -58,7 +58,7 @@ GpkHelperDepsUpdate *gpk_helper_deps_update_new (void);
gboolean gpk_helper_deps_update_set_parent (GpkHelperDepsUpdate *helper,
GtkWindow *window);
gboolean gpk_helper_deps_update_show (GpkHelperDepsUpdate *helper,
- PkPackageList *deps_list);
+ GPtrArray *deps_list);
G_END_DECLS
diff --git a/src/gpk-helper-eula.c b/src/gpk-helper-eula.c
index 96e21b6..e895a06 100644
--- a/src/gpk-helper-eula.c
+++ b/src/gpk-helper-eula.c
@@ -93,7 +93,7 @@ gpk_helper_eula_show (GpkHelperEula *helper, const gchar *eula_id, const gchar *
GtkWidget *widget;
GtkTextBuffer *buffer;
gchar *text;
- PkPackageId *ident;
+ gchar *ident;
g_return_val_if_fail (GPK_IS_HELPER_EULA (helper), FALSE);
g_return_val_if_fail (eula_id != NULL, FALSE);
@@ -104,10 +104,10 @@ gpk_helper_eula_show (GpkHelperEula *helper, const gchar *eula_id, const gchar *
/* title */
widget = GTK_WIDGET (gtk_builder_get_object (helper->priv->builder, "label_title"));
- ident = pk_package_id_new_from_string (package_id);
+ ident = xxxnotneededanymore (package_id);
text = g_strdup_printf ("<b><big>License required for %s by %s</big></b>", ident->name, vendor_name);
gtk_label_set_label (GTK_LABEL (widget), text);
- pk_package_id_free (ident);
+ g_free (ident);
g_free (text);
buffer = gtk_text_buffer_new (NULL);
diff --git a/src/gpk-helper-media-change.h b/src/gpk-helper-media-change.h
index c5fd40f..e22128a 100644
--- a/src/gpk-helper-media-change.h
+++ b/src/gpk-helper-media-change.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "gpk-enum.h"
diff --git a/src/gpk-helper-repo-signature.c b/src/gpk-helper-repo-signature.c
index 147d68c..29f7937 100644
--- a/src/gpk-helper-repo-signature.c
+++ b/src/gpk-helper-repo-signature.c
@@ -23,7 +23,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "gpk-helper-repo-signature.h"
#include "gpk-marshal.h"
@@ -96,7 +96,7 @@ gpk_helper_repo_signature_show (GpkHelperRepoSignature *helper, const gchar *pac
const gchar *key_fingerprint, const gchar *key_timestamp)
{
GtkWidget *widget;
- PkPackageId *id;
+ gchar *id;
gchar *text;
g_return_val_if_fail (GPK_IS_HELPER_REPO_SIGNATURE (helper), FALSE);
@@ -119,14 +119,14 @@ gpk_helper_repo_signature_show (GpkHelperRepoSignature *helper, const gchar *pac
gtk_label_set_label (GTK_LABEL (widget), key_id);
/* TODO: pass this as a struct from the PkClient signal */
- id = pk_package_id_new_from_string (package_id);
+ id = xxxnotneededanymore (package_id);
text = gpk_package_id_name_version (id);
widget = GTK_WIDGET (gtk_builder_get_object (helper->priv->builder, "label_package"));
gtk_label_set_label (GTK_LABEL (widget), text);
g_free (text);
- pk_package_id_free (id);
+ g_free (id);
/* show window */
widget = GTK_WIDGET (gtk_builder_get_object (helper->priv->builder, "dialog_gpg"));
diff --git a/src/gpk-helper-run.c b/src/gpk-helper-run.c
index e9bed02..0da5ad5 100644
--- a/src/gpk-helper-run.c
+++ b/src/gpk-helper-run.c
@@ -23,7 +23,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "gpk-helper-run.h"
#include "gpk-marshal.h"
@@ -212,7 +212,7 @@ gpk_helper_run_add_desktop_file (GpkHelperRun *helper, const gchar *package_id,
gchar *menu_path = NULL;
GtkTreeIter iter;
GKeyFile *file = NULL;
- PkPackageId *id;
+ gchar *id;
gint weight;
gboolean hidden;
@@ -287,7 +287,7 @@ gpk_helper_run_add_desktop_file (GpkHelperRun *helper, const gchar *package_id,
/* put formatted text into treeview */
gtk_list_store_append (helper->priv->list_store, &iter);
joint = g_strdup_printf ("%s - %s", name, summary);
- id = pk_package_id_new_from_string (package_id);
+ id = xxxnotneededanymore (package_id);
text = gpk_package_id_format_twoline (id, joint);
if (menu_path != NULL) {
/* TRANSLATORS: the path in the menu, e.g. Applications -> Games -> Dave */
@@ -295,7 +295,7 @@ gpk_helper_run_add_desktop_file (GpkHelperRun *helper, const gchar *package_id,
g_free (text);
text = fulltext;
}
- pk_package_id_free (id);
+ g_free (id);
gtk_list_store_set (helper->priv->list_store, &iter,
GPK_CHOOSER_COLUMN_TEXT, fulltext,
diff --git a/src/gpk-helper-untrusted.h b/src/gpk-helper-untrusted.h
index 2944bce..dc11420 100644
--- a/src/gpk-helper-untrusted.h
+++ b/src/gpk-helper-untrusted.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
diff --git a/src/gpk-inhibit.c b/src/gpk-inhibit.c
index 6f87ae2..2194a9a 100644
--- a/src/gpk-inhibit.c
+++ b/src/gpk-inhibit.c
@@ -35,7 +35,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <dbus/dbus-glib.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "gpk-inhibit.h"
diff --git a/src/gpk-install-catalog.c b/src/gpk-install-catalog.c
index ca5c2dc..d103391 100644
--- a/src/gpk-install-catalog.c
+++ b/src/gpk-install-catalog.c
@@ -25,7 +25,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <locale.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <dbus/dbus-glib.h>
#include "egg-debug.h"
diff --git a/src/gpk-log.c b/src/gpk-log.c
index e6880d5..9f469f7 100644
--- a/src/gpk-log.c
+++ b/src/gpk-log.c
@@ -33,7 +33,7 @@
#include <pwd.h>
#include <gconf/gconf-client.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <unique/unique.h>
#include "egg-debug.h"
@@ -193,7 +193,7 @@ gpk_log_get_type_line (gchar **array, PkInfoEnum info)
gchar *text;
gchar *whole;
gchar **sections;
- PkPackageId *id;
+ gchar *id;
string = g_string_new ("");
size = g_strv_length (array);
@@ -204,11 +204,11 @@ gpk_log_get_type_line (gchar **array, PkInfoEnum info)
sections = g_strsplit (array[i], "\t", 0);
info_local = pk_info_enum_from_text (sections[0]);
if (info_local == info) {
- id = pk_package_id_new_from_string (sections[1]);
+ id = xxxnotneededanymore (sections[1]);
text = gpk_package_id_format_oneline (id, NULL);
g_string_append_printf (string, "%s, ", text);
g_free (text);
- pk_package_id_free (id);
+ g_free (id);
}
g_strfreev (sections);
}
@@ -394,7 +394,7 @@ gpk_log_filter (const PkTransactionObj *obj)
guint length;
gchar **sections;
gchar **packages;
- PkPackageId *id;
+ gchar *id;
/* only show transactions that succeeded */
if (!obj->succeeded) {
@@ -420,7 +420,7 @@ gpk_log_filter (const PkTransactionObj *obj)
ret = TRUE;
/* check to see if package name, version or arch matches */
- id = pk_package_id_new_from_string (sections[1]);
+ id = xxxnotneededanymore (sections[1]);
if (g_strrstr (id->name, filter) != NULL)
ret = TRUE;
if (id->version != NULL && g_strrstr (id->version, filter) != NULL)
@@ -428,7 +428,7 @@ gpk_log_filter (const PkTransactionObj *obj)
if (id->arch != NULL && g_strrstr (id->arch, filter) != NULL)
ret = TRUE;
- pk_package_id_free (id);
+ g_free (id);
g_strfreev (sections);
/* shortcut for speed */
@@ -566,12 +566,6 @@ gpk_log_refresh (void)
gboolean ret;
GError *error = NULL;
- ret = pk_client_reset (client, &error);
- if (!ret) {
- egg_warning ("failed to reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
ret = pk_client_get_old_transactions (client, 0, &error);
if (!ret) {
egg_warning ("failed to get list: %s", error->message);
@@ -691,8 +685,6 @@ main (int argc, char *argv[])
GPK_DATA G_DIR_SEPARATOR_S "icons");
client = pk_client_new ();
- pk_client_set_use_buffer (client, TRUE, NULL);
- pk_client_set_synchronous (client, TRUE, NULL);
/* get UI */
builder = gtk_builder_new ();
diff --git a/src/gpk-modal-dialog.c b/src/gpk-modal-dialog.c
index 4fe4802..f95a9d5 100644
--- a/src/gpk-modal-dialog.c
+++ b/src/gpk-modal-dialog.c
@@ -34,7 +34,7 @@
#include <sys/wait.h>
#include <fcntl.h>
#include <glib/gi18n.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
@@ -629,13 +629,12 @@ gpk_modal_dialog_button_cancel_cb (GtkWidget *widget_button, GpkModalDialog *dia
* gpk_modal_dialog_set_package_list:
**/
gboolean
-gpk_modal_dialog_set_package_list (GpkModalDialog *dialog, const PkPackageList *list)
+gpk_modal_dialog_set_package_list (GpkModalDialog *dialog, const GPtrArray *list)
{
GtkTreeIter iter;
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
PkDesktop *desktop;
gchar *icon;
- gchar *package_id;
gchar *text;
guint length;
guint i;
@@ -643,7 +642,7 @@ gpk_modal_dialog_set_package_list (GpkModalDialog *dialog, const PkPackageList *
gtk_list_store_clear (dialog->priv->store);
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->builder, "scrolledwindow_packages"));
if (length > 5)
gtk_widget_set_size_request (widget, -1, 300);
@@ -651,34 +650,32 @@ gpk_modal_dialog_set_package_list (GpkModalDialog *dialog, const PkPackageList *
gtk_widget_set_size_request (widget, -1, 150);
desktop = pk_desktop_new ();
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
/* add each well */
for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
/* not installed, so ignore icon */
if (obj->info == PK_INFO_ENUM_DOWNLOADING ||
obj->info == PK_INFO_ENUM_CLEANUP)
continue;
- text = gpk_package_id_format_twoline (obj->id, obj->summary);
- package_id = pk_package_id_to_string (obj->id);
+ text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
/* get the icon */
- icon = gpk_desktop_guess_icon_name (desktop, obj->id->name);
+ icon = gpk_desktop_guess_icon_name (desktop, obj->package_id->name);
if (icon == NULL)
icon = g_strdup (gpk_info_enum_to_icon_name (PK_INFO_ENUM_INSTALLED));
gtk_list_store_append (dialog->priv->store, &iter);
gtk_list_store_set (dialog->priv->store, &iter,
GPK_MODAL_DIALOG_STORE_IMAGE, icon,
- GPK_MODAL_DIALOG_STORE_ID, package_id,
+ GPK_MODAL_DIALOG_STORE_ID, obj->package_id,
GPK_MODAL_DIALOG_STORE_TEXT, text,
-1);
g_free (icon);
g_free (text);
- g_free (package_id);
}
g_object_unref (desktop);
@@ -905,8 +902,8 @@ gpk_modal_dialog_test (EggTest *test)
{
GtkResponseType button;
GpkModalDialog *dialog = NULL;
- PkPackageList *list;
- PkPackageId *id;
+ GPtrArray *list;
+ gchar *id;
if (!egg_test_start (test, "GpkModalDialog"))
return;
@@ -920,12 +917,12 @@ gpk_modal_dialog_test (EggTest *test)
egg_test_failed (test, NULL);
/* set some packages */
- list = pk_package_list_new ();
+ list = g_ptr_array_new_with_free_func_xxx ();
id = pk_package_id_new_from_list ("totem", "0.0.1", "i386", "fedora-newkey");
- pk_package_list_add (list, PK_INFO_ENUM_INSTALLED, id, "Totem is a music player for GNOME");
- pk_package_list_add (list, PK_INFO_ENUM_AVAILABLE, id, "Amarok is a music player for KDE");
+ g_ptr_array_add_xxxwithrecount (list, PK_INFO_ENUM_INSTALLED, id, "Totem is a music player for GNOME");
+ g_ptr_array_add_xxxwithrecount (list, PK_INFO_ENUM_AVAILABLE, id, "Amarok is a music player for KDE");
gpk_modal_dialog_set_package_list (dialog, list);
- pk_package_id_free (id);
+ g_free (id);
g_object_unref (list);
/************************************************************/
diff --git a/src/gpk-modal-dialog.h b/src/gpk-modal-dialog.h
index d907823..6ed411b 100644
--- a/src/gpk-modal-dialog.h
+++ b/src/gpk-modal-dialog.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
G_BEGIN_DECLS
@@ -94,7 +94,7 @@ gboolean gpk_modal_dialog_present (GpkModalDialog *dialog);
gboolean gpk_modal_dialog_present_with_time (GpkModalDialog *dialog,
guint32 timestamp);
gboolean gpk_modal_dialog_set_package_list (GpkModalDialog *dialog,
- const PkPackageList *list);
+ const GPtrArray *list);
gboolean gpk_modal_dialog_set_parent (GpkModalDialog *dialog,
GdkWindow *window);
gboolean gpk_modal_dialog_set_window_icon (GpkModalDialog *dialog,
diff --git a/src/gpk-prefs.c b/src/gpk-prefs.c
index 75c0f00..6ecf839 100644
--- a/src/gpk-prefs.c
+++ b/src/gpk-prefs.c
@@ -31,7 +31,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include <gconf/gconf-client.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <unique/unique.h>
#include <gpk-common.h>
diff --git a/src/gpk-repo.c b/src/gpk-repo.c
index 2cce71c..4fa8c85 100644
--- a/src/gpk-repo.c
+++ b/src/gpk-repo.c
@@ -30,7 +30,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include <gconf/gconf-client.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <unique/unique.h>
#include "egg-debug.h"
@@ -407,12 +407,6 @@ gpk_repo_repo_list_refresh (void)
gpk_repo_mark_nonactive (model);
egg_debug ("refreshing list");
- ret = pk_client_reset (client_query, &error);
- if (!ret) {
- egg_warning ("failed to reset client: %s", error->message);
- g_error_free (error);
- return;
- }
if (!show_details)
filters = pk_bitfield_value (PK_FILTER_ENUM_NOT_DEVELOPMENT);
else
diff --git a/src/gpk-service-pack.c b/src/gpk-service-pack.c
index aac829e..c91b374 100644
--- a/src/gpk-service-pack.c
+++ b/src/gpk-service-pack.c
@@ -31,7 +31,7 @@
#include <sys/utsname.h>
#include <dbus/dbus-glib.h>
#include <gconf/gconf-client.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <unique/unique.h>
#include "egg-debug.h"
@@ -138,14 +138,14 @@ gpk_pack_widgets_activate (gboolean enable)
* gpk_pack_package_cb:
**/
static void
-gpk_pack_package_cb (PkServicePack *pack, const PkPackageObj *obj, gpointer data)
+gpk_pack_package_cb (PkServicePack *pack, const PkItemPackage *obj, gpointer data)
{
GtkProgressBar *progress_bar;
gchar *text;
progress_bar = GTK_PROGRESS_BAR (gtk_builder_get_object (builder, "progressbar_percentage"));
/* TRANSLATORS: This is the package name that is being downloaded */
- text = g_strdup_printf ("%s: %s-%s.%s", _("Downloading"), obj->id->name, obj->id->version, obj->id->arch);
+ text = g_strdup_printf ("%s: %s-%s.%s", _("Downloading"), obj->package_id->name, obj->package_id->version, obj->package_id->arch);
gtk_progress_bar_set_text (progress_bar, text);
g_free (text);
}
@@ -213,22 +213,14 @@ gpk_pack_progress_changed_cb (PkClient *_client, guint percentage, guint subperc
static gchar *
gpk_pack_resolve_package_id (const gchar *package)
{
- PkPackageList *list = NULL;
+ GPtrArray *list = NULL;
gchar *package_id = NULL;
gchar **packages = NULL;
GError *error = NULL;
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
gboolean ret = FALSE;
guint len;
- /* reset client */
- ret = pk_client_reset (client, &error);
- if (!ret) {
- egg_warning ("could not reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* get package list */
packages = g_strsplit (package, ";", 0);
ret = pk_client_resolve (client, pk_bitfield_value (PK_FILTER_ENUM_NEWEST), packages, &error);
@@ -240,7 +232,7 @@ gpk_pack_resolve_package_id (const gchar *package)
/* get the deps */
list = pk_client_get_package_list (client);
- len = pk_package_list_get_size (list);
+ len = xxxarray- (list);
/* no matches */
if (len == 0)
@@ -251,8 +243,8 @@ gpk_pack_resolve_package_id (const gchar *package)
egg_warning ("More than one possible package for '%s' found!", package);
/* convert to a text package id */
- obj = pk_package_list_get_obj (list, 0);
- package_id = pk_package_id_to_string (obj->id);
+ obj = g_ptr_array_index (list, 0);
+ package_id = g_strdup (obj->package_id);
out:
if (list != NULL)
@@ -321,18 +313,9 @@ static gboolean
gpk_pack_copy_package_lists (const gchar *filename, GError **error)
{
gboolean ret = FALSE;
- PkPackageList *list = NULL;
+ GPtrArray *list = NULL;
GError *error_local = NULL;
- /* reset client */
- ret = pk_client_reset (client, &error_local);
- if (!ret) {
- /* TRANSLATORS: internal error */
- *error = g_error_new (1, 0, _("Could not reset client: %s"), error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
/* get package list */
ret = pk_client_get_packages (client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), &error_local);
if (!ret) {
@@ -372,7 +355,7 @@ gpk_pack_button_create_cb (GtkWidget *widget2, gpointer data)
gchar **packages = NULL;
gchar **package_ids = NULL;
PkServicePack *pack;
- PkPackageList *list = NULL;
+ GPtrArray *list = NULL;
GError *error = NULL;
gboolean ret;
gboolean use_default = FALSE;
@@ -433,15 +416,6 @@ gpk_pack_button_create_cb (GtkWidget *widget2, gpointer data)
/* if we're using the default list, and it doesn't exist, refresh and create it */
if (use_default && !g_file_test (exclude, G_FILE_TEST_EXISTS)) {
- /* reset client */
- ret = pk_client_reset (client, &error);
- if (!ret) {
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_pack"));
- /* TRANSLATORS: we could not reset internal state */
- gpk_error_dialog_modal (GTK_WINDOW (widget), _("Refresh error"), _("Could not reset client"), error->message);
- g_error_free (error);
- goto out;
- }
/* tell the user what we are doing */
progress_bar = GTK_PROGRESS_BAR (gtk_builder_get_object (builder, "progressbar_percentage"));
@@ -460,7 +434,7 @@ gpk_pack_button_create_cb (GtkWidget *widget2, gpointer data)
}
/* add the exclude list */
- list = pk_package_list_new ();
+ list = g_ptr_array_new_with_free_func_xxx ();
ret = pk_obj_list_from_file (PK_OBJ_LIST(list), exclude);
if (!ret) {
widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_pack"));
@@ -644,8 +618,6 @@ main (int argc, char *argv[])
roles = pk_control_get_actions (control, NULL);
client = pk_client_new ();
- pk_client_set_use_buffer (client, TRUE, NULL);
- pk_client_set_synchronous (client, TRUE, NULL);
g_signal_connect (client, "progress-changed", G_CALLBACK (gpk_pack_progress_changed_cb), NULL);
/* get UI */
diff --git a/src/gpk-update-icon.c b/src/gpk-update-icon.c
index 00ba9e5..ea57d29 100644
--- a/src/gpk-update-icon.c
+++ b/src/gpk-update-icon.c
@@ -31,7 +31,7 @@
#include <gtk/gtk.h>
#include <locale.h>
#include <libnotify/notify.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-dbus-monitor.h"
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 240dcbc..e0696e3 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -30,7 +30,7 @@
#include <dbus/dbus-glib.h>
#include <gconf/gconf-client.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include <libnotify/notify.h>
#include <unique/unique.h>
#include <canberra-gtk.h>
@@ -68,12 +68,12 @@ static GtkTextBuffer *text_buffer = NULL;
static PkClient *client_primary = NULL;
static PkClient *client_secondary = NULL;
static PkControl *control = NULL;
-static PkPackageList *update_list = NULL;
+static GPtrArray *update_list = NULL;
static GpkHelperRepoSignature *helper_repo_signature = NULL;
static GpkHelperEula *helper_eula = NULL;
static GpkHelperDepsUpdate *helper_deps_update = NULL;
static EggMarkdown *markdown = NULL;
-static PkPackageId *package_id_last = NULL;
+static gchar *package_id_last = NULL;
static PkRestartEnum restart_update = PK_RESTART_ENUM_NONE;
static guint size_total = 0;
static GConfClient *gconf_client = NULL;
@@ -418,14 +418,6 @@ gpk_update_viewer_button_install_cb (GtkWidget *widget, gpointer data)
selection = gtk_tree_view_get_selection (treeview);
gtk_tree_selection_unselect_all (selection);
- /* reset client */
- ret = pk_client_reset (client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* save for finished */
package_ids = pk_package_ids_from_array (array);
g_strfreev (install_package_ids);
@@ -482,23 +474,23 @@ gpk_update_viewer_button_delete_event_cb (GtkWidget *widget, GdkEvent *event, gp
* gpk_update_viewer_find_iter_model_cb:
**/
static gboolean
-gpk_update_viewer_find_iter_model_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, const PkPackageId *id)
+gpk_update_viewer_find_iter_model_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, const gchar *id)
{
gchar *id_tmp = NULL;
GtkTreePath **_path = NULL;
- PkPackageId *id_new;
+ gchar *id_new;
gboolean ret = FALSE;
_path = (GtkTreePath **) g_object_get_data (G_OBJECT(model), "_path");
gtk_tree_model_get (model, iter, GPK_UPDATES_COLUMN_ID, &id_tmp, -1);
/* only match on the name */
- id_new = pk_package_id_new_from_string (id_tmp);
+ id_new = xxxnotneededanymore (id_tmp);
if (g_strcmp0 (id_new->name, id->name) == 0) {
*_path = gtk_tree_path_copy (path);
ret = TRUE;
}
- pk_package_id_free (id_new);
+ g_free (id_new);
return ret;
}
@@ -506,7 +498,7 @@ gpk_update_viewer_find_iter_model_cb (GtkTreeModel *model, GtkTreePath *path, Gt
* gpk_update_viewer_model_get_path:
**/
static GtkTreePath *
-gpk_update_viewer_model_get_path (GtkTreeModel *model, const PkPackageId *id)
+gpk_update_viewer_model_get_path (GtkTreeModel *model, const gchar *id)
{
GtkTreePath *path = NULL;
g_object_set_data (G_OBJECT(model), "_path", (gpointer) &path);
@@ -529,7 +521,7 @@ gpk_update_viewer_details_cb (PkClient *client, const PkDetailsObj *obj, gpointe
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview_updates"));
model = gtk_tree_view_get_model (treeview);
- path = gpk_update_viewer_model_get_path (model, obj->id);
+ path = gpk_update_viewer_model_get_path (model, obj->package_id);
if (path == NULL) {
egg_debug ("not found ID for details");
return;
@@ -573,12 +565,11 @@ gpk_update_viewer_is_update_info (PkInfoEnum info)
* gpk_update_viewer_package_cb:
**/
static void
-gpk_update_viewer_package_cb (PkClient *client, const PkPackageObj *obj, gpointer data)
+gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *obj, gpointer data)
{
PkRoleEnum role;
PkInfoEnum info;
gchar *text = NULL;
- gchar *package_id;
GtkTreeView *treeview;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -589,35 +580,32 @@ gpk_update_viewer_package_cb (PkClient *client, const PkPackageObj *obj, gpointe
pk_client_get_role (client, &role, NULL, NULL);
egg_debug ("role = %s, package = %s:%s:%s", pk_role_enum_to_text (role),
- pk_info_enum_to_text (obj->info), obj->id->name, obj->summary);
-
- /* convert to string */
- package_id = pk_package_id_to_string (obj->id);
+ pk_info_enum_to_text (obj->info), obj->package_id->name, obj->summary);
/* are we simulating to get deps? */
#if PK_CHECK_VERSION(0,5,2)
if (role == PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES) {
- egg_debug ("ignoring %s as we are simulating", package_id);
+ egg_debug ("ignoring %s as we are simulating", obj->package_id);
goto out;
}
#else
if (role == PK_ROLE_ENUM_GET_DEPENDS) {
- egg_debug ("ignoring %s as we are in the depends phase", package_id);
+ egg_debug ("ignoring %s as we are in the depends phase", obj->package_id);
goto out;
}
#endif
/* used for progress */
if (!gpk_update_viewer_is_update_info (obj->info)) {
- pk_package_id_free (package_id_last);
- package_id_last = pk_package_id_copy (obj->id);
+ g_free (package_id_last);
+ package_id_last = pk_package_id_copy (obj->package_id);
/* find model */
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview_updates"));
model = gtk_tree_view_get_model (treeview);
/* update icon */
- path = gpk_update_viewer_model_get_path (model, obj->id);
+ path = gpk_update_viewer_model_get_path (model, obj->package_id);
if (path == NULL) {
egg_debug ("not found ID for package");
goto out;
@@ -655,7 +643,7 @@ gpk_update_viewer_package_cb (PkClient *client, const PkPackageObj *obj, gpointe
}
/* add to list store */
- text = gpk_package_id_format_twoline (obj->id, obj->summary);
+ text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
selected = (obj->info != PK_INFO_ENUM_BLOCKED);
gtk_list_store_append (list_store_updates, &iter);
gtk_list_store_set (list_store_updates, &iter,
@@ -673,7 +661,6 @@ gpk_update_viewer_package_cb (PkClient *client, const PkPackageObj *obj, gpointe
GPK_UPDATES_COLUMN_PULSE, -1,
-1);
out:
- g_free (package_id);
g_free (text);
}
@@ -691,7 +678,7 @@ gpk_update_viewer_update_detail_cb (PkClient *client, const PkUpdateDetailObj *o
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview_updates"));
model = gtk_tree_view_get_model (treeview);
- path = gpk_update_viewer_model_get_path (model, obj->id);
+ path = gpk_update_viewer_model_get_path (model, obj->package_id);
if (path == NULL) {
egg_warning ("not found ID for update detail");
return;
@@ -1408,11 +1395,11 @@ gpk_packages_treeview_clicked_cb (GtkTreeSelection *selection, gpointer data)
* gpk_update_viewer_check_blocked_packages:
**/
static void
-gpk_update_viewer_check_blocked_packages (PkPackageList *list)
+gpk_update_viewer_check_blocked_packages (GPtrArray *list)
{
guint i;
guint length;
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
GString *string;
gboolean exists = FALSE;
gchar *text;
@@ -1421,11 +1408,11 @@ gpk_update_viewer_check_blocked_packages (PkPackageList *list)
string = g_string_new ("");
/* find any that are blocked */
- length = pk_package_list_get_size (list);
+ length = xxxarray- (list);
for (i=0;i<length;i++) {
- obj = pk_package_list_get_obj (list, i);
+ obj = g_ptr_array_index (list, i);
if (obj->info == PK_INFO_ENUM_BLOCKED) {
- text = gpk_package_id_format_oneline (obj->id, obj->summary);
+ text = gpk_package_id_format_oneline (obj->package_id, obj->summary);
g_string_append_printf (string, "%s\n", text);
g_free (text);
exists = TRUE;
@@ -1455,7 +1442,7 @@ out:
* gpk_update_viewer_finished_get_details_cb:
**/
static gboolean
-gpk_update_viewer_finished_get_details_cb (PkPackageList *list)
+gpk_update_viewer_finished_get_details_cb (GPtrArray *list)
{
gboolean ret;
gchar **package_ids;
@@ -1463,12 +1450,6 @@ gpk_update_viewer_finished_get_details_cb (PkPackageList *list)
package_ids = pk_package_list_to_strv (list);
/* get the details of all the packages */
- ret = pk_client_reset (client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
ret = pk_client_get_details (client_primary, package_ids, &error);
if (!ret) {
egg_error ("cannot get details: %s", error->message);
@@ -1485,7 +1466,7 @@ out:
* gpk_update_viewer_finished_get_update_details_cb:
**/
static gboolean
-gpk_update_viewer_finished_get_update_details_cb (PkPackageList *list)
+gpk_update_viewer_finished_get_update_details_cb (GPtrArray *list)
{
gboolean ret;
gchar **package_ids;
@@ -1493,12 +1474,6 @@ gpk_update_viewer_finished_get_update_details_cb (PkPackageList *list)
package_ids = pk_package_list_to_strv (list);
/* get the details of all the packages */
- ret = pk_client_reset (client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
ret = pk_client_get_update_detail (client_primary, package_ids, &error);
if (!ret) {
egg_error ("cannot get details: %s", error->message);
@@ -1521,12 +1496,6 @@ gpk_update_viewer_finished_get_distro_upgrades_cb (gpointer data)
GError *error = NULL;
/* get the details of all the packages */
- ret = pk_client_reset (client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
ret = pk_client_get_distro_upgrades (client_primary, &error);
if (!ret) {
egg_error ("cannot get details: %s", error->message);
@@ -1645,7 +1614,7 @@ out:
* gpk_update_viewer_deps_update_event_cb:
**/
static void
-gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponseType type, PkPackageList *deps_list, gpointer data)
+gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponseType type, GPtrArray *deps_list, gpointer data)
{
gboolean ret;
GError *error = NULL;
@@ -1659,8 +1628,7 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
guint i;
gboolean found;
gchar *text;
- PkPackageId *id;
- const PkPackageObj *obj;
+ const PkItemPackage *obj;
/* get model */
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview_updates"));
@@ -1676,17 +1644,16 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
/* need to select or add packages in deps_list */
len = PK_OBJ_LIST(deps_list)->len;
for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (deps_list, i);
+ obj = g_ptr_array_index (deps_list, i);
found = FALSE;
/* find it and select it */
valid = gtk_tree_model_get_iter_first (model, &iter);
while (valid && !found) {
gtk_tree_model_get (model, &iter, GPK_UPDATES_COLUMN_ID, &package_id_temp, -1);
- id = pk_package_id_new_from_string (package_id_temp);
/* we found a match */
- if (pk_package_id_equal (id, obj->id)) {
+ if (g_strcmp0 (package_id_temp, obj->package_id)) {
egg_debug ("selecting %s", id->name);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
GPK_UPDATES_COLUMN_SELECT, TRUE, -1);
@@ -1694,19 +1661,17 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
}
g_free (package_id_temp);
- pk_package_id_free (id);
valid = gtk_tree_model_iter_next (model, &iter);
}
/* not found, so add */
if (!found) {
- package_id = pk_package_id_to_string (obj->id);
- text = gpk_package_id_format_twoline (obj->id, obj->summary);
- egg_debug ("adding: id=%s, text=%s", package_id, text);
+ text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
+ egg_debug ("adding: id=%s, text=%s", obj->package_id, text);
gtk_list_store_append (list_store_updates, &iter);
gtk_list_store_set (list_store_updates, &iter,
GPK_UPDATES_COLUMN_TEXT, text,
- GPK_UPDATES_COLUMN_ID, package_id,
+ GPK_UPDATES_COLUMN_ID, obj->package_id,
GPK_UPDATES_COLUMN_INFO, obj->info,
GPK_UPDATES_COLUMN_SELECT, TRUE,
GPK_UPDATES_COLUMN_SENSITIVE, FALSE,
@@ -1726,14 +1691,6 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
/* if there are no entries selected, deselect the button */
gpk_update_viewer_reconsider_info (model);
- /* reset client */
- ret = pk_client_reset (client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* actually install packages this time */
#if PK_CHECK_VERSION(0,5,0)
ret = pk_client_update_packages (client_primary, TRUE, install_package_ids, &error);
@@ -1763,7 +1720,7 @@ gpk_update_viewer_finished_cb (PkClient *client, PkExitEnum exit, guint runtime,
GtkTreeSelection *selection;
PkBitfield roles;
PkRoleEnum role;
- PkPackageList *list;
+ GPtrArray *list;
PkRestartEnum restart;
gchar *text;
@@ -2419,14 +2376,6 @@ gpk_update_viewer_get_new_update_list (void)
text = g_strdup_printf ("<big><b>%s</b></big>", _("Checking for updates..."));
gtk_label_set_label (GTK_LABEL (widget), text);
- /* reset client */
- ret = pk_client_reset (client_primary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* only show newest updates? */
ret = gconf_client_get_bool (gconf_client, GPK_CONF_UPDATE_VIEWER_ONLY_NEWEST, NULL);
if (ret) {
@@ -2484,14 +2433,6 @@ gpk_update_viewer_repo_signature_event_cb (GpkHelperRepoSignature *_helper_repo_
goto out;
}
- /* reset client */
- ret = pk_client_reset (client_secondary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install signature */
ret = pk_client_install_signature (client_secondary, PK_SIGTYPE_ENUM_GPG, key_id, package_id, &error);
if (!ret) {
@@ -2526,14 +2467,6 @@ gpk_update_viewer_eula_event_cb (GpkHelperRepoSignature *_helper_eula, GtkRespon
goto out;
}
- /* reset client */
- ret = pk_client_reset (client_secondary, &error);
- if (!ret) {
- egg_warning ("cannot reset client: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
/* install signature */
ret = pk_client_accept_eula (client_secondary, eula_id, &error);
if (!ret) {
@@ -2893,7 +2826,6 @@ main (int argc, char *argv[])
/* this is what we use mainly */
client_primary = pk_client_new ();
- pk_client_set_use_buffer (client_primary, TRUE, NULL);
g_signal_connect (client_primary, "package",
G_CALLBACK (gpk_update_viewer_package_cb), NULL);
g_signal_connect (client_primary, "details",
@@ -3089,7 +3021,7 @@ main (int argc, char *argv[])
g_object_unref (helper_deps_update);
g_object_unref (list_store_updates);
g_object_unref (text_buffer);
- pk_package_id_free (package_id_last);
+ g_free (package_id_last);
out_build:
g_object_unref (gconf_client);
g_object_unref (control);
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index 5326931..540c871 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -37,7 +37,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <libnotify/notify.h>
-#include <packagekit-glib/packagekit.h>
+#include <packagekit-glib2/packagekit.h>
#include "egg-debug.h"
#include "egg-string.h"
@@ -443,7 +443,7 @@ gpk_watch_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum
const PkRequireRestartObj *obj_tmp;
PkObjList *array;
#else
- PkPackageId *id;
+ gchar *id;
const GPtrArray *array;
#endif
@@ -488,7 +488,7 @@ gpk_watch_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum
ret = FALSE;
for (j=0; j<array->len; j++) {
obj_tmp = pk_obj_list_index (array, j);
- if (g_strcmp0 (obj_tmp->id->name, obj->id->name) == 0) {
+ if (g_strcmp0 (obj_tmp->id->name, obj->package_id->name) == 0) {
ret = TRUE;
break;
}
@@ -497,7 +497,7 @@ gpk_watch_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum
continue;
/* add to list */
- g_ptr_array_add (watch->priv->restart_package_names, g_strdup (obj->id->name));
+ g_ptr_array_add (watch->priv->restart_package_names, g_strdup (obj->package_id->name));
}
g_object_unref (array);
no_data:
@@ -1070,10 +1070,10 @@ gpk_watch_status_changed_cb (PkClient *client, PkStatusEnum status, GpkWatch *wa
* gpk_watch_package_cb:
**/
static void
-gpk_watch_package_cb (PkClient *client, const PkPackageObj *obj, GpkWatch *watch)
+gpk_watch_package_cb (PkClient *client, const PkItemPackage *obj, GpkWatch *watch)
{
gchar *text;
- text = gpk_package_id_format_twoline (obj->id, obj->summary);
+ text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
gpk_modal_dialog_set_message (watch->priv->dialog, text);
g_free (text);
}
@@ -1096,14 +1096,6 @@ gpk_watch_monitor_tid (GpkWatch *watch, const gchar *tid)
GError *error = NULL;
PkRoleEnum role;
- /* reset client */
- ret = pk_client_reset (watch->priv->client_primary, &error);
- if (!ret) {
- egg_warning ("failed to reset client: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
-
ret = pk_client_set_tid (watch->priv->client_primary, tid, &error);
if (!ret) {
egg_warning ("could not set tid: %s", error->message);
@@ -1165,17 +1157,17 @@ gpk_watch_monitor_tid (GpkWatch *watch, const gchar *tid)
/* do the best we can, and get the last package */
ret = pk_client_get_package (watch->priv->client_primary, &package_id, NULL);
if (ret) {
- PkPackageId *id;
- PkPackageObj *obj;
+ gchar *id;
+ PkItemPackage *obj;
- id = pk_package_id_new_from_string (package_id);
+ id = xxxnotneededanymore (package_id);
if (id != NULL) {
obj = pk_package_obj_new (PK_INFO_ENUM_UNKNOWN, id, NULL);
egg_warning ("package_id=%s", package_id);
gpk_watch_package_cb (watch->priv->client_primary, obj, watch);
pk_package_obj_free (obj);
}
- pk_package_id_free (id);
+ g_free (id);
}
gpk_modal_dialog_present (watch->priv->dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]