1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-06-03 02:49:25 +00:00

main-window: Add the 'call-added' and 'call-removed' signals

These will be used in the next commit to notify of added and removed,
which will be needed to display the calls in a secondary window.
This commit is contained in:
Adrien Plazas 2018-08-01 12:57:40 +02:00
parent bc6295f5fe
commit 7e2a1f376a

View file

@ -71,6 +71,14 @@ enum {
static GParamSpec *props[PROP_LAST_PROP];
enum {
SIGNAL_CALL_ADDED,
SIGNAL_CALL_REMOVED,
SIGNAL_LAST_SIGNAL,
};
static guint signals [SIGNAL_LAST_SIGNAL];
CallsMainWindow *
calls_main_window_new (GtkApplication *application, CallsProvider *provider)
{
@ -262,6 +270,8 @@ add_call (CallsMainWindow *self, CallsCall *call)
CallsCallHolder *holder;
CallsCallDisplay *display;
g_signal_emit (self, signals[SIGNAL_CALL_ADDED], 0, call);
g_signal_connect_swapped (call, "message",
G_CALLBACK (show_message), self);
@ -309,6 +319,8 @@ remove_call (CallsMainWindow *self, CallsCall *call, const gchar *reason)
g_return_if_fail (CALLS_IS_MAIN_WINDOW (self));
g_return_if_fail (CALLS_IS_CALL (call));
g_signal_emit (self, signals[SIGNAL_CALL_REMOVED], 0, call, reason);
found = find_call_holder (self, &n_items, &position, &holder,
find_call_holder_by_call, call);
g_return_if_fail (found);
@ -566,6 +578,28 @@ calls_main_window_class_init (CallsMainWindowClass *klass)
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
signals[SIGNAL_CALL_ADDED] =
g_signal_new ("call-added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE,
1,
CALLS_TYPE_CALL);
signals[SIGNAL_CALL_REMOVED] =
g_signal_new ("call-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE,
2,
CALLS_TYPE_CALL,
G_TYPE_STRING);
gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/calls/ui/main-window.ui");
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, info);
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, info_label);