[gnome-software] trivial: Use g_autoptr for GsShellDetailsReviewHelper
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Use g_autoptr for GsShellDetailsReviewHelper
- Date: Mon, 4 Jul 2016 01:32:36 +0000 (UTC)
commit 214b2405262e914f5dbfce38bf01a212c1be1a6d
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Jul 4 13:32:18 2016 +1200
trivial: Use g_autoptr for GsShellDetailsReviewHelper
src/gs-shell-details.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 3599aa9..5b42cee 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1147,6 +1147,8 @@ gs_shell_details_review_helper_free (GsShellDetailsReviewHelper *helper)
g_free (helper);
}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GsShellDetailsReviewHelper, gs_shell_details_review_helper_free);
+
static void
gs_shell_details_app_set_review_cb (GObject *source,
GAsyncResult *res,
@@ -1179,7 +1181,7 @@ gs_shell_details_app_set_review_cb (GObject *source,
gpointer user_data)
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
- GsShellDetailsReviewHelper *helper = (GsShellDetailsReviewHelper *) user_data;
+ g_autoptr(GsShellDetailsReviewHelper) helper = (GsShellDetailsReviewHelper *) user_data;
g_autoptr(GError) error = NULL;
if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error)) {
@@ -1195,22 +1197,19 @@ gs_shell_details_app_set_review_cb (GObject *source,
&error_local);
if (dialog == NULL) {
g_warning ("%s", error_local->message);
- gs_shell_details_review_helper_free (helper);
return;
}
gs_shell_modal_dialog_present (helper->self->shell, GTK_DIALOG (dialog));
g_signal_connect (dialog, "response",
G_CALLBACK (gs_shell_details_authenticate_cb),
- helper);
+ g_steal_pointer (&helper));
return;
}
g_warning ("failed to set review on %s: %s",
gs_app_get_id (helper->app), error->message);
- gs_shell_details_review_helper_free (helper);
return;
}
gs_shell_details_refresh_reviews (helper->self);
- gs_shell_details_review_helper_free (helper);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]