Computer Science & C Programming


GLib

  1. As a more complete example, the following code present timer object and a linked list:
GTimer* timer = g_timer_new();
g_timer_start(timer);
	
GList* list = NULL;
list = g_list_append(list, g_string_new("Welcome"));
list = g_list_append(list, g_string_new("to"));
list = g_list_append(list, g_string_new("You"));
	
printf("List size: %i\n",g_list_length(list));
GList* ptr;
for(ptr=list; ptr!=NULL; ptr=ptr->next)
	g_printf("%s\n",((GString*)ptr->data)->str);

g_timer_stop(timer);
printf("Time ellapsed: %f sec.\n",g_timer_elapsed(timer,NULL));

source

  1. Now, what about Windows' Components ?
GtkWindow* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkButton* button = gtk_button_new_with_label("Ok");

2 - 8