plug-ins: more refactoring of metadata-editor.

There was a lot of duplicate code based on
whether or not value was NULL with for
some tags partially unreachable code.

We combine the parts and only test
value for NULL where needed.

Also rename the typos in enum
COL_REGSITRY_* to
COL_REGISTRY_*

(cherry picked from commit 0a0eeac1ad)
This commit is contained in:
Jacob Boerema
2021-03-09 22:18:04 -05:00
parent b0ab2b0e62
commit b40c29ac0a
3 changed files with 1125 additions and 1697 deletions

File diff suppressed because it is too large Load Diff

View File

@ -76,9 +76,9 @@ enum
enum enum
{ {
COL_REGSITRY_ORG_ID = 0, COL_REGISTRY_ORG_ID = 0,
COL_REGSITRY_ITEM_ID, COL_REGISTRY_ITEM_ID,
COL_REGSITRY_NUM_COLS COL_REGISTRY_NUM_COLS
}; };
enum enum

View File

@ -340,8 +340,8 @@ set_tag_ui (metadata_editor *args,
{ {
gtk_list_store_append (liststore, &iter); gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, gtk_list_store_set (liststore, &iter,
COL_REGSITRY_ORG_ID, list_tag_data[row][1], COL_REGISTRY_ORG_ID, list_tag_data[row][1],
COL_REGSITRY_ITEM_ID, list_tag_data[row][2], COL_REGISTRY_ITEM_ID, list_tag_data[row][2],
-1); -1);
for (item = 1; item < n_registryid + 1; item++) for (item = 1; item < n_registryid + 1; item++)
{ {
@ -359,8 +359,8 @@ set_tag_ui (metadata_editor *args,
{ {
gtk_list_store_append (liststore, &iter); gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, gtk_list_store_set (liststore, &iter,
COL_REGSITRY_ORG_ID, NULL, COL_REGISTRY_ORG_ID, NULL,
COL_REGSITRY_ITEM_ID, NULL, COL_REGISTRY_ITEM_ID, NULL,
-1); -1);
} }
} }
@ -721,8 +721,8 @@ get_tag_ui_list (metadata_editor *args, gchar *name, gchar *mode)
else if (!strcmp (REGISTRYID_HEADER, name)) else if (!strcmp (REGISTRYID_HEADER, name))
{ {
gtk_tree_model_get (treemodel, &iter, gtk_tree_model_get (treemodel, &iter,
COL_REGSITRY_ORG_ID, &tagdata[row][0], COL_REGISTRY_ORG_ID, &tagdata[row][0],
COL_REGSITRY_ITEM_ID, &tagdata[row][1], COL_REGISTRY_ITEM_ID, &tagdata[row][1],
-1); -1);
if ((tagdata[row][0] != NULL && strlen(tagdata[row][0]) > 0) || if ((tagdata[row][0] != NULL && strlen(tagdata[row][0]) > 0) ||