[gnome-software] sources dialog: Split out callbacks for install/remove
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] sources dialog: Split out callbacks for install/remove
- Date: Sat, 27 Jan 2018 15:47:17 +0000 (UTC)
commit 3201e014deac6b4e3a21c8a2a6091a5bf74dc9ad
Author: Kalev Lember <klember redhat com>
Date: Sat Jan 27 12:14:00 2018 +0100
sources dialog: Split out callbacks for install/remove
This makes it possible to show different error messages for install and
remove.
src/gs-sources-dialog.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 52abebdf..71070ea3 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -164,9 +164,26 @@ add_source (GtkListBox *listbox, GsApp *app)
}
static void
-source_modified_cb (GObject *source,
- GAsyncResult *res,
- gpointer user_data)
+source_installed_cb (GObject *source,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
+ GsSourcesDialog *dialog = GS_SOURCES_DIALOG (user_data);
+ g_autoptr(GError) error = NULL;
+
+ if (!gs_plugin_loader_job_action_finish (plugin_loader, res, &error)) {
+ g_warning ("failed to install: %s", error->message);
+ } else {
+ reload_sources (dialog);
+ reload_nonfree_sources (dialog);
+ }
+}
+
+static void
+source_removed_cb (GObject *source,
+ GAsyncResult *res,
+ gpointer user_data)
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
GsSourcesDialog *dialog = GS_SOURCES_DIALOG (user_data);
@@ -196,7 +213,7 @@ gs_sources_dialog_rescan_proprietary_sources (GsSourcesDialog *dialog)
gs_plugin_loader_job_process_async (dialog->plugin_loader,
plugin_job,
dialog->cancellable,
- source_modified_cb,
+ source_installed_cb,
dialog);
}
} else {
@@ -208,7 +225,7 @@ gs_sources_dialog_rescan_proprietary_sources (GsSourcesDialog *dialog)
gs_plugin_loader_job_process_async (dialog->plugin_loader,
plugin_job,
dialog->cancellable,
- source_modified_cb,
+ source_removed_cb,
dialog);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]