diff options
-rw-r--r-- | src/nautilus-batch-rename-dialog.c | 109 | ||||
-rw-r--r-- | src/nautilus-batch-rename-dialog.h | 4 | ||||
-rw-r--r-- | src/nautilus-batch-rename-utilities.c | 6 | ||||
-rw-r--r-- | src/nautilus-batch-rename-utilities.h | 4 |
4 files changed, 65 insertions, 58 deletions
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c index 9357d2555..21d09ccfb 100644 --- a/src/nautilus-batch-rename-dialog.c +++ b/src/nautilus-batch-rename-dialog.c @@ -120,6 +120,54 @@ typedef struct gboolean just_added; } TagData; +typedef struct +{ + const gchar *action_target_name; + const gchar *tag_text_represencation; + const gchar *label; +} TagConstants; + +typedef struct +{ + const gchar *action_target_name; + const gchar *label; + const SortMode sort_mode; +} SortConstants; + +static const SortConstants sorts_constants[] = +{ + { + "name-ascending", + N_("Original Name (Ascending)"), + ORIGINAL_ASCENDING, + }, + { + "name-descending", + N_("Original Name (Descending)"), + ORIGINAL_DESCENDING, + }, + { + "first-modified", + N_("First Modified"), + FIRST_MODIFIED, + }, + { + "last-modified", + N_("Last Modified"), + LAST_MODIFIED, + }, + { + "first-created", + N_("First Created"), + FIRST_CREATED, + }, + { + "last-created", + N_("Last Created"), + LAST_CREATED, + }, +}; + static void update_display_text (NautilusBatchRenameDialog *dialog); G_DEFINE_TYPE (NautilusBatchRenameDialog, nautilus_batch_rename_dialog, GTK_TYPE_DIALOG); @@ -131,63 +179,22 @@ add_numbering_order (GSimpleAction *action, { NautilusBatchRenameDialog *dialog; const gchar *target_name; + guint i; dialog = NAUTILUS_BATCH_RENAME_DIALOG (user_data); target_name = g_variant_get_string (value, NULL); - if (g_strcmp0 (target_name, "name-ascending") == 0) + for (i = 0; i < G_N_ELEMENTS (sorts_constants); i++) { - gtk_label_set_label (GTK_LABEL (dialog->numbering_order_label), - _("Original Name (Ascending)")); - dialog->selection = nautilus_batch_rename_dialog_sort (dialog->selection, - ORIGINAL_ASCENDING, - NULL); - } - - if (g_strcmp0 (target_name, "name-descending") == 0) - { - gtk_label_set_label (GTK_LABEL (dialog->numbering_order_label), - _("Original Name (Descending)")); - dialog->selection = nautilus_batch_rename_dialog_sort (dialog->selection, - ORIGINAL_DESCENDING, - NULL); - } - - if (g_strcmp0 (target_name, "first-modified") == 0) - { - gtk_label_set_label (GTK_LABEL (dialog->numbering_order_label), - _("First Modified")); - dialog->selection = nautilus_batch_rename_dialog_sort (dialog->selection, - FIRST_MODIFIED, - NULL); - } - - if (g_strcmp0 (target_name, "last-modified") == 0) - { - gtk_label_set_label (GTK_LABEL (dialog->numbering_order_label), - _("Last Modified")); - dialog->selection = nautilus_batch_rename_dialog_sort (dialog->selection, - LAST_MODIFIED, - NULL); - } - - if (g_strcmp0 (target_name, "first-created") == 0) - { - gtk_label_set_label (GTK_LABEL (dialog->numbering_order_label), - _("First Created")); - dialog->selection = nautilus_batch_rename_dialog_sort (dialog->selection, - FIRST_CREATED, - dialog->create_date); - } - - if (g_strcmp0 (target_name, "last-created") == 0) - { - gtk_label_set_label (GTK_LABEL (dialog->numbering_order_label), - _("Last Created")); - dialog->selection = nautilus_batch_rename_dialog_sort (dialog->selection, - LAST_CREATED, - dialog->create_date); + if (g_strcmp0 (sorts_constants[i].action_target_name, target_name) == 0) + { + gtk_label_set_label (GTK_LABEL (dialog->numbering_order_label), + gettext (sorts_constants[i].label)); + dialog->selection = nautilus_batch_rename_dialog_sort (dialog->selection, + sorts_constants[i].sort_mode, + NULL); + } } g_simple_action_set_state (action, value); diff --git a/src/nautilus-batch-rename-dialog.h b/src/nautilus-batch-rename-dialog.h index 3f11f4eaa..6f7858f3f 100644 --- a/src/nautilus-batch-rename-dialog.h +++ b/src/nautilus-batch-rename-dialog.h @@ -53,7 +53,7 @@ typedef enum { LAST_MODIFIED = 3, FIRST_CREATED = 4, LAST_CREATED = 5, -} SortingMode; +} SortMode; typedef struct { @@ -97,4 +97,4 @@ void check_conflict_for_files (Nautilus G_END_DECLS -#endif
\ No newline at end of file +#endif diff --git a/src/nautilus-batch-rename-utilities.c b/src/nautilus-batch-rename-utilities.c index a0a9ce1d3..c8826b33a 100644 --- a/src/nautilus-batch-rename-utilities.c +++ b/src/nautilus-batch-rename-utilities.c @@ -622,9 +622,9 @@ compare_files_by_last_created (gconstpointer a, } GList * -nautilus_batch_rename_dialog_sort (GList *selection, - SortingMode mode, - GHashTable *creation_date_table) +nautilus_batch_rename_dialog_sort (GList *selection, + SortMode mode, + GHashTable *creation_date_table) { GList *l, *l2; NautilusFile *file; diff --git a/src/nautilus-batch-rename-utilities.h b/src/nautilus-batch-rename-utilities.h index e343b25e3..9025cc8ab 100644 --- a/src/nautilus-batch-rename-utilities.h +++ b/src/nautilus-batch-rename-utilities.h @@ -38,7 +38,7 @@ GList* file_names_list_has_duplicates (NautilusBatchRenameD GCancellable *cancellable); GList* nautilus_batch_rename_dialog_sort (GList *selection, - SortingMode mode, + SortMode mode, GHashTable *creation_date_table); void check_metadata_for_selection (NautilusBatchRenameDialog *dialog, @@ -60,4 +60,4 @@ gboolean file_name_conflicts_with_results (GList *selection, GString* batch_rename_replace_label_text (gchar *label, const gchar *substr); -#endif /* NAUTILUS_BATCH_RENAME_UTILITIES_H */
\ No newline at end of file +#endif /* NAUTILUS_BATCH_RENAME_UTILITIES_H */ |