simplify some more code and don't leak memory
parent
0b334ce4e8
commit
78f18ad533
|
@ -736,7 +736,8 @@ terminal_app_profile_list_notify_cb (GSettings *settings,
|
||||||
TerminalApp *app = TERMINAL_APP (user_data);
|
TerminalApp *app = TERMINAL_APP (user_data);
|
||||||
GObject *object = G_OBJECT (app);
|
GObject *object = G_OBJECT (app);
|
||||||
GVariant *val;
|
GVariant *val;
|
||||||
GSList *value_list, *sl;
|
const gchar **value_list;
|
||||||
|
int i;
|
||||||
GList *profiles_to_delete, *l;
|
GList *profiles_to_delete, *l;
|
||||||
gboolean need_new_default;
|
gboolean need_new_default;
|
||||||
TerminalProfile *fallback;
|
TerminalProfile *fallback;
|
||||||
|
@ -752,12 +753,14 @@ terminal_app_profile_list_notify_cb (GSettings *settings,
|
||||||
!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING)))
|
!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING)))
|
||||||
goto ensure_one_profile;
|
goto ensure_one_profile;
|
||||||
|
|
||||||
value_list = mate_gsettings_strv_to_gslist( g_variant_get_strv (val, NULL));
|
value_list = g_variant_get_strv (val, NULL);
|
||||||
|
if (value_list == NULL)
|
||||||
|
goto ensure_one_profile;
|
||||||
|
|
||||||
/* Add any new ones */
|
/* Add any new ones */
|
||||||
for (sl = value_list; sl != NULL; sl = sl->next)
|
for (i = 0; value_list[i] != NULL; ++i)
|
||||||
{
|
{
|
||||||
const char *profile_name = sl->data;
|
const char *profile_name = value_list[i];
|
||||||
GList *link;
|
GList *link;
|
||||||
|
|
||||||
if (!profile_name)
|
if (!profile_name)
|
||||||
|
@ -771,8 +774,13 @@ terminal_app_profile_list_notify_cb (GSettings *settings,
|
||||||
terminal_app_create_profile (app, profile_name);
|
terminal_app_create_profile (app, profile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (value_list);
|
||||||
|
|
||||||
ensure_one_profile:
|
ensure_one_profile:
|
||||||
|
|
||||||
|
if (val != NULL)
|
||||||
|
g_variant_unref (val);
|
||||||
|
|
||||||
fallback = NULL;
|
fallback = NULL;
|
||||||
count = g_hash_table_size (app->profiles);
|
count = g_hash_table_size (app->profiles);
|
||||||
if (count == 0 || count <= g_list_length (profiles_to_delete))
|
if (count == 0 || count <= g_list_length (profiles_to_delete))
|
||||||
|
|
Loading…
Reference in New Issue