Skip to content
Snippets Groups Projects
Commit 79dfe39e authored by Bruce Cowan's avatar Bruce Cowan
Browse files

Remove RugbyApplication

parent 114b9259
No related branches found
No related tags found
No related merge requests found
/* 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);
}
......@@ -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',
......
......@@ -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);
}
......@@ -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
/* 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
/* 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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment