[MM] [PATCH] cli, libmm-glib: set default timeout on manager DBus proxy
- From: Ben Chan <benchan chromium org>
- To: networkmanager-list gnome org
- Subject: [MM] [PATCH] cli, libmm-glib: set default timeout on manager DBus proxy
- Date: Mon, 30 Jul 2012 16:46:25 -0700
This patch fixes mmcli to set the default timeout on the manager proxy
interface (MmGdbusOrgFreedesktopModemManager1) instead of MMManager
itself. The later is not a GDBusProxy object.
---
This is what 'mmcli -L' currently prints out:
(mmcli:4689): GLib-GObject-WARNING **: invalid cast from `MMManager' to `GDBusProxy'
(mmcli:4689): GLib-GIO-CRITICAL **: g_dbus_proxy_set_default_timeout: assertion `G_IS_DBUS_PROXY (proxy)' failed
Not sure if it's a good idea to expose the private GDBusProxy interface of
MMManager. An alternative fix we should consider:
- Implement 'mm_manager_set_default_timeout(MMManager *, gint timeout)' in libmm-glib/mm-manager.c
- Implement 'gint mmcli_get_default_timeout()' in cli/mmcli.c
- Call 'mm_manager_set_default_timeout (ctx->manaager, mmcli_get_default_timeout ())' instead of
'mmcli_force_operation_timeout' in cli/mmcli-manager.c
cli/mmcli-manager.c | 4 ++--
libmm-glib/mm-manager.c | 14 ++++++++++++++
libmm-glib/mm-manager.h | 2 ++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/cli/mmcli-manager.c b/cli/mmcli-manager.c
index 6dd00ac..4db353d 100644
--- a/cli/mmcli-manager.c
+++ b/cli/mmcli-manager.c
@@ -249,7 +249,7 @@ get_manager_ready (GObject *source,
ctx->manager = mmcli_get_manager_finish (result);
/* Setup operation timeout */
- mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->manager));
+ mmcli_force_operation_timeout (mm_manager_get_proxy (ctx->manager));
/* Request to set log level? */
if (set_logging_str) {
@@ -331,7 +331,7 @@ mmcli_manager_run_synchronous (GDBusConnection *connection)
ctx->manager = mmcli_get_manager_sync (connection);
/* Setup operation timeout */
- mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->manager));
+ mmcli_force_operation_timeout (mm_manager_get_proxy (ctx->manager));
/* Request to set log level? */
if (set_logging_str) {
diff --git a/libmm-glib/mm-manager.c b/libmm-glib/mm-manager.c
index 3e5c6d0..e1b1105 100644
--- a/libmm-glib/mm-manager.c
+++ b/libmm-glib/mm-manager.c
@@ -131,6 +131,20 @@ mm_manager_new_sync (GDBusConnection *connection,
return (ret ? MM_MANAGER (ret) : NULL);
}
+/**
+ * mm_manager_get_proxy:
+ * @manager: A #MMManager.
+ *
+ * Gets the #GDBusProxy interface of the %manager.
+ *
+ * Returns: (transfer none): The #GDBusProxy interface of %manager or %NULL if the interface hasn't been created. Do not free the returned object, it is owned by @manager.
+ */
+GDBusProxy *
+mm_manager_get_proxy (MMManager *manager)
+{
+ return G_DBUS_PROXY (manager->priv->manager_iface_proxy);
+}
+
static void
set_logging_ready (MmGdbusOrgFreedesktopModemManager1 *manager_iface_proxy,
GAsyncResult *res,
diff --git a/libmm-glib/mm-manager.h b/libmm-glib/mm-manager.h
index e95257b..0684075 100644
--- a/libmm-glib/mm-manager.h
+++ b/libmm-glib/mm-manager.h
@@ -67,6 +67,8 @@ MMManager *mm_manager_new_sync (
GCancellable *cancellable,
GError **error);
+GDBusProxy *mm_manager_get_proxy (MMManager *manager);
+
void mm_manager_set_logging (MMManager *manager,
const gchar *level,
GCancellable *cancellable,
--
1.7.7.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]