1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-05-29 08:29:26 +00:00

CallHistory: Use dial action for recall button

This commit is contained in:
Julian Sparber 2020-03-02 13:31:17 +01:00 committed by Julian Sparber
parent 19632e428b
commit 62a327a0ae
2 changed files with 22 additions and 13 deletions

View file

@ -45,6 +45,7 @@ struct _CallsCallRecordRow
GtkImage *type;
GtkLabel *target;
GtkLabel *time;
GtkButton *button;
CallsCallRecord *record;
gulong answered_notify_handler_id;
@ -70,18 +71,16 @@ enum {
static GParamSpec *props[PROP_LAST_PROP];
static void
redial_clicked_cb (CallsCallRecordRow *self)
static gboolean
string_to_variant (GBinding *binding,
const GValue *from_value,
GValue *to_value)
{
gchar *target;
const gchar *target = g_value_get_string (from_value);
GVariant *variant = g_variant_new_string (target);
g_object_get (self->record,
"target", &target,
NULL);
g_assert (target != NULL);
calls_new_call_box_dial (self->new_call, target);
g_free (target);
g_value_take_variant (to_value, variant);
return TRUE;
}
@ -488,6 +487,16 @@ constructed (GObject *object)
"end", &end,
NULL);
g_object_bind_property_full (self->record,
"target",
self->button,
"action-target",
G_BINDING_SYNC_CREATE,
(GBindingTransformFunc) string_to_variant,
NULL,
NULL,
NULL);
setup_time (self, inbound, answered, end);
calls_date_time_unref (answered);
calls_date_time_unref (end);
@ -579,7 +588,7 @@ calls_call_record_row_class_init (CallsCallRecordRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, type);
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, target);
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, time);
gtk_widget_class_bind_template_callback (widget_class, redial_clicked_cb);
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, button);
}

View file

@ -47,7 +47,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="redial">
<object class="GtkButton" id="button">
<property name="visible">True</property>
<property name="margin_left">12</property>
<property name="margin_right">8</property>
@ -55,7 +55,7 @@
<property name="margin_bottom">8</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="redial_clicked_cb" swapped="yes"/>
<property name="action-name">app.dial</property>
<style>
<class name="image-button"/>
</style>