diff --git a/Gtk3/gtk67_builder2/.vscode/c_cpp_properties.json b/Gtk3/gtk67_builder2/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..649ee3a --- /dev/null +++ b/Gtk3/gtk67_builder2/.vscode/c_cpp_properties.json @@ -0,0 +1,61 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + //For linux amd64 and linux on arm64,some include path may different + //Commet and uncomment these lines to compile on a specificed archtiecture + //Arm64 linux libs + + "/usr/lib/aarch64-linux-gnu/dbus-1.0/include/**", + "/usr/lib/aarch64-linux-gnu/glib-2.0/include", + + //amd64 linux libs(For ubuntu) + /* + "/usr/lib/x86_64-linux-gnu/dbus-1.0/include", + "/usr/lib/x86_64-linux-gnu/glib-2.0/include", + */ + //For debian and ubuntu,kali + + "/usr/include/gtk-3.0/gtk/**", + "/usr/include/uuid/**", + + //For manjaro(Arch linux) + /* + "/usr/lib/dbus-1.0/include/**", + "/usr/lib/glib-2.0/include/**", + "/usr/include/lzo/**", + "/usr/include/cloudproviders/**", + */ + "${workspaceFolder}/**", + "/usr/include/gtk-3.0/**", + "/usr/include/at-spi2-atk/2.0/**", + "/usr/include/at-spi-2.0/**", + "/usr/include/dbus-1.0/**", + "/usr/include/gio-unix-2.0/**", + "/usr/include/cairo/**", + "/usr/include/pango-1.0/**", + "/usr/include/fribidi/**", + "/usr/include/harfbuzz/**", + "/usr/include/atk-1.0/**", + "/usr/include/pixman-1/**", + "/usr/include/freetype2/**", + "/usr/include/libpng16/**", + "/usr/include/gdk-pixbuf-2.0/**", + "/usr/include/libmount/**", + "/usr/include/blkid/**", + "/usr/include/glib-2.0/**" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++14", + "intelliSenseMode": "gcc-arm64", + "compilerArgs": [ + "`pkg-config --cflags --libs gtk+-3.0`" + ], + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/Gtk3/gtk67_builder2/.vscode/launch.json b/Gtk3/gtk67_builder2/.vscode/launch.json new file mode 100644 index 0000000..783668a --- /dev/null +++ b/Gtk3/gtk67_builder2/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "g++ - Build and debug active file", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/bin/gtk67", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "C/C++: g++ build active file", + "miDebuggerPath": "/usr/bin/gdb" + } + ] +} diff --git a/Gtk3/gtk67_builder2/.vscode/settings.json b/Gtk3/gtk67_builder2/.vscode/settings.json new file mode 100644 index 0000000..0baae3a --- /dev/null +++ b/Gtk3/gtk67_builder2/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "C_Cpp.errorSquiggles": "Disabled", + "cmake.configureOnOpen": false +} \ No newline at end of file diff --git a/Gtk3/gtk67_builder2/.vscode/tasks.json b/Gtk3/gtk67_builder2/.vscode/tasks.json new file mode 100644 index 0000000..29c1089 --- /dev/null +++ b/Gtk3/gtk67_builder2/.vscode/tasks.json @@ -0,0 +1,83 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-g", + "src/*.cpp", + "-o", + "${workspaceFolder}/bin/gtk67", + "-pthread", + //For Arm64 linux + + "-I/usr/lib/aarch64-linux-gnu/dbus-1.0/include", + "-I/usr/lib/aarch64-linux-gnu/glib-2.0/include", + + //For amd64 linux + /* + "-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include", + "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include", + */ + //Ubuntu and kali include paths + + "-I/usr/include/uuid", + + //Manjaro linux and Arch linux include args + + "-I${workspaceFolder}", + /* + "-I/usr/lib/glib-2.0/include", + "-I/usr/lib/dbus-1.0/include", + "-I/usr/include/lzo", + "-I/usr/include/cloudproviders", + */ + "-I/usr/include/gtk-3.0", + "-I/usr/include/at-spi2-atk/2.0", + "-I/usr/include/at-spi-2.0", + "-I/usr/include/dbus-1.0", + "-I/usr/include/gio-unix-2.0", + "-I/usr/include/cairo", + "-I/usr/include/pango-1.0", + "-I/usr/include/fribidi", + "-I/usr/include/harfbuzz", + "-I/usr/include/atk-1.0", + "-I/usr/include/pixman-1", + "-I/usr/include/freetype2", + "-I/usr/include/libpng16", + "-I/usr/include/gdk-pixbuf-2.0", + "-I/usr/include/libmount", + "-I/usr/include/blkid", + "-I/usr/include/glib-2.0", + //Manjaro linux lib args + //"-lz", + + "-lgtk-3", + "-lgdk-3", + "-lpangocairo-1.0", + "-lpango-1.0", + "-lharfbuzz", + "-latk-1.0", + "-lcairo-gobject", + "-lcairo", + "-lgdk_pixbuf-2.0", + "-lgio-2.0", + "-lgobject-2.0", + "-lglib-2.0", + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} diff --git a/Gtk3/gtk67_builder2/res/appmenu.xml b/Gtk3/gtk67_builder2/res/appmenu.xml new file mode 100644 index 0000000..39a6560 --- /dev/null +++ b/Gtk3/gtk67_builder2/res/appmenu.xml @@ -0,0 +1,23 @@ + + + +
+ + Change background + app.back + + + Default background + app.default + + + About + app.about + + + Exit + app.quit + +
+
+
\ No newline at end of file diff --git a/Gtk3/gtk67_builder2/res/compile-resource.sh b/Gtk3/gtk67_builder2/res/compile-resource.sh new file mode 100644 index 0000000..da886d3 --- /dev/null +++ b/Gtk3/gtk67_builder2/res/compile-resource.sh @@ -0,0 +1 @@ + glib-compile-resources gtk67.gresource.xml --target=../src/resources.cpp --generate-source diff --git a/Gtk3/gtk67_builder2/res/gtk67.gresource.xml b/Gtk3/gtk67_builder2/res/gtk67.gresource.xml new file mode 100644 index 0000000..0e61f20 --- /dev/null +++ b/Gtk3/gtk67_builder2/res/gtk67.gresource.xml @@ -0,0 +1,10 @@ + + + + gtkmain.ui + win1.ui + + + icons/48x48/actions/gtk67.png + + \ No newline at end of file diff --git a/Gtk3/gtk67_builder2/res/gtkmain.ui b/Gtk3/gtk67_builder2/res/gtkmain.ui new file mode 100644 index 0000000..28b0f09 --- /dev/null +++ b/Gtk3/gtk67_builder2/res/gtkmain.ui @@ -0,0 +1,74 @@ + + + + + + False + 200 + 100 + + + True + False + vertical + + + True + False + + + + + + + + + Exit + True + True + True + + + False + True + end + 2 + + + + + False + True + end + 0 + + + + + + + + True + False + + + win1 + True + True + True + + + -1 + + + + + True + True + 2 + + + + + + diff --git a/Gtk3/gtk67_builder2/res/gtkmain.ui~ b/Gtk3/gtk67_builder2/res/gtkmain.ui~ new file mode 100644 index 0000000..54cf397 --- /dev/null +++ b/Gtk3/gtk67_builder2/res/gtkmain.ui~ @@ -0,0 +1,74 @@ + + + + + + False + 200 + 100 + + + True + False + vertical + + + True + False + + + + + + + + + Exit + True + True + True + + + False + True + end + 2 + + + + + False + True + end + 0 + + + + + + + + True + False + + + button + True + True + True + + + -1 + + + + + True + True + 2 + + + + + + diff --git a/Gtk3/gtk67_builder2/res/icons/48x48/actions/gtk67.png b/Gtk3/gtk67_builder2/res/icons/48x48/actions/gtk67.png new file mode 100644 index 0000000..5b868e2 Binary files /dev/null and b/Gtk3/gtk67_builder2/res/icons/48x48/actions/gtk67.png differ diff --git a/Gtk3/gtk67_builder2/res/win1.ui b/Gtk3/gtk67_builder2/res/win1.ui new file mode 100644 index 0000000..219c3ef --- /dev/null +++ b/Gtk3/gtk67_builder2/res/win1.ui @@ -0,0 +1,91 @@ + + + + + + False + 200 + 200 + + + True + False + vertical + + + 75 + True + False + True + + + False + True + 0 + + + + + Start + True + True + True + + + False + True + 1 + + + + + True + False + + + + + + + + + Exit + True + True + True + + + False + True + end + 2 + + + + + + + + False + True + end + 2 + + + + + Stop + True + True + True + + + False + True + 3 + + + + + + diff --git a/Gtk3/gtk67_builder2/res/win1.ui~ b/Gtk3/gtk67_builder2/res/win1.ui~ new file mode 100644 index 0000000..0664e7c --- /dev/null +++ b/Gtk3/gtk67_builder2/res/win1.ui~ @@ -0,0 +1,90 @@ + + + + + + False + 200 + 200 + + + True + False + vertical + + + 40 + True + False + + + False + True + 0 + + + + + Start + True + True + True + + + False + True + 1 + + + + + True + False + + + + + + + + + Exit + True + True + True + + + False + True + end + 2 + + + + + + + + False + True + end + 2 + + + + + Stop + True + True + True + + + False + True + 3 + + + + + + diff --git a/Gtk3/gtk67_builder2/src/main.cpp b/Gtk3/gtk67_builder2/src/main.cpp new file mode 100644 index 0000000..b17cbfd --- /dev/null +++ b/Gtk3/gtk67_builder2/src/main.cpp @@ -0,0 +1,47 @@ +#include + +static void win1(GtkWidget *widget,GtkWindow *parent){ + //A child window + GtkBuilder *builder1=gtk_builder_new_from_resource("/gtk67/win1.ui"); + GtkWidget *win1,*exit,*btnstart,*btnstop,*spinner; + win1=(GtkWidget*)gtk_builder_get_object(builder1,"win1"); + gtk_window_set_icon_name((GtkWindow*)win1,"gtk67"); + gtk_window_set_title((GtkWindow*)win1,"Gtk Spinner"); + gtk_window_set_transient_for((GtkWindow*)win1,parent); + //"Exit" button + exit=(GtkWidget*)gtk_builder_get_object(builder1,"win1exit"); + g_signal_connect_swapped(exit,"clicked",G_CALLBACK(gtk_widget_destroy),win1); + //Button to control spinner + btnstart=(GtkWidget*)gtk_builder_get_object(builder1,"btnstart"); + btnstop=(GtkWidget*)gtk_builder_get_object(builder1,"btnstop"); + spinner=(GtkWidget*)gtk_builder_get_object(builder1,"spinner"); + gtk_spinner_start((GtkSpinner*)spinner); + g_signal_connect_swapped(btnstart,"clicked",G_CALLBACK(gtk_spinner_start),spinner); + g_signal_connect_swapped(btnstop,"clicked",G_CALLBACK(gtk_spinner_stop),spinner); + gtk_widget_show_all(win1); + g_object_unref(builder1); +} + +static void gtkmain(GtkApplication *app,gpointer user_data){ + GtkBuilder *builder=gtk_builder_new_from_resource("/gtk67/gtkmain.ui"); + GtkWidget *window,*btnwin1,*btnexit; + //Main window + window=(GtkWidget*)gtk_builder_get_object(builder,"window"); + gtk_application_add_window(app,(GtkWindow*)window); + gtk_window_set_icon_name((GtkWindow*)window,"gtk67"); + gtk_window_set_title((GtkWindow*)window,"gtk(67)"); + //"Exit" and "Win1" button + btnexit=(GtkWidget*)gtk_builder_get_object(builder,"btnexit"); + g_signal_connect_swapped(btnexit,"clicked",G_CALLBACK(gtk_widget_destroy),window); + btnwin1=(GtkWidget*)gtk_builder_get_object(builder,"btnwin1"); + g_signal_connect(btnwin1,"clicked",G_CALLBACK(win1),window); + gtk_widget_show_all(window); + g_object_unref(builder); +} + +int main(int argc,char **argv){ + GtkApplication *app; + app=gtk_application_new("org.gtk.daleclack",G_APPLICATION_NON_UNIQUE); + g_signal_connect(app,"activate",G_CALLBACK(gtkmain),NULL); + return g_application_run((GApplication*)app,argc,argv); +} diff --git a/Gtk3/gtk67_builder2/src/resources.cpp.7z b/Gtk3/gtk67_builder2/src/resources.cpp.7z new file mode 100644 index 0000000..96e539f Binary files /dev/null and b/Gtk3/gtk67_builder2/src/resources.cpp.7z differ