[gnome-builder/wip/gtk4-port: 167/1774] libide/gtk: add initialization hooks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 167/1774] libide/gtk: add initialization hooks
- Date: Mon, 11 Jul 2022 22:30:59 +0000 (UTC)
commit 2c9dc75083e1afdfa54ddbccd5992acc4a24760b
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 29 12:02:01 2022 -0700
libide/gtk: add initialization hooks
This ensures we keep some types around across static linking.
src/libide/gtk/ide-gtk-init.c | 46 ++++++++++++++++++++++++++++++++++++++++
src/libide/gtk/ide-gtk-private.h | 29 +++++++++++++++++++++++++
src/libide/gtk/meson.build | 1 +
src/main.c | 4 ++++
4 files changed, 80 insertions(+)
---
diff --git a/src/libide/gtk/ide-gtk-init.c b/src/libide/gtk/ide-gtk-init.c
new file mode 100644
index 000000000..d770789a8
--- /dev/null
+++ b/src/libide/gtk/ide-gtk-init.c
@@ -0,0 +1,46 @@
+/* ide-gtk-init.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "ide-gtk-init"
+
+#include "config.h"
+
+#include "ide-gtk-resources.h"
+
+#include "ide-animation.h"
+#include "ide-entry-popover.h"
+#include "ide-gtk-private.h"
+#include "ide-cell-renderer-fancy.h"
+#include "ide-fancy-tree-view.h"
+#include "ide-progress-icon.h"
+#include "ide-search-entry.h"
+
+void
+_ide_gtk_init (void)
+{
+ g_type_ensure (IDE_TYPE_ANIMATION);
+ g_type_ensure (IDE_TYPE_CELL_RENDERER_FANCY);
+ g_type_ensure (IDE_TYPE_ENTRY_POPOVER);
+ g_type_ensure (IDE_TYPE_FANCY_TREE_VIEW);
+ g_type_ensure (IDE_TYPE_PROGRESS_ICON);
+ g_type_ensure (IDE_TYPE_SEARCH_ENTRY);
+
+ g_resources_register (ide_gtk_get_resource ());
+}
diff --git a/src/libide/gtk/ide-gtk-private.h b/src/libide/gtk/ide-gtk-private.h
new file mode 100644
index 000000000..17f2a4c78
--- /dev/null
+++ b/src/libide/gtk/ide-gtk-private.h
@@ -0,0 +1,29 @@
+/* ide-gtk-private.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+void _ide_gtk_init (void);
+
+G_END_DECLS
diff --git a/src/libide/gtk/meson.build b/src/libide/gtk/meson.build
index 785563362..9f9d52b38 100644
--- a/src/libide/gtk/meson.build
+++ b/src/libide/gtk/meson.build
@@ -41,6 +41,7 @@ libide_gtk_public_sources = [
libide_gtk_private_sources = [
'ide-frame-source.c',
+ 'ide-gtk-init.c',
]
#
diff --git a/src/main.c b/src/main.c
index ef9b9b4ce..218fd702d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -38,6 +38,7 @@
#include "ide-application-private.h"
#include "ide-build-ident.h"
+#include "ide-gtk-private.h"
#include "ide-shell-private.h"
#include "ide-thread-private.h"
#include "ide-private.h"
@@ -283,6 +284,9 @@ main (gint argc,
/* Guess the user shell early */
_ide_guess_shell ();
+ /* Ensure availability of some symbols possibly dropped in link */
+ _ide_gtk_init ();
+
app = _ide_application_new (standalone);
g_application_add_option_group (G_APPLICATION (app), g_irepository_get_option_group ());
ret = g_application_run (G_APPLICATION (app), argc, argv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]