Merge lp:~seb128/indicator-messages/newer-libglib-deprecations into lp:indicator-messages

Proposed by Sebastien Bacher
Status: Merged
Merged at revision: 462
Proposed branch: lp:~seb128/indicator-messages/newer-libglib-deprecations
Merge into: lp:indicator-messages
Diff against target: 211 lines (+23/-28)
2 files modified
src/im-accounts-service.c (+9/-13)
src/indicator-desktop-shortcuts.c (+14/-15)
To merge this branch: bzr merge lp:~seb128/indicator-messages/newer-libglib-deprecations
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Iain Lane Needs Fixing
Review via email: mp+372751@code.launchpad.net

Commit message

* src/im-accounts-service.c, src/indicator-desktop-shortcuts.c:
  - don't use deprecated g_type_class_add_private, fix the build with the
   current libglib version

Description of the change

* src/im-accounts-service.c, src/indicator-desktop-shortcuts.c:
  - don't use deprecated g_type_class_add_private, fix the build with the
   current libglib version

the castings were added to fix those warnings/errors

indicator-desktop-shortcuts.c:72:56: note: expected 'IndicatorDesktopShortcuts * {aka struct _IndicatorDesktopShortcuts *}' but argument is of type 'GObject * {aka struct _GObject *}'
 G_DEFINE_TYPE_WITH_PRIVATE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

Thanks for fixing this. Mostly good, but just one comment about the proper (GLib) way to do those casts, then feel free to land this yourself. :)

review: Needs Fixing
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, casting and lines split updated, I'm going to merge&upload

review: Approve
462. By Sebastien Bacher

Update casting and line wrapping according to review

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/im-accounts-service.c'
2--- src/im-accounts-service.c 2018-09-17 09:37:27 +0000
3+++ src/im-accounts-service.c 2019-09-13 09:39:06 +0000
4@@ -33,9 +33,6 @@
5 GCancellable * cancel;
6 };
7
8-#define IM_ACCOUNTS_SERVICE_GET_PRIVATE(o) \
9-(G_TYPE_INSTANCE_GET_PRIVATE ((o), IM_ACCOUNTS_SERVICE_TYPE, ImAccountsServicePrivate))
10-
11 static void im_accounts_service_class_init (ImAccountsServiceClass *klass);
12 static void im_accounts_service_init (ImAccountsService *self);
13 static void im_accounts_service_dispose (GObject *object);
14@@ -44,15 +41,13 @@
15 static void on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data);
16 static void security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data);
17
18-G_DEFINE_TYPE (ImAccountsService, im_accounts_service, G_TYPE_OBJECT);
19+G_DEFINE_TYPE_WITH_PRIVATE (ImAccountsService, im_accounts_service, G_TYPE_OBJECT);
20
21 static void
22 im_accounts_service_class_init (ImAccountsServiceClass *klass)
23 {
24 GObjectClass *object_class = G_OBJECT_CLASS (klass);
25
26- g_type_class_add_private (klass, sizeof (ImAccountsServicePrivate));
27-
28 object_class->dispose = im_accounts_service_dispose;
29 object_class->finalize = im_accounts_service_finalize;
30 }
31@@ -60,7 +55,7 @@
32 static void
33 im_accounts_service_init (ImAccountsService *self)
34 {
35- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(self);
36+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
37
38 priv->cancel = g_cancellable_new();
39
40@@ -78,7 +73,8 @@
41 static void
42 im_accounts_service_dispose (GObject *object)
43 {
44- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(object);
45+ ImAccountsService *service = IM_ACCOUNTS_SERVICE(object);
46+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(service);
47
48 if (priv->cancel != NULL) {
49 g_cancellable_cancel(priv->cancel);
50@@ -104,7 +100,7 @@
51 return;
52 }
53
54- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
55+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(user_data);
56 g_debug("User Updated");
57
58 /* Clear old proxies */
59@@ -135,7 +131,7 @@
60 return;
61 }
62
63- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
64+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(user_data);
65 /* Ensure we didn't get a proxy while we weren't looking */
66 g_clear_object(&priv->touch_settings);
67 priv->touch_settings = proxy;
68@@ -146,7 +142,7 @@
69 static void
70 on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data)
71 {
72- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
73+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(user_data);
74 ActUser * user = NULL;
75
76 g_debug("Accounts Manager Loaded");
77@@ -180,7 +176,7 @@
78 im_accounts_service_set_draws_attention (ImAccountsService * service, gboolean draws_attention)
79 {
80 g_return_if_fail(IM_IS_ACCOUNTS_SERVICE(service));
81- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(service);
82+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(service);
83
84 if (priv->touch_settings == NULL) {
85 return;
86@@ -206,7 +202,7 @@
87 {
88 g_return_val_if_fail(IM_IS_ACCOUNTS_SERVICE(service), FALSE);
89
90- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(service);
91+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(service);
92
93 if (priv->touch_settings == NULL) {
94 return FALSE;
95
96=== modified file 'src/indicator-desktop-shortcuts.c'
97--- src/indicator-desktop-shortcuts.c 2013-08-20 16:31:19 +0000
98+++ src/indicator-desktop-shortcuts.c 2019-09-13 09:39:06 +0000
99@@ -60,9 +60,6 @@
100 PROP_IDENTITY
101 };
102
103-#define INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(o) \
104- (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcutsPrivate))
105-
106 static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass);
107 static void indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self);
108 static void indicator_desktop_shortcuts_dispose (GObject *object);
109@@ -72,7 +69,7 @@
110 static void parse_keyfile (IndicatorDesktopShortcuts * ids);
111 static gboolean should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target);
112
113-G_DEFINE_TYPE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);
114+G_DEFINE_TYPE_WITH_PRIVATE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);
115
116 /* Build up the class */
117 static void
118@@ -80,8 +77,6 @@
119 {
120 GObjectClass *object_class = G_OBJECT_CLASS (klass);
121
122- g_type_class_add_private (klass, sizeof (IndicatorDesktopShortcutsPrivate));
123-
124 object_class->dispose = indicator_desktop_shortcuts_dispose;
125 object_class->finalize = indicator_desktop_shortcuts_finalize;
126
127@@ -109,7 +104,7 @@
128 static void
129 indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self)
130 {
131- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(self);
132+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
133
134 priv->keyfile = NULL;
135 priv->identity = NULL;
136@@ -124,7 +119,8 @@
137 static void
138 indicator_desktop_shortcuts_dispose (GObject *object)
139 {
140- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
141+ IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
142+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
143
144 if (priv->keyfile) {
145 g_key_file_free(priv->keyfile);
146@@ -139,7 +135,8 @@
147 static void
148 indicator_desktop_shortcuts_finalize (GObject *object)
149 {
150- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
151+ IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
152+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
153
154 if (priv->identity != NULL) {
155 g_free(priv->identity);
156@@ -170,7 +167,8 @@
157 set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
158 {
159 g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
160- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
161+ IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
162+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
163
164 switch(prop_id) {
165 case PROP_DESKTOP_FILE: {
166@@ -233,7 +231,8 @@
167 get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
168 {
169 g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
170- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
171+ IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
172+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
173
174 switch(prop_id) {
175 case PROP_IDENTITY:
176@@ -253,7 +252,7 @@
177 static void
178 parse_keyfile (IndicatorDesktopShortcuts * ids)
179 {
180- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
181+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
182
183 if (priv->keyfile == NULL) {
184 return;
185@@ -475,7 +474,7 @@
186 indicator_desktop_shortcuts_get_nicks (IndicatorDesktopShortcuts * ids)
187 {
188 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
189- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
190+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
191 return (const gchar **)priv->nicks->data;
192 }
193
194@@ -497,7 +496,7 @@
195 indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, const gchar * nick)
196 {
197 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
198- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
199+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
200
201 g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL);
202 g_return_val_if_fail(priv->keyfile != NULL, NULL);
203@@ -573,7 +572,7 @@
204 GError * error = NULL;
205
206 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE);
207- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
208+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
209
210 g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE);
211 g_return_val_if_fail(priv->keyfile != NULL, FALSE);

Subscribers

People subscribed via source and target branches