Create window
This commit is contained in:
14
builder.ui
Normal file
14
builder.ui
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk" version="4.0"/>
|
||||||
|
<object class="GtkWindow" id="window">
|
||||||
|
<property name="title">File Manager</property>
|
||||||
|
<property name="default-width">800</property>
|
||||||
|
<property name="default-height">300</property>
|
||||||
|
<property name="child">
|
||||||
|
<object class="GtkLabel" id="label">
|
||||||
|
<property name="label">Hi</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
1
compile
Executable file
1
compile
Executable file
@@ -0,0 +1 @@
|
|||||||
|
gcc $(pkg-config --cflags gtk4) -o filemanager.out main.c $(pkg-config --libs gtk4)
|
||||||
18
main.c
Normal file
18
main.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static void app_activate (GtkApplication *app, gpointer *user_data){
|
||||||
|
GtkBuilder *builder = gtk_builder_new_from_file("builder.ui");
|
||||||
|
GObject* window = gtk_builder_get_object(builder, "window");
|
||||||
|
gtk_window_set_application(GTK_WINDOW(window),app);
|
||||||
|
g_object_unref(builder);
|
||||||
|
gtk_window_present(GTK_WINDOW(window));
|
||||||
|
g_print("Started\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char **argv){
|
||||||
|
GtkApplication *app = gtk_application_new ("file.manager", G_APPLICATION_DEFAULT_FLAGS);
|
||||||
|
g_signal_connect (app, "activate", G_CALLBACK(app_activate),NULL);
|
||||||
|
int status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||||
|
g_object_unref(app);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user