/
evo
/
Gtk4-tutorial
Обзор
Документация
Войти
/
evo
/
Gtk4-tutorial
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/expression/exp_test.c
48 строк
1 KB
M0JXD
Add space for all stat =g_application_run
01 ноя 2025, 03:42
01 ноя 2025, 03:42
4ddec85
Код
Авторство
О чём код?
#include <gtk/gtk.h> // This program check the "this" object. // It is usually the outer object of the expressions. char* test (GObject *object) { if (object) return g_strdup (G_OBJECT_TYPE_NAME (object)); else return g_strdup ("error"); } static void app_activate (GApplication *application) { GtkApplication *app = GTK_APPLICATION (application); gtk_window_present (gtk_application_get_active_window(app)); } static void app_startup (GApplication *application) { GtkApplication *app = GTK_APPLICATION (application); GtkBuilder *build; GtkWidget *win; build = gtk_builder_new_from_resource ("/com/github/ToshioCP/exp/exp_test.ui"); win = GTK_WIDGET (gtk_builder_get_object (build, "win")); gtk_window_set_application (GTK_WINDOW (win), app); g_object_unref (build); g_object_ref (win); /* win is taken the ownership in the lookup tag in the ui file at line 25. */ } #define APPLICATION_ID "com.github.ToshioCP.exp_watch" int main (int argc, char **argv) { GtkApplication *app; int stat; app = gtk_application_new (APPLICATION_ID, G_APPLICATION_DEFAULT_FLAGS); g_signal_connect (app, "startup", G_CALLBACK (app_startup), NULL); g_signal_connect (app, "activate", G_CALLBACK (app_activate), NULL); stat = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return stat; }