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;
}; };
@@ -83,7 +82,7 @@ outbound_timeout_cb (CallsDummyCall *self)
case CALLS_CALL_STATE_DIALING: case CALLS_CALL_STATE_DIALING:
calls_call_set_state (call, CALLS_CALL_STATE_ALERTING); calls_call_set_state (call, CALLS_CALL_STATE_ALERTING);
g_timeout_add_seconds g_timeout_add_seconds
(3, (GSourceFunc)outbound_timeout_cb, self); (3, (GSourceFunc) outbound_timeout_cb, self);
break; break;
case CALLS_CALL_STATE_ALERTING: case CALLS_CALL_STATE_ALERTING:
@@ -116,7 +115,7 @@ constructed (GObject *object)
CallsDummyCall *self = CALLS_DUMMY_CALL (object); CallsDummyCall *self = CALLS_DUMMY_CALL (object);
if (!calls_call_get_inbound (CALLS_CALL (object))) if (!calls_call_get_inbound (CALLS_CALL (object)))
g_timeout_add_seconds (1, (GSourceFunc)outbound_timeout_cb, self); g_timeout_add_seconds (1, (GSourceFunc) outbound_timeout_cb, self);
G_OBJECT_CLASS (calls_dummy_call_parent_class)->constructed (object); G_OBJECT_CLASS (calls_dummy_call_parent_class)->constructed (object);
} }

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;
@@ -50,14 +49,14 @@ static void calls_dummy_provider_message_source_interface_init (CallsMessageSour
#ifdef FOR_TESTING #ifdef FOR_TESTING
G_DEFINE_TYPE_WITH_CODE G_DEFINE_TYPE_WITH_CODE
(CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER, (CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE, G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_dummy_provider_message_source_interface_init)) calls_dummy_provider_message_source_interface_init))
#else #else
G_DEFINE_DYNAMIC_TYPE_EXTENDED G_DEFINE_DYNAMIC_TYPE_EXTENDED
(CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER, 0, (CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE, G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
calls_dummy_provider_message_source_interface_init)) calls_dummy_provider_message_source_interface_init))
@@ -68,7 +67,8 @@ 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);
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);
@@ -85,8 +85,9 @@ usr1_handler (CallsDummyProvider *self)
static gboolean static gboolean
usr2_handler (CallsDummyProvider *self) usr2_handler (CallsDummyProvider *self)
{ {
g_autoptr (CallsDummyOrigin) origin = NULL;
GListModel *model; GListModel *model;
g_autoptr(CallsDummyOrigin) origin = NULL;
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);
@@ -120,7 +121,7 @@ calls_dummy_provider_get_origins (CallsProvider *provider)
return G_LIST_MODEL (self->origins); return G_LIST_MODEL (self->origins);
} }
static const char * const * static const char *const *
calls_dummy_provider_get_protocols (CallsProvider *provider) calls_dummy_provider_get_protocols (CallsProvider *provider)
{ {
return supported_protocols; return supported_protocols;
@@ -140,7 +141,7 @@ constructed (GObject *object)
calls_dummy_provider_add_origin (self, "Dummy origin"); calls_dummy_provider_add_origin (self, "Dummy origin");
g_unix_signal_add (SIGUSR1, g_unix_signal_add (SIGUSR1,
(GSourceFunc)usr1_handler, (GSourceFunc) usr1_handler,
self); self);
g_unix_signal_add (SIGUSR2, g_unix_signal_add (SIGUSR2,
(GSourceFunc) usr2_handler, (GSourceFunc) usr2_handler,

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;
@@ -111,14 +105,13 @@ set_disconnect_reason (CallsMMCall *self,
self->disconnect_reason = self->disconnect_reason =
g_strdup_printf (_("Call disconnected (unknown reason code %i)"), g_strdup_printf (_("Call disconnected (unknown reason code %i)"),
(int)reason); (int) reason);
g_warning ("%s", self->disconnect_reason); g_warning ("%s", self->disconnect_reason);
} }
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)),
@@ -222,9 +210,9 @@ operation_cb (MMCall *mm_call,
data); \ data); \
} }
DEFINE_OPERATION(accept, calls_mm_call_answer, "accepting"); DEFINE_OPERATION (accept, calls_mm_call_answer, "accepting");
DEFINE_OPERATION(hangup, calls_mm_call_hang_up, "hanging up"); DEFINE_OPERATION (hangup, calls_mm_call_hang_up, "hanging up");
DEFINE_OPERATION(start, calls_mm_call_start_call, "starting outgoing call"); DEFINE_OPERATION (start, calls_mm_call_start_call, "starting outgoing call");
static void static void

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;
@@ -85,8 +84,9 @@ ussd_initiate_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
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;
GError *error = NULL; GError *error = NULL;
@@ -110,8 +110,9 @@ ussd_reinitiate_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
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;
GError *error = NULL; GError *error = NULL;
@@ -139,9 +140,10 @@ ussd_respond_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
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;
@@ -164,9 +166,10 @@ ussd_cancel_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
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,22 +206,21 @@ 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;
g_return_if_fail (CALLS_IS_USSD (ussd)); g_return_if_fail (CALLS_IS_USSD (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,11 +367,10 @@ 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);
g_object_unref (call); g_object_unref (call);
} }
@@ -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);
@@ -422,7 +422,7 @@ delete_call (CallsMMOrigin *self,
(self->voice, (self->voice,
path, path,
NULL, NULL,
(GAsyncReadyCallback)delete_call_cb, (GAsyncReadyCallback) delete_call_cb,
data); data);
} }
@@ -457,12 +457,11 @@ add_call (CallsMMOrigin *self,
path = mm_call_dup_path (mm_call); path = mm_call_dup_path (mm_call);
g_hash_table_insert (self->calls, path, call); g_hash_table_insert (self->calls, path, call);
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));
} }
@@ -648,7 +633,7 @@ set_property (GObject *object,
break; break;
case PROP_MODEM: case PROP_MODEM:
g_set_object (&self->mm_obj, g_value_get_object(value)); g_set_object (&self->mm_obj, g_value_get_object (value));
break; break;
default: default:
@@ -676,7 +661,7 @@ get_property (GObject *object,
break; break;
case PROP_CALLS: case PROP_CALLS:
g_value_set_pointer(value, g_hash_table_get_values (self->calls)); g_value_set_pointer (value, g_hash_table_get_values (self->calls));
break; break;
case PROP_COUNTRY_CODE: case PROP_COUNTRY_CODE:
@@ -741,28 +726,26 @@ 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)
g_signal_emit_by_name (self, "ussd-added", response); g_signal_emit_by_name (self, "ussd-added", response);
if (response && *response) if (response && *response)
self->last_ussd_request = (char *)response; self->last_ussd_request = (char *) response;
g_clear_pointer (&value, g_variant_unref); g_clear_pointer (&value, g_variant_unref);
} }
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)
g_signal_emit_by_name (self, "ussd-added", response); g_signal_emit_by_name (self, "ussd-added", response);
if (response && *response) if (response && *response)
self->last_ussd_response = (char *)response; self->last_ussd_response = (char *) response;
g_clear_pointer (&value, g_variant_unref); g_clear_pointer (&value, g_variant_unref);
} }
} }
@@ -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 */
@@ -56,7 +55,7 @@ struct _CallsMMProvider
static void calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface); static void calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
G_DEFINE_DYNAMIC_TYPE_EXTENDED G_DEFINE_DYNAMIC_TYPE_EXTENDED
(CallsMMProvider, calls_mm_provider, CALLS_TYPE_PROVIDER, 0, (CallsMMProvider, calls_mm_provider, CALLS_TYPE_PROVIDER, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE, G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
calls_mm_provider_message_source_interface_init)) calls_mm_provider_message_source_interface_init))
@@ -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,9 +103,8 @@ 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,11 +277,10 @@ 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 ();
} }
@@ -366,7 +351,7 @@ calls_mm_provider_get_origins (CallsProvider *provider)
return G_LIST_MODEL (self->origins); return G_LIST_MODEL (self->origins);
} }
static const char * const * static const char *const *
calls_mm_provider_get_protocols (CallsProvider *provider) calls_mm_provider_get_protocols (CallsProvider *provider)
{ {
return supported_protocols; return supported_protocols;
@@ -387,8 +372,8 @@ constructed (GObject *object)
g_bus_watch_name (G_BUS_TYPE_SYSTEM, g_bus_watch_name (G_BUS_TYPE_SYSTEM,
MM_DBUS_SERVICE, MM_DBUS_SERVICE,
G_BUS_NAME_WATCHER_FLAGS_AUTO_START, G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
(GBusNameAppearedCallback)mm_appeared_cb, (GBusNameAppearedCallback) mm_appeared_cb,
(GBusNameVanishedCallback)mm_vanished_cb, (GBusNameVanishedCallback) mm_vanished_cb,
self, NULL); self, NULL);
g_debug ("Watching for ModemManager"); g_debug ("Watching for ModemManager");
@@ -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;
@@ -55,7 +54,7 @@ enum {
SIGNAL_TONE, SIGNAL_TONE,
SIGNAL_LAST_SIGNAL, SIGNAL_LAST_SIGNAL,
}; };
static guint signals [SIGNAL_LAST_SIGNAL]; static guint signals[SIGNAL_LAST_SIGNAL];
static const char * static const char *
calls_ofono_call_get_protocol (CallsCall *call) calls_ofono_call_get_protocol (CallsCall *call)
@@ -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);
@@ -178,7 +177,7 @@ get_property (GObject *object,
break; break;
case PROP_CALLS: case PROP_CALLS:
g_value_set_pointer(value, g_hash_table_get_values (self->calls)); g_value_set_pointer (value, g_hash_table_get_values (self->calls));
break; break;
case PROP_COUNTRY_CODE: case PROP_COUNTRY_CODE:
@@ -199,14 +198,13 @@ remove_call (CallsOfonoOrigin *self,
{ {
const gchar *path = calls_ofono_call_get_object_path (call); const gchar *path = calls_ofono_call_get_object_path (call);
g_signal_emit_by_name (CALLS_ORIGIN(self), "call-removed", g_signal_emit_by_name (CALLS_ORIGIN (self), "call-removed",
CALLS_CALL(call), reason); CALLS_CALL (call), reason);
g_hash_table_remove (self->calls, path); g_hash_table_remove (self->calls, path);
} }
struct CallsRemoveCallsData struct CallsRemoveCallsData {
{
CallsOrigin *origin; CallsOrigin *origin;
const gchar *reason; const gchar *reason;
}; };
@@ -217,7 +215,7 @@ remove_calls_cb (const gchar *path,
struct CallsRemoveCallsData *data) struct CallsRemoveCallsData *data)
{ {
g_signal_emit_by_name (data->origin, "call-removed", g_signal_emit_by_name (data->origin, "call-removed",
CALLS_CALL(call), data->reason); CALLS_CALL (call), data->reason);
return TRUE; return TRUE;
} }
@@ -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",
@@ -338,10 +323,10 @@ voice_call_proxy_new_cb (GDBusConnection *connection,
G_CALLBACK (tone_cb), self); G_CALLBACK (tone_cb), self);
path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (voice_call)); path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (voice_call));
g_hash_table_insert (self->calls, g_strdup(path), call); g_hash_table_insert (self->calls, g_strdup (path), call);
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));
g_debug ("Call `%s' added", path); g_debug ("Call `%s' added", path);
} }
@@ -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,
@@ -520,7 +499,7 @@ constructed (GObject *object)
g_dbus_proxy_get_name (modem_proxy), g_dbus_proxy_get_name (modem_proxy),
g_dbus_proxy_get_object_path (modem_proxy), g_dbus_proxy_get_object_path (modem_proxy),
NULL, NULL,
(GAsyncReadyCallback)voice_new_cb, (GAsyncReadyCallback) voice_new_cb,
self); self);
G_OBJECT_CLASS (calls_ofono_origin_parent_class)->constructed (object); G_OBJECT_CLASS (calls_ofono_origin_parent_class)->constructed (object);
@@ -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 */
@@ -64,7 +63,7 @@ static void calls_ofono_provider_message_source_interface_init (CallsMessageSour
G_DEFINE_DYNAMIC_TYPE_EXTENDED G_DEFINE_DYNAMIC_TYPE_EXTENDED
(CallsOfonoProvider, calls_ofono_provider, CALLS_TYPE_PROVIDER, 0, (CallsOfonoProvider, calls_ofono_provider, CALLS_TYPE_PROVIDER, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE, G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
calls_ofono_provider_message_source_interface_init)) calls_ofono_provider_message_source_interface_init))
@@ -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,22 +196,19 @@ 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");
/* PropertyChanged gives us a variant gvariant containing a string array, /* PropertyChanged gives us a variant gvariant containing a string array,
but modem_check_ifaces expects the inner string array gvariant */ but modem_check_ifaces expects the inner string array gvariant */
value = g_variant_get_variant(value); value = g_variant_get_variant (value);
modem_check_ifaces (self, modem, modem_name, value); modem_check_ifaces (self, modem, modem_name, value);
} }
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);
@@ -263,11 +246,10 @@ modem_proxy_new_cb (GDBusConnection *connection,
path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (modem)); path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (modem));
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);
@@ -302,7 +284,7 @@ modem_properties_get_name (GVariant *properties)
return NULL; return NULL;
} }
static const char * const * static const char *const *
calls_ofono_provider_get_protocols (CallsProvider *provider) calls_ofono_provider_get_protocols (CallsProvider *provider)
{ {
return supported_protocols; return supported_protocols;
@@ -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;
} }
@@ -122,7 +122,7 @@ on_user_changed (CallsSipAccountWidget *self)
static void static void
set_password_visibility (CallsSipAccountWidget *self, gboolean visible) set_password_visibility (CallsSipAccountWidget *self, gboolean visible)
{ {
const char* icon_name; const char *icon_name;
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self)); g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
g_assert (GTK_IS_ENTRY (self->password)); g_assert (GTK_IS_ENTRY (self->password));
@@ -138,7 +138,7 @@ set_password_visibility (CallsSipAccountWidget *self, gboolean visible)
static void static void
on_password_visibility_changed(CallsSipAccountWidget *self, on_password_visibility_changed (CallsSipAccountWidget *self,
GtkEntryIconPosition icon_pos, GtkEntryIconPosition icon_pos,
GdkEvent *event, GdkEvent *event,
GtkEntry *entry) GtkEntry *entry)
@@ -173,7 +173,7 @@ on_port_entry_insert_text (CallsSipAccountWidget *self,
if (!new_text || !*new_text || self->port_self_change) if (!new_text || !*new_text || self->port_self_change)
return; return;
pos = (int *)position; pos = (int *) position;
g_object_set_data (G_OBJECT (entry), "old-pos", GINT_TO_POINTER (*pos)); g_object_set_data (G_OBJECT (entry), "old-pos", GINT_TO_POINTER (*pos));
if (new_text_length == -1) if (new_text_length == -1)
@@ -215,7 +215,7 @@ get_port (CallsSipAccountWidget *self)
int port = 0; int port = 0;
text = gtk_entry_get_text (self->port); text = gtk_entry_get_text (self->port);
port = (int)g_ascii_strtod (text, NULL); port = (int) g_ascii_strtod (text, NULL);
return port; return port;
} }
@@ -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));
@@ -173,7 +173,7 @@ calls_sip_media_manager_class_init (CallsSipMediaManagerClass *klass)
static void static void
calls_sip_media_manager_init (CallsSipMediaManager *self) calls_sip_media_manager_init (CallsSipMediaManager *self)
{ {
if (!gst_is_initialized()) if (!gst_is_initialized ())
gst_init (NULL, NULL); gst_init (NULL, NULL);
self->settings = calls_settings_new (); self->settings = calls_settings_new ();
@@ -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;
@@ -262,7 +263,7 @@ calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self,
g_string_append_printf (attribute_lines, "a=rtcp:%d\r\n", rtcp_port); g_string_append_printf (attribute_lines, "a=rtcp:%d\r\n", rtcp_port);
done: done:
if (own_ip && *own_ip) if (own_ip && *own_ip)
address_family_string = get_address_family_string (self, own_ip); address_family_string = get_address_family_string (self, own_ip);

View File

@@ -38,21 +38,21 @@ G_DECLARE_FINAL_TYPE (CallsSipMediaManager, calls_sip_media_manager, CALLS, SIP_
CallsSipMediaManager* calls_sip_media_manager_default (void); CallsSipMediaManager* calls_sip_media_manager_default (void);
gchar* calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self, gchar *calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self,
const char *own_ip, const char *own_ip,
gint rtp_port, gint rtp_port,
gint rtcp_port, gint rtcp_port,
gboolean use_srtp, gboolean use_srtp,
GList *supported_codecs); GList *supported_codecs);
gchar* calls_sip_media_manager_static_capabilities (CallsSipMediaManager *self, gchar *calls_sip_media_manager_static_capabilities (CallsSipMediaManager *self,
const char *own_ip, const char *own_ip,
gint rtp_port, gint rtp_port,
gint rtcp_port, gint rtcp_port,
gboolean use_srtp); gboolean use_srtp);
gboolean calls_sip_media_manager_supports_media (CallsSipMediaManager *self, gboolean calls_sip_media_manager_supports_media (CallsSipMediaManager *self,
const char *media_type); const char *media_type);
GList * calls_sip_media_manager_codec_candidates (CallsSipMediaManager *self); GList *calls_sip_media_manager_codec_candidates (CallsSipMediaManager *self);
GList * calls_sip_media_manager_get_codecs_from_sdp (CallsSipMediaManager *self, GList *calls_sip_media_manager_get_codecs_from_sdp (CallsSipMediaManager *self,
sdp_media_t *sdp_media); sdp_media_t *sdp_media);
CallsSipMediaPipeline *calls_sip_media_manager_get_pipeline (CallsSipMediaManager *self); CallsSipMediaPipeline *calls_sip_media_manager_get_pipeline (CallsSipMediaManager *self);

View File

@@ -150,7 +150,7 @@ struct _CallsSipMediaPipeline {
guint bus_watch_id; guint bus_watch_id;
}; };
#if GLIB_CHECK_VERSION(2, 70, 0) #if GLIB_CHECK_VERSION (2, 70, 0)
G_DEFINE_FINAL_TYPE (CallsSipMediaPipeline, calls_sip_media_pipeline, G_TYPE_OBJECT) G_DEFINE_FINAL_TYPE (CallsSipMediaPipeline, calls_sip_media_pipeline, G_TYPE_OBJECT)
#else #else
G_DEFINE_TYPE (CallsSipMediaPipeline, calls_sip_media_pipeline, G_TYPE_OBJECT) G_DEFINE_TYPE (CallsSipMediaPipeline, calls_sip_media_pipeline, G_TYPE_OBJECT)
@@ -584,7 +584,7 @@ pipeline_link_elements (CallsSipMediaPipeline *self,
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
srcpad = gst_element_get_static_pad (self->rtcp_src, "src"); srcpad = gst_element_get_static_pad (self->rtcp_src, "src");
#if GST_CHECK_VERSION (1, 20 , 0) #if GST_CHECK_VERSION (1, 20, 0)
sinkpad = gst_element_request_pad_simple (self->rtpbin, "recv_rtcp_sink_0"); sinkpad = gst_element_request_pad_simple (self->rtpbin, "recv_rtcp_sink_0");
#else #else
sinkpad = gst_element_get_request_pad (self->rtpbin, "recv_rtcp_sink_0"); sinkpad = gst_element_get_request_pad (self->rtpbin, "recv_rtcp_sink_0");
@@ -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;
@@ -446,7 +446,7 @@ sip_r_register (int status,
change_state (origin, change_state (origin,
CALLS_ACCOUNT_STATE_ONLINE, CALLS_ACCOUNT_STATE_ONLINE,
CALLS_ACCOUNT_STATE_REASON_CONNECTED); CALLS_ACCOUNT_STATE_REASON_CONNECTED);
nua_get_params (nua, TAG_ANY (), TAG_END()); nua_get_params (nua, TAG_ANY (), TAG_END ());
if (sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_host) { if (sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_host) {
g_free (origin->own_ip); g_free (origin->own_ip);
@@ -591,7 +591,7 @@ sip_i_state (int status,
rtcp_port = rtp_port + 1; rtcp_port = rtp_port + 1;
calls_sip_call_setup_remote_media_connection (call, calls_sip_call_setup_remote_media_connection (call,
media_ip ? : session_ip, media_ip ?: session_ip,
rtp_port, rtp_port,
rtcp_port); rtcp_port);
} }
@@ -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;
} }
@@ -827,7 +826,7 @@ sip_callback (nua_event_t event,
status, status,
phrase); phrase);
g_warning ("printing tags"); g_warning ("printing tags");
tl_print(stdout, "", tags); tl_print (stdout, "", tags);
break; break;
} }
} }
@@ -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;
@@ -86,7 +85,7 @@ static void calls_sip_provider_account_provider_interface_init (CallsAccountProv
#ifdef FOR_TESTING #ifdef FOR_TESTING
G_DEFINE_TYPE_WITH_CODE G_DEFINE_TYPE_WITH_CODE
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, (CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE, G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init) calls_sip_provider_message_source_interface_init)
G_IMPLEMENT_INTERFACE (CALLS_TYPE_ACCOUNT_PROVIDER, G_IMPLEMENT_INTERFACE (CALLS_TYPE_ACCOUNT_PROVIDER,
@@ -95,7 +94,7 @@ G_DEFINE_TYPE_WITH_CODE
#else #else
G_DEFINE_DYNAMIC_TYPE_EXTENDED G_DEFINE_DYNAMIC_TYPE_EXTENDED
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, 0, (CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE, G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init) calls_sip_provider_message_source_interface_init)
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_ACCOUNT_PROVIDER, G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_ACCOUNT_PROVIDER,
@@ -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;
@@ -367,7 +367,7 @@ calls_sip_provider_get_origins (CallsProvider *provider)
return G_LIST_MODEL (self->origins); return G_LIST_MODEL (self->origins);
} }
static const char * const * static const char *const *
calls_sip_provider_get_protocols (CallsProvider *provider) calls_sip_provider_get_protocols (CallsProvider *provider)
{ {
return supported_protocols; return supported_protocols;
@@ -397,7 +397,7 @@ calls_sip_provider_deinit_sip (CallsSipProvider *self)
} }
g_clear_pointer (&self->ctx, g_free); g_clear_pointer (&self->ctx, g_free);
bail: bail:
self->sip_state = SIP_ENGINE_NULL; self->sip_state = SIP_ENGINE_NULL;
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]); g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]);
} }
@@ -448,7 +448,7 @@ calls_sip_provider_init_sofia (CallsSipProvider *self,
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]); g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]);
return TRUE; return TRUE;
err: err:
self->sip_state = SIP_ENGINE_ERROR; self->sip_state = SIP_ENGINE_ERROR;
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]); g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]);
return FALSE; return FALSE;
@@ -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;
@@ -500,7 +501,7 @@ calls_sip_provider_constructed (GObject *object)
g_warning ("Could not initialize sofia stack: %s", error->message); g_warning ("Could not initialize sofia stack: %s", error->message);
} }
out: out:
G_OBJECT_CLASS (calls_sip_provider_parent_class)->constructed (object); G_OBJECT_CLASS (calls_sip_provider_parent_class)->constructed (object);
} }

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,13 +47,12 @@ 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,
SIP_ENGINE_READY, SIP_ENGINE_READY,
} SipEngineState; } SipEngineState;
gboolean check_sips (const char *addr); gboolean check_sips (const char *addr);

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

@@ -45,7 +45,7 @@ typedef struct {
gboolean media_codec_available_in_gst (MediaCodecInfo *codec); gboolean media_codec_available_in_gst (MediaCodecInfo *codec);
MediaCodecInfo* media_codec_by_name (const char *name); MediaCodecInfo *media_codec_by_name (const char *name);
MediaCodecInfo* media_codec_by_payload_id (uint payload_id); MediaCodecInfo *media_codec_by_payload_id (uint payload_id);
gchar* media_codec_get_gst_capabilities (MediaCodecInfo *codec); gchar *media_codec_get_gst_capabilities (MediaCodecInfo *codec);
GList* media_codecs_get_candidates (void); GList *media_codecs_get_candidates (void);

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

@@ -44,7 +44,7 @@ enum {
SIGNAL_STATE_CHANGED, SIGNAL_STATE_CHANGED,
SIGNAL_LAST_SIGNAL, SIGNAL_LAST_SIGNAL,
}; };
static guint signals [SIGNAL_LAST_SIGNAL]; static guint signals[SIGNAL_LAST_SIGNAL];
static gboolean static gboolean
@@ -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);
} }
@@ -413,7 +414,7 @@ startup (GApplication *application)
{ {
g_autoptr (GtkCssProvider) provider = NULL; g_autoptr (GtkCssProvider) provider = NULL;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
#if HDY_CHECK_VERSION(1, 5, 0) #if HDY_CHECK_VERSION (1, 5, 0)
HdyStyleManager *style_manager; HdyStyleManager *style_manager;
#endif #endif
@@ -421,7 +422,7 @@ startup (GApplication *application)
hdy_init (); hdy_init ();
#if HDY_CHECK_VERSION(1, 5, 0) #if HDY_CHECK_VERSION (1, 5, 0)
style_manager = hdy_style_manager_get_default (); style_manager = hdy_style_manager_get_default ();
hdy_style_manager_set_color_scheme (style_manager, HDY_COLOR_SCHEME_PREFER_LIGHT); hdy_style_manager_set_color_scheme (style_manager, HDY_COLOR_SCHEME_PREFER_LIGHT);
@@ -462,8 +463,9 @@ 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;
options = g_application_command_line_get_options_dict (command_line); options = g_application_command_line_get_options_dict (command_line);
@@ -642,7 +644,7 @@ app_open (GApplication *application,
static void static void
finalize (GObject *object) finalize (GObject *object)
{ {
CallsApplication *self = (CallsApplication *)object; CallsApplication *self = (CallsApplication *) object;
g_clear_object (&self->call_window); g_clear_object (&self->call_window);
g_clear_object (&self->main_window); g_clear_object (&self->main_window);

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;
@@ -432,7 +431,7 @@ calls_best_match_get_primary_info (CallsBestMatch *self)
if (self->phone_number) if (self->phone_number)
return self->phone_number; return self->phone_number;
anon: anon:
return _("Anonymous caller"); return _("Anonymous caller");
} }
@@ -461,6 +460,6 @@ calls_best_match_get_secondary_info (CallsBestMatch *self)
* https://gitlab.gnome.org/GNOME/calls/-/issues/358 * https://gitlab.gnome.org/GNOME/calls/-/issues/358
*/ */
anon: anon:
return ""; return "";
} }

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;
@@ -180,7 +180,7 @@ setup_date_change_timeout (CallsCallRecordRow *self)
// Add the timeout // Add the timeout
self->date_change_timeout = self->date_change_timeout =
g_timeout_add (interval, g_timeout_add (interval,
(GSourceFunc)date_change_cb, (GSourceFunc) date_change_cb,
self); self);
} }
@@ -294,7 +294,7 @@ on_notify_can_add_contacts (CallsCallRecordRow *self)
if (!calls_contacts_provider_get_can_add_contacts (contacts_provider)) if (!calls_contacts_provider_get_can_add_contacts (contacts_provider))
return; return;
g_signal_handlers_disconnect_by_data(contacts_provider, self); g_signal_handlers_disconnect_by_data (contacts_provider, self);
/* The record has a NULL id */ /* The record has a NULL id */
if (!self->contact) if (!self->contact)
@@ -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

@@ -38,7 +38,7 @@ G_DECLARE_FINAL_TYPE (CallsCallRecordRow, calls_call_record_row,
CALLS, CALL_RECORD_ROW, GtkListBoxRow) CALLS, CALL_RECORD_ROW, GtkListBoxRow)
CallsCallRecordRow *calls_call_record_row_new (CallsCallRecord *record); CallsCallRecordRow *calls_call_record_row_new (CallsCallRecord *record);
CallsCallRecord * calls_call_record_row_get_record (CallsCallRecordRow *self); CallsCallRecord *calls_call_record_row_get_record (CallsCallRecordRow *self);
G_END_DECLS G_END_DECLS

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;
@@ -40,7 +39,7 @@ struct _CallsCallRecord
gboolean complete; gboolean complete;
}; };
G_DEFINE_TYPE(CallsCallRecord, calls_call_record, GOM_TYPE_RESOURCE) G_DEFINE_TYPE (CallsCallRecord, calls_call_record, GOM_TYPE_RESOURCE)
enum { enum {
@@ -60,7 +59,7 @@ enum {
SIGNAL_CALL_DELETE, SIGNAL_CALL_DELETE,
SIGNAL_LAST_SIGNAL, SIGNAL_LAST_SIGNAL,
}; };
static guint signals [SIGNAL_LAST_SIGNAL]; static guint signals[SIGNAL_LAST_SIGNAL];
static void static void
@@ -117,9 +116,7 @@ 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);
}
} }

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

@@ -33,7 +33,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsContactsBox, calls_contacts_box, CALLS, CONTACTS_BOX, GtkBin); G_DECLARE_FINAL_TYPE (CallsContactsBox, calls_contacts_box, CALLS, CONTACTS_BOX, GtkBin);
GtkWidget * calls_contacts_box_new (void); GtkWidget *calls_contacts_box_new (void);
G_END_DECLS G_END_DECLS

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

@@ -102,12 +102,12 @@ on_handle_call_hangup (CallsDBusCallsCall *skeleton,
} }
static gboolean static gboolean
(avatar_loadable_icon_transform_to_image_path) (GBinding *binding, (avatar_loadable_icon_transform_to_image_path) (GBinding *binding,
const GValue *from_value, const GValue *from_value,
GValue *to_value, GValue *to_value,
gpointer user_data) gpointer user_data)
{ {
GLoadableIcon *icon = G_LOADABLE_ICON (g_value_get_object(from_value)); GLoadableIcon *icon = G_LOADABLE_ICON (g_value_get_object (from_value));
if (icon == NULL) { if (icon == NULL) {
g_value_set_string (to_value, NULL); g_value_set_string (to_value, NULL);
@@ -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;
@@ -100,7 +99,7 @@ delete_call_cb (CallsCallRecord *record,
g_list_store_remove ((GListStore *) self->model, position); g_list_store_remove ((GListStore *) self->model, position);
update(self); update (self);
} }
@@ -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,
@@ -154,7 +154,7 @@ constructed (GObject *object)
gtk_list_box_bind_model (self->history, gtk_list_box_bind_model (self->history,
self->model, self->model,
(GtkListBoxCreateWidgetFunc)create_row_cb, (GtkListBoxCreateWidgetFunc) create_row_cb,
self, self,
NULL); NULL);

View File

@@ -35,7 +35,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsHistoryBox, calls_history_box, CALLS, HISTORY_BOX, GtkStack); G_DECLARE_FINAL_TYPE (CallsHistoryBox, calls_history_box, CALLS, HISTORY_BOX, GtkStack);
CallsHistoryBox * calls_history_box_new (GListModel *model); CallsHistoryBox *calls_history_box_new (GListModel *model);
G_END_DECLS G_END_DECLS

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;
@@ -159,7 +158,7 @@ calls_in_app_notification_show (CallsInAppNotification *self, const gchar *messa
g_source_remove (self->timeout_id); g_source_remove (self->timeout_id);
gtk_revealer_set_reveal_child (GTK_REVEALER (self), TRUE); gtk_revealer_set_reveal_child (GTK_REVEALER (self), TRUE);
self->timeout_id = g_timeout_add_seconds (self->timeout, (GSourceFunc)timeout_cb, self); self->timeout_id = g_timeout_add_seconds (self->timeout, (GSourceFunc) timeout_cb, self);
} }
@@ -170,5 +169,5 @@ calls_in_app_notification_hide (CallsInAppNotification *self)
g_clear_handle_id (&self->timeout_id, g_source_remove); g_clear_handle_id (&self->timeout_id, g_source_remove);
gtk_revealer_set_reveal_child (GTK_REVEALER(self), FALSE); gtk_revealer_set_reveal_child (GTK_REVEALER (self), FALSE);
} }

View File

@@ -63,7 +63,7 @@ get_log_level_prefix (GLogLevelFlags log_level,
log_level = log_level & ~CALLS_LOG_DETAILED; log_level = log_level & ~CALLS_LOG_DETAILED;
if (use_color) { if (use_color) {
switch ((int)log_level) { /* Same colors as used in GLib */ switch ((int) log_level) { /* Same colors as used in GLib */
case G_LOG_LEVEL_ERROR: return " \033[1;31mERROR\033[0m"; case G_LOG_LEVEL_ERROR: return " \033[1;31mERROR\033[0m";
case G_LOG_LEVEL_CRITICAL: return "\033[1;35mCRITICAL\033[0m"; case G_LOG_LEVEL_CRITICAL: return "\033[1;35mCRITICAL\033[0m";
case G_LOG_LEVEL_WARNING: return " \033[1;33mWARNING\033[0m"; case G_LOG_LEVEL_WARNING: return " \033[1;33mWARNING\033[0m";
@@ -74,7 +74,7 @@ get_log_level_prefix (GLogLevelFlags log_level,
default: return " UNKNOWN"; default: return " UNKNOWN";
} }
} else { } else {
switch ((int)log_level) { switch ((int) log_level) {
case G_LOG_LEVEL_ERROR: return " ERROR"; case G_LOG_LEVEL_ERROR: return " ERROR";
case G_LOG_LEVEL_CRITICAL: return "CRITICAL"; case G_LOG_LEVEL_CRITICAL: return "CRITICAL";
case G_LOG_LEVEL_WARNING: return " WARNING"; case G_LOG_LEVEL_WARNING: return " WARNING";
@@ -95,7 +95,7 @@ calls_log_write (GLogLevelFlags log_level,
gsize n_fields, gsize n_fields,
gpointer user_data) gpointer user_data)
{ {
g_autoptr(GString) log_str = NULL; g_autoptr (GString) log_str = NULL;
FILE *stream; FILE *stream;
gboolean can_color; gboolean can_color;
@@ -123,7 +123,7 @@ calls_log_write (GLogLevelFlags log_level,
strftime (buffer, sizeof (buffer), "%H:%M:%S", &tm_now); strftime (buffer, sizeof (buffer), "%H:%M:%S", &tm_now);
g_string_append_printf (log_str, "%s.%04d ", buffer, g_string_append_printf (log_str, "%s.%04d ", buffer,
(int)((now % G_USEC_PER_SEC) / 100)); (int) ((now % G_USEC_PER_SEC) / 100));
} }
can_color = g_log_writer_supports_color (fileno (stream)); can_color = g_log_writer_supports_color (fileno (stream));
@@ -173,7 +173,7 @@ calls_log_handler (GLogLevelFlags log_level,
const char *log_message = NULL; const char *log_message = NULL;
/* If domain is “all” show logs upto debug regardless of the verbosity */ /* If domain is “all” show logs upto debug regardless of the verbosity */
switch ((int)log_level) { switch ((int) log_level) {
case G_LOG_LEVEL_MESSAGE: case G_LOG_LEVEL_MESSAGE:
if (any_domain && domains) if (any_domain && domains)
break; break;

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().
@@ -128,7 +127,7 @@ about_action (GSimpleAction *action,
} }
static const GActionEntry window_entries [] = static const GActionEntry window_entries[] =
{ {
{ "about", about_action }, { "about", about_action },
}; };
@@ -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;
@@ -106,7 +105,7 @@ enum {
PROVIDERS_CHANGED, PROVIDERS_CHANGED,
SIGNAL_LAST_SIGNAL, SIGNAL_LAST_SIGNAL,
}; };
static guint signals [SIGNAL_LAST_SIGNAL]; static guint signals[SIGNAL_LAST_SIGNAL];
static void static void
@@ -224,7 +223,7 @@ on_message (CallsMessageSource *source,
} }
calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (self), calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (self),
notification ? : message, notification ?: message,
message_type); message_type);
} }
@@ -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);
@@ -488,7 +487,7 @@ remove_provider (CallsManager *self,
n_items = g_list_model_get_n_items (origins); n_items = g_list_model_get_n_items (origins);
for (guint i = 0; i < n_items; i++) { for (guint i = 0; i < n_items; i++) {
g_autoptr(CallsOrigin) origin = NULL; g_autoptr (CallsOrigin) origin = NULL;
origin = g_list_model_get_item (origins, i); origin = g_list_model_get_item (origins, i);
remove_origin (self, origin); remove_origin (self, origin);
@@ -568,7 +567,7 @@ origin_items_changed_cb (GListModel *model,
g_warning ("Managed origins are not in sync anymore!"); g_warning ("Managed origins are not in sync anymore!");
} }
skip_remove: skip_remove:
for (i = 0; i < added; i++) { for (i = 0; i < added; i++) {
g_debug ("before adding: %d", g_debug ("before adding: %d",
g_list_model_get_n_items (G_LIST_MODEL (self->origins))); g_list_model_get_n_items (G_LIST_MODEL (self->origins)));
@@ -830,7 +829,7 @@ calls_manager_get_default (void)
if (instance == NULL) { if (instance == NULL) {
instance = calls_manager_new (); instance = calls_manager_new ();
g_object_add_weak_pointer (G_OBJECT (instance), (gpointer *)&instance); g_object_add_weak_pointer (G_OBJECT (instance), (gpointer *) &instance);
} }
return instance; return instance;
} }
@@ -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

@@ -40,7 +40,7 @@ enum {
SIGNAL_MESSAGE, SIGNAL_MESSAGE,
SIGNAL_LAST_SIGNAL, SIGNAL_LAST_SIGNAL,
}; };
static guint signals [SIGNAL_LAST_SIGNAL]; static guint signals[SIGNAL_LAST_SIGNAL];
static void static void

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);
} }
@@ -174,7 +176,8 @@ ussd_send_cb (GObject *object,
gpointer user_data) gpointer user_data)
{ {
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,9 +243,9 @@ 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");
}
} }

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,9 +30,9 @@ 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,
const gchar *target); const gchar *target);
void calls_new_call_box_send_ussd_async (CallsNewCallBox *self, void calls_new_call_box_send_ussd_async (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;
@@ -58,7 +58,7 @@ notify (CallsNotifier *self, CuiCall *call)
gboolean got_id; gboolean got_id;
gboolean got_contact; gboolean got_contact;
#if GLIB_CHECK_VERSION(2,70,0) #if GLIB_CHECK_VERSION (2,70,0)
g_notification_set_category (notification, "x-gnome.call.unanswered"); g_notification_set_category (notification, "x-gnome.call.unanswered");
#endif #endif
/* TODO: We need to update the notification when the contact name changes /* TODO: We need to update the notification when the contact name changes
@@ -123,7 +123,7 @@ state_changed_cb (CallsNotifier *self,
static void static void
call_added_cb (CallsNotifier *self, CuiCall *call) call_added_cb (CallsNotifier *self, CuiCall *call)
{ {
g_list_store_append(self->unanswered, call); g_list_store_append (self->unanswered, call);
g_signal_connect_swapped (call, g_signal_connect_swapped (call,
"state-changed", "state-changed",

View File

@@ -40,7 +40,7 @@ enum {
SIGNAL_CALL_REMOVED, SIGNAL_CALL_REMOVED,
SIGNAL_LAST_SIGNAL, SIGNAL_LAST_SIGNAL,
}; };
static guint signals [SIGNAL_LAST_SIGNAL]; static guint signals[SIGNAL_LAST_SIGNAL];
static void static void
calls_origin_default_init (CallsOriginInterface *iface) calls_origin_default_init (CallsOriginInterface *iface)
@@ -107,7 +107,7 @@ calls_origin_default_init (CallsOriginInterface *iface)
* Returns (transfer full): A string containing the name. The string must be freed by * Returns (transfer full): A string containing the name. The string must be freed by
* the caller. * the caller.
*/ */
DEFINE_ORIGIN_GETTER(name, char *, NULL); DEFINE_ORIGIN_GETTER (name, char *, NULL);
/** /**
* calls_origin_get_id: * calls_origin_get_id:
@@ -118,7 +118,7 @@ DEFINE_ORIGIN_GETTER(name, char *, NULL);
* Returns (transfer full): A string containing the id. The string must be freed by * Returns (transfer full): A string containing the id. The string must be freed by
* the caller. * the caller.
*/ */
DEFINE_ORIGIN_GETTER(id, char *, NULL); DEFINE_ORIGIN_GETTER (id, char *, NULL);
/** /**
* calls_origin_get_calls: * calls_origin_get_calls:
@@ -129,7 +129,7 @@ DEFINE_ORIGIN_GETTER(id, char *, NULL);
* Returns: (transfer container): A newly-allocated GList of objects implementing * Returns: (transfer container): A newly-allocated GList of objects implementing
* #CallsCall or NULL if there was an error. * #CallsCall or NULL if there was an error.
*/ */
DEFINE_ORIGIN_GETTER(calls, GList *, NULL); DEFINE_ORIGIN_GETTER (calls, GList *, NULL);
/** /**
* calls_origin_foreach_call: * calls_origin_foreach_call:
@@ -140,7 +140,7 @@ DEFINE_ORIGIN_GETTER(calls, GList *, NULL);
* Iterate over all current calls from this origin * Iterate over all current calls from this origin
**/ **/
void void
calls_origin_foreach_call(CallsOrigin *self, calls_origin_foreach_call (CallsOrigin *self,
CallsOriginForeachCallFunc callback, CallsOriginForeachCallFunc callback,
gpointer param) gpointer param)
{ {
@@ -164,7 +164,7 @@ calls_origin_foreach_call(CallsOrigin *self,
* there is an error, an appropriate #message signal will be emitted. * there is an error, an appropriate #message signal will be emitted.
*/ */
void void
calls_origin_dial(CallsOrigin *self, calls_origin_dial (CallsOrigin *self,
const char *number) const char *number)
{ {
CallsOriginInterface *iface; CallsOriginInterface *iface;
@@ -175,7 +175,7 @@ calls_origin_dial(CallsOrigin *self,
iface = CALLS_ORIGIN_GET_IFACE (self); iface = CALLS_ORIGIN_GET_IFACE (self);
g_return_if_fail (iface->dial != NULL); g_return_if_fail (iface->dial != NULL);
return iface->dial(self, number); return iface->dial (self, number);
} }
/** /**

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,
@@ -50,9 +48,9 @@ struct _CallsOriginInterface
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin); typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
char * calls_origin_get_name (CallsOrigin *self); char *calls_origin_get_name (CallsOrigin *self);
char * calls_origin_get_id (CallsOrigin *self); char *calls_origin_get_id (CallsOrigin *self);
GList * calls_origin_get_calls (CallsOrigin *self); GList *calls_origin_get_calls (CallsOrigin *self);
void calls_origin_foreach_call (CallsOrigin *self, void calls_origin_foreach_call (CallsOrigin *self,
CallsOriginForeachCallFunc callback, CallsOriginForeachCallFunc callback,
gpointer param); gpointer param);
@@ -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,14 +40,13 @@ 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);
const char *(*get_status) (CallsProvider *self); const char *(*get_status) (CallsProvider *self);
GListModel *(*get_origins) (CallsProvider *self); GListModel *(*get_origins) (CallsProvider *self);
const char * const *(*get_protocols) (CallsProvider *self); const char *const *(*get_protocols) (CallsProvider *self);
gboolean (*is_modem) (CallsProvider *self); gboolean (*is_modem) (CallsProvider *self);
gboolean (*is_operational) (CallsProvider *self); gboolean (*is_operational) (CallsProvider *self);
}; };
@@ -57,7 +56,7 @@ const char *calls_provider_get_status (CallsProvider *self);
GListModel *calls_provider_get_origins (CallsProvider *self); GListModel *calls_provider_get_origins (CallsProvider *self);
CallsProvider *calls_provider_load_plugin (const char *name); CallsProvider *calls_provider_load_plugin (const char *name);
void calls_provider_unload_plugin (const char *name); void calls_provider_unload_plugin (const char *name);
const char * const *calls_provider_get_protocols (CallsProvider *self); const char *const *calls_provider_get_protocols (CallsProvider *self);
gboolean calls_provider_is_modem (CallsProvider *self); gboolean calls_provider_is_modem (CallsProvider *self);
gboolean calls_provider_is_operational (CallsProvider *self); gboolean calls_provider_is_operational (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,11 +213,10 @@ 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,
self); self);
} }
@@ -243,7 +241,7 @@ load_calls (CallsRecordStore *self)
CALLS_TYPE_CALL_RECORD, CALLS_TYPE_CALL_RECORD,
filter, filter,
sorting, sorting,
(GAsyncReadyCallback)load_calls_find_cb, (GAsyncReadyCallback) load_calls_find_cb,
self); self);
g_object_unref (G_OBJECT (filter)); g_object_unref (G_OBJECT (filter));
@@ -296,12 +294,12 @@ set_up_repo (CallsRecordStore *self)
g_debug ("Attempting migration of call" g_debug ("Attempting migration of call"
" record database `%s'", " record database `%s'",
self->filename); self->filename);
types = g_list_append (types, (gpointer)CALLS_TYPE_CALL_RECORD); types = g_list_append (types, (gpointer) CALLS_TYPE_CALL_RECORD);
gom_repository_automatic_migrate_async gom_repository_automatic_migrate_async
(repo, (repo,
RECORD_STORE_VERSION, RECORD_STORE_VERSION,
types, types,
(GAsyncReadyCallback)set_up_repo_migrate_cb, (GAsyncReadyCallback) set_up_repo_migrate_cb,
self); self);
self->repository = repo; self->repository = repo;
@@ -314,12 +312,11 @@ 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;
} }
ok = gom_adapter_close_sync(self->adapter, &error); ok = gom_adapter_close_sync (self->adapter, &error);
if (!ok) { if (!ok) {
if (error) if (error)
g_warning ("Error closing call record database `%s': %s", g_warning ("Error closing call record database `%s': %s",
@@ -385,15 +382,14 @@ open_repo (CallsRecordStore *self)
gom_adapter_open_async gom_adapter_open_async
(self->adapter, (self->adapter,
uri, uri,
(GAsyncReadyCallback)open_repo_adapter_open_cb, (GAsyncReadyCallback) open_repo_adapter_open_cb,
self); self);
g_free (uri); g_free (uri);
} }
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;
@@ -469,7 +466,7 @@ record_call (CallsRecordStore *self,
data->call = call; data->call = call;
gom_resource_save_async (GOM_RESOURCE (record), gom_resource_save_async (GOM_RESOURCE (record),
(GAsyncReadyCallback)record_call_save_cb, (GAsyncReadyCallback) record_call_save_cb,
data); data);
} }
@@ -519,7 +516,7 @@ stamp_call (CallsCallRecord *record,
g_date_time_unref (stamp); g_date_time_unref (stamp);
gom_resource_save_async (GOM_RESOURCE (record), gom_resource_save_async (GOM_RESOURCE (record),
(GAsyncReadyCallback)update_cb, (GAsyncReadyCallback) update_cb,
NULL); NULL);
} }
@@ -603,7 +600,7 @@ call_added_cb (CallsRecordStore *self,
g_assert (g_object_get_data (call_obj, "calls-call-start") == NULL); g_assert (g_object_get_data (call_obj, "calls-call-start") == NULL);
start = g_date_time_new_now_utc (); start = g_date_time_new_now_utc ();
g_object_set_data_full (call_obj, "calls-call-start", g_object_set_data_full (call_obj, "calls-call-start",
start, (GDestroyNotify)g_date_time_unref); start, (GDestroyNotify) g_date_time_unref);
if (!self->repository) { if (!self->repository) {
open_repo (self); open_repo (self);

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

@@ -42,7 +42,7 @@ enum {
N_SIGNALS N_SIGNALS
}; };
static guint signals [N_SIGNALS]; static guint signals[N_SIGNALS];
static void static void
calls_ussd_default_init (CallsUssdInterface *iface) calls_ussd_default_init (CallsUssdInterface *iface)

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

@@ -116,14 +116,14 @@ void calls_object_unref (gpointer object);
/** Find a particular pointer value in a GtkListStore */ /** Find a particular pointer value in a GtkListStore */
gboolean gboolean
calls_list_store_find (GtkListStore *store, calls_list_store_find (GtkListStore *store,
gpointer needle, gpointer needle,
gint needle_column, gint needle_column,
GtkTreeIter *iter); GtkTreeIter *iter);
/** Append a single character to a GtkEntry's contents */ /** Append a single character to a GtkEntry's contents */
void void
calls_entry_append (GtkEntry *entry, calls_entry_append (GtkEntry *entry,
gchar character); gchar character);
@@ -139,12 +139,11 @@ gboolean calls_find_in_store (GListModel *list,
gpointer item, gpointer item,
guint *position); guint *position);
const char* get_protocol_from_address (const char *target); const char *get_protocol_from_address (const char *target);
const char* get_protocol_from_address_with_fallback (const char *target); const char *get_protocol_from_address_with_fallback (const char *target);
gboolean dtmf_tone_key_is_valid (char key); gboolean dtmf_tone_key_is_valid (char key);
const char *get_call_icon_symbolic_name (gboolean inbound, const char *get_call_icon_symbolic_name (gboolean inbound,
gboolean missed); gboolean missed);
G_END_DECLS G_END_DECLS