From 1c989ea4e5ea375167a7646aaf4e6dbc1cf19446 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 10 Jan 2021 20:32:55 +0100 Subject: matemenu-tree: do not call g_settings_get_string unless necessary --- libmenu/matemenu-tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmenu/matemenu-tree.c b/libmenu/matemenu-tree.c index 87470b8..eb94ed3 100644 --- a/libmenu/matemenu-tree.c +++ b/libmenu/matemenu-tree.c @@ -656,20 +656,20 @@ load_object (char *id, ObjectType object_type; char *object_path; GSettings *settings; - char *location; object_path = g_strdup_printf ("/org/mate/panel/objects/%s/", id); settings = g_settings_new_with_path ("org.mate.panel.object", object_path); object_type = g_settings_get_enum (settings, "object-type"); - location = g_settings_get_string (settings, "launcher-location"); if (object_type == OBJECT_LAUNCHER) { + char *location; char *desktop_name; if (self->collection_applet == NULL) self->collection_applet = g_ptr_array_new (); + location = g_settings_get_string (settings, "launcher-location"); desktop_name = g_path_get_basename (location); if (strstr (desktop_name, "-1.") != NULL ) { @@ -681,8 +681,8 @@ load_object (char *id, g_strfreev (str); } g_ptr_array_add (self->collection_applet, desktop_name); + g_free (location); } - g_free (location); g_free (object_path); g_object_unref (settings); } -- cgit v1.2.1