[gnome-control-center] main: Use g_autoptr to simplify code
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] main: Use g_autoptr to simplify code
- Date: Sun, 21 Jan 2018 12:38:24 +0000 (UTC)
commit 4a34b693ded2215e7767b119ee27760344fd6479
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jan 21 10:37:29 2018 -0200
main: Use g_autoptr to simplify code
With g_autoptr, we don't need to manually unref the
GtkApplication before returning its status. This
saves a few lines of code.
shell/main.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/shell/main.c b/shell/main.c
index 957dd1f..d323582 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -38,8 +38,7 @@
int
main (int argc, char **argv)
{
- GtkApplication *application;
- int status;
+ g_autoptr(GtkApplication) application = NULL;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -54,9 +53,6 @@ main (int argc, char **argv)
#endif /* HAVE_CHEESE */
application = cc_application_new ();
- status = g_application_run (G_APPLICATION (application), argc, argv);
- g_object_unref (application);
-
- return status;
+ return g_application_run (G_APPLICATION (application), argc, argv);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]