[gnome-packagekit/glib2: 20/79] Moo
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-packagekit/glib2: 20/79] Moo
- Date: Tue, 6 Oct 2009 09:46:30 +0000 (UTC)
commit a23219904a1a3daab2876ee74b9fe7dab4681c63
Author: Richard Hughes <richard hughsie com>
Date: Wed Sep 16 18:19:05 2009 +0100
Moo
src/Makefile.am | 33 +----------
src/gpk-application.c | 80 ++++++++++++++--------------
src/gpk-auto-refresh.c | 35 +++++++++++-
src/gpk-check-update.c | 46 ++++++++--------
src/gpk-common.c | 15 +++++
src/gpk-common.h | 1 +
src/gpk-dbus-task.c | 74 +++++++++++++-------------
src/gpk-firmware.c | 20 ++++----
src/gpk-hardware.c | 6 +-
src/gpk-helper-chooser.c | 17 ++++---
src/gpk-helper-deps-update.c | 16 +++---
src/gpk-service-pack.c | 14 +++---
src/gpk-update-viewer.c | 124 +++++++++++++++++++++---------------------
src/gpk-watch.c | 30 +++++-----
14 files changed, 266 insertions(+), 245 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index f1f5952..da2fbd3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -206,38 +206,20 @@ gpk_application_LDADD = \
gpk_service_pack_SOURCES = \
gpk-service-pack.c \
- egg-debug.c \
- egg-debug.h \
- gpk-enum.h \
- gpk-enum.c \
- gpk-common.h \
- gpk-common.c \
- gpk-gnome.h \
- gpk-gnome.c \
- gpk-animated-icon.c \
- gpk-animated-icon.h \
$(NULL)
gpk_service_pack_LDADD = \
libgpkshared.a \
+ libgpkshared.a \
$(NULL)
gpk_prefs_SOURCES = \
gpk-prefs.c \
- egg-debug.c \
- egg-debug.h \
- gpk-enum.h \
- gpk-enum.c \
- gpk-common.h \
- gpk-common.c \
- gpk-gnome.h \
- gpk-gnome.c \
- gpk-animated-icon.c \
- gpk-animated-icon.h \
$(NULL)
gpk_prefs_LDADD = \
$(shared_LIBS) \
+ libgpkshared.a \
$(NULL)
gpk_update_viewer_SOURCES = \
@@ -279,20 +261,11 @@ gpk_repo_LDADD = \
gpk_log_SOURCES = \
gpk-log.c \
- egg-debug.c \
- egg-debug.h \
- gpk-enum.h \
- gpk-enum.c \
- gpk-common.h \
- gpk-common.c \
- gpk-gnome.h \
- gpk-gnome.c \
- gpk-animated-icon.c \
- gpk-animated-icon.h \
$(NULL)
gpk_log_LDADD = \
$(shared_LIBS) \
+ libgpkshared.a \
$(NULL)
gpk_backend_status_SOURCES = \
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 3286ced..057292c 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -88,7 +88,7 @@ struct GpkApplicationPrivate
PkControl *control;
PkClient *client_primary;
PkClient *client_secondary;
- PkConnection *pconnection;
+ PkControl *pconnection;
PkDesktop *desktop;
gchar *group;
gchar *url;
@@ -970,10 +970,10 @@ gpk_application_details_cb (PkClient *client, PkDetailsObj *details, GpkApplicat
}
/**
- * gpk_application_add_obj_to_results:
+ * gpk_application_add_item_to_results:
**/
static void
-gpk_application_add_obj_to_results (GpkApplication *application, const PkItemPackage *obj)
+gpk_application_add_item_to_results (GpkApplication *application, const PkItemPackage *item)
{
GtkTreeIter iter;
gchar *summary;
@@ -988,14 +988,14 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkItemPac
/* format if required */
egg_markdown_set_output (application->priv->markdown, EGG_MARKDOWN_OUTPUT_PANGO);
- summary = egg_markdown_parse (application->priv->markdown, obj->summary);
+ summary = egg_markdown_parse (application->priv->markdown, item->summary);
/* 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, obj->package_id);
- installed = (obj->info_enum == PK_INFO_ENUM_INSTALLED) || (obj->info == PK_INFO_ENUM_COLLECTION_INSTALLED);
+ in_queue = pk_package_list_contains (application->priv->package_list, item->package_id);
+ installed = (item->info_enum == PK_INFO_ENUM_INSTALLED) || (item->info == PK_INFO_ENUM_COLLECTION_INSTALLED);
if (installed)
pk_bitfield_add (state, GPK_STATE_INSTALLED);
@@ -1003,18 +1003,18 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkItemPac
pk_bitfield_add (state, GPK_STATE_IN_LIST);
/* special icon */
- if (obj->info_enum == PK_INFO_ENUM_COLLECTION_INSTALLED || obj->info == PK_INFO_ENUM_COLLECTION_AVAILABLE)
+ if (item->info_enum == PK_INFO_ENUM_COLLECTION_INSTALLED || item->info == PK_INFO_ENUM_COLLECTION_AVAILABLE)
pk_bitfield_add (state, GPK_STATE_COLLECTION);
/* use the application icon if available */
- icon = gpk_desktop_guess_icon_name (application->priv->desktop, obj->package_id->namexxxneedtosplitxxx);
+ icon = gpk_desktop_guess_icon_name (application->priv->desktop, item->package_id->namexxxneedtosplitxxx);
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->package_id, summary);
+ text = gpk_package_id_format_twoline (item->package_id, summary);
/* can we modify this? */
enabled = gpk_application_get_checkbox_enable (application, state);
@@ -1025,8 +1025,8 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkItemPac
PACKAGES_COLUMN_CHECKBOX, installed ^ in_queue,
PACKAGES_COLUMN_CHECKBOX_VISIBLE, enabled,
PACKAGES_COLUMN_TEXT, text,
- PACKAGES_COLUMN_SUMMARY, obj->summary,
- PACKAGES_COLUMN_ID, obj->package_id,
+ PACKAGES_COLUMN_SUMMARY, item->summary,
+ PACKAGES_COLUMN_ID, item->package_id,
PACKAGES_COLUMN_IMAGE, icon,
-1);
@@ -1044,13 +1044,13 @@ gpk_application_add_obj_to_results (GpkApplication *application, const PkItemPac
* gpk_application_package_cb:
**/
static void
-gpk_application_package_cb (PkClient *client, const PkItemPackage *obj, GpkApplication *application)
+gpk_application_package_cb (PkClient *client, const PkItemPackage *item, 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_enum), obj->package_id->namexxxneedtosplitxxx, obj->summary);
+ egg_debug ("package = %s:%s:%s", pk_info_enum_to_text (item->info_enum), item->package_id->namexxxneedtosplitxxx, item->summary);
/* ignore not search data */
#if PK_CHECK_VERSION(0,5,1)
@@ -1066,12 +1066,12 @@ gpk_application_package_cb (PkClient *client, const PkItemPackage *obj, GpkAppli
return;
/* ignore progress */
- if (obj->info_enum != PK_INFO_ENUM_INSTALLED && obj->info != PK_INFO_ENUM_AVAILABLE &&
- obj->info_enum != PK_INFO_ENUM_COLLECTION_INSTALLED && obj->info != PK_INFO_ENUM_COLLECTION_AVAILABLE)
+ if (item->info_enum != PK_INFO_ENUM_INSTALLED && item->info != PK_INFO_ENUM_AVAILABLE &&
+ item->info_enum != PK_INFO_ENUM_COLLECTION_INSTALLED && item->info != PK_INFO_ENUM_COLLECTION_AVAILABLE)
return;
/* add to list */
- gpk_application_add_obj_to_results (application, obj);
+ gpk_application_add_item_to_results (application, item);
}
/**
@@ -1333,7 +1333,7 @@ gpk_application_run_installed (GpkApplication *application)
guint i;
guint len;
GPtrArray *list;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
GPtrArray *array;
gchar **package_ids = NULL;
@@ -1342,9 +1342,9 @@ gpk_application_run_installed (GpkApplication *application)
list = pk_results_get_package_array (application->priv->client_primary);
len = PK_OBJ_LIST (list)->len;
for (i=0; i<len; i++) {
- obj = g_ptr_array_index (list, i);
- if (obj->info_enum == PK_INFO_ENUM_INSTALLING)
- g_ptr_array_add (array, g_strdup (obj->package_id));
+ item = g_ptr_array_index (list, i);
+ if (item->info_enum == PK_INFO_ENUM_INSTALLING)
+ g_ptr_array_add (array, g_strdup (item->package_id));
}
/* nothing to show */
@@ -1499,7 +1499,7 @@ gpk_application_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runti
gpk_application_run_installed (application);
/* clear if success */
- pk_obj_list_clear (PK_OBJ_LIST (application->priv->package_list));
+ pk_item_list_clear (PK_OBJ_LIST (application->priv->package_list));
application->priv->action = PK_ACTION_NONE;
gpk_application_set_buttons_apply_clear (application);
}
@@ -1662,7 +1662,7 @@ gpk_application_populate_selected (GpkApplication *application)
guint i;
guint len;
GPtrArray *list;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
list = application->priv->package_list;
len = PK_OBJ_LIST (list)->len;
@@ -1675,8 +1675,8 @@ gpk_application_populate_selected (GpkApplication *application)
/* dump queue to package window */
for (i=0; i<len; i++) {
- obj = g_ptr_array_index (list, i);
- gpk_application_add_obj_to_results (application, obj);
+ item = g_ptr_array_index (list, i);
+ gpk_application_add_item_to_results (application, item);
}
out:
return TRUE;
@@ -1928,7 +1928,7 @@ gpk_application_button_clear_cb (GtkWidget *widget_button, GpkApplication *appli
}
/* clear queue */
- pk_obj_list_clear (PK_OBJ_LIST (application->priv->package_list));
+ pk_item_list_clear (PK_OBJ_LIST (application->priv->package_list));
/* force a button refresh */
selection = gtk_tree_view_get_selection (treeview);
@@ -2190,7 +2190,7 @@ out:
* gpk_application_connection_changed_cb:
**/
static void
-gpk_application_connection_changed_cb (PkConnection *pconnection, gboolean connected, GpkApplication *application)
+gpk_application_connection_changed_cb (PkControl *pconnection, gboolean connected, GpkApplication *application)
{
g_return_if_fail (GPK_IS_APPLICATION (application));
@@ -3308,8 +3308,8 @@ static void
gpk_application_categories_finished (GpkApplication *application)
{
GPtrArray *list;
- const PkCategoryObj *obj;
- const PkCategoryObj *obj2;
+ const PkCategoryObj *item;
+ const PkCategoryObj *item2;
GtkTreeIter iter;
GtkTreeIter iter2;
guint i, j;
@@ -3363,30 +3363,30 @@ gpk_application_categories_finished (GpkApplication *application)
}
for (i=0; i < list->len; i++) {
- obj = g_ptr_array_index (list, i);
+ item = g_ptr_array_index (list, i);
gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
gtk_tree_store_set (application->priv->groups_store, &iter,
- GROUPS_COLUMN_NAME, obj->name,
- GROUPS_COLUMN_SUMMARY, obj->summary,
- GROUPS_COLUMN_ID, obj->cat_id,
- GROUPS_COLUMN_ICON, obj->icon,
+ GROUPS_COLUMN_NAME, item->name,
+ GROUPS_COLUMN_SUMMARY, item->summary,
+ GROUPS_COLUMN_ID, item->cat_id,
+ GROUPS_COLUMN_ICON, item->icon,
GROUPS_COLUMN_ACTIVE, FALSE,
-1);
j = 0;
do {
/* only allows groups two layers deep */
- obj2 = g_ptr_array_index (list, j);
- if (g_strcmp0 (obj2->parent_id, obj->cat_id) == 0) {
+ item2 = g_ptr_array_index (list, j);
+ if (g_strcmp0 (item2->parent_id, item->cat_id) == 0) {
gtk_tree_store_append (application->priv->groups_store, &iter2, &iter);
gtk_tree_store_set (application->priv->groups_store, &iter2,
- GROUPS_COLUMN_NAME, obj2->name,
- GROUPS_COLUMN_SUMMARY, obj2->summary,
- GROUPS_COLUMN_ID, obj2->cat_id,
- GROUPS_COLUMN_ICON, obj2->icon,
+ GROUPS_COLUMN_NAME, item2->name,
+ GROUPS_COLUMN_SUMMARY, item2->summary,
+ GROUPS_COLUMN_ID, item2->cat_id,
+ GROUPS_COLUMN_ICON, item2->icon,
GROUPS_COLUMN_ACTIVE, TRUE,
-1);
- pk_obj_list_remove (list, obj2);
+ pk_item_list_remove (list, item2);
} else
j++;
} while (j < list->len);
diff --git a/src/gpk-auto-refresh.c b/src/gpk-auto-refresh.c
index b935041..79beeb6 100644
--- a/src/gpk-auto-refresh.c
+++ b/src/gpk-auto-refresh.c
@@ -551,13 +551,41 @@ gpk_auto_refresh_client_changed_cb (DkpClient *client, GpkAutoRefresh *arefresh)
}
/**
+ * gpk_auto_refresh_get_properties_cb:
+ **/
+static void
+gpk_auto_refresh_get_properties_cb (GObject *object, GAsyncResult *res, GpkAutoRefresh *arefresh)
+{
+ PkNetworkEnum state;
+ GError *error = NULL;
+ PkControl *control = PK_CONTROL(object);
+ gboolean ret;
+
+ /* get the result */
+ ret = pk_control_get_properties_finish (control, res, &error);
+ if (!ret) {
+ /* TRANSLATORS: backend is broken, and won't tell us what it supports */
+ egg_warning ("could not get properties");
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get values */
+ g_object_get (control,
+ "network-state", &state,
+ NULL);
+ arefresh->priv->network_active = gpk_auto_refresh_convert_network_state (arefresh, state);
+out:
+ return;
+}
+
+/**
* gpk_auto_refresh_init:
* @auto_refresh: This class instance
**/
static void
gpk_auto_refresh_init (GpkAutoRefresh *arefresh)
{
-// PkNetworkEnum state;
arefresh->priv = GPK_AUTO_REFRESH_GET_PRIVATE (arefresh);
arefresh->priv->on_battery = FALSE;
arefresh->priv->network_active = FALSE;
@@ -579,8 +607,9 @@ gpk_auto_refresh_init (GpkAutoRefresh *arefresh)
arefresh->priv->control = pk_control_new ();
g_signal_connect (arefresh->priv->control, "notify::network-state",
G_CALLBACK (gpk_auto_refresh_notify_network_state_cb), arefresh);
-// state = pk_control_get_network_state (arefresh->priv->control, NULL);
-// arefresh->priv->network_active = gpk_auto_refresh_convert_network_state (arefresh, state);
+
+ /* get network state */
+ pk_control_get_properties_async (control, NULL, (GAsyncReadyCallback) gpk_auto_refresh_get_properties_cb, arefresh);
/* use a DkpClient */
arefresh->priv->client = dkp_client_new ();
diff --git a/src/gpk-check-update.c b/src/gpk-check-update.c
index 4a21105..93ccaaa 100644
--- a/src/gpk-check-update.c
+++ b/src/gpk-check-update.c
@@ -545,7 +545,7 @@ gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, GPtrArray *li
{
guint i;
PkBitfield infos = 0;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), PK_INFO_ENUM_UNKNOWN);
@@ -555,13 +555,13 @@ gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, GPtrArray *li
/* add each status to a list */
for (i=0; i<list->len; i++) {
- obj = g_ptr_array_index (list, i);
- if (obj == NULL) {
- egg_warning ("not found obj %i", i);
+ item = g_ptr_array_index (list, i);
+ if (item == NULL) {
+ egg_warning ("not found item %i", i);
break;
}
- egg_debug ("%s %s", obj->package_id->namexxxneedtosplitxxx, pk_info_enum_to_text (obj->info_enum));
- pk_bitfield_add (infos, obj->info_enum);
+ egg_debug ("%s %s", item->package_id->namexxxneedtosplitxxx, pk_info_enum_to_text (item->info_enum));
+ pk_bitfield_add (infos, item->info_enum);
}
return infos;
}
@@ -761,7 +761,7 @@ gpk_check_update_policy_all_idle_cb (GpkCheckUpdate *cupdate)
static gboolean
gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboolean policy_action)
{
- const PkItemPackage *obj;
+ const PkItemPackage *item;
guint i;
guint more;
guint showing = 0;
@@ -782,7 +782,7 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboo
/* filter out the same package with multiple architectures */
pk_package_list_set_fuzzy_arch (list, TRUE);
- pk_obj_list_remove_duplicate (PK_OBJ_LIST(list));
+ pk_item_list_remove_duplicate (PK_OBJ_LIST(list));
/* we have updates to process */
status_security = g_string_new ("");
@@ -801,22 +801,22 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboo
/* find the security updates first */
for (i=0; i<list->len; i++) {
- obj = g_ptr_array_index (list, i);
- if (obj->info_enum == PK_INFO_ENUM_SECURITY) {
+ item = g_ptr_array_index (list, i);
+ if (item->info_enum == PK_INFO_ENUM_SECURITY) {
/* add to array */
- g_ptr_array_add (security_array, g_strdup (obj->package_id));
+ g_ptr_array_add (security_array, g_strdup (item->package_id));
}
}
/* get the security update text */
for (i=0; i<length; i++) {
- obj = g_ptr_array_index (list, i);
- if (obj->info_enum != PK_INFO_ENUM_SECURITY)
+ item = g_ptr_array_index (list, i);
+ if (item->info_enum != 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->package_id->namexxxneedtosplitxxx, obj->summary);
+ item->package_id->namexxxneedtosplitxxx, item->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 */
@@ -1085,7 +1085,7 @@ gpk_check_update_process_distro_upgrades (GpkCheckUpdate *cupdate, GPtrArray *ar
gboolean ret;
GError *error = NULL;
guint i;
- PkDistroUpgradeObj *obj;
+ PkDistroUpgradeObj *item;
const gchar *title;
NotifyNotification *notification;
GString *string = NULL;
@@ -1107,8 +1107,8 @@ gpk_check_update_process_distro_upgrades (GpkCheckUpdate *cupdate, GPtrArray *ar
/* find the upgrade string */
string = g_string_new ("");
for (i=0; i < array->len; i++) {
- obj = (PkDistroUpgradeObj *) g_ptr_array_index (array, i);
- g_string_append_printf (string, "%s (%s)\n", obj->name, pk_distro_upgrade_enum_to_text (obj->state));
+ item = (PkDistroUpgradeObj *) g_ptr_array_index (array, i);
+ g_string_append_printf (string, "%s (%s)\n", item->name, pk_distro_upgrade_enum_to_text (item->state));
}
if (string->len != 0)
g_string_set_size (string, string->len-1);
@@ -1281,7 +1281,7 @@ gpk_check_update_finished_notify (GpkCheckUpdate *cupdate, PkClient *client)
PkRestartEnum restart;
guint i;
GPtrArray *list;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
GString *message_text;
guint skipped_number = 0;
const gchar *message;
@@ -1298,13 +1298,13 @@ gpk_check_update_finished_notify (GpkCheckUpdate *cupdate, PkClient *client)
/* find any we skipped */
for (i=0; i<list->len; i++) {
- obj = g_ptr_array_index (list, i);
- egg_debug ("%s, %s, %s", pk_info_enum_to_text (obj->info_enum),
- obj->package_id->namexxxneedtosplitxxx, obj->summary);
- if (obj->info_enum == PK_INFO_ENUM_BLOCKED) {
+ item = g_ptr_array_index (list, i);
+ egg_debug ("%s, %s, %s", pk_info_enum_to_text (item->info_enum),
+ item->package_id->namexxxneedtosplitxxx, item->summary);
+ if (item->info_enum == PK_INFO_ENUM_BLOCKED) {
skipped_number++;
g_string_append_printf (message_text, "<b>%s</b> - %s\n",
- obj->package_id->namexxxneedtosplitxxx, obj->summary);
+ item->package_id->namexxxneedtosplitxxx, item->summary);
}
}
g_object_unref (list);
diff --git a/src/gpk-common.c b/src/gpk-common.c
index 8499b23..3289871 100644
--- a/src/gpk-common.c
+++ b/src/gpk-common.c
@@ -50,6 +50,21 @@
/* static, so local to process */
static gboolean small_form_factor_mode = FALSE;
+gchar **
+pk_package_list_to_strv (GPtrArray *array)
+{
+ const PkItemPackage *item;
+ gchar **results;
+ guint i;
+
+ results = g_new0 (gchar *, array->len+1);
+ for (i=0; i<array->len; i++) {
+ item = g_ptr_array_index (array, i);
+ results[i] = g_strdup (item->package_id);
+ }
+ return results;
+}
+
/**
* pk_strv_to_ptr_array:
* @array: the gchar** array of strings
diff --git a/src/gpk-common.h b/src/gpk-common.h
index 383326a..e383b7f 100644
--- a/src/gpk-common.h
+++ b/src/gpk-common.h
@@ -114,6 +114,7 @@ gboolean gpk_window_set_parent_xid (GtkWindow *window,
guint32 xid);
GPtrArray *pk_strv_to_ptr_array (gchar **array)
G_GNUC_WARN_UNUSED_RESULT;
+gchar **pk_package_list_to_strv (GPtrArray *array);
G_END_DECLS
diff --git a/src/gpk-dbus-task.c b/src/gpk-dbus-task.c
index 4868474..84b9b17 100644
--- a/src/gpk-dbus-task.c
+++ b/src/gpk-dbus-task.c
@@ -620,7 +620,7 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
GError *error = NULL;
GError *error_local = NULL;
GPtrArray *list = NULL;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
gboolean already_installed = FALSE;
gchar *title = NULL;
gchar *message = NULL;
@@ -767,13 +767,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 = g_ptr_array_index (list, i);
- if (obj->info_enum == PK_INFO_ENUM_INSTALLED) {
+ item = g_ptr_array_index (list, i);
+ if (item->info_enum == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
- id = obj->package_id;
- } else if (obj->info_enum == PK_INFO_ENUM_AVAILABLE) {
- egg_debug ("package '%s' resolved to:", obj->package_id->namexxxneedtosplitxxx);
- id = obj->package_id;
+ id = item->package_id;
+ } else if (item->info_enum == PK_INFO_ENUM_AVAILABLE) {
+ egg_debug ("package '%s' resolved to:", item->package_id->namexxxneedtosplitxxx);
+ id = item->package_id;
}
}
@@ -816,20 +816,20 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
list = pk_results_get_package_array (task->priv->client_primary);
new = g_ptr_array_new_with_free_func_xxx ();
for (i=0; i<list->len; i++) {
- obj = g_ptr_array_index (list, i);
+ item = g_ptr_array_index (list, i);
#if PK_CHECK_VERSION(0,5,2)
/* not interesting */
- if (obj->info_enum != PK_INFO_ENUM_UPDATING &&
- obj->info_enum != PK_INFO_ENUM_INSTALLING)
+ if (item->info_enum != PK_INFO_ENUM_UPDATING &&
+ item->info_enum != PK_INFO_ENUM_INSTALLING)
continue;
#endif
/* is this package already local */
- if (g_strcmp0 (obj->package_id->data, "local") == 0)
+ if (g_strcmp0 (item->package_id->data, "local") == 0)
continue;
- g_ptr_array_add_xxxwithrecount (new, obj->info_enum, obj->package_id, obj->summary);
+ g_ptr_array_add_xxxwithrecount (new, item->info_enum, item->package_id, item->summary);
}
/* these are the new packages */
@@ -899,9 +899,9 @@ skip_checks:
/* filter out installed */
for (i=0; i<PK_OBJ_LIST(list)->len; i++) {
- obj = g_ptr_array_index (PK_OBJ_LIST (list), i);
- if (obj->info_enum != PK_INFO_ENUM_INSTALLING) {
- pk_obj_list_remove_index (PK_OBJ_LIST (list), i);
+ item = g_ptr_array_index (PK_OBJ_LIST (list), i);
+ if (item->info_enum != PK_INFO_ENUM_INSTALLING) {
+ pk_item_list_remove_index (PK_OBJ_LIST (list), i);
i--;
}
}
@@ -979,12 +979,12 @@ skip_checks:
/* see what we've got already */
for (i=0; i<len; i++) {
- obj = g_ptr_array_index (list, i);
- if (obj->info_enum == PK_INFO_ENUM_INSTALLED) {
+ item = g_ptr_array_index (list, i);
+ if (item->info_enum == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
- } else if (obj->info_enum == PK_INFO_ENUM_AVAILABLE) {
- egg_debug ("package '%s' resolved", obj->package_id->namexxxneedtosplitxxx);
- id = obj->package_id;
+ } else if (item->info_enum == PK_INFO_ENUM_AVAILABLE) {
+ egg_debug ("package '%s' resolved", item->package_id->namexxxneedtosplitxxx);
+ id = item->package_id;
//TODO: we need to list these in a gpk-dbus_task-chooser
}
}
@@ -1180,7 +1180,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 PkItemPackage *obj, GpkDbusTask *task)
+gpk_dbus_task_package_cb (PkClient *client, const PkItemPackage *item, GpkDbusTask *task)
{
gchar *text;
g_return_if_fail (GPK_IS_DBUS_TASK (task));
@@ -1188,7 +1188,7 @@ gpk_dbus_task_package_cb (PkClient *client, const PkItemPackage *obj, GpkDbusTas
if (!task->priv->show_progress)
return;
- text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
+ text = gpk_package_id_format_twoline (item->package_id, item->summary);
gpk_modal_dialog_set_message (task->priv->dialog, text);
g_free (text);
}
@@ -2269,8 +2269,8 @@ gpk_dbus_task_install_gstreamer_codec_part (GpkDbusTask *task, const gchar *code
{
GPtrArray *list = NULL;
gboolean ret;
- PkItemPackage *new_obj = NULL;
- const PkItemPackage *obj;
+ PkItemPackage *new_item = NULL;
+ const PkItemPackage *item;
guint len;
gchar *title;
@@ -2304,16 +2304,16 @@ 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 = g_ptr_array_index (list, 0);
- if (obj == NULL)
- egg_error ("obj cannot be NULL");
+ item = g_ptr_array_index (list, 0);
+ if (item == NULL)
+ egg_error ("item cannot be NULL");
/* copy the object */
- new_obj = pk_package_obj_copy (obj);
+ new_item = pk_package_item_copy (item);
out:
if (list != NULL)
g_object_unref (list);
- return new_obj;
+ return new_item;
}
/**
@@ -2430,7 +2430,7 @@ gpk_dbus_task_install_gstreamer_resources (GpkDbusTask *task, gchar **codec_name
GError *error_local = NULL;
guint i;
guint len;
- PkItemPackage *obj_new;
+ PkItemPackage *item_new;
gchar **parts;
GtkResponseType button;
gchar *info_url;
@@ -2481,8 +2481,8 @@ skip_checks:
egg_warning ("invalid line '%s', expecting a | delimiter", codec_names[i]);
continue;
}
- obj_new = gpk_dbus_task_install_gstreamer_codec_part (task, parts[0], parts[1], &error_local);
- if (obj_new == NULL) {
+ item_new = gpk_dbus_task_install_gstreamer_codec_part (task, parts[0], parts[1], &error_local);
+ if (item_new == NULL) {
if (task->priv->show_warning) {
info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_CODEC);
/* only show the "more info" button if there is a valid link */
@@ -2508,8 +2508,8 @@ skip_checks:
dbus_g_method_return_error (task->priv->context, error);
goto out;
}
- g_ptr_array_add (PK_OBJ_LIST(list), obj_new);
- pk_package_obj_free (obj_new);
+ g_ptr_array_add (PK_OBJ_LIST(list), item_new);
+ pk_package_item_free (item_new);
g_strfreev (parts);
}
@@ -3111,7 +3111,7 @@ gpk_dbus_task_get_package_for_exec (GpkDbusTask *task, const gchar *exec)
gboolean ret;
GError *error = NULL;
GPtrArray *list = NULL;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
/* set timeout */
pk_client_set_timeout (task->priv->client_primary, task->priv->timeout, NULL);
@@ -3138,8 +3138,8 @@ gpk_dbus_task_get_package_for_exec (GpkDbusTask *task, const gchar *exec)
egg_warning ("not one return, using first");
/* copy name */
- obj = g_ptr_array_index (list, 0);
- package = g_strdup (obj->package_id->namexxxneedtosplitxxx);
+ item = g_ptr_array_index (list, 0);
+ package = g_strdup (item->package_id->namexxxneedtosplitxxx);
egg_debug ("got package %s", package);
out:
diff --git a/src/gpk-firmware.c b/src/gpk-firmware.c
index 9e4b72b..278ba0c 100644
--- a/src/gpk-firmware.c
+++ b/src/gpk-firmware.c
@@ -337,7 +337,7 @@ gpk_firmware_check_available (GpkFirmware *firmware, const gchar *filename)
guint length = 0;
GPtrArray *list = NULL;
GError *error = NULL;
- PkItemPackage *obj = NULL;
+ PkItemPackage *item = NULL;
PkBitfield filter;
/* search for newest not installed package */
@@ -356,11 +356,11 @@ gpk_firmware_check_available (GpkFirmware *firmware, const gchar *filename)
else if (list->len != 1)
egg_warning ("not one package providing %s found (%i)", filename, length);
else
- obj = pk_package_obj_copy (g_ptr_array_index (list, 0));
+ item = pk_package_item_copy (g_ptr_array_index (list, 0));
out:
if (list != NULL)
g_object_unref (list);
- return obj;
+ return item;
}
/**
@@ -376,7 +376,7 @@ gpk_firmware_timeout_cb (gpointer data)
NotifyNotification *notification;
GPtrArray *array;
GError *error = NULL;
- PkItemPackage *obj = NULL;
+ PkItemPackage *item = NULL;
const GpkFirmwareRequest *req;
gboolean has_data = FALSE;
@@ -388,10 +388,10 @@ gpk_firmware_timeout_cb (gpointer data)
for (i=0; i<array->len; i++) {
req = g_ptr_array_index (array, i);
/* save to new array if we found one package for this file */
- obj = gpk_firmware_check_available (firmware, req->filename);
- if (obj != NULL) {
- g_ptr_array_add (PK_OBJ_LIST (firmware->priv->packages_found), obj);
- pk_package_obj_free (obj);
+ item = gpk_firmware_check_available (firmware, req->filename);
+ if (item != NULL) {
+ g_ptr_array_add (PK_OBJ_LIST (firmware->priv->packages_found), item);
+ pk_package_item_free (item);
}
}
@@ -402,7 +402,7 @@ gpk_firmware_timeout_cb (gpointer data)
}
/* check we don't want the same package more than once */
- pk_obj_list_remove_duplicate (PK_OBJ_LIST (firmware->priv->packages_found));
+ pk_item_list_remove_duplicate (PK_OBJ_LIST (firmware->priv->packages_found));
/* have we got any models to list */
for (i=0; i<array->len; i++) {
@@ -1023,7 +1023,7 @@ gpk_firmware_finalize (GObject *object)
g_return_if_fail (firmware->priv != NULL);
g_ptr_array_foreach (firmware->priv->array_requested, (GFunc) gpk_firmware_request_free, NULL);
g_ptr_array_free (firmware->priv->array_requested, TRUE);
- g_object_unref (firmware->priv->packages_found);
+ g_ptr_array_unref (firmware->priv->packages_found);
g_object_unref (firmware->priv->client);
g_object_unref (firmware->priv->gconf_client);
g_object_unref (firmware->priv->consolekit);
diff --git a/src/gpk-hardware.c b/src/gpk-hardware.c
index 3d9d640..706c680 100644
--- a/src/gpk-hardware.c
+++ b/src/gpk-hardware.c
@@ -125,7 +125,7 @@ gpk_hardware_check_for_driver_available (GpkHardware *hardware, const gchar *udi
GError *error = NULL;
gchar *package = NULL;
GPtrArray *list = NULL;
- const PkItemPackage *obj = NULL;
+ const PkItemPackage *item = NULL;
PkClient *client = NULL;
client = pk_client_new ();
@@ -146,8 +146,8 @@ gpk_hardware_check_for_driver_available (GpkHardware *hardware, const gchar *udi
}
/* only install the first one? */
- obj = g_ptr_array_index (list, 0);
- package = gpk_package_id_format_oneline (obj->package_id, obj->summary);
+ item = g_ptr_array_index (list, 0);
+ package = gpk_package_id_format_oneline (item->package_id, item->summary);
/* save list */
if (hardware->priv->package_ids != NULL)
diff --git a/src/gpk-helper-chooser.c b/src/gpk-helper-chooser.c
index e4869c9..e18955c 100644
--- a/src/gpk-helper-chooser.c
+++ b/src/gpk-helper-chooser.c
@@ -165,29 +165,32 @@ gpk_helper_chooser_show (GpkHelperChooser *helper, GPtrArray *list)
gchar *text;
const gchar *icon_name;
guint i;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
GtkTreeIter iter;
+ gchar **split;
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 */
for (i=0; i<list->len; i++) {
- obj = g_ptr_array_index (list, i);
- egg_debug ("package '%s' got:", obj->package_id->namexxxneedtosplitxxx);
+ item = g_ptr_array_index (list, i);
+ egg_debug ("package '%s' got:", item->package_id);
/* put formatted text into treeview */
gtk_list_store_append (helper->priv->list_store, &iter);
- text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
+ text = gpk_package_id_format_twoline (item->package_id, item->summary);
/* get the icon */
- icon_name = gpk_desktop_guess_icon_name (helper->priv->desktop, obj->package_id->namexxxneedtosplitxxx);
+ split = pk_package_id_split (item->package_id);
+ icon_name = gpk_desktop_guess_icon_name (helper->priv->desktop, split[PK_PACKAGE_ID_NAME]);
+ g_strfreev (split);
if (icon_name == NULL)
- icon_name = gpk_info_enum_to_icon_name (obj->info_enum);
+ icon_name = gpk_info_enum_to_icon_name (item->info);
gtk_list_store_set (helper->priv->list_store, &iter,
GPK_CHOOSER_COLUMN_TEXT, text,
- GPK_CHOOSER_COLUMN_ID, obj->package_id, -1);
+ GPK_CHOOSER_COLUMN_ID, item->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-deps-update.c b/src/gpk-helper-deps-update.c
index 1f0cb6c..20896d9 100644
--- a/src/gpk-helper-deps-update.c
+++ b/src/gpk-helper-deps-update.c
@@ -65,20 +65,20 @@ gpk_helper_deps_update_show (GpkHelperDepsUpdate *helper, GPtrArray *deps_list)
gboolean ret;
GtkWidget *dialog;
GtkResponseType response;
- const PkItemPackage *obj;
+ PkItemPackage *item;
guint i;
/* save deps list */
if (helper->priv->list != NULL)
g_object_unref (helper->priv->list);
- helper->priv->list = g_ptr_array_new_with_free_func_xxx ();;
+ helper->priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_item_package_unref);
/* copy only installing, updating etc */
for (i=0; i<deps_list->len; i++) {
- obj = g_ptr_array_index (deps_list, i);
- if (obj->info_enum == PK_INFO_ENUM_INSTALLING ||
- obj->info_enum == PK_INFO_ENUM_UPDATING)
- g_ptr_array_add_xxxwithrecount (helper->priv->list, obj->info_enum, obj->package_id, obj->summary);
+ item = g_ptr_array_index (deps_list, i);
+ if (item->info == PK_INFO_ENUM_INSTALLING ||
+ item->info == PK_INFO_ENUM_UPDATING)
+ g_ptr_array_add (helper->priv->list, pk_item_package_ref (item));
}
/* empty list */
@@ -98,12 +98,12 @@ gpk_helper_deps_update_show (GpkHelperDepsUpdate *helper, GPtrArray *deps_list)
/* TRANSLATORS: title: tell the user we have to install additional updates */
title = g_strdup_printf (ngettext ("%i additional update also has to be installed",
"%i additional update also have to be installed",
- length), length);
+ deps_list->len), deps_list->len);
/* TRANSLATORS: message: describe in detail why it must happen */
message = ngettext ("To perform this update, an additional package also has to be downloaded.",
"To perform this update, additional packages also have to be downloaded.",
- length);
+ deps_list->len);
dialog = gtk_message_dialog_new (helper->priv->window, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO, GTK_BUTTONS_CANCEL, "%s", title);
diff --git a/src/gpk-service-pack.c b/src/gpk-service-pack.c
index db4f0ed..3d73c7d 100644
--- a/src/gpk-service-pack.c
+++ b/src/gpk-service-pack.c
@@ -139,14 +139,14 @@ gpk_pack_widgets_activate (gboolean enable)
* gpk_pack_package_cb:
**/
static void
-gpk_pack_package_cb (PkServicePack *pack, const PkItemPackage *obj, gpointer data)
+gpk_pack_package_cb (PkServicePack *pack, const PkItemPackage *item, 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->package_id->namexxxneedtosplitxxx, obj->package_id->version, obj->package_id->arch);
+ text = g_strdup_printf ("%s: %s-%s.%s", _("Downloading"), item->package_id->namexxxneedtosplitxxx, item->package_id->version, item->package_id->arch);
gtk_progress_bar_set_text (progress_bar, text);
g_free (text);
}
@@ -221,7 +221,7 @@ gpk_pack_resolve_package_id (const gchar *package)
gchar *package_id = NULL;
gchar **packages = NULL;
GError *error = NULL;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
gboolean ret = FALSE;
/* get package list */
@@ -245,8 +245,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 = g_ptr_array_index (list, 0);
- package_id = g_strdup (obj->package_id);
+ item = g_ptr_array_index (list, 0);
+ package_id = g_strdup (item->package_id);
out:
if (list != NULL)
@@ -331,7 +331,7 @@ gpk_pack_copy_package_lists (const gchar *filename, GError **error)
list = pk_results_get_package_array (client);
/* write new file : FIXME: return a GError */
- ret = pk_obj_list_to_file (list, filename);
+ ret = pk_item_list_to_file (list, filename);
if (!ret) {
/* TRANSLATORS: we could not write to the destination directory for some reason */
*error = g_error_new (1, 0, _("Could not write package list"));
@@ -437,7 +437,7 @@ gpk_pack_button_create_cb (GtkWidget *widget2, gpointer data)
/* add the exclude list */
list = g_ptr_array_new_with_free_func_xxx ();
- ret = pk_obj_list_from_file (list, exclude);
+ ret = pk_item_list_from_file (list, exclude);
if (!ret) {
widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_pack"));
/* TRANSLATORS: we could not read the file list for the destination computer */
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index e1b4730..4b95d45 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -511,7 +511,7 @@ gpk_update_viewer_model_get_path (GtkTreeModel *model, const gchar *id)
* gpk_update_viewer_details_cb:
**/
static void
-gpk_update_viewer_details_cb (PkClient *client, const PkDetailsObj *obj, gpointer data)
+gpk_update_viewer_details_cb (PkClient *client, const PkDetailsObj *item, gpointer data)
{
GtkTreeView *treeview;
GtkTreeModel *model;
@@ -521,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->package_id);
+ path = gpk_update_viewer_model_get_path (model, item->package_id);
if (path == NULL) {
egg_debug ("not found ID for details");
return;
@@ -530,12 +530,12 @@ gpk_update_viewer_details_cb (PkClient *client, const PkDetailsObj *obj, gpointe
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_path_free (path);
gtk_list_store_set (list_store_updates, &iter,
- GPK_UPDATES_COLUMN_DETAILS_OBJ, (gpointer) pk_details_obj_copy (obj),
- GPK_UPDATES_COLUMN_SIZE, (gint)obj->size,
- GPK_UPDATES_COLUMN_SIZE_DISPLAY, (gint)obj->size,
+ GPK_UPDATES_COLUMN_DETAILS_OBJ, (gpointer) pk_details_item_copy (item),
+ GPK_UPDATES_COLUMN_SIZE, (gint)item->size,
+ GPK_UPDATES_COLUMN_SIZE_DISPLAY, (gint)item->size,
-1);
/* in cache */
- if (obj->size == 0)
+ if (item->size == 0)
gtk_list_store_set (list_store_updates, &iter,
GPK_UPDATES_COLUMN_STATUS, GPK_INFO_ENUM_DOWNLOADED, -1);
}
@@ -565,7 +565,7 @@ gpk_update_viewer_is_update_info (PkInfoEnum info)
* gpk_update_viewer_package_cb:
**/
static void
-gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *obj, gpointer data)
+gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *item, gpointer data)
{
PkRoleEnum role;
PkInfoEnum info;
@@ -580,32 +580,32 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *obj, gpoint
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_enum), obj->package_id->namexxxneedtosplitxxx, obj->summary);
+ pk_info_enum_to_text (item->info_enum), item->package_id->namexxxneedtosplitxxx, item->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", obj->package_id);
+ egg_debug ("ignoring %s as we are simulating", item->package_id);
goto out;
}
#else
if (role == PK_ROLE_ENUM_GET_DEPENDS) {
- egg_debug ("ignoring %s as we are in the depends phase", obj->package_id);
+ egg_debug ("ignoring %s as we are in the depends phase", item->package_id);
goto out;
}
#endif
/* used for progress */
- if (!gpk_update_viewer_is_update_info (obj->info_enum)) {
+ if (!gpk_update_viewer_is_update_info (item->info_enum)) {
g_free (package_id_last);
- package_id_last = pk_package_id_copy (obj->package_id);
+ package_id_last = pk_package_id_copy (item->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->package_id);
+ path = gpk_update_viewer_model_get_path (model, item->package_id);
if (path == NULL) {
egg_debug ("not found ID for package");
goto out;
@@ -621,14 +621,14 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *obj, gpoint
}
/* if the info is finished, change the status to past tense */
- if (obj->info_enum == PK_INFO_ENUM_FINISHED) {
+ if (item->info_enum == PK_INFO_ENUM_FINISHED) {
gtk_tree_model_get (model, &iter,
GPK_UPDATES_COLUMN_STATUS, &info, -1);
/* promote to past tense if present tense */
if (info < PK_INFO_ENUM_UNKNOWN)
info += PK_INFO_ENUM_UNKNOWN;
} else {
- info = obj->info_enum;
+ info = item->info_enum;
}
gtk_list_store_set (list_store_updates, &iter,
GPK_UPDATES_COLUMN_STATUS, info, -1);
@@ -637,19 +637,19 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *obj, gpoint
/* set package description */
//widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_package"));
- //gtk_label_set_label (GTK_LABEL (widget), obj->summary);
+ //gtk_label_set_label (GTK_LABEL (widget), item->summary);
goto out;
}
/* add to list store */
- text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
- selected = (obj->info_enum != PK_INFO_ENUM_BLOCKED);
+ text = gpk_package_id_format_twoline (item->package_id, item->summary);
+ selected = (item->info_enum != PK_INFO_ENUM_BLOCKED);
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_INFO, obj->info_enum,
+ GPK_UPDATES_COLUMN_INFO, item->info_enum,
GPK_UPDATES_COLUMN_SELECT, selected,
GPK_UPDATES_COLUMN_SENSITIVE, selected,
GPK_UPDATES_COLUMN_CLICKABLE, selected,
@@ -668,7 +668,7 @@ out:
* gpk_update_viewer_update_detail_cb:
**/
static void
-gpk_update_viewer_update_detail_cb (PkClient *client, const PkUpdateDetailObj *obj, gpointer data)
+gpk_update_viewer_update_detail_cb (PkClient *client, const PkUpdateDetailObj *item, gpointer data)
{
GtkTreeView *treeview;
GtkTreeModel *model;
@@ -678,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->package_id);
+ path = gpk_update_viewer_model_get_path (model, item->package_id);
if (path == NULL) {
egg_warning ("not found ID for update detail");
return;
@@ -687,8 +687,8 @@ gpk_update_viewer_update_detail_cb (PkClient *client, const PkUpdateDetailObj *o
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_path_free (path);
gtk_list_store_set (list_store_updates, &iter,
- GPK_UPDATES_COLUMN_UPDATE_DETAIL_OBJ, (gpointer) pk_update_detail_obj_copy (obj),
- GPK_UPDATES_COLUMN_RESTART, obj->restart, -1);
+ GPK_UPDATES_COLUMN_UPDATE_DETAIL_OBJ, (gpointer) pk_update_detail_item_copy (item),
+ GPK_UPDATES_COLUMN_RESTART, item->restart, -1);
}
/**
@@ -1214,7 +1214,7 @@ gpk_update_viewer_get_uris (const gchar *url_string)
* gpk_update_viewer_populate_details:
**/
static void
-gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
+gpk_update_viewer_populate_details (const PkUpdateDetailObj *item)
{
GtkTreeView *treeview;
GtkTreeSelection *selection;
@@ -1266,9 +1266,9 @@ gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
}
/* issued and updated */
- if (obj->issued != NULL && obj->updated != NULL) {
- issued = pk_iso8601_from_date (obj->issued);
- updated = pk_iso8601_from_date (obj->updated);
+ if (item->issued != NULL && item->updated != NULL) {
+ issued = pk_iso8601_from_date (item->issued);
+ updated = pk_iso8601_from_date (item->updated);
/* TRANSLATORS: this is when the notification was issued and then updated*/
line = g_strdup_printf (_("This notification was issued on %s and last updated on %s."), issued, updated);
gtk_text_buffer_insert_with_tags_by_name (text_buffer, &iter, line, -1, "para", NULL);
@@ -1276,8 +1276,8 @@ gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
g_free (issued);
g_free (updated);
g_free (line);
- } else if (obj->issued != NULL) {
- issued = pk_iso8601_from_date (obj->issued);
+ } else if (item->issued != NULL) {
+ issued = pk_iso8601_from_date (item->issued);
/* TRANSLATORS: this is when the update was issued */
line = g_strdup_printf (_("This notification was issued on %s."), issued);
gtk_text_buffer_insert_with_tags_by_name (text_buffer, &iter, line, -1, "para", NULL);
@@ -1287,9 +1287,9 @@ gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
}
/* update text */
- if (!egg_strzero (obj->update_text)) {
+ if (!egg_strzero (item->update_text)) {
/* convert the bullets */
- line = egg_markdown_parse (markdown, obj->update_text);
+ line = egg_markdown_parse (markdown, item->update_text);
if (!egg_strzero (line)) {
gtk_text_buffer_insert_markup (text_buffer, &iter, line);
gtk_text_buffer_insert (text_buffer, &iter, "\n\n", -1);
@@ -1299,8 +1299,8 @@ gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
}
/* add all the links */
- if (!egg_strzero (obj->vendor_url)) {
- array = gpk_update_viewer_get_uris (obj->vendor_url);
+ if (!egg_strzero (item->vendor_url)) {
+ array = gpk_update_viewer_get_uris (item->vendor_url);
/* TRANSLATORS: this is a list of vendor URLs */
title = ngettext ("For more information about this update please visit this website:",
"For more information about this update please visit these websites:", array->len);
@@ -1308,8 +1308,8 @@ gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
g_ptr_array_foreach (array, (GFunc) g_free, NULL);
g_ptr_array_free (array, TRUE);
}
- if (!egg_strzero (obj->bugzilla_url)) {
- array = gpk_update_viewer_get_uris (obj->bugzilla_url);
+ if (!egg_strzero (item->bugzilla_url)) {
+ array = gpk_update_viewer_get_uris (item->bugzilla_url);
/* TRANSLATORS: this is a list of bugzilla URLs */
title = ngettext ("For more information about bugs fixed by this update please visit this website:",
"For more information about bugs fixed by this update please visit these websites:", array->len);
@@ -1317,8 +1317,8 @@ gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
g_ptr_array_foreach (array, (GFunc) g_free, NULL);
g_ptr_array_free (array, TRUE);
}
- if (!egg_strzero (obj->cve_url)) {
- array = gpk_update_viewer_get_uris (obj->cve_url);
+ if (!egg_strzero (item->cve_url)) {
+ array = gpk_update_viewer_get_uris (item->cve_url);
/* TRANSLATORS: this is a list of CVE (security) URLs */
title = ngettext ("For more information about this security update please visit this website:",
"For more information about this security update please visit these websites:", array->len);
@@ -1328,30 +1328,30 @@ gpk_update_viewer_populate_details (const PkUpdateDetailObj *obj)
}
/* reboot */
- if (obj->restart == PK_RESTART_ENUM_SYSTEM) {
+ if (item->restart == PK_RESTART_ENUM_SYSTEM) {
/* TRANSLATORS: reboot required */
gtk_text_buffer_insert_with_tags_by_name (text_buffer, &iter, _("The computer will have to be restarted after the update for the changes to take effect."), -1, "para", NULL);
gtk_text_buffer_insert (text_buffer, &iter, "\n", -1);
- } else if (obj->restart == PK_RESTART_ENUM_SESSION) {
+ } else if (item->restart == PK_RESTART_ENUM_SESSION) {
/* TRANSLATORS: log out required */
gtk_text_buffer_insert_with_tags_by_name (text_buffer, &iter, _("You will need to log out and back in after the update for the changes to take effect."), -1, "para", NULL);
gtk_text_buffer_insert (text_buffer, &iter, "\n", -1);
}
/* state */
- if (obj->state == PK_UPDATE_STATE_ENUM_UNSTABLE) {
+ if (item->state == PK_UPDATE_STATE_ENUM_UNSTABLE) {
/* TRANSLATORS: this is the stability status of the update */
gtk_text_buffer_insert_with_tags_by_name (text_buffer, &iter, _("The classifaction of this update is unstable which means it is not designed for production use."), -1, "para", NULL);
gtk_text_buffer_insert (text_buffer, &iter, "\n", -1);
- } else if (obj->state == PK_UPDATE_STATE_ENUM_TESTING) {
+ } else if (item->state == PK_UPDATE_STATE_ENUM_TESTING) {
/* TRANSLATORS: this is the stability status of the update */
gtk_text_buffer_insert_with_tags_by_name (text_buffer, &iter, _("This is a test update, and is not designed for normal use. Please report any problems or regressions you encounter."), -1, "para", NULL);
gtk_text_buffer_insert (text_buffer, &iter, "\n", -1);
}
/* only show changelog if we didn't have any update text */
- if (!update_text && !egg_strzero (obj->changelog)) {
- line = egg_markdown_parse (markdown, obj->changelog);
+ if (!update_text && !egg_strzero (item->changelog)) {
+ line = egg_markdown_parse (markdown, item->changelog);
if (!egg_strzero (line)) {
/* TRANSLATORS: this is a ChangeLog */
line2 = g_strdup_printf ("%s\n%s\n", _("The developer logs will be shown as no description is available for this update:"), line);
@@ -1371,7 +1371,7 @@ gpk_packages_treeview_clicked_cb (GtkTreeSelection *selection, gpointer data)
GtkTreeModel *model;
GtkTreeIter iter;
gchar *package_id;
- PkUpdateDetailObj *obj = NULL;
+ PkUpdateDetailObj *item = NULL;
/* This will only work in single or browse selection mode! */
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -1380,12 +1380,12 @@ gpk_packages_treeview_clicked_cb (GtkTreeSelection *selection, gpointer data)
gtk_text_buffer_set_text (text_buffer, _("Loading..."), -1);
gtk_tree_model_get (model, &iter,
- GPK_UPDATES_COLUMN_UPDATE_DETAIL_OBJ, &obj,
+ GPK_UPDATES_COLUMN_UPDATE_DETAIL_OBJ, &item,
GPK_UPDATES_COLUMN_ID, &package_id, -1);
- egg_debug ("selected row is: %s, %p", package_id, obj);
+ egg_debug ("selected row is: %s, %p", package_id, item);
g_free (package_id);
- if (obj != NULL)
- gpk_update_viewer_populate_details (obj);
+ if (item != NULL)
+ gpk_update_viewer_populate_details (item);
} else {
egg_debug ("no row selected");
}
@@ -1399,7 +1399,7 @@ gpk_update_viewer_check_blocked_packages (GPtrArray *list)
{
guint i;
guint length;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
GString *string;
gboolean exists = FALSE;
gchar *text;
@@ -1409,9 +1409,9 @@ gpk_update_viewer_check_blocked_packages (GPtrArray *list)
/* find any that are blocked */
for (i=0;i<list->len;i++) {
- obj = g_ptr_array_index (list, i);
- if (obj->info_enum == PK_INFO_ENUM_BLOCKED) {
- text = gpk_package_id_format_oneline (obj->package_id, obj->summary);
+ item = g_ptr_array_index (list, i);
+ if (item->info_enum == PK_INFO_ENUM_BLOCKED) {
+ text = gpk_package_id_format_oneline (item->package_id, item->summary);
g_string_append_printf (string, "%s\n", text);
g_free (text);
exists = TRUE;
@@ -1627,7 +1627,7 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
guint i;
gboolean found;
gchar *text;
- const PkItemPackage *obj;
+ const PkItemPackage *item;
/* get model */
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview_updates"));
@@ -1643,7 +1643,7 @@ 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 = g_ptr_array_index (deps_list, i);
+ item = g_ptr_array_index (deps_list, i);
found = FALSE;
/* find it and select it */
@@ -1652,7 +1652,7 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
gtk_tree_model_get (model, &iter, GPK_UPDATES_COLUMN_ID, &package_id_temp, -1);
/* we found a match */
- if (g_strcmp0 (package_id_temp, obj->package_id)) {
+ if (g_strcmp0 (package_id_temp, item->package_id)) {
egg_debug ("selecting %s", id->name);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
GPK_UPDATES_COLUMN_SELECT, TRUE, -1);
@@ -1665,13 +1665,13 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
/* not found, so add */
if (!found) {
- text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
- egg_debug ("adding: id=%s, text=%s", obj->package_id, text);
+ text = gpk_package_id_format_twoline (item->package_id, item->summary);
+ egg_debug ("adding: id=%s, text=%s", item->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, obj->package_id,
- GPK_UPDATES_COLUMN_INFO, obj->info_enum,
+ GPK_UPDATES_COLUMN_ID, item->package_id,
+ GPK_UPDATES_COLUMN_INFO, item->info_enum,
GPK_UPDATES_COLUMN_SELECT, TRUE,
GPK_UPDATES_COLUMN_SENSITIVE, FALSE,
GPK_UPDATES_COLUMN_CLICKABLE, FALSE,
@@ -2493,19 +2493,19 @@ gpk_update_viewer_repo_signature_required_cb (PkClient *client, const gchar *pac
* pk_client_distro_upgrade_cb:
**/
static void
-pk_client_distro_upgrade_cb (PkClient *client, const PkDistroUpgradeObj *obj, gpointer data)
+pk_client_distro_upgrade_cb (PkClient *client, const PkDistroUpgradeObj *item, gpointer data)
{
gchar *text;
gchar *text_format;
GtkWidget *widget;
- if (obj->state != PK_UPDATE_STATE_ENUM_STABLE)
+ if (item->state != PK_UPDATE_STATE_ENUM_STABLE)
return;
/* only display last (newest) distro */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_upgrade"));
/* TRANSLATORS: new distro available, e.g. F9 to F10 */
- text = g_strdup_printf (_("New distribution upgrade release '%s' is available"), obj->summary);
+ text = g_strdup_printf (_("New distribution upgrade release '%s' is available"), item->summary);
text_format = g_strdup_printf ("<b>%s</b>", text);
gtk_label_set_label (GTK_LABEL (widget), text_format);
g_free (text);
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index ab96827..69cf194 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -69,7 +69,7 @@ struct GpkWatchPrivate
GpkInhibit *inhibit;
GpkModalDialog *dialog;
PkClient *client_primary;
- PkConnection *pconnection;
+ PkControl *pconnection;
PkTaskList *tlist;
PkRestartEnum restart;
GConfClient *gconf_client;
@@ -439,8 +439,8 @@ gpk_watch_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum
NotifyNotification *notification;
#if PK_CHECK_VERSION(0,5,0)
guint j;
- const PkItemRequireRestart *obj;
- const PkItemRequireRestart *obj_tmp;
+ const PkItemRequireRestart *item;
+ const PkItemRequireRestart *item_tmp;
GPtrArray *array;
#else
gchar *id;
@@ -478,17 +478,17 @@ gpk_watch_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum
goto no_data;
}
for (i=0; i<array->len; i++) {
- obj = g_ptr_array_index (array, i);
+ item = g_ptr_array_index (array, i);
/* is a lesser restart that what we have already */
- if (obj->restart != restart)
+ if (item->restart != restart)
continue;
/* is already in the list */
ret = FALSE;
for (j=0; j<array->len; j++) {
- obj_tmp = g_ptr_array_index (array, j);
- if (g_strcmp0 (obj_tmp->id->name, obj->package_id->namexxxneedtosplitxxx) == 0) {
+ item_tmp = g_ptr_array_index (array, j);
+ if (g_strcmp0 (item_tmp->id->name, item->package_id->namexxxneedtosplitxxx) == 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->package_id->namexxxneedtosplitxxx));
+ g_ptr_array_add (watch->priv->restart_package_names, g_strdup (item->package_id->namexxxneedtosplitxxx));
}
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 PkItemPackage *obj, GpkWatch *watch)
+gpk_watch_package_cb (PkClient *client, const PkItemPackage *item, GpkWatch *watch)
{
gchar *text;
- text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
+ text = gpk_package_id_format_twoline (item->package_id, item->summary);
gpk_modal_dialog_set_message (watch->priv->dialog, text);
g_free (text);
}
@@ -1158,12 +1158,12 @@ gpk_watch_monitor_tid (GpkWatch *watch, const gchar *tid)
ret = pk_client_get_package (watch->priv->client_primary, &package_id, NULL);
if (ret) {
gchar *id;
- PkItemPackage *obj;
+ PkItemPackage *item;
- obj = pk_package_obj_new (PK_INFO_ENUM_UNKNOWN, package_id, NULL);
+ item = pk_package_item_new (PK_INFO_ENUM_UNKNOWN, package_id, NULL);
egg_warning ("package_id=%s", package_id);
- gpk_watch_package_cb (watch->priv->client_primary, obj, watch);
- pk_package_obj_free (obj);
+ gpk_watch_package_cb (watch->priv->client_primary, item, watch);
+ pk_package_item_free (item);
}
gpk_modal_dialog_present (watch->priv->dialog);
@@ -1628,7 +1628,7 @@ gpk_watch_button_cancel_cb (GtkWidget *widget, GpkWatch *watch)
* gpk_watch_connection_changed_cb:
**/
static void
-gpk_watch_connection_changed_cb (PkConnection *pconnection, gboolean connected, GpkWatch *watch)
+gpk_watch_connection_changed_cb (PkControl *pconnection, gboolean connected, GpkWatch *watch)
{
g_return_if_fail (GPK_IS_WATCH (watch));
egg_debug ("connected=%i", connected);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]