[calls] manager: Remove the "error" signal and adapt to changes



commit 6de5e9a54cd72a313bd59c7fe1143d438effc688
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Tue Dec 28 15:35:10 2021 +0100

    manager: Remove the "error" signal and adapt to changes
    
    We can now use the message source interface to signal any feedback to the user.

 src/calls-application.c | 16 +++++++++-------
 src/calls-call-window.c |  2 +-
 src/calls-main-window.c |  2 +-
 src/calls-manager.c     | 13 -------------
 4 files changed, 11 insertions(+), 22 deletions(-)
---
diff --git a/src/calls-application.c b/src/calls-application.c
index 18faa149..20239fe4 100644
--- a/src/calls-application.c
+++ b/src/calls-application.c
@@ -36,6 +36,7 @@
 #include "calls-log.h"
 #include "calls-main-window.h"
 #include "calls-manager.h"
+#include "calls-message-source.h"
 #include "calls-new-call-box.h"
 #include "calls-notifier.h"
 #include "calls-record-store.h"
@@ -542,13 +543,13 @@ open_tel_uri (CallsApplication *self,
   g_debug ("Opening tel URI `%s'", uri);
 
   number = &uri[4]; // tel:NUMBER
-  if (!number || number[0] == '\0') {
+  if (!number || !*number) {
     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 (),
-                           "error",
-                           msg);
+    calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (calls_manager_get_default ()),
+                                       "msg",
+                                       GTK_MESSAGE_WARNING);
     g_warning ("Ignoring invalid tel URI `%s'", uri);
     return;
   }
@@ -623,8 +624,9 @@ app_open (GApplication  *application,
 
     msg = g_strdup_printf (_("Don't know how to open `%s'"), uri);
 
-    g_signal_emit_by_name (calls_manager_get_default (),
-                           "error", msg);
+    calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (calls_manager_get_default ()),
+                                       msg,
+                                       GTK_MESSAGE_WARNING);
   }
 }
 
diff --git a/src/calls-call-window.c b/src/calls-call-window.c
index 4f68fafa..df127a36 100644
--- a/src/calls-call-window.c
+++ b/src/calls-call-window.c
@@ -297,7 +297,7 @@ calls_call_window_init (CallsCallWindow *self)
 
   // Show errors in in-app-notification
   g_signal_connect_swapped (calls_manager_get_default (),
-                            "error",
+                            "message",
                             G_CALLBACK (calls_in_app_notification_show),
                             self->in_app_notification);
 
diff --git a/src/calls-main-window.c b/src/calls-main-window.c
index 2c357fb8..7103bb98 100644
--- a/src/calls-main-window.c
+++ b/src/calls-main-window.c
@@ -355,7 +355,7 @@ constructed (GObject *object)
 
   // Show errors in in-app-notification
   g_signal_connect_swapped (calls_manager_get_default (),
-                            "error",
+                            "message",
                             G_CALLBACK (calls_in_app_notification_show),
                             self->in_app_notification);
 
diff --git a/src/calls-manager.c b/src/calls-manager.c
index 58c8b4ed..461429c2 100644
--- a/src/calls-manager.c
+++ b/src/calls-manager.c
@@ -73,9 +73,6 @@ static GParamSpec *props[PROP_LAST_PROP];
 enum {
   SIGNAL_CALL_ADD,
   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_CANCELLED,
   USSD_STATE_CHANGED,
@@ -603,16 +600,6 @@ calls_manager_class_init (CallsManagerClass *klass)
                  CALLS_TYPE_CALL,
                  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] =
     g_signal_new ("ussd-added",
                   G_TYPE_FROM_CLASS (klass),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]