From 4d7c1e00e15921a0448947961183c1c124b6b49f Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 29 Jan 2019 17:57:16 +0900 Subject: [PATCH] Delete weak pointer in GList.SList for vala 0.43.4 Vala 0.43.4 does not allow to convert a weak pointer to the full one in SList. emojier.vala:424.36-425.73: error: Assignment: Cannot convert from `GLib.SList' to `GLib.SList?' emojier.vala:636.9-637.69: error: Assignment: Cannot convert from `GLib.SList' to `GLib.SList' panel.vala:526.36-526.65: error: Assignment: Cannot convert from `GLib.List' to `GLib.List?' --- src/ibusbus.h | 11 ++++++----- src/ibusemoji.h | 6 +++--- src/ibusunicode.h | 8 ++++---- ui/gtk3/emojier.vala | 24 ++++++++++++++++-------- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/ibusbus.h b/src/ibusbus.h index dff3dfb7..fddcf5b2 100644 --- a/src/ibusbus.h +++ b/src/ibusbus.h @@ -2,7 +2,8 @@ /* vim:set et sts=4: */ /* ibus - The Input Bus * Copyright (C) 2008-2013 Peng Huang - * Copyright (C) 2008-2013 Red Hat, Inc. + * Copyright (C) 2013-2019 Takao Fujiwara + * Copyright (C) 2008-2019 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -692,7 +693,7 @@ gboolean ibus_bus_register_component_async_finish * * List engines synchronously. * - * Returns: (transfer container) (element-type IBusEngineDesc): + * Returns: (transfer full) (element-type IBusEngineDesc): * A List of engines. */ GList *ibus_bus_list_engines (IBusBus *bus); @@ -725,7 +726,7 @@ void ibus_bus_list_engines_async * * Finishes an operation started with ibus_bus_list_engines_async(). * - * Returns: (transfer container) (element-type IBusEngineDesc): + * Returns: (transfer full) (element-type IBusEngineDesc): * A List of engines. */ GList *ibus_bus_list_engines_async_finish @@ -740,7 +741,7 @@ GList *ibus_bus_list_engines_async_finish * * List active engines synchronously. * - * Returns: (transfer container) (element-type IBusEngineDesc): + * Returns: (transfer full) (element-type IBusEngineDesc): * A List of active engines. * * Deprecated: 1.5.3: Read dconf value @@ -782,7 +783,7 @@ void ibus_bus_list_active_engines_async * * Finishes an operation started with ibus_bus_list_active_engines_async(). * - * Returns: (transfer container) (element-type IBusEngineDesc): + * Returns: (transfer full) (element-type IBusEngineDesc): * A List of active engines. * * Deprecated: 1.5.3: Read dconf value diff --git a/src/ibusemoji.h b/src/ibusemoji.h index 4edee726..5e9fbcf4 100644 --- a/src/ibusemoji.h +++ b/src/ibusemoji.h @@ -1,8 +1,8 @@ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ /* vim:set et sts=4: */ /* bus - The Input Bus - * Copyright (C) 2017 Takao Fujiwara - * Copyright (C) 2017 Red Hat, Inc. + * Copyright (C) 2017-2019 Takao Fujiwara + * Copyright (C) 2017-2019 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -209,7 +209,7 @@ void ibus_emoji_data_save (const gchar *path, * ibus_emoji_data_load: * @path: A path of the saved dictionary file. * - * Returns: (element-type IBusEmojiData) (transfer container): + * Returns: (element-type IBusEmojiData) (transfer full): * An #IBusEmojiData list loaded from the saved cache file. */ GSList * ibus_emoji_data_load (const gchar *path); diff --git a/src/ibusunicode.h b/src/ibusunicode.h index 99de9451..473bdb19 100644 --- a/src/ibusunicode.h +++ b/src/ibusunicode.h @@ -1,8 +1,8 @@ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ /* vim:set et sts=4: */ /* bus - The Input Bus - * Copyright (C) 2018 Takao Fujiwara - * Copyright (C) 2018 Red Hat, Inc. + * Copyright (C) 2018-2019 Takao Fujiwara + * Copyright (C) 2018-2019 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -201,7 +201,7 @@ void ibus_unicode_data_save (const gchar *path, * #IBusUnicodeData, * the total number of #IBusUnicodeData) of uint values * with that signal by 100 times. Otherwise %NULL. * - * Returns: (element-type IBusUnicodeData) (transfer container): + * Returns: (element-type IBusUnicodeData) (transfer full): * An #IBusUnicodeData list loaded from the saved cache file. */ GSList * ibus_unicode_data_load (const gchar *path, @@ -290,7 +290,7 @@ void ibus_unicode_block_save (const gchar *path, * ibus_unicode_block_load: * @path: A path of the saved dictionary file. * - * Returns: (element-type IBusUnicodeBlock) (transfer container): + * Returns: (element-type IBusUnicodeBlock) (transfer full): * An #IBusUnicodeBlock list loaded from the saved cache file. */ GSList * ibus_unicode_block_load (const gchar *path); diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala index 0b9b54a9..aedeb4cb 100644 --- a/ui/gtk3/emojier.vala +++ b/ui/gtk3/emojier.vala @@ -2,7 +2,7 @@ * * ibus - The Input Bus * - * Copyright (c) 2017-2018 Takao Fujiwara + * Copyright (c) 2017-2019 Takao Fujiwara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -882,8 +882,13 @@ public class IBusEmojier : Gtk.ApplicationWindow { update_unicode_blocks(); return; } else { - unowned GLib.SList emojis = - m_category_to_emojis_dict.lookup(category); + // Use copy_deep() since vala 0.43.4 does not allow to assign + // a weak pointer to the full one in SList: + // emojier.vala:885.48-886.62: error: Assignment: Cannot convert + // from `GLib.SList' to `GLib.SList?' + GLib.SList emojis = + m_category_to_emojis_dict.lookup(category).copy_deep( + GLib.strdup); m_lookup_table.clear(); m_candidate_panel_mode = true; foreach (unowned string emoji in emojis) { @@ -1547,8 +1552,8 @@ public class IBusEmojier : Gtk.ApplicationWindow { m_vbox.add(widget); widget.show_all(); } - unowned GLib.SList? annotations = - data.get_annotations(); + GLib.SList annotations = + data.get_annotations().copy_deep(GLib.strdup); var buff = new GLib.StringBuilder(); int i = 0; foreach (unowned string annotation in annotations) { @@ -2001,17 +2006,20 @@ public class IBusEmojier : Gtk.ApplicationWindow { ) as IBus.EmojiData; m_emoji_to_data_dict.insert(favorite, new_data); } else { - unowned GLib.SList annotations = data.get_annotations(); + GLib.SList annotations = + data.get_annotations().copy_deep(GLib.strdup); if (annotations.find_custom(annotation, GLib.strcmp) == null) { annotations.append(annotation); - data.set_annotations(annotations.copy()); + data.set_annotations(annotations.copy_deep(GLib.strdup)); } } unowned GLib.SList emojis = m_annotation_to_emojis_dict.lookup(annotation); if (emojis.find_custom(favorite, GLib.strcmp) == null) { emojis.append(favorite); - m_annotation_to_emojis_dict.replace(annotation, emojis.copy()); + m_annotation_to_emojis_dict.replace( + annotation, + emojis.copy_deep(GLib.strdup)); } } }