summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-01-10 20:32:55 +0100
committerraveit65 <[email protected]>2021-01-26 21:17:10 +0100
commit1c989ea4e5ea375167a7646aaf4e6dbc1cf19446 (patch)
tree7b055036b6163cd63c27d8dcab3bbd372fe07c27
parent8e3ecee06adc8e02e3daeb036f13da506c0c2d6a (diff)
downloadmate-menus-1c989ea4e5ea375167a7646aaf4e6dbc1cf19446.tar.bz2
mate-menus-1c989ea4e5ea375167a7646aaf4e6dbc1cf19446.tar.xz
matemenu-tree: do not call g_settings_get_string unless necessary
-rw-r--r--libmenu/matemenu-tree.c6
1 files 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);
}