summaryrefslogtreecommitdiff
path: root/cli/mmcli-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-12-19 20:40:54 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:35 +0100
commit534aeb0c8ac83126048353b8f30128cd6f1cd92a (patch)
tree5a0c768b38ef761421765598428c353519cfb810 /cli/mmcli-modem.c
parentcd6caf61061e18736ecf0ddd4834c1ad1fbcb7c2 (diff)
cli: always keep a MMManager around
In order to receive signals in the GDBusObjects retrieved from the GDBusObjectManagerClient, we need to keep a reference of the client around.
Diffstat (limited to 'cli/mmcli-modem.c')
-rw-r--r--cli/mmcli-modem.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c
index ce507af0..e5f6d879 100644
--- a/cli/mmcli-modem.c
+++ b/cli/mmcli-modem.c
@@ -35,6 +35,7 @@
/* Context */
typedef struct {
+ MMManager *manager;
GCancellable *cancellable;
MMObject *object;
MMModem *modem;
@@ -155,6 +156,8 @@ context_free (Context *ctx)
g_object_unref (ctx->modem);
if (ctx->object)
g_object_unref (ctx->object);
+ if (ctx->manager)
+ g_object_unref (ctx->manager);
g_free (ctx);
}
@@ -635,13 +638,13 @@ delete_bearer_ready (MMModem *modem,
}
static void
-state_changed (MMObject *modem,
+state_changed (MMModem *modem,
MMModemState old_state,
MMModemState new_state,
MMModemStateChangeReason reason)
{
g_print ("\t%s: State changed, '%s' --> '%s' (Reason: %s)\n",
- mm_object_get_path (modem),
+ mm_modem_get_path (modem),
mmcli_get_state_string (old_state),
mmcli_get_state_string (new_state),
mmcli_get_state_reason_string (reason));
@@ -653,7 +656,7 @@ get_modem_ready (GObject *source,
GAsyncResult *result,
gpointer none)
{
- ctx->object = mmcli_get_modem_finish (result);
+ ctx->object = mmcli_get_modem_finish (result, &ctx->manager);
ctx->modem = mm_object_get_modem (ctx->object);
if (info_flag)
@@ -807,7 +810,7 @@ mmcli_modem_run_synchronous (GDBusConnection *connection)
/* Initialize context */
ctx = g_new0 (Context, 1);
- ctx->object = mmcli_get_modem_sync (connection, modem_str);
+ ctx->object = mmcli_get_modem_sync (connection, modem_str, &ctx->manager);
ctx->modem = mm_object_get_modem (ctx->object);
/* Request to get info from modem? */