Mike
Mike

Reputation: 814

GTK3 spinbutton has bizarre default style

I took this example right out of a book. Code is below. As well as screenshots of how it renders and how the book shows it.

Shouldn't this have a better looking default style? It takes up the entire window, there are plus and minus controls instead of arrows, and they're side-by-side instead of stacked. How do I get this to look like something a normal human can accept?

#include <gtk/gtk.h>

void closeApp ( GtkWidget *window, gpointer data)
{
    gtk_main_quit();
}

int main (int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *spinbutton;
    GtkAdjustment *adjustment;

    gtk_init (&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size ( GTK_WINDOW(window), 300, 200);
    g_signal_connect (G_OBJECT(window), "destroy",
                    G_CALLBACK(closeApp), NULL);
    adjustment = gtk_adjustment_new(100.0, 50.0, 150.0, 0.5, 0.05, 0.05);
    spinbutton = gtk_spin_button_new(adjustment, 0.01, 2);

    gtk_container_add(GTK_CONTAINER(window), spinbutton);
    gtk_widget_show_all(window);
    gtk_main ();

    return 0;
}

Code rendering

Image from book

Upvotes: 2

Views: 63

Answers (0)

Related Questions