Fix modem addition/removal and deal with ModemManager appearing/vanishing

Modems being added or removed were not working.  To fix this, we pay
attention to the "object-removed" event and not just
"interface-removed".

Also, to deal with ModemManager appearing and vanishing, we add a
GDBus watch on ModemManager's D-Bus object.

Finally, we provide appropriate UI feedback when it's not possible to
make a call.

Closes #15
Closes #16
This commit is contained in:
Bob Ham
2018-10-19 10:19:41 +00:00
parent 39ae9d6d76
commit c203f470fe
8 changed files with 304 additions and 79 deletions

View File

@@ -27,6 +27,8 @@
#include "calls-message-source.h"
#include "util.h"
#include <glib/gi18n.h>
/**
* SECTION:calls-provider
* @short_description: An abstraction of call providers, such as
@@ -43,6 +45,14 @@
G_DEFINE_INTERFACE (CallsProvider, calls_provider, CALLS_TYPE_MESSAGE_SOURCE);
enum {
PROP_0,
PROP_STATUS,
PROP_LAST_PROP,
};
static GParamSpec *props[PROP_LAST_PROP];
enum {
SIGNAL_ORIGIN_ADDED,
SIGNAL_ORIGIN_REMOVED,
@@ -55,6 +65,15 @@ calls_provider_default_init (CallsProviderInterface *iface)
{
GType arg_types = CALLS_TYPE_ORIGIN;
props[PROP_STATUS] =
g_param_spec_string ("status",
_("Status"),
_("A text string describing the status for display to the user"),
"",
G_PARAM_READABLE);
g_object_interface_install_property (iface, props[PROP_STATUS]);
signals[SIGNAL_ORIGIN_ADDED] =
g_signal_newv ("origin-added",
G_TYPE_FROM_INTERFACE (iface),
@@ -86,6 +105,21 @@ calls_provider_default_init (CallsProviderInterface *iface)
*/
DEFINE_PROVIDER_FUNC(get_name, const gchar *, NULL);
gchar *
calls_provider_get_status (CallsProvider *self)
{
gchar *status;
g_return_val_if_fail (CALLS_IS_PROVIDER (self), NULL);
g_object_get (G_OBJECT (self),
"status", &status,
NULL);
return status;
}
/**
* calls_provider_get_origins:
* @self: a #CallsProvider