Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change regard error textColumnDataFunc, buttonColumnDataFunc, applyColor for table.c #34

Open
AS400JPLPC opened this issue Aug 27, 2020 · 0 comments

Comments

@AS400JPLPC
Copy link

AS400JPLPC commented Aug 27, 2020

Hello,
I changed some function see ERROR ----> IS NOT G_TYPE_STRING or G_TYPE_BOXED
with that there are no more errors in example

static void textColumnDataFunc(GtkTreeViewColumn *c, GtkCellRenderer *r, GtkTreeModel *m, GtkTreeIter *iter, gpointer data)
{
	struct textColumnParams *p = (struct textColumnParams *) data;
	GValue value = G_VALUE_INIT;
	const gchar *str;

	gtk_tree_model_get_value(m, iter, p->modelColumn, &value);
	---->if ( G_VALUE_TYPE(&value) == G_TYPE_STRING	)
	{
		str = g_value_get_string(&value);   
		g_object_set(r, "text", str, NULL);
		g_value_unset(&value);

		setEditable(p->m, iter, p->editableColumn, r, "editable");

		if (p->params.ColorModelColumn != -1)
			applyColor(m, iter, p->params.ColorModelColumn,
				r, "foreground-rgba", "foreground-set");

		applyBackgroundColor(p->t, m, iter, r);
	}
}

static void buttonColumnDataFunc(GtkTreeViewColumn *c, GtkCellRenderer *r, GtkTreeModel *m, GtkTreeIter *iter, gpointer data)
{
	struct buttonColumnParams *p = (struct buttonColumnParams *) data;
	GValue value = G_VALUE_INIT;
	const gchar *str;

	gtk_tree_model_get_value(m, iter, p->modelColumn, &value);
	---> if ( G_VALUE_TYPE(&value) == G_TYPE_STRING	)
	{
		str = g_value_get_string(&value);
		g_object_set(r, "text", str, NULL);
		g_value_unset(&value);

		setEditable(p->m, iter, p->clickableColumn, r, "sensitive");

		applyBackgroundColor(p->t, m, iter, r);
	}
}

static void applyColor(GtkTreeModel *m, GtkTreeIter *iter, int modelColumn, GtkCellRenderer *r, const char *prop, const char *propSet)
{
	GValue value = G_VALUE_INIT;

	---> GdkRGBA *rgba = NULL ;


	
	gtk_tree_model_get_value(m, iter, modelColumn, &value);


	---> if ( G_VALUE_TYPE(&value) == G_TYPE_BOXED	) rgba = (GdkRGBA *) g_value_get_boxed(&value);

	if (rgba != NULL)
		g_object_set(r, prop, rgba, NULL);
	else
		g_object_set(r, propSet, FALSE, NULL);
	g_value_unset(&value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant