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;
|
FolksSearchView *view;
|
||||||
FolksIndividual *best_match;
|
FolksIndividual *best_match;
|
||||||
gchar *phone_number;
|
char *phone_number;
|
||||||
gchar *country_code;
|
char *country_code;
|
||||||
gboolean had_country_code_last_time;
|
gboolean had_country_code_last_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -131,10 +131,9 @@ set_property (GObject *object,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
CallsBestMatch *self = CALLS_BEST_MATCH (object);
|
CallsBestMatch *self = CALLS_BEST_MATCH (object);
|
||||||
const gchar *country_code;
|
const char *country_code;
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id) {
|
||||||
{
|
|
||||||
case PROP_PHONE_NUMBER:
|
case PROP_PHONE_NUMBER:
|
||||||
calls_best_match_set_phone_number (self, g_value_get_string (value));
|
calls_best_match_set_phone_number (self, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
@ -146,7 +145,7 @@ set_property (GObject *object,
|
||||||
self->country_code = g_strdup (country_code);
|
self->country_code = g_strdup (country_code);
|
||||||
|
|
||||||
if (self->phone_number) {
|
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);
|
calls_best_match_set_phone_number (self, number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,8 +165,7 @@ get_property (GObject *object,
|
||||||
{
|
{
|
||||||
CallsBestMatch *self = CALLS_BEST_MATCH (object);
|
CallsBestMatch *self = CALLS_BEST_MATCH (object);
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id) {
|
||||||
{
|
|
||||||
case PROP_HAS_INDIVIDUAL:
|
case PROP_HAS_INDIVIDUAL:
|
||||||
g_value_set_boolean (value,
|
g_value_set_boolean (value,
|
||||||
calls_best_match_has_individual (self));
|
calls_best_match_has_individual (self));
|
||||||
|
@ -276,7 +274,7 @@ calls_best_match_init (CallsBestMatch *self)
|
||||||
|
|
||||||
|
|
||||||
CallsBestMatch *
|
CallsBestMatch *
|
||||||
calls_best_match_new (const gchar *number)
|
calls_best_match_new (const char *number)
|
||||||
{
|
{
|
||||||
return g_object_new (CALLS_TYPE_BEST_MATCH,
|
return g_object_new (CALLS_TYPE_BEST_MATCH,
|
||||||
"phone_number", number,
|
"phone_number", number,
|
||||||
|
@ -291,7 +289,7 @@ calls_best_match_has_individual (CallsBestMatch *self)
|
||||||
return !!self->best_match;
|
return !!self->best_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *
|
const char *
|
||||||
calls_best_match_get_phone_number (CallsBestMatch *self)
|
calls_best_match_get_phone_number (CallsBestMatch *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
||||||
|
@ -301,7 +299,7 @@ calls_best_match_get_phone_number (CallsBestMatch *self)
|
||||||
|
|
||||||
void
|
void
|
||||||
calls_best_match_set_phone_number (CallsBestMatch *self,
|
calls_best_match_set_phone_number (CallsBestMatch *self,
|
||||||
const gchar *phone_number)
|
const char *phone_number)
|
||||||
{
|
{
|
||||||
g_autoptr (EPhoneNumber) number = NULL;
|
g_autoptr (EPhoneNumber) number = NULL;
|
||||||
g_autoptr (CallsPhoneNumberQuery) query = 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]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_PHONE_NUMBER]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *
|
const char *
|
||||||
calls_best_match_get_name (CallsBestMatch *self)
|
calls_best_match_get_name (CallsBestMatch *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
||||||
|
|
||||||
if (self->best_match)
|
if (self->best_match)
|
||||||
{
|
|
||||||
return folks_individual_get_display_name (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)
|
else if (self->phone_number)
|
||||||
{
|
|
||||||
return self->phone_number;
|
return self->phone_number;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return _("Anonymous caller");
|
return _("Anonymous caller");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GLoadableIcon *
|
GLoadableIcon *
|
||||||
|
@ -378,11 +372,7 @@ calls_best_match_get_avatar (CallsBestMatch *self)
|
||||||
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
g_return_val_if_fail (CALLS_IS_BEST_MATCH (self), NULL);
|
||||||
|
|
||||||
if (self->best_match)
|
if (self->best_match)
|
||||||
{
|
|
||||||
return folks_avatar_details_get_avatar (FOLKS_AVATAR_DETAILS (self->best_match));
|
return folks_avatar_details_get_avatar (FOLKS_AVATAR_DETAILS (self->best_match));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -33,12 +33,12 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (CallsBestMatch, calls_best_match, CALLS, BEST_MATCH, GObject);
|
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);
|
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,
|
void calls_best_match_set_phone_number (CallsBestMatch *self,
|
||||||
const gchar *phone_number);
|
const char *phone_number);
|
||||||
const gchar * calls_best_match_get_name (CallsBestMatch *self);
|
const char *calls_best_match_get_name (CallsBestMatch *self);
|
||||||
GLoadableIcon *calls_best_match_get_avatar (CallsBestMatch *self);
|
GLoadableIcon *calls_best_match_get_avatar (CallsBestMatch *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
Loading…
Reference in a new issue