how to make gtkiconview one column grid centred.



Hi,
I am making a gtkiconview in a left side of a hpanel. The code is pasted at the end.
i am facing two problems at the moment.

1. The text beneath icon is wrapped which i kinda fixed with
gtk_icon_view_set_item_width (GTK_ICON_VIEW (icon_view), 100); but i want a more plausible handling way such that any lenght text is shown in one line not wrapped. Actually it covers the icon are width and then afterwards it wraps.

2. This one is not catered of at the moment.
when i move the hpanel the iconview remains to the left side and the are of iconview is increased. Remember i am using one column only in gtkiconview. I want the column to be centred in the middle of the area.
gtkiconview is in a scrolledarea. i have deleted that. I want no scrolling.
How can i make gtkiconview(one column) always centred in any resized area.

GtkWidget *
create_iconview(GtkWidget *mainWnd)
{
	GtkWidget         *icon_view;
	GtkListStore 	  *store;
	GdkPixbuf     	  *icon;
	GError        	  *error = NULL;
	GtkTreeIter 	  iter;

	// Load up the tree view.
	icon_view = lookup_widget(mainWnd, "iconview1");
store = gtk_list_store_new(NUM_COLS_ICONVIEW, G_TYPE_STRING, GDK_TYPE_PIXBUF);

	icon = gdk_pixbuf_new_from_file("Welcome.png", &error);
 	if (error)
 	{
   	g_warning ("Could not load icon: %s\n", error->message);
   	g_error_free(error);
   	error = NULL;
 	}


	gtk_list_store_append (store, &iter);
	gtk_list_store_set (store, &iter,
			      COL_DISPLAY_NAME, "Welcome",
			      COL_PIXBUF, icon,
			      -1);

	gtk_list_store_append (store, &iter);
	gtk_list_store_set (store, &iter,
			      COL_DISPLAY_NAME, "BackUp",
			      COL_PIXBUF, icon,
			      -1);

	gtk_list_store_append (store, &iter);
	gtk_list_store_set (store, &iter,
			      COL_DISPLAY_NAME, "Restore",
			      COL_PIXBUF, icon,
			      -1);

	gtk_icon_view_set_model(GTK_ICON_VIEW(icon_view), GTK_TREE_MODEL (store));
	g_object_unref (store);

	 /* We now set which model columns that correspond to the text
	   * and pixbuf of each item
	   */
gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), COL_DISPLAY_NAME);
	gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF);

	gtk_icon_view_set_columns(GTK_ICON_VIEW (icon_view), 1);
	gtk_icon_view_set_item_width (GTK_ICON_VIEW (icon_view), 100);

	gtk_widget_grab_focus (icon_view);
}

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]