cli,voice: minor coding style fixes

This commit is contained in:
Aleksander Morgado
2015-05-23 17:30:16 +02:00
parent f67cc37956
commit c0e05dbd43
4 changed files with 80 additions and 79 deletions

View File

@@ -153,14 +153,14 @@ print_call_info (MMCall *call)
g_print ("CALL '%s'\n", mm_call_get_path (call)); g_print ("CALL '%s'\n", mm_call_get_path (call));
g_print (" -------------------------------\n" g_print (" -------------------------------\n"
" Global | number: '%s'\n", VALIDATE (mm_call_get_number (call))); " Global | number: '%s'\n", VALIDATE (mm_call_get_number (call)));
g_print (" | direction: '%s'\n", mm_call_direction_get_string( mm_call_get_direction (call) ) ); g_print (" | direction: '%s'\n", mm_call_direction_get_string (mm_call_get_direction (call)) );
g_print (" -------------------------------\n" g_print (" -------------------------------\n"
" Properties | state: '%s'\n", mm_call_state_get_string (mm_call_get_state (call))); " Properties | state: '%s'\n", mm_call_state_get_string (mm_call_get_state (call)));
if (mm_call_get_state_reason(call) != MM_CALL_STATE_REASON_UNKNOWN) if (mm_call_get_state_reason(call) != MM_CALL_STATE_REASON_UNKNOWN)
g_print (" | state reason: '%s'\n", g_print (" | state reason: '%s'\n",
mm_call_state_reason_get_string(mm_call_get_state_reason(call))); mm_call_state_reason_get_string(mm_call_get_state_reason (call)));
} }
static void static void
@@ -277,8 +277,8 @@ get_call_ready (GObject *source,
gpointer none) gpointer none)
{ {
ctx->call = mmcli_get_call_finish (result, ctx->call = mmcli_get_call_finish (result,
&ctx->manager, &ctx->manager,
&ctx->object); &ctx->object);
/* Setup operation timeout */ /* Setup operation timeout */
mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->call)); mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->call));
@@ -287,38 +287,38 @@ get_call_ready (GObject *source,
/* Requesting to start the call? */ /* Requesting to start the call? */
if (start_flag) { if (start_flag) {
mm_call_start(ctx->call, mm_call_start (ctx->call,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)start_ready, (GAsyncReadyCallback)start_ready,
NULL); NULL);
return; return;
} }
/* Requesting to accept the call? */ /* Requesting to accept the call? */
if (accept_flag) { if (accept_flag) {
mm_call_accept(ctx->call, mm_call_accept (ctx->call,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)accept_ready, (GAsyncReadyCallback)accept_ready,
NULL); NULL);
return; return;
} }
/* Requesting to hangup the call? */ /* Requesting to hangup the call? */
if (hangup_flag) { if (hangup_flag) {
mm_call_hangup(ctx->call, mm_call_hangup (ctx->call,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)hangup_ready, (GAsyncReadyCallback)hangup_ready,
NULL); NULL);
return; return;
} }
/* Requesting to send tone the call? */ /* Requesting to send tone the call? */
if (tone_request) { if (tone_request) {
mm_call_send_tone(ctx->call, mm_call_send_tone (ctx->call,
tone_request, tone_request,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)send_tone_ready, (GAsyncReadyCallback)send_tone_ready,
NULL); NULL);
return; return;
} }
@@ -329,7 +329,7 @@ get_call_ready (GObject *source,
void void
mmcli_call_run_asynchronous (GDBusConnection *connection, mmcli_call_run_asynchronous (GDBusConnection *connection,
GCancellable *cancellable) GCancellable *cancellable)
{ {
/* Initialize context */ /* Initialize context */
ctx = g_new0 (Context, 1); ctx = g_new0 (Context, 1);
@@ -338,10 +338,10 @@ mmcli_call_run_asynchronous (GDBusConnection *connection,
/* Get proper call */ /* Get proper call */
mmcli_get_call (connection, mmcli_get_call (connection,
mmcli_get_common_call_string (), mmcli_get_common_call_string (),
cancellable, cancellable,
(GAsyncReadyCallback)get_call_ready, (GAsyncReadyCallback)get_call_ready,
NULL); NULL);
} }
void void
@@ -352,9 +352,9 @@ mmcli_call_run_synchronous (GDBusConnection *connection)
/* Initialize context */ /* Initialize context */
ctx = g_new0 (Context, 1); ctx = g_new0 (Context, 1);
ctx->call = mmcli_get_call_sync (connection, ctx->call = mmcli_get_call_sync (connection,
mmcli_get_common_call_string (), mmcli_get_common_call_string (),
&ctx->manager, &ctx->manager,
&ctx->object); &ctx->object);
/* Setup operation timeout: 2 minutes */ /* Setup operation timeout: 2 minutes */
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->call), 2 * 60 * 1000); g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->call), 2 * 60 * 1000);

View File

@@ -1110,7 +1110,7 @@ static void look_for_call_in_modem (GetVoiceContext *ctx);
static MMCall * static MMCall *
find_call_in_list (GList *list, find_call_in_list (GList *list,
const gchar *call_path) const gchar *call_path)
{ {
GList *l; GList *l;
@@ -1128,8 +1128,8 @@ find_call_in_list (GList *list,
static void static void
list_call_ready (MMModemVoice *modem, list_call_ready (MMModemVoice *modem,
GAsyncResult *res, GAsyncResult *res,
GetVoiceContext *ctx) GetVoiceContext *ctx)
{ {
GList *call_list; GList *call_list;
GError *error = NULL; GError *error = NULL;
@@ -1180,9 +1180,9 @@ look_for_call_in_modem (GetVoiceContext *ctx)
ctx->call_path, ctx->call_path,
mm_object_get_path (ctx->current)); mm_object_get_path (ctx->current));
mm_modem_voice_list_call (modem, mm_modem_voice_list_call (modem,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)list_call_ready, (GAsyncReadyCallback)list_call_ready,
ctx); ctx);
g_object_unref (modem); g_object_unref (modem);
return; return;
} }
@@ -1193,8 +1193,8 @@ look_for_call_in_modem (GetVoiceContext *ctx)
static void static void
get_voice_manager_ready (GDBusConnection *connection, get_voice_manager_ready (GDBusConnection *connection,
GAsyncResult *res, GAsyncResult *res,
GetVoiceContext *ctx) GetVoiceContext *ctx)
{ {
ctx->manager = mmcli_get_manager_finish (res); ctx->manager = mmcli_get_manager_finish (res);
ctx->modems = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (ctx->manager)); ctx->modems = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (ctx->manager));
@@ -1237,8 +1237,8 @@ get_call_path (const gchar *path_or_index)
MMCall * MMCall *
mmcli_get_call_finish (GAsyncResult *res, mmcli_get_call_finish (GAsyncResult *res,
MMManager **o_manager, MMManager **o_manager,
MMObject **o_object) MMObject **o_object)
{ {
GetVoiceContext *ctx; GetVoiceContext *ctx;
@@ -1250,12 +1250,13 @@ mmcli_get_call_finish (GAsyncResult *res,
return g_object_ref (ctx->call); return g_object_ref (ctx->call);
} }
void mmcli_get_call (GDBusConnection *connection, void
const gchar *path_or_index, mmcli_get_call (GDBusConnection *connection,
GCancellable *cancellable, const gchar *path_or_index,
GAsyncReadyCallback callback, GCancellable *cancellable,
gpointer user_data) { GAsyncReadyCallback callback,
gpointer user_data)
{
GetVoiceContext *ctx; GetVoiceContext *ctx;
ctx = g_new0 (GetVoiceContext, 1); ctx = g_new0 (GetVoiceContext, 1);
@@ -1272,11 +1273,12 @@ void mmcli_get_call (GDBusConnection *connection,
ctx); ctx);
} }
MMCall *mmcli_get_call_sync (GDBusConnection *connection, MMCall *
const gchar *path_or_index, mmcli_get_call_sync (GDBusConnection *connection,
MMManager **o_manager, const gchar *path_or_index,
MMObject **o_object) { MMManager **o_manager,
MMObject **o_object)
{
MMManager *manager; MMManager *manager;
GList *modems; GList *modems;
GList *l; GList *l;
@@ -1340,7 +1342,6 @@ MMCall *mmcli_get_call_sync (GDBusConnection *connection,
return found; return found;
} }
/* Common options */ /* Common options */
static gchar *modem_str; static gchar *modem_str;
static gchar *bearer_str; static gchar *bearer_str;

View File

@@ -79,18 +79,18 @@ MMSms *mmcli_get_sms_sync (GDBusConnection *connection,
MMManager **manager, MMManager **manager,
MMObject **object); MMObject **object);
void mmcli_get_call (GDBusConnection *connection, void mmcli_get_call (GDBusConnection *connection,
const gchar *path_or_index, const gchar *path_or_index,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
MMCall *mmcli_get_call_finish (GAsyncResult *res, MMCall *mmcli_get_call_finish (GAsyncResult *res,
MMManager **manager, MMManager **manager,
MMObject **object); MMObject **object);
MMCall *mmcli_get_call_sync (GDBusConnection *connection, MMCall *mmcli_get_call_sync (GDBusConnection *connection,
const gchar *path_or_index, const gchar *path_or_index,
MMManager **manager, MMManager **manager,
MMObject **object); MMObject **object);
const gchar *mmcli_get_state_reason_string (MMModemStateChangeReason reason); const gchar *mmcli_get_state_reason_string (MMModemStateChangeReason reason);

View File

@@ -253,8 +253,8 @@ delete_process_reply (gboolean result,
static void static void
delete_ready (MMModemVoice *modem, delete_ready (MMModemVoice *modem,
GAsyncResult *result, GAsyncResult *result,
gpointer nothing) gpointer nothing)
{ {
gboolean operation_result; gboolean operation_result;
GError *error = NULL; GError *error = NULL;
@@ -267,7 +267,7 @@ delete_ready (MMModemVoice *modem,
static void static void
get_call_to_delete_ready (GDBusConnection *connection, get_call_to_delete_ready (GDBusConnection *connection,
GAsyncResult *res) GAsyncResult *res)
{ {
MMCall *call; MMCall *call;
MMObject *obj = NULL; MMObject *obj = NULL;
@@ -281,10 +281,10 @@ get_call_to_delete_ready (GDBusConnection *connection,
} }
mm_modem_voice_delete_call (ctx->modem_voice, mm_modem_voice_delete_call (ctx->modem_voice,
mm_call_get_path (call), mm_call_get_path (call),
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)delete_ready, (GAsyncReadyCallback)delete_ready,
NULL); NULL);
g_object_unref (call); g_object_unref (call);
g_object_unref (obj); g_object_unref (obj);
} }
@@ -331,10 +331,10 @@ get_modem_ready (GObject *source,
/* Request to delete a given call? */ /* Request to delete a given call? */
if (delete_str) { if (delete_str) {
mmcli_get_call (ctx->connection, mmcli_get_call (ctx->connection,
delete_str, delete_str,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)get_call_to_delete_ready, (GAsyncReadyCallback)get_call_to_delete_ready,
NULL); NULL);
return; return;
} }
@@ -343,7 +343,7 @@ get_modem_ready (GObject *source,
void void
mmcli_modem_voice_run_asynchronous (GDBusConnection *connection, mmcli_modem_voice_run_asynchronous (GDBusConnection *connection,
GCancellable *cancellable) GCancellable *cancellable)
{ {
/* Initialize context */ /* Initialize context */
ctx = g_new0 (Context, 1); ctx = g_new0 (Context, 1);
@@ -413,9 +413,9 @@ mmcli_modem_voice_run_synchronous (GDBusConnection *connection)
MMObject *obj = NULL; MMObject *obj = NULL;
call = mmcli_get_call_sync (connection, call = mmcli_get_call_sync (connection,
delete_str, delete_str,
NULL, NULL,
&obj); &obj);
if (!g_str_equal (mm_object_get_path (obj), mm_modem_voice_get_path (ctx->modem_voice))) { if (!g_str_equal (mm_object_get_path (obj), mm_modem_voice_get_path (ctx->modem_voice))) {
g_printerr ("error: call '%s' not owned by modem '%s'", g_printerr ("error: call '%s' not owned by modem '%s'",
mm_call_get_path (call), mm_call_get_path (call),