diff --git a/src/rugby-application.c b/src/main.c similarity index 75% rename from src/rugby-application.c rename to src/main.c index 0081d9a0faac5688d74d45a749fa15ae83d3253b..70d0266378563659c07b32f945de019ec39353d8 100644 --- a/src/rugby-application.c +++ b/src/main.c @@ -1,6 +1,6 @@ -/* rugby-application.c +/* main.c * - * Copyright © 2012, 2016, 2017 Bruce Cowan <bruce@bcowan.eu> + * Copyright © 2012, 2016-2018 Bruce Cowan <bruce@bcowan.eu> * * This file is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as @@ -18,20 +18,13 @@ #include <gtk/gtk.h> -#include "rugby-application.h" #include "rugby-app-window.h" -struct _RugbyApplication -{ - GtkApplication parent; -}; - -G_DEFINE_TYPE (RugbyApplication, rugby_application, GTK_TYPE_APPLICATION) - static void -rugby_application_activate (GApplication *app) +on_activate (GApplication *app, + gpointer user_data) { - RugbyAppWindow *win = rugby_app_window_new (RUGBY_APPLICATION (app)); + RugbyAppWindow *win = rugby_app_window_new (GTK_APPLICATION (app)); gtk_window_present (GTK_WINDOW (win)); } @@ -69,7 +62,8 @@ quit_activated (GSimpleAction *simple, } static void -rugby_application_startup (GApplication *app) +on_startup (GApplication *app, + gpointer user_data) { const GActionEntry app_entries[] = { @@ -77,8 +71,6 @@ rugby_application_startup (GApplication *app) { "quit", quit_activated } }; - G_APPLICATION_CLASS (rugby_application_parent_class)->startup (app); - g_action_map_add_action_entries (G_ACTION_MAP (app), app_entries, G_N_ELEMENTS (app_entries), @@ -97,24 +89,16 @@ rugby_application_startup (GApplication *app) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } -static void -rugby_application_class_init (RugbyApplicationClass *klass) +int +main (int argc, + char **argv) { - GApplicationClass *app_class = G_APPLICATION_CLASS (klass); + GtkApplication *app = gtk_application_new ("uk.me.bcowan.rugby", G_APPLICATION_FLAGS_NONE); - app_class->activate = rugby_application_activate; - app_class->startup = rugby_application_startup; -} + g_signal_connect (app, "startup", + G_CALLBACK(on_startup), NULL); + g_signal_connect (app, "activate", + G_CALLBACK (on_activate), NULL); -static void -rugby_application_init (RugbyApplication *self) -{ -} - -RugbyApplication * -rugby_application_new (void) -{ - return g_object_new (RUGBY_TYPE_APPLICATION, - "application-id", "uk.me.bcowan.rugby", - NULL); + return g_application_run (G_APPLICATION (app), argc, argv); } diff --git a/src/meson.build b/src/meson.build index 7fff179aa2affd14b3d7ecda5c9a0cc47607c6f1..fbe94bbbd1c618c458cb26bd88b30494ec23b8f0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -8,8 +8,7 @@ conf.set('KICK_POINTS', get_option('kick_points')) config_h = configure_file(configuration: conf, output: 'config.h') sources = files( - 'rugby.c', - 'rugby-application.c', + 'main.c', 'rugby-app-window.c', 'rugby-list-store.c', 'rugby-possibility.c', diff --git a/src/rugby-app-window.c b/src/rugby-app-window.c index 32af8db411294f45aa13ba9200a022c0c7b29524..89da10028c8ca6ca57f4f79954a76c7436129677 100644 --- a/src/rugby-app-window.c +++ b/src/rugby-app-window.c @@ -19,7 +19,6 @@ #include <gtk/gtk.h> #include "config.h" -#include "rugby-application.h" #include "rugby-app-window.h" #include "rugby-list-store.h" #include "rugby-possibility.h" @@ -134,7 +133,9 @@ rugby_app_window_class_init (RugbyAppWindowClass *klass) } RugbyAppWindow * -rugby_app_window_new (RugbyApplication *app) +rugby_app_window_new (GtkApplication *app) { - return g_object_new (RUGBY_TYPE_APP_WINDOW, "application", app, NULL); + return g_object_new (RUGBY_TYPE_APP_WINDOW, + "application", app, + NULL); } diff --git a/src/rugby-app-window.h b/src/rugby-app-window.h index 70af6de01b22c0f0b4a69bb142c3be67e84d5d11..b9ac69cbd6ad5cf5d535564a5d38194f8197c1f3 100644 --- a/src/rugby-app-window.h +++ b/src/rugby-app-window.h @@ -26,6 +26,6 @@ G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (RugbyAppWindow, rugby_app_window, RUGBY, APP_WINDOW, GtkApplicationWindow); -RugbyAppWindow *rugby_app_window_new (RugbyApplication *app); +RugbyAppWindow *rugby_app_window_new (GtkApplication *app); G_END_DECLS diff --git a/src/rugby-application.h b/src/rugby-application.h deleted file mode 100644 index 2adb6060e8829af20985b69fc0fd7d5063d181ca..0000000000000000000000000000000000000000 --- a/src/rugby-application.h +++ /dev/null @@ -1,30 +0,0 @@ -/* rugby-application.h - * - * Copyright © 2012, 2016 Bruce Cowan <bruce@bcowan.eu> - * - * This file is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define RUGBY_TYPE_APPLICATION rugby_application_get_type () -G_DECLARE_FINAL_TYPE (RugbyApplication, rugby_application, RUGBY, APPLICATION, GtkApplication) - -RugbyApplication * rugby_application_new (void); - -G_END_DECLS diff --git a/src/rugby.c b/src/rugby.c deleted file mode 100644 index 06678980553aaf2ef0c3b4b5d12ddff220f2875f..0000000000000000000000000000000000000000 --- a/src/rugby.c +++ /dev/null @@ -1,32 +0,0 @@ -/* rugby.c - * - * Copyright © 2012 Bruce Cowan <bruce@bcowan.eu> - * - * This file is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "rugby-application.h" - -int -main (int argc, - char **argv) -{ - RugbyApplication *app; - gint retval; - - app = rugby_application_new (); - retval = g_application_run (G_APPLICATION (app), argc, argv); - - return retval; -}