]> git.street.me.uk Git - andy/viking.git/blobdiff - src/print.c
Fix uniquify tracks to use the appropriate sort order.
[andy/viking.git] / src / print.c
index c6f838962d4a3fa95ea46b0e53334fef46192db6..285e3af2a53fd9752d698f19a561328f7251a764 100644 (file)
@@ -30,8 +30,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#if GTK_CHECK_VERSION(2,10,0)
-
 #include "viking.h"
 #include "print.h"
 #include "print-preview.h"
@@ -107,7 +105,7 @@ void a_print(VikWindow *vw, VikViewport *vvp)
   data.width         = vik_viewport_get_width(vvp);
   data.height        = vik_viewport_get_height(vvp);
 
-  data.xres = data.yres = 230;   /* FIXME */
+  data.xres = data.yres = 1; // This forces it to default to a 100% page size
 
   if (print_settings != NULL) 
     gtk_print_operation_set_print_settings (print_oper, print_settings);
@@ -199,8 +197,6 @@ static void draw_page_cairo(GtkPrintContext *context, PrintData *data)
   gint             stride;
   gint             pixbuf_stride;
   gint             pixbuf_n_channels;
-  gdouble          cr_width;
-  gdouble          cr_height;
   gdouble          cr_dpi_x;
   gdouble          cr_dpi_y;
   gdouble          scale_x;
@@ -214,8 +210,6 @@ static void draw_page_cairo(GtkPrintContext *context, PrintData *data)
   surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
                                        data->width, data->height);
   
-  cr_width  = gtk_print_context_get_width  (context);
-  cr_height = gtk_print_context_get_height (context);
   cr_dpi_x  = gtk_print_context_get_dpi_x  (context);
   cr_dpi_y  = gtk_print_context_get_dpi_y  (context);
 
@@ -244,6 +238,7 @@ static void draw_page_cairo(GtkPrintContext *context, PrintData *data)
       case 4:
         copy_row_from_rgba (surface_pixels, pixbuf_pixels, data->width);
         break;
+      default: break;
     }
   }
 
@@ -358,7 +353,11 @@ static void page_setup_cb (GtkWidget *widget, CustomWidgetInfo *info)
   GtkWidget         *toplevel;
 
   toplevel = gtk_widget_get_toplevel (widget);
+#if GTK_CHECK_VERSION (2,18,0)
+  if (! gtk_widget_is_toplevel (toplevel))
+#else
   if (! GTK_WIDGET_TOPLEVEL (toplevel))
+#endif
     toplevel = NULL;
 
   settings = gtk_print_operation_get_print_settings (operation);
@@ -485,7 +484,9 @@ static void update_offsets (CustomWidgetInfo *info)
       data->offset_x = offset_x_max / 2.0;
       data->offset_y = offset_y_max / 2.0;
       break;
-    }
+
+    default: break;
+  }
 }
 
 static void center_changed_cb (GtkWidget *combo, CustomWidgetInfo *info)
@@ -597,9 +598,9 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
 
-  combo = gtk_combo_box_new_text ();
+  combo = vik_combo_box_text_new ();
   for (center = center_modes; center->name; center++) {
-    gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _(center->name));
+    vik_combo_box_text_append (combo, _(center->name));
   }
   gtk_combo_box_set_active(GTK_COMBO_BOX(combo), VIK_PRINT_CENTER_BOTH);
   gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
@@ -671,5 +672,3 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat
   
   return layout;
 }
-
-#endif