Skip to content

Commit 3fc6585

Browse files
authored
Add support for GIRepository-2.0. (#13474)
This is needed to support cjs/mozjs 140+ and will be enabled at at build-time according to the cjs version provided. Silence some gir-2.0-related warnings.
1 parent 14c83ba commit 3fc6585

12 files changed

Lines changed: 55 additions & 21 deletions

js/misc/config.js.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ var PACKAGE_VERSION = '@PACKAGE_VERSION@';
88
var BUILT_NM_AGENT = @BUILT_NM_AGENT@;
99
/* libexec directory */
1010
var LIBEXECDIR = '@LIBEXECDIR@';
11+
12+
var USE_GIR20 = @USE_GIR20@;

meson.build

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,25 @@ dbus = dependency('dbus-1')
2525
servicedir = dbus.get_variable(pkgconfig: 'session_bus_services_dir', pkgconfig_define: ['datadir', datadir])
2626

2727
# dependencies
28-
cjs = dependency('cjs-1.0', version: '>= 4.8.0')
28+
cjs = dependency('cjs-1.0', version: '>= 115.0')
2929
clutter = dependency('muffin-clutter-0')
3030
cmenu = dependency('libcinnamon-menu-3.0', version: '>= 4.8.0')
3131
cogl = dependency('muffin-cogl-0')
3232
cogl_path = dependency('muffin-cogl-path-0')
3333
gcr = dependency('gcr-base-3', version: '>= 3.7.5')
3434
gdkx11 = dependency('gdk-x11-3.0')
35-
gi = dependency('gobject-introspection-1.0', version: '>= 0.9.2')
3635
polkit = dependency('polkit-agent-1', version: '>= 0.100')
3736
atk = dependency('atk-bridge-2.0')
3837
gio = dependency('gio-2.0', version: '>= 2.36.0')
3938
gio_unix = dependency('gio-unix-2.0')
39+
40+
use_gir20 = false
41+
if cjs.version().version_compare('>= 139.9')
42+
gi = dependency('girepository-2.0', version: '>= 2.36.0')
43+
use_gir20 = true
44+
else
45+
gi = dependency('gobject-introspection-1.0', version: '>= 0.9.2')
46+
endif
4047
gl = dependency('gl')
4148
glib_version = '2.79.2'
4249
glib = dependency('glib-2.0', version: '>= ' + glib_version)
@@ -110,6 +117,7 @@ cinnamon_conf = configuration_data()
110117
cinnamon_conf.set_quoted('VERSION', version)
111118
cinnamon_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name().to_lower())
112119
cinnamon_conf.set('BUILT_NM_AGENT', internal_nm_agent)
120+
cinnamon_conf.set10('USE_GIR20', use_gir20)
113121

114122
have_mallinfo = cc.has_function('mallinfo', prefix: '#include <malloc.h>')
115123
if have_mallinfo
@@ -209,6 +217,7 @@ config_js_conf.set('PACKAGE_NAME', meson.project_name().to_lower())
209217
config_js_conf.set('PACKAGE_VERSION', version)
210218
config_js_conf.set10('BUILT_NM_AGENT', internal_nm_agent)
211219
config_js_conf.set('LIBEXECDIR', join_paths(prefix, libexecdir))
220+
config_js_conf.set10('USE_GIR20', use_gir20)
212221

213222
configure_file(
214223
input: 'js/misc/config.js.in',
@@ -217,7 +226,6 @@ configure_file(
217226
install_dir: 'share/cinnamon/js/misc/'
218227
)
219228

220-
221229
excluded_files = []
222230
if get_option('exclude_info_settings')
223231
excluded_files += ['usr/share/applications/cinnamon-settings-info.desktop']

src/cinnamon-generic-container.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include <clutter/clutter.h>
2121
#include <gtk/gtk.h>
22-
#include <girepository.h>
2322

2423
static void cinnamon_generic_container_iface_init (ClutterContainerIface *iface);
2524

src/cinnamon-global-private.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef __CINNAMON_GLOBAL_PRIVATE_H__
33
#define __CINNAMON_GLOBAL_PRIVATE_H__
44

5+
#include "config.h"
6+
57
#include <errno.h>
68
#include <math.h>
79
#include <stdarg.h>
@@ -10,7 +12,13 @@
1012

1113
#include "cinnamon-global.h"
1214
#include <gio/gio.h>
15+
16+
#if USE_GIR20
17+
#include <girepository/girepository.h>
18+
#else
1319
#include <girepository.h>
20+
#endif
21+
1422
#include <meta/meta-plugin.h>
1523

1624

src/cinnamon-global.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
22

3-
#include "config.h"
4-
53
#include <fcntl.h>
64

75
#include "cinnamon-global-private.h"
@@ -358,7 +356,7 @@ cinnamon_global_class_init (CinnamonGlobalClass *klass)
358356
g_param_spec_object ("stage",
359357
"Stage",
360358
"Stage holding the desktop scene graph",
361-
CLUTTER_TYPE_ACTOR,
359+
CLUTTER_TYPE_STAGE,
362360
G_PARAM_READABLE));
363361
g_object_class_install_property (gobject_class,
364362
PROP_STAGE_INPUT_MODE,

src/cinnamon-tray-manager.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <clutter/clutter.h>
66
#include <clutter/x11/clutter-x11.h>
7-
#include <girepository.h>
87
#include <gtk/gtk.h>
98
#include <meta/display.h>
109
#include <meta/util.h>

src/main.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
#include <clutter/clutter.h>
1212
#include <dbus/dbus-shared.h>
1313
#include <glib/gi18n-lib.h>
14+
15+
#if USE_GIR20
16+
#include <girepository/girepository.h>
17+
#else
1418
#include <girepository.h>
19+
#endif
20+
1521
#include <meta/main.h>
1622
#include <meta/meta-plugin.h>
1723
#include <meta/prefs.h>
@@ -369,16 +375,30 @@ main (int argc, char **argv)
369375
cinnamon_a11y_init ();
370376
cinnamon_perf_log_init ();
371377

378+
#if USE_GIR20
379+
g_autoptr (GIRepository) repo = NULL;
380+
repo = gi_repository_dup_default ();
381+
382+
gi_repository_prepend_search_path (repo, CINNAMON_PKGLIBDIR);
383+
gi_repository_prepend_search_path (repo, MUFFIN_TYPELIB_DIR);
384+
#else
372385
g_irepository_prepend_search_path (CINNAMON_PKGLIBDIR);
373386
g_irepository_prepend_search_path (MUFFIN_TYPELIB_DIR);
387+
#endif
374388

375389
/* We need to explicitly add the directories where the private libraries are
376390
* installed to the GIR's library path, so that they can be found at runtime
377391
* when linking using DT_RUNPATH (instead of DT_RPATH), which is the default
378392
* for some linkers (e.g. gold) and in some distros (e.g. Debian).
379393
*/
394+
395+
#if USE_GIR20
396+
gi_repository_prepend_library_path (repo, CINNAMON_PKGLIBDIR);
397+
gi_repository_prepend_library_path (repo, MUFFIN_TYPELIB_DIR);
398+
#else
380399
g_irepository_prepend_library_path (CINNAMON_PKGLIBDIR);
381400
g_irepository_prepend_library_path (MUFFIN_TYPELIB_DIR);
401+
#endif
382402

383403
/* Disable debug spew from various libraries */
384404
g_log_set_handler ("Cvc", G_LOG_LEVEL_DEBUG,

src/st/st-entry.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,12 +1179,12 @@ st_entry_set_text (StEntry *entry,
11791179
* Returns: (transfer none): the #ClutterText used by #StEntry. The entry is
11801180
* owned by the #StEntry and should not be unref'ed by the application.
11811181
*/
1182-
ClutterActor*
1182+
ClutterText *
11831183
st_entry_get_clutter_text (StEntry *entry)
11841184
{
11851185
g_return_val_if_fail (ST_ENTRY (entry), NULL);
11861186

1187-
return entry->priv->entry;
1187+
return (ClutterText *) entry->priv->entry;
11881188
}
11891189

11901190
/**

src/st/st-entry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ StWidget * st_entry_new (const gchar *text);
6868
const gchar * st_entry_get_text (StEntry *entry);
6969
void st_entry_set_text (StEntry *entry,
7070
const gchar *text);
71-
ClutterActor* st_entry_get_clutter_text (StEntry *entry);
71+
ClutterText * st_entry_get_clutter_text (StEntry *entry);
7272

7373
void st_entry_set_hint_text (StEntry *entry,
7474
const gchar *text);

src/st/st-label.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,12 @@ st_label_set_text (StLabel *label,
388388
* Returns: (transfer none): ethe #ClutterText used by #StLabel. The label
389389
* is owned by the #StLabel and should not be unref'ed by the application.
390390
*/
391-
ClutterActor*
391+
ClutterText *
392392
st_label_get_clutter_text (StLabel *label)
393393
{
394394
g_return_val_if_fail (ST_IS_LABEL (label), NULL);
395395

396-
return label->priv->label;
396+
return (ClutterText *) label->priv->label;
397397
}
398398

399399

0 commit comments

Comments
 (0)