[gnome-photos] properties-dialog: Move common code to its own function



commit 7f3b9f94f141fd9b3bd5ad4c5f3d9031e3643195
Author: Rafael Fonseca <r4f4rfs gmail com>
Date:   Mon Mar 21 17:14:12 2016 +0100

    properties-dialog: Move common code to its own function
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763908

 src/photos-properties-dialog.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/photos-properties-dialog.c b/src/photos-properties-dialog.c
index 6fd87a8..f7005d8 100644
--- a/src/photos-properties-dialog.c
+++ b/src/photos-properties-dialog.c
@@ -105,6 +105,17 @@ photos_properties_dialog_get_camera (GObject *source_object, GAsyncResult *res,
 }
 
 
+static void
+photos_properties_dialog_remove_timeout (PhotosPropertiesDialog *self)
+{
+  if (self->title_entry_timeout != 0)
+    {
+      g_source_remove (self->title_entry_timeout);
+      self->title_entry_timeout = 0;
+    }
+}
+
+
 static gboolean
 photos_properties_dialog_title_entry_timeout (gpointer user_data)
 {
@@ -125,11 +136,7 @@ photos_properties_dialog_title_entry_changed (GtkEditable *editable, gpointer us
 {
   PhotosPropertiesDialog *self = PHOTOS_PROPERTIES_DIALOG (user_data);
 
-  if (self->title_entry_timeout != 0)
-    {
-      g_source_remove (self->title_entry_timeout);
-      self->title_entry_timeout = 0;
-    }
+  photos_properties_dialog_remove_timeout (self);
 
   self->title_entry_timeout = g_timeout_add (TITLE_ENTRY_TIMEOUT,
                                              photos_properties_dialog_title_entry_timeout,
@@ -528,8 +535,7 @@ photos_properties_dialog_finalize (GObject *object)
 
   g_free (self->urn);
 
-  if (self->title_entry_timeout != 0)
-    g_source_remove (self->title_entry_timeout);
+  photos_properties_dialog_remove_timeout (self);
 
   G_OBJECT_CLASS (photos_properties_dialog_parent_class)->finalize (object);
 }


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