power: Move variant_lookup_string() helper function

This commit is contained in:
Bastien Nocera 2021-07-16 10:07:28 +02:00
parent eda473f0d6
commit 05997b424c

View file

@ -1343,6 +1343,18 @@ setup_power_saving (CcPowerPanel *self)
#endif
}
static const char *
variant_lookup_string (GVariant *dict,
const char *key)
{
GVariant *variant;
variant = g_variant_lookup_value (dict, key, G_VARIANT_TYPE_STRING);
if (!variant)
return NULL;
return g_variant_get_string (variant, NULL);
}
static void
performance_profile_set_active (CcPowerPanel *self,
const char *profile_str)
@ -1427,18 +1439,6 @@ perf_profile_list_box_sort (GtkListBoxRow *row1,
return 0;
}
static const char *
variant_lookup_string (GVariant *dict,
const char *key)
{
GVariant *variant;
variant = g_variant_lookup_value (dict, key, G_VARIANT_TYPE_STRING);
if (!variant)
return NULL;
return g_variant_get_string (variant, NULL);
}
static void
power_profiles_properties_changed_cb (CcPowerPanel *self,
GVariant *changed_properties,