<accelerator key="q" modifiers="GDK_CONTROL_MASK"/>
</child>
</object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-missing-image</property>
+ <property name="icon-size">1</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
<object class="GtkWindow" id="logger-window">
<property name="can_focus">False</property>
<property name="window_position">center</property>
</child>
</object>
</child>
+ <child>
+ <object class="GtkMenuItem" id="debug">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="right_justified">True</property>
+ <property name="label" translatable="yes">Debug</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkImageMenuItem" id="storage-dump">
+ <property name="label" translatable="yes">imagemenuitem</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="image">image2</property>
+ <property name="use_stock">False</property>
+ <signal name="activate" handler="familia_storage_dump_all" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="stack-dump">
+ <property name="label" translatable="yes">imagemenuitem</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="image">image1</property>
+ <property name="use_stock">False</property>
+ <signal name="activate" handler="familia_memory_stack_dump" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
return parent;
}
+
+/**
+ * Adds child to the family
+ */
+Gedcom_ctxt familia_gedcom_family_add_child(Gedcom_elt elt,
+ Gedcom_ctxt parent,
+ int level,
+ char* tag,
+ char* raw_value,
+ int parsed_tag,
+ Gedcom_val parsed_value)
+{
+ void * object = NULL;
+ /* XREF_PTR(FAM) */
+ struct xref_value *xr = GEDCOM_XREF_PTR(parsed_value);
+
+ object = familia_memory_stack_find(xr->string, FS_FAMILY);
+ /* parent: REC_INDI */
+ familia_family_add_child(object, parent);
+
+ return parent;
+}
+
/*
void familia_gedcom_individual_family_end(Gedcom_elt elt,
Gedcom_ctxt parent,
familia_gedcom_individual_last_name_start,
NULL);
gedcom_subscribe_to_element(ELT_SUB_FAMS,
- familia_gedcom_individual_add_family,
+ familia_gedcom_family_add_child,
+ NULL);
+ gedcom_subscribe_to_element(ELT_SUB_FAMC,
+ familia_gedcom_family_add_child,
NULL);
familia_memory_stack_init();
-/****************************************************************************
- * Familia Lignum - Genealogical program *
- * Copyright (C) 2011-2012 Rafał Długołęcki <rafal@dlugolecki.net.pl> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; version 2 of the License. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along *
- * with this program; if not, write to the Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
- * *
- ****************************************************************************/
-
-#ifndef _FAMILIA_MATH_POSITIONS_H
-#define _FAMILIA_MATH_POSITIONS_H
-
#include <stdlib.h>
#include "positions.h"
/* TODO: Implement this function*/
return NULL;
}
-
-#endif /* _FAMILIA_MATH_3D_H */
*/
struct position * familia_position_calculate_family_position(struct familia_family * family);
-#endif /* _FAMILIA_MATH_3D_H */
+#endif /* _FAMILIA_MATH_POSITIONS_H */
char * familia_individual_get_first_name(struct familia_individual * individual)
{
+ if (!individual) {
+ return NULL;
+ }
+
return individual->first_name;
}
+#include <stdio.h>
#include <stdlib.h>
#include "storage.h"
}
}
+void familia_storage_dump_all()
+{
+ int i;
+ struct familia_storage * storage = NULL;
+ struct familia_family * family = NULL;
+ struct familia_individual * individual = NULL;
+
+ storage = familia_storage_get_current();
+
+ for (i = 0; i < storage->individuals_no; i++) {
+ individual = storage->individuals[i];
+ printf("Individual (%d)\n", individual->id);
+ printf("\t First name: %s\n", individual->first_name);
+ printf("\t Last name: %s\n", individual->last_name);
+ if (individual->families_no > 0) {
+ int j;
+ struct familia_family * f = NULL;
+ struct familia_individual * i1 = NULL;
+ struct familia_individual * i2 = NULL;
+
+ printf("\t Families:\n");
+ for (j = 0; j < individual->families_no; j++) {
+ f = individual->families[j];
+ i1 = familia_family_get_individual(f, Individual1);
+ i2 = familia_family_get_individual(f, Individual2);
+
+ printf("\t > %s&%s\n", familia_individual_get_first_name(i1), familia_individual_get_first_name(i2));
+ }
+ printf("\t Parents:\n");
+ f = familia_individual_get_parents(individual);
+ i1 = familia_family_get_individual(f, Individual1);
+ i2 = familia_family_get_individual(f, Individual2);
+
+ printf("\t > %s&%s\n", familia_individual_get_first_name(i1), familia_individual_get_first_name(i2));
+ }
+ }
+
+
+ for (i = 0; i < storage->families_no; i++) {
+ int j;
+ struct familia_individual * i1 = NULL;
+ struct familia_individual * i2 = NULL;
+
+ family = storage->families[i];
+
+ printf("Family (%d)\n", family->id);
+ i1 = familia_family_get_individual(family, Individual1);
+ i2 = familia_family_get_individual(family, Individual2);
+ printf("\t First parent: %s\n", familia_individual_get_first_name(i1));
+ printf("\t Second parent: %s\n", familia_individual_get_first_name(i2));
+
+ printf("\t Children:\n");
+ if (family->children_no > 0) {
+ for (j = 0; j < family->children_no; j++) {
+ i1 = family->children[j];
+ printf("\t > %s\n", familia_individual_get_first_name(i1));
+ }
+ }
+ }
+}
*/
void familia_storage_remove_family_by_id(struct familia_storage * storage, unsigned int id);
+void familia_storage_dump_all();
+
#endif /*_FAMILIA_STORAGE_H */