From dd6a60c62c1fc07de49f81b24c3ca3d579f49f6c Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 6 Dec 2011 15:49:39 -0600 Subject: Added coverage reporting via gcov config and targets. --- src/Makefile.am | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 9b11fd1..e445d78 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,6 +22,7 @@ libapplication_la_SOURCES = \ dbus-shared.h \ indicator-application.c libapplication_la_CFLAGS = $(INDICATOR_CFLAGS) \ + $(COVERAGE_CFLAGS) \ -Wall \ -Wl,-Bsymbolic-functions \ -Wl,-z,defs \ @@ -29,7 +30,8 @@ libapplication_la_CFLAGS = $(INDICATOR_CFLAGS) \ -Werror \ -DG_LOG_DOMAIN=\"Indicator-Application\" libapplication_la_LIBADD = $(INDICATOR_LIBS) -libapplication_la_LDFLAGS = -module -avoid-version +libapplication_la_LDFLAGS = $(COVERAGE_LDFLAGS) \ + -module -avoid-version ################################## # Service @@ -57,6 +59,7 @@ indicator_application_service_SOURCES = \ indicator_application_service_CFLAGS = \ $(INDICATOR_CFLAGS) \ $(APPINDICATOR_CFLAGS) \ + $(COVERAGE_CFLAGS) \ -DDATADIR="\"$(pkgdatadir)\"" \ -Wall -Werror \ -DG_LOG_DOMAIN=\"indicator-application-service\" @@ -65,6 +68,9 @@ indicator_application_service_LDADD = \ $(INDICATOR_LIBS) \ $(APPINDICATOR_LIBS) +indicator_application_service_LDFLAGS = \ + $(COVERAGE_LDFLAGS) + glib_marshal_list = application-service-marshal.list glib_marshal_prefix = _application_service_marshal -- cgit v1.2.3 From 3cfb188eb9e1afb0b57c503622f63c69e1568913 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jan 2012 22:32:00 -0600 Subject: fix dead store found by clang static analyzer --- src/application-service-appstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index edc517f..51f975c 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -403,7 +403,7 @@ load_override_file (GHashTable * hash, const gchar * filename) return; } - gchar * key = keys[0]; + gchar * key; gint i; for (i = 0; (key = keys[i]) != NULL; i++) { -- cgit v1.2.3 From 37d7bd75ad4cbba67844e2c0375bad9fce0dfae2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 16:47:38 -0600 Subject: Fixing includes to match dbusmenu v0.5.90 --- src/indicator-application.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/indicator-application.c b/src/indicator-application.c index 24ec7d4..173124c 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -32,11 +32,7 @@ with this program. If not, see . #include /* DBus Stuff */ -#ifdef HAVE_GTK3 -#include -#else #include -#endif /* Indicator Stuff */ #include -- cgit v1.2.3 From 716e613e96ba579d5cf7454320317386b9117d24 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 16:53:23 -0600 Subject: Add the title to the structure for the application indicator --- src/application-service-appstore.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index edc517f..d2758a1 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -50,6 +50,7 @@ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); #define NOTIFICATION_ITEM_PROP_MENU "Menu" #define NOTIFICATION_ITEM_PROP_LABEL "XAyatanaLabel" #define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "XAyatanaLabelGuide" +#define NOTIFICATION_ITEM_PROP_TITLE "Title" #define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "XAyatanaOrderingIndex" #define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" @@ -108,6 +109,7 @@ struct _Application { gchar * icon_theme_path; gchar * label; gchar * guide; + gchar * title; gboolean currently_free; guint ordering_index; GList * approver_cancels; @@ -440,7 +442,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, * status = NULL, * icon_name = NULL, * aicon_name = NULL, * icon_desc = NULL, * aicon_desc = NULL, * icon_theme_path = NULL, * index = NULL, * label = NULL, - * guide = NULL; + * guide = NULL, * title = NULL; GVariant * properties = g_dbus_proxy_call_finish(G_DBUS_PROXY(source_object), res, &error); @@ -494,6 +496,8 @@ got_all_properties (GObject * source_object, GAsyncResult * res, label = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_LABEL_GUIDE) == 0) { guide = g_variant_ref(value); + } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_TITLE) == 0) { + title = g_variant_ref(value); } /* else ignore */ } g_variant_iter_free (iter); @@ -581,6 +585,13 @@ got_all_properties (GObject * source_object, GAsyncResult * res, app->guide = g_strdup(""); } + g_free(app->title); + if (title != NULL) { + app->title = g_variant_dup_string(title, NULL); + } else { + app->title = g_strdup(""); + } + g_list_foreach(priv->approvers, check_with_old_approver, app); apply_status(app); @@ -603,6 +614,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, if (index) g_variant_unref (index); if (label) g_variant_unref (label); if (guide) g_variant_unref (guide); + if (title) g_variant_unref (title); return; } @@ -784,6 +796,9 @@ application_free (Application * app) if (app->guide != NULL) { g_free(app->guide); } + if (app->title != NULL) { + g_free(app->title); + } if (app->approver_cancels != NULL) { g_list_foreach(app->approver_cancels, (GFunc)g_cancellable_cancel, NULL); g_list_foreach(app->approver_cancels, (GFunc)g_object_unref, NULL); @@ -1039,6 +1054,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst app->icon_theme_path = NULL; app->label = NULL; app->guide = NULL; + app->title = NULL; app->currently_free = FALSE; app->ordering_index = 0; app->approver_cancels = NULL; -- cgit v1.2.3 From c91e6fcb209ec0121a6f9d3ded750d0588ca03a2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 16:57:21 -0600 Subject: Handling the 'NewTitle' signal coming from the application indicator --- src/application-service-appstore.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index d2758a1..e60450c 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -58,6 +58,7 @@ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); #define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" #define NOTIFICATION_ITEM_SIG_NEW_LABEL "XAyatanaNewLabel" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" +#define NOTIFICATION_ITEM_SIG_NEW_TITLE "NewTitle" #define OVERRIDE_GROUP_NAME "Ordering Index Overrides" #define OVERRIDE_FILE_NAME "ordering-override.keyfile" @@ -1214,6 +1215,10 @@ app_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name /* aicon name isn't provided by signal, so look it up */ get_all_properties(app); } + else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_TITLE) == 0) { + /* title name isn't provided by signal, so look it up */ + get_all_properties(app); + } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_STATUS) == 0) { const gchar * status; g_variant_get(parameters, "(&s)", &status); -- cgit v1.2.3 From c1f07f77dcf0dabf24a5e540112b8e47c0aad75e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 17:03:12 -0600 Subject: If we have a mega-change of things, let's signal a title change --- src/application-service-appstore.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index e60450c..07783ad 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -939,6 +939,9 @@ apply_status (Application * app) g_variant_new ("(iss)", position, app->label != NULL ? app->label : "", app->guide != NULL ? app->guide : "")); + emit_signal (appstore, "ApplicationTitleChanged", + g_variant_new ("(is)", position, + app->title != NULL ? app->title : "")); } } -- cgit v1.2.3 From 2a7a9f3e01227c83df481a63f288b620213fd883 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 17:04:01 -0600 Subject: Changing the service description to match --- src/application-service.xml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/application-service.xml b/src/application-service.xml index 434cfd8..2588d8e 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -69,5 +69,9 @@ with this program. If not, see . + + + + -- cgit v1.2.3 From 1b2a4572a83b8e876bc7612e4dc7c913a82f1bd3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 20:18:58 -0600 Subject: Adding to more strings to the standard structure, ID and title --- src/application-service.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/application-service.xml b/src/application-service.xml index 2588d8e..72dbf21 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -26,7 +26,7 @@ with this program. If not, see . - + @@ -51,6 +51,8 @@ with this program. If not, see . + + -- cgit v1.2.3 From 3ceb0322953f0ddfb7fe69ae703ac5c775a7fe00 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 20:34:52 -0600 Subject: Adding in service versions to detect the dbus API change --- src/application-service.c | 2 +- src/dbus-shared.h | 1 + src/indicator-application.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/application-service.c b/src/application-service.c index 68ac264..bc1787f 100644 --- a/src/application-service.c +++ b/src/application-service.c @@ -55,7 +55,7 @@ main (int argc, char ** argv) g_type_init(); /* Bring us up as a basic indicator service */ - service = indicator_service_new(INDICATOR_APPLICATION_DBUS_ADDR); + service = indicator_service_new_version(INDICATOR_APPLICATION_DBUS_ADDR, INDICATOR_APPLICATION_SERVICE_VERSION); g_signal_connect(G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_disconnected), NULL); /* Building our app store */ diff --git a/src/dbus-shared.h b/src/dbus-shared.h index 6144b9b..ce27bd9 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -23,6 +23,7 @@ with this program. If not, see . #define INDICATOR_APPLICATION_DBUS_ADDR "com.canonical.indicator.application" #define INDICATOR_APPLICATION_DBUS_OBJ "/com/canonical/indicator/application/service" #define INDICATOR_APPLICATION_DBUS_IFACE "com.canonical.indicator.application.service" +#define INDICATOR_APPLICATION_SERVICE_VERSION 2 #define NOTIFICATION_WATCHER_DBUS_ADDR "org.kde.StatusNotifierWatcher" #define NOTIFICATION_WATCHER_DBUS_OBJ "/StatusNotifierWatcher" diff --git a/src/indicator-application.c b/src/indicator-application.c index 173124c..d515e34 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -158,7 +158,7 @@ indicator_application_init (IndicatorApplication *self) priv->theme_dirs = NULL; priv->disconnect_kill = 0; - priv->sm = indicator_service_manager_new(INDICATOR_APPLICATION_DBUS_ADDR); + priv->sm = indicator_service_manager_new_version(INDICATOR_APPLICATION_DBUS_ADDR, INDICATOR_APPLICATION_SERVICE_VERSION); g_signal_connect(G_OBJECT(priv->sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self); priv->applications = NULL; -- cgit v1.2.3 From cef6f0fc81bb99aac7cc9d78529b12c05c2a5fc1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 20:36:54 -0600 Subject: Changing the output signatures --- src/application-service-appstore.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 07783ad..0548ced 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -922,12 +922,12 @@ apply_status (Application * app) if (app->visible_state == VISIBLE_STATE_HIDDEN) { /* Put on panel */ emit_signal (appstore, "ApplicationAdded", - g_variant_new ("(sisosssss)", newicon, + g_variant_new ("(sisossssss)", newicon, get_position(app), app->dbus_name, app->menu, app->icon_theme_path, app->label, app->guide, - newdesc, app->id)); + newdesc, app->id, app->title)); } else { /* Icon update */ gint position = get_position(app); @@ -1347,20 +1347,20 @@ get_applications (ApplicationServiceAppstore * appstore) continue; } - g_variant_builder_add (&builder, "(sisosssss)", app->icon, + g_variant_builder_add (&builder, "(sisossssss)", app->icon, position++, app->dbus_name, app->menu, app->icon_theme_path, app->label, app->guide, (app->icon_desc != NULL) ? app->icon_desc : "", - app->id); + app->id, app->title); } out = g_variant_builder_end(&builder); } else { GError * error = NULL; - out = g_variant_parse(g_variant_type_new("a(sisosssss)"), "[]", NULL, NULL, &error); + out = g_variant_parse(g_variant_type_new("a(sisossssss)"), "[]", NULL, NULL, &error); if (error != NULL) { - g_warning("Unable to parse '[]' as a 'a(sisosssss)': %s", error->message); + g_warning("Unable to parse '[]' as a 'a(sisossssss)': %s", error->message); out = NULL; g_error_free(error); } -- cgit v1.2.3 From bc7f44a24e624911fd5b343431f5a8a4b110f653 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 20:37:21 -0600 Subject: Don't need the ID as that's already the hint --- src/application-service.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/application-service.xml b/src/application-service.xml index 72dbf21..9428ebb 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -26,7 +26,7 @@ with this program. If not, see . - + @@ -51,7 +51,6 @@ with this program. If not, see . - -- cgit v1.2.3 From 432817d5e245989beb6438c352c61114742c394f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 20:41:29 -0600 Subject: Changing the signatures on the indicator side, we don't care much about title though. --- src/indicator-application.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/indicator-application.c b/src/indicator-application.c index d515e34..8b28ebc 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -811,10 +811,11 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, const gchar * guide; const gchar * accessible_desc; const gchar * hint; - g_variant_get (parameters, "(&si&s&o&s&s&s&s&s)", &iconname, + const gchar * title; + g_variant_get (parameters, "(&si&s&o&s&s&s&s&s&s)", &iconname, &position, &dbusaddress, &dbusobject, &icon_theme_path, &label, &guide, - &accessible_desc, &hint); + &accessible_desc, &hint, &title); application_added(self, iconname, position, dbusaddress, dbusobject, icon_theme_path, label, guide, accessible_desc, hint); @@ -884,7 +885,7 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) } /* Get our new applications that we got in the request */ - g_variant_get(result, "(a(sisosssss))", &iter); + g_variant_get(result, "(a(sisossssss))", &iter); while ((child = g_variant_iter_next_value (iter))) { get_applications_helper(self, child); g_variant_unref(child); @@ -909,9 +910,10 @@ get_applications_helper (IndicatorApplication * self, GVariant * variant) const gchar * guide; const gchar * accessible_desc; const gchar * hint; - g_variant_get(variant, "(sisosssss)", &icon_name, &position, + const gchar * title; + g_variant_get(variant, "(sisossssss)", &icon_name, &position, &dbus_address, &dbus_object, &icon_theme_path, &label, - &guide, &accessible_desc, &hint); + &guide, &accessible_desc, &hint, &title); return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_desc, hint); } -- cgit v1.2.3 From 3bfb6d6b5b10c2ef34414763f975eed2525c3d2e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 20:47:53 -0600 Subject: Fixing some of the variant usage to free strings appropriately --- src/indicator-application.c | 82 +++++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/indicator-application.c b/src/indicator-application.c index 8b28ebc..577008d 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -802,23 +802,32 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, } if (g_strcmp0(signal_name, "ApplicationAdded") == 0) { - const gchar * iconname; + gchar * iconname; gint position; - const gchar * dbusaddress; - const gchar * dbusobject; - const gchar * icon_theme_path; - const gchar * label; - const gchar * guide; - const gchar * accessible_desc; - const gchar * hint; - const gchar * title; - g_variant_get (parameters, "(&si&s&o&s&s&s&s&s&s)", &iconname, + gchar * dbusaddress; + gchar * dbusobject; + gchar * icon_theme_path; + gchar * label; + gchar * guide; + gchar * accessible_desc; + gchar * hint; + gchar * title; + g_variant_get (parameters, "(sisossssss)", &iconname, &position, &dbusaddress, &dbusobject, &icon_theme_path, &label, &guide, &accessible_desc, &hint, &title); application_added(self, iconname, position, dbusaddress, dbusobject, icon_theme_path, label, guide, accessible_desc, hint); + g_free(iconname); + g_free(dbusaddress); + g_free(dbusobject); + g_free(icon_theme_path); + g_free(label); + g_free(guide); + g_free(accessible_desc); + g_free(hint); + g_free(title); } else if (g_strcmp0(signal_name, "ApplicationRemoved") == 0) { gint position; @@ -827,23 +836,28 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, } else if (g_strcmp0(signal_name, "ApplicationIconChanged") == 0) { gint position; - const gchar * iconname; - const gchar * icondesc; - g_variant_get (parameters, "(i&s&s)", &position, &iconname, &icondesc); + gchar * iconname; + gchar * icondesc; + g_variant_get (parameters, "(iss)", &position, &iconname, &icondesc); application_icon_changed(self, position, iconname, icondesc); + g_free(iconname); + g_free(icondesc); } else if (g_strcmp0(signal_name, "ApplicationIconThemePathChanged") == 0) { gint position; - const gchar * icon_theme_path; - g_variant_get (parameters, "(i&s)", &position, &icon_theme_path); + gchar * icon_theme_path; + g_variant_get (parameters, "(is)", &position, &icon_theme_path); application_icon_theme_path_changed(self, position, icon_theme_path); + g_free(icon_theme_path); } else if (g_strcmp0(signal_name, "ApplicationLabelChanged") == 0) { gint position; - const gchar * label; - const gchar * guide; - g_variant_get (parameters, "(i&s&s)", &position, &label, &guide); + gchar * label; + gchar * guide; + g_variant_get (parameters, "(iss)", &position, &label, &guide); application_label_changed(self, position, label, guide); + g_free(label); + g_free(guide); } return; @@ -901,21 +915,33 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) static void get_applications_helper (IndicatorApplication * self, GVariant * variant) { - const gchar * icon_name; + gchar * icon_name; gint position; - const gchar * dbus_address; - const gchar * dbus_object; - const gchar * icon_theme_path; - const gchar * label; - const gchar * guide; - const gchar * accessible_desc; - const gchar * hint; - const gchar * title; + gchar * dbus_address; + gchar * dbus_object; + gchar * icon_theme_path; + gchar * label; + gchar * guide; + gchar * accessible_desc; + gchar * hint; + gchar * title; g_variant_get(variant, "(sisossssss)", &icon_name, &position, &dbus_address, &dbus_object, &icon_theme_path, &label, &guide, &accessible_desc, &hint, &title); - return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_desc, hint); + application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_desc, hint); + + g_free(icon_name); + g_free(dbus_address); + g_free(dbus_object); + g_free(icon_theme_path); + g_free(label); + g_free(guide); + g_free(accessible_desc); + g_free(hint); + g_free(title); + + return; } /* Unrefs a theme directory. This may involve removing it from -- cgit v1.2.3 From 79e3bfeacfc134a7a96b2a47b2ca3f285535262c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 20:55:43 -0600 Subject: Fixing variant usage --- src/application-service-appstore.c | 48 ++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 0548ced..587557e 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -268,8 +268,8 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, ApplicationServiceAppstore * service = APPLICATION_SERVICE_APPSTORE(user_data); GVariant * retval = NULL; Application *app = NULL; - const gchar *dbusaddress; - const gchar *dbusmenuobject; + gchar *dbusaddress; + gchar *dbusmenuobject; if (g_strcmp0(method, "GetApplications") == 0) { retval = get_applications(service); @@ -278,7 +278,7 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, gint delta; guint direction; - g_variant_get (params, "(&s&siu)", &dbusaddress, &dbusmenuobject, + g_variant_get (params, "(ssiu)", &dbusaddress, &dbusmenuobject, &delta, &direction); switch (direction) { @@ -304,7 +304,7 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, } else if (g_strcmp0(method, "ApplicationSecondaryActivateEvent") == 0) { guint time; - g_variant_get (params, "(&s&su)", &dbusaddress, &dbusmenuobject, &time); + g_variant_get (params, "(ssu)", &dbusaddress, &dbusmenuobject, &time); app = find_application_by_menu(service, dbusaddress, dbusmenuobject); if (app != NULL && app->dbus_proxy != NULL) { @@ -316,6 +316,9 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, g_warning("Calling method '%s' on the indicator service and it's unknown", method); } + g_free(dbusaddress); + g_free(dbusmenuobject); + g_dbus_method_invocation_return_value(invocation, retval); return; } @@ -1096,11 +1099,13 @@ name_changed (GDBusConnection * connection, const gchar * sender_name, { Application * app = (Application *)user_data; - const gchar * new_name; - g_variant_get(parameters, "(&s&s&s)", NULL, NULL, &new_name); + gchar * new_name; + g_variant_get(parameters, "(sss)", NULL, NULL, &new_name); if (new_name == NULL || new_name[0] == 0) application_died(app); + + g_free(new_name); } /* Callback from trying to create the proxy for the app. */ @@ -1223,19 +1228,23 @@ app_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name get_all_properties(app); } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_STATUS) == 0) { - const gchar * status; - g_variant_get(parameters, "(&s)", &status); + gchar * status; + g_variant_get(parameters, "(s)", &status); new_status(app, status); + g_free(status); } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH) == 0) { - const gchar * icon_theme_path; - g_variant_get(parameters, "(&s)", &icon_theme_path); + gchar * icon_theme_path; + g_variant_get(parameters, "(s)", &icon_theme_path); new_icon_theme_path(app, icon_theme_path); + g_free(icon_theme_path); } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_LABEL) == 0) { - const gchar * label, * guide; - g_variant_get(parameters, "(&s&s)", &label, &guide); + gchar * label, * guide; + g_variant_get(parameters, "(ss)", &label, &guide); new_label(app, label, guide); + g_free(label); + g_free(guide); } return; @@ -1560,13 +1569,16 @@ approver_name_changed (GDBusConnection * connection, const gchar * sender_name, Approver * approver = (Approver *)user_data; ApplicationServiceAppstore * appstore = approver->appstore; - const gchar * new_name; - g_variant_get(parameters, "(&s&s&s)", NULL, NULL, &new_name); + gchar * new_name; + g_variant_get(parameters, "(sss)", NULL, NULL, &new_name); if (new_name == NULL || new_name[0] == 0) { appstore->priv->approvers = g_list_remove(appstore->priv->approvers, approver); approver_free(approver, appstore); } + + g_free(new_name); + return; } /* Callback from trying to create the proxy for the approver. */ @@ -1632,10 +1644,12 @@ approver_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal if (g_strcmp0(signal_name, "ReviseJudgement") == 0) { gboolean approved; - const gchar * address; - const gchar * path; - g_variant_get(parameters, "(b&s&o)", &approved, &address, &path); + gchar * address; + gchar * path; + g_variant_get(parameters, "(bso)", &approved, &address, &path); approver_revise_judgement(approver, approved, address, path); + g_free(address); + g_free(path); } return; -- cgit v1.2.3 From 18b22173e0e0f07cdfe75bb3bd15ae7ad80e4e97 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 22:01:20 -0600 Subject: Ensuring that the values are initialized to NULL before using that later. --- src/application-service-appstore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 587557e..8b06eec 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -268,8 +268,8 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, ApplicationServiceAppstore * service = APPLICATION_SERVICE_APPSTORE(user_data); GVariant * retval = NULL; Application *app = NULL; - gchar *dbusaddress; - gchar *dbusmenuobject; + gchar *dbusaddress = NULL; + gchar *dbusmenuobject = NULL; if (g_strcmp0(method, "GetApplications") == 0) { retval = get_applications(service); -- cgit v1.2.3 From ee1ac0d31371b8c472c44715eb7dce36b2793cc5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 22:10:50 -0600 Subject: Make sure to initialize values before free'ing them --- src/application-service-appstore.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 8b06eec..c0ec327 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -1228,19 +1228,19 @@ app_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name get_all_properties(app); } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_STATUS) == 0) { - gchar * status; + gchar * status = NULL; g_variant_get(parameters, "(s)", &status); new_status(app, status); g_free(status); } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH) == 0) { - gchar * icon_theme_path; + gchar * icon_theme_path = NULL; g_variant_get(parameters, "(s)", &icon_theme_path); new_icon_theme_path(app, icon_theme_path); g_free(icon_theme_path); } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_LABEL) == 0) { - gchar * label, * guide; + gchar * label = NULL, * guide = NULL; g_variant_get(parameters, "(ss)", &label, &guide); new_label(app, label, guide); g_free(label); @@ -1569,7 +1569,7 @@ approver_name_changed (GDBusConnection * connection, const gchar * sender_name, Approver * approver = (Approver *)user_data; ApplicationServiceAppstore * appstore = approver->appstore; - gchar * new_name; + gchar * new_name = NULL; g_variant_get(parameters, "(sss)", NULL, NULL, &new_name); if (new_name == NULL || new_name[0] == 0) { @@ -1643,9 +1643,9 @@ approver_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal Approver * approver = (Approver *)user_data; if (g_strcmp0(signal_name, "ReviseJudgement") == 0) { - gboolean approved; - gchar * address; - gchar * path; + gboolean approved = FALSE; + gchar * address = NULL; + gchar * path = NULL; g_variant_get(parameters, "(bso)", &approved, &address, &path); approver_revise_judgement(approver, approved, address, path); g_free(address); -- cgit v1.2.3 From 4145c58e2ee3191f2557f1e558adda0d1f387223 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 22:12:26 -0600 Subject: Making sure to initial string pointers --- src/indicator-application.c | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/indicator-application.c b/src/indicator-application.c index 577008d..2c4f232 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -802,16 +802,16 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, } if (g_strcmp0(signal_name, "ApplicationAdded") == 0) { - gchar * iconname; + gchar * iconname = NULL; gint position; - gchar * dbusaddress; - gchar * dbusobject; - gchar * icon_theme_path; - gchar * label; - gchar * guide; - gchar * accessible_desc; - gchar * hint; - gchar * title; + gchar * dbusaddress = NULL; + gchar * dbusobject = NULL; + gchar * icon_theme_path = NULL; + gchar * label = NULL; + gchar * guide = NULL; + gchar * accessible_desc = NULL; + gchar * hint = NULL; + gchar * title = NULL; g_variant_get (parameters, "(sisossssss)", &iconname, &position, &dbusaddress, &dbusobject, &icon_theme_path, &label, &guide, @@ -836,8 +836,8 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, } else if (g_strcmp0(signal_name, "ApplicationIconChanged") == 0) { gint position; - gchar * iconname; - gchar * icondesc; + gchar * iconname = NULL; + gchar * icondesc = NULL; g_variant_get (parameters, "(iss)", &position, &iconname, &icondesc); application_icon_changed(self, position, iconname, icondesc); g_free(iconname); @@ -845,15 +845,15 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, } else if (g_strcmp0(signal_name, "ApplicationIconThemePathChanged") == 0) { gint position; - gchar * icon_theme_path; + gchar * icon_theme_path = NULL; g_variant_get (parameters, "(is)", &position, &icon_theme_path); application_icon_theme_path_changed(self, position, icon_theme_path); g_free(icon_theme_path); } else if (g_strcmp0(signal_name, "ApplicationLabelChanged") == 0) { gint position; - gchar * label; - gchar * guide; + gchar * label = NULL; + gchar * guide = NULL; g_variant_get (parameters, "(iss)", &position, &label, &guide); application_label_changed(self, position, label, guide); g_free(label); @@ -915,16 +915,16 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) static void get_applications_helper (IndicatorApplication * self, GVariant * variant) { - gchar * icon_name; + gchar * icon_name = NULL; gint position; - gchar * dbus_address; - gchar * dbus_object; - gchar * icon_theme_path; - gchar * label; - gchar * guide; - gchar * accessible_desc; - gchar * hint; - gchar * title; + gchar * dbus_address = NULL; + gchar * dbus_object = NULL; + gchar * icon_theme_path = NULL; + gchar * label = NULL; + gchar * guide = NULL; + gchar * accessible_desc = NULL; + gchar * hint = NULL; + gchar * title = NULL; g_variant_get(variant, "(sisossssss)", &icon_name, &position, &dbus_address, &dbus_object, &icon_theme_path, &label, &guide, &accessible_desc, &hint, &title); -- cgit v1.2.3 From a85b08ad050bf8e1acd39f58c5d3984eefd57e6a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 3 Feb 2012 22:13:38 -0600 Subject: Oops, forgot one --- src/application-service-appstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index c0ec327..da5b859 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -1099,7 +1099,7 @@ name_changed (GDBusConnection * connection, const gchar * sender_name, { Application * app = (Application *)user_data; - gchar * new_name; + gchar * new_name = NULL; g_variant_get(parameters, "(sss)", NULL, NULL, &new_name); if (new_name == NULL || new_name[0] == 0) -- cgit v1.2.3