summaryrefslogtreecommitdiff
blob: 0ebb92c21e5d308be8d7cd486af828fa946b8ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
From 4d7c1e00e15921a0448947961183c1c124b6b49f Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
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<weak IBus.EmojiData>' to `GLib.SList<IBus.EmojiData>?'
emojier.vala:636.9-637.69: error: Assignment: Cannot convert from
`GLib.SList<weak IBus.UnicodeBlock>' to `GLib.SList<IBus.UnicodeBlock>'
panel.vala:526.36-526.65: error: Assignment: Cannot convert from
`GLib.List<weak IBus.EngineDesc>' to `GLib.List<IBus.EngineDesc>?'
---
 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 <shawn.p.huang@gmail.com>
- * Copyright (C) 2008-2013 Red Hat, Inc.
+ * Copyright (C) 2013-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * 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 <takao.fujiwara1@gmail.com>
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2017-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * 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 <takao.fujiwara1@gmail.com>
- * Copyright (C) 2018 Red Hat, Inc.
+ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * 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 <takao.fujiwara1@gmail.com>
+ * Copyright (c) 2017-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
  *
  * 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<unowned string> 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<string>' to `GLib.SList<weak string>?'
+            GLib.SList<string> 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<unowned string>? annotations =
-                data.get_annotations();
+        GLib.SList<string> 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<string> annotations = data.get_annotations();
+                GLib.SList<string> 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<string> 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));
             }
         }
     }