diff --git a/src/devede/add_files.py b/src/devede/add_files.py
index 7ea0f35..3339d73 100644
--- a/src/devede/add_files.py
+++ b/src/devede/add_files.py
@@ -17,14 +17,15 @@
from gi.repository import Gtk
import os
+import devede.configuration_data
class add_files:
last_path = None
- def __init__(self,config):
+ def __init__(self):
- self.config = config
+ self.config = devede.configuration_data.configuration.get_config()
self.show_title_options = True
def set_type(self,disc_type):
diff --git a/src/devede/ask.py b/src/devede/ask.py
index e482393..f37f45b 100644
--- a/src/devede/ask.py
+++ b/src/devede/ask.py
@@ -17,12 +17,13 @@
from gi.repository import Gtk
import os
+import devede.configuration_data
class ask_window:
- def __init__(self,config):
+ def __init__(self):
- self.config = config
+ self.config = devede.configuration_data.configuration.get_config()
def run(self,text,title):
diff --git a/src/devede/configuration_data.py b/src/devede/configuration_data.py
index 16ce94b..3aacb1b 100644
--- a/src/devede/configuration_data.py
+++ b/src/devede/configuration_data.py
@@ -21,6 +21,14 @@ import os
class configuration:
+ current_configuration = None
+
+ @staticmethod
+ def get_config():
+ if configuration.current_configuration == None:
+ configuration.current_configuration = configuration()
+ return configuration.current_configuration
+
def __init__(self):
self.error = False
diff --git a/src/devede/file_movie.py b/src/devede/file_movie.py
index 1e6ad94..6b55ab4 100644
--- a/src/devede/file_movie.py
+++ b/src/devede/file_movie.py
@@ -17,15 +17,16 @@
from gi.repository import Gtk,GObject
import os
+import devede.configuration_data
class file_movie(GObject.GObject):
counter2 = 0
- def __init__(self,config,file_name):
+ def __init__(self,file_name):
GObject.GObject.__init__(self)
- self.config = config
+ self.config = devede.configuration_data.configuration.get_config()
self.file_name = file_name
self.title_name = os.path.splitext(os.path.basename(file_name))[0]
self.wfile_properties = None
diff --git a/src/devede/project.py b/src/devede/project.py
index 74c330e..1634c44 100644
--- a/src/devede/project.py
+++ b/src/devede/project.py
@@ -24,9 +24,9 @@ import devede.add_files
class devede_project:
- def __init__(self,config):
+ def __init__(self):
- self.config = config
+ self.config = devede.configuration_data.configuration.get_config()
self.destroy_all()
@@ -206,18 +206,18 @@ class devede_project:
def on_wmain_window_delete_event(self,b,e=None):
- ask = devede.ask.ask_window(self.config)
+ ask = devede.ask.ask_window()
if (ask.run(_("Abort the current DVD and exit?"),_("Exit DeVeDe"))):
Gtk.main_quit()
return True
def on_add_file_clicked(self,b):
- ask_files = devede.add_files.add_files(self.config)
+ ask_files = devede.add_files.add_files()
ask_files.set_type(self.disc_type)
if (ask_files.run()):
for efile in ask_files.files:
- new_file = devede.file_movie.file_movie(self.config,efile)
+ new_file = devede.file_movie.file_movie(efile)
new_file.set_type(self.disc_type)
self.wliststore_files.append([new_file, new_file.title_name])
self.set_interface_status(None)
@@ -229,7 +229,7 @@ class devede_project:
if (element == None):
return
- ask_w = devede.ask.ask_window(self.config)
+ ask_w = devede.ask.ask_window()
if (ask_w.run(_("The file %(X)s (%(Y)s) will be removed.") % {"X":element.title_name, "Y":element.file_name},_("Delete file"))):
element.delete_file()
model.remove(treeiter)
diff --git a/src/devede_ng.py b/src/devede_ng.py
index 1d976b7..9af26e1 100755
--- a/src/devede_ng.py
+++ b/src/devede_ng.py
@@ -25,7 +25,7 @@ from gi.repository import Gtk
import devede.project
import devede.configuration_data
-config_data = devede.configuration_data.configuration()
+config_data = devede.configuration_data.configuration.get_config()
if config_data.error:
print ("Can't locate extra files. Aborting.")
@@ -43,7 +43,7 @@ _ = gettext.gettext
Gtk.init(sys.argv)
-mwindow = devede.project.devede_project(config_data)
+mwindow = devede.project.devede_project()
mwindow.ask_type()
Gtk.main()
config_data.save_config()