Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*compile with gcc `pkg-config --cflags gtk+-3.0` -o main main.c `pkg-config --libs gtk+-3.0` -ltidy -lcurl*/
- //first this needs to get created then the modularity can begin in a new form
- #include <gtk/gtk.h>
- #include <tidy/tidy.h>
- #include <tidy/buffio.h>
- #include <curl/curl.h>
- #include <stdlib.h>
- #include <stdio.h>
- typedef struct
- {
- GtkWidget *grid, *view;
- GtkTextBuffer *buffer;
- } gridntext;
- static gridntext vg;
- void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
- {
- vg.view = gtk_text_view_new();
- vg.buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(vg.view));
- gtk_text_buffer_set_text(vg.buffer, "This is hello world text.", -1);
- gtk_grid_attach(GTK_GRID(vg.grid), vg.view, 1,3,1,1);
- ...
- }
- static void
- activate (GtkApplication* app,
- gpointer user_data)
- {
- const gchar *text;
- const gchar *texto;
- GtkWidget *window, *label, *button, *entry;
- //GtkTextBuffer *buffer;
- window = gtk_application_window_new (app);
- gtk_window_set_title (GTK_WINDOW (window), "Window");
- gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
- /* Create a 1x2 table */
- vg.grid = gtk_grid_new();
- gtk_container_add(GTK_CONTAINER (window), vg.grid);
- //left, right, up , down
- //tell the user what to do (bad philosophy if you want the user to feel at home, unless you want them to feel infantile)
- label = gtk_label_new("Enter the url:");
- gtk_grid_attach(GTK_GRID(vg.grid), label, 0, 1, 1, 1);
- entry = gtk_entry_new();
- //find a way to get the text in here to be appended to the yeah shit
- //texto = gtk_entry_buffer_get_text(gtk_entry_buffer_new(text, 10));
- //g_print("%c", texto);
- //gtk_entry_set_max_length(GTK_ENTRY(entry), 50);
- g_signal_connect(entry, "activate", G_CALLBACK (do_shit), entry); /*when enter is pressed, shit is sent */
- gtk_grid_attach(GTK_GRID(vg.grid), entry, 1, 1, 1, 1);
- //this does the same thing as enter but in button form
- button = gtk_button_new_with_label("Enter");
- g_signal_connect(button, "clicked", G_CALLBACK(do_shit), entry);
- gtk_grid_attach(GTK_GRID(vg.grid), button, 1, 2, 1, 1);
- gtk_widget_show_all (window);
- }
- int
- main (int argc, char **argv)
- {
- GtkApplication *app;
- int status;
- app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
- g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
- status = g_application_run (G_APPLICATION (app), argc, argv);
- g_object_unref (app);
- return status;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement