r17730 - gnucash/trunk/src - Partly revert r17725, "Bug #106401: Add SX weekend occurence to be shifted to weekdays"

Christian Stimming cstim at cvs.gnucash.org
Wed Nov 26 17:42:30 EST 2008


Author: cstim
Date: 2008-11-26 17:42:29 -0500 (Wed, 26 Nov 2008)
New Revision: 17730
Trac: http://svn.gnucash.org/trac/changeset/17730

Modified:
   gnucash/trunk/src/backend/file/gnc-freqspec-xml-v2.c
   gnucash/trunk/src/backend/file/gnc-recurrence-xml-v2.c
   gnucash/trunk/src/gnome-utils/gnc-frequency.c
   gnucash/trunk/src/gnome/glade/sched-xact.glade
Log:
Partly revert r17725, "Bug #106401: Add SX weekend occurence to be shifted to weekdays"

The original patch doesn't seem to deal with backward compatiblity in the
XML parser well enough. This commit reverts the GUI- and XML-related
parts of r17725.

Modified: gnucash/trunk/src/backend/file/gnc-freqspec-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-freqspec-xml-v2.c	2008-11-26 22:16:27 UTC (rev 17729)
+++ gnucash/trunk/src/backend/file/gnc-freqspec-xml-v2.c	2008-11-26 22:42:29 UTC (rev 17730)
@@ -245,20 +245,6 @@
 
 static
 gboolean
-fs_weekend_adj_handler( xmlNodePtr node, gpointer data )
-{
-        fsParseData *fspd = data;
-        gboolean        ret;
-        gint64          foo;
-        ret = dom_tree_to_integer( node, &foo );
-        if ( !ret )
-                return ret;
-        fspd->weekend_adj = foo;
-        return TRUE;
-}
-
-static
-gboolean
 fs_subelement_handler( xmlNodePtr node, gpointer data )
 {
         fsParseData *fspd = data;
@@ -287,14 +273,13 @@
 }
 
 struct dom_tree_handler fs_union_dom_handlers[] = {
-        { "fs:date",        fs_date_handler,        0, 0 },
-        { "fs:interval",    fs_interval_handler,    0, 0 },
-        { "fs:offset",      fs_offset_handler,      0, 0 },
-        { "fs:day",         fs_day_handler,         0, 0 },
-        { "fs:weekday",     fs_weekday_handler,     0, 0 },
-        { "fs:occurrence",  fs_occurrence_handler,  0, 0 },
-        { "fs:weekend_adj", fs_weekend_adj_handler, 0, 0 },
-        { "gnc:freqspec",   fs_subelement_handler,  0, 0 },
+        { "fs:date",       fs_date_handler,       0, 0 },
+        { "fs:interval",   fs_interval_handler,   0, 0 },
+        { "fs:offset",     fs_offset_handler,     0, 0 },
+        { "fs:day",        fs_day_handler,        0, 0 },
+        { "fs:weekday",    fs_weekday_handler,    0, 0 },
+        { "fs:occurrence", fs_occurrence_handler, 0, 0 },
+        { "gnc:freqspec",  fs_subelement_handler, 0, 0 },
         { NULL, NULL, 0, 0 },
 };
 

Modified: gnucash/trunk/src/backend/file/gnc-recurrence-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-recurrence-xml-v2.c	2008-11-26 22:16:27 UTC (rev 17729)
+++ gnucash/trunk/src/backend/file/gnc-recurrence-xml-v2.c	2008-11-26 22:42:29 UTC (rev 17730)
@@ -47,7 +47,6 @@
 #define recurrence_mult          "recurrence:mult"
 #define recurrence_period_type   "recurrence:period_type"
 #define recurrence_start         "recurrence:start"
-#define recurrence_weekend_adj   "recurrence:weekend_adj"
 
 //TODO: I think three of these functions rightly belong in Recurrence.c.
 
@@ -84,25 +83,10 @@
     return dom_tree_to_guint16(node, &((Recurrence *)r)->mult);
 }
 
-static gboolean
-recurrence_weekend_adj_handler(xmlNodePtr node, gpointer d)
-{
-    WeekendAdjust wadj;
-    char *nodeTxt;
-
-    nodeTxt = dom_tree_to_text(node);
-    g_return_val_if_fail(nodeTxt, FALSE);
-    wadj= recurrenceWeekendAdjustFromString(nodeTxt);
-    ((Recurrence *) d)->wadj = wadj;
-    g_free(nodeTxt);
-    return (wadj != -1);
-}
-
 static struct dom_tree_handler recurrence_dom_handlers[] = {
     { recurrence_mult, recurrence_mult_handler, 1, 0 },
     { recurrence_period_type, recurrence_period_type_handler, 1, 0 },
     { recurrence_start, recurrence_start_date_handler, 1, 0 },
-    { recurrence_weekend_adj, recurrence_weekend_adj_handler, 1, 0 },
     { NULL, NULL, 0, 0 }
 };
 
@@ -129,7 +113,6 @@
     xmlNodePtr n;
     PeriodType pt;
     GDate d;
-    WeekendAdjust wadj;
 
     n = xmlNewNode(NULL, tag);
     xmlSetProp(n, "version", recurrence_version_string );
@@ -140,8 +123,5 @@
                                     recurrencePeriodTypeToString(pt)));
     d = recurrenceGetDate(r);
     xmlAddChild(n, gdate_to_dom_tree(recurrence_start, &d));
-    wadj = recurrenceGetWeekendAdjust(r);
-    xmlAddChild(n, text_to_dom_tree(recurrence_weekend_adj,
-                                    recurrenceWeekendAdjustToString(wadj)));
     return n;
 }

Modified: gnucash/trunk/src/gnome/glade/sched-xact.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/sched-xact.glade	2008-11-26 22:16:27 UTC (rev 17729)
+++ gnucash/trunk/src/gnome/glade/sched-xact.glade	2008-11-26 22:42:29 UTC (rev 17730)
@@ -1892,47 +1892,6 @@
 			      <property name="fill">True</property>
 			    </packing>
 			  </child>
-
-			  <child>
-			    <widget class="GtkLabel" id="label847751">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">except on weekends:</property>
-			      <property name="use_underline">False</property>
-			      <property name="use_markup">False</property>
-			      <property name="justify">GTK_JUSTIFY_RIGHT</property>
-			      <property name="wrap">False</property>
-			      <property name="selectable">False</property>
-			      <property name="xalign">1</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			      <property name="width_chars">-1</property>
-			      <property name="single_line_mode">False</property>
-			      <property name="angle">0</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">2</property>
-			      <property name="expand">False</property>
-			      <property name="fill">True</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkComboBox" id="semimonthly_first_weekend">
-			      <property name="visible">True</property>
-			      <property name="items" translatable="yes">No change
-Use previous weekday
-Use next weekday</property>
-			      <property name="add_tearoffs">False</property>
-			      <property name="focus_on_click">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
 			</widget>
 			<packing>
 			  <property name="padding">3</property>
@@ -2023,47 +1982,6 @@
 			      <property name="fill">False</property>
 			    </packing>
 			  </child>
-
-			  <child>
-			    <widget class="GtkLabel" id="label847752">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">except on weekends:</property>
-			      <property name="use_underline">False</property>
-			      <property name="use_markup">False</property>
-			      <property name="justify">GTK_JUSTIFY_RIGHT</property>
-			      <property name="wrap">False</property>
-			      <property name="selectable">False</property>
-			      <property name="xalign">1</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			      <property name="width_chars">-1</property>
-			      <property name="single_line_mode">False</property>
-			      <property name="angle">0</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">2</property>
-			      <property name="expand">False</property>
-			      <property name="fill">True</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkComboBox" id="semimonthly_second_weekend">
-			      <property name="visible">True</property>
-			      <property name="items" translatable="yes">No change
-Use previous weekday
-Use next weekday</property>
-			      <property name="add_tearoffs">False</property>
-			      <property name="focus_on_click">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
 			</widget>
 			<packing>
 			  <property name="padding">3</property>
@@ -2284,57 +2202,16 @@
 			      <property name="fill">False</property>
 			    </packing>
 			  </child>
-
-			  <child>
-			    <widget class="GtkLabel" id="label847750">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">except on weekends:</property>
-			      <property name="use_underline">False</property>
-			      <property name="use_markup">False</property>
-			      <property name="justify">GTK_JUSTIFY_RIGHT</property>
-			      <property name="wrap">False</property>
-			      <property name="selectable">False</property>
-			      <property name="xalign">1</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			      <property name="width_chars">-1</property>
-			      <property name="single_line_mode">False</property>
-			      <property name="angle">0</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">2</property>
-			      <property name="expand">False</property>
-			      <property name="fill">True</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkComboBox" id="monthly_weekend">
-			      <property name="visible">True</property>
-			      <property name="items" translatable="yes">No change
-Use previous weekday
-Use next weekday</property>
-			      <property name="add_tearoffs">False</property>
-			      <property name="focus_on_click">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
 			</widget>
 			<packing>
-			  <property name="padding">3</property>
+			  <property name="padding">5</property>
 			  <property name="expand">False</property>
 			  <property name="fill">True</property>
 			</packing>
 		      </child>
 		    </widget>
 		    <packing>
-		      <property name="padding">3</property>
+		      <property name="padding">5</property>
 		      <property name="expand">True</property>
 		      <property name="fill">True</property>
 		    </packing>

Modified: gnucash/trunk/src/gnome-utils/gnc-frequency.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-frequency.c	2008-11-26 22:16:27 UTC (rev 17729)
+++ gnucash/trunk/src/gnome-utils/gnc-frequency.c	2008-11-26 22:42:29 UTC (rev 17730)
@@ -412,12 +412,8 @@
 
              dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_first");
              gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), _get_monthly_combobox_index(first));
-             dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_first_weekend");
-             gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), recurrenceGetWeekendAdjust(first));
              dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_second");
              gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), _get_monthly_combobox_index(second));
-             dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_second_weekend");
-             gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), recurrenceGetWeekendAdjust(second));
 
              gtk_notebook_set_current_page(gf->nb, PAGE_SEMI_MONTHLY);
              gtk_combo_box_set_active(gf->freqComboBox, PAGE_SEMI_MONTHLY);
@@ -468,7 +464,7 @@
          case PERIOD_YEAR:
          case PERIOD_LAST_WEEKDAY: {
              guint multiplier;
-             GtkWidget *multipler_spin, *day_of_month, *weekend_mode;
+             GtkWidget *multipler_spin, *day_of_month;
              
              multipler_spin = glade_xml_get_widget(gf->gxml, "monthly_spin");
              multiplier = recurrenceGetMultiplier(r);
@@ -478,8 +474,6 @@
 
              day_of_month = glade_xml_get_widget(gf->gxml, "monthly_day");
              gtk_combo_box_set_active(GTK_COMBO_BOX(day_of_month), _get_monthly_combobox_index(r));
-             weekend_mode = glade_xml_get_widget(gf->gxml, "monthly_weekend");
-             gtk_combo_box_set_active(GTK_COMBO_BOX(weekend_mode), recurrenceGetWeekendAdjust(r));
 
              gtk_notebook_set_current_page(gf->nb, PAGE_MONTHLY);
              gtk_combo_box_set_active(gf->freqComboBox, PAGE_MONTHLY);
@@ -513,8 +507,7 @@
     Recurrence *r;
     GtkWidget *day_of_month_combo = glade_xml_get_widget(gf->gxml, combo_name);
     int day_of_month_index = gtk_combo_box_get_active(GTK_COMBO_BOX(day_of_month_combo));
-    GtkWidget *weekend_adjust_combo = glade_xml_get_widget(gf->gxml, combo_weekend_name);
-    int weekend_adjust = gtk_combo_box_get_active(GTK_COMBO_BOX(weekend_adjust_combo));
+    int weekend_adjust = WEEKEND_ADJ_NONE;
         
     r = g_new0(Recurrence, 1);
     if (day_of_month_index > LAST_DAY_OF_MONTH_OPTION_INDEX)



More information about the gnucash-changes mailing list