How to process on selected icon in IconView

I am learning gtk+ version 2.12. Currently I am trying to implement icon
view, showing thumbnails with text labels. The code I used is as follows:

const char* list[] =
        "2" ,
		filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
		GSList *filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER
  		GtkListStore *store;
		GtkTreeIter iter;

		// Create a new tree model with 2 columns
		store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
		for (i=0; i<g_slist_length(filenames); i++)
			gchar* namePtr = (gchar*) g_slist_nth_data(filenames, i);
			GdkPixbuf *pbuf = gdk_pixbuf_new_from_file_at_scale (namePtr, 96, 64,
true, NULL);
  			gtk_list_store_append (store, &iter);
  			gtk_list_store_set (store, &iter, 0, pbuf, 1, list[i], -1);
			g_object_unref (pbuf);

		gtk_icon_view_set_model(GTK_ICON_VIEW(IconViewTray), GTK_TREE_MODEL
		gtk_icon_view_set_columns (GTK_ICON_VIEW(IconViewTray), -1);
		gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW(IconViewTray), 0);
		gtk_icon_view_set_text_column (GTK_ICON_VIEW(IconViewTray), 1);
		g_object_unref (store);

Now I would like to do something, on double-click of a some icon in the icon
view. I realize, that it should be implemented by the on_item_activated

But how can I get the item, which is associated with the clicked thumbnail,
its index in the GtkListStore, and its content (i.e., GdkPixbuf  and text
label). Could anybody give me a sample of the callback function,
on_item_activated,  doing this?

Thank you in advance.
View this message in context:
Sent from the Gtk+ - Dev - General mailing list archive at

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