Advertisement
PepperoniPapaya

asdasd

May 11th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. /*
  2. * Compile me with:
  3. * gcc -o tut tut.c $(pkg-config --cflags --libs gtk+-2.0 gmodule-2.0)
  4. */
  5.  
  6. #include <gtk/gtk.h>
  7.  
  8. int main(int argc, char **argv) {
  9. GtkBuilder *builder;
  10. GtkWidget *window;
  11. GError *error = NULL;
  12.  
  13. /* Init GTK+ */
  14. gtk_init(&argc, &argv);
  15.  
  16. /* Create new GtkBuilder object */
  17. builder = gtk_builder_new();
  18.  
  19. /* Load UI from file. If error occurs, report it and quit application.*/
  20. if(!gtk_builder_add_from_file(builder, "dictionary.glade", &error))
  21. {
  22. g_warning("%s", error->message);
  23. g_free(error);
  24. return(1);
  25. }
  26.  
  27. /* Get main window pointer from UI */
  28. window = GTK_WIDGET(gtk_builder_get_object( builder, "main_window"));
  29.  
  30. /* Connect signals */
  31. gtk_builder_connect_signals( builder, NULL );
  32.  
  33. /* Destroy builder, since we don't need it anymore */
  34. g_object_unref( G_OBJECT( builder ) );
  35.  
  36. /* Show window. All other widgets are automatically shown by GtkBuilder */
  37. gtk_widget_show( window );
  38.  
  39. /* Start main loop */
  40. gtk_main();
  41.  
  42. return( 0 );
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement