Problems with GtkPrintOperation's settings



Hi guys, 

I am having a bit of trouble playing with GtkPrintOperation. More
precisely, I am not getting correctly some information that I stored in
the GtkPrintSettings of my operation.

My rationale is as follows:

- In the callback for "custom-widget-apply", I store in the settings of
the operation a double that I get from my custom widget:

void
on_custom_widget_apply (GtkPrintOperation *op,
                        GtkWidget         *widget,
                        gpointer           user_data)
{
        GtkPrintSettings *settings;
        gdouble a;
        
        settings = gtk_print_operation_get_print_settings (op);
        a = custom_widget_get_double (widget);
        gtk_print_settings_set_double (settings, 
                                       "my-double", (a != .0)? a : 100);
}

- In the callback for "draw-page", I get that double from the settings
in my operation:

void
on_draw_page (GtkPrintOperation *op,
              GtkPrintContext   *context,
              gint               page_nr,
              gpointer           user_data)
{
        GtkPrintSettings *settings;
        gdouble a;
        
        gtk_print_operation_get_print_settings (op);
        a = gtk_print_settings_get_double (settings, "my-double");
        
        g_assert (a != .0);
        
        ...
}

I would expect a in on_draw_page() to be different from 0, but I am
wrong. This can only mean that the settings in on_draw_page () are
different from the one in on_custom_widget_apply (), and that the key
"my-double" is not set.

I am surely missing something on the GtkPrintOperation usage. Could you
please give me some advice?

Thanks,

Claudio

-- 
Claudio Saavedra <csaavedra alumnos utalca cl>




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