clapper-app: Ensure private types for GtkBuilder

We need to ensure types that are not part of public API, otherwise GtkBuilder will fail to use them
(e81aad25a1/gtk/glade/README.glade (L15)).
This commit is contained in:
Rafał Dzięgiel
2024-06-16 15:21:16 +02:00
parent 6ca1bccd1a
commit 262983e857
4 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
/* Clapper Application
* Copyright (C) 2024 Rafał Dzięgiel <rafostar.github@gmail.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 <https://www.gnu.org/licenses/>.
*/
#include "clapper-app-types.h"
#include "clapper-app-headerbar.h"
#include "clapper-app-media-item-box.h"
#include "clapper-app-property-row.h"
#include "clapper-app-queue-list.h"
#include "clapper-app-queue-progression-model.h"
#include "clapper-app-window-state-buttons.h"
/*
* clapper_app_types_init:
*
* Ensure private types that appear in UI files in order for
* GtkBuilder to be able to find them when building templates.
*/
inline void
clapper_app_types_init (void)
{
g_type_ensure (CLAPPER_APP_TYPE_HEADERBAR);
g_type_ensure (CLAPPER_APP_TYPE_MEDIA_ITEM_BOX);
g_type_ensure (CLAPPER_APP_TYPE_PROPERTY_ROW);
g_type_ensure (CLAPPER_APP_TYPE_QUEUE_LIST);
g_type_ensure (CLAPPER_APP_TYPE_QUEUE_PROGRESSION_MODEL);
g_type_ensure (CLAPPER_APP_TYPE_WINDOW_STATE_BUTTONS);
}

View File

@@ -0,0 +1,27 @@
/* Clapper Application
* Copyright (C) 2024 Rafał Dzięgiel <rafostar.github@gmail.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 <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib.h>
G_BEGIN_DECLS
G_GNUC_INTERNAL
void clapper_app_types_init (void);
G_END_DECLS

View File

@@ -25,6 +25,7 @@
#include <clapper/clapper.h>
#include "clapper-app-application.h"
#include "clapper-app-types.h"
gint
main (gint argc, gchar **argv)
@@ -46,6 +47,8 @@ main (gint argc, gchar **argv)
gtk_init ();
adw_init ();
clapper_app_types_init ();
g_set_application_name ("Clapper");
application = clapper_app_application_new ();

View File

@@ -67,6 +67,7 @@ clapperapp_sources = [
'clapper-app-queue-progression-item.c',
'clapper-app-queue-progression-model.c',
'clapper-app-queue-selection.c',
'clapper-app-types.c',
'clapper-app-uri-dialog.c',
'clapper-app-utils.c',
'clapper-app-window.c',