Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.31 KB | None | 0 0
  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. #+
  3. #+     Glade / Gtk Programming
  4. #+
  5. #+     Copyright (C) 2019 by Kevin C. O'Kane
  6. #+
  7. #+     Kevin C. O'Kane
  8. #+     kc.okane@gmail.com
  9. #+     https://www.cs.uni.edu/~okane
  10. #+     http://threadsafebooks.com/
  11. #+
  12. #+ This program is free software; you can redistribute it and/or modify
  13. #+ it under the terms of the GNU General Public License as published by
  14. #+ the Free Software Foundation; either version 2 of the License, or
  15. #+ (at your option) any later version.
  16. #+
  17. #+ This program is distributed in the hope that it will be useful,
  18. #+ but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. #+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. #+ GNU General Public License for more details.
  21. #+
  22. #+ You should have received a copy of the GNU General Public License
  23. #+ along with this program; if not, write to the Free Software
  24. #+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25. #+
  26. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  27.  
  28. #include <stdlib.h>
  29. #include <sys/types.h>
  30. #include <signal.h>
  31. #include <unistd.h>
  32. #include <string.h>
  33. #include <gtk/gtk.h>
  34. #include <gtk/gtkx.h>
  35. #include <math.h>
  36. #include <ctype.h>
  37.  
  38. // Make them global
  39.  
  40. GtkWidget   *window;
  41. GtkWidget   *fixed1;
  42. GtkWidget   *button1;
  43. GtkWidget   *label1;
  44. GtkBuilder  *builder;
  45.  
  46. int main(int argc, char *argv[]) {
  47.  
  48.     gtk_init(&argc, &argv); // init Gtk
  49.  
  50. //---------------------------------------------------------------------
  51. // establish contact with xml code used to adjust widget settings
  52. //---------------------------------------------------------------------
  53.  
  54.     builder = gtk_builder_new_from_file ("part1.glade");
  55.  
  56.     window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
  57.  
  58.     g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
  59.  
  60.         gtk_builder_connect_signals(builder, NULL);
  61.  
  62.     fixed1 = GTK_WIDGET(gtk_builder_get_object(builder, "fixed1"));
  63.     button1 = GTK_WIDGET(gtk_builder_get_object(builder, "button1"));
  64.     label1 = GTK_WIDGET(gtk_builder_get_object(builder, "label1"));
  65.  
  66.     gtk_widget_show(window);
  67.  
  68.     gtk_main();
  69.  
  70.     return EXIT_SUCCESS;
  71.     }
  72.  
  73. void    on_button1_clicked (GtkButton *b) {
  74.     gtk_label_set_text (GTK_LABEL(label1), (const gchar* ) "Hello World");
  75.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement