[calls] in-app-notification: Use unsigned integers for timeout property



commit 3e37870824ff01d5a7838b6a5bf0f2e9a1eff092
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Wed Dec 15 13:35:55 2021 +0100

    in-app-notification: Use unsigned integers for timeout property
    
    It's used in g_timeout_add_seconds and that expects a guint.
    Set the minimum timeout to 1 second.

 src/calls-in-app-notification.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/calls-in-app-notification.c b/src/calls-in-app-notification.c
index 2a5c04f3..0b56472f 100644
--- a/src/calls-in-app-notification.c
+++ b/src/calls-in-app-notification.c
@@ -32,7 +32,7 @@ struct _CallsInAppNotification
 
   GtkLabel *label;
 
-  gint timeout;
+  guint timeout;
   guint timeout_id;
 };
 
@@ -65,7 +65,7 @@ calls_in_app_notification_get_property (GObject      *object,
 
   switch (property_id) {
   case PROP_TIMEOUT:
-    g_value_set_int (value, self->timeout);
+    g_value_set_uint (value, self->timeout);
     break;
 
   default:
@@ -85,7 +85,7 @@ calls_in_app_notification_set_property (GObject      *object,
 
   switch (property_id) {
   case PROP_TIMEOUT:
-    self->timeout = g_value_get_int (value);
+    self->timeout = g_value_get_uint (value);
     break;
 
   default:
@@ -117,15 +117,15 @@ calls_in_app_notification_class_init (CallsInAppNotificationClass *klass)
   object_class->set_property = calls_in_app_notification_set_property;
   object_class->finalize = calls_in_app_notification_finalize;
 
-  props[PROP_TIMEOUT] = g_param_spec_int ("timeout",
-                                          "Timeout",
-                                          "The time the in-app notifaction should be shown",
-                                          -1,
-                                          G_MAXINT,
-                                          DEFAULT_TIMEOUT_SECONDS,
-                                          G_PARAM_READWRITE |
-                                          G_PARAM_CONSTRUCT |
-                                          G_PARAM_STATIC_STRINGS);
+  props[PROP_TIMEOUT] = g_param_spec_uint ("timeout",
+                                           "Timeout",
+                                           "The time the in-app notifaction should be shown",
+                                           1,
+                                           G_MAXUINT,
+                                           DEFAULT_TIMEOUT_SECONDS,
+                                           G_PARAM_READWRITE |
+                                           G_PARAM_CONSTRUCT |
+                                           G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
 


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