[gnome-packagekit/glib2: 61/79] moo
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-packagekit/glib2: 61/79] moo
- Date: Tue, 6 Oct 2009 09:49:51 +0000 (UTC)
commit d9e42ec4dd1f48136c04428f0a2efd8158fca94e
Author: Richard Hughes <richard hughsie com>
Date: Sat Oct 3 17:12:31 2009 +0100
moo
src/gpk-application.c | 63 ++--
src/gpk-dbus-task.c | 1051 +++++++++++++++++++++++------------------------
src/gpk-dbus-task.h | 28 +-
src/gpk-firmware.c | 11 +-
src/gpk-hardware.c | 11 +-
src/gpk-update-viewer.c | 59 +--
src/gpk-watch.c | 17 +-
7 files changed, 611 insertions(+), 629 deletions(-)
---
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 6a6c86f..8a077a6 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -35,16 +35,17 @@
#include "egg-string.h"
#include "egg-markdown.h"
-#include "gpk-common.h"
-#include "gpk-gnome.h"
-#include "gpk-error.h"
-#include "gpk-enum.h"
-#include "gpk-application.h"
#include "gpk-animated-icon.h"
-#include "gpk-dialog.h"
+#include "gpk-application.h"
#include "gpk-cell-renderer-uri.h"
+#include "gpk-common.h"
#include "gpk-desktop.h"
+#include "gpk-dialog.h"
+#include "gpk-enum.h"
+#include "gpk-error.h"
+#include "gpk-gnome.h"
#include "gpk-helper-run.h"
+#include "gpk-task.h"
static void gpk_application_finalize (GObject *object);
@@ -81,7 +82,7 @@ struct GpkApplicationPrivate
GtkListStore *details_store;
EggMarkdown *markdown;
PkControl *control;
- PkClient *client;
+ PkTask *task;
PkDesktop *desktop;
gchar *group;
gchar *url;
@@ -743,7 +744,7 @@ gpk_application_menu_files_cb (GtkAction *action, GpkApplication *application)
/* set correct view */
package_ids = pk_package_ids_from_id (package_id_selected);
- pk_client_get_files_async (application->priv->client, package_ids, application->priv->cancellable,
+ pk_client_get_files_async (PK_CLIENT(application->priv->task), package_ids, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_get_files_cb, application);
out:
@@ -980,7 +981,7 @@ gpk_application_menu_requires_cb (GtkAction *action, GpkApplication *application
/* get the requires */
package_ids = pk_package_ids_from_id (package_id_selected);
- pk_client_get_requires_async (application->priv->client, PK_FILTER_ENUM_NONE,
+ pk_client_get_requires_async (PK_CLIENT(application->priv->task), PK_FILTER_ENUM_NONE,
package_ids, TRUE, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_get_requires_cb, application);
@@ -1096,7 +1097,7 @@ gpk_application_menu_depends_cb (GtkAction *action, GpkApplication *application)
/* get the depends */
package_ids = pk_package_ids_from_id (package_id_selected);
- pk_client_get_depends_async (application->priv->client, PK_FILTER_ENUM_NONE,
+ pk_client_get_depends_async (PK_CLIENT(application->priv->task), PK_FILTER_ENUM_NONE,
package_ids, TRUE, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_get_depends_cb, application);
@@ -1597,19 +1598,19 @@ gpk_application_perform_search_name_details_file (GpkApplication *application)
/* do the search */
searches = g_strsplit (application->priv->search_text, " ", -1);
if (application->priv->search_type == PK_SEARCH_NAME) {
- pk_client_search_name_async (application->priv->client,
+ pk_client_search_name_async (PK_CLIENT(application->priv->task),
application->priv->filters_current,
searches, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_search_cb, application);
} else if (application->priv->search_type == PK_SEARCH_DETAILS) {
- pk_client_search_details_async (application->priv->client,
+ pk_client_search_details_async (PK_CLIENT(application->priv->task),
application->priv->filters_current,
searches, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_search_cb, application);
} else if (application->priv->search_type == PK_SEARCH_FILE) {
- pk_client_search_file_async (application->priv->client,
+ pk_client_search_file_async (PK_CLIENT(application->priv->task),
application->priv->filters_current,
searches, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
@@ -1646,13 +1647,13 @@ gpk_application_perform_search_others (GpkApplication *application)
if (application->priv->search_mode == PK_MODE_GROUP) {
groups = g_strsplit (application->priv->group, " ", -1);
- pk_client_search_group_async (application->priv->client,
+ pk_client_search_group_async (PK_CLIENT(application->priv->task),
application->priv->filters_current, groups, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_search_cb, application);
g_strfreev (groups);
} else {
- pk_client_get_packages_async (application->priv->client,
+ pk_client_get_packages_async (PK_CLIENT(application->priv->task),
application->priv->filters_current, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_search_cb, application);
@@ -1942,14 +1943,14 @@ gpk_application_button_clear_cb (GtkWidget *widget_button, GpkApplication *appli
* gpk_application_install_packages_cb:
**/
static void
-gpk_application_install_packages_cb (PkClient *client, GAsyncResult *res, GpkApplication *application)
+gpk_application_install_packages_cb (PkTask *task, GAsyncResult *res, GpkApplication *application)
{
PkResults *results;
GError *error = NULL;
PkItemErrorCode *error_item = NULL;
/* get the results */
- results = pk_client_generic_finish (client, res, &error);
+ results = pk_task_generic_finish (task, res, &error);
if (results == NULL) {
egg_warning ("failed to install packages: %s", error->message);
g_error_free (error);
@@ -1984,14 +1985,14 @@ out:
* gpk_application_remove_packages_cb:
**/
static void
-gpk_application_remove_packages_cb (PkClient *client, GAsyncResult *res, GpkApplication *application)
+gpk_application_remove_packages_cb (PkTask *task, GAsyncResult *res, GpkApplication *application)
{
PkResults *results;
GError *error = NULL;
PkItemErrorCode *error_item = NULL;
/* get the results */
- results = pk_client_generic_finish (client, res, &error);
+ results = pk_task_generic_finish (task, res, &error);
if (results == NULL) {
egg_warning ("failed to remove packages: %s", error->message);
g_error_free (error);
@@ -2033,9 +2034,9 @@ gpk_application_button_apply_cb (GtkWidget *widget, GpkApplication *application)
if (application->priv->action == PK_ACTION_INSTALL) {
/* install */
- pk_client_install_packages_async (application->priv->client, TRUE, package_ids, application->priv->cancellable,
- (PkProgressCallback) gpk_application_progress_cb, application,
- (GAsyncReadyCallback) gpk_application_install_packages_cb, application);
+ pk_task_install_packages_async (application->priv->task, package_ids, application->priv->cancellable,
+ (PkProgressCallback) gpk_application_progress_cb, application,
+ (GAsyncReadyCallback) gpk_application_install_packages_cb, application);
/* make package array insensitive */
widget = GTK_WIDGET (gtk_builder_get_object (application->priv->builder, "treeview_packages"));
@@ -2044,9 +2045,9 @@ gpk_application_button_apply_cb (GtkWidget *widget, GpkApplication *application)
} else if (application->priv->action == PK_ACTION_REMOVE) {
/* install */
- pk_client_remove_packages_async (application->priv->client, package_ids, TRUE, FALSE, application->priv->cancellable,
- (PkProgressCallback) gpk_application_progress_cb, application,
- (GAsyncReadyCallback) gpk_application_remove_packages_cb, application);
+ pk_task_remove_packages_async (application->priv->task, package_ids, TRUE, FALSE, application->priv->cancellable,
+ (PkProgressCallback) gpk_application_progress_cb, application,
+ (GAsyncReadyCallback) gpk_application_remove_packages_cb, application);
/* make package array insensitive */
widget = GTK_WIDGET (gtk_builder_get_object (application->priv->builder, "treeview_packages"));
@@ -2385,7 +2386,7 @@ gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkAp
/* get the details */
package_ids = pk_package_ids_from_id (package_id);
- pk_client_get_details_async (application->priv->client, package_ids, application->priv->cancellable,
+ pk_client_get_details_async (PK_CLIENT(application->priv->task), package_ids, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_get_details_cb, application);
out:
@@ -2811,7 +2812,7 @@ static void
gpk_application_menu_refresh_cb (GtkAction *action, GpkApplication *application)
{
g_return_if_fail (GPK_IS_APPLICATION (application));
- pk_client_refresh_cache_async (application->priv->client, TRUE, application->priv->cancellable,
+ pk_client_refresh_cache_async (PK_CLIENT(application->priv->task), TRUE, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_refresh_cache_cb, application);
}
@@ -3300,7 +3301,7 @@ static void
gpk_application_create_group_array_categories (GpkApplication *application)
{
/* get categories supported */
- pk_client_get_categories_async (application->priv->client, application->priv->cancellable,
+ pk_client_get_categories_async (PK_CLIENT(application->priv->task), application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_get_categories_cb, application);
}
@@ -3639,7 +3640,7 @@ gpk_application_init (GpkApplication *application)
application->priv->control = pk_control_new ();
/* this is what we use mainly */
- application->priv->client = pk_client_new ();
+ application->priv->task = PK_TASK(gpk_task_new ());
/* get properties */
pk_control_get_properties_async (application->priv->control, NULL, (GAsyncReadyCallback) pk_backend_status_get_properties_cb, application);
@@ -3947,7 +3948,7 @@ gpk_application_init (GpkApplication *application)
G_CALLBACK (gpk_application_groups_treeview_changed_cb), application);
/* get repos, so we can show the full name in the software source box */
- pk_client_get_repo_list_async (application->priv->client, PK_FILTER_ENUM_NONE, application->priv->cancellable,
+ pk_client_get_repo_list_async (PK_CLIENT(application->priv->task), PK_FILTER_ENUM_NONE, application->priv->cancellable,
(PkProgressCallback) gpk_application_progress_cb, application,
(GAsyncReadyCallback) gpk_application_get_repo_list_cb, application);
@@ -4020,7 +4021,7 @@ gpk_application_finalize (GObject *object)
g_object_unref (application->priv->packages_store);
g_object_unref (application->priv->details_store);
g_object_unref (application->priv->control);
- g_object_unref (application->priv->client);
+ g_object_unref (PK_CLIENT(application->priv->task));
g_object_unref (application->priv->desktop);
g_object_unref (application->priv->gconf_client);
g_object_unref (application->priv->markdown);
diff --git a/src/gpk-dbus-task.c b/src/gpk-dbus-task.c
index db3ce0a..70bf13a 100644
--- a/src/gpk-dbus-task.c
+++ b/src/gpk-dbus-task.c
@@ -37,20 +37,21 @@
#include "egg-debug.h"
#include "egg-string.h"
+#include "gpk-common.h"
#include "gpk-dbus.h"
#include "gpk-dbus-task.h"
-#include "gpk-modal-dialog.h"
-#include "gpk-common.h"
-#include "gpk-gnome.h"
+#include "gpk-desktop.h"
+#include "gpk-dialog.h"
+#include "gpk-enum.h"
#include "gpk-error.h"
+#include "gpk-gnome.h"
+#include "gpk-helper-chooser.h"
+#include "gpk-helper-run.h"
#include "gpk-language.h"
-#include "gpk-dialog.h"
+#include "gpk-modal-dialog.h"
+#include "gpk-task.h"
#include "gpk-vendor.h"
-#include "gpk-enum.h"
#include "gpk-x11.h"
-#include "gpk-desktop.h"
-#include "gpk-helper-run.h"
-#include "gpk-helper-chooser.h"
static void gpk_dbus_task_finalize (GObject *object);
@@ -66,7 +67,7 @@ struct _GpkDbusTaskPrivate
{
GdkWindow *parent_window;
GConfClient *gconf_client;
- PkClient *client;
+ PkTask *task;
PkDesktop *desktop;
PkControl *control;
PkExitEnum exit;
@@ -101,22 +102,22 @@ G_DEFINE_TYPE (GpkDbusTask, gpk_dbus_task, G_TYPE_OBJECT)
* gpk_dbus_task_set_interaction:
**/
gboolean
-gpk_dbus_task_set_interaction (GpkDbusTask *task, PkBitfield interact)
+gpk_dbus_task_set_interaction (GpkDbusTask *dtask, PkBitfield interact)
{
- g_return_val_if_fail (GPK_IS_DBUS_TASK (task), FALSE);
+ g_return_val_if_fail (GPK_IS_DBUS_TASK (dtask), FALSE);
- task->priv->show_confirm_search = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_SEARCH);
- task->priv->show_confirm_deps = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_DEPS);
- task->priv->show_confirm_install = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_INSTALL);
- task->priv->show_progress = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_PROGRESS);
- task->priv->show_finished = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_FINISHED);
- task->priv->show_warning = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_WARNING);
+ dtask->priv->show_confirm_search = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_SEARCH);
+ dtask->priv->show_confirm_deps = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_DEPS);
+ dtask->priv->show_confirm_install = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_INSTALL);
+ dtask->priv->show_progress = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_PROGRESS);
+ dtask->priv->show_finished = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_FINISHED);
+ dtask->priv->show_warning = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_WARNING);
/* debug */
egg_debug ("confirm_search:%i, confirm_deps:%i, confirm_install:%i, progress:%i, finished:%i, warning:%i",
- task->priv->show_confirm_search, task->priv->show_confirm_deps,
- task->priv->show_confirm_install, task->priv->show_progress,
- task->priv->show_finished, task->priv->show_warning);
+ dtask->priv->show_confirm_search, dtask->priv->show_confirm_deps,
+ dtask->priv->show_confirm_install, dtask->priv->show_progress,
+ dtask->priv->show_finished, dtask->priv->show_warning);
return TRUE;
}
@@ -125,12 +126,12 @@ gpk_dbus_task_set_interaction (GpkDbusTask *task, PkBitfield interact)
* gpk_dbus_task_set_context:
**/
gboolean
-gpk_dbus_task_set_context (GpkDbusTask *task, DBusGMethodInvocation *context)
+gpk_dbus_task_set_context (GpkDbusTask *dtask, DBusGMethodInvocation *context)
{
- g_return_val_if_fail (GPK_IS_DBUS_TASK (task), FALSE);
+ g_return_val_if_fail (GPK_IS_DBUS_TASK (dtask), FALSE);
g_return_val_if_fail (context != NULL, FALSE);
- task->priv->context = context;
+ dtask->priv->context = context;
return TRUE;
}
@@ -138,15 +139,15 @@ gpk_dbus_task_set_context (GpkDbusTask *task, DBusGMethodInvocation *context)
* gpk_dbus_task_set_xid:
**/
gboolean
-gpk_dbus_task_set_xid (GpkDbusTask *task, guint32 xid)
+gpk_dbus_task_set_xid (GpkDbusTask *dtask, guint32 xid)
{
GdkDisplay *display;
- g_return_val_if_fail (GPK_IS_DBUS_TASK (task), FALSE);
+ g_return_val_if_fail (GPK_IS_DBUS_TASK (dtask), FALSE);
display = gdk_display_get_default ();
- task->priv->parent_window = gdk_window_foreign_new_for_display (display, xid);
- egg_debug ("parent_window=%p", task->priv->parent_window);
- gpk_modal_dialog_set_parent (task->priv->dialog, task->priv->parent_window);
+ dtask->priv->parent_window = gdk_window_foreign_new_for_display (display, xid);
+ egg_debug ("parent_window=%p", dtask->priv->parent_window);
+ gpk_modal_dialog_set_parent (dtask->priv->dialog, dtask->priv->parent_window);
return TRUE;
}
@@ -154,20 +155,20 @@ gpk_dbus_task_set_xid (GpkDbusTask *task, guint32 xid)
* gpk_dbus_task_set_timestamp:
**/
gboolean
-gpk_dbus_task_set_timestamp (GpkDbusTask *task, guint32 timestamp)
+gpk_dbus_task_set_timestamp (GpkDbusTask *dtask, guint32 timestamp)
{
- g_return_val_if_fail (GPK_IS_DBUS_TASK (task), FALSE);
- task->priv->timestamp = timestamp;
+ g_return_val_if_fail (GPK_IS_DBUS_TASK (dtask), FALSE);
+ dtask->priv->timestamp = timestamp;
return TRUE;
}
-static void gpk_dbus_task_install_package_ids (GpkDbusTask *task);
+static void gpk_dbus_task_install_package_ids (GpkDbusTask *dtask);
/**
* gpk_dbus_task_chooser_event_cb:
**/
static void
-gpk_dbus_task_chooser_event_cb (GpkHelperChooser *helper_chooser, GtkResponseType type, const gchar *package_id, GpkDbusTask *task)
+gpk_dbus_task_chooser_event_cb (GpkHelperChooser *helper_chooser, GtkResponseType type, const gchar *package_id, GpkDbusTask *dtask)
{
GError *error_dbus = NULL;
@@ -176,25 +177,25 @@ gpk_dbus_task_chooser_event_cb (GpkHelperChooser *helper_chooser, GtkResponseTyp
/* failed */
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not choose anything to install");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
- if (task->priv->show_warning) {
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ if (dtask->priv->show_warning) {
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: we failed to install */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Failed to install software"));
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Failed to install software"));
/* TRANSLATORS: we didn't select any applications that were returned */
- gpk_modal_dialog_set_message (task->priv->dialog, _("No applications were chosen to be installed"));
- gpk_modal_dialog_present (task->priv->dialog);
- gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("No applications were chosen to be installed"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ gpk_modal_dialog_run (dtask->priv->dialog);
}
goto out;
}
/* install this specific package */
- task->priv->package_ids = pk_package_ids_from_id (package_id);
+ dtask->priv->package_ids = pk_package_ids_from_id (package_id);
/* install these packages with deps */
- gpk_dbus_task_install_package_ids (task);
+ gpk_dbus_task_install_package_ids (dtask);
out:
return;
}
@@ -203,18 +204,18 @@ out:
* gpk_dbus_task_error_msg:
**/
static void
-gpk_dbus_task_error_msg (GpkDbusTask *task, const gchar *title, GError *error)
+gpk_dbus_task_error_msg (GpkDbusTask *dtask, const gchar *title, GError *error)
{
GtkWindow *window;
/* TRANSLATORS: default fallback error -- this should never happen */
const gchar *message = _("Unknown error. Please refer to the detailed report and report in your distribution bugtracker.");
const gchar *details = NULL;
- if (!task->priv->show_warning)
+ if (!dtask->priv->show_warning)
return;
/* setup UI */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
/* print a proper error if we have it */
if (error != NULL) {
@@ -222,11 +223,11 @@ gpk_dbus_task_error_msg (GpkDbusTask *task, const gchar *title, GError *error)
g_str_has_prefix (error->message, "org.freedesktop.packagekit.")) {
/* TRANSLATORS: failed authentication */
message = _("You don't have the necessary privileges to perform this action.");
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-permissions");
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-permissions");
} else if (error->code == PK_CLIENT_ERROR_CANNOT_START_DAEMON) {
/* TRANSLATORS: could not start system service */
message = _("The packagekitd service could not be started.");
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-no-service");
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-no-service");
} else if (error->code == PK_CLIENT_ERROR_INVALID_INPUT) {
/* TRANSLATORS: the user tried to query for something invalid */
message = _("The query is not valid.");
@@ -242,36 +243,35 @@ gpk_dbus_task_error_msg (GpkDbusTask *task, const gchar *title, GError *error)
/* it's a normal UI, not a backtrace so keep in the UI */
if (details == NULL) {
- gpk_modal_dialog_set_title (task->priv->dialog, title);
- gpk_modal_dialog_set_message (task->priv->dialog, message);
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, message);
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ gpk_modal_dialog_run (dtask->priv->dialog);
return;
}
/* hide the main window */
- window = gpk_modal_dialog_get_window (task->priv->dialog);
- gpk_error_dialog_modal_with_time (window, title, message, details, task->priv->timestamp);
+ window = gpk_modal_dialog_get_window (dtask->priv->dialog);
+ gpk_error_dialog_modal_with_time (window, title, message, details, dtask->priv->timestamp);
}
/**
* gpk_dbus_task_install_packages_cb:
**/
static void
-gpk_dbus_task_install_packages_cb (GObject *object, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_install_packages_cb (PkTask *task, GAsyncResult *res, GpkDbusTask *dtask)
{
- PkClient *client = PK_CLIENT (object);
GError *error = NULL;
GError *error_dbus = NULL;
PkResults *results = NULL;
/* get the results */
- results = pk_client_generic_finish (client, res, &error);
+ results = pk_task_generic_finish (task, res, &error);
if (results == NULL) {
/* TRANSLATORS: error: failed to install, detailed error follows */
- gpk_dbus_task_error_msg (task, _("Failed to install package"), error);
+ gpk_dbus_task_error_msg (dtask, _("Failed to install package"), error);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
g_error_free (error);
goto out;
}
@@ -285,17 +285,17 @@ out:
* @task: a valid #GpkDbusTask instance
**/
static void
-gpk_dbus_task_install_package_ids (GpkDbusTask *task)
+gpk_dbus_task_install_package_ids (GpkDbusTask *dtask)
{
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, GPK_MODAL_DIALOG_PACKAGE_PADDING);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, GPK_MODAL_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: title: installing packages */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Installing packages"));
- if (task->priv->show_progress)
- gpk_modal_dialog_present (task->priv->dialog);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Installing packages"));
+ if (dtask->priv->show_progress)
+ gpk_modal_dialog_present (dtask->priv->dialog);
/* install async */
- pk_client_install_packages_async (task->priv->client, TRUE, task->priv->package_ids, NULL, NULL, NULL,
- (GAsyncReadyCallback) gpk_dbus_task_install_packages_cb, task);
+ pk_task_install_packages_async (dtask->priv->task, dtask->priv->package_ids, NULL, NULL, NULL,
+ (GAsyncReadyCallback) gpk_dbus_task_install_packages_cb, dtask);
}
#if 0
@@ -304,7 +304,7 @@ gpk_dbus_task_install_package_ids (GpkDbusTask *task)
* gpk_dbus_task_finished_cb:
**/
static void
-gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime, GpkDbusTask *task)
+gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime, GpkDbusTask *dtask)
{
PkRoleEnum role = PK_ROLE_ENUM_UNKNOWN;
gboolean ret;
@@ -329,17 +329,17 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
egg_debug ("role: %s, exit: %s", pk_role_enum_to_text (role), pk_exit_enum_to_text (exit_enum));
/* stop spinning */
- gpk_modal_dialog_set_percentage (task->priv->dialog, 100);
+ gpk_modal_dialog_set_percentage (dtask->priv->dialog, 100);
if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
/* show finished? */
- if (!task->priv->show_finished)
- gpk_modal_dialog_close (task->priv->dialog);
+ if (!dtask->priv->show_finished)
+ gpk_modal_dialog_close (dtask->priv->dialog);
/* fail the transaction and set the correct error */
error = gpk_dbus_task_error_from_exit_enum (exit_enum);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -348,11 +348,11 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
role == PK_ROLE_ENUM_INSTALL_FILES) {
/* show summary? */
- if (task->priv->show_finished) {
+ if (dtask->priv->show_finished) {
array = pk_results_get_package_array (client);
/* TRANSLATORS: list the packages we just installed */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_FINISHED, GPK_MODAL_DIALOG_PACKAGE_LIST);
- gpk_modal_dialog_set_message (task->priv->dialog, _("The following packages were installed:"));
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_FINISHED, GPK_MODAL_DIALOG_PACKAGE_LIST);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("The following packages were installed:"));
/* filter out installed */
for (i=0; i<array->len; i++) {
@@ -362,16 +362,16 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
i--;
}
}
- gpk_modal_dialog_set_package_list (task->priv->dialog, array);
- gpk_modal_dialog_present (task->priv->dialog);
+ gpk_modal_dialog_set_package_list (dtask->priv->dialog, array);
+ gpk_modal_dialog_present (dtask->priv->dialog);
g_object_unref (list);
} else {
- gpk_modal_dialog_close (task->priv->dialog);
+ gpk_modal_dialog_close (dtask->priv->dialog);
}
/* done! */
egg_debug ("doing async return");
- dbus_g_method_return (task->priv->context, TRUE); /* FIXME: we send true? */
+ dbus_g_method_return (dtask->priv->context, TRUE); /* FIXME: we send true? */
goto out;
}
@@ -389,12 +389,12 @@ out:
* gpk_dbus_task_set_status:
**/
static gboolean
-gpk_dbus_task_set_status (GpkDbusTask *task, PkStatusEnum status)
+gpk_dbus_task_set_status (GpkDbusTask *dtask, PkStatusEnum status)
{
- g_return_val_if_fail (GPK_IS_DBUS_TASK (task), FALSE);
+ g_return_val_if_fail (GPK_IS_DBUS_TASK (dtask), FALSE);
/* do we force progress? */
- if (!task->priv->show_progress) {
+ if (!dtask->priv->show_progress) {
if (status == PK_STATUS_ENUM_DOWNLOAD_REPOSITORY ||
status == PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST ||
status == PK_STATUS_ENUM_DOWNLOAD_FILELIST ||
@@ -402,35 +402,35 @@ gpk_dbus_task_set_status (GpkDbusTask *task, PkStatusEnum status)
status == PK_STATUS_ENUM_DOWNLOAD_GROUP ||
status == PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO ||
status == PK_STATUS_ENUM_REFRESH_CACHE) {
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-progress");
- gpk_modal_dialog_present_with_time (task->priv->dialog, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-progress");
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, 0);
}
}
/* ignore */
- if (!task->priv->show_progress) {
+ if (!dtask->priv->show_progress) {
egg_warning ("not showing progress");
return FALSE;
}
/* set icon */
- gpk_modal_dialog_set_image_status (task->priv->dialog, status);
+ gpk_modal_dialog_set_image_status (dtask->priv->dialog, status);
/* set label */
- gpk_modal_dialog_set_title (task->priv->dialog, gpk_status_enum_to_localised_text (status));
+ gpk_modal_dialog_set_title (dtask->priv->dialog, gpk_status_enum_to_localised_text (status));
/* spin */
if (status == PK_STATUS_ENUM_WAIT)
- gpk_modal_dialog_set_percentage (task->priv->dialog, -1);
+ gpk_modal_dialog_set_percentage (dtask->priv->dialog, -1);
/* do visual stuff when finished */
if (status == PK_STATUS_ENUM_FINISHED) {
/* make insensitive */
- gpk_modal_dialog_set_allow_cancel (task->priv->dialog, FALSE);
+ gpk_modal_dialog_set_allow_cancel (dtask->priv->dialog, FALSE);
/* stop spinning */
- gpk_modal_dialog_set_percentage (task->priv->dialog, 100);
+ gpk_modal_dialog_set_percentage (dtask->priv->dialog, 100);
}
return TRUE;
}
@@ -440,7 +440,7 @@ gpk_dbus_task_set_status (GpkDbusTask *task, PkStatusEnum status)
* gpk_dbus_task_error_code_cb:
**/
static void
-gpk_dbus_task_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar *details, GpkDbusTask *task)
+gpk_dbus_task_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar *details, GpkDbusTask *dtask)
{
gboolean ret;
GError *error = NULL;
@@ -449,10 +449,10 @@ gpk_dbus_task_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar
NotifyNotification *notification;
GtkWidget *widget;
- g_return_if_fail (GPK_IS_DBUS_TASK (task));
+ g_return_if_fail (GPK_IS_DBUS_TASK (dtask));
/* save for later */
- task->priv->last_exit_code = code;
+ dtask->priv->last_exit_code = code;
/* have we handled? */
if (code == PK_ERROR_ENUM_NO_LICENSE_AGREEMENT) {
@@ -472,15 +472,15 @@ gpk_dbus_task_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar
/* use a modal dialog if showing progress, else use libnotify */
title = gpk_error_enum_to_localised_text (code);
message = gpk_error_enum_to_localised_message (code);
- if (task->priv->show_progress) {
- widget = GTK_WIDGET (gpk_modal_dialog_get_window (task->priv->dialog));
+ if (dtask->priv->show_progress) {
+ widget = GTK_WIDGET (gpk_modal_dialog_get_window (dtask->priv->dialog));
gpk_error_dialog_modal (GTK_WINDOW (widget), title, message, details);
return;
}
/* save this globally */
- g_free (task->priv->error_details);
- task->priv->error_details = g_markup_escape_text (details, -1);
+ g_free (dtask->priv->error_details);
+ dtask->priv->error_details = g_markup_escape_text (details, -1);
/* do the bubble */
notification = notify_notification_new (title, message, "help-browser", NULL);
@@ -488,7 +488,7 @@ gpk_dbus_task_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar
notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
notify_notification_add_action (notification, "show-error-details",
/* TRANSLATORS: button: show details about the error */
- _("Show details"), gpk_dbus_task_libnotify_cb, task, NULL);
+ _("Show details"), gpk_dbus_task_libnotify_cb, dtask, NULL);
ret = notify_notification_show (notification, &error);
if (!ret) {
egg_warning ("error: %s", error->message);
@@ -500,16 +500,16 @@ 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 *item, GpkDbusTask *task)
+gpk_dbus_task_package_cb (PkClient *client, const PkItemPackage *item, GpkDbusTask *dtask)
{
gchar *text;
- g_return_if_fail (GPK_IS_DBUS_TASK (task));
+ g_return_if_fail (GPK_IS_DBUS_TASK (dtask));
- if (!task->priv->show_progress)
+ if (!dtask->priv->show_progress)
return;
text = gpk_package_id_format_twoline (item->package_id, item->summary);
- gpk_modal_dialog_set_message (task->priv->dialog, text);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, text);
g_free (text);
}
#endif
@@ -518,29 +518,28 @@ gpk_dbus_task_package_cb (PkClient *client, const PkItemPackage *item, GpkDbusTa
* gpk_dbus_task_button_close_cb:
**/
static void
-gpk_dbus_task_button_close_cb (GtkWidget *widget, GpkDbusTask *task)
+gpk_dbus_task_button_close_cb (GtkWidget *widget, GpkDbusTask *dtask)
{
/* close, don't abort */
- gpk_modal_dialog_close (task->priv->dialog);
+ gpk_modal_dialog_close (dtask->priv->dialog);
}
/**
* gpk_dbus_task_button_cancel_cb:
**/
static void
-gpk_dbus_task_button_cancel_cb (GtkWidget *widget, GpkDbusTask *task)
+gpk_dbus_task_button_cancel_cb (GtkWidget *widget, GpkDbusTask *dtask)
{
/* we might have a transaction running */
- g_cancellable_cancel (task->priv->cancellable);
+ g_cancellable_cancel (dtask->priv->cancellable);
}
/**
* gpk_dbus_task_install_files_cb:
**/
static void
-gpk_dbus_task_install_files_cb (GObject *object, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_install_files_cb (PkTask *task, GAsyncResult *res, GpkDbusTask *dtask)
{
- PkClient *client = PK_CLIENT (object);
GError *error = NULL;
GError *error_dbus = NULL;
PkResults *results = NULL;
@@ -548,14 +547,14 @@ gpk_dbus_task_install_files_cb (GObject *object, GAsyncResult *res, GpkDbusTask
const gchar *title;
/* get the results */
- results = pk_client_generic_finish (client, res, &error);
+ results = pk_task_generic_finish (task, res, &error);
if (results == NULL) {
/* TRANSLATORS: error: failed to install, detailed error follows */
- length = g_strv_length (task->priv->files);
+ length = g_strv_length (dtask->priv->files);
title = ngettext ("Failed to install file", "Failed to install files", length);
- gpk_dbus_task_error_msg (task, title, error);
+ gpk_dbus_task_error_msg (dtask, title, error);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "%s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
g_error_free (error);
goto out;
}
@@ -611,7 +610,7 @@ gpk_dbus_task_ptr_array_to_bullets (GPtrArray *array, const gchar *prefix)
* Return value: %TRUE if the method succeeded
**/
static gboolean
-gpk_dbus_task_install_package_files_verify (GpkDbusTask *task, GPtrArray *array, GError **error)
+gpk_dbus_task_install_package_files_verify (GpkDbusTask *dtask, GPtrArray *array, GError **error)
{
GtkResponseType button;
const gchar *title;
@@ -624,14 +623,14 @@ gpk_dbus_task_install_package_files_verify (GpkDbusTask *task, GPtrArray *array,
message = gpk_dbus_task_ptr_array_to_bullets (array, NULL);
/* show UI */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, title);
- gpk_modal_dialog_set_message (task->priv->dialog, message);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, message);
/* TRANSLATORS: title: installing local files */
- gpk_modal_dialog_set_action (task->priv->dialog, _("Install"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-install-files");
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("Install"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-install-files");
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
g_free (message);
/* did we click no or exit the window? */
@@ -649,33 +648,33 @@ out:
* @task: a valid #GpkDbusTask instance
**/
static gboolean
-gpk_dbus_task_confirm_action (GpkDbusTask *task, const gchar *title, const gchar *message, const gchar *action)
+gpk_dbus_task_confirm_action (GpkDbusTask *dtask, const gchar *title, const gchar *message, const gchar *action)
{
GtkResponseType button;
/* check the user wanted to call this method */
- if (!task->priv->show_confirm_search)
+ if (!dtask->priv->show_confirm_search)
return TRUE;
/* setup UI */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, 0);
- gpk_modal_dialog_set_action (task->priv->dialog, action);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, 0);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, action);
/* set icon */
- if (task->priv->parent_icon_name != NULL)
- gpk_modal_dialog_set_image (task->priv->dialog, task->priv->parent_icon_name);
+ if (dtask->priv->parent_icon_name != NULL)
+ gpk_modal_dialog_set_image (dtask->priv->dialog, dtask->priv->parent_icon_name);
else
- gpk_modal_dialog_set_image (task->priv->dialog, "emblem-system");
+ gpk_modal_dialog_set_image (dtask->priv->dialog, "emblem-system");
- gpk_modal_dialog_set_title (task->priv->dialog, title);
- gpk_modal_dialog_set_message (task->priv->dialog, message);
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-application-confirm");
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, message);
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-application-confirm");
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
/* close, we're going to fail the method */
if (button != GTK_RESPONSE_OK) {
- gpk_modal_dialog_close (task->priv->dialog);
+ gpk_modal_dialog_close (dtask->priv->dialog);
return FALSE;
}
@@ -686,7 +685,7 @@ gpk_dbus_task_confirm_action (GpkDbusTask *task, const gchar *title, const gchar
* gpk_dbus_task_progress_cb:
**/
static void
-gpk_dbus_task_progress_cb (PkProgress *progress, PkProgressType type, GpkDbusTask *task)
+gpk_dbus_task_progress_cb (PkProgress *progress, PkProgressType type, GpkDbusTask *dtask)
{
gboolean allow_cancel;
gint percentage;
@@ -704,20 +703,20 @@ gpk_dbus_task_progress_cb (PkProgress *progress, PkProgressType type, GpkDbusTas
if (type == PK_PROGRESS_TYPE_PACKAGE_ID)
egg_debug ("_package");
else if (type == PK_PROGRESS_TYPE_PERCENTAGE)
- gpk_modal_dialog_set_percentage (task->priv->dialog, percentage);
+ gpk_modal_dialog_set_percentage (dtask->priv->dialog, percentage);
else if (type == PK_PROGRESS_TYPE_ALLOW_CANCEL)
- gpk_modal_dialog_set_allow_cancel (task->priv->dialog, allow_cancel);
+ gpk_modal_dialog_set_allow_cancel (dtask->priv->dialog, allow_cancel);
else if (type == PK_PROGRESS_TYPE_STATUS)
- gpk_dbus_task_set_status (task, status);
+ gpk_dbus_task_set_status (dtask, status);
else if (type == PK_PROGRESS_TYPE_REMAINING_TIME)
- gpk_modal_dialog_set_remaining (task->priv->dialog, remaining_time);
+ gpk_modal_dialog_set_remaining (dtask->priv->dialog, remaining_time);
}
/**
* gpk_dbus_task_is_installed_resolve_cb:
**/
static void
-gpk_dbus_task_is_installed_resolve_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_is_installed_resolve_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *dtask)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -730,7 +729,7 @@ gpk_dbus_task_is_installed_resolve_cb (PkClient *client, GAsyncResult *res, GpkD
results = pk_client_generic_finish (client, res, &error);
if (results == NULL) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
egg_warning ("failed to resolve: %s", error->message);
g_error_free (error);
goto out;
@@ -741,7 +740,7 @@ gpk_dbus_task_is_installed_resolve_cb (PkClient *client, GAsyncResult *res, GpkD
if (error_item != NULL) {
egg_warning ("failed to resolve: %s, %s", pk_error_enum_to_text (error_item->code), error_item->details);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error_item->details);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -749,7 +748,7 @@ gpk_dbus_task_is_installed_resolve_cb (PkClient *client, GAsyncResult *res, GpkD
array = pk_results_get_package_array (results);
ret = (array->len > 0);
egg_debug ("doing async return");
- dbus_g_method_return (task->priv->context, ret);
+ dbus_g_method_return (dtask->priv->context, ret);
out:
if (error_item != NULL)
pk_item_error_code_unref (error_item);
@@ -763,15 +762,15 @@ out:
* gpk_dbus_task_is_installed:
**/
void
-gpk_dbus_task_is_installed (GpkDbusTask *task, const gchar *package_name)
+gpk_dbus_task_is_installed (GpkDbusTask *dtask, const gchar *package_name)
{
gchar **package_names = NULL;
/* get the package list for the installed packages */
package_names = g_strsplit (package_name, "|", 1);
- pk_client_resolve_async (task->priv->client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), package_names, NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_is_installed_resolve_cb, task);
+ pk_client_resolve_async (PK_CLIENT(dtask->priv->task), pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), package_names, NULL,
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_is_installed_resolve_cb, dtask);
g_strfreev (package_names);
}
@@ -779,7 +778,7 @@ gpk_dbus_task_is_installed (GpkDbusTask *task, const gchar *package_name)
* gpk_dbus_task_search_file_search_file_cb:
**/
static void
-gpk_dbus_task_search_file_search_file_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_search_file_search_file_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *dtask)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -793,7 +792,7 @@ gpk_dbus_task_search_file_search_file_cb (PkClient *client, GAsyncResult *res, G
results = pk_client_generic_finish (client, res, &error);
if (results == NULL) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to search file: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
egg_warning ("failed to resolve: %s", error->message);
g_error_free (error);
goto out;
@@ -804,7 +803,7 @@ gpk_dbus_task_search_file_search_file_cb (PkClient *client, GAsyncResult *res, G
if (error_item != NULL) {
egg_warning ("failed to resolve: %s, %s", pk_error_enum_to_text (error_item->code), error_item->details);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to search file: %s", error_item->details);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -813,7 +812,7 @@ gpk_dbus_task_search_file_search_file_cb (PkClient *client, GAsyncResult *res, G
if (array->len == 0) {
egg_warning ("no packages");
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to find any packages");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -822,7 +821,7 @@ gpk_dbus_task_search_file_search_file_cb (PkClient *client, GAsyncResult *res, G
split = pk_package_id_split (item->package_id);
egg_debug ("doing async return");
- dbus_g_method_return (task->priv->context, (item->info == PK_INFO_ENUM_INSTALLED), split[PK_PACKAGE_ID_NAME]);
+ dbus_g_method_return (dtask->priv->context, (item->info == PK_INFO_ENUM_INSTALLED), split[PK_PACKAGE_ID_NAME]);
out:
g_strfreev (split);
if (error_item != NULL)
@@ -837,16 +836,16 @@ out:
* gpk_dbus_task_search_file:
**/
void
-gpk_dbus_task_search_file (GpkDbusTask *task, const gchar *search_file)
+gpk_dbus_task_search_file (GpkDbusTask *dtask, const gchar *search_file)
{
gchar **values = NULL;
/* get the package list for the installed packages */
egg_debug ("package_name=%s", search_file);
values = g_strsplit (search_file, "&", -1);
- pk_client_search_file_async (task->priv->client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), values, NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_search_file_search_file_cb, task);
+ pk_client_search_file_async (PK_CLIENT(dtask->priv->task), pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), values, NULL,
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_search_file_search_file_cb, dtask);
g_strfreev (values);
}
@@ -862,7 +861,7 @@ gpk_dbus_task_search_file (GpkDbusTask *task, const gchar *search_file)
* Return value: %TRUE if the method succeeded
**/
void
-gpk_dbus_task_install_package_files (GpkDbusTask *task, gchar **files_rel)
+gpk_dbus_task_install_package_files (GpkDbusTask *dtask, gchar **files_rel)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -870,33 +869,33 @@ gpk_dbus_task_install_package_files (GpkDbusTask *task, gchar **files_rel)
GPtrArray *array;
guint len;
- g_return_if_fail (GPK_IS_DBUS_TASK (task));
+ g_return_if_fail (GPK_IS_DBUS_TASK (dtask));
g_return_if_fail (files_rel != NULL);
array = pk_strv_to_ptr_array (files_rel);
/* check the user wanted to call this method */
- if (task->priv->show_confirm_search) {
- ret = gpk_dbus_task_install_package_files_verify (task, array, &error);
+ if (dtask->priv->show_confirm_search) {
+ ret = gpk_dbus_task_install_package_files_verify (dtask, array, &error);
if (!ret) {
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
}
/* check for deps */
- task->priv->files = pk_ptr_array_to_strv (array);
+ dtask->priv->files = pk_ptr_array_to_strv (array);
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
- len = g_strv_length (task->priv->files);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
+ len = g_strv_length (dtask->priv->files);
/* TRANSLATORS: title: installing a local file */
- gpk_modal_dialog_set_title (task->priv->dialog, ngettext ("Install local file", "Install local files", len));
- if (task->priv->show_progress)
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, ngettext ("Install local file", "Install local files", len));
+ if (dtask->priv->show_progress)
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
/* install async */
- pk_client_install_files_async (task->priv->client, TRUE, task->priv->files, NULL, NULL, NULL,
- (GAsyncReadyCallback) gpk_dbus_task_install_files_cb, task);
+ pk_task_install_files_async (dtask->priv->task, dtask->priv->files, NULL, NULL, NULL,
+ (GAsyncReadyCallback) gpk_dbus_task_install_files_cb, dtask);
/* wait for async reply */
out:
@@ -909,7 +908,7 @@ out:
* gpk_dbus_task_install_package_names_resolve_cb:
**/
static void
-gpk_dbus_task_install_package_names_resolve_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_install_package_names_resolve_cb (PkTask *task, GAsyncResult *res, GpkDbusTask *dtask)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -925,10 +924,10 @@ gpk_dbus_task_install_package_names_resolve_cb (PkClient *client, GAsyncResult *
gboolean already_installed;
/* get the results */
- results = pk_client_generic_finish (client, res, &error);
+ results = pk_task_generic_finish (task, res, &error);
if (results == NULL) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
egg_warning ("failed to resolve: %s", error->message);
g_error_free (error);
goto out;
@@ -939,38 +938,38 @@ gpk_dbus_task_install_package_names_resolve_cb (PkClient *client, GAsyncResult *
if (error_item != NULL) {
egg_warning ("failed to resolve: %s, %s", pk_error_enum_to_text (error_item->code), error_item->details);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error_item->details);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* found nothing? */
array = pk_results_get_package_array (results);
if (array->len == 0) {
- if (!task->priv->show_warning) {
+ if (!dtask->priv->show_warning) {
//FIXME: shows package_id in UI
/* TRANSLATORS: couldn't resolve name to package */
title = g_strdup_printf (_("Could not find packages"));
- info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_DEFAULT);
+ info_url = gpk_vendor_get_not_found_url (dtask->priv->vendor, GPK_VENDOR_URL_TYPE_DEFAULT);
/* only show the "more info" button if there is a valid link */
if (info_url != NULL)
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
else
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, title);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
/* TRANSLATORS: message: could not find */
- gpk_modal_dialog_set_message (task->priv->dialog, _("The packages could not be found in any software source"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-package-not-found");
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("The packages could not be found in any software source"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: a link to the help file */
- gpk_modal_dialog_set_action (task->priv->dialog, _("More information"));
- gpk_modal_dialog_present (task->priv->dialog);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("More information"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
g_free (info_url);
g_free (title);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_NO_PACKAGES_FOUND, "no package found");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -988,42 +987,42 @@ gpk_dbus_task_install_package_names_resolve_cb (PkClient *client, GAsyncResult *
/* already installed? */
if (already_installed) {
- if (task->priv->show_warning) {
+ if (dtask->priv->show_warning) {
//FIXME: shows package_id in UI
/* TRANSLATORS: title: package is already installed */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, _("Failed to install packages"));
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Failed to install packages"));
/* TRANSLATORS: message: package is already installed */
- gpk_modal_dialog_set_message (task->priv->dialog, _("The package is already installed"));
- gpk_modal_dialog_present (task->priv->dialog);
- gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("The package is already installed"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ gpk_modal_dialog_run (dtask->priv->dialog);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_FAILED, "package already found");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* got junk? */
if (package_id == NULL) {
- if (task->priv->show_warning) {
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ if (dtask->priv->show_warning) {
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: failed to install, shouldn't be shown */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Failed to install package"));
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Failed to install package"));
/* TRANSLATORS: the search gave us the wrong result. internal error. barf. */
- gpk_modal_dialog_set_message (task->priv->dialog, _("Incorrect response from search"));
- gpk_modal_dialog_present (task->priv->dialog);
- gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("Incorrect response from search"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ gpk_modal_dialog_run (dtask->priv->dialog);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "incorrect response from search");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* convert to data */
- task->priv->package_ids = pk_package_array_to_strv (array);
+ dtask->priv->package_ids = pk_package_array_to_strv (array);
/* install these packages with deps */
- gpk_dbus_task_install_package_ids (task);
+ gpk_dbus_task_install_package_ids (dtask);
out:
if (error_item != NULL)
pk_item_error_code_unref (error_item);
@@ -1044,7 +1043,7 @@ out:
* Return value: %TRUE if the method succeeded
**/
void
-gpk_dbus_task_install_package_names (GpkDbusTask *task, gchar **packages)
+gpk_dbus_task_install_package_names (GpkDbusTask *dtask, gchar **packages)
{
gboolean ret;
GError *error_dbus = NULL;
@@ -1054,11 +1053,11 @@ gpk_dbus_task_install_package_names (GpkDbusTask *task, gchar **packages)
guint i;
GString *string;
- g_return_if_fail (GPK_IS_DBUS_TASK (task));
+ g_return_if_fail (GPK_IS_DBUS_TASK (dtask));
g_return_if_fail (packages != NULL);
/* optional */
- if (!task->priv->show_confirm_install) {
+ if (!dtask->priv->show_confirm_install) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -1086,37 +1085,37 @@ gpk_dbus_task_install_package_names (GpkDbusTask *task, gchar **packages)
g_free (text);
/* make title using application name */
- if (task->priv->parent_title != NULL) {
+ if (dtask->priv->parent_title != NULL) {
/* TRANSLATORS: string is a program name, e.g. "Movie Player" */
- text = g_strdup_printf (ngettext ("%s wants to install a package", "%s wants to install packages", len), task->priv->parent_title);
+ text = g_strdup_printf (ngettext ("%s wants to install a package", "%s wants to install packages", len), dtask->priv->parent_title);
} else {
/* TRANSLATORS: a random program which we can't get the name wants to do something */
text = g_strdup (ngettext ("A program wants to install a package", "A program wants to install packages", len));
}
/* TRANSLATORS: button: confirm to search for packages */
- ret = gpk_dbus_task_confirm_action (task, text, message, _("Install"));
+ ret = gpk_dbus_task_confirm_action (dtask, text, message, _("Install"));
g_free (text);
g_free (message);
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to search");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title, searching */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Searching for packages"));
- gpk_modal_dialog_set_image_status (task->priv->dialog, PK_STATUS_ENUM_WAIT);
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-finding-packages");
- if (task->priv->show_progress)
- gpk_modal_dialog_present (task->priv->dialog);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Searching for packages"));
+ gpk_modal_dialog_set_image_status (dtask->priv->dialog, PK_STATUS_ENUM_WAIT);
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-finding-packages");
+ if (dtask->priv->show_progress)
+ gpk_modal_dialog_present (dtask->priv->dialog);
/* find out if we can find a package */
- pk_client_resolve_async (task->priv->client, pk_bitfield_from_enums (PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1), packages, NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_install_package_names_resolve_cb, task);
+ pk_client_resolve_async (PK_CLIENT(dtask->priv->task), pk_bitfield_from_enums (PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1), packages, NULL,
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_install_package_names_resolve_cb, dtask);
/* wait for async reply */
out:
@@ -1127,7 +1126,7 @@ out:
* gpk_dbus_task_install_provide_files_search_file_cb:
**/
static void
-gpk_dbus_task_install_provide_files_search_file_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_install_provide_files_search_file_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *dtask)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -1147,7 +1146,7 @@ gpk_dbus_task_install_provide_files_search_file_cb (PkClient *client, GAsyncResu
results = pk_client_generic_finish (client, res, &error);
if (results == NULL) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
egg_warning ("failed to resolve: %s", error->message);
g_error_free (error);
goto out;
@@ -1158,7 +1157,7 @@ gpk_dbus_task_install_provide_files_search_file_cb (PkClient *client, GAsyncResu
if (error_item != NULL) {
egg_warning ("failed to resolve: %s, %s", pk_error_enum_to_text (error_item->code), error_item->details);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error_item->details);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -1168,28 +1167,28 @@ gpk_dbus_task_install_provide_files_search_file_cb (PkClient *client, GAsyncResu
/* found nothing? */
if (array->len == 0) {
- if (task->priv->show_warning) {
- info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_DEFAULT);
+ if (dtask->priv->show_warning) {
+ info_url = gpk_vendor_get_not_found_url (dtask->priv->vendor, GPK_VENDOR_URL_TYPE_DEFAULT);
/* only show the "more info" button if there is a valid link */
if (info_url != NULL)
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
else
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: failed to fild the package for thefile */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Failed to find package"));
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Failed to find package"));
/* TRANSLATORS: nothing found */
- gpk_modal_dialog_set_message (task->priv->dialog, _("The file could not be found in any packages"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-package-not-found");
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("The file could not be found in any packages"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: show the user a button to get more help finding stuff */
- gpk_modal_dialog_set_action (task->priv->dialog, _("More information"));
- gpk_modal_dialog_present (task->priv->dialog);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("More information"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
g_free (info_url);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_NO_PACKAGES_FOUND, "no files found");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -1207,29 +1206,29 @@ gpk_dbus_task_install_provide_files_search_file_cb (PkClient *client, GAsyncResu
/* already installed? */
if (already_installed) {
- if (task->priv->show_warning) {
+ if (dtask->priv->show_warning) {
split = pk_package_id_split (package_id);
/* TRANSLATORS: we've already got a package that provides this file */
text = g_strdup_printf (_("The %s package already provides this file"), split[PK_PACKAGE_ID_NAME]);
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: title */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Failed to install file"));
- gpk_modal_dialog_set_message (task->priv->dialog, text);
- gpk_modal_dialog_present (task->priv->dialog);
- gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Failed to install file"));
+ gpk_modal_dialog_set_message (dtask->priv->dialog, text);
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ gpk_modal_dialog_run (dtask->priv->dialog);
g_free (text);
g_strfreev (split);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_FAILED, "already provided");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* convert to data */
- task->priv->package_ids = pk_package_ids_from_id (package_id);
+ dtask->priv->package_ids = pk_package_ids_from_id (package_id);
/* install these packages with deps */
- gpk_dbus_task_install_package_ids (task);
+ gpk_dbus_task_install_package_ids (dtask);
out:
if (error_item != NULL)
pk_item_error_code_unref (error_item);
@@ -1250,7 +1249,7 @@ out:
* Return value: %TRUE if the method succeeded
**/
void
-gpk_dbus_task_install_provide_files (GpkDbusTask *task, gchar **full_paths)
+gpk_dbus_task_install_provide_files (GpkDbusTask *dtask, gchar **full_paths)
{
gboolean ret;
GError *error_dbus = NULL;
@@ -1260,11 +1259,11 @@ gpk_dbus_task_install_provide_files (GpkDbusTask *task, gchar **full_paths)
gchar *message;
GString *string;
- g_return_if_fail (GPK_IS_DBUS_TASK (task));
+ g_return_if_fail (GPK_IS_DBUS_TASK (dtask));
g_return_if_fail (full_paths != NULL);
/* optional */
- if (!task->priv->show_confirm_search) {
+ if (!dtask->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -1291,33 +1290,33 @@ gpk_dbus_task_install_provide_files (GpkDbusTask *task, gchar **full_paths)
ngettext ("Do you want to search for this file now?", "Do you want to search for these files now?", len));
/* make title using application name */
- if (task->priv->parent_title != NULL) {
+ if (dtask->priv->parent_title != NULL) {
/* TRANSLATORS: string is a program name, e.g. "Movie Player" */
- text = g_strdup_printf (ngettext ("%s wants to install a file", "%s wants to install files", len), task->priv->parent_title);
+ text = g_strdup_printf (ngettext ("%s wants to install a file", "%s wants to install files", len), dtask->priv->parent_title);
} else {
/* TRANSLATORS: a random program which we can't get the name wants to do something */
text = g_strdup (ngettext ("A program wants to install a file", "A program wants to install files", len));
}
/* TRANSLATORS: button: confirm to search for packages */
- ret = gpk_dbus_task_confirm_action (task, text, message, _("Install"));
+ ret = gpk_dbus_task_confirm_action (dtask, text, message, _("Install"));
g_free (text);
g_free (message);
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to search");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
/* TRANSLATORS: searching for the package that provides the file */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Searching for file"));
- gpk_modal_dialog_set_image_status (task->priv->dialog, PK_STATUS_ENUM_WAIT);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Searching for file"));
+ gpk_modal_dialog_set_image_status (dtask->priv->dialog, PK_STATUS_ENUM_WAIT);
/* do search */
- pk_client_search_file_async (task->priv->client, pk_bitfield_from_enums (PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1), full_paths, NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_install_provide_files_search_file_cb, task);
+ pk_client_search_file_async (PK_CLIENT(dtask->priv->task), pk_bitfield_from_enums (PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1), full_paths, NULL,
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_install_provide_files_search_file_cb, dtask);
/* wait for async reply */
out:
@@ -1328,7 +1327,7 @@ out:
* gpk_dbus_task_install_gstreamer_resources_confirm:
**/
static gboolean
-gpk_dbus_task_install_gstreamer_resources_confirm (GpkDbusTask *task, gchar **codec_names)
+gpk_dbus_task_install_gstreamer_resources_confirm (GpkDbusTask *dtask, gchar **codec_names)
{
guint i;
guint len;
@@ -1382,19 +1381,19 @@ gpk_dbus_task_install_gstreamer_resources_confirm (GpkDbusTask *task, gchar **co
message = g_string_free (string, FALSE);
/* make title using application name */
- if (task->priv->parent_title != NULL) {
+ if (dtask->priv->parent_title != NULL) {
if (is_decoder && !is_encoder) {
/* TRANSLATORS: a program wants to decode something (unknown) -- string is a program name, e.g. "Movie Player" */
title = g_strdup_printf (ngettext ("%s requires an additional plugin to decode this file",
- "%s requires additional plugins to decode this file", len), task->priv->parent_title);
+ "%s requires additional plugins to decode this file", len), dtask->priv->parent_title);
} else if (!is_decoder && is_encoder) {
/* TRANSLATORS: a program wants to encode something (unknown) -- string is a program name, e.g. "Movie Player" */
title = g_strdup_printf (ngettext ("%s requires an additional plugin to encode this file",
- "%s requires additional plugins to encode this file", len), task->priv->parent_title);
+ "%s requires additional plugins to encode this file", len), dtask->priv->parent_title);
} else {
/* TRANSLATORS: a program wants to do something (unknown) -- string is a program name, e.g. "Movie Player" */
title = g_strdup_printf (ngettext ("%s requires an additional plugin for this operation",
- "%s requires additional plugins for this operation", len), task->priv->parent_title);
+ "%s requires additional plugins for this operation", len), dtask->priv->parent_title);
}
} else {
if (is_decoder && !is_encoder) {
@@ -1413,7 +1412,7 @@ gpk_dbus_task_install_gstreamer_resources_confirm (GpkDbusTask *task, gchar **co
}
/* TRANSLATORS: button: confirm to search for packages */
- ret = gpk_dbus_task_confirm_action (task, title, message, _("Search"));
+ ret = gpk_dbus_task_confirm_action (dtask, title, message, _("Search"));
g_free (title);
g_free (message);
@@ -1424,7 +1423,7 @@ gpk_dbus_task_install_gstreamer_resources_confirm (GpkDbusTask *task, gchar **co
* gpk_dbus_task_codec_what_provides_cb:
**/
static void
-gpk_dbus_task_codec_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_codec_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *dtask)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -1440,7 +1439,7 @@ gpk_dbus_task_codec_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDb
results = pk_client_generic_finish (client, res, &error);
if (results == NULL) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
egg_warning ("failed to resolve: %s", error->message);
g_error_free (error);
goto out;
@@ -1451,7 +1450,7 @@ gpk_dbus_task_codec_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDb
if (error_item != NULL) {
egg_warning ("failed to resolve: %s, %s", pk_error_enum_to_text (error_item->code), error_item->details);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error_item->details);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -1460,34 +1459,34 @@ gpk_dbus_task_codec_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDb
/* found nothing? */
if (array->len == 0) {
- if (task->priv->show_warning) {
- info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_CODEC);
+ if (dtask->priv->show_warning) {
+ info_url = gpk_vendor_get_not_found_url (dtask->priv->vendor, GPK_VENDOR_URL_TYPE_CODEC);
/* only show the "more info" button if there is a valid link */
if (info_url != NULL)
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
else
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: failed to search for codec */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Failed to search for plugin"));
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Failed to search for plugin"));
/* TRANSLATORS: no software sources have the wanted codec */
- gpk_modal_dialog_set_message (task->priv->dialog, _("Could not find plugin in any configured software source"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-package-not-found");
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("Could not find plugin in any configured software source"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button text */
- gpk_modal_dialog_set_action (task->priv->dialog, _("More information"));
- gpk_modal_dialog_present (task->priv->dialog);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("More information"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
g_free (info_url);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_NO_PACKAGES_FOUND, "failed to find codec");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* optional */
- if (!task->priv->show_confirm_deps) {
+ if (!dtask->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks2;
}
@@ -1495,28 +1494,28 @@ gpk_dbus_task_codec_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDb
title = ngettext ("Install the following plugin", "Install the following plugins", array->len);
message = ngettext ("Do you want to install this package now?", "Do you want to install these packages now?", array->len);
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, GPK_MODAL_DIALOG_PACKAGE_LIST);
- gpk_modal_dialog_set_package_list (task->priv->dialog, array);
- gpk_modal_dialog_set_title (task->priv->dialog, title);
- gpk_modal_dialog_set_message (task->priv->dialog, message);
- gpk_modal_dialog_set_image (task->priv->dialog, "dialog-information");
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, GPK_MODAL_DIALOG_PACKAGE_LIST);
+ gpk_modal_dialog_set_package_list (dtask->priv->dialog, array);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, message);
+ gpk_modal_dialog_set_image (dtask->priv->dialog, "dialog-information");
/* TRANSLATORS: button: install codecs */
- gpk_modal_dialog_set_action (task->priv->dialog, _("Install"));
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("Install"));
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
/* close, we're going to fail the method */
if (button != GTK_RESPONSE_OK) {
- gpk_modal_dialog_close (task->priv->dialog);
+ gpk_modal_dialog_close (dtask->priv->dialog);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to download");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks2:
/* install with deps */
- task->priv->package_ids = pk_package_array_to_strv (array);
- gpk_dbus_task_install_package_ids (task);
+ dtask->priv->package_ids = pk_package_array_to_strv (array);
+ gpk_dbus_task_install_package_ids (dtask);
out:
if (error_item != NULL)
pk_item_error_code_unref (error_item);
@@ -1537,7 +1536,7 @@ out:
* Return value: %TRUE if the method succeeded
**/
void
-gpk_dbus_task_install_gstreamer_resources (GpkDbusTask *task, gchar **codec_names)
+gpk_dbus_task_install_gstreamer_resources (GpkDbusTask *dtask, gchar **codec_names)
{
gboolean ret = TRUE;
GError *error_dbus = NULL;
@@ -1545,50 +1544,50 @@ gpk_dbus_task_install_gstreamer_resources (GpkDbusTask *task, gchar **codec_name
gchar *message;
/* check it's not session wide banned in gconf */
- ret = gconf_client_get_bool (task->priv->gconf_client, GPK_CONF_ENABLE_CODEC_HELPER, NULL);
+ ret = gconf_client_get_bool (dtask->priv->gconf_client, GPK_CONF_ENABLE_CODEC_HELPER, NULL);
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_FORBIDDEN, "not enabled in GConf : %s", GPK_CONF_ENABLE_CODEC_HELPER);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* optional */
- if (!task->priv->show_confirm_search) {
+ if (!dtask->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
/* confirm */
- ret = gpk_dbus_task_install_gstreamer_resources_confirm (task, codec_names);
+ ret = gpk_dbus_task_install_gstreamer_resources_confirm (dtask, codec_names);
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to search");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, GPK_MODAL_DIALOG_PACKAGE_PADDING);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, GPK_MODAL_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: search for codec */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Searching for plugins"));
- gpk_modal_dialog_set_image_status (task->priv->dialog, PK_STATUS_ENUM_WAIT);
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-finding-packages");
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Searching for plugins"));
+ gpk_modal_dialog_set_image_status (dtask->priv->dialog, PK_STATUS_ENUM_WAIT);
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-finding-packages");
/* setup the UI */
- if (task->priv->show_progress)
- gpk_modal_dialog_present (task->priv->dialog);
+ if (dtask->priv->show_progress)
+ gpk_modal_dialog_present (dtask->priv->dialog);
/* get the request */
parts = g_strsplit (codec_names[0], "|", 2);
/* TRANSLATORS: title, searching for codecs */
message = g_strdup_printf (_("Searching for plugin: %s"), parts[1]);
- gpk_modal_dialog_set_message (task->priv->dialog, message);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, message);
/* get codec packages */
- pk_client_what_provides_async (task->priv->client, pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1),
+ pk_client_what_provides_async (PK_CLIENT(dtask->priv->task), pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1),
PK_PROVIDES_ENUM_CODEC, parts, NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_codec_what_provides_cb, task);
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_codec_what_provides_cb, dtask);
out:
g_strfreev (parts);
g_free (message);
@@ -1598,7 +1597,7 @@ out:
* gpk_dbus_task_mime_what_provides_cb:
**/
static void
-gpk_dbus_task_mime_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_mime_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *dtask)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -1612,9 +1611,9 @@ gpk_dbus_task_mime_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbu
results = pk_client_generic_finish (client, res, &error);
if (results == NULL) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
- gpk_dbus_task_error_msg (task, _("Failed to search for provides"), error);
+ gpk_dbus_task_error_msg (dtask, _("Failed to search for provides"), error);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
egg_warning ("failed to resolve: %s", error->message);
g_error_free (error);
goto out;
@@ -1625,7 +1624,7 @@ gpk_dbus_task_mime_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbu
if (error_item != NULL) {
egg_warning ("failed to resolve: %s, %s", pk_error_enum_to_text (error_item->code), error_item->details);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to resolve: %s", error_item->details);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -1634,36 +1633,36 @@ gpk_dbus_task_mime_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbu
/* found nothing? */
if (array->len == 0) {
- if (task->priv->show_warning) {
- info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_MIME);
+ if (dtask->priv->show_warning) {
+ info_url = gpk_vendor_get_not_found_url (dtask->priv->vendor, GPK_VENDOR_URL_TYPE_MIME);
/* only show the "more info" button if there is a valid link */
if (info_url != NULL)
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
else
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: title */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Failed to find software"));
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Failed to find software"));
/* TRANSLATORS: nothing found in the software sources that helps */
- gpk_modal_dialog_set_message (task->priv->dialog, _("No new applications can be found to handle this type of file"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-package-not-found");
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("No new applications can be found to handle this type of file"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: show the user a button to get more help finding stuff */
- gpk_modal_dialog_set_action (task->priv->dialog, _("More information"));
- gpk_modal_dialog_present (task->priv->dialog);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("More information"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
g_free (info_url);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_NO_PACKAGES_FOUND, "nothing was found to handle mime type");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* populate a chooser */
- gpk_helper_chooser_show (task->priv->helper_chooser, array);
+ gpk_helper_chooser_show (dtask->priv->helper_chooser, array);
egg_debug ("doing async return");
- dbus_g_method_return (task->priv->context, TRUE);
+ dbus_g_method_return (dtask->priv->context, TRUE);
out:
if (error_item != NULL)
pk_item_error_code_unref (error_item);
@@ -1684,7 +1683,7 @@ out:
* Return value: %TRUE if the method succeeded
**/
void
-gpk_dbus_task_install_mime_types (GpkDbusTask *task, gchar **mime_types)
+gpk_dbus_task_install_mime_types (GpkDbusTask *dtask, gchar **mime_types)
{
gboolean ret;
GError *error_dbus = NULL;
@@ -1692,19 +1691,19 @@ gpk_dbus_task_install_mime_types (GpkDbusTask *task, gchar **mime_types)
gchar *message = NULL;
gchar *text = NULL;
- g_return_if_fail (GPK_IS_DBUS_TASK (task));
+ g_return_if_fail (GPK_IS_DBUS_TASK (dtask));
g_return_if_fail (mime_types != NULL);
/* check it's not session wide banned in gconf */
- ret = gconf_client_get_bool (task->priv->gconf_client, GPK_CONF_ENABLE_MIME_TYPE_HELPER, NULL);
+ ret = gconf_client_get_bool (dtask->priv->gconf_client, GPK_CONF_ENABLE_MIME_TYPE_HELPER, NULL);
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_FORBIDDEN, "not enabled in GConf : %s", GPK_CONF_ENABLE_MIME_TYPE_HELPER);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* optional */
- if (!task->priv->show_confirm_search) {
+ if (!dtask->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -1721,38 +1720,38 @@ gpk_dbus_task_install_mime_types (GpkDbusTask *task, gchar **mime_types)
len = 1;
/* make title using application name */
- if (task->priv->parent_title != NULL) {
+ if (dtask->priv->parent_title != NULL) {
/* TRANSLATORS: string is a program name, e.g. "Movie Player" */
- text = g_strdup_printf (ngettext ("%s requires a new mime type", "%s requires new mime types", len), task->priv->parent_title);
+ text = g_strdup_printf (ngettext ("%s requires a new mime type", "%s requires new mime types", len), dtask->priv->parent_title);
} else {
/* TRANSLATORS: a random program which we can't get the name wants to do something */
text = g_strdup (ngettext ("A program requires a new mime type", "A program requires new mime types", len));
}
/* TRANSLATORS: button: confirm to search for packages */
- ret = gpk_dbus_task_confirm_action (task, text, message, _("Search"));
+ ret = gpk_dbus_task_confirm_action (dtask, text, message, _("Search"));
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to search");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: searching for mime type handlers */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Searching for file handlers"));
- gpk_modal_dialog_set_image_status (task->priv->dialog, PK_STATUS_ENUM_WAIT);
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-finding-packages");
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Searching for file handlers"));
+ gpk_modal_dialog_set_image_status (dtask->priv->dialog, PK_STATUS_ENUM_WAIT);
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-finding-packages");
/* setup the UI */
- if (task->priv->show_progress)
- gpk_modal_dialog_present (task->priv->dialog);
+ if (dtask->priv->show_progress)
+ gpk_modal_dialog_present (dtask->priv->dialog);
/* action */
- pk_client_what_provides_async (task->priv->client, pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1),
+ pk_client_what_provides_async (PK_CLIENT(dtask->priv->task), pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1),
PK_PROVIDES_ENUM_MIMETYPE, mime_types, NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_mime_what_provides_cb, task);
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_mime_what_provides_cb, dtask);
/* wait for async reply */
out:
g_free (text);
@@ -1810,7 +1809,7 @@ out:
* gpk_dbus_task_font_tag_to_localised_name:
**/
static gchar *
-gpk_dbus_task_font_tag_to_localised_name (GpkDbusTask *task, const gchar *tag)
+gpk_dbus_task_font_tag_to_localised_name (GpkDbusTask *dtask, const gchar *tag)
{
gchar *lang;
gchar *language = NULL;
@@ -1825,7 +1824,7 @@ gpk_dbus_task_font_tag_to_localised_name (GpkDbusTask *task, const gchar *tag)
}
/* convert to localisable name */
- language = gpk_language_iso639_to_language (task->priv->language, lang);
+ language = gpk_language_iso639_to_language (dtask->priv->language, lang);
if (language == NULL) {
/* TRANSLATORS: we could not find en_US string for ISO639 code */
name = g_strdup_printf ("%s: %s", _("Language code not matched"), lang);
@@ -1846,7 +1845,7 @@ out:
* gpk_dbus_task_fontconfig_what_provides_cb:
**/
static void
-gpk_dbus_task_fontconfig_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_fontconfig_what_provides_cb (PkClient *client, GAsyncResult *res, GpkDbusTask *dtask)
{
GError *error = NULL;
GError *error_dbus = NULL;
@@ -1861,9 +1860,9 @@ gpk_dbus_task_fontconfig_what_provides_cb (PkClient *client, GAsyncResult *res,
results = pk_client_generic_finish (client, res, &error);
if (results == NULL) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
-// gpk_dbus_task_error_msg (task, _("Failed to search for provides"), error);
+// gpk_dbus_task_error_msg (dtask, _("Failed to search for provides"), error);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to search for provides: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
egg_warning ("failed to resolve: %s", error->message);
g_error_free (error);
goto out;
@@ -1873,9 +1872,9 @@ gpk_dbus_task_fontconfig_what_provides_cb (PkClient *client, GAsyncResult *res,
error_item = pk_results_get_error_code (results);
if (error_item != NULL) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
-// gpk_dbus_task_error_msg (task, _("Failed to search for provides"), error_item->details);
+// gpk_dbus_task_error_msg (dtask, _("Failed to search for provides"), error_item->details);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to search for provides: %s", error_item->details);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
@@ -1884,62 +1883,62 @@ gpk_dbus_task_fontconfig_what_provides_cb (PkClient *client, GAsyncResult *res,
/* found nothing? */
if (array->len == 0) {
- if (task->priv->show_warning) {
- info_url = gpk_vendor_get_not_found_url (task->priv->vendor, GPK_VENDOR_URL_TYPE_FONT);
+ if (dtask->priv->show_warning) {
+ info_url = gpk_vendor_get_not_found_url (dtask->priv->vendor, GPK_VENDOR_URL_TYPE_FONT);
/* TRANSLATORS: title: cannot find in sources */
title = ngettext ("Failed to find font", "Failed to find fonts", array->len);
/* only show the "more info" button if there is a valid link */
if (info_url != NULL)
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, GPK_MODAL_DIALOG_BUTTON_ACTION);
else
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, title);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
/* TRANSLATORS: message: tell the user we suck */
- gpk_modal_dialog_set_message (task->priv->dialog, _("No new fonts can be found for this document"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-package-not-found");
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("No new fonts can be found for this document"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: show the user a button to get more help finding stuff */
- gpk_modal_dialog_set_action (task->priv->dialog, _("More information"));
- gpk_modal_dialog_present (task->priv->dialog);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("More information"));
+ gpk_modal_dialog_present (dtask->priv->dialog);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
g_free (info_url);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_NO_PACKAGES_FOUND, "failed to find font");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* optional */
- if (!task->priv->show_confirm_deps) {
+ if (!dtask->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
/* TRANSLATORS: title: show a list of fonts */
title = ngettext ("Do you want to install this package now?", "Do you want to install these packages now?", array->len);
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, GPK_MODAL_DIALOG_PACKAGE_LIST);
- gpk_modal_dialog_set_package_list (task->priv->dialog, array);
- gpk_modal_dialog_set_title (task->priv->dialog, title);
- gpk_modal_dialog_set_message (task->priv->dialog, title);
- gpk_modal_dialog_set_image (task->priv->dialog, "dialog-information");
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, GPK_MODAL_DIALOG_PACKAGE_LIST);
+ gpk_modal_dialog_set_package_list (dtask->priv->dialog, array);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_image (dtask->priv->dialog, "dialog-information");
/* TRANSLATORS: button: install a font */
- gpk_modal_dialog_set_action (task->priv->dialog, _("Install"));
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("Install"));
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
/* close, we're going to fail the method */
if (button != GTK_RESPONSE_OK) {
- gpk_modal_dialog_close (task->priv->dialog);
+ gpk_modal_dialog_close (dtask->priv->dialog);
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to download");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
/* convert to list of package id's */
- task->priv->package_ids = pk_package_array_to_strv (array);
- gpk_dbus_task_install_package_ids (task);
+ dtask->priv->package_ids = pk_package_array_to_strv (array);
+ gpk_dbus_task_install_package_ids (dtask);
out:
if (error_item != NULL)
pk_item_error_code_unref (error_item);
@@ -1960,7 +1959,7 @@ out:
* Return value: %TRUE if the method succeeded
**/
void
-gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *task, gchar **fonts)
+gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *dtask, gchar **fonts)
{
gboolean ret;
GPtrArray *array = NULL;
@@ -1976,22 +1975,22 @@ gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *task, gchar **fonts)
const gchar *title_part;
GString *string;
- g_return_if_fail (GPK_IS_DBUS_TASK (task));
+ g_return_if_fail (GPK_IS_DBUS_TASK (dtask));
g_return_if_fail (fonts != NULL);
/* get number of fonts to install */
len = g_strv_length (fonts);
/* check it's not session wide banned in gconf */
- ret = gconf_client_get_bool (task->priv->gconf_client, GPK_CONF_ENABLE_FONT_HELPER, NULL);
+ ret = gconf_client_get_bool (dtask->priv->gconf_client, GPK_CONF_ENABLE_FONT_HELPER, NULL);
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_FORBIDDEN, "not enabled in GConf : %s", GPK_CONF_ENABLE_FONT_HELPER);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* optional */
- if (!task->priv->show_confirm_search) {
+ if (!dtask->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -2001,14 +2000,14 @@ gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *task, gchar **fonts)
/* correct prefix */
if (!g_str_has_prefix (fonts[i], ":lang=")) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "not recognised prefix: '%s'", fonts[i]);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* no lang code */
size = strlen (fonts[i]);
if (size < 7 || size > 20) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "lang tag malformed: '%s'", fonts[i]);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
}
@@ -2017,12 +2016,12 @@ gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *task, gchar **fonts)
/* don't use a bullet for one item */
if (len == 1) {
- text = gpk_dbus_task_font_tag_to_localised_name (task, fonts[0]);
+ text = gpk_dbus_task_font_tag_to_localised_name (dtask, fonts[0]);
g_string_append_printf (string, "%s\n", text);
g_free (text);
} else {
for (i=0; i<len; i++) {
- text = gpk_dbus_task_font_tag_to_localised_name (task, fonts[i]);
+ text = gpk_dbus_task_font_tag_to_localised_name (dtask, fonts[i]);
g_string_append_printf (string, "â?¢ %s\n", text);
g_free (text);
}
@@ -2043,41 +2042,41 @@ gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *task, gchar **fonts)
g_free (text);
/* make title using application name */
- if (task->priv->parent_title != NULL) {
+ if (dtask->priv->parent_title != NULL) {
/* TRANSLATORS: string is a program name, e.g. "Movie Player" */
- text = g_strdup_printf (ngettext ("%s wants to install a font", "%s wants to install fonts", len), task->priv->parent_title);
+ text = g_strdup_printf (ngettext ("%s wants to install a font", "%s wants to install fonts", len), dtask->priv->parent_title);
} else {
/* TRANSLATORS: a random program which we can't get the name wants to do something */
text = g_strdup (ngettext ("A program wants to install a font", "A program wants to install fonts", len));
}
/* TRANSLATORS: button: confirm to search for packages */
- ret = gpk_dbus_task_confirm_action (task, text, message, _("Search"));
+ ret = gpk_dbus_task_confirm_action (dtask, text, message, _("Search"));
g_free (text);
g_free (message);
if (!ret) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to search");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
/* TRANSLATORS: title to show when searching for font files */
title = ngettext ("Searching for font", "Searching for fonts", len);
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, title);
- gpk_modal_dialog_set_image_status (task->priv->dialog, PK_STATUS_ENUM_WAIT);
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-finding-packages");
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_image_status (dtask->priv->dialog, PK_STATUS_ENUM_WAIT);
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-finding-packages");
/* setup the UI */
- if (task->priv->show_progress)
- gpk_modal_dialog_present (task->priv->dialog);
+ if (dtask->priv->show_progress)
+ gpk_modal_dialog_present (dtask->priv->dialog);
/* do each one */
- pk_client_what_provides_async (task->priv->client, pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1),
+ pk_client_what_provides_async (PK_CLIENT(dtask->priv->task), pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_ARCH, PK_FILTER_ENUM_NEWEST, -1),
PK_PROVIDES_ENUM_FONT, fonts, NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_fontconfig_what_provides_cb, task);
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_fontconfig_what_provides_cb, dtask);
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -2087,7 +2086,7 @@ out:
* gpk_dbus_task_catalog_lookup_cb:
**/
static void
-gpk_dbus_task_catalog_lookup_cb (GObject *object, GAsyncResult *res, GpkDbusTask *task)
+gpk_dbus_task_catalog_lookup_cb (GObject *object, GAsyncResult *res, GpkDbusTask *dtask)
{
PkCatalog *catalog = PK_CATALOG (object);
GError *error = NULL;
@@ -2098,16 +2097,16 @@ gpk_dbus_task_catalog_lookup_cb (GObject *object, GAsyncResult *res, GpkDbusTask
/* get the results */
array = pk_catalog_lookup_finish (catalog, res, &error);
if (array == NULL) {
- if (task->priv->show_warning) {
+ if (dtask->priv->show_warning) {
/* TRANSLATORS: title: we've already got all these packages installed */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, _("Could not process catalog"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, NULL);
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Could not process catalog"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, NULL);
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ gpk_modal_dialog_run (dtask->priv->dialog);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_FAILED, "failed to parse catalog: %s", error->message);
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
g_error_free (error);
goto out;
}
@@ -2115,48 +2114,48 @@ gpk_dbus_task_catalog_lookup_cb (GObject *object, GAsyncResult *res, GpkDbusTask
/* nothing to do? */
if (array->len == 0) {
/* show UI */
- if (task->priv->show_warning) {
+ if (dtask->priv->show_warning) {
/* TRANSLATORS: title: we've already got all these packages installed */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, _("No packages need to be installed"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-catalog-none-required");
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_WARNING, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("No packages need to be installed"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-catalog-none-required");
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ gpk_modal_dialog_run (dtask->priv->dialog);
}
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_FAILED, "No packages need to be installed");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
/* optional */
- if (!task->priv->show_confirm_deps) {
+ if (!dtask->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, GPK_MODAL_DIALOG_PACKAGE_LIST);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, GPK_MODAL_DIALOG_PACKAGE_LIST);
/* TRANSLATORS: title: allow user to confirm */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Install packages in catalog?"));
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Install packages in catalog?"));
/* TRANSLATORS: display a list of packages to install */
- gpk_modal_dialog_set_message (task->priv->dialog, _("The following packages are marked to be installed from the catalog:"));
- gpk_modal_dialog_set_image (task->priv->dialog, "dialog-question");
- gpk_modal_dialog_set_package_list (task->priv->dialog, array);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, _("The following packages are marked to be installed from the catalog:"));
+ gpk_modal_dialog_set_image (dtask->priv->dialog, "dialog-question");
+ gpk_modal_dialog_set_package_list (dtask->priv->dialog, array);
/* TRANSLATORS: button: install packages in catalog */
- gpk_modal_dialog_set_action (task->priv->dialog, _("Install"));
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("Install"));
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "Action was cancelled");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
/* convert to list of package id's */
- task->priv->package_ids = pk_package_array_to_strv (array);
- gpk_dbus_task_install_package_ids (task);
+ dtask->priv->package_ids = pk_package_array_to_strv (array);
+ gpk_dbus_task_install_package_ids (dtask);
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -2166,7 +2165,7 @@ out:
* gpk_dbus_task_install_catalogs:
**/
void
-gpk_dbus_task_install_catalogs (GpkDbusTask *task, gchar **filenames)
+gpk_dbus_task_install_catalogs (GpkDbusTask *dtask, gchar **filenames)
{
GError *error_dbus = NULL;
GtkResponseType button;
@@ -2177,7 +2176,7 @@ gpk_dbus_task_install_catalogs (GpkDbusTask *task, gchar **filenames)
len = g_strv_length (filenames);
/* optional */
- if (!task->priv->show_confirm_search) {
+ if (!dtask->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -2188,36 +2187,36 @@ gpk_dbus_task_install_catalogs (GpkDbusTask *task, gchar **filenames)
message = g_strjoinv ("\n", filenames);
/* show UI */
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, 0);
- gpk_modal_dialog_set_title (task->priv->dialog, title);
- gpk_modal_dialog_set_message (task->priv->dialog, message);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_CONFIRM, 0);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, title);
+ gpk_modal_dialog_set_message (dtask->priv->dialog, message);
/* TRANSLATORS: button: install catalog */
- gpk_modal_dialog_set_action (task->priv->dialog, _("Install"));
- gpk_modal_dialog_set_help_id (task->priv->dialog, "dialog-install-catalogs");
- gpk_modal_dialog_present_with_time (task->priv->dialog, task->priv->timestamp);
- button = gpk_modal_dialog_run (task->priv->dialog);
+ gpk_modal_dialog_set_action (dtask->priv->dialog, _("Install"));
+ gpk_modal_dialog_set_help_id (dtask->priv->dialog, "dialog-install-catalogs");
+ gpk_modal_dialog_present_with_time (dtask->priv->dialog, dtask->priv->timestamp);
+ button = gpk_modal_dialog_run (dtask->priv->dialog);
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
error_dbus = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_CANCELLED, "did not agree to install");
- dbus_g_method_return_error (task->priv->context, error_dbus);
+ dbus_g_method_return_error (dtask->priv->context, error_dbus);
goto out;
}
skip_checks:
- gpk_modal_dialog_setup (task->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
+ gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: install package catalogs, that is, instructions for installing */
- gpk_modal_dialog_set_title (task->priv->dialog, _("Install catalogs"));
- gpk_dbus_task_set_status (task, PK_STATUS_ENUM_WAIT);
+ gpk_modal_dialog_set_title (dtask->priv->dialog, _("Install catalogs"));
+ gpk_dbus_task_set_status (dtask, PK_STATUS_ENUM_WAIT);
/* setup the UI */
- if (task->priv->show_progress)
- gpk_modal_dialog_present (task->priv->dialog);
+ if (dtask->priv->show_progress)
+ gpk_modal_dialog_present (dtask->priv->dialog);
/* lookup catalog */
- pk_catalog_lookup_async (task->priv->catalog, filenames[0], NULL,
- (PkProgressCallback) gpk_dbus_task_progress_cb, task,
- (GAsyncReadyCallback) gpk_dbus_task_catalog_lookup_cb, task);
+ pk_catalog_lookup_async (dtask->priv->catalog, filenames[0], NULL,
+ (PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
+ (GAsyncReadyCallback) gpk_dbus_task_catalog_lookup_cb, dtask);
out:
g_free (message);
}
@@ -2226,7 +2225,7 @@ out:
* gpk_dbus_task_get_package_for_exec:
**/
static gchar *
-gpk_dbus_task_get_package_for_exec (GpkDbusTask *task, const gchar *exec)
+gpk_dbus_task_get_package_for_exec (GpkDbusTask *dtask, const gchar *exec)
{
gchar *package = NULL;
GError *error = NULL;
@@ -2237,7 +2236,7 @@ gpk_dbus_task_get_package_for_exec (GpkDbusTask *task, const gchar *exec)
/* find the package name */
values = g_strsplit (exec, "&", -1);
- results = pk_client_search_file (task->priv->client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), values, NULL, NULL, NULL, &error);
+ results = pk_client_search_file (PK_CLIENT(dtask->priv->task), pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), values, NULL, NULL, NULL, &error);
if (results == NULL) {
egg_warning ("failed to search file: %s", error->message);
g_error_free (error);
@@ -2291,53 +2290,53 @@ gpk_dbus_task_path_is_trusted (const gchar *exec)
* a translated name and icon.
**/
gboolean
-gpk_dbus_task_set_exec (GpkDbusTask *task, const gchar *exec)
+gpk_dbus_task_set_exec (GpkDbusTask *dtask, const gchar *exec)
{
GpkX11 *x11;
gchar *package = NULL;
- g_return_val_if_fail (GPK_IS_DBUS_TASK (task), FALSE);
+ g_return_val_if_fail (GPK_IS_DBUS_TASK (dtask), FALSE);
/* old values invalid */
- g_free (task->priv->parent_title);
- g_free (task->priv->parent_icon_name);
- task->priv->parent_title = NULL;
- task->priv->parent_icon_name = NULL;
+ g_free (dtask->priv->parent_title);
+ g_free (dtask->priv->parent_icon_name);
+ dtask->priv->parent_title = NULL;
+ dtask->priv->parent_icon_name = NULL;
/* is the binary trusted, i.e. can we probe it's window properties */
if (gpk_dbus_task_path_is_trusted (exec)) {
egg_debug ("using application window properties");
/* get from window properties */
x11 = gpk_x11_new ();
- gpk_x11_set_window (x11, task->priv->parent_window);
- task->priv->parent_title = gpk_x11_get_title (x11);
+ gpk_x11_set_window (x11, dtask->priv->parent_window);
+ dtask->priv->parent_title = gpk_x11_get_title (x11);
g_object_unref (x11);
goto out;
}
/* get from installed database */
- package = gpk_dbus_task_get_package_for_exec (task, exec);
+ package = gpk_dbus_task_get_package_for_exec (dtask, exec);
egg_debug ("got package %s", package);
/* try to get from PkDesktop */
if (package != NULL) {
- task->priv->parent_title = gpk_desktop_guess_localised_name (task->priv->desktop, package);
- task->priv->parent_icon_name = gpk_desktop_guess_icon_name (task->priv->desktop, package);
+ dtask->priv->parent_title = gpk_desktop_guess_localised_name (dtask->priv->desktop, package);
+ dtask->priv->parent_icon_name = gpk_desktop_guess_icon_name (dtask->priv->desktop, package);
/* fallback to package name */
- if (task->priv->parent_title == NULL) {
+ if (dtask->priv->parent_title == NULL) {
egg_debug ("did not get localised description for %s", package);
- task->priv->parent_title = g_strdup (package);
+ dtask->priv->parent_title = g_strdup (package);
}
}
/* fallback to exec - eugh... */
- if (task->priv->parent_title == NULL) {
+ if (dtask->priv->parent_title == NULL) {
egg_debug ("did not get package for %s, using exec basename", package);
- task->priv->parent_title = g_path_get_basename (exec);
+ dtask->priv->parent_title = g_path_get_basename (exec);
}
out:
g_free (package);
- egg_debug ("got name=%s, icon=%s", task->priv->parent_title, task->priv->parent_icon_name);
+ egg_debug ("got name=%s, icon=%s", dtask->priv->parent_title, dtask->priv->parent_icon_name);
return TRUE;
}
@@ -2358,30 +2357,30 @@ gpk_dbus_task_class_init (GpkDbusTaskClass *klass)
* @task: a valid #GpkDbusTask instance
**/
static void
-gpk_dbus_task_init (GpkDbusTask *task)
+gpk_dbus_task_init (GpkDbusTask *dtask)
{
gboolean ret;
GtkWindow *main_window;
- task->priv = GPK_DBUS_TASK_GET_PRIVATE (task);
-
- task->priv->package_ids = NULL;
- task->priv->files = NULL;
- task->priv->parent_window = NULL;
- task->priv->parent_title = NULL;
- task->priv->parent_icon_name = NULL;
- task->priv->error_details = NULL;
- task->priv->context = NULL;
- task->priv->cancellable = g_cancellable_new ();
- task->priv->exit = PK_EXIT_ENUM_FAILED;
- task->priv->show_confirm_search = TRUE;
- task->priv->show_confirm_deps = TRUE;
- task->priv->show_confirm_install = TRUE;
- task->priv->show_progress = TRUE;
- task->priv->show_finished = TRUE;
- task->priv->show_warning = TRUE;
- task->priv->timestamp = 0;
- task->priv->last_exit_code = PK_ERROR_ENUM_UNKNOWN;
+ dtask->priv = GPK_DBUS_TASK_GET_PRIVATE (dtask);
+
+ dtask->priv->package_ids = NULL;
+ dtask->priv->files = NULL;
+ dtask->priv->parent_window = NULL;
+ dtask->priv->parent_title = NULL;
+ dtask->priv->parent_icon_name = NULL;
+ dtask->priv->error_details = NULL;
+ dtask->priv->context = NULL;
+ dtask->priv->cancellable = g_cancellable_new ();
+ dtask->priv->exit = PK_EXIT_ENUM_FAILED;
+ dtask->priv->show_confirm_search = TRUE;
+ dtask->priv->show_confirm_deps = TRUE;
+ dtask->priv->show_confirm_install = TRUE;
+ dtask->priv->show_progress = TRUE;
+ dtask->priv->show_finished = TRUE;
+ dtask->priv->show_warning = TRUE;
+ dtask->priv->timestamp = 0;
+ dtask->priv->last_exit_code = PK_ERROR_ENUM_UNKNOWN;
/* add application specific icons to search path */
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
@@ -2391,39 +2390,39 @@ gpk_dbus_task_init (GpkDbusTask *task)
if (!notify_is_initted ())
notify_init ("gpk-dbus_task");
- task->priv->vendor = gpk_vendor_new ();
- task->priv->dialog = gpk_modal_dialog_new ();
- main_window = gpk_modal_dialog_get_window (task->priv->dialog);
- gpk_modal_dialog_set_window_icon (task->priv->dialog, "pk-package-installed");
- g_signal_connect (task->priv->dialog, "cancel",
- G_CALLBACK (gpk_dbus_task_button_cancel_cb), task);
- g_signal_connect (task->priv->dialog, "close",
- G_CALLBACK (gpk_dbus_task_button_close_cb), task);
+ dtask->priv->vendor = gpk_vendor_new ();
+ dtask->priv->dialog = gpk_modal_dialog_new ();
+ main_window = gpk_modal_dialog_get_window (dtask->priv->dialog);
+ gpk_modal_dialog_set_window_icon (dtask->priv->dialog, "pk-package-installed");
+ g_signal_connect (dtask->priv->dialog, "cancel",
+ G_CALLBACK (gpk_dbus_task_button_cancel_cb), dtask);
+ g_signal_connect (dtask->priv->dialog, "close",
+ G_CALLBACK (gpk_dbus_task_button_close_cb), dtask);
/* helpers */
- task->priv->helper_run = gpk_helper_run_new ();
- gpk_helper_run_set_parent (task->priv->helper_run, main_window);
+ dtask->priv->helper_run = gpk_helper_run_new ();
+ gpk_helper_run_set_parent (dtask->priv->helper_run, main_window);
- task->priv->helper_chooser = gpk_helper_chooser_new ();
- g_signal_connect (task->priv->helper_chooser, "event", G_CALLBACK (gpk_dbus_task_chooser_event_cb), task);
- gpk_helper_chooser_set_parent (task->priv->helper_chooser, main_window);
+ dtask->priv->helper_chooser = gpk_helper_chooser_new ();
+ g_signal_connect (dtask->priv->helper_chooser, "event", G_CALLBACK (gpk_dbus_task_chooser_event_cb), dtask);
+ gpk_helper_chooser_set_parent (dtask->priv->helper_chooser, main_window);
/* map ISO639 to language names */
- task->priv->language = gpk_language_new ();
- gpk_language_populate (task->priv->language, NULL);
+ dtask->priv->language = gpk_language_new ();
+ gpk_language_populate (dtask->priv->language, NULL);
/* use gconf for session settings */
- task->priv->gconf_client = gconf_client_get_default ();
+ dtask->priv->gconf_client = gconf_client_get_default ();
/* get actions */
- task->priv->control = pk_control_new ();
- task->priv->client = pk_client_new ();
- task->priv->roles = pk_control_get_properties (task->priv->control, NULL, NULL);
- task->priv->catalog = pk_catalog_new ();
+ dtask->priv->control = pk_control_new ();
+ dtask->priv->task = PK_TASK(gpk_task_new ());
+ dtask->priv->roles = pk_control_get_properties (dtask->priv->control, NULL, NULL);
+ dtask->priv->catalog = pk_catalog_new ();
/* used for icons and translations */
- task->priv->desktop = pk_desktop_new ();
- ret = pk_desktop_open_database (task->priv->desktop, NULL);
+ dtask->priv->desktop = pk_desktop_new ();
+ ret = pk_desktop_open_database (dtask->priv->desktop, NULL);
if (!ret)
egg_warning ("failed to open desktop database");
}
@@ -2435,29 +2434,29 @@ gpk_dbus_task_init (GpkDbusTask *task)
static void
gpk_dbus_task_finalize (GObject *object)
{
- GpkDbusTask *task;
+ GpkDbusTask *dtask;
g_return_if_fail (GPK_IS_DBUS_TASK (object));
- task = GPK_DBUS_TASK (object);
- g_return_if_fail (task->priv != NULL);
-
- g_free (task->priv->parent_title);
- g_free (task->priv->parent_icon_name);
- g_free (task->priv->error_details);
- g_strfreev (task->priv->files);
- g_strfreev (task->priv->package_ids);
- g_object_unref (task->priv->client);
- g_object_unref (task->priv->control);
- g_object_unref (task->priv->desktop);
- g_object_unref (task->priv->gconf_client);
- g_object_unref (task->priv->dialog);
- g_object_unref (task->priv->vendor);
- g_object_unref (task->priv->language);
- g_object_unref (task->priv->cancellable);
- g_object_unref (task->priv->helper_run);
- g_object_unref (task->priv->helper_chooser);
- g_object_unref (task->priv->catalog);
+ dtask = GPK_DBUS_TASK (object);
+ g_return_if_fail (dtask->priv != NULL);
+
+ g_free (dtask->priv->parent_title);
+ g_free (dtask->priv->parent_icon_name);
+ g_free (dtask->priv->error_details);
+ g_strfreev (dtask->priv->files);
+ g_strfreev (dtask->priv->package_ids);
+ g_object_unref (PK_CLIENT(dtask->priv->task));
+ g_object_unref (dtask->priv->control);
+ g_object_unref (dtask->priv->desktop);
+ g_object_unref (dtask->priv->gconf_client);
+ g_object_unref (dtask->priv->dialog);
+ g_object_unref (dtask->priv->vendor);
+ g_object_unref (dtask->priv->language);
+ g_object_unref (dtask->priv->cancellable);
+ g_object_unref (dtask->priv->helper_run);
+ g_object_unref (dtask->priv->helper_chooser);
+ g_object_unref (dtask->priv->catalog);
G_OBJECT_CLASS (gpk_dbus_task_parent_class)->finalize (object);
}
@@ -2472,9 +2471,9 @@ gpk_dbus_task_finalize (GObject *object)
GpkDbusTask *
gpk_dbus_task_new (void)
{
- GpkDbusTask *task;
- task = g_object_new (GPK_TYPE_DBUS_TASK, NULL);
- return GPK_DBUS_TASK (task);
+ GpkDbusTask *dtask;
+ dtask = g_object_new (GPK_TYPE_DBUS_TASK, NULL);
+ return GPK_DBUS_TASK (dtask);
}
/***************************************************************************
@@ -2487,7 +2486,7 @@ void
gpk_dbus_task_test (gpointer data)
{
EggTest *test = (EggTest *) data;
- GpkDbusTask *task;
+ GpkDbusTask *dtask;
gchar *lang;
gchar *language;
gchar *package;
@@ -2502,8 +2501,8 @@ gpk_dbus_task_test (gpointer data)
/************************************************************/
egg_test_title (test, "get GpkDbusTask object");
- task = gpk_dbus_task_new ();
- if (task != NULL)
+ dtask = gpk_dbus_task_new ();
+ if (dtask != NULL)
egg_test_success (test, NULL);
else
egg_warning (NULL);
@@ -2519,7 +2518,7 @@ gpk_dbus_task_test (gpointer data)
/************************************************************/
egg_test_title (test, "convert tag to language");
- language = gpk_dbus_task_font_tag_to_localised_name (task, ":lang=mn");
+ language = gpk_dbus_task_font_tag_to_localised_name (dtask, ":lang=mn");
if (g_strcmp0 (language, "Mongolian") == 0)
egg_test_success (test, NULL);
else
@@ -2544,7 +2543,7 @@ gpk_dbus_task_test (gpointer data)
/************************************************************/
egg_test_title (test, "get package for exec");
- package = gpk_dbus_task_get_package_for_exec (task, "/usr/bin/totem");
+ package = gpk_dbus_task_get_package_for_exec (dtask, "/usr/bin/totem");
if (g_strcmp0 (package, "totem") == 0)
egg_test_success (test, NULL);
else
@@ -2553,7 +2552,7 @@ gpk_dbus_task_test (gpointer data)
/************************************************************/
egg_test_title (test, "set exec");
- ret = gpk_dbus_task_set_exec (task, "/usr/bin/totem");
+ ret = gpk_dbus_task_set_exec (dtask, "/usr/bin/totem");
if (ret)
egg_test_success (test, NULL);
else
@@ -2563,8 +2562,8 @@ gpk_dbus_task_test (gpointer data)
/************************************************************/
egg_test_title (test, "install fonts (no UI)");
error = NULL;
- gpk_dbus_task_set_interaction (task, GPK_CLIENT_INTERACT_NEVER);
- ret = gpk_dbus_task_install_fontconfig_resources (task, (gchar**)fonts, &error);
+ gpk_dbus_task_set_interaction (dtask, GPK_CLIENT_INTERACT_NEVER);
+ ret = gpk_dbus_task_install_fontconfig_resources (dtask, (gchar**)fonts, &error);
if (ret)
egg_test_success (test, NULL);
else {
@@ -2576,8 +2575,8 @@ gpk_dbus_task_test (gpointer data)
/************************************************************/
egg_test_title (test, "install fonts (if found)");
error = NULL;
- gpk_dbus_task_set_interaction (task, pk_bitfield_from_enums (GPK_CLIENT_INTERACT_CONFIRM_SEARCH, GPK_CLIENT_INTERACT_FINISHED, -1));
- ret = gpk_dbus_task_install_fontconfig_resources (task, (gchar**)fonts, &error);
+ gpk_dbus_task_set_interaction (dtask, pk_bitfield_from_enums (GPK_CLIENT_INTERACT_CONFIRM_SEARCH, GPK_CLIENT_INTERACT_FINISHED, -1));
+ ret = gpk_dbus_task_install_fontconfig_resources (dtask, (gchar**)fonts, &error);
if (ret)
egg_test_success (test, NULL);
else {
@@ -2589,8 +2588,8 @@ gpk_dbus_task_test (gpointer data)
/************************************************************/
egg_test_title (test, "install fonts (always)");
error = NULL;
- gpk_dbus_task_set_interaction (task, GPK_CLIENT_INTERACT_ALWAYS);
- ret = gpk_dbus_task_install_fontconfig_resources (task, (gchar**)fonts, &error);
+ gpk_dbus_task_set_interaction (dtask, GPK_CLIENT_INTERACT_ALWAYS);
+ ret = gpk_dbus_task_install_fontconfig_resources (dtask, (gchar**)fonts, &error);
if (ret)
egg_test_success (test, NULL);
else {
diff --git a/src/gpk-dbus-task.h b/src/gpk-dbus-task.h
index b17d660..b631754 100644
--- a/src/gpk-dbus-task.h
+++ b/src/gpk-dbus-task.h
@@ -86,35 +86,35 @@ GType gpk_dbus_task_error_get_type (void);
GpkDbusTask *gpk_dbus_task_new (void);
/* methods that expect a DBusGMethodInvocation return */
-void gpk_dbus_task_is_installed (GpkDbusTask *task,
+void gpk_dbus_task_is_installed (GpkDbusTask *dtask,
const gchar *package_name);
-void gpk_dbus_task_search_file (GpkDbusTask *task,
+void gpk_dbus_task_search_file (GpkDbusTask *dtask,
const gchar *search_file);
-void gpk_dbus_task_install_package_files (GpkDbusTask *task,
+void gpk_dbus_task_install_package_files (GpkDbusTask *dtask,
gchar **files_rel);
-void gpk_dbus_task_install_provide_files (GpkDbusTask *task,
+void gpk_dbus_task_install_provide_files (GpkDbusTask *dtask,
gchar **full_paths);
-void gpk_dbus_task_install_mime_types (GpkDbusTask *task,
+void gpk_dbus_task_install_mime_types (GpkDbusTask *dtask,
gchar **mime_types);
-void gpk_dbus_task_install_gstreamer_resources (GpkDbusTask *task,
+void gpk_dbus_task_install_gstreamer_resources (GpkDbusTask *dtask,
gchar **codec_names);
-void gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *task,
+void gpk_dbus_task_install_fontconfig_resources (GpkDbusTask *dtask,
gchar **fonts);
-void gpk_dbus_task_install_package_names (GpkDbusTask *task,
+void gpk_dbus_task_install_package_names (GpkDbusTask *dtask,
gchar **packages);
-void gpk_dbus_task_install_catalogs (GpkDbusTask *task,
+void gpk_dbus_task_install_catalogs (GpkDbusTask *dtask,
gchar **filenames);
/* set state */
-gboolean gpk_dbus_task_set_interaction (GpkDbusTask *task,
+gboolean gpk_dbus_task_set_interaction (GpkDbusTask *dtask,
PkBitfield interact);
-gboolean gpk_dbus_task_set_timestamp (GpkDbusTask *task,
+gboolean gpk_dbus_task_set_timestamp (GpkDbusTask *dtask,
guint timeout);
-gboolean gpk_dbus_task_set_context (GpkDbusTask *task,
+gboolean gpk_dbus_task_set_context (GpkDbusTask *dtask,
DBusGMethodInvocation *context);
-gboolean gpk_dbus_task_set_xid (GpkDbusTask *task,
+gboolean gpk_dbus_task_set_xid (GpkDbusTask *dtask,
guint xid);
-gboolean gpk_dbus_task_set_exec (GpkDbusTask *task,
+gboolean gpk_dbus_task_set_exec (GpkDbusTask *dtask,
const gchar *exec);
G_END_DECLS
diff --git a/src/gpk-firmware.c b/src/gpk-firmware.c
index d6d5da5..a96bc7b 100644
--- a/src/gpk-firmware.c
+++ b/src/gpk-firmware.c
@@ -50,6 +50,7 @@
#include "gpk-common.h"
#include "gpk-error.h"
#include "gpk-firmware.h"
+#include "gpk-task.h"
static void gpk_firmware_finalize (GObject *object);
@@ -67,7 +68,7 @@ struct GpkFirmwarePrivate
GConfClient *gconf_client;
GFileMonitor *monitor;
GPtrArray *array_requested;
- PkClient *client;
+ PkTask *task;
GPtrArray *packages_found;
guint timeout_id;
};
@@ -410,7 +411,7 @@ gpk_firmware_install_file (GpkFirmware *firmware)
/* install all of the firmware files */
package_ids = pk_package_array_to_strv (firmware->priv->packages_found);
- pk_client_install_packages_async (firmware->priv->client, TRUE, package_ids, NULL, NULL, NULL,
+ pk_client_install_packages_async (PK_CLIENT(firmware->priv->task), TRUE, package_ids, NULL, NULL, NULL,
(GAsyncReadyCallback) gpk_firmware_install_packages_cb, firmware);
g_strfreev (package_ids);
}
@@ -485,7 +486,7 @@ gpk_firmware_check_available (GpkFirmware *firmware, const gchar *filename)
/* search for newest not installed package */
filter = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_NEWEST, -1);
values = g_strsplit (filename, "&", -1);
- results = pk_client_search_file (firmware->priv->client, filter, values, NULL, NULL, NULL, &error);
+ results = pk_client_search_file (PK_CLIENT(firmware->priv->task), filter, values, NULL, NULL, NULL, &error);
if (results == NULL) {
egg_warning ("failed to search file %s: %s", filename, error->message);
g_error_free (error);
@@ -998,7 +999,7 @@ gpk_firmware_init (GpkFirmware *firmware)
firmware->priv->array_requested = g_ptr_array_new_with_free_func ((GDestroyNotify) gpk_firmware_request_free);
firmware->priv->gconf_client = gconf_client_get_default ();
firmware->priv->consolekit = egg_console_kit_new ();
- firmware->priv->client = pk_client_new ();
+ firmware->priv->task = PK_TASK(gpk_task_new ());
/* setup watch for new hardware */
file = g_file_new_for_path (GPK_FIRMWARE_MISSING_DIR);
@@ -1037,7 +1038,7 @@ gpk_firmware_finalize (GObject *object)
g_return_if_fail (firmware->priv != NULL);
g_ptr_array_unref (firmware->priv->array_requested);
g_ptr_array_unref (firmware->priv->packages_found);
- g_object_unref (firmware->priv->client);
+ g_object_unref (PK_CLIENT(firmware->priv->task));
g_object_unref (firmware->priv->gconf_client);
g_object_unref (firmware->priv->consolekit);
if (firmware->priv->monitor != NULL)
diff --git a/src/gpk-hardware.c b/src/gpk-hardware.c
index 71aca6d..eca4b08 100644
--- a/src/gpk-hardware.c
+++ b/src/gpk-hardware.c
@@ -46,6 +46,7 @@
#include "gpk-common.h"
#include "gpk-hardware.h"
+#include "gpk-task.h"
static void gpk_hardware_finalize (GObject *object);
@@ -57,7 +58,7 @@ static void gpk_hardware_finalize (GObject *object);
struct GpkHardwarePrivate
{
- PkClient *client;
+ PkTask *task;
GConfClient *gconf_client;
DBusGConnection *connection;
DBusGProxy *proxy;
@@ -97,7 +98,7 @@ static void
gpk_hardware_install_package (GpkHardware *hardware)
{
/* FIXME: this needs to be async and connect up to the repo signature stuff */
- pk_client_install_packages_async (hardware->priv->client, TRUE, hardware->priv->package_ids, NULL, NULL, NULL,
+ pk_client_install_packages_async (PK_CLIENT(hardware->priv->task), TRUE, hardware->priv->package_ids, NULL, NULL, NULL,
(GAsyncReadyCallback) gpk_hardware_install_packages_cb, hardware);
}
@@ -197,7 +198,7 @@ gpk_hardware_check_for_driver_available (GpkHardware *hardware, const gchar *udi
{
gchar **values = NULL;
values = g_strsplit (udi, "&", -1);
- pk_client_what_provides_async (hardware->priv->client, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED),
+ pk_client_what_provides_async (PK_CLIENT(hardware->priv->task), pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED),
PK_PROVIDES_ENUM_HARDWARE_DRIVER, values, NULL, NULL, NULL,
(GAsyncReadyCallback) gpk_hardware_what_provides_cb, hardware);
g_strfreev (values);
@@ -266,7 +267,7 @@ gpk_hardware_init (GpkHardware *hardware)
egg_debug ("hardware driver checking disabled in GConf");
return;
}
- hardware->priv->client = pk_client_new ();
+ hardware->priv->task = PK_TASK(gpk_task_new ());
hardware->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (error != NULL) {
@@ -314,7 +315,7 @@ gpk_hardware_finalize (GObject *object)
g_return_if_fail (hardware->priv != NULL);
g_object_unref (hardware->priv->gconf_client);
- g_object_unref (hardware->priv->client);
+ g_object_unref (PK_CLIENT(hardware->priv->task));
g_strfreev (hardware->priv->package_ids);
G_OBJECT_CLASS (gpk_hardware_parent_class)->finalize (object);
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index a5102df..17956e3 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -49,6 +49,7 @@
#include "gpk-cell-renderer-restart.h"
#include "gpk-cell-renderer-spinner.h"
#include "gpk-enum.h"
+#include "gpk-task.h"
#define GPK_UPDATE_VIEWER_AUTO_QUIT_TIMEOUT 10 /* seconds */
#define GPK_UPDATE_VIEWER_AUTO_RESTART_TIMEOUT 60 /* seconds */
@@ -62,7 +63,7 @@ static GMainLoop *loop = NULL;
static GtkBuilder *builder = NULL;
static GtkListStore *array_store_updates = NULL;
static GtkTextBuffer *text_buffer = NULL;
-static PkClient *client = NULL;
+static PkTask *task = NULL;
static PkControl *control = NULL;
static GPtrArray *update_array = NULL;
static EggMarkdown *markdown = NULL;
@@ -169,7 +170,7 @@ gpk_update_viewer_quit (void)
GtkResponseType response;
/* are we in a transaction */
- ret = pk_client_get_role (client, &role, NULL, &error);
+ ret = pk_client_get_role (PK_CLIENT(task), &role, NULL, &error);
if (!ret) {
egg_warning ("failed to get role: %s", error->message);
g_error_free (error);
@@ -179,7 +180,7 @@ gpk_update_viewer_quit (void)
egg_debug ("no role, so quitting");
goto out;
}
- ret = pk_client_get_status (client, &status, &error);
+ ret = pk_client_get_status (PK_CLIENT(task), &status, &error);
if (!ret) {
egg_warning ("failed to get status: %s", error->message);
g_error_free (error);
@@ -191,7 +192,7 @@ gpk_update_viewer_quit (void)
}
/* can we easily cancel */
- ret = pk_client_get_allow_cancel (client, &allow_cancel, &error);
+ ret = pk_client_get_allow_cancel (PK_CLIENT(task), &allow_cancel, &error);
if (!ret) {
egg_warning ("failed to get allow cancel state: %s", error->message);
g_error_free (error);
@@ -200,7 +201,7 @@ gpk_update_viewer_quit (void)
/* cancel the transaction */
if (allow_cancel) {
- ret = g_cancellable_cancel (client, &error);
+ ret = g_cancellable_cancel (PK_CLIENT(task), &error);
if (!ret) {
egg_warning ("failed to cancel client: %s", error->message);
g_error_free (error);
@@ -417,7 +418,7 @@ gpk_update_viewer_button_install_cb (GtkWidget *widget, gpointer data)
install_package_ids = g_strdupv (package_ids);
/* get packages that also have to be updated */
- ret = pk_client_update_packages (client, package_ids, &error);
+ ret = pk_client_update_packages (PK_CLIENT(task), package_ids, &error);
if (!ret) {
egg_warning ("cannot get depends for updates: %s", error->message);
g_error_free (error);
@@ -566,7 +567,7 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *item, gpoin
gboolean selected;
gboolean scroll;
- pk_client_get_role (client, &role, NULL, NULL);
+ pk_client_get_role (PK_CLIENT(task), &role, NULL, NULL);
egg_debug ("role = %s, package = %s:%s:%s", pk_role_enum_to_text (role),
pk_info_enum_to_text (item->info), "xxx", item->summary);
@@ -1421,7 +1422,7 @@ gpk_update_viewer_finished_get_details_cb (GPtrArray *array)
package_ids = pk_package_sack_get_ids (array);
/* get the details of all the packages */
- ret = pk_client_get_details (client, package_ids, &error);
+ ret = pk_client_get_details (PK_CLIENT(task), package_ids, &error);
if (!ret) {
egg_error ("cannot get details: %s", error->message);
g_error_free (error);
@@ -1445,7 +1446,7 @@ gpk_update_viewer_finished_get_update_details_cb (GPtrArray *array)
package_ids = pk_package_sack_get_ids (array);
/* get the details of all the packages */
- ret = pk_client_get_update_detail (client, package_ids, &error);
+ ret = pk_client_get_update_detail (PK_CLIENT(task), package_ids, &error);
if (!ret) {
egg_error ("cannot get details: %s", error->message);
g_error_free (error);
@@ -1467,7 +1468,7 @@ gpk_update_viewer_finished_get_distro_upgrades_cb (gpointer data)
GError *error = NULL;
/* get the details of all the packages */
- ret = pk_client_get_distro_upgrades (client, &error);
+ ret = pk_client_get_distro_upgrades (PK_CLIENT(task), &error);
if (!ret) {
egg_error ("cannot get details: %s", error->message);
g_error_free (error);
@@ -1645,7 +1646,7 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
gpk_update_viewer_reconsider_info (model);
/* actually install packages this time */
- ret = pk_client_update_packages (client, TRUE, install_package_ids, &error);
+ ret = pk_client_update_packages (PK_CLIENT(task), TRUE, install_package_ids, &error);
if (!ret) {
egg_warning ("cannot install packages: %s", error->message);
g_error_free (error);
@@ -1672,7 +1673,7 @@ gpk_update_viewer_finished_cb (PkClient *client, PkExitEnum exit, guint runtime,
PkRestartEnum restart;
gchar *text;
- pk_client_get_role (client, &role, NULL, NULL);
+ pk_client_get_role (PK_CLIENT(task), &role, NULL, NULL);
egg_debug ("role: %s, exit: %s", pk_role_enum_to_text (role), pk_exit_enum_to_text (exit));
/* clear package */
@@ -1686,7 +1687,7 @@ gpk_update_viewer_finished_cb (PkClient *client, PkExitEnum exit, guint runtime,
gtk_widget_set_sensitive (widget, TRUE);
/* if secondary, ignore */
- if (client == client &&
+ if (PK_CLIENT(task) == client &&
(exit == PK_EXIT_ENUM_KEY_REQUIRED ||
exit == PK_EXIT_ENUM_EULA_REQUIRED)) {
egg_debug ("ignoring primary sig-required or eula");
@@ -1776,7 +1777,7 @@ gpk_update_viewer_finished_cb (PkClient *client, PkExitEnum exit, guint runtime,
CA_PROP_EVENT_DESCRIPTION, _("Updated successfully"), NULL);
/* get the worst restart case */
- restart = pk_client_get_require_restart (client);
+ restart = pk_client_get_require_restart (PK_CLIENT(task));
if (restart > restart_update)
restart_update = restart;
@@ -2297,7 +2298,7 @@ gpk_update_viewer_get_new_update_array (void)
}
/* get new array */
- ret = pk_client_get_updates (client, filter, &error);
+ ret = pk_client_get_updates (PK_CLIENT(task), filter, &error);
if (!ret) {
egg_warning ("Failed to get updates: %s", error->message);
g_error_free (error);
@@ -2680,29 +2681,7 @@ main (int argc, char *argv[])
G_CALLBACK (gpk_update_viewer_updates_changed_cb), NULL);
/* this is what we use mainly */
- client = pk_client_new ();
- g_signal_connect (client, "package",
- G_CALLBACK (gpk_update_viewer_package_cb), NULL);
- g_signal_connect (client, "details",
- G_CALLBACK (gpk_update_viewer_details_cb), NULL);
- g_signal_connect (client, "finished",
- G_CALLBACK (gpk_update_viewer_finished_cb), NULL);
- g_signal_connect (client, "progress-changed",
- G_CALLBACK (gpk_update_viewer_progress_changed_cb), NULL);
- g_signal_connect (client, "update-detail",
- G_CALLBACK (gpk_update_viewer_update_detail_cb), NULL);
- g_signal_connect (client, "status-changed",
- G_CALLBACK (gpk_update_viewer_status_changed_cb), NULL);
- g_signal_connect (client, "error-code",
- G_CALLBACK (gpk_update_viewer_error_code_cb), NULL);
- g_signal_connect (client, "allow-cancel",
- G_CALLBACK (gpk_update_viewer_allow_cancel_cb), NULL);
- g_signal_connect (client, "repo-signature-required",
- G_CALLBACK (gpk_update_viewer_repo_signature_required_cb), NULL);
- g_signal_connect (client, "eula-required",
- G_CALLBACK (gpk_update_viewer_eula_required_cb), NULL);
- g_signal_connect (client, "distro-upgrade",
- G_CALLBACK (pk_client_distro_upgrade_cb), NULL);
+ client = PK_TASK(gpk_task_new ());
/* get properties */
pk_control_get_properties_async (control, NULL, (GAsyncReadyCallback) pk_prefs_get_properties_cb, loop);
@@ -2832,7 +2811,7 @@ main (int argc, char *argv[])
g_main_loop_run (loop);
/* we might have visual stuff running, close it down */
- ret = g_cancellable_cancel (client, &error);
+ ret = g_cancellable_cancel (PK_CLIENT(task), &error);
if (!ret) {
egg_warning ("failed to cancel client: %s", error->message);
g_clear_error (&error);
@@ -2851,7 +2830,7 @@ out_build:
g_object_unref (gconf_client);
g_object_unref (control);
g_object_unref (markdown);
- g_object_unref (client);
+ g_object_unref (PK_CLIENT(task));
g_object_unref (console);
g_object_unref (builder);
unique_out:
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index 82fdae9..81921db 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -44,12 +44,13 @@
#include "egg-console-kit.h"
#include "gpk-common.h"
-#include "gpk-session.h"
+#include "gpk-enum.h"
#include "gpk-error.h"
-#include "gpk-watch.h"
-#include "gpk-modal-dialog.h"
#include "gpk-inhibit.h"
-#include "gpk-enum.h"
+#include "gpk-modal-dialog.h"
+#include "gpk-session.h"
+#include "gpk-task.h"
+#include "gpk-watch.h"
static void gpk_watch_finalize (GObject *object);
@@ -68,7 +69,7 @@ struct GpkWatchPrivate
NotifyNotification *notification_cached_messages;
GpkInhibit *inhibit;
GpkModalDialog *dialog;
- PkClient *client;
+ PkTask *task;
PkTransactionList *tlist;
PkRestartEnum restart;
GConfClient *gconf_client;
@@ -1635,7 +1636,7 @@ gpk_watch_transaction_list_added_cb (PkTransactionList *tlist, const gchar *tran
return;
}
egg_debug ("added: %s", transaction_id);
- pk_client_adopt_async (watch->priv->client, transaction_id, NULL,
+ pk_client_adopt_async (PK_CLIENT(watch->priv->task), transaction_id, NULL,
(PkProgressCallback) gpk_watch_progress_cb, watch,
(GAsyncReadyCallback) gpk_watch_adopt_cb, watch);
}
@@ -1715,7 +1716,7 @@ gpk_watch_init (GpkWatch *watch)
watch->priv->set_proxy_timeout = 0;
watch->priv->cached_messages = g_ptr_array_new_with_free_func ((GDestroyNotify) gpk_watch_cached_message_free);
watch->priv->restart_package_names = g_ptr_array_new_with_free_func (g_free);
- watch->priv->client = pk_client_new ();
+ watch->priv->task = PK_TASK(gpk_task_new ());
watch->priv->dialog = gpk_modal_dialog_new ();
gpk_modal_dialog_set_window_icon (watch->priv->dialog, "pk-package-installed");
g_signal_connect (watch->priv->dialog, "cancel",
@@ -1784,7 +1785,7 @@ gpk_watch_finalize (GObject *object)
g_free (watch->priv->error_details);
g_free (watch->priv->transaction_id);
g_object_unref (watch->priv->cancellable);
- g_object_unref (watch->priv->client);
+ g_object_unref (PK_CLIENT(watch->priv->task));
g_object_unref (watch->priv->console);
g_object_unref (watch->priv->control);
g_object_unref (watch->priv->dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]