gnome-split-team team mailing list archive
-
gnome-split-team team
-
Mailing list archive
-
Message #00048
[Branch ~respawneral/gnome-split/mainline] Rev 232: Rework GNOME Split constructor.
------------------------------------------------------------
revno: 232
committer: Guillaume Mazoyer <respawneral@xxxxxxxxx>
branch nick: gnome-split
timestamp: Wed 2010-09-15 21:54:43 +0200
message:
Rework GNOME Split constructor.
Use few methods to build the main object by step.
In this way, it will be easier to tweak the code
and to search for errors.
modified:
po/gnome-split.pot
src/org/gnome/split/GnomeSplit.java
src/org/gnome/split/gtk/MainWindow.java
--
lp:gnome-split
https://code.launchpad.net/~respawneral/gnome-split/mainline
Your team GNOME Split developers is subscribed to branch lp:gnome-split.
To unsubscribe from this branch go to https://code.launchpad.net/~respawneral/gnome-split/mainline/+edit-subscription
=== modified file 'po/gnome-split.pot'
--- po/gnome-split.pot 2010-09-08 22:17:00 +0000
+++ po/gnome-split.pot 2010-09-15 19:54:43 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-09-08 23:41+0200\n"
+"POT-Creation-Date: 2010-09-09 17:13+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -171,22 +171,22 @@
msgid "GNOME Split activity"
msgstr ""
-#: src/org/gnome/split/GnomeSplit.java:109
+#: src/org/gnome/split/GnomeSplit.java:152
msgid "More than one instance."
msgstr ""
-#: src/org/gnome/split/GnomeSplit.java:110
+#: src/org/gnome/split/GnomeSplit.java:153
msgid ""
"Only one instance of GNOME Split can be executed at a time. If you want to "
"run multiple instances, edit the preferences. Remember that it is never safe "
"to run more than one instance of GNOME Split."
msgstr ""
-#: src/org/gnome/split/GnomeSplit.java:276
+#: src/org/gnome/split/GnomeSplit.java:300
msgid "Quit GNOME Split."
msgstr ""
-#: src/org/gnome/split/GnomeSplit.java:277
+#: src/org/gnome/split/GnomeSplit.java:301
msgid ""
"An action is currently being perfomed. Do you really want to quit GNOME "
"Split?"
=== modified file 'src/org/gnome/split/GnomeSplit.java'
--- src/org/gnome/split/GnomeSplit.java 2010-09-05 21:11:31 +0000
+++ src/org/gnome/split/GnomeSplit.java 2010-09-15 19:54:43 +0000
@@ -88,6 +88,44 @@
// Load GTK
Gtk.init(args);
+ // Load config
+ this.loadConfig();
+
+ // Check if an instance is running
+ this.checkRunning();
+
+ // Load logo
+ Gtk.setDefaultIcon(Constants.PROGRAM_LOGO);
+
+ // Load translations
+ Internationalization.init("gnome-split", "share/locale/");
+
+ // Load libnotify
+ if (config.USE_NOTIFICATION) {
+ Notify.init(Constants.PROGRAM_NAME);
+ }
+
+ // Build the user interface
+ this.buildUserInterface();
+
+ // If there are some arguments
+ if (args.length > 0) {
+ this.parseCommandLine(args);
+ } else {
+ if (config.ASSISTANT_ON_START) {
+ // Show the assistant on start if requested
+ actions.activateAction(ActionId.ASSISTANT);
+ }
+ }
+
+ // Start GTK main loop (blocker method)
+ Gtk.main();
+ }
+
+ /**
+ * Load the configuration and preferences.
+ */
+ private void loadConfig() {
try {
// Load constants and preferences
Constants.load();
@@ -96,7 +134,12 @@
e.printStackTrace();
System.exit(1);
}
+ }
+ /**
+ * Check if an instance of GNOME Split is already running.
+ */
+ private void checkRunning() {
// Initialize unique application check
Application application = new Application("org.gnome.GnomeSplit", null);
@@ -122,18 +165,12 @@
// Quit the current app
System.exit(1);
}
-
- // Load logo
- Gtk.setDefaultIcon(Constants.PROGRAM_LOGO);
-
- // Load translations
- Internationalization.init("gnome-split", "share/locale/");
-
- // Load libnotify
- if (config.USE_NOTIFICATION) {
- Notify.init(Constants.PROGRAM_NAME);
- }
-
+ }
+
+ /**
+ * Build the GTK+ user interface.
+ */
+ private void buildUserInterface() {
// Load actions manager
actions = new ActionManager(this);
@@ -144,19 +181,6 @@
// Load engine listener
engine = new DefaultEngineListener(this);
-
- // If there are some arguments
- if (args.length > 0) {
- this.parseCommandLine(args);
- } else {
- if (config.ASSISTANT_ON_START) {
- // Show the assistant on start if requested
- actions.activateAction(ActionId.ASSISTANT);
- }
- }
-
- // Start GTK main loop (blocker method)
- Gtk.main();
}
/**
@@ -217,7 +241,7 @@
}
}
- // No options have been used, this is just a file that has been giver
+ // No options have been used, this is just a file that has been given
if (!args[0].startsWith("-")) {
// Update the view, checking the file extension
byte select = (byte) (Algorithm.isValidExtension(args[0]) ? 1 : 0);
=== modified file 'src/org/gnome/split/gtk/MainWindow.java'
--- src/org/gnome/split/gtk/MainWindow.java 2010-08-21 15:57:36 +0000
+++ src/org/gnome/split/gtk/MainWindow.java 2010-09-15 19:54:43 +0000
@@ -330,7 +330,7 @@
*/
public void selectDefaultView() {
// Get the default view
- int view = app.getConfig().DEFAULT_VIEW;
+ byte view = app.getConfig().DEFAULT_VIEW;
// The merge view is the default one
if (view == 1) {