frontend: Start skeleton for a proper GObject derived LsiSettingsWindow

We can't properly track state within a big ugly main() function, so let's
start breaking it up into a proper object.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
Ikey Doherty
2017-11-05 17:22:06 +00:00
parent 8684a992b0
commit 84a4dd59a9
3 changed files with 131 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016-2017 Ikey Doherty <ikey@solus-project.com>
*
* linux-steam-integration 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 2.1
* of the License, or (at your option) any later version.
*/
#define _GNU_SOURCE
#include "main-window.h"
struct _LsiSettingsWindow {
GtkWindow parent;
int __reserved1;
};
struct _LsiSettingsWindowClass {
GtkWindowClass parent_class;
};
G_DEFINE_TYPE(LsiSettingsWindow, lsi_settings_window, GTK_TYPE_WINDOW)
/**
* lsi_settings_window_new:
*
* Construct a new LsiSettingsWindow object
*/
GtkWidget *lsi_settings_window_new()
{
return g_object_new(LSI_TYPE_SETTINGS_WINDOW, "type", GTK_WINDOW_TOPLEVEL, NULL);
}
/**
* lsi_settings_window_dispose:
*
* Clean up a LsiSettingsWindow instance
*/
static void lsi_settings_window_dispose(GObject *obj)
{
G_OBJECT_CLASS(lsi_settings_window_parent_class)->dispose(obj);
}
/**
* lsi_settings_window_class_init:
*
* Handle class initialisation
*/
static void lsi_settings_window_class_init(LsiSettingsWindowClass *klazz)
{
GObjectClass *obj_class = G_OBJECT_CLASS(klazz);
/* gobject vtable hookup */
obj_class->dispose = lsi_settings_window_dispose;
}
/**
* lsi_settings_window_init:
*
* Handle construction of the LsiSettingsWindow
*/
static void lsi_settings_window_init(LsiSettingsWindow *self)
{
/* TODO: Just about anything */
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=8 tabstop=8 expandtab:
* :indentSize=8:tabSize=8:noTabs=true:
*/
+49
View File
@@ -0,0 +1,49 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016-2017 Ikey Doherty <ikey@solus-project.com>
*
* linux-steam-integration 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 2.1
* of the License, or (at your option) any later version.
*/
#pragma once
#include <glib-object.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
typedef struct _LsiSettingsWindow LsiSettingsWindow;
typedef struct _LsiSettingsWindowClass LsiSettingsWindowClass;
#define LSI_TYPE_SETTINGS_WINDOW lsi_settings_window_get_type()
#define LSI_SETTINGS_WINDOW(o) \
(G_TYPE_CHECK_INSTANCE_CAST((o), LSI_TYPE_SETTINGS_WINDOW, LsiSettingsWindow))
#define LSI_IS_SETTINGS_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), LSI_TYPE_SETTINGS_WINDOW))
#define LSI_SETTINGS_WINDOW_CLASS(o) \
(G_TYPE_CHECK_CLASS_CAST((o), LSI_TYPE_SETTINGS_WINDOW, LsiSettingsWindowClass))
#define LSI_IS_SETTINGS_WINDOW_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), LSI_TYPE_SETTINGS_WINDOW))
#define LSI_SETTINGS_WINDOW_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), LSI_TYPE_SETTINGS_WINDOW, LsiSettingsWindowClass))
GtkWidget *lsi_settings_window_new(void);
GType lsi_settings_window_get_type(void);
G_END_DECLS
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=8 tabstop=8 expandtab:
* :indentSize=8:tabSize=8:noTabs=true:
*/
+1
View File
@@ -3,6 +3,7 @@ if with_frontend == true
frontend_sources = [
'main.c',
'main-window.c',
]
frontend = executable(