~ubuntu-branches/ubuntu/lucid/gedit/lucid-proposed

« back to all changes in this revision

Viewing changes to gedit/gedit-tab.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-03-03 22:44:53 UTC
  • mfrom: (1.1.75 upstream)
  • Revision ID: james.westby@ubuntu.com-20100303224453-cv1q4se7d0xgibqg
Tags: 2.29.8-0ubuntu1
* New upstream version
  - Rework encoding validation
  - Misc bugfixes
* Refreshed patches:
  - 01_gedit-bugreport-location.patch
  - 01_lpi.patch
  - 03_python_path.patch
  - 80_not_using_localmodlibs.patch
  - 90_autoconf.patch
  - 99_ltmain_as-needed.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
834
834
                  goffset        total_size,
835
835
                  GeditTab      *tab)
836
836
{
837
 
        double et;
 
837
        gdouble et;
 
838
        gdouble total_time;
838
839
 
839
840
        g_return_if_fail ((tab->priv->state == GEDIT_TAB_STATE_LOADING) ||
840
841
                          (tab->priv->state == GEDIT_TAB_STATE_REVERTING));
849
850
 
850
851
        et = g_timer_elapsed (tab->priv->timer, NULL);
851
852
 
852
 
        if (tab->priv->times_called == 1)
853
 
        {
854
 
                if ((total_size == 0) || (total_size > 51200UL) /* 50 KB */)
855
 
                {
856
 
                        show_loading_message_area (tab);
857
 
                }
858
 
        }
859
 
        else
860
 
        {
861
 
                if ((tab->priv->times_called == 3) && (total_size != 0))
862
 
                {
863
 
                        gdouble total_time;
864
 
 
865
 
                        /* et : total_time = size : total_size */
866
 
                        total_time = (et * total_size)/size;
867
 
 
868
 
                        if ((total_time - et) > 3.0)
869
 
                        {
870
 
                                show_loading_message_area (tab);
871
 
                        }
872
 
                }
873
 
                else
874
 
                {
875
 
                        if (et > 3.0)
876
 
                        {
877
 
                                show_loading_message_area (tab);
878
 
                        }
879
 
                }
880
 
        }
881
 
        
 
853
        /* et : total_time = size : total_size */
 
854
        total_time = (et * total_size) / size;
 
855
 
 
856
        if ((total_time - et) > 3.0)
 
857
        {
 
858
                show_loading_message_area (tab);
 
859
        }
 
860
 
882
861
        message_area_set_progress (tab, size, total_size);
883
 
 
884
 
        tab->priv->times_called++;
885
862
}
886
863
 
887
864
static gboolean
919
896
        uri = gedit_document_get_uri (document);
920
897
 
921
898
        /* if the error is CONVERSION FALLBACK don't treat it as a normal error */
922
 
        if (error != NULL && error->code != GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK)
 
899
        if (error != NULL &&
 
900
            (error->domain != GEDIT_DOCUMENT_ERROR || error->code != GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK))
923
901
        {
924
902
                if (tab->priv->state == GEDIT_TAB_STATE_LOADING)
925
903
                        gedit_tab_set_state (tab, GEDIT_TAB_STATE_LOADING_ERROR);
928
906
 
929
907
                encoding = gedit_document_get_encoding (document);
930
908
 
931
 
                if (error->domain == G_IO_ERROR && 
 
909
                if (error->domain == G_IO_ERROR &&
932
910
                    error->code == G_IO_ERROR_CANCELLED)
933
911
                {
934
912
                        /* remove the tab, but in an idle handler, since
998
976
                                   mime);
999
977
                g_free (mime);
1000
978
 
1001
 
                if (error && error->code == GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK)
 
979
                if (error &&
 
980
                    error->domain == GEDIT_DOCUMENT_ERROR &&
 
981
                    error->code == GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK)
1002
982
                {
1003
983
                        GtkWidget *emsg;
1004
984
 
1102
1082
                 goffset  total_size,
1103
1083
                 GeditTab         *tab)
1104
1084
{
1105
 
        double et;
 
1085
        gdouble et;
 
1086
        gdouble total_time;
1106
1087
 
1107
1088
        g_return_if_fail (tab->priv->state == GEDIT_TAB_STATE_SAVING);
1108
1089
 
1117
1098
 
1118
1099
        et = g_timer_elapsed (tab->priv->timer, NULL);
1119
1100
 
1120
 
        if (tab->priv->times_called == 1)
1121
 
        {
1122
 
                if ((total_size == 0) || (total_size > 51200UL) /* 50 KB */)
1123
 
                {
1124
 
                        show_saving_message_area (tab);
1125
 
                }
1126
 
        }
1127
 
        else
1128
 
        {
1129
 
                if ((tab->priv->times_called == 3) && (total_size != 0))
1130
 
                {
1131
 
                        gdouble total_time;
1132
 
 
1133
 
                        /* et : total_time = size : total_size */
1134
 
                        total_time = (et * total_size)/size;
1135
 
 
1136
 
                        if ((total_time - et) > 3.0)
1137
 
                        {
1138
 
                                show_saving_message_area (tab);
1139
 
                        }
1140
 
                }
1141
 
                else
1142
 
                {
1143
 
                        if (et > 3.0)
1144
 
                        {
1145
 
                                show_saving_message_area (tab);
1146
 
                        }
1147
 
                }
1148
 
        }
1149
 
        
 
1101
        /* et : total_time = size : total_size */
 
1102
        total_time = (et * total_size)/size;
 
1103
 
 
1104
        if ((total_time - et) > 3.0)
 
1105
        {
 
1106
                show_saving_message_area (tab);
 
1107
        }
 
1108
 
1150
1109
        message_area_set_progress (tab, size, total_size);
1151
1110
 
1152
1111
        tab->priv->times_called++;