call-record-row: Improve event handling
Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
@@ -46,7 +46,6 @@ struct _CallsCallRecordRow {
|
|||||||
GtkLabel *time;
|
GtkLabel *time;
|
||||||
GtkButton *button;
|
GtkButton *button;
|
||||||
GtkPopover *popover;
|
GtkPopover *popover;
|
||||||
GtkBox *event_box;
|
|
||||||
|
|
||||||
GMenu *context_menu;
|
GMenu *context_menu;
|
||||||
|
|
||||||
@@ -508,6 +507,19 @@ dispose (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
finalize (GObject *object)
|
||||||
|
{
|
||||||
|
CallsCallRecordRow *self = CALLS_CALL_RECORD_ROW (object);
|
||||||
|
|
||||||
|
GtkWidget *popover = GTK_WIDGET (self->popover);
|
||||||
|
|
||||||
|
g_clear_pointer (&popover, gtk_widget_unparent);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (calls_call_record_row_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calls_call_record_row_class_init (CallsCallRecordRowClass *klass)
|
calls_call_record_row_class_init (CallsCallRecordRowClass *klass)
|
||||||
{
|
{
|
||||||
@@ -518,6 +530,7 @@ calls_call_record_row_class_init (CallsCallRecordRowClass *klass)
|
|||||||
object_class->constructed = constructed;
|
object_class->constructed = constructed;
|
||||||
object_class->get_property = get_property;
|
object_class->get_property = get_property;
|
||||||
object_class->dispose = dispose;
|
object_class->dispose = dispose;
|
||||||
|
object_class->finalize = finalize;
|
||||||
|
|
||||||
props[PROP_RECORD] =
|
props[PROP_RECORD] =
|
||||||
g_param_spec_object ("record",
|
g_param_spec_object ("record",
|
||||||
@@ -536,7 +549,6 @@ calls_call_record_row_class_init (CallsCallRecordRowClass *klass)
|
|||||||
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, time);
|
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, time);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, button);
|
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, button);
|
||||||
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, event_box);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, context_menu);
|
gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, context_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,10 +628,10 @@ new_sms_activated (GSimpleAction *action,
|
|||||||
|
|
||||||
static GActionEntry entries[] =
|
static GActionEntry entries[] =
|
||||||
{
|
{
|
||||||
{ "delete-call", delete_call_activated, NULL, NULL, NULL},
|
{ "delete-call", delete_call_activated },
|
||||||
{ "copy-number", copy_number_activated, NULL, NULL, NULL},
|
{ "copy-number", copy_number_activated },
|
||||||
{ "new-contact", new_contact_activated, NULL, NULL, NULL},
|
{ "new-contact", new_contact_activated },
|
||||||
{ "new-sms", new_sms_activated, NULL, NULL, NULL},
|
{ "new-sms", new_sms_activated },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -644,13 +656,14 @@ calls_call_record_row_init (CallsCallRecordRow *self)
|
|||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
|
||||||
|
|
||||||
gesture = gtk_gesture_click_new ();
|
gesture = gtk_gesture_click_new ();
|
||||||
|
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||||
g_signal_connect (gesture, "pressed", G_CALLBACK (calls_call_record_row_button_press_event), self);
|
g_signal_connect (gesture, "pressed", G_CALLBACK (calls_call_record_row_button_press_event), self);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
gesture = gtk_gesture_long_press_new ();
|
gesture = gtk_gesture_long_press_new ();
|
||||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
|
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
|
||||||
g_signal_connect (gesture, "pressed", G_CALLBACK (on_long_pressed), self);
|
g_signal_connect (gesture, "pressed", G_CALLBACK (on_long_pressed), self);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (self->event_box), GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,54 +5,50 @@
|
|||||||
<property name="activatable">False</property>
|
<property name="activatable">False</property>
|
||||||
<property name="selectable">False</property>
|
<property name="selectable">False</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkBox" id="event_box">
|
<object class="GtkBox">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="AdwAvatar" id="avatar">
|
||||||
<child>
|
<property name="margin-start">8</property>
|
||||||
<object class="AdwAvatar" id="avatar">
|
<property name="margin_top">8</property>
|
||||||
<property name="margin-start">8</property>
|
<property name="margin_bottom">8</property>
|
||||||
<property name="margin_top">8</property>
|
<property name="size">48</property>
|
||||||
<property name="margin_bottom">8</property>
|
<property name="text" bind-source="target" bind-property="label" bind-flags="sync-create"/>
|
||||||
<property name="size">48</property>
|
<property name="show-initials">True</property>
|
||||||
<property name="text" bind-source="target" bind-property="label" bind-flags="sync-create"/>
|
</object>
|
||||||
<property name="show-initials">True</property>
|
</child>
|
||||||
</object>
|
<child>
|
||||||
</child>
|
<object class="GtkImage" id="type">
|
||||||
<child>
|
<property name="margin-start">8</property>
|
||||||
<object class="GtkImage" id="type">
|
</object>
|
||||||
<property name="margin-start">8</property>
|
</child>
|
||||||
</object>
|
<child>
|
||||||
</child>
|
<object class="GtkLabel" id="target">
|
||||||
<child>
|
<property name="margin-start">10</property>
|
||||||
<object class="GtkLabel" id="target">
|
<property name="ellipsize">middle</property>
|
||||||
<property name="margin-start">10</property>
|
</object>
|
||||||
<property name="ellipsize">middle</property>
|
</child>
|
||||||
</object>
|
<child>
|
||||||
</child>
|
<object class="GtkButton" id="button">
|
||||||
<child>
|
<property name="margin-start">12</property>
|
||||||
<object class="GtkButton" id="button">
|
<property name="margin-end">8</property>
|
||||||
<property name="margin-start">12</property>
|
<property name="margin_top">8</property>
|
||||||
<property name="margin-end">8</property>
|
<property name="margin_bottom">8</property>
|
||||||
<property name="margin_top">8</property>
|
<property name="halign">center</property>
|
||||||
<property name="margin_bottom">8</property>
|
<property name="valign">center</property>
|
||||||
<property name="halign">center</property>
|
<property name="tooltip-text">Call</property>
|
||||||
<property name="valign">center</property>
|
<property name="icon-name">call-start-symbolic</property>
|
||||||
<property name="tooltip-text">Call</property>
|
</object>
|
||||||
<property name="icon-name">call-start-symbolic</property>
|
</child>
|
||||||
</object>
|
<child>
|
||||||
</child>
|
<object class="GtkLabel" id="time">
|
||||||
<child>
|
<property name="margin-start">8</property>
|
||||||
<object class="GtkLabel" id="time">
|
<property name="justify">right</property>
|
||||||
<property name="margin-start">8</property>
|
<style>
|
||||||
<property name="justify">right</property>
|
<class name="dim-label"/>
|
||||||
<style>
|
</style>
|
||||||
<class name="dim-label"/>
|
<attributes>
|
||||||
</style>
|
<attribute name="scale" value="0.7"></attribute>
|
||||||
<attributes>
|
</attributes>
|
||||||
<attribute name="scale" value="0.7"></attribute>
|
|
||||||
</attributes>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -62,21 +58,21 @@
|
|||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Delete Call</attribute>
|
<attribute name="label" translatable="yes">_Delete Call</attribute>
|
||||||
<attribute name="action">delete-call</attribute>
|
<attribute name="action">row-history.delete-call</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<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">row-history.copy-number</attribute>
|
||||||
<attribute name="hidden-when">action-disabled</attribute>
|
<attribute name="hidden-when">action-disabled</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Add contact</attribute>
|
<attribute name="label" translatable="yes">_Add contact</attribute>
|
||||||
<attribute name="action">new-contact</attribute>
|
<attribute name="action">row-history.new-contact</attribute>
|
||||||
<attribute name="hidden-when">action-disabled</attribute>
|
<attribute name="hidden-when">action-disabled</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Send SMS</attribute>
|
<attribute name="label" translatable="yes">_Send SMS</attribute>
|
||||||
<attribute name="action">new-sms</attribute>
|
<attribute name="action">row-history.new-sms</attribute>
|
||||||
<attribute name="hidden-when">action-disabled</attribute>
|
<attribute name="hidden-when">action-disabled</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user