[gtk+/wip/baedert/gtkimageview: 197/279] demo: Add some error handling for async operations



commit 56f4639dee467235b30c0e5da71341511c320f50
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 22 17:39:27 2016 +0100

    demo: Add some error handling for async operations

 demos/gtk-demo/image_view.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/demos/gtk-demo/image_view.c b/demos/gtk-demo/image_view.c
index 425c307..73de799 100644
--- a/demos/gtk-demo/image_view.c
+++ b/demos/gtk-demo/image_view.c
@@ -25,6 +25,26 @@ file_set_cb (GtkFileChooserButton *widget,
                                        NULL);
 }
 
+
+static void
+image_loaded_cb (GObject      *source_object,
+                 GAsyncResult *result,
+                 gpointer      user_data)
+{
+  GtkImageView *image_view = GTK_IMAGE_VIEW (source_object);
+  GError *error = NULL;
+
+  gtk_image_view_load_from_file_finish (image_view,
+                                        result,
+                                        &error);
+
+  if (error)
+    {
+      g_message ("Error: %s", error->message);
+      return;
+    }
+}
+
 void
 load_button_cb ()
 {
@@ -34,7 +54,7 @@ load_button_cb ()
                                        file,
                                        1,
                                        NULL,
-                                       generic_cb,
+                                       image_loaded_cb,
                                        NULL);
 }
 


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