Which widget should I use…

  1. …for lists and trees?

    This question has different answers, depending on the size of the dataset and the required formatting flexibility.

    If you want to display a large amount of data in a uniform way, your best option is a GtkTreeView widget. See the tree widget overview. A list is just a tree with no branches, so the treeview widget is used for lists as well.

    If you want to display a small amount of items, but need flexible formatting and widgetry inside the list, then you probably want to use a GtkListBox, which uses regular widgets for display.

  2. …for multi-line text display or editing?

    See the text widget overview – you should use the GtkTextView widget.

    If you only have a small amount of text, GtkLabel may also be appropriate of course. It can be made selectable with gtk_label_set_selectable(). For a single-line text entry, see GtkEntry.

  3. …to display an image or animation?

    GTK has two widgets that are dedicated to displaying images. GtkImage, for small, fixed-size icons and GtkPicture for content images.

    Both can display images in just about any format GTK understands. You can also use GtkDrawingArea if you need to do something more complex, such as draw text or graphics over the top of the image.

    Both GtkImage and GtkPicture can display animations and videos as well. To show an webm file, load it with the GtkMediaFile API and then use it as a paintable:

    mediafile = gtk_media_file_new_for_filename ("example.webm");
    picture = gtk_picture_new_for_paintable (GDK_PAINTABLE (mediafile));
  4. …for presenting a set of mutually-exclusive choices, where Windows would use a combo box?

    With GTK, a GtkComboBox is the recommended widget to use for this use case. If you need an editable text entry, use the “has-entry” property.