[mednaffe] 79/99: Loading emulator options fixed

Stephen Kitt skitt at moszumanska.debian.org
Tue Aug 2 21:00:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

skitt pushed a commit to branch master
in repository mednaffe.

commit 3e9ae4a6e63cbdaed30974fc62f5ae653e6593f5
Author: AmatCoder <amatcoder at gmail.com>
Date:   Tue Jul 21 11:18:09 2015 +0200

    Loading emulator options fixed
---
 src/mednaffe.c |  4 +++-
 src/prefs.c    | 14 ++++++++++----
 src/prefs.h    |  3 ++-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/mednaffe.c b/src/mednaffe.c
index 2f111c4..2bdd804 100644
--- a/src/mednaffe.c
+++ b/src/mednaffe.c
@@ -330,6 +330,7 @@ int main(int argc, char **argv)
   guidata gui;
   const gchar *home = NULL;
   gchar *stout = NULL;
+  GKeyFile *key_file;
 
   /* Init GTK+ */
   gtk_init(&argc, &argv);
@@ -490,7 +491,7 @@ int main(int argc, char **argv)
   g_signal_connect(celltoggle, "toggled", G_CALLBACK(on_cell_toggled), &gui);
 
   /* Load preferences */
-  load_prefs(&gui);
+  key_file = load_prefs(&gui);
 
  /* Search for mednafen executable */
   if (gui.binpath==NULL)
@@ -571,6 +572,7 @@ version or above.\n");
   }
 
   /* Set values into gui */
+  if (key_file) load_emu_options(key_file, &gui);
   set_values(gui.builder, &gui);
   set_values(gui.specific, &gui);
   select_rows(&gui);
diff --git a/src/prefs.c b/src/prefs.c
index f9bb1e7..30d7aad 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -246,9 +246,10 @@ void load_emu_options(GKeyFile *key_file, guidata *gui)
     }
   }
   g_free(ffekeys);
+  g_key_file_free(key_file);
 }
 
-void load_prefs(guidata *gui)
+GKeyFile* load_prefs(guidata *gui)
 {
   gchar *conf_file;
   GKeyFile *key_file;
@@ -262,7 +263,7 @@ void load_prefs(guidata *gui)
     conf_file=g_strconcat(g_get_user_config_dir(), "/mednaffe.conf", NULL);
   #endif
 
-  key_file=g_key_file_new();
+  key_file = g_key_file_new();
   /*g_key_file_set_list_separator(key_file,  0x0D);*/
 
   if (g_key_file_load_from_file(key_file, conf_file,
@@ -370,8 +371,13 @@ void load_prefs(guidata *gui)
     }
 
     load_systems_showed(key_file, gui);
-    load_emu_options(key_file, gui);
   }
-  g_key_file_free(key_file);
+  else
+  {
+    g_key_file_free(key_file);
+    key_file = NULL;
+  }
   g_free(conf_file);
+
+  return key_file;
 }
diff --git a/src/prefs.h b/src/prefs.h
index 5cfb2cd..90576c4 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -24,6 +24,7 @@
 #define PREFS_H
 
   void save_prefs(guidata *gui);
-  void load_prefs(guidata *gui);
+  GKeyFile* load_prefs(guidata *gui);
+  void load_emu_options(GKeyFile *key_file, guidata *gui);
 
 #endif /* PREFS_H */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mednaffe.git



More information about the Pkg-games-commits mailing list