1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-09-27 06:05:30 +00:00

record-row: hide copy number menu item

for anonymous callers
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-01-13 19:47:14 +01:00
parent 78a47918be
commit 9f295a729b
2 changed files with 9 additions and 9 deletions

View file

@ -330,6 +330,12 @@ static void
contact_name_cb (CallsCallRecordRow *self) contact_name_cb (CallsCallRecordRow *self)
{ {
const gchar *name = NULL; const gchar *name = NULL;
g_autofree gchar *target = NULL;
GAction *act = g_action_map_lookup_action (self->action_map, "copy-number");
g_object_get (G_OBJECT (self->record),
"target", &target,
NULL);
if (self->contact) if (self->contact)
{ {
@ -342,21 +348,17 @@ contact_name_cb (CallsCallRecordRow *self)
} }
else else
{ {
g_autofree gchar *target = NULL;
g_object_get (G_OBJECT (self->record),
"target", &target,
NULL);
if (!g_strcmp0 (target, "")) if (!g_strcmp0 (target, ""))
{ {
gtk_label_set_text (self->target, ANONYMOUS_CALLER); gtk_label_set_text (self->target, ANONYMOUS_CALLER);
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);
} }
else else
{ {
gtk_label_set_text (self->target, target); gtk_label_set_text (self->target, target);
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), "app.dial"); gtk_actionable_set_action_name (GTK_ACTIONABLE (self->button), "app.dial");
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
} }
} }
} }
@ -648,9 +650,6 @@ calls_call_record_row_init (CallsCallRecordRow *self)
act = g_action_map_lookup_action (self->action_map, "delete-call"); act = g_action_map_lookup_action (self->action_map, "delete-call");
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE); g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
act = g_action_map_lookup_action (self->action_map, "copy-number");
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
self->gesture = gtk_gesture_long_press_new (GTK_WIDGET (self->event_box)); self->gesture = gtk_gesture_long_press_new (GTK_WIDGET (self->event_box));
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (self->gesture), TRUE); gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (self->gesture), TRUE);
g_signal_connect (self->gesture, "pressed", G_CALLBACK (long_pressed), self); g_signal_connect (self->gesture, "pressed", G_CALLBACK (long_pressed), self);

View file

@ -116,6 +116,7 @@
<!-- Translators: This is a phone number --> <!-- Translators: This is a phone number -->
<attribute name="label" translatable="yes">_Copy number</attribute> <attribute name="label" translatable="yes">_Copy number</attribute>
<attribute name="action">copy-number</attribute> <attribute name="action">copy-number</attribute>
<attribute name="hidden-when">action-disabled</attribute>
</item> </item>
</section> </section>
</menu> </menu>