Commit 719b3e75 authored by Bob Ham's avatar Bob Ham
Browse files

calls-call-display: Add a display of dial pad digits

Closes #57
parent 2d99fe16
......@@ -54,6 +54,7 @@ struct _CallsCallDisplay
GtkButton *answer;
GtkRevealer *dial_pad_revealer;
GtkEntry *dial_pad_display;
};
G_DEFINE_TYPE (CallsCallDisplay, calls_call_display, GTK_TYPE_OVERLAY);
......@@ -121,6 +122,8 @@ dial_pad_symbol_clicked_cb (CallsCallDisplay *self,
HdyDialer *dialer)
{
calls_call_tone_start (self->call, symbol);
calls_entry_append (self->dial_pad_display, symbol);
}
static void
......@@ -411,6 +414,7 @@ calls_call_display_class_init (CallsCallDisplayClass *klass)
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, hang_up);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, answer);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, dial_pad_revealer);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, dial_pad_display);
gtk_widget_class_bind_template_callback (widget_class, answer_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, hang_up_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, hold_toggled_cb);
......
......@@ -63,11 +63,7 @@ dial_pad_symbol_clicked_cb (CallsNewCallBox *self,
gchar symbol,
HdyDialer *dialer)
{
GtkEntryBuffer *buf = gtk_entry_get_buffer (GTK_ENTRY (self->number_entry));
guint len = gtk_entry_buffer_get_length (buf);
const gchar str[] = {symbol, '\0'};
gtk_entry_buffer_insert_text (buf, len, str, 1);
calls_entry_append (GTK_ENTRY (self->number_entry), symbol);
}
......
......@@ -395,12 +395,20 @@
<property name="width_request">300</property>
<property name="margin_bottom">6</property>
<property name="margin_top">12</property>
<property name="spacing">10</property>
<child>
<object class="GtkEntry" id="dial_pad_display">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="xalign">0.5</property>
<property name="margin_bottom">8</property>
</object>
</child>
<child>
<object class="HdyDialer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="column_spacing">10</property>
<property name="margin_bottom">10</property>
<property name="receives_default">True</property>
<property name="row_spacing">8</property>
<property name="show_action_buttons">False</property>
......
......@@ -68,3 +68,20 @@ calls_list_store_find (GtkListStore *store,
return find_data.found;
}
void
calls_entry_append (GtkEntry *entry,
gchar character)
{
const gchar str[] = {character, '\0'};
GtkEntryBuffer *buf;
guint len;
g_return_if_fail (GTK_IS_ENTRY (entry));
buf = gtk_entry_get_buffer (entry);
len = gtk_entry_buffer_get_length (buf);
gtk_entry_buffer_insert_text (buf, len - 1, str, 1);
}
......@@ -83,6 +83,11 @@ calls_list_store_find (GtkListStore *store,
gint needle_column,
GtkTreeIter *iter);
/** Append a single character to a GtkEntry's contents */
void
calls_entry_append (GtkEntry *entry,
gchar character);
G_END_DECLS
#endif /* CALLS__UTIL_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment