2021-02-13 11:58:43 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "background.h"
|
2021-02-14 10:45:51 +08:00
|
|
|
#include "winconf.h"
|
2021-02-15 12:33:16 +08:00
|
|
|
#include "panel1.h"
|
|
|
|
#include "panel2.h"
|
2021-02-13 11:58:43 +08:00
|
|
|
|
|
|
|
static void gtkmain(GtkApplication *app,gpointer user_data){
|
|
|
|
//Get main window
|
2021-02-18 09:38:23 +08:00
|
|
|
int width=640,height=360;
|
2021-02-14 10:45:51 +08:00
|
|
|
get_config(&width,&height);
|
2021-02-18 09:38:23 +08:00
|
|
|
GtkBuilder *builder=gtk_builder_new_from_resource("/gtk42/window.ui");
|
2021-02-13 11:58:43 +08:00
|
|
|
GObject *window=gtk_builder_get_object(builder,"window");
|
2021-02-14 10:45:51 +08:00
|
|
|
gtk_window_set_default_size(GTK_WINDOW(window),width,height);
|
2021-02-18 09:38:23 +08:00
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(window),"gtk4-icon");
|
2021-02-15 12:33:16 +08:00
|
|
|
|
|
|
|
//Get button for change background(moved to panel 1)
|
|
|
|
/*GObject *btn_back=gtk_builder_get_object(builder,"btnback");
|
|
|
|
g_signal_connect(btn_back,"clicked",G_CALLBACK(fileopen),builder);*/
|
|
|
|
|
|
|
|
//Config button(moved to panel 1)
|
|
|
|
/*GObject *btn_conf=gtk_builder_get_object(builder,"btnset");
|
|
|
|
g_signal_connect(btn_conf,"clicked",G_CALLBACK(conf_dialog),builder);*/
|
2021-02-13 11:58:43 +08:00
|
|
|
//default background
|
2021-02-15 12:33:16 +08:00
|
|
|
|
2021-02-13 11:58:43 +08:00
|
|
|
default_background(builder);
|
2021-02-15 12:33:16 +08:00
|
|
|
//Add a top panel with timer
|
|
|
|
GObject *fixed=gtk_builder_get_object(builder,"fixed");
|
|
|
|
add_toppanel(builder,GTK_FIXED(fixed));
|
|
|
|
add_leftpanel(builder,GTK_FIXED(fixed));
|
2021-02-13 11:58:43 +08:00
|
|
|
//Add window to the application and show
|
|
|
|
gtk_application_add_window(app,GTK_WINDOW(window));
|
|
|
|
gtk_widget_show_all(GTK_WIDGET(window));
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc,char *argv[]){
|
|
|
|
GtkApplication *app;
|
|
|
|
int status;
|
2021-02-18 09:38:23 +08:00
|
|
|
app=gtk_application_new("org.gtk.daleclack",G_APPLICATION_NON_UNIQUE);
|
2021-02-13 11:58:43 +08:00
|
|
|
g_signal_connect(app,"activate",G_CALLBACK(gtkmain),NULL);
|
|
|
|
status=g_application_run(G_APPLICATION(app),argc,argv);
|
|
|
|
return status;
|
|
|
|
}
|