diff --git a/src/calls-call-display.c b/src/calls-call-display.c
index 568d8d1..dc97dcc 100644
--- a/src/calls-call-display.c
+++ b/src/calls-call-display.c
@@ -35,7 +35,7 @@
struct _CallsCallDisplay
{
- GtkBox parent_instance;
+ GtkOverlay parent_instance;
CallsCall *call;
GTimer *timer;
@@ -51,9 +51,11 @@ struct _CallsCallDisplay
GtkToggleButton *mute;
GtkButton *hang_up;
GtkToggleButton *speaker;
+
+ GtkRevealer *dial_pad_revealer;
};
-G_DEFINE_TYPE (CallsCallDisplay, calls_call_display, GTK_TYPE_BOX);
+G_DEFINE_TYPE (CallsCallDisplay, calls_call_display, GTK_TYPE_OVERLAY);
enum {
PROP_0,
@@ -99,6 +101,20 @@ speaker_toggled_cb (GtkToggleButton *togglebutton,
}
+static void
+dial_pad_symbol_clicked_cb (CallsCallDisplay *self,
+ gchar symbol,
+ HdyDialer *dialer)
+{
+ calls_call_tone_start (self->call, symbol);
+}
+
+static void
+hide_dial_pad_clicked_cb (CallsCallDisplay *self)
+{
+ gtk_revealer_set_reveal_child (self->dial_pad_revealer, FALSE);
+}
+
static gboolean
timeout_cb (CallsCallDisplay *self)
{
@@ -213,7 +229,7 @@ set_party (CallsCallDisplay *self, CallsParty *party)
const gchar *name, *number;
image = calls_party_create_image (party);
- gtk_box_pack_start (self->party_box, image, TRUE, TRUE, 0);
+ gtk_box_pack_end (self->party_box, image, TRUE, FALSE, 0);
gtk_image_set_pixel_size (GTK_IMAGE (image), 100);
gtk_widget_show (image);
@@ -255,7 +271,7 @@ set_property (GObject *object,
static void
constructed (GObject *object)
{
- GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_BOX);
+ GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_OVERLAY);
CallsCallDisplay *self = CALLS_CALL_DISPLAY (object);
self->timer = g_timer_new ();
@@ -276,7 +292,7 @@ calls_call_display_init (CallsCallDisplay *self)
static void
dispose (GObject *object)
{
- GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_BOX);
+ GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_OVERLAY);
CallsCallDisplay *self = CALLS_CALL_DISPLAY (object);
g_clear_object (&self->call);
@@ -287,7 +303,7 @@ dispose (GObject *object)
static void
finalize (GObject *object)
{
- GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_BOX);
+ GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_OVERLAY);
CallsCallDisplay *self = CALLS_CALL_DISPLAY (object);
g_source_remove (self->timeout);
@@ -327,8 +343,11 @@ calls_call_display_class_init (CallsCallDisplayClass *klass)
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, mute);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, hang_up);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, speaker);
+ gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, dial_pad_revealer);
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, mute_toggled_cb);
gtk_widget_class_bind_template_callback (widget_class, speaker_toggled_cb);
+ gtk_widget_class_bind_template_callback (widget_class, dial_pad_symbol_clicked_cb);
+ gtk_widget_class_bind_template_callback (widget_class, hide_dial_pad_clicked_cb);
}
diff --git a/src/calls-call-display.h b/src/calls-call-display.h
index 6d099f8..9f121aa 100644
--- a/src/calls-call-display.h
+++ b/src/calls-call-display.h
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
#define CALLS_TYPE_CALL_DISPLAY (calls_call_display_get_type ())
-G_DECLARE_FINAL_TYPE (CallsCallDisplay, calls_call_display, CALLS, CALL_DISPLAY, GtkBox);
+G_DECLARE_FINAL_TYPE (CallsCallDisplay, calls_call_display, CALLS, CALL_DISPLAY, GtkOverlay);
CallsCallDisplay *calls_call_display_new (CallsCallData *data);
diff --git a/src/calls-history-box.c b/src/calls-history-box.c
new file mode 100644
index 0000000..c0d8444
--- /dev/null
+++ b/src/calls-history-box.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2018 Purism SPC
+ *
+ * This file is part of Calls.
+ *
+ * Calls is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calls is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calls. If not, see .
+ *
+ * Author: Adrien Plazas
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+#include "calls-history-box.h"
+#include "calls-origin.h"
+#include "calls-call-holder.h"
+#include "calls-call-selector-item.h"
+#include "util.h"
+
+#include
+#include
+
+#define HANDY_USE_UNSTABLE_API
+#include
+
+
+struct _CallsHistoryBox
+{
+ GtkTreeView parent_instance;
+
+ GtkListStore *history_store;
+};
+
+G_DEFINE_TYPE (CallsHistoryBox, calls_history_box, GTK_TYPE_TREE_VIEW);
+
+
+static void
+calls_history_box_init (CallsHistoryBox *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+
+static void
+calls_history_box_class_init (CallsHistoryBoxClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/calls/ui/history-box.ui");
+ gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, history_store);
+}
diff --git a/src/calls-history-box.h b/src/calls-history-box.h
new file mode 100644
index 0000000..77196b5
--- /dev/null
+++ b/src/calls-history-box.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 Purism SPC
+ *
+ * This file is part of Calls.
+ *
+ * Calls is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calls is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calls. If not, see .
+ *
+ * Author: Adrien Plazas
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+#ifndef CALLS_HISTORY_BOX_H__
+#define CALLS_HISTORY_BOX_H__
+
+#include
+
+#define HANDY_USE_UNSTABLE_API
+#include
+
+G_BEGIN_DECLS
+
+#define CALLS_TYPE_HISTORY_BOX (calls_history_box_get_type ())
+
+G_DECLARE_FINAL_TYPE (CallsHistoryBox, calls_history_box, CALLS, HISTORY_BOX, GtkTreeView);
+
+G_END_DECLS
+
+#endif /* CALLS_HISTORY_BOX_H__ */
diff --git a/src/calls-main-window.c b/src/calls-main-window.c
index 2065ba1..ee1de9a 100644
--- a/src/calls-main-window.c
+++ b/src/calls-main-window.c
@@ -26,6 +26,7 @@
#include "calls-origin.h"
#include "calls-call-holder.h"
#include "calls-call-selector-item.h"
+#include "calls-new-call-box.h"
#include "util.h"
#include
@@ -51,15 +52,8 @@ struct _CallsMainWindow
GtkStack *call_stack;
GtkScrolledWindow *call_scroll;
GtkFlowBox *call_selector;
- GtkBox *dial_box;
- GtkExpander *new_call;
- GtkBox *dial_controls;
- GtkComboBox *origin;
- GtkSearchEntry *search;
- HdyDialer *dial_pad;
GtkListStore *origin_store;
- GtkListStore *history_store;
};
enum {
@@ -107,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 *
call_holders_create_widget_cb (CallsCallHolder *holder,
CallsMainWindow *self)
@@ -114,71 +120,6 @@ call_holders_create_widget_cb (CallsCallHolder *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)
-{
- if (self->focus && !gtk_expander_get_expanded (self->new_call))
- {
- CallsCallData *data = calls_call_holder_get_data (self->focus);
- CallsCall *call = calls_call_data_get_call (data);
-
- calls_call_tone_start (call, symbol);
- }
- else
- {
- 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));
-
- if (gtk_widget_get_visible (GTK_WIDGET (self->new_call))
- && !gtk_expander_get_expanded (self->new_call))
- {
- return;
- }
-
- 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,
gpointer user_data);
@@ -259,65 +200,6 @@ set_focus (CallsMainWindow *self, CallsCallHolder *holder)
}
-/* When we have an active call, we hide the dialpad action buttons and
- * put the dial_controls inside the new_call expander and use the
- * expanded state to determine whether key presses should be
- * considered dialing a new call or entering DTMF tones for the active
- * call.
- */
-static void
-show_new_call (CallsMainWindow *self)
-{
- GtkWidget *dial_controls_widget = GTK_WIDGET (self->dial_controls);
- GObject *dial_controls_object = G_OBJECT (dial_controls_widget);
-
- hdy_dialer_set_show_action_buttons (self->dial_pad, FALSE);
-
- g_object_ref (dial_controls_object);
- gtk_container_remove (GTK_CONTAINER (self->dial_box), dial_controls_widget);
-
- gtk_container_add (GTK_CONTAINER (self->new_call), dial_controls_widget);
- g_object_unref (dial_controls_object);
-
- gtk_expander_set_expanded (self->new_call, FALSE);
- gtk_widget_show (GTK_WIDGET (self->new_call));
-
- gtk_widget_queue_allocate (GTK_WIDGET (self));
-}
-
-
-static void
-hide_new_call (CallsMainWindow *self)
-{
- GtkWidget *dial_controls_widget = GTK_WIDGET (self->dial_controls);
- GObject *dial_controls_object = G_OBJECT (dial_controls_widget);
-
- gtk_widget_hide (GTK_WIDGET (self->new_call));
-
- g_object_ref (dial_controls_object);
- gtk_container_remove (GTK_CONTAINER (self->new_call), dial_controls_widget);
-
- gtk_box_pack_start (self->dial_box, dial_controls_widget, FALSE, TRUE, 0);
- g_object_unref (dial_controls_object);
-
- gtk_box_reorder_child (self->dial_box, dial_controls_widget, 0);
-
- hdy_dialer_set_show_action_buttons (self->dial_pad, TRUE);
-
- gtk_widget_queue_allocate (GTK_WIDGET (self));
-}
-
-
-static void
-new_call_expanded_notify_cb (GtkExpander *new_call,
- GParamSpec *param_spec,
- CallsMainWindow *self)
-{
- hdy_dialer_set_show_action_buttons (self->dial_pad,
- gtk_expander_get_expanded (new_call));
-}
-
-
static void
back_clicked_cb (GtkButton *back,
CallsMainWindow *self)
@@ -349,7 +231,6 @@ show_calls (CallsMainWindow *self, guint old_call_count)
gtk_stack_add_titled (self->main_stack,
GTK_WIDGET (self->call_stack),
"call", "Call");
- show_new_call (self);
}
if (old_call_count > 0)
@@ -364,7 +245,6 @@ hide_calls (CallsMainWindow *self, guint call_count)
{
if (call_count == 0)
{
- hide_new_call (self);
gtk_container_remove (GTK_CONTAINER (self->main_stack),
GTK_WIDGET (self->call_stack));
}
@@ -478,28 +358,14 @@ add_origin_calls (CallsMainWindow *self, CallsOrigin *origin)
static void
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;
- 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_set (self->origin_store, &iter,
ORIGIN_STORE_COLUMN_NAME, calls_origin_get_name(origin),
ORIGIN_STORE_COLUMN_ORIGIN, G_OBJECT (origin),
-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_CALLBACK (show_message), self);
@@ -538,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
remove_origin (CallsMainWindow *self, CallsOrigin *origin)
{
@@ -560,8 +415,6 @@ remove_origin (CallsMainWindow *self, CallsOrigin *origin)
g_return_if_fail (ok);
gtk_list_store_remove (self->origin_store, &iter);
-
- update_origin (self);
}
@@ -575,8 +428,6 @@ remove_origins (CallsMainWindow *self)
{
gtk_list_store_remove (self->origin_store, &iter);
}
-
- update_origin (self);
}
@@ -723,19 +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_scroll);
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, new_call);
- 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, history_store);
gtk_widget_class_bind_template_callback (widget_class, info_response_cb);
- gtk_widget_class_bind_template_callback (widget_class, new_call_expanded_notify_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, dial_pad_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);
+ gtk_widget_class_bind_template_callback (widget_class, new_call_submitted_cb);
}
diff --git a/src/calls-new-call-box.c b/src/calls-new-call-box.c
new file mode 100644
index 0000000..b3c6ceb
--- /dev/null
+++ b/src/calls-new-call-box.c
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2018 Purism SPC
+ *
+ * This file is part of Calls.
+ *
+ * Calls is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calls is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calls. If not, see .
+ *
+ * Author: Adrien Plazas
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+#include "calls-new-call-box.h"
+
+#include "calls-origin.h"
+
+#include
+#define HANDY_USE_UNSTABLE_API
+#include
+
+
+struct _CallsNewCallBox
+{
+ GtkBox parent_instance;
+
+ GtkComboBox *origin_box;
+ GtkSearchEntry *number_entry;
+ HdyDialer *dial_pad;
+
+ gulong origin_store_row_deleted_id;
+ gulong origin_store_row_inserted_id;
+};
+
+G_DEFINE_TYPE (CallsNewCallBox, calls_new_call_box, GTK_TYPE_BOX);
+
+
+enum {
+ PROP_0,
+ PROP_ORIGIN_STORE,
+ PROP_LAST_PROP,
+};
+static GParamSpec *props[PROP_LAST_PROP];
+
+
+enum {
+ SIGNAL_SUBMITTED,
+ SIGNAL_LAST_SIGNAL,
+};
+static guint signals[SIGNAL_LAST_SIGNAL];
+
+
+enum {
+ ORIGIN_STORE_COLUMN_NAME,
+ ORIGIN_STORE_COLUMN_ORIGIN
+};
+
+
+static void
+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);
+
+ gtk_entry_buffer_insert_text (buf, len, &symbol, 1);
+}
+
+
+static void
+dial_pad_deleted_cb (CallsNewCallBox *self,
+ HdyDialer *dialer)
+{
+ GtkEntryBuffer *buf = gtk_entry_get_buffer (GTK_ENTRY (self->number_entry));
+ guint len = gtk_entry_buffer_get_length (buf);
+
+ gtk_entry_buffer_delete_text (buf, len - 1, 1);
+}
+
+
+static void
+dial_clicked_cb (CallsNewCallBox *self,
+ const gchar *unused,
+ GtkButton *button)
+{
+ GtkTreeIter iter;
+ GtkTreeModel *origin_store;
+ CallsOrigin *origin;
+ const gchar *number;
+
+ gtk_combo_box_get_active_iter (self->origin_box, &iter);
+ if (!gtk_combo_box_get_active_iter (self->origin_box, &iter))
+ {
+ g_debug ("Can't submit call with no origin.");
+
+ return;
+ }
+
+ origin_store = gtk_combo_box_get_model (self->origin_box);
+ gtk_tree_model_get (origin_store, &iter,
+ ORIGIN_STORE_COLUMN_ORIGIN, &origin,
+ -1);
+ g_assert (CALLS_IS_ORIGIN (origin));
+
+ number = gtk_entry_get_text (GTK_ENTRY (self->number_entry));
+
+ g_signal_emit (self, signals[SIGNAL_SUBMITTED], 0, origin, number);
+}
+
+
+void
+update_origin_box (CallsNewCallBox *self)
+{
+ GtkTreeModel *origin_store = gtk_combo_box_get_model (self->origin_box);
+ GtkTreeIter iter;
+
+ if (origin_store == NULL ||
+ !gtk_tree_model_get_iter_first (origin_store, &iter))
+ {
+ gtk_widget_hide (GTK_WIDGET (self->origin_box));
+
+ return;
+ }
+
+ /* We know there is a model and it's not empty. */
+
+ if (!gtk_tree_model_iter_next (origin_store, &iter))
+ {
+ gtk_combo_box_set_active (self->origin_box, 0);
+ gtk_widget_hide (GTK_WIDGET (self->origin_box));
+
+ return;
+ }
+
+ /* We know there are multiple origins in the model. */
+
+ if (gtk_combo_box_get_active (self->origin_box) < 0)
+ {
+ gtk_combo_box_set_active (self->origin_box, 0);
+ }
+
+ /* We know there are multiple origins and one is selected. */
+
+ gtk_widget_show (GTK_WIDGET (self->origin_box));
+}
+
+
+static void
+calls_new_call_box_set_origin_store (CallsNewCallBox *self,
+ GtkListStore *origin_store)
+{
+ g_return_if_fail (CALLS_IS_NEW_CALL_BOX (self));
+ g_return_if_fail (origin_store == NULL || GTK_IS_LIST_STORE (origin_store));
+
+ if (self->origin_store_row_deleted_id != 0)
+ {
+ g_signal_handler_disconnect (gtk_combo_box_get_model (self->origin_box),
+ self->origin_store_row_deleted_id);
+ g_signal_handler_disconnect (gtk_combo_box_get_model (self->origin_box),
+ self->origin_store_row_inserted_id);
+ }
+
+ gtk_combo_box_set_model (self->origin_box, GTK_TREE_MODEL (origin_store));
+
+ if (origin_store != NULL)
+ {
+ self->origin_store_row_deleted_id = g_signal_connect_swapped (origin_store, "row-deleted", G_CALLBACK (update_origin_box), self);
+ self->origin_store_row_inserted_id = g_signal_connect_swapped (origin_store, "row-inserted", G_CALLBACK (update_origin_box), self);
+ }
+ else
+ {
+ self->origin_store_row_deleted_id = 0;
+ self->origin_store_row_inserted_id = 0;
+ }
+}
+
+
+static void
+calls_new_call_box_init (CallsNewCallBox *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+
+ update_origin_box (self);
+}
+
+
+static void
+calls_new_call_box_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ CallsNewCallBox *self = CALLS_NEW_CALL_BOX (object);
+
+ switch (property_id)
+ {
+ case PROP_ORIGIN_STORE:
+ calls_new_call_box_set_origin_store (self, g_value_get_object (value));
+ g_object_notify_by_pspec (object, pspec);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void
+calls_new_call_box_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ CallsNewCallBox *self = CALLS_NEW_CALL_BOX (object);
+
+ switch (property_id)
+ {
+ case PROP_ORIGIN_STORE:
+ g_value_set_object (value, gtk_combo_box_get_model (self->origin_box));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void
+calls_new_call_box_class_init (CallsNewCallBoxClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->set_property = calls_new_call_box_set_property;
+ object_class->get_property = calls_new_call_box_get_property;
+
+ props[PROP_ORIGIN_STORE] =
+ g_param_spec_object ("origin-store",
+ _("Origin store"),
+ _("The storage for origins"),
+ GTK_TYPE_LIST_STORE,
+ G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+
+ g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
+
+ /**
+ * CallsNewCallBox::submitted:
+ * @self: The # CallsNewCallBox instance.
+ * @origin: The origin of the call.
+ * @number: The number at the time of activation.
+ *
+ * This signal is emitted when the dialer's 'dial' button is activated.
+ * Connect to this signal to perform to get notified when the user
+ * wants to submit the dialed number for a given call origin.
+ */
+ signals[SIGNAL_SUBMITTED] =
+ g_signal_new ("submitted",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 2,
+ CALLS_TYPE_ORIGIN,
+ G_TYPE_STRING);
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/calls/ui/new-call-box.ui");
+ gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, origin_box);
+ gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, number_entry);
+ gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, dial_pad);
+ gtk_widget_class_bind_template_callback (widget_class, dial_clicked_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);
+}
diff --git a/src/calls-new-call-box.h b/src/calls-new-call-box.h
new file mode 100644
index 0000000..7e7b06f
--- /dev/null
+++ b/src/calls-new-call-box.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2018 Purism SPC
+ *
+ * This file is part of Calls.
+ *
+ * Calls is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calls is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calls. If not, see .
+ *
+ * Author: Adrien Plazas
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+#ifndef CALLS_NEW_CALL_BOX_H__
+#define CALLS_NEW_CALL_BOX_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define CALLS_TYPE_NEW_CALL_BOX (calls_new_call_box_get_type ())
+
+G_DECLARE_FINAL_TYPE (CallsNewCallBox, calls_new_call_box, CALLS, NEW_CALL_BOX, GtkBox);
+
+G_END_DECLS
+
+#endif /* CALLS_NEW_CALL_BOX_H__ */
diff --git a/src/calls.gresources.xml b/src/calls.gresources.xml
index cbaa257..355bfc8 100644
--- a/src/calls.gresources.xml
+++ b/src/calls.gresources.xml
@@ -5,5 +5,7 @@
call-display.ui
call-selector-item.ui
encryption-indicator.ui
+ history-box.ui
+ new-call-box.ui
diff --git a/src/main.c b/src/main.c
index 367c2a7..0dc5d0e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -28,8 +28,10 @@
#include
#include "calls-encryption-indicator.h"
+#include "calls-history-box.h"
#include "calls-main-window.h"
#include "calls-mm-provider.h"
+#include "calls-new-call-box.h"
#define APP_ID "sm.puri.Calls"
@@ -42,6 +44,8 @@ show_window (GtkApplication *app)
CallsMainWindow *main_window;
CALLS_TYPE_ENCRYPTION_INDICATOR;
+ CALLS_TYPE_HISTORY_BOX;
+ CALLS_TYPE_NEW_CALL_BOX;
HDY_TYPE_DIALER;
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
diff --git a/src/meson.build b/src/meson.build
index 21d1066..2a215b1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -46,6 +46,8 @@ calls_sources = ['calls-message-source.c', 'calls-message-source.h',
'calls-call-display.c', 'calls-call-display.h',
'calls-call-selector-item.c', 'calls-call-selector-item.h',
'calls-encryption-indicator.c', 'calls-encryption-indicator.h',
+ 'calls-history-box.c', 'calls-history-box.h',
+ 'calls-new-call-box.c', 'calls-new-call-box.h',
'calls-main-window.c', 'calls-main-window.h',
'util.c', 'util.h',
]
diff --git a/src/ui/call-display.ui b/src/ui/call-display.ui
index c07f4c5..dd46ccd 100644
--- a/src/ui/call-display.ui
+++ b/src/ui/call-display.ui
@@ -2,170 +2,251 @@
-
+
True
False
- center
- 8
- 12
- 12
- 8
- vertical
- center
- 300
-
-
-
- True
False
+ center
+ 8
+ 12
+ 12
+ 8
vertical
+ center
+ True
+ 300
+
-
+
True
False
- Active
-
-
-
-
- True
- False
- 00:00
- 30
- 40
-
-
-
-
-
-
-
- Answer
- True
- True
- True
- True
-
+ vertical
+
+
+ True
+ False
+ 6
+ 6
+
+
+
+
+
+
+
+
+ True
+ False
+ 4
+ 4
+
+
True
False
- 12
- True
- 65
- 65
+ vertical
-
+
+ True
+ False
+ Active
+
+
+
+
+ True
+ False
+ 00:00
+ 30
+ 40
+
+
+
+
+
+
+
+ Answer
True
True
True
True
-
+
+
+
+
+
+ True
+ False
+ 12
+ True
+ 65
+ 65
-
+
True
- False
- microphone-sensitivity-muted-symbolic
- 3
+ True
+ True
+ True
+
+
+
+ True
+ False
+ microphone-sensitivity-muted-symbolic
+ 3
+
+
+
+
+
+
+ True
+ True
+ True
+ True
+
+
+
+ True
+ False
+ input-dialpad-symbolic
+ 3
+
+
+
+
+
+
+ True
+ True
+ True
+ True
+
+
+
+ True
+ False
+ audio-volume-high-symbolic
+ 3
+
+
-
+
+ False
+ 30
True
- True
- True
- True
-
-
- True
- False
- input-dialpad-symbolic
- 3
-
-
-
- True
+
+ True
True
- True
- True
-
+ center
+ 65
+ False
+ start
+ True
+ 150
+
+
+
+
+ Hang up
+
+
True
- False
- audio-volume-high-symbolic
- 3
+ call-stop-symbolic
+ 5
+
+
+
+
+ True
+ False
+ fill
+ end
+ True
+ False
+ slide-up
+
-
+
+ True
False
- 30
- True
-
-
-
-
- True
- True
- center
- 65
- False
- start
- True
- 150
-
-
-
- Hang up
-
-
-
-
+
+
True
- call-stop-symbolic
- 5
+ False
+ vertical
+ 300
+ 6
+ 12
+
+
+ True
+ True
+ 10
+ 10
+ True
+ 8
+ False
+ False
+
+
+
+
+
+ True
+ True
+ center
+ 65
+ True
+ start
+ none
+ True
+ 150
+
+
+
+
+ Hide the dial pad
+
+
+
+
+ True
+ go-down-symbolic
+ 5
+
+
+
+
diff --git a/src/ui/history-box.ui b/src/ui/history-box.ui
new file mode 100644
index 0000000..5de67f4
--- /dev/null
+++ b/src/ui/history-box.ui
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ False
+ history_store
+ True
+
+
+
+
+
diff --git a/src/ui/main-window.ui b/src/ui/main-window.ui
index 8968372..87a3c42 100644
--- a/src/ui/main-window.ui
+++ b/src/ui/main-window.ui
@@ -3,7 +3,6 @@
-
@@ -14,7 +13,7 @@
False
- Call
+ Calls
True
False
@@ -163,114 +162,26 @@
-
+
True
False
- vertical
-
-
- True
- False
- vertical
-
-
- False
- True
- origin_store
- 0
-
-
-
- 0
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- True
- edit-find-symbolic
- False
- False
-
-
- False
- True
- 1
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- True
- True
-
-
-
-
-
-
- True
- False
- New call
-
-
-
-
- False
- True
- 6
- 1
-
-
-
-
- True
- True
- True
-
-
-
-
-
- True
- True
- 2
-
-
+ origin_store
+
- dial-pad
- Dial pad
- 1
+ new-call
+ New call
-
+
True
True
- history_store
-
-
-
history
History
- 2
+ 3
@@ -286,4 +197,4 @@
-
+
\ No newline at end of file
diff --git a/src/ui/new-call-box.ui b/src/ui/new-call-box.ui
new file mode 100644
index 0000000..839b904
--- /dev/null
+++ b/src/ui/new-call-box.ui
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+ False
+ center
+ 16
+ 24
+ 24
+ 16
+ vertical
+ center
+ True
+
+
+ False
+ 0
+ 8
+ True
+ True
+
+
+
+ 0
+
+
+
+
+ False
+ True
+
+
+
+
+ True
+ False
+ edit-find-symbolic
+ False
+ True
+
+
+ False
+ True
+
+
+
+
+ True
+ True
+ 10
+ 20
+ 20
+ True
+ 8
+ False
+ 300
+ False
+
+
+
+
+ False
+ True
+
+
+
+
+ True
+ True
+ center
+ 65
+ True
+ start
+ True
+ 150
+
+
+
+
+ Dial
+
+
+
+
+ True
+ call-start-symbolic
+ 5
+
+
+
+
+ False
+ True
+
+
+
+