[easytag/wip/application-window: 41/41] Store default scanner masks in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 41/41] Store default scanner masks in GSettings
- Date: Fri, 4 Jul 2014 15:41:55 +0000 (UTC)
commit a793d1be92fe8f105cd9dee12be2dc44b3138e82
Author: David King <amigadave amigadave com>
Date: Sun Jun 29 14:52:54 2014 +0100
Store default scanner masks in GSettings
src/scan_dialog.c | 58 +++++++++++++++++++++++-----------------------------
src/setting.c | 11 +---------
src/setting.h | 4 ---
3 files changed, 27 insertions(+), 46 deletions(-)
---
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 7031722..3bdda48 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -2636,19 +2636,17 @@ create_scan_dialog (EtScanDialog *self)
G_CALLBACK (Scan_Fill_Tag_Generate_Preview),
self);
- // Load masks into the combobox from a file
- Load_Scan_Tag_Masks_List(priv->scan_tag_masks_model, MASK_EDITOR_TEXT, Scan_Masks);
- if (SCAN_TAG_DEFAULT_MASK)
- {
- Add_String_To_Combo_List(priv->scan_tag_masks_model, SCAN_TAG_DEFAULT_MASK);
- gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo))),
SCAN_TAG_DEFAULT_MASK);
- }else
- {
- gtk_combo_box_set_active(GTK_COMBO_BOX(priv->scan_tag_mask_combo), 0);
- }
-
- // Mask status icon
- // Signal connection to check if mask is correct into the mask entry
+ /* Load masks into the combobox from a file. */
+ Load_Scan_Tag_Masks_List (priv->scan_tag_masks_model, MASK_EDITOR_TEXT,
+ Scan_Masks);
+ g_settings_bind (MainSettings, "scan-tag-default-mask",
+ gtk_bin_get_child (GTK_BIN (priv->scan_tag_mask_combo)),
+ "text", G_SETTINGS_BIND_DEFAULT);
+ Add_String_To_Combo_List (priv->scan_tag_masks_model,
+ gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN
(priv->scan_tag_mask_combo)))));
+
+ /* Mask status icon. Signal connection to check if mask is correct in the
+ * mask entry. */
g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->scan_tag_mask_combo)),
"changed", G_CALLBACK (entry_check_scan_tag_mask),
NULL);
@@ -2708,19 +2706,17 @@ create_scan_dialog (EtScanDialog *self)
G_CALLBACK (Scan_Rename_File_Generate_Preview),
self);
- // Load masks into the combobox from a file
- Load_Rename_File_Masks_List(priv->rename_masks_model, MASK_EDITOR_TEXT, Rename_File_Masks);
- if (RENAME_FILE_DEFAULT_MASK)
- {
- Add_String_To_Combo_List(priv->rename_masks_model, RENAME_FILE_DEFAULT_MASK);
- gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo))),
RENAME_FILE_DEFAULT_MASK);
- }else
- {
- gtk_combo_box_set_active(GTK_COMBO_BOX(priv->rename_file_mask_combo), 0);
- }
-
- // Mask status icon
- // Signal connection to check if mask is correct into the mask entry
+ /* Load masks into the combobox from a file. */
+ Load_Rename_File_Masks_List (priv->rename_masks_model, MASK_EDITOR_TEXT,
+ Rename_File_Masks);
+ g_settings_bind (MainSettings, "rename-file-default-mask",
+ gtk_bin_get_child (GTK_BIN (priv->rename_file_mask_combo)),
+ "text", G_SETTINGS_BIND_DEFAULT);
+ Add_String_To_Combo_List (priv->rename_masks_model,
+ gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN
(priv->rename_file_mask_combo)))));
+
+ /* Mask status icon. Signal connection to check if mask is correct to the
+ * mask entry. */
g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->rename_file_mask_combo)),
"changed", G_CALLBACK (entry_check_rename_file_mask),
NULL);
@@ -3261,14 +3257,12 @@ et_scan_dialog_apply_changes (EtScanDialog *self)
priv = et_scan_dialog_get_instance_private (self);
/* Save default masks. */
- if (SCAN_TAG_DEFAULT_MASK) g_free(SCAN_TAG_DEFAULT_MASK);
- SCAN_TAG_DEFAULT_MASK =
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo)))));
- Add_String_To_Combo_List(priv->scan_tag_masks_model, SCAN_TAG_DEFAULT_MASK);
+ Add_String_To_Combo_List (priv->scan_tag_masks_model,
+ gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN
(priv->scan_tag_mask_combo)))));
Save_Rename_File_Masks_List(priv->scan_tag_masks_model, MASK_EDITOR_TEXT);
- if (RENAME_FILE_DEFAULT_MASK) g_free(RENAME_FILE_DEFAULT_MASK);
- RENAME_FILE_DEFAULT_MASK = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN
(priv->rename_file_mask_combo)))));
- Add_String_To_Combo_List(priv->rename_masks_model, RENAME_FILE_DEFAULT_MASK);
+ Add_String_To_Combo_List(priv->rename_masks_model,
+ gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN
(priv->rename_file_mask_combo)))));
Save_Rename_File_Masks_List(priv->rename_masks_model, MASK_EDITOR_TEXT);
}
diff --git a/src/setting.c b/src/setting.c
index 168582e..9c0fd81 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -104,10 +104,7 @@ static void set_sorting_indicator_for_column_id (EtApplicationWindow *self,
static const tConfigVariable Config_Variables[] =
{
- {"audio_file_player", CV_TYPE_STRING,&AUDIO_FILE_PLAYER },
-
- {"scan_tag_default_mask", CV_TYPE_STRING, &SCAN_TAG_DEFAULT_MASK },
- {"rename_file_default_mask", CV_TYPE_STRING, &RENAME_FILE_DEFAULT_MASK },
+ {"audio_file_player", CV_TYPE_STRING,&AUDIO_FILE_PLAYER }
};
@@ -157,12 +154,6 @@ void Init_Config_Variables (void)
#else /* !G_OS_WIN32 */
AUDIO_FILE_PLAYER = g_strdup("xdg-open");
#endif /* !G_OS_WIN32 */
-
- /*
- * Masks
- */
- SCAN_TAG_DEFAULT_MASK = NULL;
- RENAME_FILE_DEFAULT_MASK = NULL;
}
diff --git a/src/setting.h b/src/setting.h
index f4d0bad..98e75bc 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -262,10 +262,6 @@ gint SORTING_FILE_MODE;
gchar *AUDIO_FILE_PLAYER;
-/* Default mask */
-gchar *SCAN_TAG_DEFAULT_MASK;
-gchar *RENAME_FILE_DEFAULT_MASK;
-
/**************
* Prototypes *
**************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]