[gnome-photos/wip/foo: 7/7] base-item: Use PhotosPrintOperation



commit cd2c786b5f234f3dff863274b74c53dc47ad42b0
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Mar 25 23:54:58 2013 +0100

    base-item: Use PhotosPrintOperation

 src/photos-base-item.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 597a2aa..f624b3e 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -32,6 +32,7 @@
 #include <tracker-sparql.h>
 
 #include "photos-base-item.h"
+#include "photos-print-operation.h"
 #include "photos-query.h"
 #include "photos-single-item-job.h"
 #include "photos-utils.h"
@@ -562,6 +563,27 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
 
 
 static void
+photos_base_item_print_load (GObject *source_object, GAsyncResult *res, gpointer user_data)
+{
+  PhotosBaseItem *self = PHOTOS_BASE_ITEM (source_object);
+  GtkWindow *toplevel = GTK_WINDOW (user_data);
+  GeglNode *node;
+  GtkPrintOperation *print_op;
+
+  node = photos_base_item_load_finish (self, res, NULL);
+  if (node == NULL)
+    goto out;
+
+  print_op = photos_print_operation_new (self);
+  gtk_print_operation_run (print_op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, toplevel, NULL);
+
+ out:
+  g_clear_object (&node);
+  g_object_unref (toplevel);
+}
+
+
+static void
 photos_base_item_update_type_description (PhotosBaseItem *self)
 {
   PhotosBaseItemPrivate *priv = self->priv;
@@ -925,6 +947,7 @@ photos_base_item_open (PhotosBaseItem *self, GdkScreen *screen, guint32 timestam
 void
 photos_base_item_print (PhotosBaseItem *self, GtkWidget *toplevel)
 {
+  photos_base_item_load_async (self, NULL, photos_base_item_print_load, g_object_ref (toplevel));
 }
 
 


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