mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-08 04:45:31 +00:00
parent
4321381f23
commit
dc454837d6
3 changed files with 43 additions and 25 deletions
|
@ -23,7 +23,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "calls-call-selector-item.h"
|
#include "calls-call-selector-item.h"
|
||||||
#include "calls-call-display.h"
|
#include "calls-call.h"
|
||||||
|
#include "calls-ui-call-data.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
@ -35,7 +36,7 @@ struct _CallsCallSelectorItem
|
||||||
{
|
{
|
||||||
GtkEventBox parent_instance;
|
GtkEventBox parent_instance;
|
||||||
|
|
||||||
CallsCallDisplay *display;
|
CuiCallDisplay *display;
|
||||||
CallsBestMatch *contact;
|
CallsBestMatch *contact;
|
||||||
|
|
||||||
GtkBox *main_box;
|
GtkBox *main_box;
|
||||||
|
@ -65,9 +66,9 @@ call_state_changed_cb (CallsCallSelectorItem *self,
|
||||||
|
|
||||||
|
|
||||||
CallsCallSelectorItem *
|
CallsCallSelectorItem *
|
||||||
calls_call_selector_item_new (CallsCallDisplay *display)
|
calls_call_selector_item_new (CuiCallDisplay *display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CALLS_IS_CALL_DISPLAY (display), NULL);
|
g_return_val_if_fail (CUI_IS_CALL_DISPLAY (display), NULL);
|
||||||
|
|
||||||
return g_object_new (CALLS_TYPE_CALL_SELECTOR_ITEM,
|
return g_object_new (CALLS_TYPE_CALL_SELECTOR_ITEM,
|
||||||
"display", display,
|
"display", display,
|
||||||
|
@ -75,23 +76,36 @@ calls_call_selector_item_new (CallsCallDisplay *display)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CallsCallDisplay *
|
CuiCallDisplay *
|
||||||
calls_call_selector_item_get_display (CallsCallSelectorItem *item)
|
calls_call_selector_item_get_display (CallsCallSelectorItem *item)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CALLS_IS_CALL_SELECTOR_ITEM (item), NULL);
|
g_return_val_if_fail (CALLS_IS_CALL_SELECTOR_ITEM (item), NULL);
|
||||||
return item->display;
|
return item->display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CallsCall *
|
||||||
|
display_get_call (CuiCallDisplay *display)
|
||||||
|
{
|
||||||
|
CuiCall *call_data;
|
||||||
|
|
||||||
|
g_assert (CUI_IS_CALL_DISPLAY (display));
|
||||||
|
|
||||||
|
call_data = cui_call_display_get_call (display);
|
||||||
|
return calls_ui_call_data_get_call (CALLS_UI_CALL_DATA (call_data));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_party (CallsCallSelectorItem *self)
|
set_party (CallsCallSelectorItem *self)
|
||||||
{
|
{
|
||||||
|
CallsCall *call;
|
||||||
// FIXME: use HdyAvatar and the contact avatar
|
// FIXME: use HdyAvatar and the contact avatar
|
||||||
GtkWidget *image = gtk_image_new_from_icon_name ("avatar-default-symbolic", GTK_ICON_SIZE_DIALOG);
|
GtkWidget *image = gtk_image_new_from_icon_name ("avatar-default-symbolic", GTK_ICON_SIZE_DIALOG);
|
||||||
|
|
||||||
gtk_box_pack_start (self->main_box, image, TRUE, TRUE, 0);
|
gtk_box_pack_start (self->main_box, image, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (image);
|
gtk_widget_show (image);
|
||||||
|
|
||||||
self->contact = calls_call_get_contact (calls_call_display_get_call (self->display));
|
call = display_get_call (self->display);
|
||||||
|
self->contact = calls_call_get_contact (call);
|
||||||
|
|
||||||
g_object_bind_property (self->contact, "name",
|
g_object_bind_property (self->contact, "name",
|
||||||
self->name, "label",
|
self->name, "label",
|
||||||
|
@ -100,14 +114,14 @@ set_party (CallsCallSelectorItem *self)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_call_display (CallsCallSelectorItem *self, CallsCallDisplay *display)
|
set_call_display (CallsCallSelectorItem *self, CuiCallDisplay *display)
|
||||||
{
|
{
|
||||||
CallsCall *call = NULL;
|
CallsCall *call;
|
||||||
|
|
||||||
g_return_if_fail (CALLS_IS_CALL_SELECTOR_ITEM (self));
|
g_assert (CALLS_IS_CALL_SELECTOR_ITEM (self));
|
||||||
g_return_if_fail (CALLS_IS_CALL_DISPLAY (display));
|
g_assert (CUI_IS_CALL_DISPLAY (display));
|
||||||
|
|
||||||
call = calls_call_display_get_call (display);
|
call = display_get_call (display);
|
||||||
g_signal_connect_object (call, "state-changed",
|
g_signal_connect_object (call, "state-changed",
|
||||||
G_CALLBACK (call_state_changed_cb),
|
G_CALLBACK (call_state_changed_cb),
|
||||||
self,
|
self,
|
||||||
|
@ -131,7 +145,7 @@ set_property (GObject *object,
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PROP_DISPLAY:
|
case PROP_DISPLAY:
|
||||||
set_call_display
|
set_call_display
|
||||||
(self, CALLS_CALL_DISPLAY (g_value_get_object (value)));
|
(self, CUI_CALL_DISPLAY (g_value_get_object (value)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -173,9 +187,9 @@ calls_call_selector_item_class_init (CallsCallSelectorItemClass *klass)
|
||||||
g_param_spec_object ("display",
|
g_param_spec_object ("display",
|
||||||
"Call display",
|
"Call display",
|
||||||
"The display for this call",
|
"The display for this call",
|
||||||
CALLS_TYPE_CALL_DISPLAY,
|
CUI_TYPE_CALL_DISPLAY,
|
||||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
|
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@
|
||||||
#ifndef CALLS_CALL_SELECTOR_ITEM_H__
|
#ifndef CALLS_CALL_SELECTOR_ITEM_H__
|
||||||
#define CALLS_CALL_SELECTOR_ITEM_H__
|
#define CALLS_CALL_SELECTOR_ITEM_H__
|
||||||
|
|
||||||
#include "calls-call-display.h"
|
#include <call-ui.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -36,8 +35,8 @@ G_BEGIN_DECLS
|
||||||
G_DECLARE_FINAL_TYPE (CallsCallSelectorItem, calls_call_selector_item,
|
G_DECLARE_FINAL_TYPE (CallsCallSelectorItem, calls_call_selector_item,
|
||||||
CALLS, CALL_SELECTOR_ITEM, GtkEventBox);
|
CALLS, CALL_SELECTOR_ITEM, GtkEventBox);
|
||||||
|
|
||||||
CallsCallSelectorItem *calls_call_selector_item_new (CallsCallDisplay *display);
|
CallsCallSelectorItem *calls_call_selector_item_new (CuiCallDisplay *display);
|
||||||
CallsCallDisplay * calls_call_selector_item_get_display (CallsCallSelectorItem *item);
|
CuiCallDisplay *calls_call_selector_item_get_display (CallsCallSelectorItem *item);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "calls-new-call-box.h"
|
#include "calls-new-call-box.h"
|
||||||
#include "calls-in-app-notification.h"
|
#include "calls-in-app-notification.h"
|
||||||
#include "calls-manager.h"
|
#include "calls-manager.h"
|
||||||
|
#include "calls-ui-call-data.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
@ -127,8 +128,8 @@ new_call_submitted_cb (CallsCallWindow *self,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_focus (CallsCallWindow *self,
|
set_focus (CallsCallWindow *self,
|
||||||
CallsCallDisplay *display)
|
CuiCallDisplay *display)
|
||||||
{
|
{
|
||||||
gtk_stack_set_visible_child_name (self->main_stack, "active-call");
|
gtk_stack_set_visible_child_name (self->main_stack, "active-call");
|
||||||
gtk_stack_set_visible_child (self->call_stack, GTK_WIDGET (display));
|
gtk_stack_set_visible_child (self->call_stack, GTK_WIDGET (display));
|
||||||
|
@ -150,7 +151,7 @@ call_selector_child_activated_cb (GtkFlowBox *box,
|
||||||
{
|
{
|
||||||
GtkWidget *widget = gtk_bin_get_child (GTK_BIN (child));
|
GtkWidget *widget = gtk_bin_get_child (GTK_BIN (child));
|
||||||
CallsCallSelectorItem *item = CALLS_CALL_SELECTOR_ITEM (widget);
|
CallsCallSelectorItem *item = CALLS_CALL_SELECTOR_ITEM (widget);
|
||||||
CallsCallDisplay *display = calls_call_selector_item_get_display (item);
|
CuiCallDisplay *display = calls_call_selector_item_get_display (item);
|
||||||
|
|
||||||
set_focus (self, display);
|
set_focus (self, display);
|
||||||
}
|
}
|
||||||
|
@ -160,13 +161,15 @@ static void
|
||||||
add_call (CallsCallWindow *self,
|
add_call (CallsCallWindow *self,
|
||||||
CallsCall *call)
|
CallsCall *call)
|
||||||
{
|
{
|
||||||
CallsCallDisplay *display;
|
CallsUiCallData *call_data;
|
||||||
|
CuiCallDisplay *display;
|
||||||
CallsCallSelectorItem *item;
|
CallsCallSelectorItem *item;
|
||||||
|
|
||||||
g_return_if_fail (CALLS_IS_CALL_WINDOW (self));
|
g_return_if_fail (CALLS_IS_CALL_WINDOW (self));
|
||||||
g_return_if_fail (CALLS_IS_CALL (call));
|
g_return_if_fail (CALLS_IS_CALL (call));
|
||||||
|
|
||||||
display = calls_call_display_new (call);
|
call_data = calls_ui_call_data_new (call);
|
||||||
|
display = cui_call_display_new (CUI_CALL (call_data));
|
||||||
item = calls_call_selector_item_new (display);
|
item = calls_call_selector_item_new (display);
|
||||||
gtk_stack_add_named (self->call_stack, GTK_WIDGET (display),
|
gtk_stack_add_named (self->call_stack, GTK_WIDGET (display),
|
||||||
calls_call_get_number (call));
|
calls_call_get_number (call));
|
||||||
|
@ -191,9 +194,11 @@ remove_call (CallsCallWindow *self,
|
||||||
for (guint i = 0; i < n_calls; i++) {
|
for (guint i = 0; i < n_calls; i++) {
|
||||||
g_autoptr (CallsCallSelectorItem) item =
|
g_autoptr (CallsCallSelectorItem) item =
|
||||||
g_list_model_get_item (G_LIST_MODEL (self->calls), i);
|
g_list_model_get_item (G_LIST_MODEL (self->calls), i);
|
||||||
CallsCallDisplay *display = calls_call_selector_item_get_display (item);
|
CuiCallDisplay *display = calls_call_selector_item_get_display (item);
|
||||||
|
CallsUiCallData *call_data =
|
||||||
|
CALLS_UI_CALL_DATA (cui_call_display_get_call (display));
|
||||||
|
|
||||||
if (calls_call_display_get_call (display) == call) {
|
if (calls_ui_call_data_get_call (call_data) == call) {
|
||||||
g_list_store_remove (self->calls, i);
|
g_list_store_remove (self->calls, i);
|
||||||
gtk_container_remove (GTK_CONTAINER (self->call_stack),
|
gtk_container_remove (GTK_CONTAINER (self->call_stack),
|
||||||
GTK_WIDGET (display));
|
GTK_WIDGET (display));
|
||||||
|
|
Loading…
Reference in a new issue