#include <gtk/gtk.h>

static void
append_item (GtkListStore *model,
			 const char   *name,
			 const char   *desc)
{
	char *text;
	GtkTreeIter iter;

	gtk_list_store_append (model, &iter);

	text = g_markup_printf_escaped ("<span size=\"larger\" weight=\"bold\">%s</span>\n%s",
					  name, desc);

	gtk_list_store_set (model, &iter, 0, text, -1);
	g_free (text);
}

static GtkTreeModel *
make_model (void)
{
	GtkListStore *model;

	model = gtk_list_store_new (1, G_TYPE_STRING);

	append_item (model, "Text", "Description");
	append_item (model, "Textlongggggg", "Description");
	append_item (model, "مصنع بريمج الساعة", "م_ساعدة");

	return (GtkTreeModel *) model;
}

int main (int argc, char *argv [])
{
	GtkWidget *window;
	GtkWidget *tree_view;
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *column;
	GtkTreeModel *model;

	gtk_init (&argc, &argv);

	gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_signal_connect (window, "destroy",
			  G_CALLBACK (gtk_main_quit), NULL);

	tree_view = gtk_tree_view_new ();

	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view),
						     -1, NULL,
						     renderer,
						     "markup", 0,
						     NULL);

	column = gtk_tree_view_get_column (GTK_TREE_VIEW (tree_view),
					   0);
	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);

	gtk_container_add (GTK_CONTAINER (window), tree_view);

	model = make_model ();
	gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view),
				 model);

	gtk_window_set_default_size (GTK_WINDOW (window),
				     600, 500);

	gtk_widget_show_all (window);

	gtk_main ();

	return 0;
}
