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:
@@ -71,6 +71,14 @@ enum {
|
|||||||
static GParamSpec *props[PROP_LAST_PROP];
|
static GParamSpec *props[PROP_LAST_PROP];
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SIGNAL_CALL_ADDED,
|
||||||
|
SIGNAL_CALL_REMOVED,
|
||||||
|
SIGNAL_LAST_SIGNAL,
|
||||||
|
};
|
||||||
|
static guint signals [SIGNAL_LAST_SIGNAL];
|
||||||
|
|
||||||
|
|
||||||
CallsMainWindow *
|
CallsMainWindow *
|
||||||
calls_main_window_new (GtkApplication *application, CallsProvider *provider)
|
calls_main_window_new (GtkApplication *application, CallsProvider *provider)
|
||||||
{
|
{
|
||||||
@@ -262,6 +270,8 @@ add_call (CallsMainWindow *self, CallsCall *call)
|
|||||||
CallsCallHolder *holder;
|
CallsCallHolder *holder;
|
||||||
CallsCallDisplay *display;
|
CallsCallDisplay *display;
|
||||||
|
|
||||||
|
g_signal_emit (self, signals[SIGNAL_CALL_ADDED], 0, call);
|
||||||
|
|
||||||
g_signal_connect_swapped (call, "message",
|
g_signal_connect_swapped (call, "message",
|
||||||
G_CALLBACK (show_message), self);
|
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_MAIN_WINDOW (self));
|
||||||
g_return_if_fail (CALLS_IS_CALL (call));
|
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,
|
found = find_call_holder (self, &n_items, &position, &holder,
|
||||||
find_call_holder_by_call, call);
|
find_call_holder_by_call, call);
|
||||||
g_return_if_fail (found);
|
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);
|
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_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);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, info_label);
|
gtk_widget_class_bind_template_child (widget_class, CallsMainWindow, info_label);
|
||||||
|
|||||||
Reference in New Issue
Block a user