2021-05-11 16:18:35 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author: Evangelos Ribeiro Tzaras <evangelos.tzaras@puri.sm>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define G_LOG_DOMAIN "CallsAccountOverview"
|
|
|
|
|
2022-12-18 10:18:10 +00:00
|
|
|
#include "calls-config.h"
|
2022-11-13 10:15:03 +00:00
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
#include "calls-account.h"
|
|
|
|
#include "calls-account-overview.h"
|
|
|
|
#include "calls-account-row.h"
|
|
|
|
#include "calls-account-provider.h"
|
2021-07-05 08:01:26 +00:00
|
|
|
#include "calls-manager.h"
|
2021-12-15 13:06:03 +00:00
|
|
|
#include "calls-in-app-notification.h"
|
2023-05-15 08:08:55 +00:00
|
|
|
#include "calls-plugin-manager.h"
|
|
|
|
#include "calls-util.h"
|
|
|
|
|
2022-11-13 10:15:03 +00:00
|
|
|
#include <glib/gi18n-lib.h>
|
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Section:calls-account-overview
|
2023-12-13 20:56:46 +00:00
|
|
|
* short_description: A #AdwWindow to manage VoIP accounts
|
2021-05-11 16:18:35 +00:00
|
|
|
* @Title: CallsAccountOverview
|
|
|
|
*
|
2023-12-13 20:56:46 +00:00
|
|
|
* This is a #AdwWindow derived window to display and manage the
|
2021-05-11 16:18:35 +00:00
|
|
|
* VoIP accounts. Each available #CallsAccount from any #CallsAccountProvider
|
|
|
|
* will be listed as a #CallsAccountRow.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SHOW_INTRO = 0,
|
|
|
|
SHOW_OVERVIEW,
|
|
|
|
} CallsAccountOverviewState;
|
|
|
|
|
|
|
|
|
|
|
|
struct _CallsAccountOverview {
|
2023-12-13 20:56:46 +00:00
|
|
|
AdwWindow parent;
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
/* UI widgets */
|
2022-04-24 10:24:55 +00:00
|
|
|
GtkStack *stack;
|
|
|
|
GtkWidget *intro;
|
|
|
|
GtkWidget *overview;
|
|
|
|
GtkWidget *add_btn;
|
2022-05-21 16:05:13 +00:00
|
|
|
GtkListBoxRow *add_row;
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
/* The window where we add the account providers widget */
|
2022-04-24 10:24:55 +00:00
|
|
|
GtkWindow *account_window;
|
|
|
|
GtkWidget *current_account_widget;
|
2021-05-11 16:18:35 +00:00
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
/* models */
|
|
|
|
GtkFilter *account_provider_filter;
|
|
|
|
GtkFilter *account_filter;
|
|
|
|
GListModel *providers;
|
|
|
|
GListModel *accounts;
|
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
/* misc */
|
2022-11-13 10:03:40 +00:00
|
|
|
GtkEventController *key_controller;
|
|
|
|
GtkEventController *key_controller_account;
|
2022-04-24 10:24:55 +00:00
|
|
|
CallsAccountOverviewState state;
|
2024-01-08 19:46:14 +00:00
|
|
|
AdwToastOverlay *toast_overlay;
|
2021-05-11 16:18:35 +00:00
|
|
|
};
|
|
|
|
|
2023-12-13 20:56:46 +00:00
|
|
|
G_DEFINE_TYPE (CallsAccountOverview, calls_account_overview, ADW_TYPE_WINDOW)
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_visibility (CallsAccountOverview *self)
|
|
|
|
{
|
|
|
|
g_assert (CALLS_IS_ACCOUNT_OVERVIEW (self));
|
|
|
|
|
|
|
|
switch (self->state) {
|
|
|
|
case SHOW_INTRO:
|
|
|
|
gtk_stack_set_visible_child (self->stack, self->intro);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOW_OVERVIEW:
|
|
|
|
gtk_stack_set_visible_child (self->stack, self->overview);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_warn_if_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_state (CallsAccountOverview *self)
|
|
|
|
{
|
|
|
|
guint n_origins = 0;
|
2023-05-15 08:08:55 +00:00
|
|
|
guint n_providers;
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
g_assert (CALLS_IS_ACCOUNT_OVERVIEW (self));
|
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
n_providers = g_list_model_get_n_items (self->providers);
|
|
|
|
|
|
|
|
for (guint i = 0; i < n_providers; i++) {
|
|
|
|
g_autoptr (CallsProvider) provider = g_list_model_get_item (self->providers, i);
|
|
|
|
GListModel *origins;
|
|
|
|
|
|
|
|
/* we might be in the middle of the lists being updated! */
|
|
|
|
if (!provider) {
|
|
|
|
n_providers--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
origins = calls_provider_get_origins (provider);
|
2021-05-11 16:18:35 +00:00
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
n_origins += g_list_model_get_n_items (origins);
|
2021-05-11 16:18:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (n_origins > 0)
|
|
|
|
self->state = SHOW_OVERVIEW;
|
|
|
|
else
|
|
|
|
self->state = SHOW_INTRO;
|
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
gtk_widget_set_sensitive (self->add_btn, n_providers > 0);
|
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
update_visibility (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
attach_account_widget (CallsAccountOverview *self,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
g_assert (CALLS_IS_ACCOUNT_OVERVIEW (self));
|
|
|
|
g_assert (!widget || GTK_IS_WIDGET (widget));
|
|
|
|
|
|
|
|
if (widget == self->current_account_widget)
|
|
|
|
return;
|
|
|
|
|
2023-12-18 07:37:51 +00:00
|
|
|
adw_window_set_content (ADW_WINDOW (self->account_window), widget);
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
self->current_account_widget = widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2022-05-21 16:05:13 +00:00
|
|
|
on_account_row_activated (GtkListBox *box,
|
|
|
|
GtkListBoxRow *row,
|
|
|
|
CallsAccountOverview *self)
|
2021-05-11 16:18:35 +00:00
|
|
|
{
|
2023-05-15 08:08:55 +00:00
|
|
|
CallsAccountProvider *provider;
|
2022-05-21 16:05:13 +00:00
|
|
|
CallsAccount *account = NULL;
|
|
|
|
CallsAccountRow *acc_row;
|
2021-05-11 16:18:35 +00:00
|
|
|
GtkWidget *widget;
|
|
|
|
|
2022-05-21 16:05:13 +00:00
|
|
|
g_assert (GTK_IS_LIST_BOX_ROW (row) );
|
|
|
|
g_assert (CALLS_IS_ACCOUNT_OVERVIEW (self));
|
2023-05-15 08:08:55 +00:00
|
|
|
g_assert (g_list_model_get_n_items (self->providers) > 0);
|
2022-05-21 16:05:13 +00:00
|
|
|
|
|
|
|
if (row == self->add_row) {
|
|
|
|
/* TODO this needs changing if we ever have multiple account providers */
|
2023-05-15 08:08:55 +00:00
|
|
|
provider = g_list_model_get_item (self->providers, 0);
|
2022-05-21 16:05:13 +00:00
|
|
|
widget = calls_account_provider_get_account_widget (provider);
|
2023-05-15 08:08:55 +00:00
|
|
|
g_object_unref (provider);
|
2022-05-21 16:05:13 +00:00
|
|
|
|
|
|
|
} else if (CALLS_IS_ACCOUNT_ROW (row)) {
|
|
|
|
acc_row = CALLS_ACCOUNT_ROW (row);
|
|
|
|
|
|
|
|
provider = calls_account_row_get_account_provider (acc_row);
|
|
|
|
widget = calls_account_provider_get_account_widget (provider);
|
|
|
|
account = calls_account_row_get_account (acc_row);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
g_warning ("Unknown type of row activated!");
|
|
|
|
g_assert_not_reached ();
|
|
|
|
return;
|
|
|
|
}
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
attach_account_widget (self, widget);
|
|
|
|
|
2022-11-13 10:15:03 +00:00
|
|
|
if (account) {
|
|
|
|
g_autofree char *title = g_strdup_printf (_("Edit account: %s"),
|
|
|
|
calls_account_get_address (account));
|
|
|
|
|
2022-05-21 16:05:13 +00:00
|
|
|
calls_account_provider_edit_account (provider, account);
|
2022-11-13 10:15:03 +00:00
|
|
|
gtk_window_set_title (self->account_window, title);
|
|
|
|
} else {
|
2022-05-21 16:05:13 +00:00
|
|
|
calls_account_provider_add_new_account (provider);
|
2022-11-13 10:15:03 +00:00
|
|
|
gtk_window_set_title (self->account_window, _("Add new account"));
|
|
|
|
|
|
|
|
}
|
2021-05-11 16:18:35 +00:00
|
|
|
|
|
|
|
gtk_window_present (self->account_window);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-05 08:01:26 +00:00
|
|
|
static void
|
2022-05-21 16:05:13 +00:00
|
|
|
on_add_account_clicked (CallsAccountOverview *self)
|
2021-07-05 08:01:26 +00:00
|
|
|
{
|
2022-05-21 16:05:13 +00:00
|
|
|
on_account_row_activated (NULL, self->add_row, self);
|
2021-07-05 08:01:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-15 13:06:03 +00:00
|
|
|
static void
|
|
|
|
on_account_message (CallsAccount *account,
|
|
|
|
const char *message,
|
|
|
|
GtkMessageType message_type,
|
|
|
|
CallsAccountOverview *self)
|
|
|
|
{
|
|
|
|
g_autofree char* notification = NULL;
|
|
|
|
|
|
|
|
g_assert (CALLS_IS_ACCOUNT (account));
|
|
|
|
g_assert (CALLS_IS_ACCOUNT_OVERVIEW (self));
|
|
|
|
|
|
|
|
notification = g_strdup_printf ("%s: %s",
|
|
|
|
calls_account_get_address (account),
|
|
|
|
message);
|
2024-01-08 19:46:14 +00:00
|
|
|
calls_in_app_notification_show (self->toast_overlay, notification);
|
2021-12-15 13:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-05 08:01:26 +00:00
|
|
|
static void
|
2023-05-15 08:08:55 +00:00
|
|
|
on_accounts_changed (GListModel *accounts,
|
|
|
|
guint position,
|
|
|
|
guint removed,
|
|
|
|
guint added,
|
|
|
|
CallsAccountOverview *self)
|
2021-07-05 08:01:26 +00:00
|
|
|
{
|
2023-05-15 08:08:55 +00:00
|
|
|
guint n_providers = g_list_model_get_n_items (self->providers);
|
2021-07-05 08:01:26 +00:00
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
for (guint i = removed; i > 0; i--) {
|
|
|
|
GtkListBoxRow *row =
|
|
|
|
gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->overview), position + i - 1);
|
2021-07-05 08:01:26 +00:00
|
|
|
|
2023-12-16 00:55:00 +00:00
|
|
|
gtk_list_box_remove (GTK_LIST_BOX (self->overview), GTK_WIDGET (row));
|
2021-07-05 08:01:26 +00:00
|
|
|
}
|
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
for (guint i = 0; i < added; i++) {
|
|
|
|
g_autoptr (CallsAccount) account =
|
|
|
|
CALLS_ACCOUNT (g_list_model_get_item (accounts, position + i));
|
|
|
|
CallsAccountProvider *provider = NULL;
|
|
|
|
CallsAccountRow *account_row;
|
2021-07-05 08:01:26 +00:00
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
/* which provider does this account belong to? */
|
|
|
|
for (guint j = 0; j < n_providers; j++) {
|
|
|
|
g_autoptr (CallsProvider) candidate = g_list_model_get_item (self->providers, j);
|
2021-07-05 08:01:26 +00:00
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
if (calls_find_in_model (calls_provider_get_origins (candidate), account, NULL)) {
|
|
|
|
provider = CALLS_ACCOUNT_PROVIDER (candidate);
|
|
|
|
break;
|
|
|
|
}
|
2021-07-05 08:01:26 +00:00
|
|
|
}
|
2023-05-15 08:08:55 +00:00
|
|
|
|
|
|
|
g_assert (CALLS_IS_ACCOUNT_PROVIDER (provider));
|
|
|
|
|
|
|
|
account_row = calls_account_row_new (provider, account);
|
|
|
|
|
|
|
|
g_signal_connect_object (account, "message",
|
|
|
|
G_CALLBACK (on_account_message),
|
|
|
|
self,
|
|
|
|
0);
|
|
|
|
gtk_list_box_insert (GTK_LIST_BOX (self->overview),
|
|
|
|
GTK_WIDGET (account_row),
|
|
|
|
position + i);
|
2021-07-05 08:01:26 +00:00
|
|
|
}
|
2023-05-15 08:08:55 +00:00
|
|
|
|
2021-07-05 08:01:26 +00:00
|
|
|
update_state (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-12-14 00:05:27 +00:00
|
|
|
/*
|
|
|
|
* Helper for `on_providers_changed` signal callback
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
hide_widget (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
gtk_widget_set_visible (widget, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-05 08:01:26 +00:00
|
|
|
static void
|
2023-05-15 08:08:55 +00:00
|
|
|
on_providers_changed (GListModel *providers,
|
|
|
|
guint position,
|
|
|
|
guint removed,
|
|
|
|
guint added,
|
|
|
|
CallsAccountOverview *self)
|
2021-07-05 08:01:26 +00:00
|
|
|
{
|
2023-05-15 08:08:55 +00:00
|
|
|
for (guint i = 0; i < added; i++) {
|
|
|
|
g_autoptr (CallsProvider) provider =
|
|
|
|
g_list_model_get_item (providers, position + i);
|
|
|
|
|
|
|
|
g_signal_connect_swapped (provider, "widget-edit-done",
|
2023-12-14 00:05:27 +00:00
|
|
|
G_CALLBACK (hide_widget), self->account_window);
|
2021-07-05 08:01:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear any acccount widgets, because they might've gone stale */
|
|
|
|
attach_account_widget (self, NULL);
|
2023-12-14 00:05:27 +00:00
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->account_window), FALSE);
|
2021-07-05 08:01:26 +00:00
|
|
|
}
|
|
|
|
|
2022-11-13 10:03:40 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
on_key_pressed (GtkEventControllerKey *controller,
|
|
|
|
guint keyval,
|
|
|
|
guint keycode,
|
|
|
|
GdkModifierType modifiers,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
if (keyval == GDK_KEY_Escape) {
|
2023-12-14 00:05:27 +00:00
|
|
|
gtk_widget_set_visible (widget, FALSE);
|
2022-11-13 10:03:40 +00:00
|
|
|
return GDK_EVENT_STOP;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
calls_account_overview_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
CallsAccountOverview *self = CALLS_ACCOUNT_OVERVIEW (object);
|
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
g_clear_object (&self->providers);
|
|
|
|
g_clear_object (&self->account_provider_filter);
|
|
|
|
|
|
|
|
g_clear_object (&self->accounts);
|
|
|
|
g_clear_object (&self->account_filter);
|
|
|
|
|
2022-11-13 10:03:40 +00:00
|
|
|
g_clear_object (&self->key_controller);
|
|
|
|
g_clear_object (&self->key_controller_account);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (calls_account_overview_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
static void
|
|
|
|
calls_account_overview_class_init (CallsAccountOverviewClass *klass)
|
|
|
|
{
|
2022-11-13 10:03:40 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2021-05-11 16:18:35 +00:00
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
|
2022-11-13 10:03:40 +00:00
|
|
|
object_class->dispose = calls_account_overview_dispose;
|
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Calls/ui/account-overview.ui");
|
|
|
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CallsAccountOverview, add_btn);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CallsAccountOverview, add_row);
|
|
|
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CallsAccountOverview, stack);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CallsAccountOverview, intro);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CallsAccountOverview, overview);
|
|
|
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CallsAccountOverview, account_window);
|
|
|
|
|
2024-01-08 19:46:14 +00:00
|
|
|
gtk_widget_class_bind_template_child (widget_class, CallsAccountOverview, toast_overlay);
|
2021-12-15 13:06:03 +00:00
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_add_account_clicked);
|
2022-05-21 16:05:13 +00:00
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_account_row_activated);
|
2021-05-11 16:18:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-15 08:08:55 +00:00
|
|
|
static gboolean
|
|
|
|
match_account_provider (gpointer item,
|
|
|
|
gpointer unused)
|
|
|
|
{
|
|
|
|
g_assert (CALLS_IS_PROVIDER (item));
|
|
|
|
|
|
|
|
return CALLS_IS_ACCOUNT_PROVIDER (item);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
match_account (gpointer item,
|
|
|
|
gpointer unused)
|
|
|
|
{
|
|
|
|
g_assert (CALLS_IS_ORIGIN (item));
|
|
|
|
|
|
|
|
return CALLS_IS_ACCOUNT (item);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
static void
|
|
|
|
calls_account_overview_init (CallsAccountOverview *self)
|
|
|
|
{
|
2023-05-15 08:08:55 +00:00
|
|
|
GListModel *all_providers =
|
|
|
|
calls_plugin_manager_get_providers (calls_plugin_manager_get_default ());
|
|
|
|
GListModel *all_origins =
|
|
|
|
calls_manager_get_origins (calls_manager_get_default ());
|
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
|
|
|
2023-12-13 19:20:35 +00:00
|
|
|
self->account_provider_filter = GTK_FILTER (gtk_custom_filter_new (match_account_provider, NULL, NULL));
|
2023-05-15 08:08:55 +00:00
|
|
|
self->providers =
|
|
|
|
G_LIST_MODEL (gtk_filter_list_model_new (all_providers,
|
|
|
|
self->account_provider_filter));
|
|
|
|
|
|
|
|
g_signal_connect (self->providers,
|
|
|
|
"items-changed",
|
|
|
|
G_CALLBACK (on_providers_changed),
|
|
|
|
self);
|
|
|
|
on_providers_changed (self->providers,
|
|
|
|
0, 0, g_list_model_get_n_items (self->providers),
|
|
|
|
self);
|
|
|
|
|
2023-12-13 19:20:35 +00:00
|
|
|
self->account_filter = GTK_FILTER (gtk_custom_filter_new (match_account, NULL, NULL));
|
2023-05-15 08:08:55 +00:00
|
|
|
self->accounts =
|
|
|
|
G_LIST_MODEL (gtk_filter_list_model_new (all_origins,
|
|
|
|
self->account_filter));
|
|
|
|
g_signal_connect_object (self->accounts,
|
|
|
|
"items-changed",
|
|
|
|
G_CALLBACK (on_accounts_changed),
|
|
|
|
self,
|
|
|
|
G_CONNECT_AFTER);
|
|
|
|
on_accounts_changed (self->accounts, 0, 0, g_list_model_get_n_items (self->accounts), self);
|
2021-07-05 08:01:26 +00:00
|
|
|
|
2021-05-11 16:18:35 +00:00
|
|
|
gtk_list_box_insert (GTK_LIST_BOX (self->overview),
|
|
|
|
GTK_WIDGET (self->add_row),
|
|
|
|
-1);
|
|
|
|
gtk_window_set_transient_for (self->account_window, GTK_WINDOW (self));
|
|
|
|
|
2023-12-16 01:09:00 +00:00
|
|
|
self->key_controller = gtk_event_controller_key_new ();
|
2022-11-13 10:03:40 +00:00
|
|
|
g_signal_connect (self->key_controller,
|
|
|
|
"key-pressed",
|
|
|
|
G_CALLBACK (on_key_pressed),
|
|
|
|
self);
|
|
|
|
|
2023-12-16 01:09:00 +00:00
|
|
|
self->key_controller_account = gtk_event_controller_key_new ();
|
2022-11-13 10:03:40 +00:00
|
|
|
g_signal_connect (self->key_controller_account,
|
|
|
|
"key-pressed",
|
|
|
|
G_CALLBACK (on_key_pressed),
|
|
|
|
self->account_window);
|
2022-11-13 10:15:03 +00:00
|
|
|
|
2023-12-18 01:58:24 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (self), _("VoIP Accounts"));
|
2021-05-11 16:18:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CallsAccountOverview *
|
|
|
|
calls_account_overview_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (CALLS_TYPE_ACCOUNT_OVERVIEW,
|
|
|
|
NULL);
|
|
|
|
}
|