@@ -834,8 +834,8 @@ combo_changed_cb (GtkComboBox *widget, gpointer user_data)
834
834
835
835
/* This function will return the selected invoice report guid if
836
836
* the countdown times out or a selection is made and OK pressed.
837
- *
838
- * If cancel is pressed then it return a NULL
837
+ *
838
+ * If cancel is pressed then it will return NULL
839
839
*/
840
840
static char *
841
841
use_default_report_template_or_change (GtkWindow * parent )
@@ -847,20 +847,34 @@ use_default_report_template_or_change (GtkWindow *parent)
847
847
GtkWidget * ok_button ;
848
848
GtkWidget * report_combo_hbox ;
849
849
GtkWidget * progress_bar ;
850
+ GtkWidget * label ;
850
851
gchar * ret_guid = NULL ;
851
852
gchar * rep_guid = NULL ;
852
853
gchar * rep_name = NULL ;
854
+ gboolean warning_visible = FALSE;
853
855
gint result ;
854
856
gdouble timeout ;
855
857
dialog_args * args ;
856
858
857
859
timeout = qof_book_get_default_invoice_report_timeout (book );
858
860
859
- if (timeout == 0 )
860
- return gnc_get_default_invoice_print_report ();
861
-
862
861
combo = gnc_default_invoice_report_combo ("gnc:custom-report-invoice-template-guids" );
863
862
863
+ rep_name = qof_book_get_default_invoice_report_name (book );
864
+ rep_guid = gnc_get_default_invoice_print_report ();
865
+
866
+ gnc_report_combo_set_active (GNC_REPORT_COMBO (combo ),
867
+ rep_guid ,
868
+ rep_name );
869
+ g_free (rep_guid );
870
+ g_free (rep_name );
871
+
872
+ warning_visible = gnc_report_combo_is_warning_visible_for_active (GNC_REPORT_COMBO (combo ));
873
+
874
+ // When timeout is 0, only return if warning not visible
875
+ if (timeout == 0 && !warning_visible )
876
+ return gnc_get_default_invoice_print_report ();
877
+
864
878
builder = gtk_builder_new ();
865
879
gnc_builder_add_from_file (builder , "dialog-invoice.glade" , "invoice_print_dialog" );
866
880
@@ -873,20 +887,12 @@ use_default_report_template_or_change (GtkWindow *parent)
873
887
ok_button = GTK_WIDGET (gtk_builder_get_object (builder , "ok_button" ));
874
888
report_combo_hbox = GTK_WIDGET (gtk_builder_get_object (builder , "report_combo_hbox" ));
875
889
progress_bar = GTK_WIDGET (gtk_builder_get_object (builder , "progress_bar" ));
890
+ label = GTK_WIDGET (gtk_builder_get_object (builder , "label" ));
876
891
877
892
gtk_box_pack_start (GTK_BOX (report_combo_hbox ), GTK_WIDGET (combo ), TRUE, TRUE, 0 );
878
893
879
894
gtk_widget_grab_focus (ok_button );
880
895
881
- rep_name = qof_book_get_default_invoice_report_name (book );
882
- rep_guid = gnc_get_default_invoice_print_report ();
883
-
884
- gnc_report_combo_set_active (GNC_REPORT_COMBO (combo ),
885
- rep_guid ,
886
- rep_name );
887
- g_free (rep_guid );
888
- g_free (rep_name );
889
-
890
896
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar ), 1 );
891
897
892
898
args = g_malloc (sizeof (dialog_args ));
@@ -907,7 +913,15 @@ use_default_report_template_or_change (GtkWindow *parent)
907
913
g_signal_connect (G_OBJECT (combo ), "notify::popup-shown" ,
908
914
G_CALLBACK (combo_popped_cb ), args );
909
915
910
- g_timeout_add (100 , update_progress_bar , args );
916
+ // if warning visible, do not add args timeout, wait for user
917
+ if (warning_visible )
918
+ {
919
+ gtk_label_set_text (GTK_LABEL (label ),
920
+ N_ ("Choose a different report template or Printable Invoice will be used" ));
921
+ gtk_widget_hide (GTK_WIDGET (progress_bar ));
922
+ }
923
+ else
924
+ g_timeout_add (100 , update_progress_bar , args );
911
925
912
926
result = gtk_dialog_run (GTK_DIALOG (dialog ));
913
927
0 commit comments