panel-loader: Define vtable struct in the header

We will allow test panels to be added, so the vtable must
be overridable. The first step into making it overridable
is exposing the actual vtable struct.
This commit is contained in:
Georges Basile Stavracas Neto 2018-11-07 20:03:11 -02:00
parent 9d88b84788
commit 6a50a21f40
No known key found for this signature in database
GPG key ID: 886C17EE170D1385
2 changed files with 14 additions and 7 deletions

View file

@ -80,13 +80,8 @@ extern void cc_wacom_panel_static_init_func (void);
#endif
static struct {
const char *name;
#ifndef CC_PANEL_LOADER_NO_GTYPES
GType (*get_type)(void);
CcPanelStaticInitFunc static_init_func;
#endif
} all_panels[] = {
static CcPanelLoaderVtable all_panels[] =
{
PANEL_TYPE("background", cc_background_panel_get_type, NULL),
#ifdef BUILD_BLUETOOTH
PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),

View file

@ -20,6 +20,8 @@
#pragma once
#include "config.h"
#include <glib.h>
#include <glib-object.h>
#include <shell/cc-panel.h>
@ -27,6 +29,16 @@
G_BEGIN_DECLS
typedef struct
{
const gchar *name;
#ifndef CC_PANEL_LOADER_NO_GTYPES
GType (*get_type)(void);
CcPanelStaticInitFunc static_init_func;
#endif
} CcPanelLoaderVtable;
void cc_panel_loader_fill_model (CcShellModel *model);
GList *cc_panel_loader_get_panels (void);
CcPanel *cc_panel_loader_load_by_name (CcShell *shell,