View difference between Paste ID: sLz2zUJt and VTsWfvza
SHOW: | | - or go back to the newest paste.
1
/*compile with gcc `pkg-config --cflags gtk+-3.0` -o main main.c `pkg-config --libs gtk+-3.0` -ltidy -lcurl*/
2
//first this needs to get created then the modularity can begin in a new form
3
#include <gtk/gtk.h>
4
#include <tidy/tidy.h>
5
#include <tidy/buffio.h>
6
#include <curl/curl.h>
7
#include <stdlib.h>
8
#include <stdio.h>
9
typedef struct 
10
{
11
	GtkWidget *grid, *view;
12
	GtkTextBuffer *buffer;
13
} gridntext;
14
15
static gridntext vg;
16
17-
 	
17+
18-
	gridntext vg;
18+
19
	vg.view = gtk_text_view_new();
20
	vg.buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(vg.view));
21
	gtk_text_buffer_set_text(vg.buffer, "This is hello world text.", -1);
22
	gtk_grid_attach(GTK_GRID(vg.grid), vg.view, 1,3,1,1);
23
	
24
	...
25
  
26
}
27
28
29
30
static void
31
activate (GtkApplication* app,
32
          gpointer        user_data)
33
{
34
	const gchar *text;
35-
	gridntext vg;
35+
36
	GtkWidget *window, *label, *button, *entry;
37
  	//GtkTextBuffer *buffer;
38
	window = gtk_application_window_new (app);
39
  	gtk_window_set_title (GTK_WINDOW (window), "Window");
40
  	gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
41
  
42
	/* Create a 1x2 table */
43
	vg.grid = gtk_grid_new();
44
	gtk_container_add(GTK_CONTAINER (window), vg.grid);
45
	//left, right, up , down
46
	//tell the user what to do (bad philosophy if you want the user to feel at home, unless you want them to feel infantile)
47
	label = gtk_label_new("Enter the url:");
48
	gtk_grid_attach(GTK_GRID(vg.grid), label, 0, 1, 1, 1);
49
50
	entry = gtk_entry_new();
51
	//find a way to get the text in here to be appended to the yeah shit
52
	//texto = gtk_entry_buffer_get_text(gtk_entry_buffer_new(text, 10));
53
	//g_print("%c", texto);
54
	//gtk_entry_set_max_length(GTK_ENTRY(entry), 50);
55
	g_signal_connect(entry, "activate", G_CALLBACK (do_shit), entry); /*when enter is pressed, shit is sent */
56
	gtk_grid_attach(GTK_GRID(vg.grid), entry, 1, 1, 1, 1);
57
	
58
	//this does the same thing as enter but in button form
59
	button = gtk_button_new_with_label("Enter");
60
	g_signal_connect(button, "clicked", G_CALLBACK(do_shit), entry);
61
	gtk_grid_attach(GTK_GRID(vg.grid), button, 1, 2, 1, 1);
62
	
63
	
64
	
65
	gtk_widget_show_all (window);
66
}
67
68
int
69
main (int    argc,  char **argv)
70
{
71
  GtkApplication *app;
72
  int status;
73
74
  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
75
  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
76
  status = g_application_run (G_APPLICATION (app), argc, argv);
77
  g_object_unref (app);
78
79
  return status;
80
}