1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-14 00:17:35 +00:00

manager: Remove the "error" signal and adapt to changes

We can now use the message source interface to signal any feedback to the user.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-12-28 15:35:10 +01:00
parent d1b20bec39
commit 6de5e9a54c
4 changed files with 11 additions and 22 deletions

View file

@ -36,6 +36,7 @@
#include "calls-log.h" #include "calls-log.h"
#include "calls-main-window.h" #include "calls-main-window.h"
#include "calls-manager.h" #include "calls-manager.h"
#include "calls-message-source.h"
#include "calls-new-call-box.h" #include "calls-new-call-box.h"
#include "calls-notifier.h" #include "calls-notifier.h"
#include "calls-record-store.h" #include "calls-record-store.h"
@ -542,13 +543,13 @@ open_tel_uri (CallsApplication *self,
g_debug ("Opening tel URI `%s'", uri); g_debug ("Opening tel URI `%s'", uri);
number = &uri[4]; // tel:NUMBER number = &uri[4]; // tel:NUMBER
if (!number || number[0] == '\0') { if (!number || !*number) {
g_autofree char *msg = g_autofree char *msg =
g_strdup_printf (_("Tried invalid tel URI `%s'"), uri); g_strdup_printf (_("Tried dialing invalid tel URI `%s'"), uri);
g_signal_emit_by_name (calls_manager_get_default (), calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (calls_manager_get_default ()),
"error", "msg",
msg); GTK_MESSAGE_WARNING);
g_warning ("Ignoring invalid tel URI `%s'", uri); g_warning ("Ignoring invalid tel URI `%s'", uri);
return; return;
} }
@ -623,8 +624,9 @@ app_open (GApplication *application,
msg = g_strdup_printf (_("Don't know how to open `%s'"), uri); msg = g_strdup_printf (_("Don't know how to open `%s'"), uri);
g_signal_emit_by_name (calls_manager_get_default (), calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (calls_manager_get_default ()),
"error", msg); msg,
GTK_MESSAGE_WARNING);
} }
} }

View file

@ -297,7 +297,7 @@ calls_call_window_init (CallsCallWindow *self)
// Show errors in in-app-notification // Show errors in in-app-notification
g_signal_connect_swapped (calls_manager_get_default (), g_signal_connect_swapped (calls_manager_get_default (),
"error", "message",
G_CALLBACK (calls_in_app_notification_show), G_CALLBACK (calls_in_app_notification_show),
self->in_app_notification); self->in_app_notification);

View file

@ -355,7 +355,7 @@ constructed (GObject *object)
// Show errors in in-app-notification // Show errors in in-app-notification
g_signal_connect_swapped (calls_manager_get_default (), g_signal_connect_swapped (calls_manager_get_default (),
"error", "message",
G_CALLBACK (calls_in_app_notification_show), G_CALLBACK (calls_in_app_notification_show),
self->in_app_notification); self->in_app_notification);

View file

@ -73,9 +73,6 @@ static GParamSpec *props[PROP_LAST_PROP];
enum { enum {
SIGNAL_CALL_ADD, SIGNAL_CALL_ADD,
SIGNAL_CALL_REMOVE, SIGNAL_CALL_REMOVE,
/* TODO: currently this event isn't emitted since the plugins don't give use
* a usable error or error message. */
SIGNAL_ERROR,
USSD_ADDED, USSD_ADDED,
USSD_CANCELLED, USSD_CANCELLED,
USSD_STATE_CHANGED, USSD_STATE_CHANGED,
@ -603,16 +600,6 @@ calls_manager_class_init (CallsManagerClass *klass)
CALLS_TYPE_CALL, CALLS_TYPE_CALL,
CALLS_TYPE_ORIGIN); CALLS_TYPE_ORIGIN);
signals[SIGNAL_ERROR] =
g_signal_new ("error",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL, NULL,
G_TYPE_NONE,
1,
G_TYPE_STRING);
signals[USSD_ADDED] = signals[USSD_ADDED] =
g_signal_new ("ussd-added", g_signal_new ("ussd-added",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),