X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/9a99599695e04ad9f217f4199da8a48d1e924e63..21012ec0a0a3c535966813134645b87160b18bc3:/src/print.c diff --git a/src/print.c b/src/print.c index 5d9ec1d4..285e3af2 100644 --- a/src/print.c +++ b/src/print.c @@ -21,12 +21,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include - -#if GTK_CHECK_VERSION(2,10,0) +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include +#include +#include #include "viking.h" #include "print.h" @@ -46,10 +48,10 @@ typedef struct { } PrintCenterName; static const PrintCenterName center_modes[] = { - {"None", VIK_PRINT_CENTER_NONE}, - {"Horizontally", VIK_PRINT_CENTER_HORIZONTALLY}, - {"Vertically", VIK_PRINT_CENTER_VERTICALLY}, - {"Both", VIK_PRINT_CENTER_BOTH}, + {N_("None"), VIK_PRINT_CENTER_NONE}, + {N_("Horizontally"), VIK_PRINT_CENTER_HORIZONTALLY}, + {N_("Vertically"), VIK_PRINT_CENTER_VERTICALLY}, + {N_("Both"), VIK_PRINT_CENTER_BOTH}, {NULL, -1} }; @@ -103,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); @@ -113,7 +115,7 @@ void a_print(VikWindow *vw, VikViewport *vvp) g_signal_connect (print_oper, "end-print", G_CALLBACK (end_print), &data); g_signal_connect (print_oper, "create-custom-widget", G_CALLBACK (create_custom_widget_cb), &data); - gtk_print_operation_set_custom_tab_label (print_oper, "Image Settings"); + gtk_print_operation_set_custom_tab_label (print_oper, _("Image Settings")); res = gtk_print_operation_run (print_oper, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, @@ -195,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; @@ -210,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); @@ -240,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; } } @@ -354,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); @@ -481,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) @@ -543,7 +548,7 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat GtkPageSetup *setup; CustomWidgetInfo *info = g_malloc0(sizeof(CustomWidgetInfo)); - g_signal_connect_swapped (data->operation, "done", G_CALLBACK (custom_widgets_cleanup), info); + g_signal_connect_swapped (data->operation, _("done"), G_CALLBACK (custom_widgets_cleanup), info); info->data = data; @@ -572,8 +577,8 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat gtk_widget_show (vbox); /* Page Size */ - button = gtk_button_new_with_mnemonic ("_Adjust Page Size " - "and Orientation"); + button = gtk_button_new_with_mnemonic (_("_Adjust Page Size " + "and Orientation")); gtk_box_pack_start (GTK_BOX (main_vbox), button, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (page_setup_cb), @@ -588,14 +593,14 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); - label = gtk_label_new_with_mnemonic ("C_enter:"); + label = gtk_label_new_with_mnemonic (_("C_enter:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 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); @@ -606,7 +611,7 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat info->center_combo = combo; /* ignore page margins */ - button = gtk_check_button_new_with_mnemonic ("Ignore Page _Margins"); + button = gtk_check_button_new_with_mnemonic (_("Ignore Page _Margins")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), data->use_full_page); @@ -625,7 +630,7 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); - label = gtk_label_new_with_mnemonic ("Image S_ize:"); + label = gtk_label_new_with_mnemonic (_("Image S_ize:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -667,5 +672,3 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat return layout; } - -#endif