|
Post by bigbass on Jul 20, 2020 1:02:01 GMT 1
Hello I wanted a gtk3 glade with webkit example that compiles using BaCon I used bassix macros and several hacks because I wanted that there was a way to modify the code visually and easily that's why I used glade it takes some time to get used to glade a lot of options ! now modifying the code would be much easier and the bulk of the code and settings stay in the glade file I was able to get it to resize too! P.S I liked how vovchik used a combobox for the link list so I did it in glade looks cleaner compared to buttons bassix-glade-browser-1.00.tar.gz (3.23 KB) Joe
|
|
|
Post by vovchik on Jul 20, 2020 12:37:23 GMT 1
Dear Joe, Thanks. It works! To get rid of the glade, though, we could study the glade xml and figure out where it places the vbox and hbox bits. I used this: glade2c, and am looking at the c code it generated. With kind regards, vovchik
|
|
|
Post by bigbass on Jul 20, 2020 17:07:35 GMT 1
hello vovchik
thanks for posting the converter glade2c even though it doesn't produce any code that compiles (as of yet) it is useful to some degree producing some c code to read
with a bit of hacking we could make it work(compile) maybe (or you got it working as is ? ) another thing is web kit is not part of the database if not too much work it could be added
all of that aside if you only want the code for the boxes the code is there in c
Thanks I will look at if there is some working example code that compiles
I used the 0.0.3 version will check the others too Joe
|
|
|
Post by vovchik on Jul 20, 2020 17:36:13 GMT 1
Dear Joe, I know it doesn't do the webkit things - but it is still useful for getting the other widgets translated from xml into in normal c. In the meaintime, here is the old version of the bassix browser, this time with a working mailto bit. With kind regards, vovchik
|
|
|
Post by bigbass on Jul 20, 2020 21:58:03 GMT 1
Hello vovchik
Thanks working nicely Its good that you worked on the load time That can be used for many things one comes to mind
if the page takes too long break out give a warning to try again or check your internet connection and load an alternative url
Joe
|
|
|
Post by vovchik on Jul 21, 2020 15:48:41 GMT 1
Dear Joe, Here is the latest. I added a little graphics touch to the top, where the widgets are, just because it looks nice... With kind regards, vovchik
|
|
|
Post by bigbass on Jul 21, 2020 23:10:54 GMT 1
Hello vovchik Thanks for your fine tuning this link adds the progress differently using a signal and the progress bar (no timeouts) refresh and site load cancel for those sticking sites or slow loading ones bassic-glade-browser-1.10.tar.gz (3.69 KB) P.S I know glade is not popular here but we still need some examples for gtk3 with webkit and when we need to do more a complete app glade is much easier to edit and see the changes and can be fun to test ideas quickly! and if anyone wants to start out fresh its much easier with working demo that compiles using the bacon compiler Joe
|
|
|
Post by vovchik on Jul 22, 2020 20:29:31 GMT 1
Dear Joe,
Thanks. I looked at the pulsebar output, and we are never reaching a value of 1.0 for some reason, meaning full page loaded. I will have to look at the code there. I remember we once did a function that procesed a glade file that was placed inside a string variable. That is one way of keeping the the source self-contained - and we could have a switch (e.g. -d) to dump the glade file and the complete source (SOURCE$) to disk for editing/updating. I am just thinking out loud...
With kind regards, vovchik
|
|
|
Post by bigbass on Jul 22, 2020 21:26:59 GMT 1
Hello vovchik waiting for a 1.0 or 100 can cause extra loops that gets the "estimated load value" and may load faster than 100 I did try a few other ways and they all added extra delay loops in loading could force a 100 there if needed but it may load sooner which is good I see your point you would expect a full or 100 there using the signal it has no timing issues I was a bit hasty in my thoughts about the c code generator I tried again today and now understand why nothing would compile the glade2c was written some time before gtk 2.12 that was before 2007 so after updating old code to gtk3 standards and writing callbacks and the missing gtk code structure I got a c code version to compile if I hadn't written the code first and knew what it was supposed to do that would be very difficult to port for a large program maybe we could edit the source code and update it to gtk3 but that's still lot of work thinking... and glade is for larger apps in the other non glade thread of bassix we can manually do a lot too with the fixed placement and glade is super easy with the fixed grid also a long time ago glade was embedded in the bacon app which just only made it more difficult to edit the code later and no real performance gains development time vs having two files both ways work which is good I will still work using non glade also its just an option and I feel it is more transparent in the long run Joe
|
|
|
Post by bigbass on Jul 23, 2020 4:33:39 GMT 1
Hello vovchik fixed the progress bar it was really easy when I looked at it fresh again and is correct this time bassic-glade-browser-1.11.tar.gz (3.72 KB) Joe IF loadProgress == 100.0 THEN PRINT "DONE" PROGRESS_SET(PROG1,1) END IF
|
|
|
Post by bigbass on Jul 23, 2020 4:56:58 GMT 1
Hello vovchik
before I said I ported my own glade / bacon version to gtk3 (without webkit) but is an exact copy
here it is in just c code not for everyone but just in case its needed it now compiles clean for gtk3 and you can see all that was added
P.S it was much easier to do in glade
using geany
gcc -Wall -c "%f" -Wno-deprecated-declarations `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0 gcc -Wall -o "%e" "%f" -Wno-deprecated-declarations `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0 `
#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <glib/gi18n.h> #include <gtk/gtk.h>
void ENTRY1_CB() { g_print("entry cb"); }
void URI_CB() { g_print("uri cb"); }
void WINDOW_CB() { g_print("window cb"); }
void BACK_CB() { g_print("back cb"); }
void FORWARD_CB() { g_print("forward cb"); }
GtkWidget* WINDOW; GtkWidget* BOX1; GtkWidget* BOX2; GtkWidget* BACK_BUTTON; GtkWidget* ENTRY1; GtkWidget* FORWARD_BUTTON; GtkWidget* BOX3; GtkWidget* URI;
int main(int argc, char *argv[]) { gtk_init(&argc, &argv);
WINDOW = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size((GtkWindow*)WINDOW,300,300); (void)0 /* Visible = TRUE */; g_object_set((GObject*)WINDOW, "title",_(" Bassix browser demo using glade version 1.00 "), "can_focus",FALSE, NULL); g_signal_connect((void*)WINDOW,"destroy",G_CALLBACK(WINDOW_CB),NULL); BOX1 = gtk_box_new(1,0); gtk_container_add((GtkContainer*)WINDOW,(GtkWidget*)BOX1); gtk_widget_show((GtkWidget*)BOX1); g_object_set((GObject*)BOX1, "orientation",GTK_ORIENTATION_VERTICAL, "can_focus",FALSE, NULL); BOX2 = gtk_box_new(1,0); gtk_box_pack_start((GtkBox*)BOX1,BOX2,FALSE,TRUE,0); g_object_set((GObject*)BOX2, "orientation",GTK_ORIENTATION_HORIZONTAL, "can_focus",FALSE, NULL); gtk_widget_show((GtkWidget*)BOX2); g_object_set((GObject*)BOX2, "can_focus",FALSE, NULL); BACK_BUTTON = gtk_button_new_from_stock("gtk-go-back"); gtk_box_pack_start((GtkBox*)BOX2,BACK_BUTTON,FALSE,TRUE,0); (void)0 /* Use stock = TRUE */; gtk_widget_show((GtkWidget*)BACK_BUTTON); g_object_set((GObject*)BACK_BUTTON, "tooltip_text",_("Go back a page"), "receives_default",TRUE, "can_focus",TRUE, NULL); ENTRY1 = gtk_entry_new(); gtk_box_pack_start((GtkBox*)BOX2,ENTRY1,TRUE,TRUE,0); gtk_widget_show((GtkWidget*)ENTRY1); g_object_set((GObject*)ENTRY1, "tooltip_text",_("Enter a full link or DND local file here to view it as text"), "can_focus",TRUE, NULL); g_signal_connect((void*)ENTRY1,"activate",G_CALLBACK(ENTRY1_CB),NULL); FORWARD_BUTTON = gtk_button_new_from_stock("gtk-go-forward"); gtk_box_pack_start((GtkBox*)BOX2,FORWARD_BUTTON,FALSE,TRUE,0); (void)0 /* Use stock = TRUE */; gtk_widget_show((GtkWidget*)FORWARD_BUTTON); g_object_set((GObject*)FORWARD_BUTTON, "tooltip_text",_("Go forward page"), "receives_default",TRUE, "can_focus",TRUE, NULL); BOX3 = gtk_box_new(0,0); gtk_box_pack_start((GtkBox*)BOX1,BOX3,FALSE,TRUE,0); gtk_widget_show((GtkWidget*)BOX3); g_object_set((GObject*)BOX3, "can_focus",FALSE, NULL); URI = gtk_button_new_with_label(_("URI")); gtk_box_pack_start((GtkBox*)BOX3,URI,FALSE,TRUE,0); gtk_widget_show((GtkWidget*)URI); g_object_set((GObject*)URI, "tooltip_text",_("Get and put the current link in the entry"), "receives_default",TRUE, "can_focus",TRUE, NULL); g_signal_connect((void*)URI,"clicked",G_CALLBACK(URI_CB),NULL); g_signal_connect((void*)BACK_BUTTON,"clicked",G_CALLBACK(BACK_CB),NULL); g_signal_connect((void*)FORWARD_BUTTON,"clicked",G_CALLBACK(FORWARD_CB),NULL); g_signal_connect(WINDOW, "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_widget_show(WINDOW); gtk_main();
return 0; }
|
|
|
Post by vovchik on Jul 23, 2020 9:44:10 GMT 1
Dear Joe,
I like the c barebones version, since it shows the widgets we need for the gui in order to do a bassix-style version easily. Thanks.
With kind regards, vovchik
|
|
|
Post by vovchik on Jul 23, 2020 17:44:59 GMT 1
Dear Joe, I have had some success, but still experimenting. We have to use some of this stuff, I think: featuresattributesI have attached a little test. There is a runtime waring about casting, but we will figure that out... UPDATED: Had some success with expand and hexpand properties. Changes in archive. UPDATED: Added HOME and REFRESH buttons. They don't do anything yet. UPDATED: HOME and REFRESH buttons now working. With kind regards, vovchik
|
|
|
Post by bigbass on Jul 24, 2020 19:17:34 GMT 1
Hello vovchik had to replace the timeouts and use signals for the rpi3 in the SPINNER_CB everything else is the same with no other changes I used ''' 3 comments were I commented out parts so its easy to locate let me know how it goes on the rpi4 please bassix-using-signals.tar.gz (8.46 KB) Joe
|
|
|
Post by vovchik on Jul 24, 2020 21:03:01 GMT 1
Dear Joe, Your mods are working perfectly on Mint and Pi4. I added a stop button to your latest code, and it seems to be working, too. With kind regards, vovchik UPDATE: I also added a convenient expand button that does a zoom and maximizes the screen in one go. And I made nearly all the buttoms svg images for now, just for the sake of code consistency.
|
|