Commit 0853ce30 authored by Javier Jardón's avatar Javier Jardón

Use G_VALUE_INIT

Instead of an explicit { 0, } when declaring the variable.
parent 616afadd
......@@ -711,7 +711,7 @@ selection_cb (GtkTreeSelection *selection,
GtkTreeModel *model)
{
GtkTreeIter iter;
GValue value = {0, };
GValue value = G_VALUE_INIT;
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
return;
......
......@@ -1117,7 +1117,7 @@ gdk_x11_screen_get_setting (GdkScreen *screen,
GdkX11Screen *x11_screen;
gboolean success = FALSE;
gint i;
GValue tmp_val = { 0, };
GValue tmp_val = G_VALUE_INIT;
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
......
......@@ -117,7 +117,7 @@ gtk_combo_box_accessible_get_name (AtkObject *obj)
n_columns = gtk_tree_model_get_n_columns (model);
for (i = 0; i < n_columns; i++)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gtk_tree_model_get_value (model, &iter, i, &value);
if (G_VALUE_HOLDS_STRING (&value))
......
......@@ -2442,7 +2442,7 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
if (spec != NULL)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, spec->value_type);
g_object_get_property (cur_renderer->data, *prop_list, &value);
......
......@@ -479,7 +479,7 @@ binding_compose_params (GObject *object,
valid = TRUE;
for (i = 1; i < query->n_params + 1 && valid; i++)
{
GValue tmp_value = { 0, };
GValue tmp_value = G_VALUE_INIT;
g_value_init (params, *types);
......@@ -602,7 +602,7 @@ gtk_binding_entry_activate (GtkBindingEntry *entry,
GSignalQuery query;
guint signal_id;
GValue *params = NULL;
GValue return_val = { 0, };
GValue return_val = G_VALUE_INIT;
gchar *accelerator = NULL;
signal_id = g_signal_lookup (sig->signal_name, G_OBJECT_TYPE (object));
......
......@@ -1250,7 +1250,7 @@ apply_cell_attributes (GtkCellRenderer *renderer,
{
CellAttribute *attribute;
GSList *list;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gboolean is_expander;
gboolean is_expanded;
......@@ -2602,7 +2602,7 @@ area_set_cell_property (GtkCellArea *area,
GParamSpec *pspec,
const GValue *value)
{
GValue tmp_value = { 0, };
GValue tmp_value = G_VALUE_INIT;
GtkCellAreaClass *class = g_type_class_peek (pspec->owner_type);
/* provide a copy to work from, convert (if necessary) and validate */
......@@ -2656,7 +2656,7 @@ gtk_cell_area_cell_set_valist (GtkCellArea *area,
name = first_property_name;
while (name)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gchar *error = NULL;
GParamSpec *pspec =
g_param_spec_pool_lookup (cell_property_pool, name,
......@@ -2718,7 +2718,7 @@ gtk_cell_area_cell_get_valist (GtkCellArea *area,
name = first_property_name;
while (name)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
GParamSpec *pspec;
gchar *error;
......@@ -2824,7 +2824,7 @@ gtk_cell_area_cell_get_property (GtkCellArea *area,
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area));
else
{
GValue *prop_value, tmp_value = { 0, };
GValue *prop_value, tmp_value = G_VALUE_INIT;
/* auto-conversion of the callers value type
*/
......
......@@ -711,7 +711,7 @@ gtk_cell_layout_buildable_set_cell_property (GtkCellArea *area,
const gchar *value)
{
GParamSpec *pspec;
GValue gvalue = { 0, };
GValue gvalue = G_VALUE_INIT;
GError *error = NULL;
pspec = gtk_cell_area_class_find_cell_property (GTK_CELL_AREA_GET_CLASS (area), name);
......
......@@ -987,7 +987,7 @@ gtk_cell_view_new_with_text (const gchar *text)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
GValue value = G_VALUE_INIT;
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
......@@ -1021,7 +1021,7 @@ gtk_cell_view_new_with_markup (const gchar *markup)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
GValue value = G_VALUE_INIT;
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
......@@ -1053,7 +1053,7 @@ gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
GValue value = G_VALUE_INIT;
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
......
......@@ -553,7 +553,7 @@ gtk_container_buildable_set_child_property (GtkContainer *container,
const gchar *value)
{
GParamSpec *pspec;
GValue gvalue = { 0, };
GValue gvalue = G_VALUE_INIT;
GError *error = NULL;
pspec = gtk_container_class_find_child_property
......@@ -847,7 +847,7 @@ container_set_child_property (GtkContainer *container,
const GValue *value,
GObjectNotifyQueue *nqueue)
{
GValue tmp_value = { 0, };
GValue tmp_value = G_VALUE_INIT;
GtkContainerClass *class = g_type_class_peek (pspec->owner_type);
/* provide a copy to work from, convert (if necessary) and validate */
......@@ -903,7 +903,7 @@ gtk_container_child_get_valist (GtkContainer *container,
name = first_property_name;
while (name)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
GParamSpec *pspec;
gchar *error;
......@@ -983,7 +983,7 @@ gtk_container_child_get_property (GtkContainer *container,
G_OBJECT_TYPE_NAME (container));
else
{
GValue *prop_value, tmp_value = { 0, };
GValue *prop_value, tmp_value = G_VALUE_INIT;
/* auto-conversion of the callers value type
*/
......@@ -1047,7 +1047,7 @@ gtk_container_child_set_valist (GtkContainer *container,
name = first_property_name;
while (name)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gchar *error = NULL;
GParamSpec *pspec = g_param_spec_pool_lookup (_gtk_widget_child_property_pool,
name,
......
......@@ -1285,7 +1285,7 @@ attribute_from_text (GtkBuilder *builder,
PangoLanguage *language;
PangoFontDescription *font_desc;
GdkColor *color;
GValue val = { 0, };
GValue val = G_VALUE_INIT;
if (!gtk_builder_value_from_string_type (builder, PANGO_TYPE_ATTR_TYPE, name, &val, error))
return NULL;
......@@ -1441,7 +1441,7 @@ pango_start_element (GMarkupParseContext *context,
GError **error)
{
PangoParserData *data = (PangoParserData*)user_data;
GValue val = { 0, };
GValue val = G_VALUE_INIT;
guint i;
gint line_number, char_number;
......
......@@ -838,7 +838,7 @@ gtk_list_store_real_set_value (GtkListStore *list_store,
GtkTreeDataList *list;
GtkTreeDataList *prev;
gint old_column = column;
GValue real_value = {0, };
GValue real_value = G_VALUE_INIT;
gboolean converted = FALSE;
gboolean retval = FALSE;
......@@ -1036,7 +1036,7 @@ gtk_list_store_set_valist_internal (GtkListStore *list_store,
while (column != -1)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gchar *error = NULL;
if (column < 0 || column >= priv->n_columns)
......
......@@ -510,7 +510,7 @@ display_opened_cb (GdkDisplayManager *display_manager,
for (i = 0; i < gdk_display_get_n_screens (display); i++)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
......
......@@ -1637,7 +1637,7 @@ marks_start_element (GMarkupParseContext *context,
msg_context = values[i];
else if (strcmp (names[i], "value") == 0)
{
GValue gvalue = { 0, };
GValue gvalue = G_VALUE_INIT;
if (!gtk_builder_value_from_string_type (parser_data->builder, G_TYPE_DOUBLE, values[i], &gvalue, error))
return;
......@@ -1647,7 +1647,7 @@ marks_start_element (GMarkupParseContext *context,
}
else if (strcmp (names[i], "position") == 0)
{
GValue gvalue = { 0, };
GValue gvalue = G_VALUE_INIT;
if (!gtk_builder_value_from_string_type (parser_data->builder, GTK_TYPE_POSITION_TYPE, values[i], &gvalue, error))
return;
......
......@@ -873,7 +873,7 @@ gtk_scale_button_screen_changed (GtkWidget *widget,
GtkScaleButton *button = (GtkScaleButton *) widget;
GtkScaleButtonPrivate *priv;
GdkScreen *screen;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
if (gtk_widget_has_screen (widget) == FALSE)
return;
......
......@@ -1583,7 +1583,7 @@ gtk_settings_get_property (GObject *object,
}
else
{
GValue val = { 0, };
GValue val = G_VALUE_INIT;
/* Try to get xsetting as a string and parse it. */
......@@ -1596,8 +1596,8 @@ gtk_settings_get_property (GObject *object,
}
else
{
GValue tmp_value = { 0, };
GValue gstring_value = { 0, };
GValue tmp_value = G_VALUE_INIT;
GValue gstring_value = G_VALUE_INIT;
GtkRcPropertyParser parser = (GtkRcPropertyParser) g_param_spec_get_qdata (pspec, quark_property_parser);
g_value_init (&gstring_value, G_TYPE_GSTRING);
......@@ -1759,7 +1759,7 @@ apply_queued_setting (GtkSettings *settings,
GtkSettingsValuePrivate *qvalue)
{
GtkSettingsPrivate *priv = settings->priv;
GValue tmp_value = { 0, };
GValue tmp_value = G_VALUE_INIT;
GtkRcPropertyParser parser = (GtkRcPropertyParser) g_param_spec_get_qdata (pspec, quark_property_parser);
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
......@@ -2411,7 +2411,7 @@ _gtk_settings_handle_event (GdkEventSetting *event)
if (property_id == PROP_COLOR_SCHEME)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
if (!gdk_screen_get_setting (screen, pspec->name, &value))
......@@ -2699,7 +2699,7 @@ settings_update_color_scheme (GtkSettings *settings)
{
GtkSettingsPrivate *priv = settings->priv;
ColorSchemeData *data;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
data = g_slice_new0 (ColorSchemeData);
data->color_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
......
......@@ -584,7 +584,7 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
{
const GtkStyleProperty *node;
gchar *error = NULL;
GValue val = { 0 };
GValue val = G_VALUE_INIT;
node = _gtk_style_property_lookup (property_name);
......@@ -756,7 +756,7 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
}
else if (_gtk_style_property_is_shorthand (node))
{
GValue packed = { 0 };
GValue packed = G_VALUE_INIT;
g_value_init (&packed, node->pspec->value_type);
_gtk_style_property_pack (node, props, state, &packed);
......@@ -765,7 +765,7 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
}
else
{
GValue default_value = { 0 };
GValue default_value = G_VALUE_INIT;
g_value_init (&default_value, node->pspec->value_type);
_gtk_style_property_default_value (node, props, state, &default_value);
......
......@@ -1201,7 +1201,7 @@ border_image_value_parse (GtkCssParser *parser,
GFile *base,
GValue *value)
{
GValue temp = { 0, };
GValue temp = G_VALUE_INIT;
cairo_pattern_t *pattern = NULL;
GtkGradient *gradient = NULL;
GtkBorder slice, *width = NULL, *parsed_slice;
......
......@@ -54,7 +54,7 @@ serialize_value (GValue *value)
{
if (g_value_type_transformable (value->g_type, G_TYPE_STRING))
{
GValue text_value = { 0 };
GValue text_value = G_VALUE_INIT;
gchar *tmp;
g_value_init (&text_value, G_TYPE_STRING);
......@@ -85,7 +85,7 @@ deserialize_value (const gchar *str,
{
if (g_value_type_transformable (G_TYPE_STRING, value->g_type))
{
GValue text_value = { 0 };
GValue text_value = G_VALUE_INIT;
gboolean retval;
g_value_init (&text_value, G_TYPE_STRING);
......@@ -313,7 +313,7 @@ serialize_tag (gpointer key,
for (i = 0; i < n_pspecs; i++)
{
GValue value = { 0 };
GValue value = G_VALUE_INIT;
gchar *tmp, *tmp2;
if (!(pspecs[i]->flags & G_PARAM_READABLE) ||
......@@ -1164,7 +1164,7 @@ parse_attr_element (GMarkupParseContext *context,
{
const gchar *name, *type, *value;
GType gtype;
GValue gvalue = { 0 };
GValue gvalue = G_VALUE_INIT;
GParamSpec *pspec;
g_assert (peek_state (info) == STATE_TAG);
......
......@@ -326,8 +326,8 @@ _gtk_tree_data_list_compare_func (GtkTreeModel *model,
{
gint column = GPOINTER_TO_INT (user_data);
GType type = gtk_tree_model_get_column_type (model, column);
GValue a_value = {0, };
GValue b_value = {0, };
GValue a_value = G_VALUE_INIT;
GValue b_value = G_VALUE_INIT;
gint retval;
const gchar *stra, *strb;
......
......@@ -1754,7 +1754,7 @@ gtk_tree_model_get_valist (GtkTreeModel *tree_model,
while (column != -1)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gchar *error = NULL;
if (column >= gtk_tree_model_get_n_columns (tree_model))
......
......@@ -1264,7 +1264,7 @@ gtk_tree_model_filter_real_visible (GtkTreeModelFilter *filter,
}
else if (filter->priv->visible_column >= 0)
{
GValue val = {0, };
GValue val = G_VALUE_INIT;
gtk_tree_model_get_value (child_model, child_iter,
filter->priv->visible_column, &val);
......
......@@ -849,7 +849,7 @@ gtk_tree_store_real_set_value (GtkTreeStore *tree_store,
GtkTreeDataList *list;
GtkTreeDataList *prev;
gint old_column = column;
GValue real_value = { 0, };
GValue real_value = G_VALUE_INIT;
gboolean converted = FALSE;
gboolean retval = FALSE;
......@@ -1040,7 +1040,7 @@ gtk_tree_store_set_valist_internal (GtkTreeStore *tree_store,
while (column != -1)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gchar *error = NULL;
if (column < 0 || column >= priv->n_columns)
......
......@@ -15300,8 +15300,8 @@ gtk_tree_view_search_equal_func (GtkTreeModel *model,
gchar *normalized_key;
gchar *case_normalized_string = NULL;
gchar *case_normalized_key = NULL;
GValue value = {0,};
GValue transformed = {0,};
GValue value = G_VALUE_INIT;
GValue transformed = G_VALUE_INIT;
gtk_tree_model_get_value (model, iter, column, &value);
......@@ -16329,8 +16329,8 @@ gtk_tree_view_set_tooltip_query_cb (GtkWidget *widget,
GtkTooltip *tooltip,
gpointer data)
{
GValue value = { 0, };
GValue transformed = { 0, };
GValue value = G_VALUE_INIT;
GValue transformed = G_VALUE_INIT;
GtkTreeIter iter;
GtkTreePath *path;
GtkTreeModel *model;
......
......@@ -1721,7 +1721,7 @@ test_window (void)
static void
test_value_from_string (void)
{
GValue value = { 0 };
GValue value = G_VALUE_INIT;
GError *error = NULL;
GtkBuilder *builder;
......
......@@ -27,7 +27,7 @@ check_property (const char *output,
GParamSpec *pspec,
GValue *value)
{
GValue default_value = { 0, };
GValue default_value = G_VALUE_INIT;
char *v, *dv, *msg;
if (g_param_value_defaults (pspec, value))
......@@ -103,7 +103,7 @@ test_type (gconstpointer data)
for (i = 0; i < n_pspecs; ++i)
{
GParamSpec *pspec = pspecs[i];
GValue value = { 0, };
GValue value = G_VALUE_INIT;
if (pspec->owner_type != type)
continue;
......@@ -298,7 +298,7 @@ test_type (gconstpointer data)
for (i = 0; i < n_pspecs; ++i)
{
GParamSpec *pspec = pspecs[i];
GValue value = { 0, };
GValue value = G_VALUE_INIT;
if (pspec->owner_type != type)
continue;
......
......@@ -212,7 +212,7 @@ object_test_property (GObject *object,
if (pspec->flags & G_PARAM_WRITABLE &&
!(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
guint i;
const IgnoreProperty *ignore_properties;
/* select value to set */
......
......@@ -426,8 +426,8 @@ dump_atk_value (AtkValue *atk_value,
guint depth,
GString *string)
{
GValue value = { 0, };
GValue svalue = { 0, };
GValue value = G_VALUE_INIT;
GValue svalue = G_VALUE_INIT;
g_string_append_printf (string, "%*s<AtkValue>\n", depth, "");
......
......@@ -184,7 +184,7 @@ static void
int_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_INT);
......@@ -221,7 +221,7 @@ static void
uint_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_UINT);
get_property_value (object, pspec, &val);
......@@ -257,7 +257,7 @@ static void
float_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_FLOAT);
get_property_value (object, pspec, &val);
......@@ -293,7 +293,7 @@ static void
double_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_DOUBLE);
get_property_value (object, pspec, &val);
......@@ -332,7 +332,7 @@ static void
string_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkEntry *entry = GTK_ENTRY (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
const gchar *str;
const gchar *text;
......@@ -377,7 +377,7 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkToggleButton *tb = GTK_TOGGLE_BUTTON (data);
GtkWidget *child;
GValue val = { 0, };
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_BOOLEAN);
get_property_value (object, pspec, &val);
......@@ -425,7 +425,7 @@ static void
enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkComboBox *cb = GTK_COMBO_BOX (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
GEnumClass *eclass;
gint i;
......@@ -499,7 +499,7 @@ static void
flags_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GList *children, *c;
GValue val = { 0, };
GValue val = G_VALUE_INIT;
GFlagsClass *fclass;
guint flags;
gint i;
......@@ -559,7 +559,7 @@ unichar_changed (GObject *object, GParamSpec *pspec, gpointer data)
GtkEntry *entry = GTK_ENTRY (data);
gunichar new_val;
gunichar old_val = unichar_get_value (entry);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
gchar buf[7];
gint len;
......@@ -684,7 +684,7 @@ static void
color_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkColorButton *cb = GTK_COLOR_BUTTON (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
GdkRGBA *color;
GdkRGBA cb_color;
......@@ -730,7 +730,7 @@ static void
font_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkFontChooser *fb = GTK_FONT_CHOOSER (data);
GValue val = { 0, };
GValue val = G_VALUE_INIT;
const PangoFontDescription *font_desc;
PangoFontDescription *fb_font_desc;
......
......@@ -6077,7 +6077,7 @@ void
toggle_resize (GtkWidget *widget, GtkWidget *child)
{
GtkContainer *container = GTK_CONTAINER (gtk_widget_get_parent (child));
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_BOOLEAN);
gtk_container_child_get_property (container, child, "resize", &value);
g_value_set_boolean (&value, !g_value_get_boolean (&value));
......@@ -6088,7 +6088,7 @@ void
toggle_shrink (GtkWidget *widget, GtkWidget *child)
{
GtkContainer *container = GTK_CONTAINER (gtk_widget_get_parent (child));
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_BOOLEAN);
gtk_container_child_get_property (container, child, "shrink", &value);
g_value_set_boolean (&value, !g_value_get_boolean (&value));
......
......@@ -364,7 +364,7 @@ iter_compare_func (GtkTreeModel *model,
GtkTreeIter *b,
gpointer user_data)
{
GValue a_value = { 0, }, b_value = { 0, };
GValue a_value = G_VALUE_INIT, b_value = G_VALUE_INIT;
GtkAction *a_action, *b_action;
const gchar *a_name, *b_name;
gint retval = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment