mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-08 04:45:31 +00:00
record-row: Use per protocol dial action
This allows us to deactivate actions if there is no origin that can handle them. Closes #293
This commit is contained in:
parent
dd4a02aea2
commit
b00deccdcb
2 changed files with 15 additions and 24 deletions
|
@ -73,19 +73,6 @@ enum {
|
||||||
static GParamSpec *props[PROP_LAST_PROP];
|
static GParamSpec *props[PROP_LAST_PROP];
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
string_to_variant (GBinding *binding,
|
|
||||||
const GValue *from_value,
|
|
||||||
GValue *to_value)
|
|
||||||
{
|
|
||||||
const gchar *target = g_value_get_string (from_value);
|
|
||||||
GVariant *variant = g_variant_new_string (target);
|
|
||||||
|
|
||||||
g_value_take_variant (to_value, variant);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nice_time (GDateTime *t,
|
nice_time (GDateTime *t,
|
||||||
gchar **nice,
|
gchar **nice,
|
||||||
|
@ -359,7 +346,6 @@ setup_contact (CallsCallRecordRow *self)
|
||||||
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 (action_copy), FALSE);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION (action_copy), FALSE);
|
||||||
} else {
|
} else {
|
||||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), "app.dial");
|
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (action_copy), TRUE);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION (action_copy), TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,22 +431,28 @@ constructed (GObject *object)
|
||||||
gboolean inbound;
|
gboolean inbound;
|
||||||
GDateTime *answered;
|
GDateTime *answered;
|
||||||
GDateTime *end;
|
GDateTime *end;
|
||||||
|
g_autofree char *target_name = NULL;
|
||||||
|
g_autofree char *protocol = NULL;
|
||||||
|
g_autofree char *action_name = NULL;
|
||||||
|
|
||||||
g_object_get (G_OBJECT (self->record),
|
g_object_get (G_OBJECT (self->record),
|
||||||
"inbound", &inbound,
|
"inbound", &inbound,
|
||||||
"answered", &answered,
|
"answered", &answered,
|
||||||
"end", &end,
|
"end", &end,
|
||||||
|
"protocol", &protocol,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_object_bind_property_full (self->record,
|
/* Fall back to "app.dial-tel" action if no protocol was given */
|
||||||
"target",
|
if (protocol)
|
||||||
self->button,
|
action_name = g_strdup_printf ("app.dial-%s", protocol);
|
||||||
"action-target",
|
else
|
||||||
G_BINDING_SYNC_CREATE,
|
action_name = g_strdup ("app.dial-tel");
|
||||||
(GBindingTransformFunc) string_to_variant,
|
|
||||||
NULL,
|
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), action_name);
|
||||||
NULL,
|
|
||||||
NULL);
|
/* TODO add origin ID to action target */
|
||||||
|
gtk_actionable_set_action_target (GTK_ACTIONABLE (self->button),
|
||||||
|
"(ss)", self->target, "");
|
||||||
|
|
||||||
setup_time (self, inbound, answered, end);
|
setup_time (self, inbound, answered, end);
|
||||||
calls_date_time_unref (answered);
|
calls_date_time_unref (answered);
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
<property name="margin_bottom">8</property>
|
<property name="margin_bottom">8</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="action-name">app.dial</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="image-button"/>
|
<class name="image-button"/>
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue