Uncrustify sources

Ran `find src plugins -iname '*.[c|h]' -print0 | xargs -0 uncrustify --no-backup`
with some minimal manual intervention.
This commit is contained in:
Evangelos Ribeiro Tzaras
2022-04-24 12:24:55 +02:00
parent 8daa502de5
commit 7ac862155b
83 changed files with 1744 additions and 1869 deletions

View File

@@ -29,8 +29,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
struct _CallsDummyCall struct _CallsDummyCall {
{
GObject parent_instance; GObject parent_instance;
}; };

View File

@@ -31,8 +31,7 @@
#include <glib-object.h> #include <glib-object.h>
struct _CallsDummyOrigin struct _CallsDummyOrigin {
{
GObject parent_instance; GObject parent_instance;
GString *name; GString *name;
GList *calls; GList *calls;
@@ -99,8 +98,7 @@ remove_calls (CallsDummyOrigin *self, const gchar *reason)
} }
struct DisconnectedData struct DisconnectedData {
{
CallsDummyOrigin *self; CallsDummyOrigin *self;
CallsCall *call; CallsCall *call;
}; };

View File

@@ -22,8 +22,7 @@
* *
*/ */
#ifndef CALLS_DUMMY_ORIGIN_H__ #pragma once
#define CALLS_DUMMY_ORIGIN_H__
#include <glib-object.h> #include <glib-object.h>
@@ -38,5 +37,3 @@ void calls_dummy_origin_create_inbound (CallsDummyOrigin *self,
const gchar *number); const gchar *number);
G_END_DECLS G_END_DECLS
#endif /* CALLS_DUMMY_ORIGIN_H__ */

View File

@@ -37,8 +37,7 @@ static const char * const supported_protocols[] = {
NULL NULL
}; };
struct _CallsDummyProvider struct _CallsDummyProvider {
{
CallsProvider parent_instance; CallsProvider parent_instance;
GListStore *origins; GListStore *origins;
@@ -68,6 +67,7 @@ static gboolean
usr1_handler (CallsDummyProvider *self) usr1_handler (CallsDummyProvider *self)
{ {
GListModel *model; GListModel *model;
g_autoptr (CallsDummyOrigin) origin = NULL; g_autoptr (CallsDummyOrigin) origin = NULL;
model = G_LIST_MODEL (self->origins); model = G_LIST_MODEL (self->origins);
@@ -85,9 +85,10 @@ usr1_handler (CallsDummyProvider *self)
static gboolean static gboolean
usr2_handler (CallsDummyProvider *self) usr2_handler (CallsDummyProvider *self)
{ {
GListModel *model;
g_autoptr (CallsDummyOrigin) origin = NULL; g_autoptr (CallsDummyOrigin) origin = NULL;
GListModel *model;
model = G_LIST_MODEL (self->origins); model = G_LIST_MODEL (self->origins);
g_return_val_if_fail (g_list_model_get_n_items (model) > 0, FALSE); g_return_val_if_fail (g_list_model_get_n_items (model) > 0, FALSE);

View File

@@ -33,8 +33,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
struct _CallsMMCall struct _CallsMMCall {
{
GObject parent_instance; GObject parent_instance;
MMCall *mm_call; MMCall *mm_call;
gchar *disconnect_reason; gchar *disconnect_reason;
@@ -61,8 +60,7 @@ notify_id_cb (CallsMMCall *self,
} }
struct CallsMMCallStateReasonMap struct CallsMMCallStateReasonMap {
{
MMCallStateReason value; MMCallStateReason value;
const gchar *desc; const gchar *desc;
}; };
@@ -95,14 +93,10 @@ set_disconnect_reason (CallsMMCall *self,
const struct CallsMMCallStateReasonMap *map_row; const struct CallsMMCallStateReasonMap *map_row;
if (self->disconnect_reason) if (self->disconnect_reason)
{
g_free (self->disconnect_reason); g_free (self->disconnect_reason);
}
for (map_row = STATE_REASON_MAP; map_row->desc; ++map_row) for (map_row = STATE_REASON_MAP; map_row->desc; ++map_row) {
{ if (map_row->value == reason) {
if (map_row->value == reason)
{
self->disconnect_reason = self->disconnect_reason =
g_strdup (gettext (map_row->desc)); g_strdup (gettext (map_row->desc));
return; return;
@@ -117,8 +111,7 @@ set_disconnect_reason (CallsMMCall *self,
} }
struct CallsMMCallStateMap struct CallsMMCallStateMap {
{
MMCallState mm; MMCallState mm;
CallsCallState calls; CallsCallState calls;
const gchar *name; const gchar *name;
@@ -152,14 +145,10 @@ state_changed_cb (CallsMMCall *self,
const struct CallsMMCallStateMap *map_row; const struct CallsMMCallStateMap *map_row;
if (mm_new == MM_CALL_STATE_TERMINATED) if (mm_new == MM_CALL_STATE_TERMINATED)
{
set_disconnect_reason (self, reason); set_disconnect_reason (self, reason);
}
for (map_row = STATE_MAP; map_row->mm != -1; ++map_row) for (map_row = STATE_MAP; map_row->mm != -1; ++map_row) {
{ if (map_row->mm == mm_new) {
if (map_row->mm == mm_new)
{
g_debug ("MM call state changed to `%s'", g_debug ("MM call state changed to `%s'",
map_row->name); map_row->name);
calls_call_set_state (CALLS_CALL (self), map_row->calls); calls_call_set_state (CALLS_CALL (self), map_row->calls);
@@ -175,8 +164,7 @@ calls_mm_call_get_protocol (CallsCall *self)
return "tel"; return "tel";
} }
struct CallsMMOperationData struct CallsMMOperationData {
{
const gchar *desc; const gchar *desc;
CallsMMCall *self; CallsMMCall *self;
gboolean (*finish_func) (MMCall *, GAsyncResult *, GError **); gboolean (*finish_func) (MMCall *, GAsyncResult *, GError **);
@@ -188,11 +176,11 @@ operation_cb (MMCall *mm_call,
struct CallsMMOperationData *data) struct CallsMMOperationData *data)
{ {
gboolean ok; gboolean ok;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
ok = data->finish_func (mm_call, res, &error); ok = data->finish_func (mm_call, res, &error);
if (!ok) if (!ok) {
{
g_warning ("Error %s ModemManager call to `%s': %s", g_warning ("Error %s ModemManager call to `%s': %s",
data->desc, data->desc,
calls_call_get_id (CALLS_CALL (data->self)), calls_call_get_id (CALLS_CALL (data->self)),

View File

@@ -34,8 +34,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
struct _CallsMMOrigin struct _CallsMMOrigin {
{
GObject parent_instance; GObject parent_instance;
MMObject *mm_obj; MMObject *mm_obj;
MMModemVoice *voice; MMModemVoice *voice;
@@ -86,6 +85,7 @@ ussd_initiate_cb (GObject *object,
gpointer user_data) gpointer user_data)
{ {
MMModem3gppUssd *ussd = (MMModem3gppUssd *) object; MMModem3gppUssd *ussd = (MMModem3gppUssd *) object;
g_autoptr (GTask) task = user_data; g_autoptr (GTask) task = user_data;
CallsMMOrigin *self = user_data; CallsMMOrigin *self = user_data;
char *response = NULL; char *response = NULL;
@@ -111,6 +111,7 @@ ussd_reinitiate_cb (GObject *object,
gpointer user_data) gpointer user_data)
{ {
CallsUssd *ussd = (CallsUssd *) object; CallsUssd *ussd = (CallsUssd *) object;
g_autoptr (GTask) task = user_data; g_autoptr (GTask) task = user_data;
CallsMMOrigin *self = user_data; CallsMMOrigin *self = user_data;
GCancellable *cancellable; GCancellable *cancellable;
@@ -141,6 +142,7 @@ ussd_respond_cb (GObject *object,
{ {
MMModem3gppUssd *ussd = (MMModem3gppUssd *) object; MMModem3gppUssd *ussd = (MMModem3gppUssd *) object;
CallsMMOrigin *self; CallsMMOrigin *self;
g_autoptr (GTask) task = user_data; g_autoptr (GTask) task = user_data;
char *response = NULL; char *response = NULL;
GError *error = NULL; GError *error = NULL;
@@ -166,6 +168,7 @@ ussd_cancel_cb (GObject *object,
{ {
MMModem3gppUssd *ussd = (MMModem3gppUssd *) object; MMModem3gppUssd *ussd = (MMModem3gppUssd *) object;
CallsMMOrigin *self; CallsMMOrigin *self;
g_autoptr (GTask) task = user_data; g_autoptr (GTask) task = user_data;
GError *error = NULL; GError *error = NULL;
gboolean response; gboolean response;
@@ -203,6 +206,7 @@ calls_mm_ussd_initiate_async (CallsUssd *ussd,
gpointer user_data) gpointer user_data)
{ {
CallsMMOrigin *self = CALLS_MM_ORIGIN (ussd); CallsMMOrigin *self = CALLS_MM_ORIGIN (ussd);
g_autoptr (GTask) task = NULL; g_autoptr (GTask) task = NULL;
CallsUssdState state; CallsUssdState state;
@@ -210,15 +214,13 @@ calls_mm_ussd_initiate_async (CallsUssd *ussd,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
if (!self->ussd) if (!self->ussd) {
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
"No USSD interface found"); "No USSD interface found");
return; return;
} }
if (!command || !*command) if (!command || !*command) {
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
"USSD command empty"); "USSD command empty");
return; return;
@@ -312,11 +314,11 @@ dial_cb (MMModemVoice *voice,
CallsMMOrigin *self) CallsMMOrigin *self)
{ {
MMCall *call; MMCall *call;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
call = mm_modem_voice_create_call_finish (voice, res, &error); call = mm_modem_voice_create_call_finish (voice, res, &error);
if (!call) if (!call) {
{
g_warning ("Error dialing number on ModemManager modem `%s': %s", g_warning ("Error dialing number on ModemManager modem `%s': %s",
self->name, error->message); self->name, error->message);
CALLS_ERROR (self, error); CALLS_ERROR (self, error);
@@ -365,8 +367,7 @@ remove_calls (CallsMMOrigin *self, const gchar *reason)
paths = g_hash_table_get_keys (self->calls); paths = g_hash_table_get_keys (self->calls);
for (node = paths; node != NULL; node = node->next) for (node = paths; node != NULL; node = node->next) {
{
g_hash_table_steal_extended (self->calls, node->data, NULL, &call); g_hash_table_steal_extended (self->calls, node->data, NULL, &call);
g_signal_emit_by_name (self, "call-removed", g_signal_emit_by_name (self, "call-removed",
CALLS_CALL (call), reason); CALLS_CALL (call), reason);
@@ -377,8 +378,7 @@ remove_calls (CallsMMOrigin *self, const gchar *reason)
} }
struct CallsMMOriginDeleteCallData struct CallsMMOriginDeleteCallData {
{
CallsMMOrigin *self; CallsMMOrigin *self;
gchar *path; gchar *path;
}; };
@@ -390,11 +390,11 @@ delete_call_cb (MMModemVoice *voice,
struct CallsMMOriginDeleteCallData *data) struct CallsMMOriginDeleteCallData *data)
{ {
gboolean ok; gboolean ok;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
ok = mm_modem_voice_delete_call_finish (voice, res, &error); ok = mm_modem_voice_delete_call_finish (voice, res, &error);
if (!ok) if (!ok) {
{
g_warning ("Error deleting call `%s' on MMModemVoice `%s': %s", g_warning ("Error deleting call `%s' on MMModemVoice `%s': %s",
data->path, data->self->name, error->message); data->path, data->self->name, error->message);
CALLS_ERROR (data->self, error); CALLS_ERROR (data->self, error);
@@ -460,9 +460,8 @@ add_call (CallsMMOrigin *self,
g_signal_emit_by_name (CALLS_ORIGIN (self), "call-added", g_signal_emit_by_name (CALLS_ORIGIN (self), "call-added",
CALLS_CALL (call)); CALLS_CALL (call));
if (mm_call_get_state (mm_call) == MM_CALL_STATE_TERMINATED) if (mm_call_get_state (mm_call) == MM_CALL_STATE_TERMINATED) {
{ /* Delete any remnant disconnected call */
// Delete any remnant disconnected call
delete_call (self, call); delete_call (self, call);
} }
@@ -476,8 +475,7 @@ add_call (CallsMMOrigin *self,
} }
struct CallsMMOriginCallAddedData struct CallsMMOriginCallAddedData {
{
CallsMMOrigin *self; CallsMMOrigin *self;
gchar *path; gchar *path;
}; };
@@ -488,45 +486,37 @@ call_added_list_calls_cb (MMModemVoice *voice,
GAsyncResult *res, GAsyncResult *res,
struct CallsMMOriginCallAddedData *data) struct CallsMMOriginCallAddedData *data)
{ {
GList *calls;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
GList *calls;
calls = mm_modem_voice_list_calls_finish (voice, res, &error); calls = mm_modem_voice_list_calls_finish (voice, res, &error);
if (!calls) if (!calls) {
{ if (error) {
if (error)
{
g_warning ("Error listing calls on MMModemVoice `%s'" g_warning ("Error listing calls on MMModemVoice `%s'"
" after call-added signal: %s", " after call-added signal: %s",
data->self->name, error->message); data->self->name, error->message);
CALLS_ERROR (data->self, error); CALLS_ERROR (data->self, error);
} } else {
else
{
g_warning ("No calls on MMModemVoice `%s'" g_warning ("No calls on MMModemVoice `%s'"
" after call-added signal", " after call-added signal",
data->self->name); data->self->name);
} }
} } else {
else
{
GList *node; GList *node;
MMCall *call; MMCall *call;
gboolean found = FALSE; gboolean found = FALSE;
for (node = calls; node; node = node->next) for (node = calls; node; node = node->next) {
{
call = MM_CALL (node->data); call = MM_CALL (node->data);
if (g_strcmp0 (mm_call_get_path (call), data->path) == 0) if (g_strcmp0 (mm_call_get_path (call), data->path) == 0) {
{
add_call (data->self, call); add_call (data->self, call);
found = TRUE; found = TRUE;
} }
} }
if (!found) if (!found) {
{
g_warning ("Could not find new call `%s' in call list" g_warning ("Could not find new call `%s' in call list"
" on MMModemVoice `%s' after call-added signal", " on MMModemVoice `%s' after call-added signal",
data->path, data->self->name); data->path, data->self->name);
@@ -547,8 +537,7 @@ call_added_cb (MMModemVoice *voice,
{ {
struct CallsMMOriginCallAddedData *data; struct CallsMMOriginCallAddedData *data;
if (g_hash_table_contains (self->calls, path)) if (g_hash_table_contains (self->calls, path)) {
{
g_warning ("Received call-added signal for" g_warning ("Received call-added signal for"
" existing call object path `%s'", path); " existing call object path `%s'", path);
return; return;
@@ -582,8 +571,7 @@ call_deleted_cb (MMModemVoice *voice,
g_free (key); g_free (key);
if (!call) if (!call) {
{
g_warning ("Could not find removed call `%s'", path); g_warning ("Could not find removed call `%s'", path);
return; return;
} }
@@ -591,8 +579,7 @@ call_deleted_cb (MMModemVoice *voice,
reason = g_string_new ("Call removed"); reason = g_string_new ("Call removed");
mm_reason = calls_mm_call_get_disconnect_reason (CALLS_MM_CALL (call)); mm_reason = calls_mm_call_get_disconnect_reason (CALLS_MM_CALL (call));
if (mm_reason) if (mm_reason) {
{
g_string_assign (reason, mm_reason); g_string_assign (reason, mm_reason);
} }
@@ -611,13 +598,12 @@ list_calls_cb (MMModemVoice *voice,
CallsMMOrigin *self) CallsMMOrigin *self)
{ {
GList *calls, *node; GList *calls, *node;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
calls = mm_modem_voice_list_calls_finish (voice, res, &error); calls = mm_modem_voice_list_calls_finish (voice, res, &error);
if (!calls) if (!calls) {
{ if (error) {
if (error)
{
g_warning ("Error listing calls on MMModemVoice `%s': %s", g_warning ("Error listing calls on MMModemVoice `%s': %s",
self->name, error->message); self->name, error->message);
CALLS_ERROR (self, error); CALLS_ERROR (self, error);
@@ -625,8 +611,7 @@ list_calls_cb (MMModemVoice *voice,
return; return;
} }
for (node = calls; node; node = node->next) for (node = calls; node; node = node->next) {
{
add_call (self, MM_CALL (node->data)); add_call (self, MM_CALL (node->data));
} }
@@ -741,8 +726,7 @@ ussd_properties_changed_cb (CallsMMOrigin *self,
/* XXX: We check for user state only because the NetworkRequest /* XXX: We check for user state only because the NetworkRequest
* dbus property change isn't regularly emitted */ * dbus property change isn't regularly emitted */
if (state == CALLS_USSD_STATE_USER_RESPONSE || if (state == CALLS_USSD_STATE_USER_RESPONSE ||
(value = g_variant_lookup_value (properties, "NetworkRequest", NULL))) (value = g_variant_lookup_value (properties, "NetworkRequest", NULL))) {
{
response = mm_modem_3gpp_ussd_get_network_request (self->ussd); response = mm_modem_3gpp_ussd_get_network_request (self->ussd);
if (response && *response && response != self->last_ussd_request) if (response && *response && response != self->last_ussd_request)
@@ -754,8 +738,7 @@ ussd_properties_changed_cb (CallsMMOrigin *self,
} }
if (state != CALLS_USSD_STATE_USER_RESPONSE && if (state != CALLS_USSD_STATE_USER_RESPONSE &&
(value = g_variant_lookup_value (properties, "NetworkNotification", NULL))) (value = g_variant_lookup_value (properties, "NetworkNotification", NULL))) {
{
response = mm_modem_3gpp_ussd_get_network_notification (self->ussd); response = mm_modem_3gpp_ussd_get_network_notification (self->ussd);
if (response && *response && response != self->last_ussd_response) if (response && *response && response != self->last_ussd_response)
@@ -962,4 +945,3 @@ calls_mm_origin_matches (CallsMMOrigin *self,
return FALSE; return FALSE;
} }

View File

@@ -39,8 +39,7 @@ static const char * const supported_protocols[] = {
NULL NULL
}; };
struct _CallsMMProvider struct _CallsMMProvider {
{
CallsProvider parent_instance; CallsProvider parent_instance;
/* The status property */ /* The status property */
@@ -66,9 +65,7 @@ set_status (CallsMMProvider *self,
const gchar *new_status) const gchar *new_status)
{ {
if (strcmp (self->status, new_status) == 0) if (strcmp (self->status, new_status) == 0)
{
return; return;
}
g_free (self->status); g_free (self->status);
self->status = g_strdup (new_status); self->status = g_strdup (new_status);
@@ -81,16 +78,11 @@ update_status (CallsMMProvider *self)
{ {
const gchar *s; const gchar *s;
if (!self->mm) if (!self->mm) {
{
s = _("ModemManager unavailable"); s = _("ModemManager unavailable");
} } else if (g_list_model_get_n_items (G_LIST_MODEL (self->origins)) == 0) {
else if (g_list_model_get_n_items (G_LIST_MODEL (self->origins)) == 0)
{
s = _("No voice-capable modem available"); s = _("No voice-capable modem available");
} } else {
else
{
s = _("Normal"); s = _("Normal");
} }
@@ -111,8 +103,7 @@ mm_provider_contains (CallsMMProvider *self,
model = G_LIST_MODEL (self->origins); model = G_LIST_MODEL (self->origins);
n_items = g_list_model_get_n_items (model); n_items = g_list_model_get_n_items (model);
for (guint i = 0; i < n_items; i++) for (guint i = 0; i < n_items; i++) {
{
g_autoptr (CallsMMOrigin) origin = NULL; g_autoptr (CallsMMOrigin) origin = NULL;
origin = g_list_model_get_item (model, i); origin = g_list_model_get_item (model, i);
@@ -129,6 +120,7 @@ add_origin (CallsMMProvider *self,
GDBusObject *object) GDBusObject *object)
{ {
MMObject *mm_obj; MMObject *mm_obj;
g_autoptr (CallsMMOrigin) origin = NULL; g_autoptr (CallsMMOrigin) origin = NULL;
g_autoptr (MMModem3gpp) modem_3gpp = NULL; g_autoptr (MMModem3gpp) modem_3gpp = NULL;
const gchar *path; const gchar *path;
@@ -136,8 +128,7 @@ add_origin (CallsMMProvider *self,
mm_obj = MM_OBJECT (object); mm_obj = MM_OBJECT (object);
path = g_dbus_object_get_object_path (object); path = g_dbus_object_get_object_path (object);
if (mm_provider_contains (self, mm_obj)) if (mm_provider_contains (self, mm_obj)) {
{
g_warning ("New voice interface on existing" g_warning ("New voice interface on existing"
" origin with path `%s'", path); " origin with path `%s'", path);
return; return;
@@ -172,8 +163,7 @@ interface_added_cb (CallsMMProvider *self,
g_dbus_object_get_object_path (object)); g_dbus_object_get_object_path (object));
if (g_strcmp0 (info->name, if (g_strcmp0 (info->name,
"org.freedesktop.ModemManager1.Modem.Voice") == 0) "org.freedesktop.ModemManager1.Modem.Voice") == 0) {
{
add_origin (self, object); add_origin (self, object);
} }
} }
@@ -195,8 +185,7 @@ remove_modem_object (CallsMMProvider *self,
origin = g_list_model_get_item (model, i); origin = g_list_model_get_item (model, i);
if (calls_mm_origin_matches (origin, MM_OBJECT (object))) if (calls_mm_origin_matches (origin, MM_OBJECT (object))) {
{
g_list_store_remove (self->origins, i); g_list_store_remove (self->origins, i);
update_status (self); update_status (self);
@@ -221,8 +210,7 @@ interface_removed_cb (CallsMMProvider *self,
info->name, path); info->name, path);
if (g_strcmp0 (info->name, if (g_strcmp0 (info->name,
"org.freedesktop.ModemManager1.Modem.Voice") == 0) "org.freedesktop.ModemManager1.Modem.Voice") == 0) {
{
remove_modem_object (self, path, object); remove_modem_object (self, path, object);
} }
} }
@@ -234,8 +222,7 @@ add_mm_object (CallsMMProvider *self, GDBusObject *object)
GList *ifaces, *node; GList *ifaces, *node;
ifaces = g_dbus_object_get_interfaces (object); ifaces = g_dbus_object_get_interfaces (object);
for (node = ifaces; node; node = node->next) for (node = ifaces; node; node = node->next) {
{
interface_added_cb (self, object, interface_added_cb (self, object,
G_DBUS_INTERFACE (node->data)); G_DBUS_INTERFACE (node->data));
} }
@@ -250,8 +237,7 @@ add_mm_objects (CallsMMProvider *self)
GList *objects, *node; GList *objects, *node;
objects = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (self->mm)); objects = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (self->mm));
for (node = objects; node; node = node->next) for (node = objects; node; node = node->next) {
{
add_mm_object (self, G_DBUS_OBJECT (node->data)); add_mm_object (self, G_DBUS_OBJECT (node->data));
} }
@@ -291,8 +277,7 @@ mm_manager_new_cb (GDBusConnection *connection,
GError *error = NULL; GError *error = NULL;
self->mm = mm_manager_new_finish (res, &error); self->mm = mm_manager_new_finish (res, &error);
if (!self->mm) if (!self->mm) {
{
g_error ("Error creating ModemManager Manager: %s", g_error ("Error creating ModemManager Manager: %s",
error->message); error->message);
g_assert_not_reached (); g_assert_not_reached ();
@@ -402,8 +387,7 @@ dispose (GObject *object)
{ {
CallsMMProvider *self = CALLS_MM_PROVIDER (object); CallsMMProvider *self = CALLS_MM_PROVIDER (object);
if (self->watch_id) if (self->watch_id) {
{
g_bus_unwatch_name (self->watch_id); g_bus_unwatch_name (self->watch_id);
self->watch_id = 0; self->watch_id = 0;
} }

View File

@@ -16,8 +16,7 @@
#include <glib.h> #include <glib.h>
struct mcc_list struct mcc_list {
{
guint mcc; guint mcc;
char code[3]; char code[3];
}; };

View File

@@ -31,8 +31,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
struct _CallsOfonoCall struct _CallsOfonoCall {
{
GObject parent_instance; GObject parent_instance;
GDBOVoiceCall *voice_call; GDBOVoiceCall *voice_call;
gchar *disconnect_reason; gchar *disconnect_reason;
@@ -63,8 +62,7 @@ calls_ofono_call_get_protocol (CallsCall *call)
return "tel"; return "tel";
} }
struct CallsCallOperationData struct CallsCallOperationData {
{
const gchar *desc; const gchar *desc;
CallsOfonoCall *self; CallsOfonoCall *self;
gboolean (*finish_func) (GDBOVoiceCall *, GAsyncResult *, GError **); gboolean (*finish_func) (GDBOVoiceCall *, GAsyncResult *, GError **);
@@ -76,9 +74,10 @@ operation_cb (GDBOVoiceCall *voice_call,
GAsyncResult *res, GAsyncResult *res,
struct CallsCallOperationData *data) struct CallsCallOperationData *data)
{ {
gboolean ok;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
gboolean ok;
ok = data->finish_func (voice_call, res, &error); ok = data->finish_func (voice_call, res, &error);
if (!ok) { if (!ok) {
g_warning ("Error %s oFono voice call to `%s': %s", g_warning ("Error %s oFono voice call to `%s': %s",
@@ -133,6 +132,7 @@ static void
calls_ofono_call_send_dtmf_tone (CallsCall *call, gchar key) calls_ofono_call_send_dtmf_tone (CallsCall *call, gchar key)
{ {
CallsOfonoCall *self = CALLS_OFONO_CALL (call); CallsOfonoCall *self = CALLS_OFONO_CALL (call);
if (calls_call_get_state (call) != CALLS_CALL_STATE_ACTIVE) { if (calls_call_get_state (call) != CALLS_CALL_STATE_ACTIVE) {
g_warning ("Tone start requested for non-active call to `%s'", g_warning ("Tone start requested for non-active call to `%s'",
calls_call_get_id (call)); calls_call_get_id (call));

View File

@@ -32,8 +32,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
struct _CallsOfonoOrigin struct _CallsOfonoOrigin {
{
GObject parent_instance; GObject parent_instance;
GDBusConnection *connection; GDBusConnection *connection;
GDBOModem *modem; GDBOModem *modem;
@@ -71,12 +70,12 @@ dial_cb (GDBOVoiceCallManager *voice,
CallsOfonoOrigin *self) CallsOfonoOrigin *self)
{ {
gboolean ok; gboolean ok;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
ok = gdbo_voice_call_manager_call_dial_finish ok = gdbo_voice_call_manager_call_dial_finish
(voice, NULL, res, &error); (voice, NULL, res, &error);
if (!ok) if (!ok) {
{
g_warning ("Error dialing number on modem `%s': %s", g_warning ("Error dialing number on modem `%s': %s",
self->name, error->message); self->name, error->message);
CALLS_ERROR (self, error); CALLS_ERROR (self, error);
@@ -205,8 +204,7 @@ remove_call (CallsOfonoOrigin *self,
} }
struct CallsRemoveCallsData struct CallsRemoveCallsData {
{
CallsOrigin *origin; CallsOrigin *origin;
const gchar *reason; const gchar *reason;
}; };
@@ -232,8 +230,7 @@ remove_calls (CallsOfonoOrigin *self, const gchar *reason)
} }
struct CallsVoiceCallProxyNewData struct CallsVoiceCallProxyNewData {
{
CallsOfonoOrigin *self; CallsOfonoOrigin *self;
GVariant *properties; GVariant *properties;
}; };
@@ -250,20 +247,17 @@ send_tones_cb (GDBOVoiceCallManager *voice,
/* Deal with old tones */ /* Deal with old tones */
ok = gdbo_voice_call_manager_call_send_tones_finish ok = gdbo_voice_call_manager_call_send_tones_finish
(voice, res, &error); (voice, res, &error);
if (!ok) if (!ok) {
{
g_warning ("Error sending DTMF tones to network on modem `%s': %s", g_warning ("Error sending DTMF tones to network on modem `%s': %s",
self->name, error->message); self->name, error->message);
CALLS_EMIT_MESSAGE (self, error->message, GTK_MESSAGE_WARNING); CALLS_EMIT_MESSAGE (self, error->message, GTK_MESSAGE_WARNING);
} }
/* Possibly send new tones */ /* Possibly send new tones */
if (self->tone_queue) if (self->tone_queue) {
{
g_debug ("Sending queued DTMF tones `%s'", self->tone_queue->str); g_debug ("Sending queued DTMF tones `%s'", self->tone_queue->str);
gdbo_voice_call_manager_call_send_tones gdbo_voice_call_manager_call_send_tones (voice,
(voice,
self->tone_queue->str, self->tone_queue->str,
NULL, NULL,
(GAsyncReadyCallback) send_tones_cb, (GAsyncReadyCallback) send_tones_cb,
@@ -271,9 +265,7 @@ send_tones_cb (GDBOVoiceCallManager *voice,
g_string_free (self->tone_queue, TRUE); g_string_free (self->tone_queue, TRUE);
self->tone_queue = NULL; self->tone_queue = NULL;
} } else {
else
{
self->sending_tones = FALSE; self->sending_tones = FALSE;
} }
} }
@@ -285,23 +277,16 @@ tone_cb (CallsOfonoOrigin *self,
{ {
const gchar key_str[2] = { key, '\0' }; const gchar key_str[2] = { key, '\0' };
if (self->sending_tones) if (self->sending_tones) {
{ if (self->tone_queue) {
if (self->tone_queue)
{
g_string_append_c (self->tone_queue, key); g_string_append_c (self->tone_queue, key);
} } else {
else
{
self->tone_queue = g_string_new (key_str); self->tone_queue = g_string_new (key_str);
} }
} } else {
else
{
g_debug ("Sending immediate DTMF tone `%c'", key); g_debug ("Sending immediate DTMF tone `%c'", key);
gdbo_voice_call_manager_call_send_tones gdbo_voice_call_manager_call_send_tones (self->voice,
(self->voice,
key_str, key_str,
NULL, NULL,
(GAsyncReadyCallback) send_tones_cb, (GAsyncReadyCallback) send_tones_cb,
@@ -318,13 +303,13 @@ voice_call_proxy_new_cb (GDBusConnection *connection,
{ {
CallsOfonoOrigin *self = data->self; CallsOfonoOrigin *self = data->self;
GDBOVoiceCall *voice_call; GDBOVoiceCall *voice_call;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
const gchar *path; const gchar *path;
CallsOfonoCall *call; CallsOfonoCall *call;
voice_call = gdbo_voice_call_proxy_new_finish (res, &error); voice_call = gdbo_voice_call_proxy_new_finish (res, &error);
if (!voice_call) if (!voice_call) {
{
g_variant_unref (data->properties); g_variant_unref (data->properties);
g_free (data); g_free (data);
g_warning ("Error creating oFono VoiceCall proxy: %s", g_warning ("Error creating oFono VoiceCall proxy: %s",
@@ -357,8 +342,7 @@ call_added_cb (GDBOVoiceCallManager *voice,
g_debug ("Adding call `%s'", path); g_debug ("Adding call `%s'", path);
if (g_hash_table_lookup (self->calls, path)) if (g_hash_table_lookup (self->calls, path)) {
{
g_warning ("Call `%s' already exists", path); g_warning ("Call `%s' already exists", path);
return; return;
} }
@@ -393,8 +377,7 @@ call_removed_cb (GDBOVoiceCallManager *voice,
g_debug ("Removing call `%s'", path); g_debug ("Removing call `%s'", path);
ofono_call = g_hash_table_lookup (self->calls, path); ofono_call = g_hash_table_lookup (self->calls, path);
if (!ofono_call) if (!ofono_call) {
{
g_warning ("Could not find removed call `%s'", path); g_warning ("Could not find removed call `%s'", path);
return; return;
} }
@@ -402,8 +385,7 @@ call_removed_cb (GDBOVoiceCallManager *voice,
reason = g_string_new ("Call removed"); reason = g_string_new ("Call removed");
ofono_reason = calls_ofono_call_get_disconnect_reason (ofono_call); ofono_reason = calls_ofono_call_get_disconnect_reason (ofono_call);
if (ofono_reason) if (ofono_reason) {
{
/* The oFono reason is either "local", "remote" or "network". /* The oFono reason is either "local", "remote" or "network".
* We just capitalise that to create a nice reason string. * We just capitalise that to create a nice reason string.
*/ */
@@ -426,6 +408,7 @@ get_calls_cb (GDBOVoiceCallManager *voice,
{ {
gboolean ok; gboolean ok;
GVariant *calls_with_properties = NULL; GVariant *calls_with_properties = NULL;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
GVariantIter *iter = NULL; GVariantIter *iter = NULL;
const gchar *path; const gchar *path;
@@ -433,8 +416,7 @@ get_calls_cb (GDBOVoiceCallManager *voice,
ok = gdbo_voice_call_manager_call_get_calls_finish ok = gdbo_voice_call_manager_call_get_calls_finish
(voice, &calls_with_properties, res, &error); (voice, &calls_with_properties, res, &error);
if (!ok) if (!ok) {
{
g_warning ("Error getting calls from oFono" g_warning ("Error getting calls from oFono"
" VoiceCallManager `%s': %s", " VoiceCallManager `%s': %s",
self->name, error->message); self->name, error->message);
@@ -471,8 +453,7 @@ voice_new_cb (GDBusConnection *connection,
self->voice = gdbo_voice_call_manager_proxy_new_finish self->voice = gdbo_voice_call_manager_proxy_new_finish
(res, &error); (res, &error);
if (!self->voice) if (!self->voice) {
{
g_warning ("Error creating oFono" g_warning ("Error creating oFono"
" VoiceCallManager `%s' proxy: %s", " VoiceCallManager `%s' proxy: %s",
self->name, error->message); self->name, error->message);
@@ -510,9 +491,7 @@ constructed (GObject *object)
name = g_object_get_data (G_OBJECT (self->modem), name = g_object_get_data (G_OBJECT (self->modem),
"calls-modem-name"); "calls-modem-name");
if (name) if (name)
{
self->name = g_strdup (name); self->name = g_strdup (name);
}
gdbo_voice_call_manager_proxy_new gdbo_voice_call_manager_proxy_new
(self->connection, (self->connection,
@@ -545,8 +524,7 @@ finalize (GObject *object)
{ {
CallsOfonoOrigin *self = CALLS_OFONO_ORIGIN (object); CallsOfonoOrigin *self = CALLS_OFONO_ORIGIN (object);
if (self->tone_queue) if (self->tone_queue) {
{
g_string_free (self->tone_queue, TRUE); g_string_free (self->tone_queue, TRUE);
} }
g_free (self->name); g_free (self->name);

View File

@@ -41,8 +41,7 @@ static const char * const supported_protocols[] = {
NULL NULL
}; };
struct _CallsOfonoProvider struct _CallsOfonoProvider {
{
CallsProvider parent_instance; CallsProvider parent_instance;
/* The status property */ /* The status property */
@@ -73,8 +72,7 @@ static void
set_status (CallsOfonoProvider *self, set_status (CallsOfonoProvider *self,
const gchar *new_status) const gchar *new_status)
{ {
if (strcmp (self->status, new_status) == 0) if (strcmp (self->status, new_status) == 0) {
{
return; return;
} }
@@ -92,16 +90,11 @@ update_status (CallsOfonoProvider *self)
model = G_LIST_MODEL (self->origins); model = G_LIST_MODEL (self->origins);
if (!self->connection) if (!self->connection) {
{
s = _("DBus unavailable"); s = _("DBus unavailable");
} } else if (g_list_model_get_n_items (model) == 0) {
else if (g_list_model_get_n_items (model) == 0)
{
s = _("No voice-capable modem available"); s = _("No voice-capable modem available");
} } else {
else
{
s = _("Normal"); s = _("Normal");
} }
@@ -122,14 +115,12 @@ ofono_find_origin_index (CallsOfonoProvider *self,
model = G_LIST_MODEL (self->origins); model = G_LIST_MODEL (self->origins);
n_items = g_list_model_get_n_items (model); n_items = g_list_model_get_n_items (model);
for (guint i = 0; i < n_items; i++) for (guint i = 0; i < n_items; i++) {
{
g_autoptr (CallsOfonoOrigin) origin = NULL; g_autoptr (CallsOfonoOrigin) origin = NULL;
origin = g_list_model_get_item (model, i); origin = g_list_model_get_item (model, i);
if (calls_ofono_origin_matches (origin, path)) if (calls_ofono_origin_matches (origin, path)) {
{
if (index) if (index)
*index = i; *index = i;
@@ -148,10 +139,10 @@ object_array_includes (GVariantIter *iter,
{ {
const gchar *str; const gchar *str;
gboolean found = FALSE; gboolean found = FALSE;
while (g_variant_iter_loop (iter, "&s", &str)) while (g_variant_iter_loop (iter, "&s", &str))
{ {
if (g_strcmp0 (str, needle) == 0) if (g_strcmp0 (str, needle) == 0) {
{
found = TRUE; found = TRUE;
break; break;
} }
@@ -176,23 +167,19 @@ modem_check_ifaces (CallsOfonoProvider *self,
g_variant_get (ifaces, "as", &iter); g_variant_get (ifaces, "as", &iter);
voice = object_array_includes voice = object_array_includes (iter, "org.ofono.VoiceCallManager");
(iter, "org.ofono.VoiceCallManager");
path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (modem)); path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (modem));
has_origin = ofono_find_origin_index (self, path, &index); has_origin = ofono_find_origin_index (self, path, &index);
if (voice && !has_origin) if (voice && !has_origin) {
{
g_autoptr (CallsOfonoOrigin) origin = NULL; g_autoptr (CallsOfonoOrigin) origin = NULL;
g_debug ("Adding oFono Origin with path `%s'", path); g_debug ("Adding oFono Origin with path `%s'", path);
origin = calls_ofono_origin_new (modem); origin = calls_ofono_origin_new (modem);
g_list_store_append (self->origins, origin); g_list_store_append (self->origins, origin);
} } else if (!voice && has_origin) {
else if (!voice && has_origin)
{
g_list_store_remove (self->origins, index); g_list_store_remove (self->origins, index);
} }
} }
@@ -209,9 +196,7 @@ modem_property_changed_cb (GDBOModem *modem,
g_debug ("Modem property `%s' changed", name); g_debug ("Modem property `%s' changed", name);
if (g_strcmp0 (name, "Interfaces") != 0) if (g_strcmp0 (name, "Interfaces") != 0)
{
return; return;
}
modem_name = g_object_get_data (G_OBJECT (modem), modem_name = g_object_get_data (G_OBJECT (modem),
"calls-modem-name"); "calls-modem-name");
@@ -223,8 +208,7 @@ modem_property_changed_cb (GDBOModem *modem,
} }
struct CallsModemProxyNewData struct CallsModemProxyNewData {
{
CallsOfonoProvider *self; CallsOfonoProvider *self;
gchar *name; gchar *name;
GVariant *ifaces; GVariant *ifaces;
@@ -241,8 +225,7 @@ modem_proxy_new_cb (GDBusConnection *connection,
const gchar *path; const gchar *path;
modem = gdbo_modem_proxy_new_finish (res, &error); modem = gdbo_modem_proxy_new_finish (res, &error);
if (!modem) if (!modem) {
{
g_variant_unref (data->ifaces); g_variant_unref (data->ifaces);
g_free (data->name); g_free (data->name);
g_free (data); g_free (data);
@@ -266,8 +249,7 @@ modem_proxy_new_cb (GDBusConnection *connection,
g_hash_table_insert (data->self->modems, g_strdup (path), modem); g_hash_table_insert (data->self->modems, g_strdup (path), modem);
if (data->ifaces) if (data->ifaces) {
{
modem_check_ifaces (data->self, modem, modem_check_ifaces (data->self, modem,
data->name, data->ifaces); data->name, data->ifaces);
g_variant_unref (data->ifaces); g_variant_unref (data->ifaces);
@@ -324,8 +306,7 @@ modem_added_cb (GDBOManager *manager,
g_debug ("Adding modem `%s'", path); g_debug ("Adding modem `%s'", path);
if (g_hash_table_lookup (self->modems, path)) if (g_hash_table_lookup (self->modems, path)) {
{
g_warning ("Modem `%s' already exists", path); g_warning ("Modem `%s' already exists", path);
return; return;
} }
@@ -336,8 +317,7 @@ modem_added_cb (GDBOManager *manager,
data->ifaces = g_variant_lookup_value data->ifaces = g_variant_lookup_value
(properties, "Interfaces", G_VARIANT_TYPE_ARRAY); (properties, "Interfaces", G_VARIANT_TYPE_ARRAY);
if (data->ifaces) if (data->ifaces) {
{
g_variant_ref (data->ifaces); g_variant_ref (data->ifaces);
} }
@@ -377,17 +357,17 @@ get_modems_cb (GDBOManager *manager,
GAsyncResult *res, GAsyncResult *res,
CallsOfonoProvider *self) CallsOfonoProvider *self)
{ {
g_autoptr (GError) error = NULL;
gboolean ok; gboolean ok;
GVariant *modems; GVariant *modems;
GVariantIter *modems_iter = NULL; GVariantIter *modems_iter = NULL;
g_autoptr (GError) error = NULL;
const gchar *path; const gchar *path;
GVariant *properties; GVariant *properties;
ok = gdbo_manager_call_get_modems_finish (manager, &modems, ok = gdbo_manager_call_get_modems_finish (manager, &modems,
res, &error); res, &error);
if (!ok) if (!ok) {
{
g_warning ("Error getting modems from oFono Manager: %s", g_warning ("Error getting modems from oFono Manager: %s",
error->message); error->message);
CALLS_ERROR (self, error); CALLS_ERROR (self, error);
@@ -442,8 +422,7 @@ ofono_appeared_cb (GDBusConnection *connection,
{ {
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
self->connection = connection; self->connection = connection;
if (!self->connection) if (!self->connection) {
{
g_error ("Error creating D-Bus connection: %s", g_error ("Error creating D-Bus connection: %s",
error->message); error->message);
} }
@@ -455,8 +434,7 @@ ofono_appeared_cb (GDBusConnection *connection,
"/", "/",
NULL, NULL,
&error); &error);
if (!self->manager) if (!self->manager) {
{
g_error ("Error creating ModemManager object manager proxy: %s", g_error ("Error creating ModemManager object manager proxy: %s",
error->message); error->message);
} }

View File

@@ -97,10 +97,10 @@ is_form_filled (CallsSipAccountWidget *self)
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self)); g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
return return
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->host)), "") != 0 && g_strcmp0 (gtk_entry_get_text (self->host), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->user)), "") != 0 && g_strcmp0 (gtk_entry_get_text (self->user), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->password)), "") != 0 && g_strcmp0 (gtk_entry_get_text (self->password), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->port)), "") != 0; g_strcmp0 (gtk_entry_get_text (self->port), "") != 0;
} }
@@ -270,6 +270,7 @@ find_protocol (CallsSipAccountWidget *self,
guint *index) guint *index)
{ {
guint len; guint len;
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self)); g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
len = g_list_model_get_n_items (G_LIST_MODEL (self->protocols_store)); len = g_list_model_get_n_items (G_LIST_MODEL (self->protocols_store));

View File

@@ -56,8 +56,7 @@ enum {
}; };
static GParamSpec *props[PROP_LAST_PROP]; static GParamSpec *props[PROP_LAST_PROP];
struct _CallsSipCall struct _CallsSipCall {
{
GObject parent_instance; GObject parent_instance;
CallsSipMediaManager *manager; CallsSipMediaManager *manager;

View File

@@ -48,8 +48,7 @@
* #CallsSipMediaPipeline objects that are ready to be used. * #CallsSipMediaPipeline objects that are ready to be used.
*/ */
typedef struct _CallsSipMediaManager typedef struct _CallsSipMediaManager {
{
GObject parent; GObject parent;
int address_family; int address_family;
@@ -95,6 +94,7 @@ static void
on_notify_preferred_audio_codecs (CallsSipMediaManager *self) on_notify_preferred_audio_codecs (CallsSipMediaManager *self)
{ {
GList *supported_codecs; GList *supported_codecs;
g_auto (GStrv) settings_codec_preference = NULL; g_auto (GStrv) settings_codec_preference = NULL;
g_assert (CALLS_IS_SIP_MEDIA_MANAGER (self)); g_assert (CALLS_IS_SIP_MEDIA_MANAGER (self));
@@ -228,6 +228,7 @@ calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self,
GList *supported_codecs) GList *supported_codecs)
{ {
char *payload_type = use_srtp ? "SAVP" : "AVP"; char *payload_type = use_srtp ? "SAVP" : "AVP";
g_autoptr (GString) media_line = NULL; g_autoptr (GString) media_line = NULL;
g_autoptr (GString) attribute_lines = NULL; g_autoptr (GString) attribute_lines = NULL;
GList *node; GList *node;

View File

@@ -966,8 +966,7 @@ diagnose_ports_in_use (CallsSipMediaPipeline *self)
if (same_socket) { if (same_socket) {
g_debug ("Diagnosing bidirectional socket..."); g_debug ("Diagnosing bidirectional socket...");
diagnose_used_ports_in_socket (socket_in); diagnose_used_ports_in_socket (socket_in);
} } else {
else {
g_debug ("Diagnosing server socket..."); g_debug ("Diagnosing server socket...");
diagnose_used_ports_in_socket (socket_in); diagnose_used_ports_in_socket (socket_in);
g_debug ("Diagnosing client socket..."); g_debug ("Diagnosing client socket...");

View File

@@ -82,8 +82,7 @@ static GParamSpec *props[PROP_LAST_PROP];
static gboolean set_contact_header = FALSE; static gboolean set_contact_header = FALSE;
struct _CallsSipOrigin struct _CallsSipOrigin {
{
GObject parent_instance; GObject parent_instance;
CallsSipContext *ctx; CallsSipContext *ctx;
@@ -160,7 +159,7 @@ change_state (CallsSipOrigin *self,
static void static void
remove_call (CallsSipOrigin *self, remove_call (CallsSipOrigin *self,
CallsCall *call, CallsCall *call,
const gchar *reason) const char *reason)
{ {
CallsOrigin *origin; CallsOrigin *origin;
CallsSipCall *sip_call; CallsSipCall *sip_call;
@@ -188,7 +187,7 @@ remove_call (CallsSipOrigin *self,
static void static void
remove_calls (CallsSipOrigin *self, remove_calls (CallsSipOrigin *self,
const gchar *reason) const char *reason)
{ {
CallsCall *call; CallsCall *call;
GList *next; GList *next;
@@ -229,18 +228,19 @@ on_call_state_changed (CallsSipCall *call,
static void static void
add_call (CallsSipOrigin *self, add_call (CallsSipOrigin *self,
const gchar *address, const char *address,
gboolean inbound, gboolean inbound,
nua_handle_t *handle) nua_handle_t *handle)
{ {
CallsSipCall *sip_call; CallsSipCall *sip_call;
CallsCall *call; CallsCall *call;
CallsSipMediaPipeline *pipeline; CallsSipMediaPipeline *pipeline;
g_autofree gchar *local_sdp = NULL;
g_auto (GStrv) address_split = NULL;
const char *call_address = address; const char *call_address = address;
gint rtp_port, rtcp_port; gint rtp_port, rtcp_port;
g_auto (GStrv) address_split = NULL;
g_autofree char *local_sdp = NULL;
pipeline = calls_sip_media_manager_get_pipeline (self->media_manager); pipeline = calls_sip_media_manager_get_pipeline (self->media_manager);
rtp_port = calls_sip_media_pipeline_get_rtp_port (pipeline); rtp_port = calls_sip_media_pipeline_get_rtp_port (pipeline);
rtcp_port = calls_sip_media_pipeline_get_rtcp_port (pipeline); rtcp_port = calls_sip_media_pipeline_get_rtcp_port (pipeline);
@@ -299,7 +299,7 @@ add_call (CallsSipOrigin *self,
static void static void
dial (CallsOrigin *origin, dial (CallsOrigin *origin,
const gchar *address) const char *address)
{ {
CallsSipOrigin *self; CallsSipOrigin *self;
nua_handle_t *nh; nua_handle_t *nh;
@@ -354,7 +354,7 @@ dial (CallsOrigin *origin,
static void static void
create_inbound (CallsSipOrigin *self, create_inbound (CallsSipOrigin *self,
const gchar *address, const char *address,
nua_handle_t *handle) nua_handle_t *handle)
{ {
g_assert (CALLS_IS_SIP_ORIGIN (self)); g_assert (CALLS_IS_SIP_ORIGIN (self));
@@ -375,9 +375,9 @@ sip_authenticate (CallsSipOrigin *self,
nua_handle_t *nh, nua_handle_t *nh,
sip_t const *sip) sip_t const *sip)
{ {
const gchar *scheme = NULL; const char *scheme = NULL;
const gchar *realm = NULL; const char *realm = NULL;
g_autofree gchar *auth = NULL; g_autofree char *auth = NULL;
sip_www_authenticate_t *www_auth = sip->sip_www_authenticate; sip_www_authenticate_t *www_auth = sip->sip_www_authenticate;
sip_proxy_authenticate_t *proxy_auth = sip->sip_proxy_authenticate; sip_proxy_authenticate_t *proxy_auth = sip->sip_proxy_authenticate;
@@ -675,7 +675,7 @@ sip_callback (nua_event_t event,
{ {
CallsSipOrigin *origin = CALLS_SIP_ORIGIN (magic); CallsSipOrigin *origin = CALLS_SIP_ORIGIN (magic);
CallsSipHandles *op = origin->oper; CallsSipHandles *op = origin->oper;
g_autofree gchar * from = NULL; g_autofree char *from = NULL;
switch (event) { switch (event) {
case nua_i_invite: case nua_i_invite:
@@ -807,8 +807,7 @@ sip_callback (nua_event_t event,
if (status == 200) { if (status == 200) {
origin->is_nua_shutdown = TRUE; origin->is_nua_shutdown = TRUE;
origin->is_shutdown_success = TRUE; origin->is_shutdown_success = TRUE;
} } else if (status == 500) {
else if (status == 500) {
origin->is_nua_shutdown = TRUE; origin->is_nua_shutdown = TRUE;
origin->is_shutdown_success = FALSE; origin->is_shutdown_success = FALSE;
} }
@@ -1168,6 +1167,7 @@ supports_protocol (CallsOrigin *origin,
const char *protocol) const char *protocol)
{ {
CallsSipOrigin *self; CallsSipOrigin *self;
g_assert (protocol); g_assert (protocol);
g_assert (CALLS_IS_SIP_ORIGIN (origin)); g_assert (CALLS_IS_SIP_ORIGIN (origin));
@@ -1360,6 +1360,7 @@ static void
calls_sip_origin_constructed (GObject *object) calls_sip_origin_constructed (GObject *object)
{ {
CallsSipOrigin *self = CALLS_SIP_ORIGIN (object); CallsSipOrigin *self = CALLS_SIP_ORIGIN (object);
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
int major = 0; int major = 0;
int minor = 0; int minor = 0;

View File

@@ -65,8 +65,7 @@ enum {
}; };
static GParamSpec *props[PROP_LAST_PROP]; static GParamSpec *props[PROP_LAST_PROP];
struct _CallsSipProvider struct _CallsSipProvider {
{
CallsProvider parent_instance; CallsProvider parent_instance;
GListStore *origins; GListStore *origins;
@@ -115,6 +114,7 @@ on_origin_pw_looked_up (GObject *source,
gpointer user_data) gpointer user_data)
{ {
SipOriginLoadData *data; SipOriginLoadData *data;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
g_autofree char *id = NULL; g_autofree char *id = NULL;
g_autofree char *name = NULL; g_autofree char *name = NULL;
@@ -479,6 +479,7 @@ static void
calls_sip_provider_constructed (GObject *object) calls_sip_provider_constructed (GObject *object)
{ {
CallsSipProvider *self = CALLS_SIP_PROVIDER (object); CallsSipProvider *self = CALLS_SIP_PROVIDER (object);
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
const gchar *env_sip_test; const gchar *env_sip_test;

View File

@@ -28,14 +28,12 @@
#include <sofia-sip/nua.h> #include <sofia-sip/nua.h>
#include <glib-object.h> #include <glib-object.h>
typedef struct typedef struct {
{
su_home_t home[1]; su_home_t home[1];
su_root_t *root; su_root_t *root;
} CallsSipContext; } CallsSipContext;
typedef struct typedef struct {
{
nua_handle_t *register_handle; nua_handle_t *register_handle;
nua_handle_t *call_handle; nua_handle_t *call_handle;
CallsSipContext *context; CallsSipContext *context;
@@ -49,8 +47,7 @@ typedef struct
* @SIP_ENGINE_ERROR: Unrecoverable/Unhandled sofia-sip error * @SIP_ENGINE_ERROR: Unrecoverable/Unhandled sofia-sip error
* @SIP_ENGINE_READY: Ready for operation * @SIP_ENGINE_READY: Ready for operation
*/ */
typedef enum typedef enum {
{
SIP_ENGINE_NULL = 0, SIP_ENGINE_NULL = 0,
SIP_ENGINE_INITIALIZING, SIP_ENGINE_INITIALIZING,
SIP_ENGINE_ERROR, SIP_ENGINE_ERROR,

View File

@@ -46,7 +46,8 @@ static MediaCodecInfo gst_codecs[] = {
* Returns: %TRUE if codec is available on your system, %FALSE otherwise * Returns: %TRUE if codec is available on your system, %FALSE otherwise
*/ */
gboolean gboolean
media_codec_available_in_gst (MediaCodecInfo *codec) { media_codec_available_in_gst (MediaCodecInfo *codec)
{
gboolean available = FALSE; gboolean available = FALSE;
GstRegistry *registry = gst_registry_get (); GstRegistry *registry = gst_registry_get ();
GstPlugin *plugin = NULL; GstPlugin *plugin = NULL;

View File

@@ -35,8 +35,7 @@ G_BEGIN_DECLS
G_DECLARE_INTERFACE (CallsAccountProvider, calls_account_provider, CALLS, ACCOUNT_PROVIDER, CallsProvider) G_DECLARE_INTERFACE (CallsAccountProvider, calls_account_provider, CALLS, ACCOUNT_PROVIDER, CallsProvider)
struct _CallsAccountProviderInterface struct _CallsAccountProviderInterface {
{
GTypeInterface parent_iface; GTypeInterface parent_iface;
GtkWidget *(*get_account_widget) (CallsAccountProvider *self); GtkWidget *(*get_account_widget) (CallsAccountProvider *self);

View File

@@ -92,7 +92,8 @@ calls_account_state_reason_is_error (CallsAccountStateReason reason)
static void static void
calls_account_default_init (CallsAccountInterface *iface) calls_account_default_init (CallsAccountInterface *iface)
{ {
g_object_interface_install_property (iface, g_object_interface_install_property (
iface,
g_param_spec_enum ("account-state", g_param_spec_enum ("account-state",
"Account state", "Account state",
"The state of the account", "The state of the account",
@@ -102,7 +103,8 @@ calls_account_default_init (CallsAccountInterface *iface)
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY)); G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface, g_object_interface_install_property (
iface,
g_param_spec_string ("address", g_param_spec_string ("address",
"Address", "Address",
"The address of this account", "The address of this account",

View File

@@ -91,8 +91,7 @@ typedef enum {
} CallsAccountStateReason; } CallsAccountStateReason;
struct _CallsAccountInterface struct _CallsAccountInterface {
{
GTypeInterface parent_iface; GTypeInterface parent_iface;
void (*go_online) (CallsAccount *self, void (*go_online) (CallsAccount *self,

View File

@@ -57,8 +57,7 @@
#define DEFAULT_PROVIDER_PLUGIN "mm" #define DEFAULT_PROVIDER_PLUGIN "mm"
struct _CallsApplication struct _CallsApplication {
{
GtkApplication parent_instance; GtkApplication parent_instance;
gboolean daemon; gboolean daemon;
@@ -165,6 +164,7 @@ set_default_providers_action (GSimpleAction *action,
{ {
CallsManager *manager = calls_manager_get_default (); CallsManager *manager = calls_manager_get_default ();
CallsSettings *settings = calls_manager_get_settings (manager); CallsSettings *settings = calls_manager_get_settings (manager);
g_auto (GStrv) plugins = NULL; g_auto (GStrv) plugins = NULL;
/** /**
* Only add default providers when there are none added yet, * Only add default providers when there are none added yet,
@@ -368,6 +368,7 @@ show_accounts (GSimpleAction *action,
gpointer user_data) gpointer user_data)
{ {
CallsApplication *app = CALLS_APPLICATION (g_application_get_default ()); CallsApplication *app = CALLS_APPLICATION (g_application_get_default ());
calls_main_window_show_accounts_overview (app->main_window); calls_main_window_show_accounts_overview (app->main_window);
} }
@@ -462,6 +463,7 @@ calls_application_command_line (GApplication *application,
CallsApplication *self = CALLS_APPLICATION (application); CallsApplication *self = CALLS_APPLICATION (application);
GVariantDict *options; GVariantDict *options;
const char *arg; const char *arg;
g_autoptr (GVariant) providers = NULL; g_autoptr (GVariant) providers = NULL;
g_auto (GStrv) arguments = NULL; g_auto (GStrv) arguments = NULL;
gint argc; gint argc;

View File

@@ -31,8 +31,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
struct _CallsBestMatch struct _CallsBestMatch {
{
GObject parent_instance; GObject parent_instance;
FolksSearchView *view; FolksSearchView *view;

View File

@@ -37,8 +37,7 @@
#include <errno.h> #include <errno.h>
struct _CallsCallRecordRow struct _CallsCallRecordRow {
{
GtkListBoxRow parent_instance; GtkListBoxRow parent_instance;
GtkWidget *avatar; GtkWidget *avatar;
@@ -79,6 +78,7 @@ nice_time (GDateTime *t,
gboolean *final) gboolean *final)
{ {
GDateTime *now = g_date_time_new_now_local (); GDateTime *now = g_date_time_new_now_local ();
g_autoptr (GTimeZone) local_tz = g_time_zone_new_local (); g_autoptr (GTimeZone) local_tz = g_time_zone_new_local ();
g_autoptr (GDateTime) t_local_tz = g_date_time_to_timezone (t, local_tz); g_autoptr (GDateTime) t_local_tz = g_date_time_to_timezone (t, local_tz);
const gboolean today = const gboolean today =
@@ -119,6 +119,7 @@ update_time_text (CallsCallRecordRow *self,
gboolean *final) gboolean *final)
{ {
gchar *nice; gchar *nice;
nice_time (end, &nice, final); nice_time (end, &nice, final);
gtk_label_set_text (self->time, nice); gtk_label_set_text (self->time, nice);
g_free (nice); g_free (nice);
@@ -161,8 +162,7 @@ setup_date_change_timeout (CallsCallRecordRow *self)
// Get the precise time now // Get the precise time now
err = gettimeofday (&now, NULL); err = gettimeofday (&now, NULL);
if (err == -1) if (err == -1) {
{
g_warning ("Error getting time to set date change timeout: %s", g_warning ("Error getting time to set date change timeout: %s",
g_strerror (errno)); g_strerror (errno));
return; return;
@@ -562,6 +562,7 @@ delete_call_activated (GSimpleAction *action,
gpointer data) gpointer data)
{ {
GtkWidget *self = GTK_WIDGET (data); GtkWidget *self = GTK_WIDGET (data);
g_signal_emit_by_name (CALLS_CALL_RECORD_ROW (self)->record, "call-delete"); g_signal_emit_by_name (CALLS_CALL_RECORD_ROW (self)->record, "call-delete");
} }
@@ -613,6 +614,7 @@ static void
calls_call_record_row_init (CallsCallRecordRow *self) calls_call_record_row_init (CallsCallRecordRow *self)
{ {
GAction *act; GAction *act;
gtk_widget_init_template (GTK_WIDGET (self)); gtk_widget_init_template (GTK_WIDGET (self));
self->action_map = G_ACTION_MAP (g_simple_action_group_new ()); self->action_map = G_ACTION_MAP (g_simple_action_group_new ());

View File

@@ -27,8 +27,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
struct _CallsCallRecord struct _CallsCallRecord {
{
GomResource parent_instance; GomResource parent_instance;
guint id; guint id;
char *target; char *target;
@@ -117,10 +116,8 @@ set_date_time (GDateTime **stamp_ptr,
g_clear_pointer (stamp_ptr, g_date_time_unref); g_clear_pointer (stamp_ptr, g_date_time_unref);
if (new_stamp) if (new_stamp)
{
*stamp_ptr = g_date_time_ref (new_stamp); *stamp_ptr = g_date_time_ref (new_stamp);
} }
}
static void static void

View File

@@ -32,8 +32,7 @@
#include <glib.h> #include <glib.h>
struct _CallsCallSelectorItem struct _CallsCallSelectorItem {
{
GtkEventBox parent_instance; GtkEventBox parent_instance;
CuiCallDisplay *display; CuiCallDisplay *display;
@@ -184,5 +183,3 @@ calls_call_selector_item_get_display (CallsCallSelectorItem *item)
g_return_val_if_fail (CALLS_IS_CALL_SELECTOR_ITEM (item), NULL); g_return_val_if_fail (CALLS_IS_CALL_SELECTOR_ITEM (item), NULL);
return item->display; return item->display;
} }

View File

@@ -40,8 +40,7 @@
#include <handy.h> #include <handy.h>
struct _CallsCallWindow struct _CallsCallWindow {
{
GtkApplicationWindow parent_instance; GtkApplicationWindow parent_instance;
GListStore *calls; GListStore *calls;
@@ -280,6 +279,7 @@ calls_call_window_init (CallsCallWindow *self)
{ {
g_autoptr (GList) calls = NULL; g_autoptr (GList) calls = NULL;
GList *c; GList *c;
gtk_widget_init_template (GTK_WIDGET (self)); gtk_widget_init_template (GTK_WIDGET (self));
self->calls = g_list_store_new (CALLS_TYPE_CALL_SELECTOR_ITEM); self->calls = g_list_store_new (CALLS_TYPE_CALL_SELECTOR_ITEM);
@@ -350,4 +350,3 @@ calls_call_window_new (GtkApplication *application)
"application", application, "application", application,
NULL); NULL);
} }

View File

@@ -49,8 +49,7 @@ typedef enum {
CALLS_CALL_TYPE_SIP_VOICE, CALLS_CALL_TYPE_SIP_VOICE,
} CallsCallType; } CallsCallType;
struct _CallsCallClass struct _CallsCallClass {
{
GObjectClass parent_iface; GObjectClass parent_iface;
const char *(*get_protocol) (CallsCall *self); const char *(*get_protocol) (CallsCall *self);
@@ -83,4 +82,3 @@ gboolean calls_call_state_parse_nick (CallsCallState *state,
G_END_DECLS G_END_DECLS

View File

@@ -32,8 +32,7 @@
#define HANDY_USE_UNSTABLE_API #define HANDY_USE_UNSTABLE_API
#include <handy.h> #include <handy.h>
struct _CallsContactsBox struct _CallsContactsBox {
{
GtkBin parent_instance; GtkBin parent_instance;
GtkWidget *search_entry; GtkWidget *search_entry;
@@ -51,6 +50,7 @@ search_changed_cb (CallsContactsBox *self,
GtkEntry *entry) GtkEntry *entry)
{ {
const gchar *search_text; const gchar *search_text;
search_text = gtk_entry_get_text (entry); search_text = gtk_entry_get_text (entry);
folks_simple_query_set_query_string (self->search_query, search_text); folks_simple_query_set_query_string (self->search_query, search_text);
@@ -73,15 +73,12 @@ adjust_style (CallsContactsBox *self, GtkWidget *widget)
{ {
g_return_if_fail (CALLS_IS_CONTACTS_BOX (self)); g_return_if_fail (CALLS_IS_CONTACTS_BOX (self));
if (gtk_widget_get_mapped (widget)) if (gtk_widget_get_mapped (widget)) {
{
gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_NONE); gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_NONE);
gtk_widget_set_vexpand (self->contacts_frame, TRUE); gtk_widget_set_vexpand (self->contacts_frame, TRUE);
gtk_style_context_add_class (gtk_widget_get_style_context (self->contacts_listbox), gtk_style_context_add_class (gtk_widget_get_style_context (self->contacts_listbox),
"no-background"); "no-background");
} } else {
else
{
gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_ETCHED_IN); gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_set_vexpand (self->contacts_frame, FALSE); gtk_widget_set_vexpand (self->contacts_frame, FALSE);
gtk_style_context_remove_class (gtk_widget_get_style_context (self->contacts_listbox), gtk_style_context_remove_class (gtk_widget_get_style_context (self->contacts_listbox),
@@ -93,8 +90,7 @@ static void
header_cb (GtkListBoxRow *row, header_cb (GtkListBoxRow *row,
GtkListBoxRow *before) GtkListBoxRow *before)
{ {
if (!before) if (!before) {
{
gtk_list_box_row_set_header (row, NULL); gtk_list_box_row_set_header (row, NULL);
return; return;
} }
@@ -109,6 +105,7 @@ contacts_provider_added (CallsContactsBox *self,
FolksIndividual *individual) FolksIndividual *individual)
{ {
GtkWidget *row; GtkWidget *row;
row = calls_contacts_row_new (individual); row = calls_contacts_row_new (individual);
gtk_container_add (GTK_CONTAINER (self->contacts_listbox), row); gtk_container_add (GTK_CONTAINER (self->contacts_listbox), row);
@@ -157,6 +154,7 @@ static void
calls_contacts_box_init (CallsContactsBox *self) calls_contacts_box_init (CallsContactsBox *self)
{ {
CallsContactsProvider *contacts_provider; CallsContactsProvider *contacts_provider;
g_autoptr (GeeCollection) individuals = NULL; g_autoptr (GeeCollection) individuals = NULL;
gchar* query_fields[] = { "alias", gchar* query_fields[] = { "alias",
"full-name", "full-name",

View File

@@ -48,16 +48,14 @@
*/ */
typedef struct typedef struct {
{
GeeIterator *iter; GeeIterator *iter;
IdleCallback callback; IdleCallback callback;
gpointer user_data; gpointer user_data;
} IdleData; } IdleData;
struct _CallsContactsProvider struct _CallsContactsProvider {
{
GObject parent_instance; GObject parent_instance;
FolksIndividualAggregator *folks_aggregator; FolksIndividualAggregator *folks_aggregator;
@@ -221,6 +219,7 @@ on_contacts_appeared (GDBusConnection *connection,
gpointer user_data) gpointer user_data)
{ {
CallsContactsProvider *self; CallsContactsProvider *self;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
g_assert (CALLS_IS_CONTACTS_PROVIDER (user_data)); g_assert (CALLS_IS_CONTACTS_PROVIDER (user_data));
@@ -481,6 +480,7 @@ calls_contacts_provider_consume_iter_on_idle (GeeIterator *iter,
gpointer user_data) gpointer user_data)
{ {
IdleData *data = g_new (IdleData, 1); IdleData *data = g_new (IdleData, 1);
data->iter = iter; data->iter = iter;
data->user_data = user_data; data->user_data = user_data;
data->callback = callback; data->callback = callback;

View File

@@ -16,8 +16,7 @@
#include "calls-contacts-row.h" #include "calls-contacts-row.h"
#include "calls-contacts-provider.h" #include "calls-contacts-provider.h"
struct _CallsContactsRow struct _CallsContactsRow {
{
GtkListBoxRow parent_instance; GtkListBoxRow parent_instance;
GtkWidget *avatar; GtkWidget *avatar;
@@ -63,6 +62,7 @@ static void
phone_numbers_changed_cb (CallsContactsRow *self) phone_numbers_changed_cb (CallsContactsRow *self)
{ {
GeeIterator *phone_iter; GeeIterator *phone_iter;
g_autoptr (GeeSet) phone_numbers; g_autoptr (GeeSet) phone_numbers;
while (gtk_grid_get_child_at (GTK_GRID (self->grid), 1, 1) != NULL) { while (gtk_grid_get_child_at (GTK_GRID (self->grid), 1, 1) != NULL) {

View File

@@ -237,11 +237,11 @@ on_notify_update_hints (CallsUiCallData *call,
static void static void
call_added_cb (CallsDBusManager *self, CuiCall *call) call_added_cb (CallsDBusManager *self, CuiCall *call)
{ {
g_autofree char *path = NULL;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
g_autoptr (CallsDBusObjectSkeleton) object = NULL; g_autoptr (CallsDBusObjectSkeleton) object = NULL;
g_autoptr (CallsDBusCallsCall) iface = NULL; g_autoptr (CallsDBusCallsCall) iface = NULL;
g_autoptr (CallsBestMatch) match = NULL; g_autoptr (CallsBestMatch) match = NULL;
g_autofree char *path = NULL;
path = get_obj_path (self, self->iface_num++); path = get_obj_path (self, self->iface_num++);
object = calls_dbus_object_skeleton_new (path); object = calls_dbus_object_skeleton_new (path);

View File

@@ -31,8 +31,7 @@
#include <glib-object.h> #include <glib-object.h>
struct _CallsHistoryBox struct _CallsHistoryBox {
{
GtkStack parent_instance; GtkStack parent_instance;
GtkListBox *history; GtkListBox *history;
@@ -109,6 +108,7 @@ create_row_cb (CallsCallRecord *record,
CallsHistoryBox *self) CallsHistoryBox *self)
{ {
GtkWidget *row_widget; GtkWidget *row_widget;
row_widget = GTK_WIDGET (calls_call_record_row_new (record)); row_widget = GTK_WIDGET (calls_call_record_row_new (record));
g_signal_connect (record, g_signal_connect (record,

View File

@@ -26,8 +26,7 @@
#define DEFAULT_TIMEOUT_SECONDS 3 #define DEFAULT_TIMEOUT_SECONDS 3
struct _CallsInAppNotification struct _CallsInAppNotification {
{
GtkRevealer parent_instance; GtkRevealer parent_instance;
GtkLabel *label; GtkLabel *label;

View File

@@ -40,8 +40,7 @@
#include <handy.h> #include <handy.h>
struct _CallsMainWindow struct _CallsMainWindow {
{
HdyApplicationWindow parent_instance; HdyApplicationWindow parent_instance;
GListModel *record_store; GListModel *record_store;
@@ -106,8 +105,8 @@ about_action (GSimpleAction *action,
NULL NULL
}; };
version = g_str_equal (VCS_TAG, "") ? PACKAGE_VERSION: version = g_str_equal (VCS_TAG, "") ?
PACKAGE_VERSION "-" VCS_TAG; PACKAGE_VERSION : PACKAGE_VERSION "-" VCS_TAG;
/* /*
* “program-name” defaults to g_get_application_name(). * “program-name” defaults to g_get_application_name().
@@ -216,23 +215,21 @@ window_ussd_respond_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
CallsMainWindow *self = user_data;
g_autofree char *response = NULL;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
g_autofree char *response = NULL;
CallsMainWindow *self = user_data;
CallsUssd *ussd; CallsUssd *ussd;
ussd = g_object_get_data (G_OBJECT (self->ussd_dialog), "ussd"); ussd = g_object_get_data (G_OBJECT (self->ussd_dialog), "ussd");
response = calls_ussd_respond_finish (ussd, result, &error); response = calls_ussd_respond_finish (ussd, result, &error);
if (error) if (error) {
{
gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE); gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE);
g_warning ("USSD Error: %s", error->message); g_warning ("USSD Error: %s", error->message);
return; return;
} }
if (response && *response) if (response && *response) {
{
window_update_ussd_state (self, ussd); window_update_ussd_state (self, ussd);
gtk_label_set_text (self->ussd_label, response); gtk_label_set_text (self->ussd_label, response);
} }
@@ -263,16 +260,15 @@ main_window_ussd_send_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
CallsMainWindow *self = user_data;
g_autofree char *response = NULL;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
g_autofree char *response = NULL;
CallsMainWindow *self = user_data;
CallsUssd *ussd; CallsUssd *ussd;
response = calls_new_call_box_send_ussd_finish (self->new_call, result, &error); response = calls_new_call_box_send_ussd_finish (self->new_call, result, &error);
ussd = g_task_get_task_data (G_TASK (result)); ussd = g_task_get_task_data (G_TASK (result));
if (error) if (error) {
{
gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE); gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE);
g_warning ("USSD Error: %s", error->message); g_warning ("USSD Error: %s", error->message);
return; return;
@@ -501,8 +497,7 @@ void
calls_main_window_dial (CallsMainWindow *self, calls_main_window_dial (CallsMainWindow *self,
const gchar *target) const gchar *target)
{ {
if (calls_number_is_ussd (target)) if (calls_number_is_ussd (target)) {
{
gtk_widget_hide (GTK_WIDGET (self->ussd_cancel_button)); gtk_widget_hide (GTK_WIDGET (self->ussd_cancel_button));
gtk_widget_hide (GTK_WIDGET (self->ussd_reply_button)); gtk_widget_hide (GTK_WIDGET (self->ussd_reply_button));
gtk_stack_set_visible_child (self->ussd_stack, GTK_WIDGET (self->ussd_spinner)); gtk_stack_set_visible_child (self->ussd_stack, GTK_WIDGET (self->ussd_spinner));
@@ -512,9 +507,7 @@ calls_main_window_dial (CallsMainWindow *self,
main_window_ussd_send_cb, self); main_window_ussd_send_cb, self);
gtk_window_present (GTK_WINDOW (self->ussd_dialog)); gtk_window_present (GTK_WINDOW (self->ussd_dialog));
} } else {
else
{
calls_new_call_box_dial (self->new_call, target); calls_new_call_box_dial (self->new_call, target);
} }
} }

View File

@@ -59,8 +59,7 @@ static const char * const protocols[] = {
"sips" "sips"
}; };
struct _CallsManager struct _CallsManager {
{
GObject parent_instance; GObject parent_instance;
GHashTable *providers; GHashTable *providers;
@@ -247,8 +246,7 @@ add_call (CallsManager *self, CallsCall *call, CallsOrigin *origin)
} }
struct CallsRemoveData struct CallsRemoveData {
{
CallsManager *manager; CallsManager *manager;
CallsCall *call; CallsCall *call;
}; };
@@ -358,6 +356,7 @@ static void
add_origin (CallsManager *self, CallsOrigin *origin) add_origin (CallsManager *self, CallsOrigin *origin)
{ {
g_autofree const char *name = NULL; g_autofree const char *name = NULL;
g_assert (CALLS_IS_MANAGER (self)); g_assert (CALLS_IS_MANAGER (self));
g_assert (CALLS_IS_ORIGIN (origin)); g_assert (CALLS_IS_ORIGIN (origin));
@@ -379,8 +378,7 @@ add_origin (CallsManager *self, CallsOrigin *origin)
g_signal_connect_swapped (origin, "call-added", G_CALLBACK (add_call), self); g_signal_connect_swapped (origin, "call-added", G_CALLBACK (add_call), self);
g_signal_connect_swapped (origin, "call-removed", G_CALLBACK (remove_call), self); g_signal_connect_swapped (origin, "call-removed", G_CALLBACK (remove_call), self);
if (CALLS_IS_USSD (origin)) if (CALLS_IS_USSD (origin)) {
{
g_signal_connect_swapped (origin, "ussd-added", G_CALLBACK (ussd_added_cb), self); g_signal_connect_swapped (origin, "ussd-added", G_CALLBACK (ussd_added_cb), self);
g_signal_connect_swapped (origin, "ussd-cancelled", G_CALLBACK (ussd_cancelled_cb), self); g_signal_connect_swapped (origin, "ussd-cancelled", G_CALLBACK (ussd_cancelled_cb), self);
g_signal_connect_swapped (origin, "ussd-state-changed", G_CALLBACK (ussd_state_changed_cb), self); g_signal_connect_swapped (origin, "ussd-state-changed", G_CALLBACK (ussd_state_changed_cb), self);
@@ -464,9 +462,10 @@ static void
remove_provider (CallsManager *self, remove_provider (CallsManager *self,
const char *name) const char *name)
{ {
g_autoptr (CallsProvider) provider = NULL;
GListModel *origins; GListModel *origins;
guint n_items; guint n_items;
g_autoptr (CallsProvider) provider = NULL;
g_assert (CALLS_IS_MANAGER (self)); g_assert (CALLS_IS_MANAGER (self));
g_assert (name); g_assert (name);
@@ -980,8 +979,7 @@ calls_manager_has_active_call (CallsManager *self)
calls = calls_manager_get_calls (self); calls = calls_manager_get_calls (self);
for (node = calls; node; node = node->next) for (node = calls; node; node = node->next) {
{
call = node->data; call = node->data;
if (calls_call_get_state (call) != CALLS_CALL_STATE_DISCONNECTED) if (calls_call_get_state (call) != CALLS_CALL_STATE_DISCONNECTED)
return TRUE; return TRUE;

View File

@@ -32,8 +32,7 @@ G_BEGIN_DECLS
G_DECLARE_INTERFACE (CallsMessageSource, calls_message_source, CALLS, MESSAGE_SOURCE, GObject) G_DECLARE_INTERFACE (CallsMessageSource, calls_message_source, CALLS, MESSAGE_SOURCE, GObject)
struct _CallsMessageSourceInterface struct _CallsMessageSourceInterface {
{
GTypeInterface parent_iface; GTypeInterface parent_iface;
}; };

View File

@@ -40,8 +40,7 @@ enum {
}; };
static GParamSpec *props[PROP_LAST_PROP]; static GParamSpec *props[PROP_LAST_PROP];
struct _CallsNewCallBox struct _CallsNewCallBox {
{
GtkBox parent_instance; GtkBox parent_instance;
GtkListBox *origin_list_box; GtkListBox *origin_list_box;
@@ -85,6 +84,7 @@ get_origin (CallsNewCallBox *self,
{ {
CallsManager *manager = calls_manager_get_default (); CallsManager *manager = calls_manager_get_default ();
CallsSettings *settings = calls_manager_get_settings (manager); CallsSettings *settings = calls_manager_get_settings (manager);
g_autoptr (CallsOrigin) origin = NULL; g_autoptr (CallsOrigin) origin = NULL;
GListModel *model; GListModel *model;
gboolean auto_use_def_origin = gboolean auto_use_def_origin =
@@ -158,6 +158,7 @@ static void
long_press_back_cb (CallsNewCallBox *self) long_press_back_cb (CallsNewCallBox *self)
{ {
GtkEntry *entry = hdy_keypad_get_entry (self->keypad); GtkEntry *entry = hdy_keypad_get_entry (self->keypad);
gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1); gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1);
} }
@@ -165,6 +166,7 @@ static void
backspace_clicked_cb (CallsNewCallBox *self) backspace_clicked_cb (CallsNewCallBox *self)
{ {
GtkEntry *entry = hdy_keypad_get_entry (self->keypad); GtkEntry *entry = hdy_keypad_get_entry (self->keypad);
g_signal_emit_by_name (entry, "backspace", NULL); g_signal_emit_by_name (entry, "backspace", NULL);
} }
@@ -175,6 +177,7 @@ ussd_send_cb (GObject *object,
{ {
CallsNewCallBox *self; CallsNewCallBox *self;
CallsUssd *ussd = (CallsUssd *) object; CallsUssd *ussd = (CallsUssd *) object;
g_autoptr (GTask) task = user_data; g_autoptr (GTask) task = user_data;
GError *error = NULL; GError *error = NULL;
char *response; char *response;
@@ -232,6 +235,7 @@ dial_queued_cb (gchar *target,
CallsNewCallBox *self) CallsNewCallBox *self)
{ {
CallsOrigin *origin = NULL; CallsOrigin *origin = NULL;
g_debug ("Try dialing queued target `%s'", target); g_debug ("Try dialing queued target `%s'", target);
origin = get_origin (self, origin = get_origin (self,
@@ -239,10 +243,10 @@ dial_queued_cb (gchar *target,
if (origin) { if (origin) {
calls_origin_dial (origin, target); calls_origin_dial (origin, target);
self->dial_queue = g_list_remove (self->dial_queue, target); self->dial_queue = g_list_remove (self->dial_queue, target);
} } else {
else
g_debug ("No suitable origin found"); g_debug ("No suitable origin found");
} }
}
static void static void

View File

@@ -22,8 +22,7 @@
* *
*/ */
#ifndef CALLS_NEW_CALL_BOX_H__ #pragma once
#define CALLS_NEW_CALL_BOX_H__
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -31,7 +30,7 @@ G_BEGIN_DECLS
#define CALLS_TYPE_NEW_CALL_BOX (calls_new_call_box_get_type ()) #define CALLS_TYPE_NEW_CALL_BOX (calls_new_call_box_get_type ())
G_DECLARE_FINAL_TYPE (CallsNewCallBox, calls_new_call_box, CALLS, NEW_CALL_BOX, GtkBox); G_DECLARE_FINAL_TYPE (CallsNewCallBox, calls_new_call_box, CALLS, NEW_CALL_BOX, GtkBox)
CallsNewCallBox *calls_new_call_box_new (void); CallsNewCallBox *calls_new_call_box_new (void);
void calls_new_call_box_dial (CallsNewCallBox *self, void calls_new_call_box_dial (CallsNewCallBox *self,
@@ -46,5 +45,3 @@ char *calls_new_call_box_send_ussd_finish (CallsNewCallBox *self
GError **error); GError **error);
G_END_DECLS G_END_DECLS
#endif /* CALLS_NEW_CALL_BOX_H__ */

View File

@@ -35,8 +35,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <glib-object.h> #include <glib-object.h>
struct _CallsNotifier struct _CallsNotifier {
{
GObject parent_instance; GObject parent_instance;
GListStore *unanswered; GListStore *unanswered;
@@ -49,6 +48,7 @@ static void
notify (CallsNotifier *self, CuiCall *call) notify (CallsNotifier *self, CuiCall *call)
{ {
GApplication *app = g_application_get_default (); GApplication *app = g_application_get_default ();
g_autoptr (GNotification) notification = g_notification_new (_("Missed call")); g_autoptr (GNotification) notification = g_notification_new (_("Missed call"));
g_autofree gchar *msg = NULL; g_autofree gchar *msg = NULL;
g_autofree gchar *ref = NULL; g_autofree gchar *ref = NULL;

View File

@@ -22,8 +22,7 @@
* *
*/ */
#ifndef CALLS_ORIGIN_H__ #pragma once
#define CALLS_ORIGIN_H__
#include "calls-call.h" #include "calls-call.h"
#include "util.h" #include "util.h"
@@ -35,11 +34,10 @@ G_BEGIN_DECLS
#define CALLS_TYPE_ORIGIN (calls_origin_get_type ()) #define CALLS_TYPE_ORIGIN (calls_origin_get_type ())
G_DECLARE_INTERFACE (CallsOrigin, calls_origin, CALLS, ORIGIN, GObject); G_DECLARE_INTERFACE (CallsOrigin, calls_origin, CALLS, ORIGIN, GObject)
struct _CallsOriginInterface struct _CallsOriginInterface {
{
GTypeInterface parent_iface; GTypeInterface parent_iface;
void (*dial) (CallsOrigin *self, void (*dial) (CallsOrigin *self,
@@ -62,4 +60,3 @@ gboolean calls_origin_supports_protocol (CallsOrigin *self,
const char *protocol); const char *protocol);
G_END_DECLS G_END_DECLS
#endif /* CALLS_ORIGIN_H__ */

View File

@@ -40,8 +40,7 @@ G_BEGIN_DECLS
G_DECLARE_DERIVABLE_TYPE (CallsProvider, calls_provider, CALLS, PROVIDER, GObject) G_DECLARE_DERIVABLE_TYPE (CallsProvider, calls_provider, CALLS, PROVIDER, GObject)
struct _CallsProviderClass struct _CallsProviderClass {
{
GObjectClass parent_class; GObjectClass parent_class;
const char *(*get_name) (CallsProvider *self); const char *(*get_name) (CallsProvider *self);

View File

@@ -75,8 +75,7 @@ state_to_record_state (CuiCallState call_state)
} }
struct _CallsRecordStore struct _CallsRecordStore {
{
GtkApplicationWindow parent_instance; GtkApplicationWindow parent_instance;
gchar *filename; gchar *filename;
@@ -138,8 +137,8 @@ load_calls_fetch_cb (GomResourceGroup *group,
GAsyncResult *res, GAsyncResult *res,
CallsRecordStore *self) CallsRecordStore *self)
{ {
gboolean ok;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
gboolean ok;
guint count, i; guint count, i;
gpointer *records; gpointer *records;
@@ -191,8 +190,8 @@ load_calls_find_cb (GomRepository *repository,
GAsyncResult *res, GAsyncResult *res,
CallsRecordStore *self) CallsRecordStore *self)
{ {
GomResourceGroup *group;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
GomResourceGroup *group;
guint count; guint count;
group = gom_repository_find_finish (repository, group = gom_repository_find_finish (repository,
@@ -214,8 +213,7 @@ load_calls_find_cb (GomRepository *repository,
g_debug ("Found %u call records in database `%s', fetching", g_debug ("Found %u call records in database `%s', fetching",
count, self->filename); count, self->filename);
gom_resource_group_fetch_async gom_resource_group_fetch_async (group,
(group,
0, 0,
count, count,
(GAsyncReadyCallback) load_calls_fetch_cb, (GAsyncReadyCallback) load_calls_fetch_cb,
@@ -314,8 +312,7 @@ close_adapter (CallsRecordStore *self)
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
gboolean ok; gboolean ok;
if (!self->adapter) if (!self->adapter) {
{
return; return;
} }
@@ -392,8 +389,7 @@ open_repo (CallsRecordStore *self)
} }
struct CallsRecordCallData struct CallsRecordCallData {
{
CallsRecordStore *self; CallsRecordStore *self;
CallsUiCallData *call; CallsUiCallData *call;
}; };
@@ -405,6 +401,7 @@ record_call_save_cb (GomResource *resource,
struct CallsRecordCallData *data) struct CallsRecordCallData *data)
{ {
GObject * const call_obj = G_OBJECT (data->call); GObject * const call_obj = G_OBJECT (data->call);
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
gboolean ok; gboolean ok;

View File

@@ -35,6 +35,7 @@
#define LIBFEEDBACK_USE_UNSTABLE_API #define LIBFEEDBACK_USE_UNSTABLE_API
#include <libfeedback.h> #include <libfeedback.h>
enum { enum {
PROP_0, PROP_0,
PROP_IS_RINGING, PROP_IS_RINGING,
@@ -64,7 +65,9 @@ struct _CallsRinger {
gboolean is_quiet; gboolean is_quiet;
}; };
G_DEFINE_TYPE (CallsRinger, calls_ringer, G_TYPE_OBJECT);
G_DEFINE_TYPE (CallsRinger, calls_ringer, G_TYPE_OBJECT)
static const char * static const char *
ring_state_to_string (CallsRingState state) ring_state_to_string (CallsRingState state)
@@ -83,6 +86,7 @@ ring_state_to_string (CallsRingState state)
} }
} }
static void static void
change_ring_state (CallsRinger *self, change_ring_state (CallsRinger *self,
CallsRingState state) CallsRingState state)
@@ -115,6 +119,7 @@ on_event_triggered (LfbEvent *event,
CallsRinger *self) CallsRinger *self)
{ {
g_autoptr (GError) err = NULL; g_autoptr (GError) err = NULL;
g_return_if_fail (LFB_IS_EVENT (event)); g_return_if_fail (LFB_IS_EVENT (event));
g_return_if_fail (CALLS_IS_RINGER (self)); g_return_if_fail (CALLS_IS_RINGER (self));

View File

@@ -22,8 +22,7 @@
* *
*/ */
#ifndef CALLS_RINGER_H__ #pragma once
#define CALLS_RINGER_H__
#include <glib-object.h> #include <glib-object.h>
@@ -31,7 +30,7 @@ G_BEGIN_DECLS
#define CALLS_TYPE_RINGER (calls_ringer_get_type ()) #define CALLS_TYPE_RINGER (calls_ringer_get_type ())
G_DECLARE_FINAL_TYPE (CallsRinger, calls_ringer, CALLS, RINGER, GObject); G_DECLARE_FINAL_TYPE (CallsRinger, calls_ringer, CALLS, RINGER, GObject)
CallsRinger *calls_ringer_new (void); CallsRinger *calls_ringer_new (void);
@@ -39,5 +38,3 @@ gboolean calls_ringer_get_is_ringing (CallsRinger *self);
gboolean calls_ringer_get_ring_is_quiet (CallsRinger *self); gboolean calls_ringer_get_ring_is_quiet (CallsRinger *self);
G_END_DECLS G_END_DECLS
#endif /* CALLS_RINGER_H__ */

View File

@@ -33,4 +33,3 @@
const SecretSchema *calls_secret_get_schema (void) G_GNUC_CONST; const SecretSchema *calls_secret_get_schema (void) G_GNUC_CONST;
#define CALLS_SECRET_SCHEMA calls_secret_get_schema () #define CALLS_SECRET_SCHEMA calls_secret_get_schema ()

View File

@@ -47,4 +47,3 @@ void calls_settings_set_preferred_audio_codecs (CallsSettings
const char * const *codecs); const char * const *codecs);
G_END_DECLS G_END_DECLS

View File

@@ -55,8 +55,7 @@ enum {
static GParamSpec *props[PROP_LAST_PROP]; static GParamSpec *props[PROP_LAST_PROP];
static guint signals[N_SIGNALS]; static guint signals[N_SIGNALS];
struct _CallsUiCallData struct _CallsUiCallData {
{
GObject parent_instance; GObject parent_instance;
CallsCall *call; CallsCall *call;
@@ -282,6 +281,7 @@ static void
on_notify_state (CallsUiCallData *self) on_notify_state (CallsUiCallData *self)
{ {
CallsCallState state; CallsCallState state;
g_assert (CALLS_IS_UI_CALL_DATA (self)); g_assert (CALLS_IS_UI_CALL_DATA (self));
state = calls_call_get_state (self->call); state = calls_call_get_state (self->call);
@@ -725,6 +725,7 @@ char *
calls_ui_call_data_dup_origin_name (CallsUiCallData *self) calls_ui_call_data_dup_origin_name (CallsUiCallData *self)
{ {
CallsOrigin *origin; CallsOrigin *origin;
g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (self), NULL); g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (self), NULL);
origin = calls_manager_get_origin_by_id (calls_manager_get_default (), origin = calls_manager_get_origin_by_id (calls_manager_get_default (),

View File

@@ -40,8 +40,7 @@ typedef enum
CALLS_USSD_STATE_USER_RESPONSE CALLS_USSD_STATE_USER_RESPONSE
} CallsUssdState; } CallsUssdState;
struct _CallsUssdInterface struct _CallsUssdInterface {
{
GTypeInterface parent_iface; GTypeInterface parent_iface;
CallsUssdState (*get_state) (CallsUssd *self); CallsUssdState (*get_state) (CallsUssd *self);

View File

@@ -28,15 +28,13 @@
void void
calls_object_unref (gpointer object) calls_object_unref (gpointer object)
{ {
if (object) if (object) {
{
g_object_unref (object); g_object_unref (object);
} }
} }
typedef struct typedef struct {
{
gpointer needle; gpointer needle;
guint needle_column; guint needle_column;
GtkTreeIter *iter; GtkTreeIter *iter;
@@ -55,8 +53,7 @@ list_store_find_foreach_cb (GtkTreeModel *model,
gtk_tree_model_get (model, iter, find_data->needle_column, gtk_tree_model_get (model, iter, find_data->needle_column,
&value, -1); &value, -1);
if (value == find_data->needle) if (value == find_data->needle) {
{
*find_data->iter = *iter; *find_data->iter = *iter;
return (find_data->found = TRUE); return (find_data->found = TRUE);
} }

View File

@@ -147,4 +147,3 @@ const char *get_call_icon_symbolic_name (gboolean inbound,
gboolean missed); gboolean missed);
G_END_DECLS G_END_DECLS