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
=== modified file 'src/im-accounts-service.c'
--- src/im-accounts-service.c 2018-09-17 09:37:27 +0000
+++ src/im-accounts-service.c 2019-09-13 09:39:06 +0000
@@ -33,9 +33,6 @@
33 GCancellable * cancel;33 GCancellable * cancel;
34};34};
3535
36#define IM_ACCOUNTS_SERVICE_GET_PRIVATE(o) \
37(G_TYPE_INSTANCE_GET_PRIVATE ((o), IM_ACCOUNTS_SERVICE_TYPE, ImAccountsServicePrivate))
38
39static void im_accounts_service_class_init (ImAccountsServiceClass *klass);36static void im_accounts_service_class_init (ImAccountsServiceClass *klass);
40static void im_accounts_service_init (ImAccountsService *self);37static void im_accounts_service_init (ImAccountsService *self);
41static void im_accounts_service_dispose (GObject *object);38static void im_accounts_service_dispose (GObject *object);
@@ -44,15 +41,13 @@
44static void on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data);41static void on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data);
45static void security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data);42static void security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data);
4643
47G_DEFINE_TYPE (ImAccountsService, im_accounts_service, G_TYPE_OBJECT);44G_DEFINE_TYPE_WITH_PRIVATE (ImAccountsService, im_accounts_service, G_TYPE_OBJECT);
4845
49static void46static void
50im_accounts_service_class_init (ImAccountsServiceClass *klass)47im_accounts_service_class_init (ImAccountsServiceClass *klass)
51{48{
52 GObjectClass *object_class = G_OBJECT_CLASS (klass);49 GObjectClass *object_class = G_OBJECT_CLASS (klass);
5350
54 g_type_class_add_private (klass, sizeof (ImAccountsServicePrivate));
55
56 object_class->dispose = im_accounts_service_dispose;51 object_class->dispose = im_accounts_service_dispose;
57 object_class->finalize = im_accounts_service_finalize;52 object_class->finalize = im_accounts_service_finalize;
58}53}
@@ -60,7 +55,7 @@
60static void55static void
61im_accounts_service_init (ImAccountsService *self)56im_accounts_service_init (ImAccountsService *self)
62{57{
63 ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(self);58 ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
6459
65 priv->cancel = g_cancellable_new();60 priv->cancel = g_cancellable_new();
6661
@@ -78,7 +73,8 @@
78static void73static void
79im_accounts_service_dispose (GObject *object)74im_accounts_service_dispose (GObject *object)
80{75{
81 ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(object);76 ImAccountsService *service = IM_ACCOUNTS_SERVICE(object);
77 ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(service);
8278
83 if (priv->cancel != NULL) {79 if (priv->cancel != NULL) {
84 g_cancellable_cancel(priv->cancel);80 g_cancellable_cancel(priv->cancel);
@@ -104,7 +100,7 @@
104 return;100 return;
105 }101 }
106102
107 ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);103 ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(user_data);
108 g_debug("User Updated");104 g_debug("User Updated");
109105
110 /* Clear old proxies */106 /* Clear old proxies */
@@ -135,7 +131,7 @@
135 return;131 return;
136 }132 }
137133
138 ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);134 ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(user_data);
139 /* Ensure we didn't get a proxy while we weren't looking */135 /* Ensure we didn't get a proxy while we weren't looking */
140 g_clear_object(&priv->touch_settings);136 g_clear_object(&priv->touch_settings);
141 priv->touch_settings = proxy;137 priv->touch_settings = proxy;
@@ -146,7 +142,7 @@
146static void142static void
147on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data)143on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data)
148{144{
149 ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);145 ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(user_data);
150 ActUser * user = NULL;146 ActUser * user = NULL;
151147
152 g_debug("Accounts Manager Loaded");148 g_debug("Accounts Manager Loaded");
@@ -180,7 +176,7 @@
180im_accounts_service_set_draws_attention (ImAccountsService * service, gboolean draws_attention)176im_accounts_service_set_draws_attention (ImAccountsService * service, gboolean draws_attention)
181{177{
182 g_return_if_fail(IM_IS_ACCOUNTS_SERVICE(service));178 g_return_if_fail(IM_IS_ACCOUNTS_SERVICE(service));
183 ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(service);179 ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(service);
184180
185 if (priv->touch_settings == NULL) {181 if (priv->touch_settings == NULL) {
186 return;182 return;
@@ -206,7 +202,7 @@
206{202{
207 g_return_val_if_fail(IM_IS_ACCOUNTS_SERVICE(service), FALSE);203 g_return_val_if_fail(IM_IS_ACCOUNTS_SERVICE(service), FALSE);
208204
209 ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(service);205 ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(service);
210206
211 if (priv->touch_settings == NULL) {207 if (priv->touch_settings == NULL) {
212 return FALSE;208 return FALSE;
213209
=== modified file 'src/indicator-desktop-shortcuts.c'
--- src/indicator-desktop-shortcuts.c 2013-08-20 16:31:19 +0000
+++ src/indicator-desktop-shortcuts.c 2019-09-13 09:39:06 +0000
@@ -60,9 +60,6 @@
60 PROP_IDENTITY60 PROP_IDENTITY
61};61};
6262
63#define INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(o) \
64 (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcutsPrivate))
65
66static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass);63static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass);
67static void indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self);64static void indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self);
68static void indicator_desktop_shortcuts_dispose (GObject *object);65static void indicator_desktop_shortcuts_dispose (GObject *object);
@@ -72,7 +69,7 @@
72static void parse_keyfile (IndicatorDesktopShortcuts * ids);69static void parse_keyfile (IndicatorDesktopShortcuts * ids);
73static gboolean should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target);70static gboolean should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target);
7471
75G_DEFINE_TYPE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);72G_DEFINE_TYPE_WITH_PRIVATE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);
7673
77/* Build up the class */74/* Build up the class */
78static void75static void
@@ -80,8 +77,6 @@
80{77{
81 GObjectClass *object_class = G_OBJECT_CLASS (klass);78 GObjectClass *object_class = G_OBJECT_CLASS (klass);
8279
83 g_type_class_add_private (klass, sizeof (IndicatorDesktopShortcutsPrivate));
84
85 object_class->dispose = indicator_desktop_shortcuts_dispose;80 object_class->dispose = indicator_desktop_shortcuts_dispose;
86 object_class->finalize = indicator_desktop_shortcuts_finalize;81 object_class->finalize = indicator_desktop_shortcuts_finalize;
8782
@@ -109,7 +104,7 @@
109static void104static void
110indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self)105indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self)
111{106{
112 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(self);107 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
113108
114 priv->keyfile = NULL;109 priv->keyfile = NULL;
115 priv->identity = NULL;110 priv->identity = NULL;
@@ -124,7 +119,8 @@
124static void119static void
125indicator_desktop_shortcuts_dispose (GObject *object)120indicator_desktop_shortcuts_dispose (GObject *object)
126{121{
127 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);122 IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
123 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
128124
129 if (priv->keyfile) {125 if (priv->keyfile) {
130 g_key_file_free(priv->keyfile);126 g_key_file_free(priv->keyfile);
@@ -139,7 +135,8 @@
139static void135static void
140indicator_desktop_shortcuts_finalize (GObject *object)136indicator_desktop_shortcuts_finalize (GObject *object)
141{137{
142 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);138 IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
139 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
143140
144 if (priv->identity != NULL) {141 if (priv->identity != NULL) {
145 g_free(priv->identity);142 g_free(priv->identity);
@@ -170,7 +167,8 @@
170set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)167set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
171{168{
172 g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));169 g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
173 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);170 IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
171 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
174172
175 switch(prop_id) {173 switch(prop_id) {
176 case PROP_DESKTOP_FILE: {174 case PROP_DESKTOP_FILE: {
@@ -233,7 +231,8 @@
233get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)231get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
234{232{
235 g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));233 g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
236 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);234 IndicatorDesktopShortcuts *shortcuts = INDICATOR_DESKTOP_SHORTCUTS(object);
235 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(shortcuts);
237236
238 switch(prop_id) {237 switch(prop_id) {
239 case PROP_IDENTITY:238 case PROP_IDENTITY:
@@ -253,7 +252,7 @@
253static void252static void
254parse_keyfile (IndicatorDesktopShortcuts * ids)253parse_keyfile (IndicatorDesktopShortcuts * ids)
255{254{
256 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);255 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
257256
258 if (priv->keyfile == NULL) {257 if (priv->keyfile == NULL) {
259 return;258 return;
@@ -475,7 +474,7 @@
475indicator_desktop_shortcuts_get_nicks (IndicatorDesktopShortcuts * ids)474indicator_desktop_shortcuts_get_nicks (IndicatorDesktopShortcuts * ids)
476{475{
477 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);476 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
478 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);477 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
479 return (const gchar **)priv->nicks->data;478 return (const gchar **)priv->nicks->data;
480}479}
481480
@@ -497,7 +496,7 @@
497indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, const gchar * nick)496indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, const gchar * nick)
498{497{
499 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);498 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
500 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);499 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
501500
502 g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL);501 g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL);
503 g_return_val_if_fail(priv->keyfile != NULL, NULL);502 g_return_val_if_fail(priv->keyfile != NULL, NULL);
@@ -573,7 +572,7 @@
573 GError * error = NULL;572 GError * error = NULL;
574573
575 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE);574 g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE);
576 IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);575 IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(ids);
577576
578 g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE);577 g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE);
579 g_return_val_if_fail(priv->keyfile != NULL, FALSE);578 g_return_val_if_fail(priv->keyfile != NULL, FALSE);

Subscribers

People subscribed via source and target branches