diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 51 |
1 files changed, 0 insertions, 51 deletions
@@ -1,51 +0,0 @@ -#include "file.h" -#include "image.h" -#include "input.h" -#include "window.h" -#include <gtk-3.0/gtk/gtk.h> - -void print_help() -{ - printf("usage: qwe [filename]\n"); -} - -static void activate(GtkApplication *app, gpointer user_data) -{ - print_help(); -} - -static void open(GApplication *app, GFile **files, gint n_files, - const gchar *hint) -{ - if (n_files != 1) { - print_help(); - return; - } - - create_main_window(app); - - char *curr_filename = g_file_get_path(files[0]); - int i = scan(curr_filename); - if (i < 0) { - printf("failed to load file\n"); - return; - } - - i = load_image(curr_filename); - if (i < 0) { - printf("failed to load file\n"); - quit(); - } -} - -int main(int argc, char *argv[]) -{ - GtkApplication *app; - int status; - app = gtk_application_new("org.gtk.qwe", G_APPLICATION_HANDLES_OPEN); - g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); - g_signal_connect(app, "open", G_CALLBACK(open), NULL); - status = g_application_run(G_APPLICATION(app), argc, argv); - g_object_unref(app); - return status; -} |