mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-07 12:25:31 +00:00
main-window: Use a new call box
Replace the custom inplementation of a call box by a CallsNewCallBox which is used to dial new calls and not to send DTMF tones as the call display can now handle that.
This commit is contained in:
parent
22d79bfbbf
commit
b05c6e34e2
3 changed files with 23 additions and 158 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include "calls-origin.h"
|
#include "calls-origin.h"
|
||||||
#include "calls-call-holder.h"
|
#include "calls-call-holder.h"
|
||||||
#include "calls-call-selector-item.h"
|
#include "calls-call-selector-item.h"
|
||||||
|
#include "calls-new-call-box.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
@ -51,11 +52,6 @@ struct _CallsMainWindow
|
||||||
GtkStack *call_stack;
|
GtkStack *call_stack;
|
||||||
GtkScrolledWindow *call_scroll;
|
GtkScrolledWindow *call_scroll;
|
||||||
GtkFlowBox *call_selector;
|
GtkFlowBox *call_selector;
|
||||||
GtkBox *dial_box;
|
|
||||||
GtkBox *dial_controls;
|
|
||||||
GtkComboBox *origin;
|
|
||||||
GtkSearchEntry *search;
|
|
||||||
HdyDialer *dial_pad;
|
|
||||||
|
|
||||||
GtkListStore *origin_store;
|
GtkListStore *origin_store;
|
||||||
};
|
};
|
||||||
|
@ -105,6 +101,18 @@ info_response_cb (GtkInfoBar *infobar,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
new_call_submitted_cb (CallsMainWindow *self,
|
||||||
|
CallsOrigin *origin,
|
||||||
|
const gchar *number,
|
||||||
|
CallsNewCallBox *new_call_box)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CALLS_IS_MAIN_WINDOW (self));
|
||||||
|
|
||||||
|
calls_origin_dial (origin, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
call_holders_create_widget_cb (CallsCallHolder *holder,
|
call_holders_create_widget_cb (CallsCallHolder *holder,
|
||||||
CallsMainWindow *self)
|
CallsMainWindow *self)
|
||||||
|
@ -112,55 +120,6 @@ call_holders_create_widget_cb (CallsCallHolder *holder,
|
||||||
return GTK_WIDGET (calls_call_holder_get_selector_item (holder));
|
return GTK_WIDGET (calls_call_holder_get_selector_item (holder));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
search_append_symbol (CallsMainWindow *self, gchar symbol)
|
|
||||||
{
|
|
||||||
GtkEntryBuffer *buf = gtk_entry_get_buffer (GTK_ENTRY (self->search));
|
|
||||||
guint len = gtk_entry_buffer_get_length (buf);
|
|
||||||
|
|
||||||
gtk_entry_buffer_insert_text (buf, len, &symbol, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dial_pad_symbol_clicked_cb (CallsMainWindow *self, gchar symbol, HdyDialer *dialer)
|
|
||||||
{
|
|
||||||
search_append_symbol (self, symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
dial_pad_deleted_cb (CallsMainWindow *self, HdyDialer *dialer)
|
|
||||||
{
|
|
||||||
GtkEntryBuffer *buf = gtk_entry_get_buffer (GTK_ENTRY (self->search));
|
|
||||||
guint len = gtk_entry_buffer_get_length (buf);
|
|
||||||
|
|
||||||
gtk_entry_buffer_delete_text (buf, len - 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
dial_pad_submitted_cb (CallsMainWindow *self, const gchar *unused, HdyDialer *dialer)
|
|
||||||
{
|
|
||||||
GtkTreeIter iter;
|
|
||||||
gboolean ok;
|
|
||||||
CallsOrigin *origin;
|
|
||||||
const gchar *number;
|
|
||||||
|
|
||||||
g_return_if_fail (CALLS_IS_MAIN_WINDOW (self));
|
|
||||||
|
|
||||||
ok = gtk_combo_box_get_active_iter (self->origin, &iter);
|
|
||||||
g_return_if_fail (ok);
|
|
||||||
|
|
||||||
gtk_tree_model_get (GTK_TREE_MODEL (self->origin_store), &iter,
|
|
||||||
ORIGIN_STORE_COLUMN_ORIGIN, &origin,
|
|
||||||
-1);
|
|
||||||
g_return_if_fail (CALLS_IS_ORIGIN (origin));
|
|
||||||
|
|
||||||
number = gtk_entry_get_text (GTK_ENTRY (self->search));
|
|
||||||
|
|
||||||
calls_origin_dial (origin, number);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
typedef gboolean (*FindCallHolderFunc) (CallsCallHolder *holder,
|
typedef gboolean (*FindCallHolderFunc) (CallsCallHolder *holder,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
@ -399,28 +358,14 @@ add_origin_calls (CallsMainWindow *self, CallsOrigin *origin)
|
||||||
static void
|
static void
|
||||||
add_origin (CallsMainWindow *self, CallsOrigin *origin)
|
add_origin (CallsMainWindow *self, CallsOrigin *origin)
|
||||||
{
|
{
|
||||||
const gint n_origins = gtk_tree_model_iter_n_children
|
|
||||||
(GTK_TREE_MODEL (self->origin_store), NULL);
|
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
if (n_origins == 1)
|
|
||||||
{
|
|
||||||
/* We have more than one origin now so show the origin combo box */
|
|
||||||
gtk_widget_show (GTK_WIDGET (self->origin));
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_list_store_append (self->origin_store, &iter);
|
gtk_list_store_append (self->origin_store, &iter);
|
||||||
gtk_list_store_set (self->origin_store, &iter,
|
gtk_list_store_set (self->origin_store, &iter,
|
||||||
ORIGIN_STORE_COLUMN_NAME, calls_origin_get_name(origin),
|
ORIGIN_STORE_COLUMN_NAME, calls_origin_get_name(origin),
|
||||||
ORIGIN_STORE_COLUMN_ORIGIN, G_OBJECT (origin),
|
ORIGIN_STORE_COLUMN_ORIGIN, G_OBJECT (origin),
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (gtk_combo_box_get_active (self->origin) == -1)
|
|
||||||
{
|
|
||||||
/* We always want an item active */
|
|
||||||
gtk_combo_box_set_active (self->origin, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
g_signal_connect_swapped (origin, "message",
|
g_signal_connect_swapped (origin, "message",
|
||||||
G_CALLBACK (show_message), self);
|
G_CALLBACK (show_message), self);
|
||||||
|
@ -459,17 +404,6 @@ dump_list_store (GtkListStore *store)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
update_origin (CallsMainWindow *self)
|
|
||||||
{
|
|
||||||
if (gtk_tree_model_iter_n_children
|
|
||||||
(GTK_TREE_MODEL (self->origin_store), NULL) < 2)
|
|
||||||
{
|
|
||||||
/* User has only one choice so hide the origin combo box */
|
|
||||||
gtk_widget_hide (GTK_WIDGET (self->origin));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
remove_origin (CallsMainWindow *self, CallsOrigin *origin)
|
remove_origin (CallsMainWindow *self, CallsOrigin *origin)
|
||||||
{
|
{
|
||||||
|
@ -481,8 +415,6 @@ remove_origin (CallsMainWindow *self, CallsOrigin *origin)
|
||||||
g_return_if_fail (ok);
|
g_return_if_fail (ok);
|
||||||
|
|
||||||
gtk_list_store_remove (self->origin_store, &iter);
|
gtk_list_store_remove (self->origin_store, &iter);
|
||||||
|
|
||||||
update_origin (self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -496,8 +428,6 @@ remove_origins (CallsMainWindow *self)
|
||||||
{
|
{
|
||||||
gtk_list_store_remove (self->origin_store, &iter);
|
gtk_list_store_remove (self->origin_store, &iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_origin (self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -644,16 +574,9 @@ calls_main_window_class_init (CallsMainWindowClass *klass)
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, call_stack);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, call_stack);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, call_scroll);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, call_scroll);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, call_selector);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, call_selector);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, dial_box);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, dial_controls);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, origin);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, search);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, dial_pad);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, origin_store);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, origin_store);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, info_response_cb);
|
gtk_widget_class_bind_template_callback (widget_class, info_response_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, call_selector_child_activated_cb);
|
gtk_widget_class_bind_template_callback (widget_class, call_selector_child_activated_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, back_clicked_cb);
|
gtk_widget_class_bind_template_callback (widget_class, back_clicked_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, dial_pad_submitted_cb);
|
gtk_widget_class_bind_template_callback (widget_class, new_call_submitted_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, dial_pad_deleted_cb);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, dial_pad_symbol_clicked_cb);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "calls-history-box.h"
|
#include "calls-history-box.h"
|
||||||
#include "calls-main-window.h"
|
#include "calls-main-window.h"
|
||||||
#include "calls-mm-provider.h"
|
#include "calls-mm-provider.h"
|
||||||
|
#include "calls-new-call-box.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_window (GtkApplication *app)
|
show_window (GtkApplication *app)
|
||||||
|
@ -42,6 +43,7 @@ show_window (GtkApplication *app)
|
||||||
|
|
||||||
CALLS_TYPE_ENCRYPTION_INDICATOR;
|
CALLS_TYPE_ENCRYPTION_INDICATOR;
|
||||||
CALLS_TYPE_HISTORY_BOX;
|
CALLS_TYPE_HISTORY_BOX;
|
||||||
|
CALLS_TYPE_NEW_CALL_BOX;
|
||||||
HDY_TYPE_DIALER;
|
HDY_TYPE_DIALER;
|
||||||
|
|
||||||
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||||
|
|
|
@ -162,75 +162,15 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="dial_box">
|
<object class="CallsNewCallBox" id="new_call_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="origin_store">origin_store</property>
|
||||||
<child>
|
<signal name="submitted" handler="new_call_submitted_cb" swapped="yes"/>
|
||||||
<object class="GtkBox" id="dial_controls">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkComboBox" id="origin">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="no_show_all">True</property>
|
|
||||||
<property name="model">origin_store</property>
|
|
||||||
<property name="id_column">0</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCellRendererText"/>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="text">0</attribute>
|
|
||||||
</attributes>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSearchEntry" id="search">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
|
||||||
<property name="primary_icon_activatable">False</property>
|
|
||||||
<property name="primary_icon_sensitive">False</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="HdyDialer" id="dial_pad">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<signal name="deleted" handler="dial_pad_deleted_cb" swapped="yes"/>
|
|
||||||
<signal name="submitted" handler="dial_pad_submitted_cb" swapped="yes"/>
|
|
||||||
<signal name="symbol-clicked" handler="dial_pad_symbol_clicked_cb" swapped="yes"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">dial-pad</property>
|
<property name="name">new-call</property>
|
||||||
<property name="title" translatable="yes">Dial pad</property>
|
<property name="title" translatable="yes">New call</property>
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -241,7 +181,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">history</property>
|
<property name="name">history</property>
|
||||||
<property name="title" translatable="yes">History</property>
|
<property name="title" translatable="yes">History</property>
|
||||||
<property name="position">2</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -257,4 +197,4 @@
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
</template>
|
</template>
|
||||||
</interface>
|
</interface>
|
Loading…
Reference in a new issue