mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-05 19:15:32 +00:00
record-row: Codestyle
This commit is contained in:
parent
c37e9d8462
commit
625b26be32
1 changed files with 58 additions and 80 deletions
|
@ -102,31 +102,25 @@ nice_time (GDateTime *t,
|
||||||
g_assert (nice != NULL);
|
g_assert (nice != NULL);
|
||||||
g_assert (final != NULL);
|
g_assert (final != NULL);
|
||||||
|
|
||||||
if (today || yesterday)
|
if (today || yesterday) {
|
||||||
{
|
gchar *n = g_date_time_format (t_local_tz, "%R");
|
||||||
gchar *n = g_date_time_format (t_local_tz, "%R");
|
|
||||||
|
|
||||||
if (yesterday)
|
if (yesterday) {
|
||||||
{
|
gchar *s;
|
||||||
gchar *s;
|
s = g_strdup_printf (_("%s\nyesterday"), n);
|
||||||
s = g_strdup_printf (_("%s\nyesterday"), n);
|
g_free (n);
|
||||||
g_free (n);
|
n = s;
|
||||||
n = s;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
*nice = n;
|
*nice = n;
|
||||||
*final = FALSE;
|
*final = FALSE;
|
||||||
}
|
} else if (calls_date_time_is_same_year (now, t)) {
|
||||||
else if (calls_date_time_is_same_year (now, t))
|
*nice = g_date_time_format (t_local_tz, "%b %-d");
|
||||||
{
|
*final = FALSE;
|
||||||
*nice = g_date_time_format (t_local_tz, "%b %-d");
|
} else {
|
||||||
*final = FALSE;
|
*nice = g_date_time_format (t_local_tz, "%Y");
|
||||||
}
|
*final = TRUE;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
*nice = g_date_time_format (t_local_tz, "%Y");
|
|
||||||
*final = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_date_time_unref (now);
|
g_date_time_unref (now);
|
||||||
}
|
}
|
||||||
|
@ -219,13 +213,9 @@ date_change_cb (CallsCallRecordRow *self)
|
||||||
g_date_time_unref (end);
|
g_date_time_unref (end);
|
||||||
|
|
||||||
if (final)
|
if (final)
|
||||||
{
|
self->date_change_timeout = 0;
|
||||||
self->date_change_timeout = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
setup_date_change_timeout (self);
|
||||||
setup_date_change_timeout (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -240,22 +230,17 @@ update_time (CallsCallRecordRow *self,
|
||||||
gboolean missed = FALSE;
|
gboolean missed = FALSE;
|
||||||
gchar *type_icon_name;
|
gchar *type_icon_name;
|
||||||
|
|
||||||
if (end)
|
if (end) {
|
||||||
{
|
gboolean time_final;
|
||||||
gboolean time_final;
|
|
||||||
|
|
||||||
update_time_text (self, end, &time_final);
|
update_time_text (self, end, &time_final);
|
||||||
|
|
||||||
if (!time_final && !self->date_change_timeout)
|
if (!time_final && !self->date_change_timeout)
|
||||||
{
|
setup_date_change_timeout (self);
|
||||||
setup_date_change_timeout (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!answered)
|
if (!answered)
|
||||||
{
|
missed = TRUE;
|
||||||
missed = TRUE;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type_icon_name = g_strdup_printf
|
type_icon_name = g_strdup_printf
|
||||||
("call-arrow-%s%s-symbolic",
|
("call-arrow-%s%s-symbolic",
|
||||||
|
@ -285,16 +270,14 @@ notify_time_cb (CallsCallRecordRow *self,
|
||||||
|
|
||||||
update_time (self, inbound, answered, end);
|
update_time (self, inbound, answered, end);
|
||||||
|
|
||||||
if (answered)
|
if (answered) {
|
||||||
{
|
g_date_time_unref (answered);
|
||||||
g_date_time_unref (answered);
|
calls_clear_signal (record, &self->answered_notify_handler_id);
|
||||||
calls_clear_signal (record, &self->answered_notify_handler_id);
|
}
|
||||||
}
|
if (end) {
|
||||||
if (end)
|
g_date_time_unref (end);
|
||||||
{
|
calls_clear_signal (record, &self->end_notify_handler_id);
|
||||||
g_date_time_unref (end);
|
}
|
||||||
calls_clear_signal (record, &self->end_notify_handler_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -304,23 +287,21 @@ setup_time (CallsCallRecordRow *self,
|
||||||
GDateTime *answered,
|
GDateTime *answered,
|
||||||
GDateTime *end)
|
GDateTime *end)
|
||||||
{
|
{
|
||||||
if (!end)
|
if (!end) {
|
||||||
{
|
self->end_notify_handler_id =
|
||||||
self->end_notify_handler_id =
|
g_signal_connect_swapped (self->record,
|
||||||
|
"notify::end",
|
||||||
|
G_CALLBACK (notify_time_cb),
|
||||||
|
self);
|
||||||
|
|
||||||
|
if (!answered) {
|
||||||
|
self->answered_notify_handler_id =
|
||||||
g_signal_connect_swapped (self->record,
|
g_signal_connect_swapped (self->record,
|
||||||
"notify::end",
|
"notify::answered",
|
||||||
G_CALLBACK (notify_time_cb),
|
G_CALLBACK (notify_time_cb),
|
||||||
self);
|
self);
|
||||||
|
|
||||||
if (!answered)
|
|
||||||
{
|
|
||||||
self->answered_notify_handler_id =
|
|
||||||
g_signal_connect_swapped (self->record,
|
|
||||||
"notify::answered",
|
|
||||||
G_CALLBACK (notify_time_cb),
|
|
||||||
self);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update_time (self, inbound, answered, end);
|
update_time (self, inbound, answered, end);
|
||||||
}
|
}
|
||||||
|
@ -354,16 +335,13 @@ setup_contact (CallsCallRecordRow *self)
|
||||||
self->avatar, "loadable-icon",
|
self->avatar, "loadable-icon",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
|
|
||||||
if (target[0] == '\0')
|
if (target[0] == '\0') {
|
||||||
{
|
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), NULL);
|
||||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), NULL);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), FALSE);
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), FALSE);
|
} else {
|
||||||
}
|
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), "app.dial");
|
||||||
else
|
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
|
||||||
{
|
}
|
||||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), "app.dial");
|
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -397,11 +375,11 @@ static gboolean
|
||||||
calls_call_record_row_button_press_event (GtkWidget *self,
|
calls_call_record_row_button_press_event (GtkWidget *self,
|
||||||
GdkEventButton *event)
|
GdkEventButton *event)
|
||||||
{
|
{
|
||||||
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
|
if (gdk_event_triggers_context_menu ((GdkEvent *) event)) {
|
||||||
{
|
context_menu (self, (GdkEvent *) event);
|
||||||
context_menu (self, (GdkEvent *) event);
|
return TRUE;
|
||||||
return TRUE;
|
}
|
||||||
}
|
|
||||||
return GTK_WIDGET_CLASS (calls_call_record_row_parent_class)->button_press_event (self, event);
|
return GTK_WIDGET_CLASS (calls_call_record_row_parent_class)->button_press_event (self, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue