[gnome-control-center/gbsneto/interactive-test-panels: 25/34] panel-loader: Define vtable struct in the header
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gbsneto/interactive-test-panels: 25/34] panel-loader: Define vtable struct in the header
- Date: Fri, 9 Nov 2018 23:48:36 +0000 (UTC)
commit 0d6c90d0ec5c3a4a8c1ee515042f3fd24a1554e1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Nov 7 20:03:11 2018 -0200
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.
shell/cc-panel-loader.c | 9 ++-------
shell/cc-panel-loader.h | 12 ++++++++++++
2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 02c94113b..845de37bf 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -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),
diff --git a/shell/cc-panel-loader.h b/shell/cc-panel-loader.h
index fd0b9f96a..84feee549 100644
--- a/shell/cc-panel-loader.h
+++ b/shell/cc-panel-loader.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]