Yet Another Check-Out System
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 lines
1.3 KiB

#include <gtk/gtk.h>
#include "main_window.h"
#include "scanner.h"
struct app_state {
struct mainWindow *mainWindow;
};
static void activate(GtkApplication* app, gpointer user_data)
{
struct app_state *app_state = user_data;
struct mainWindow **mainWindow = &(app_state->mainWindow);
YacosScanner *scanner;
YacosApi *api;
*mainWindow = mainWindow_new(app);
if (!(*mainWindow)) {
g_error("Error initializing mainWindow.");
return;
}
gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW((*mainWindow)->main_window));
gtk_widget_show_all((*mainWindow)->main_window);
api = yacos_api_new();
mainWindow_set_yacos_api(*mainWindow, api);
scanner = yacos_scanner_new();
if (!scanner) {
g_error("Error initializing scanner.");
}
g_signal_connect(scanner, "newtag",
(GCallback) mainWindow_scan_tags, (*mainWindow));
//mainWindow_scan_tags(scanner, *mainWindow); // TODO: For testing only
}
int main(int argc, char *argv[])
{
GtkApplication *app;
int status;
struct app_state app_state;
app = gtk_application_new ("net.notysyncing.yacos", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), &app_state);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}