aboutsummaryrefslogtreecommitdiff
path: root/src/idolocationmenuitem.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-12-04 14:26:11 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-12-04 14:26:11 +0100
commit1545345255210e8fbf781c2bbebcdd49fa5a87cd (patch)
tree0af826edcc3fa90ae163e4b1f089775f9586922e /src/idolocationmenuitem.c
parent0ab4079b28220f4051f8d0935a976e550514ad7f (diff)
downloadayatana-ido-1545345255210e8fbf781c2bbebcdd49fa5a87cd.tar.gz
ayatana-ido-1545345255210e8fbf781c2bbebcdd49fa5a87cd.tar.bz2
ayatana-ido-1545345255210e8fbf781c2bbebcdd49fa5a87cd.zip
Port from Glib's g_object_newv to g_object_new_with_properties.
Diffstat (limited to 'src/idolocationmenuitem.c')
-rw-r--r--src/idolocationmenuitem.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/idolocationmenuitem.c b/src/idolocationmenuitem.c
index eb6b38b..4361e50 100644
--- a/src/idolocationmenuitem.c
+++ b/src/idolocationmenuitem.c
@@ -296,41 +296,45 @@ ido_location_menu_item_new_from_model (GMenuItem * menu_item,
guint n;
gchar * str;
IdoLocationMenuItem * ido_location;
- GParameter parameters[4];
+ const gchar * names[3];
+ GValue * values;
+ const guint n_max = 3;
/* create the ido_location */
n = 0;
+ values = g_new0(GValue, n_max);
if (g_menu_item_get_attribute (menu_item, "label", "s", &str))
{
- GParameter p = { "text", G_VALUE_INIT };
- g_value_init (&p.value, G_TYPE_STRING);
- g_value_take_string (&p.value, str);
- parameters[n++] = p;
+ names[n] = "text";
+ g_value_init (&values[n], G_TYPE_STRING);
+ g_value_take_string (&values[n], str);
+ n++;
}
if (g_menu_item_get_attribute (menu_item, "x-canonical-timezone", "s", &str))
{
- GParameter p = { "timezone", G_VALUE_INIT };
- g_value_init (&p.value, G_TYPE_STRING);
- g_value_take_string (&p.value, str);
- parameters[n++] = p;
+ names[n] = "timezone";
+ g_value_init (&values[n], G_TYPE_STRING);
+ g_value_take_string (&values[n], str);
+ n++;
}
if (g_menu_item_get_attribute (menu_item, "x-canonical-time-format", "s", &str))
{
- GParameter p = { "format", G_VALUE_INIT };
- g_value_init (&p.value, G_TYPE_STRING);
- g_value_take_string (&p.value, str);
- parameters[n++] = p;
+ names[n] = "format";
+ g_value_init (&values[n], G_TYPE_STRING);
+ g_value_take_string (&values[n], str);
+ n++;
}
- g_assert (n <= G_N_ELEMENTS (parameters));
- ido_location = g_object_newv (IDO_LOCATION_MENU_ITEM_TYPE, n, parameters);
+ g_assert (n <= G_N_ELEMENTS (names));
+ g_assert (n <= n_max);
+ ido_location = IDO_LOCATION_MENU_ITEM(g_object_new_with_properties (IDO_LOCATION_MENU_ITEM_TYPE, n, names, values));
for (i=0; i<n; i++)
- g_value_unset (&parameters[i].value);
+ g_value_unset (&values[i]);
/* give it an ActionHelper */