Skip to content

Instantly share code, notes, and snippets.

@elboulangero
Created November 9, 2016 09:40
Show Gist options
  • Save elboulangero/1927f1af1b7b463fe6740ee69341a5a3 to your computer and use it in GitHub Desktop.
Save elboulangero/1927f1af1b7b463fe6740ee69341a5a3 to your computer and use it in GitHub Desktop.
GtkExpander seems broken when expanded manually
/*
* Compile with:
* gcc $(pkg-config --cflags gtk+-3.0 --libs gtk+-3.0) -lm *.c
*/
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
#define EXPANDED
//#undef EXPANDED
int
main(int argc, char *argv[])
{
/* Init */
gtk_init(&argc, &argv);
/* Create a clickable label */
GtkWidget *label;
label = gtk_label_new("<b><a href=\"https://developer.gnome.org/gtk3/\">GTK+3</a></b>");
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
/* Create an expander that holds the label */
GtkWidget *expander;
expander = gtk_expander_new("Expandable");
gtk_container_add(GTK_CONTAINER(expander), label);
/* Create the main window that holds the expander */
GtkWidget *window;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_add(GTK_CONTAINER(window), expander);
#ifdef EXPANDED
/* Expand - this is where things seem bogus */
gtk_expander_set_expanded(GTK_EXPANDER(expander), TRUE);
#endif
/* Main loop */
gtk_widget_show_all(window);
gtk_main();
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment