[gnome-initial-setup/source-remove-cleanups] Improve readability when removing event sources



commit 5e39f9133b49539c6d7da7e4e59c510fccca45b9
Author: Matthew Leeds <matthew leeds endlessm com>
Date:   Fri Mar 13 14:46:47 2020 -0700

    Improve readability when removing event sources
    
    This introduces no functional changes.

 gnome-initial-setup/pages/account/gis-account-page-local.c | 13 +++----------
 gnome-initial-setup/pages/password/gis-password-page.c     |  7 ++-----
 2 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.c 
b/gnome-initial-setup/pages/account/gis-account-page-local.c
index cfd06a2..2672aa8 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.c
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.c
@@ -256,10 +256,7 @@ validate (GisAccountPageLocal *page)
   gboolean parental_controls_enabled;
   gchar *tip;
 
-  if (priv->timeout_id != 0) {
-    g_source_remove (priv->timeout_id);
-    priv->timeout_id = 0;
-  }
+  g_clear_handle_id (&priv->timeout_id, g_source_remove);
 
   entry = gtk_bin_get_child (GTK_BIN (priv->username_combo));
 
@@ -286,7 +283,7 @@ validate (GisAccountPageLocal *page)
 
   validation_changed (page);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static gboolean
@@ -494,11 +491,7 @@ gis_account_page_local_dispose (GObject *object)
   g_clear_object (&priv->goa_client);
   g_clear_object (&priv->avatar_pixbuf);
   g_clear_pointer (&priv->avatar_filename, g_free);
-
-  if (priv->timeout_id != 0) {
-    g_source_remove (priv->timeout_id);
-    priv->timeout_id = 0;
-  }
+  g_clear_handle_id (&priv->timeout_id, g_source_remove);
 
   G_OBJECT_CLASS (gis_account_page_local_parent_class)->dispose (object);
 }
diff --git a/gnome-initial-setup/pages/password/gis-password-page.c 
b/gnome-initial-setup/pages/password/gis-password-page.c
index a45f2e2..e15a9b5 100644
--- a/gnome-initial-setup/pages/password/gis-password-page.c
+++ b/gnome-initial-setup/pages/password/gis-password-page.c
@@ -206,10 +206,7 @@ validate (GisPasswordPage *page)
   gint strength_level;
   const gchar *hint;
 
-  if (priv->timeout_id != 0) {
-    g_source_remove (priv->timeout_id);
-    priv->timeout_id = 0;
-  }
+  g_clear_handle_id (&priv->timeout_id, g_source_remove);
 
   password = gtk_entry_get_text (GTK_ENTRY (priv->password_entry));
   verify = gtk_entry_get_text (GTK_ENTRY (priv->confirm_entry));
@@ -248,7 +245,7 @@ validate (GisPasswordPage *page)
 
   update_page_validation (page);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static gboolean


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