[gnome-photos] base-model: Use g_auto*
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-model: Use g_auto*
- Date: Tue, 24 Oct 2017 18:01:44 +0000 (UTC)
commit 239b960db4a997b9457b2174a38fefe351dc9ce6
Author: Ekta Nandwani <mailnandwaniekta gmail com>
Date: Sat Oct 14 18:27:09 2017 +0530
base-model: Use g_auto*
https://bugzilla.gnome.org/show_bug.cgi?id=788174
src/photos-base-model.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/src/photos-base-model.c b/src/photos-base-model.c
index 965ac5e..cfcd76b 100644
--- a/src/photos-base-model.c
+++ b/src/photos-base-model.c
@@ -78,7 +78,7 @@ photos_base_model_active_changed (PhotosBaseModel *self, GObject *active_object)
static void
photos_base_model_refresh (PhotosBaseModel *self)
{
- GMenu *section;
+ g_autoptr (GMenu) section = NULL;
const gchar *action_id;
const gchar *title;
guint i;
@@ -95,11 +95,11 @@ photos_base_model_refresh (PhotosBaseModel *self)
n_items = g_list_model_get_n_items (G_LIST_MODEL (self->mngr));
for (i = 0; i < n_items; i++)
{
- GMenuItem *menu_item;
- GObject *object;
+ g_autoptr (GMenuItem) menu_item = NULL;
+ g_autoptr (GObject) object = NULL;
GVariant *target_value;
const gchar *id;
- gchar *name;
+ g_autofree gchar *name = NULL;
object = g_list_model_get_object (G_LIST_MODEL (self->mngr), i);
id = photos_filterable_get_id (PHOTOS_FILTERABLE (object));
@@ -109,13 +109,7 @@ photos_base_model_refresh (PhotosBaseModel *self)
target_value = g_variant_new ("s", id);
g_menu_item_set_action_and_target_value (menu_item, action_id, target_value);
g_menu_append_item (section, menu_item);
-
- g_free (name);
- g_object_unref (menu_item);
- g_object_unref (object);
}
-
- g_object_unref (section);
}
@@ -125,7 +119,7 @@ photos_base_model_constructed (GObject *object)
PhotosBaseModel *self = PHOTOS_BASE_MODEL (object);
GApplication *app;
const gchar *action_id;
- gchar *detailed_signal;
+ g_autofree gchar *detailed_signal = NULL;
G_OBJECT_CLASS (photos_base_model_parent_class)->constructed (object);
@@ -150,7 +144,6 @@ photos_base_model_constructed (GObject *object)
G_CALLBACK (photos_base_model_action_state_changed),
self,
G_CONNECT_SWAPPED);
- g_free (detailed_signal);
g_signal_connect_object (self->mngr,
"active-changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]