29 #include <glib/gi18n.h> 36 typedef struct _pending_matches
38 gint num_manual_matches;
39 gint num_auto_matches;
42 GNCImportPendingMatches *gnc_import_PendingMatches_new (
void)
53 void gnc_import_PendingMatches_delete (GNCImportPendingMatches *map)
55 g_return_if_fail (map);
57 g_hash_table_destroy (map);
66 g_return_val_if_fail (match_info, NULL);
75 gnc_import_PendingMatches_get_value (GNCImportPendingMatches *map,
80 g_return_val_if_fail (map, NULL);
81 g_return_val_if_fail (match_info, NULL);
83 match_guid = gnc_import_PendingMatches_get_key (match_info);
89 gnc_import_PendingMatches_add_match (GNCImportPendingMatches *map,
91 gboolean selected_manually)
97 g_return_if_fail (map);
98 g_return_if_fail (match_info);
101 pending_matches = gnc_import_PendingMatches_get_value (map, match_info);
102 match_guid = gnc_import_PendingMatches_get_key (match_info);
104 if (pending_matches == NULL)
109 g_hash_table_insert (map, key, pending_matches);
112 if (selected_manually)
114 pending_matches->num_manual_matches++;
118 pending_matches->num_auto_matches++;
123 gnc_import_PendingMatches_remove_match (GNCImportPendingMatches *map,
125 gboolean selected_manually)
129 g_return_if_fail (map);
130 g_return_if_fail (match_info);
132 pending_matches = gnc_import_PendingMatches_get_value (map, match_info);
134 g_return_if_fail (pending_matches);
136 if (selected_manually)
138 pending_matches->num_manual_matches--;
142 pending_matches->num_auto_matches--;
145 if (pending_matches->num_auto_matches == 0 &&
146 pending_matches->num_manual_matches == 0)
149 g_hash_table_remove (map,
150 gnc_import_PendingMatches_get_key (match_info));
154 GNCImportPendingMatchType
155 gnc_import_PendingMatches_get_match_type (GNCImportPendingMatches *map,
160 g_return_val_if_fail (map, GNCImportPending_NONE);
161 g_return_val_if_fail (match_info, GNCImportPending_NONE);
163 pending_matches = gnc_import_PendingMatches_get_value (map, match_info);
165 if (pending_matches == NULL)
167 return GNCImportPending_NONE;
170 if (pending_matches->num_manual_matches > 0)
172 return GNCImportPending_MANUAL;
175 if (pending_matches->num_auto_matches > 0)
177 return GNCImportPending_AUTO;
180 g_assert_not_reached();
184 gnc_import_PendingMatches_get_type_str (GNCImportPendingMatchType type)
188 case GNCImportPending_NONE:
190 case GNCImportPending_MANUAL:
192 case GNCImportPending_AUTO:
195 g_assert_not_reached();
const GncGUID * qof_instance_get_guid(gconstpointer inst)
Return the GncGUID of this instance.
Tracking container for pending match status.
Generic importer backend interface.
globally unique ID User API
guint guid_hash_to_guint(gconstpointer ptr)
Hash function for a GUID.
Split * gnc_import_MatchInfo_get_split(const GNCImportMatchInfo *info)
Get the split ('this-side split') of this MatchInfo.
The type used to store guids in C.
gint guid_g_hash_table_equal(gconstpointer guid_a, gconstpointer guid_b)
Equality function for two GUIDs in a GHashTable.