2018-08-03 14:22:12 +00:00
|
|
|
/*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author: Bob Ham <bob.ham@puri.sm>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-06-18 09:10:36 +00:00
|
|
|
#define G_LOG_DOMAIN "CallsMMProvider"
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
#include "calls-mm-provider.h"
|
|
|
|
#include "calls-provider.h"
|
|
|
|
#include "calls-mm-origin.h"
|
|
|
|
#include "calls-message-source.h"
|
|
|
|
#include "calls-origin.h"
|
|
|
|
|
|
|
|
#include <libmm-glib.h>
|
2018-11-23 14:34:41 +00:00
|
|
|
#include <libpeas/peas.h>
|
2018-08-03 14:22:12 +00:00
|
|
|
#include <glib/gi18n.h>
|
|
|
|
|
2021-04-19 17:07:00 +00:00
|
|
|
static const char * const supported_protocols[] = {
|
|
|
|
"tel",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
struct _CallsMMProvider {
|
2021-01-25 15:32:14 +00:00
|
|
|
CallsProvider parent_instance;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
/* The status property */
|
2022-04-24 10:24:55 +00:00
|
|
|
gchar *status;
|
2018-10-19 10:19:41 +00:00
|
|
|
/** ID for the D-Bus watch */
|
2022-04-24 10:24:55 +00:00
|
|
|
guint watch_id;
|
2018-08-03 14:22:12 +00:00
|
|
|
/** ModemManager object proxy */
|
2022-04-24 10:24:55 +00:00
|
|
|
MMManager *mm;
|
2021-02-15 05:34:34 +00:00
|
|
|
/* A list of CallsOrigins */
|
2022-04-24 10:24:55 +00:00
|
|
|
GListStore *origins;
|
2022-09-03 09:06:59 +00:00
|
|
|
|
|
|
|
GCancellable *cancellable;
|
2018-08-03 14:22:12 +00:00
|
|
|
};
|
|
|
|
|
2021-01-25 15:32:14 +00:00
|
|
|
static void calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2018-11-23 14:34:41 +00:00
|
|
|
G_DEFINE_DYNAMIC_TYPE_EXTENDED
|
2022-04-24 10:24:55 +00:00
|
|
|
(CallsMMProvider, calls_mm_provider, CALLS_TYPE_PROVIDER, 0,
|
|
|
|
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
|
|
|
|
calls_mm_provider_message_source_interface_init))
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
static void
|
|
|
|
set_status (CallsMMProvider *self,
|
|
|
|
const gchar *new_status)
|
|
|
|
{
|
|
|
|
if (strcmp (self->status, new_status) == 0)
|
2022-04-24 10:24:55 +00:00
|
|
|
return;
|
2018-10-19 10:19:41 +00:00
|
|
|
|
|
|
|
g_free (self->status);
|
|
|
|
self->status = g_strdup (new_status);
|
|
|
|
g_object_notify (G_OBJECT (self), "status");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_status (CallsMMProvider *self)
|
|
|
|
{
|
|
|
|
const gchar *s;
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
if (!self->mm) {
|
|
|
|
s = _("ModemManager unavailable");
|
|
|
|
} else if (g_list_model_get_n_items (G_LIST_MODEL (self->origins)) == 0) {
|
|
|
|
s = _("No voice-capable modem available");
|
|
|
|
} else {
|
|
|
|
s = _("Normal");
|
|
|
|
}
|
2018-10-19 10:19:41 +00:00
|
|
|
|
|
|
|
set_status (self, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-02 17:42:25 +00:00
|
|
|
static gboolean
|
2021-02-15 05:34:34 +00:00
|
|
|
mm_provider_contains (CallsMMProvider *self,
|
|
|
|
MMObject *mm_obj)
|
|
|
|
{
|
|
|
|
GListModel *model;
|
|
|
|
guint n_items;
|
|
|
|
|
|
|
|
g_assert (CALLS_IS_MM_PROVIDER (self));
|
|
|
|
g_assert (MM_OBJECT (mm_obj));
|
|
|
|
|
|
|
|
model = G_LIST_MODEL (self->origins);
|
|
|
|
n_items = g_list_model_get_n_items (model);
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
for (guint i = 0; i < n_items; i++) {
|
|
|
|
g_autoptr (CallsMMOrigin) origin = NULL;
|
2021-02-15 05:34:34 +00:00
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
origin = g_list_model_get_item (model, i);
|
2021-02-15 05:34:34 +00:00
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
if (calls_mm_origin_matches (origin, mm_obj))
|
|
|
|
return TRUE;
|
|
|
|
}
|
2021-02-15 05:34:34 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
static void
|
|
|
|
add_origin (CallsMMProvider *self,
|
|
|
|
GDBusObject *object)
|
|
|
|
{
|
|
|
|
MMObject *mm_obj;
|
2022-04-24 10:24:55 +00:00
|
|
|
|
2021-03-23 08:48:21 +00:00
|
|
|
g_autoptr (CallsMMOrigin) origin = NULL;
|
2022-01-27 14:28:35 +00:00
|
|
|
g_autoptr (MMModem3gpp) modem_3gpp = NULL;
|
2018-10-19 10:19:41 +00:00
|
|
|
const gchar *path;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
mm_obj = MM_OBJECT (object);
|
2018-10-19 10:19:41 +00:00
|
|
|
path = g_dbus_object_get_object_path (object);
|
2022-04-24 10:24:55 +00:00
|
|
|
if (mm_provider_contains (self, mm_obj)) {
|
|
|
|
g_warning ("New voice interface on existing"
|
|
|
|
" origin with path `%s'", path);
|
|
|
|
return;
|
|
|
|
}
|
2018-10-19 10:19:41 +00:00
|
|
|
|
|
|
|
g_debug ("Adding new voice-capable modem `%s'",
|
|
|
|
path);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
g_assert (MM_IS_OBJECT (object));
|
|
|
|
|
2022-01-27 14:28:35 +00:00
|
|
|
modem_3gpp = mm_object_get_modem_3gpp (mm_obj);
|
|
|
|
|
|
|
|
origin = calls_mm_origin_new (mm_obj,
|
|
|
|
mm_modem_3gpp_get_imei (modem_3gpp));
|
2021-02-15 05:34:34 +00:00
|
|
|
g_list_store_append (self->origins, origin);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
update_status (self);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
interface_added_cb (CallsMMProvider *self,
|
|
|
|
GDBusObject *object,
|
|
|
|
GDBusInterface *interface)
|
|
|
|
{
|
|
|
|
GDBusInterfaceInfo *info;
|
|
|
|
|
|
|
|
info = g_dbus_interface_get_info (interface);
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
g_debug ("ModemManager interface `%s' found on object `%s'",
|
|
|
|
info->name,
|
|
|
|
g_dbus_object_get_object_path (object));
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
if (g_strcmp0 (info->name,
|
2022-04-24 10:24:55 +00:00
|
|
|
"org.freedesktop.ModemManager1.Modem.Voice") == 0) {
|
|
|
|
add_origin (self, object);
|
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-19 10:19:41 +00:00
|
|
|
remove_modem_object (CallsMMProvider *self,
|
|
|
|
const gchar *path,
|
|
|
|
GDBusObject *object)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
2021-02-15 05:34:34 +00:00
|
|
|
GListModel *model;
|
|
|
|
guint n_items;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
model = G_LIST_MODEL (self->origins);
|
|
|
|
n_items = g_list_model_get_n_items (model);
|
2018-10-19 10:19:41 +00:00
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
for (guint i = 0; i < n_items; i++) {
|
|
|
|
g_autoptr (CallsMMOrigin) origin = NULL;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
origin = g_list_model_get_item (model, i);
|
2020-03-23 14:31:23 +00:00
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
if (calls_mm_origin_matches (origin, MM_OBJECT (object))) {
|
|
|
|
g_list_store_remove (self->origins, i);
|
|
|
|
update_status (self);
|
2018-10-19 10:19:41 +00:00
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2021-02-15 05:34:34 +00:00
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
interface_removed_cb (CallsMMProvider *self,
|
|
|
|
GDBusObject *object,
|
|
|
|
GDBusInterface *interface)
|
|
|
|
{
|
2018-10-19 10:19:41 +00:00
|
|
|
const gchar *path;
|
2018-08-03 14:22:12 +00:00
|
|
|
GDBusInterfaceInfo *info;
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
path = g_dbus_object_get_object_path (object);
|
2018-08-03 14:22:12 +00:00
|
|
|
info = g_dbus_interface_get_info (interface);
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
g_debug ("ModemManager interface `%s' removed on object `%s'",
|
|
|
|
info->name, path);
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
if (g_strcmp0 (info->name,
|
2022-04-24 10:24:55 +00:00
|
|
|
"org.freedesktop.ModemManager1.Modem.Voice") == 0) {
|
|
|
|
remove_modem_object (self, path, object);
|
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_mm_object (CallsMMProvider *self, GDBusObject *object)
|
|
|
|
{
|
|
|
|
GList *ifaces, *node;
|
|
|
|
|
|
|
|
ifaces = g_dbus_object_get_interfaces (object);
|
2022-04-24 10:24:55 +00:00
|
|
|
for (node = ifaces; node; node = node->next) {
|
|
|
|
interface_added_cb (self, object,
|
|
|
|
G_DBUS_INTERFACE (node->data));
|
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
g_list_free_full (ifaces, g_object_unref);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_mm_objects (CallsMMProvider *self)
|
|
|
|
{
|
|
|
|
GList *objects, *node;
|
|
|
|
|
|
|
|
objects = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (self->mm));
|
2022-04-24 10:24:55 +00:00
|
|
|
for (node = objects; node; node = node->next) {
|
|
|
|
add_mm_object (self, G_DBUS_OBJECT (node->data));
|
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
g_list_free_full (objects, g_object_unref);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-02 17:42:25 +00:00
|
|
|
static void
|
2018-10-19 10:19:41 +00:00
|
|
|
object_added_cb (CallsMMProvider *self,
|
|
|
|
GDBusObject *object)
|
|
|
|
{
|
|
|
|
g_debug ("ModemManager object `%s' added",
|
|
|
|
g_dbus_object_get_object_path (object));
|
|
|
|
|
|
|
|
add_mm_object (self, object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-02 17:42:25 +00:00
|
|
|
static void
|
2018-10-19 10:19:41 +00:00
|
|
|
object_removed_cb (CallsMMProvider *self,
|
|
|
|
GDBusObject *object)
|
|
|
|
{
|
|
|
|
const gchar *path;
|
|
|
|
|
|
|
|
path = g_dbus_object_get_object_path (object);
|
|
|
|
g_debug ("ModemManager object `%s' removed", path);
|
|
|
|
|
|
|
|
remove_modem_object (self, path, object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
static void
|
|
|
|
mm_manager_new_cb (GDBusConnection *connection,
|
2022-04-24 10:24:55 +00:00
|
|
|
GAsyncResult *res,
|
2018-08-03 14:22:12 +00:00
|
|
|
CallsMMProvider *self)
|
|
|
|
{
|
2022-09-02 10:08:45 +00:00
|
|
|
g_autoptr (GError) error = NULL;
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
self->mm = mm_manager_new_finish (res, &error);
|
2022-04-24 10:24:55 +00:00
|
|
|
if (!self->mm) {
|
2023-05-01 07:35:10 +00:00
|
|
|
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
|
|
g_warning ("Error creating ModemManager Manager: %s",
|
|
|
|
error->message);
|
|
|
|
|
2022-09-02 10:20:47 +00:00
|
|
|
update_status (self);
|
|
|
|
return;
|
2022-04-24 10:24:55 +00:00
|
|
|
}
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
g_signal_connect_swapped (G_DBUS_OBJECT_MANAGER (self->mm),
|
|
|
|
"interface-added",
|
2018-08-03 14:22:12 +00:00
|
|
|
G_CALLBACK (interface_added_cb), self);
|
2018-10-19 10:19:41 +00:00
|
|
|
g_signal_connect_swapped (G_DBUS_OBJECT_MANAGER (self->mm),
|
|
|
|
"interface-removed",
|
2018-08-03 14:22:12 +00:00
|
|
|
G_CALLBACK (interface_removed_cb), self);
|
2018-10-19 10:19:41 +00:00
|
|
|
g_signal_connect_swapped (G_DBUS_OBJECT_MANAGER (self->mm),
|
|
|
|
"object-added",
|
|
|
|
G_CALLBACK (object_added_cb), self);
|
|
|
|
g_signal_connect_swapped (G_DBUS_OBJECT_MANAGER (self->mm),
|
|
|
|
"object-removed",
|
|
|
|
G_CALLBACK (object_removed_cb), self);
|
|
|
|
|
|
|
|
update_status (self);
|
2018-08-03 14:22:12 +00:00
|
|
|
add_mm_objects (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-19 10:19:41 +00:00
|
|
|
mm_appeared_cb (GDBusConnection *connection,
|
2022-04-24 10:24:55 +00:00
|
|
|
const gchar *name,
|
|
|
|
const gchar *name_owner,
|
2018-10-19 10:19:41 +00:00
|
|
|
CallsMMProvider *self)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
2018-10-19 10:19:41 +00:00
|
|
|
g_debug ("ModemManager appeared on D-Bus");
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2022-09-03 09:06:59 +00:00
|
|
|
g_cancellable_cancel (self->cancellable);
|
|
|
|
g_clear_object (&self->cancellable);
|
|
|
|
self->cancellable = g_cancellable_new ();
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
mm_manager_new (connection,
|
2018-08-03 14:22:12 +00:00
|
|
|
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
|
2022-09-03 09:06:59 +00:00
|
|
|
self->cancellable,
|
2018-08-03 14:22:12 +00:00
|
|
|
(GAsyncReadyCallback) mm_manager_new_cb,
|
|
|
|
self);
|
2018-10-19 10:19:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-02 17:42:25 +00:00
|
|
|
static void
|
2018-10-19 10:19:41 +00:00
|
|
|
mm_vanished_cb (GDBusConnection *connection,
|
2022-04-24 10:24:55 +00:00
|
|
|
const gchar *name,
|
2018-10-19 10:19:41 +00:00
|
|
|
CallsMMProvider *self)
|
|
|
|
{
|
|
|
|
g_debug ("ModemManager vanished from D-Bus");
|
2022-09-03 09:03:39 +00:00
|
|
|
|
|
|
|
g_clear_object (&self->mm);
|
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
g_list_store_remove_all (self->origins);
|
2018-10-19 10:19:41 +00:00
|
|
|
update_status (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-25 15:32:14 +00:00
|
|
|
static const char *
|
|
|
|
calls_mm_provider_get_name (CallsProvider *provider)
|
|
|
|
{
|
|
|
|
return "ModemManager";
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
calls_mm_provider_get_status (CallsProvider *provider)
|
|
|
|
{
|
|
|
|
CallsMMProvider *self = CALLS_MM_PROVIDER (provider);
|
|
|
|
|
|
|
|
return self->status;
|
|
|
|
}
|
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
static GListModel *
|
2021-01-25 15:32:14 +00:00
|
|
|
calls_mm_provider_get_origins (CallsProvider *provider)
|
|
|
|
{
|
|
|
|
CallsMMProvider *self = CALLS_MM_PROVIDER (provider);
|
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
return G_LIST_MODEL (self->origins);
|
2021-01-25 15:32:14 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 10:24:55 +00:00
|
|
|
static const char *const *
|
2021-04-19 17:07:00 +00:00
|
|
|
calls_mm_provider_get_protocols (CallsProvider *provider)
|
|
|
|
{
|
|
|
|
return supported_protocols;
|
|
|
|
}
|
|
|
|
|
2021-05-04 19:49:07 +00:00
|
|
|
static gboolean
|
|
|
|
calls_mm_provider_is_modem (CallsProvider *provider)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
static void
|
|
|
|
constructed (GObject *object)
|
|
|
|
{
|
|
|
|
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
|
|
|
|
2022-12-21 18:13:21 +00:00
|
|
|
G_OBJECT_CLASS (calls_mm_provider_parent_class)->constructed (object);
|
|
|
|
|
2018-10-19 10:19:41 +00:00
|
|
|
self->watch_id =
|
|
|
|
g_bus_watch_name (G_BUS_TYPE_SYSTEM,
|
|
|
|
MM_DBUS_SERVICE,
|
|
|
|
G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
|
2022-04-24 10:24:55 +00:00
|
|
|
(GBusNameAppearedCallback) mm_appeared_cb,
|
|
|
|
(GBusNameVanishedCallback) mm_vanished_cb,
|
2018-10-19 10:19:41 +00:00
|
|
|
self, NULL);
|
|
|
|
|
|
|
|
g_debug ("Watching for ModemManager");
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dispose (GObject *object)
|
|
|
|
{
|
|
|
|
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
|
|
|
|
2022-09-03 09:06:59 +00:00
|
|
|
g_cancellable_cancel (self->cancellable);
|
|
|
|
g_clear_object (&self->cancellable);
|
|
|
|
|
2022-09-03 09:03:39 +00:00
|
|
|
g_clear_object (&self->mm);
|
|
|
|
|
2022-09-03 08:51:57 +00:00
|
|
|
g_clear_handle_id (&self->watch_id, g_bus_unwatch_name);
|
2018-10-19 10:19:41 +00:00
|
|
|
|
2021-02-15 05:34:34 +00:00
|
|
|
g_list_store_remove_all (self->origins);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2020-02-18 15:01:22 +00:00
|
|
|
G_OBJECT_CLASS (calls_mm_provider_parent_class)->dispose (object);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
finalize (GObject *object)
|
|
|
|
{
|
|
|
|
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
|
|
|
|
2022-09-03 08:51:57 +00:00
|
|
|
g_clear_object (&self->origins);
|
|
|
|
g_clear_pointer (&self->status, g_free);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
2020-02-18 15:01:22 +00:00
|
|
|
G_OBJECT_CLASS (calls_mm_provider_parent_class)->finalize (object);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
calls_mm_provider_class_init (CallsMMProviderClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2021-01-25 15:32:14 +00:00
|
|
|
CallsProviderClass *provider_class = CALLS_PROVIDER_CLASS (klass);
|
2018-08-03 14:22:12 +00:00
|
|
|
|
|
|
|
object_class->constructed = constructed;
|
|
|
|
object_class->dispose = dispose;
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
2021-01-25 15:32:14 +00:00
|
|
|
provider_class->get_name = calls_mm_provider_get_name;
|
|
|
|
provider_class->get_status = calls_mm_provider_get_status;
|
|
|
|
provider_class->get_origins = calls_mm_provider_get_origins;
|
2021-04-19 17:07:00 +00:00
|
|
|
provider_class->get_protocols = calls_mm_provider_get_protocols;
|
2021-05-04 19:49:07 +00:00
|
|
|
provider_class->is_modem = calls_mm_provider_is_modem;
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-23 14:34:41 +00:00
|
|
|
static void
|
|
|
|
calls_mm_provider_class_finalize (CallsMMProviderClass *klass)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-08-03 14:22:12 +00:00
|
|
|
static void
|
2021-01-25 15:32:14 +00:00
|
|
|
calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
calls_mm_provider_init (CallsMMProvider *self)
|
|
|
|
{
|
2022-03-19 22:15:12 +00:00
|
|
|
self->status = g_strdup (_("Initialized"));
|
2021-05-13 16:19:21 +00:00
|
|
|
self->origins = g_list_store_new (CALLS_TYPE_ORIGIN);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-23 14:34:41 +00:00
|
|
|
G_MODULE_EXPORT void
|
|
|
|
peas_register_types (PeasObjectModule *module)
|
2018-08-03 14:22:12 +00:00
|
|
|
{
|
2018-11-23 14:34:41 +00:00
|
|
|
calls_mm_provider_register_type (G_TYPE_MODULE (module));
|
|
|
|
|
|
|
|
peas_object_module_register_extension_type (module,
|
|
|
|
CALLS_TYPE_PROVIDER,
|
|
|
|
CALLS_TYPE_MM_PROVIDER);
|
2018-08-03 14:22:12 +00:00
|
|
|
}
|