aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-02-08 10:50:04 -0600
committerTed Gould <ted@gould.cx>2012-02-08 10:50:04 -0600
commit8a1e30e9465e2d49e6c66e372da4daea8e3dfc0c (patch)
treedd0ad09083dee68ffaa3d060d5863bb329acadf3
parent04922240ee1e2c73ec61b46f17cab7653372eefa (diff)
parenta85b08ad050bf8e1acd39f58c5d3984eefd57e6a (diff)
downloadayatana-indicator-application-8a1e30e9465e2d49e6c66e372da4daea8e3dfc0c.tar.gz
ayatana-indicator-application-8a1e30e9465e2d49e6c66e372da4daea8e3dfc0c.tar.bz2
ayatana-indicator-application-8a1e30e9465e2d49e6c66e372da4daea8e3dfc0c.zip
Fixing variant usage
-rw-r--r--.bzrignore2
-rw-r--r--src/application-service-appstore.c50
-rw-r--r--src/indicator-application.c82
3 files changed, 88 insertions, 46 deletions
diff --git a/.bzrignore b/.bzrignore
index beef564..1290cba 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -112,3 +112,5 @@ bindings/mono/policy.0.0.appindicator-sharp.config
bindings/mono/policy.0.0.appindicator-sharp.dll
src/libapplication_la-generate-id.lo
src/libappindicator_la-generate-id.lo
+gen-notification-approver.xml.c
+gen-notification-approver.xml.h
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index 0548ced..da5b859 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 = NULL;
+ gchar *dbusmenuobject = NULL;
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 = NULL;
+ 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 = 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) {
- const gchar * icon_theme_path;
- g_variant_get(parameters, "(&s)", &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) {
- const gchar * label, * guide;
- g_variant_get(parameters, "(&s&s)", &label, &guide);
+ gchar * label = NULL, * guide = NULL;
+ 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 = NULL;
+ 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. */
@@ -1631,11 +1643,13 @@ approver_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal
Approver * approver = (Approver *)user_data;
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);
+ 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);
+ g_free(path);
}
return;
diff --git a/src/indicator-application.c b/src/indicator-application.c
index 8b28ebc..2c4f232 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 = NULL;
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 = 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,
&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 = NULL;
+ gchar * icondesc = NULL;
+ 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 = 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;
- const gchar * label;
- const gchar * guide;
- g_variant_get (parameters, "(i&s&s)", &position, &label, &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);
+ 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 = NULL;
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 = 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);
- 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