[libpanel/gbsneto/no-autofree: 11/12] example: Drop g_auto* usage
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpanel/gbsneto/no-autofree: 11/12] example: Drop g_auto* usage
- Date: Mon, 5 Sep 2022 19:56:52 +0000 (UTC)
commit 3ebd8f69d0b586be73019f5b4ae3ad5bcf0d2968
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Sep 5 16:52:03 2022 -0300
example: Drop g_auto* usage
example/example-window.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/example/example-window.c b/example/example-window.c
index fadea48..8caffaf 100644
--- a/example/example-window.c
+++ b/example/example-window.c
@@ -173,7 +173,7 @@ set_high_contrast_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
- g_autoptr(GVariant) v = g_action_get_state (G_ACTION (action));
+ GVariant *v = g_action_get_state (G_ACTION (action));
if (!v ||
!g_variant_is_of_type (v, G_VARIANT_TYPE_BOOLEAN) ||
@@ -181,6 +181,8 @@ set_high_contrast_action (GSimpleAction *action,
g_simple_action_set_state (action, g_variant_new_boolean (TRUE));
else
g_simple_action_set_state (action, g_variant_new_boolean (FALSE));
+
+ g_clear_pointer (&v, g_variant_unref);
}
static void
@@ -188,7 +190,7 @@ set_rtl_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
- g_autoptr(GVariant) v = g_action_get_state (G_ACTION (action));
+ GVariant *v = g_action_get_state (G_ACTION (action));
if (!v ||
!g_variant_is_of_type (v, G_VARIANT_TYPE_BOOLEAN) ||
@@ -196,6 +198,8 @@ set_rtl_action (GSimpleAction *action,
g_simple_action_set_state (action, g_variant_new_boolean (TRUE));
else
g_simple_action_set_state (action, g_variant_new_boolean (FALSE));
+
+ g_clear_pointer (&v, g_variant_unref);
}
static void
@@ -353,9 +357,9 @@ example_window_init (ExampleWindow *self)
{ "high-contrast", set_high_contrast_action, NULL, "false" },
{ "right-to-left", set_rtl_action, NULL, "false" },
};
- g_autoptr(GPropertyAction) reveal_start = NULL;
- g_autoptr(GPropertyAction) reveal_end = NULL;
- g_autoptr(GPropertyAction) reveal_bottom = NULL;
+ GPropertyAction *reveal_start = NULL;
+ GPropertyAction *reveal_end = NULL;
+ GPropertyAction *reveal_bottom = NULL;
AdwStyleManager *style_manager = adw_style_manager_get_default ();
GtkPopover *popover;
@@ -390,4 +394,8 @@ example_window_init (ExampleWindow *self)
gtk_popover_menu_add_child (GTK_POPOVER_MENU (popover),
GTK_WIDGET (self->theme_selector),
"theme");
+
+ g_clear_object (&reveal_start);
+ g_clear_object (&reveal_end);
+ g_clear_object (&reveal_bottom);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]