[easytag/wip/application-window: 20/95] Store default scanner masks in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 20/95] Store default scanner masks in GSettings
- Date: Wed, 3 Sep 2014 15:23:09 +0000 (UTC)
commit b3284fe87a9e245f8e0b090ea3feb0ae59cae11f
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 9269e07..4e4f2dd 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 c69089f..ce436d8 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -100,10 +100,7 @@ static gboolean Create_Easytag_Directory (void);
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 }
};
@@ -153,12 +150,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 119d973..301f154 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -260,10 +260,6 @@ GSettings *MainSettings;
/* Misc */
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]