cli: port Manager actions to use the new libmm-glib

The original command line interface was written based on a hand-made libmm. This
commit ports the Manager interface handling to the new gdbus-codegen-based
libmm-glib.
This commit is contained in:
Aleksander Morgado
2012-03-15 14:14:25 +01:00
parent c37949d7ba
commit 9e241b7062
3 changed files with 176 additions and 119 deletions
+7 -5
View File
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
* Copyright (C) 2011 Google, Inc.
*/
#include "config.h"
@@ -28,7 +29,7 @@
#include <glib.h>
#include <gio/gio.h>
#include <libmm.h>
#include <libmm-glib.h>
#include "mmcli.h"
@@ -37,7 +38,6 @@
/* Globals */
static GMainLoop *loop;
static gboolean keep_loop;
static GCancellable *cancellable;
/* Context */
@@ -98,8 +98,7 @@ mmcli_async_operation_done (void)
cancellable = NULL;
}
if (!keep_loop)
g_main_loop_quit (loop);
g_main_loop_quit (loop);
}
gint
@@ -147,9 +146,12 @@ main (gint argc, gchar **argv)
/* Manager options? */
if (mmcli_manager_options_enabled ()) {
if (async_flag)
keep_loop = mmcli_manager_run_asynchronous (connection, cancellable);
mmcli_manager_run_asynchronous (connection, cancellable);
else
mmcli_manager_run_synchronous (connection);
} else {
g_printerr ("error: no actions specified\n");
exit (EXIT_FAILURE);
}
/* Run loop only in async operations */