From 75ae6cbac0dc1d2c423d27a4d9f460a87139f0fe Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2012 15:41:23 -0500 Subject: add lars as co-author of app-section --- src/app-section.c | 3 ++- src/app-section.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app-section.c b/src/app-section.c index c5b0731..f6cf15f 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -2,9 +2,10 @@ An indicator to show information that is in messaging applications that the user is using. -Copyright 2009 Canonical Ltd. +Copyright 2012 Canonical Ltd. Authors: + Lars Uebernickel Ted Gould This program is free software: you can redistribute it and/or modify it diff --git a/src/app-section.h b/src/app-section.h index c351ada..711fdc9 100644 --- a/src/app-section.h +++ b/src/app-section.h @@ -2,9 +2,10 @@ An indicator to show information that is in messaging applications that the user is using. -Copyright 2009 Canonical Ltd. +Copyright 2012 Canonical Ltd. Authors: + Lars Uebernickel Ted Gould This program is free software: you can redistribute it and/or modify it -- cgit v1.2.3 From 302ec8cd11ba3ec3a2d23d78bdd41974e92f63f6 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2012 15:42:48 -0500 Subject: in app-section.c's dispose(), use g_clear_object() for priv.ids and priv.keyfile --- src/app-section.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/app-section.c b/src/app-section.c index f6cf15f..179be59 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -225,16 +225,8 @@ app_section_dispose (GObject *object) } g_clear_object (&priv->remote_menu); - - if (priv->ids != NULL) { - g_object_unref(priv->ids); - priv->ids = NULL; - } - - if (priv->appinfo != NULL) { - g_object_unref(priv->appinfo); - priv->appinfo = NULL; - } + g_clear_object (&priv->ids); + g_clear_object (&priv->appinfo); G_OBJECT_CLASS (app_section_parent_class)->dispose (object); } -- cgit v1.2.3 From ade3b76a6d41bf95b82e6c19b09c7142c79bf31e Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2012 15:49:24 -0500 Subject: add sanity checks to args passed in the public API --- src/app-section.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app-section.c b/src/app-section.c index 179be59..0b6a4b1 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -252,7 +252,7 @@ nick_activate_cb (GSimpleAction *action, static void keyfile_loaded (GObject *source_object, GAsyncResult *result, - gpointer user_data) + gpointer user_data) { AppSection *self = user_data; gchar *contents; @@ -408,6 +408,7 @@ app_section_get_desktop (AppSection * self) GActionGroup * app_section_get_actions (AppSection *self) { + g_return_val_if_fail(IS_APP_SECTION(self), NULL); AppSectionPrivate * priv = self->priv; return priv->actions ? priv->actions : G_ACTION_GROUP (priv->static_shortcuts); } @@ -415,6 +416,7 @@ app_section_get_actions (AppSection *self) GMenuModel * app_section_get_menu (AppSection *self) { + g_return_val_if_fail(IS_APP_SECTION(self), NULL); AppSectionPrivate * priv = self->priv; return G_MENU_MODEL (priv->menu); } @@ -422,6 +424,7 @@ app_section_get_menu (AppSection *self) GAppInfo * app_section_get_app_info (AppSection *self) { + g_return_val_if_fail(IS_APP_SECTION(self), NULL); AppSectionPrivate * priv = self->priv; return G_APP_INFO (priv->appinfo); } @@ -429,6 +432,7 @@ app_section_get_app_info (AppSection *self) gboolean app_section_get_draws_attention (AppSection *self) { + g_return_val_if_fail(IS_APP_SECTION(self), FALSE); AppSectionPrivate * priv = self->priv; return priv->draws_attention; } @@ -436,6 +440,7 @@ app_section_get_draws_attention (AppSection *self) void app_section_clear_draws_attention (AppSection *self) { + g_return_if_fail (IS_APP_SECTION(self)); AppSectionPrivate * priv = self->priv; gchar **action_names; gchar **it; @@ -498,6 +503,7 @@ app_section_set_object_path (AppSection *self, const gchar *bus_name, const gchar *object_path) { + g_return_if_fail (IS_APP_SECTION(self)); AppSectionPrivate *priv = self->priv; g_object_freeze_notify (G_OBJECT (self)); @@ -537,6 +543,7 @@ app_section_set_object_path (AppSection *self, void app_section_unset_object_path (AppSection *self) { + g_return_if_fail (IS_APP_SECTION(self)); AppSectionPrivate *priv = self->priv; if (priv->name_watch_id) { @@ -656,6 +663,7 @@ action_removed (GActionGroup *group, gboolean app_section_get_uses_chat_status (AppSection *self) { + g_return_val_if_fail (IS_APP_SECTION(self), FALSE); AppSectionPrivate * priv = self->priv; /* chat status is only useful when the app is running */ -- cgit v1.2.3 From 5b852d2f1fd35640ce94982c8078ce1603ed12a2 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2012 16:24:42 -0500 Subject: in indicator-messages's dispose(), use g_clear_object() --- src/indicator-messages.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 14833fd..12109ca 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -149,11 +149,7 @@ indicator_messages_dispose (GObject *object) IndicatorMessages * self = INDICATOR_MESSAGES(object); g_return_if_fail(self != NULL); - if (self->service != NULL) { - g_object_unref(self->service); - self->service = NULL; - } - + g_clear_object (&self->service); g_clear_object (&self->menu_wrapper); g_clear_object (&self->actions); g_clear_object (&self->menu); -- cgit v1.2.3 From 666abf25d2fe9c71577040b2ef9cdba825c77668 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2012 19:22:09 -0500 Subject: in indicator-messages' indicator_messages_accessible_desc_updated(), don't leak the entries GList --- src/indicator-messages.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 12109ca..162fd4d 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -217,6 +217,8 @@ indicator_messages_accessible_desc_updated (IndicatorMessages *self) g_return_if_fail (entries != NULL); g_signal_emit_by_name (self, INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, entries->data); + + g_list_free (entries); } static void -- cgit v1.2.3 From d62fb5bcbc663b4f511f25963c06ec3d51eccdb8 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2012 19:37:37 -0500 Subject: when removing an application in messages-service, disconnect the notify::uses-chat-status handler --- src/messages-service.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/messages-service.c b/src/messages-service.c index 4b32006..a7355d0 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -201,6 +201,7 @@ remove_application (const char *desktop_id) g_signal_handlers_disconnect_by_func (section, actions_changed, NULL); g_signal_handlers_disconnect_by_func (section, draws_attention_changed, NULL); + g_signal_handlers_disconnect_by_func (section, uses_chat_status_changed, NULL); } else { g_warning ("could not remove '%s', it's not registered", desktop_id); -- cgit v1.2.3 From d34fb7000e9b508b05c653b47bb60f35989c34f9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2012 23:34:49 -0500 Subject: in messages-service.c, make the functions create_action_group() and create_status_section() static --- src/messages-service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/messages-service.c b/src/messages-service.c index a7355d0..ccd2eba 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -370,8 +370,8 @@ set_status (IndicatorMessagesService *service, indicator_messages_service_complete_set_status (service, invocation); } -GSimpleActionGroup * -create_action_group () +static GSimpleActionGroup * +create_action_group (void) { GSimpleActionGroup *actions; GSimpleAction *messages; @@ -400,8 +400,8 @@ create_action_group () return actions; } -GMenuModel * -create_status_section () +static GMenuModel * +create_status_section (void) { GMenu *menu; -- cgit v1.2.3