This document will describe how I build my Calends, which is an application/window to interact with my files and help manage my goals.
We need to build an application window and I want to use the WxWidgets framework so that I can start with something that is cross-platform to start. But on more reflection, I am going to work with GTK to be able to ramp knowledge for the GlScopeClient project better and I only really intend to use this on Linux for now. Compromises help the other projects!
1/14/21: Downloading Glade to facilitate in building desired UI and loading from XML. Too complicated out the gate. Their tutorial is a 2009 blogspot and the mock interface image isn't loading. Still had good advice for starting with an image of my desired interface and so I sketched out some initial features I want to see/interact with.
Built GTK example window (https://developer.gnome.org/gtk3/stable/gtk-getting-started.html)
gcc
pkg-config --cflags gtk+-3.0
-o bin/meus_calends src/main.cpkg-config --libs gtk+-3.0
1/15/21
Spent way too much time last night sketch out an ideal interface and widget. I am very pleased with the progress/drawings/thoughts/states I did think out and document. I need to get better with the scanner so I can directly embedded/manipulate the images I draw.
1/16/21
Next example is to start using the UI XML which is good and an output of the Glade program if I understand correctly.
Small issue with locating the "builder.ui" file, default looking for it where I run the program
Copying from source here for future reference
Note that GtkBuilder can also be used to construct objects that are not widgets, such as tree models, adjustments, etc. That is the reason the method we use here is called gtk_builder_get_object() and returns a GObject* instead of a GtkWidget*.
Normally, you would pass a full path to gtk_builder_add_from_file() to make the execution of your program independent of the current directory. A common location to install UI descriptions and similar data is /usr/share/appname.
It is also possible to embed the UI description in the source code as a string and use gtk_builder_add_from_string() to load it. But keeping the UI description in a separate file has several advantages: It is then possible to make minor adjustments to the UI without recompiling your program, and, more importantly, graphical UI editors such as glade can load the file and allow you to create and modify your UI by point-and-click.
https://developer.gnome.org/gtk3/stable/ch01s03.html
1/18-19/21
The next example wants me to access the source to practice with applications. I wish they had the source file more easily available as an HTML
I searched for the files on my computer using find and grep but to no avail
find gtk /usr/ | grep example
The full, buildable sources for these examples can be found in the examples/ directory of the GTK+ source distribution, or online in the GTK+ git repository.
https://developer.gnome.org/gtk3/stable/ch01s04.html
https://github.com/GNOME/gtk/tree/master/examples
Checking this out into repos against my better judgement (feels a bit cluttered but oh well)
http://ptomato.name/advanced-gtk-techniques/html/real-life-app-setup.html
Stumbled into this site by searching "gtk .desktop icon".
Need to move out of the tutorial and into implementing my application and reading/referencing the examples as needed. The size and complexity of the examples at this point is detrimental compared to what I want to implement. I had a great time building the 48x48 pixel desktop icon to start but having trouble linking it into the running application so going to try this Ptomato site and work on the application itself
1/19/21
Attempting to build the application from examples but using my names/goals/arrangments. Going to remove examples folder from project.
I'm wary of just diving into the autoconf/tools tutorial offered by ptomato so I'm looking at the simple make to start. https://www.gnu.org/software/make/manual/make.html#Overview
make requires a makefile, which more-or-less recompiles source/header files based on edits since last compilation. It can also solve world hunger and bring everlasting peace if you're smart enough but I'm just here for the basics.
Makefile consists of "rules" with this format.
target ... : prerequisites ..
recipe
...
...
Usually the name of a file that is generated by a program (executables/objects). Can also be the name of an action to carry out, such as 'clean' (see https://www.gnu.org/software/make/manual/make.html#Phony-Targets)
A file used as input to create the target
An action that make carries out. A recipe may have more than one command either on the same line or each on its own line.
Note: Tab character (\t) is required at the beginning of every recipe line. "An obscurity that catches the unwary". Workaround through the .RECIPEPREFIX variable (see https://www.gnu.org/software/make/manual/make.html#Special-Variables)
Typically, the usage of a recipe is with prerequisites and serves to create a target file if any prerequisites change. However, prerequisites are not required. For example, the rule containing the delete command associated with the target 'clean' does not have prerequisites.
Example where edit executable is created from several object compilations and example clean command to remove the object/executable files.
make
make clean
edit : main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o
cc -o edit main.o kbd.o command.o display.o \
insert.o search.o file.o utils.o
main.o : main.c defs.h
cc -c main.c
kbd.o : kbd.c defs.h command.h
cc -c kbd.c
....
clean :
rm edit main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o