mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-12 07:37:35 +00:00
best-match: codestyle
This commit is contained in:
parent
49c347ca31
commit
fd45f04886
2 changed files with 60 additions and 70 deletions
|
@ -37,8 +37,8 @@ struct _CallsBestMatch
|
|||
|
||||
FolksSearchView *view;
|
||||
FolksIndividual *best_match;
|
||||
gchar *phone_number;
|
||||
gchar *country_code;
|
||||
char *phone_number;
|
||||
char *country_code;
|
||||
gboolean had_country_code_last_time;
|
||||
};
|
||||
|
||||
|
@ -131,10 +131,9 @@ set_property (GObject *object,
|
|||
GParamSpec *pspec)
|
||||
{
|
||||
CallsBestMatch *self = CALLS_BEST_MATCH (object);
|
||||
const gchar *country_code;
|
||||
const char *country_code;
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
switch (property_id) {
|
||||
case PROP_PHONE_NUMBER:
|
||||
calls_best_match_set_phone_number (self, g_value_get_string (value));
|
||||
break;
|
||||
|
@ -146,7 +145,7 @@ set_property (GObject *object,
|
|||
self->country_code = g_strdup (country_code);
|
||||
|
||||
if (self->phone_number) {
|
||||
g_autofree gchar *number = g_strdup (self->phone_number);
|
||||
g_autofree char *number = g_strdup (self->phone_number);
|
||||
calls_best_match_set_phone_number (self, number);
|
||||
}
|
||||
}
|
||||
|
@ -166,8 +165,7 @@ get_property (GObject *object,
|
|||
{
|
||||
CallsBestMatch *self = CALLS_BEST_MATCH (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
switch (property_id) {
|
||||
case PROP_HAS_INDIVIDUAL:
|
||||
g_value_set_boolean (value,
|
||||
calls_best_match_has_individual (self));
|
||||
|
@ -276,7 +274,7 @@ calls_best_match_init (CallsBestMatch *self)
|
|||
|
||||
|
||||
CallsBestMatch *
|
||||
calls_best_match_new (const gchar *number)
|
||||
calls_best_match_new (const char *number)
|
||||
{
|
||||
return g_object_new (CALLS_TYPE_BEST_MATCH,
|
||||
"phone_number", number,
|
||||
|
@ -291,7 +289,7 @@ calls_best_match_has_individual (CallsBestMatch *self)
|
|||
return !!self->best_match;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
const char *
|
||||
calls_best_match_get_phone_number (CallsBestMatch *self)
|
||||
{
|
||||
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
||||
|
@ -301,7 +299,7 @@ calls_best_match_get_phone_number (CallsBestMatch *self)
|
|||
|
||||
void
|
||||
calls_best_match_set_phone_number (CallsBestMatch *self,
|
||||
const gchar *phone_number)
|
||||
const char *phone_number)
|
||||
{
|
||||
g_autoptr (EPhoneNumber) number = NULL;
|
||||
g_autoptr (CallsPhoneNumberQuery) query = NULL;
|
||||
|
@ -352,24 +350,20 @@ calls_best_match_set_phone_number (CallsBestMatch *self,
|
|||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_PHONE_NUMBER]);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
const char *
|
||||
calls_best_match_get_name (CallsBestMatch *self)
|
||||
{
|
||||
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
||||
|
||||
if (self->best_match)
|
||||
{
|
||||
return folks_individual_get_display_name (self->best_match);
|
||||
}
|
||||
else if (self->name_sip)
|
||||
return self->name_sip;
|
||||
else if (self->phone_number)
|
||||
{
|
||||
return self->phone_number;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _("Anonymous caller");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLoadableIcon *
|
||||
|
@ -378,11 +372,7 @@ calls_best_match_get_avatar (CallsBestMatch *self)
|
|||
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
||||
|
||||
if (self->best_match)
|
||||
{
|
||||
return folks_avatar_details_get_avatar (FOLKS_AVATAR_DETAILS (self->best_match));
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ G_BEGIN_DECLS
|
|||
|
||||
G_DECLARE_FINAL_TYPE (CallsBestMatch, calls_best_match, CALLS, BEST_MATCH, GObject);
|
||||
|
||||
CallsBestMatch *calls_best_match_new (const gchar *phone_number);
|
||||
CallsBestMatch *calls_best_match_new (const char *phone_number);
|
||||
gboolean calls_best_match_has_individual (CallsBestMatch *self);
|
||||
const gchar * calls_best_match_get_phone_number (CallsBestMatch *self);
|
||||
const char *calls_best_match_get_phone_number (CallsBestMatch *self);
|
||||
void calls_best_match_set_phone_number (CallsBestMatch *self,
|
||||
const gchar *phone_number);
|
||||
const gchar * calls_best_match_get_name (CallsBestMatch *self);
|
||||
const char *phone_number);
|
||||
const char *calls_best_match_get_name (CallsBestMatch *self);
|
||||
GLoadableIcon *calls_best_match_get_avatar (CallsBestMatch *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue