[easytag/wip/application-window: 6/54] Move dialog setting saving to application window



commit 5c944af801b24b4806801f63e159c733b54cfe21
Author: David King <amigadave amigadave com>
Date:   Sat Jul 19 23:27:37 2014 +0100

    Move dialog setting saving to application window

 src/application_window.c |   73 ++++++++++++++++------------------------------
 src/application_window.h |    5 +--
 src/easytag.c            |    4 +-
 src/setting.c            |   30 -------------------
 src/setting.h            |    2 -
 5 files changed, 28 insertions(+), 86 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index 4ded09b..13d7975 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -1807,42 +1807,6 @@ et_application_window_get_log_area (EtApplicationWindow *self)
     return priv->log_area;
 }
 
-GtkWidget *
-et_application_window_get_load_files_dialog (EtApplicationWindow *self)
-{
-    EtApplicationWindowPrivate *priv;
-
-    g_return_val_if_fail (self != NULL, NULL);
-
-    priv = et_application_window_get_instance_private (self);
-
-    return priv->load_files_dialog;
-}
-
-GtkWidget *
-et_application_window_get_search_dialog (EtApplicationWindow *self)
-{
-    EtApplicationWindowPrivate *priv;
-
-    g_return_val_if_fail (self != NULL, NULL);
-
-    priv = et_application_window_get_instance_private (self);
-
-    return priv->search_dialog;
-}
-
-GtkWidget *
-et_application_window_get_preferences_dialog (EtApplicationWindow *self)
-{
-    EtApplicationWindowPrivate *priv;
-
-    g_return_val_if_fail (self != NULL, NULL);
-
-    priv = et_application_window_get_instance_private (self);
-
-    return priv->preferences_dialog;
-}
-
 void
 et_application_window_show_preferences_dialog_scanner (EtApplicationWindow *self)
 {
@@ -1860,18 +1824,6 @@ et_application_window_show_preferences_dialog_scanner (EtApplicationWindow *self
     et_preferences_dialog_show_scanner (ET_PREFERENCES_DIALOG (priv->preferences_dialog));
 }
 
-GtkWidget *
-et_application_window_get_cddb_dialog (EtApplicationWindow *self)
-{
-    EtApplicationWindowPrivate *priv;
-
-    g_return_val_if_fail (self != NULL, NULL);
-
-    priv = et_application_window_get_instance_private (self);
-
-    return priv->cddb_dialog;
-}
-
 void
 et_application_window_browser_toggle_display_mode (EtApplicationWindow *self)
 {
@@ -1990,6 +1942,31 @@ et_application_window_get_scan_dialog (EtApplicationWindow *self)
     return priv->scan_dialog;
 }
 
+void
+et_application_window_apply_changes (EtApplicationWindow *self)
+{
+    EtApplicationWindowPrivate *priv;
+
+    g_return_if_fail (ET_APPLICATION_WINDOW (self));
+
+    priv = et_application_window_get_instance_private (self);
+
+    if (priv->scan_dialog)
+    {
+        et_scan_dialog_apply_changes (ET_SCAN_DIALOG (priv->scan_dialog));
+    }
+
+    if (priv->cddb_dialog)
+    {
+        et_cddb_dialog_apply_changes (ET_CDDB_DIALOG (priv->cddb_dialog));
+    }
+
+    if (priv->search_dialog)
+    {
+        et_search_dialog_apply_changes (ET_SEARCH_DIALOG (priv->search_dialog));
+    }
+}
+
 /*
  * Disable (FALSE) / Enable (TRUE) all user widgets in the tag area
  */
diff --git a/src/application_window.h b/src/application_window.h
index c0fcdc7..b98ed87 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -60,11 +60,7 @@ void et_application_window_disable_command_actions (EtApplicationWindow *self);
 void et_application_window_update_actions (EtApplicationWindow *self);
 void et_application_window_tag_area_display_controls (EtApplicationWindow *self, ET_File *ETFile);
 GtkWidget * et_application_window_get_log_area (EtApplicationWindow *self);
-GtkWidget * et_application_window_get_load_files_dialog (EtApplicationWindow *self);
-GtkWidget * et_application_window_get_search_dialog (EtApplicationWindow *self);
-GtkWidget * et_application_window_get_preferences_dialog (EtApplicationWindow *self);
 void et_application_window_show_preferences_dialog_scanner (EtApplicationWindow *self);
-GtkWidget * et_application_window_get_cddb_dialog (EtApplicationWindow *self);
 void et_application_window_browser_toggle_display_mode (EtApplicationWindow *self);
 void et_application_window_browser_set_sensitive (EtApplicationWindow *self, gboolean sensitive);
 void et_application_window_browser_clear (EtApplicationWindow *self);
@@ -73,6 +69,7 @@ void et_application_window_browser_clear_artist_model (EtApplicationWindow *self
 void et_application_window_select_dir (EtApplicationWindow *self, const gchar *path);
 const gchar * et_application_window_get_current_path (EtApplicationWindow *self);
 GtkWidget * et_application_window_get_scan_dialog (EtApplicationWindow *self);
+void et_application_window_apply_changes (EtApplicationWindow *self);
 void et_application_window_browser_entry_set_text (EtApplicationWindow *self, const gchar *text);
 void et_application_window_browser_label_set_text (EtApplicationWindow *self, const gchar *text);
 ET_File * et_application_window_browser_get_et_file_from_path (EtApplicationWindow *self, GtkTreePath *path);
diff --git a/src/easytag.c b/src/easytag.c
index afa4606..5dd4dcd 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -1577,8 +1577,8 @@ EasyTAG_Exit (void)
 static void
 Quit_MainWindow_Confirmed (void)
 {
-    // Save the configuration when exiting...
-    Save_Changes_Of_UI();
+    /* Save the configuration when exiting. */
+    et_application_window_apply_changes (ET_APPLICATION_WINDOW (MainWindow));
     
     // Quit EasyTAG
     EasyTAG_Exit();
diff --git a/src/setting.c b/src/setting.c
index da231f4..c3cebeb 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -127,36 +127,6 @@ void Init_Config_Variables (void)
 }
 
 /*
- * Save into the config variables the settings of each window
- *  - Position/size of the window
- *  - Specific options in the window
- */
-static void
-Apply_Changes_Of_UI (void)
-{
-    /*
-     * Changes in user interface
-     */
-
-    /* Configuration of the scanner window (see scan_dialog.c).
-     * Function also called when destroying the window. */
-    et_scan_dialog_apply_changes (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
-
-    /* Configuration of the cddb window (see cddb_dialog.c).
-     * Function also called when destroying the window. */
-    et_cddb_dialog_apply_changes (ET_CDDB_DIALOG (et_application_window_get_cddb_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
-
-    /* Configuration of the search_file window (see search_dialog.c).
-     * Function also called when destroying the window. */
-    et_search_dialog_apply_changes (ET_SEARCH_DIALOG (et_application_window_get_search_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
-}
-
-void Save_Changes_Of_UI (void)
-{
-    Apply_Changes_Of_UI();
-}
-
-/*
  * check_or_create_file:
  * @filename: (type filename): the filename to create
  *
diff --git a/src/setting.h b/src/setting.h
index aadc341..5c7d357 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -239,8 +239,6 @@ GSettings *MainSettings;
 
 void Init_Config_Variables (void);
 
-void Save_Changes_Of_UI                  (void);
-
 gboolean Setting_Create_Files     (void);
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]