inform the application about the plugin state
This commit is contained in:
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Mon Mar 04 18:28:49 EST 2024
|
#Mon Mar 04 20:11:29 EST 2024
|
||||||
build.number=628
|
build.number=640
|
||||||
|
@ -144,20 +144,6 @@ public class I2PBrowser extends I2PGenericUnsafeBrowser {
|
|||||||
*/
|
*/
|
||||||
public void launch(int privateWindow, String[] url) {
|
public void launch(int privateWindow, String[] url) {
|
||||||
validateUserDirectory();
|
validateUserDirectory();
|
||||||
if (generic) {
|
|
||||||
this.launchGeneric(privateWindow, url);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((chromium && firefox) || (!chromium && !firefox)) {
|
|
||||||
if (this.hasFirefox()) {
|
|
||||||
this.launchFirefox(privateWindow, url);
|
|
||||||
} else if (this.hasChromium()) {
|
|
||||||
this.launchChromium(privateWindow, url);
|
|
||||||
} else {
|
|
||||||
this.launchGeneric(privateWindow, url);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (chromiumFirst) {
|
if (chromiumFirst) {
|
||||||
if (chromium) {
|
if (chromium) {
|
||||||
this.launchChromium(privateWindow, url);
|
this.launchChromium(privateWindow, url);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package net.i2p.i2pfirefox.plugin;
|
package net.i2p.i2pfirefox.plugin;
|
||||||
|
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.app.ClientApp;
|
import net.i2p.app.ClientApp;
|
||||||
import net.i2p.app.ClientAppManager;
|
import net.i2p.app.ClientAppManager;
|
||||||
@ -10,6 +12,7 @@ import net.i2p.app.MenuHandle;
|
|||||||
import net.i2p.app.MenuService;
|
import net.i2p.app.MenuService;
|
||||||
import net.i2p.desktopgui.ExternalMain;
|
import net.i2p.desktopgui.ExternalMain;
|
||||||
import net.i2p.i2pfirefox.I2PBrowser;
|
import net.i2p.i2pfirefox.I2PBrowser;
|
||||||
|
import net.i2p.i2pfirefox.I2PFirefox;
|
||||||
import net.i2p.util.I2PAppThread;
|
import net.i2p.util.I2PAppThread;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
import net.i2p.util.SystemVersion;
|
import net.i2p.util.SystemVersion;
|
||||||
@ -38,12 +41,17 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
|
|||||||
private final ClientAppManager _mgr;
|
private final ClientAppManager _mgr;
|
||||||
private final String _args[];
|
private final String _args[];
|
||||||
private static final String PROP_DTG_ENABLED = "desktopgui.enabled";
|
private static final String PROP_DTG_ENABLED = "desktopgui.enabled";
|
||||||
private final I2PBrowser i2pBrowser = new I2PBrowser();
|
private final I2PBrowser i2pBrowser;
|
||||||
|
private final File pluginDir;
|
||||||
|
private final File profileDir;
|
||||||
public I2PBrowserPlugin() {
|
public I2PBrowserPlugin() {
|
||||||
_context = new I2PAppContext();
|
_context = new I2PAppContext();
|
||||||
_mgr = null;
|
_mgr = null;
|
||||||
_args = new String[] {};
|
_args = new String[] {};
|
||||||
_log = _context.logManager().getLog(I2PBrowserPlugin.class);
|
_log = _context.logManager().getLog(I2PBrowserPlugin.class);
|
||||||
|
pluginDir = new File(_context.getAppDir(), "plugins/i2pfirefox/");
|
||||||
|
profileDir = new File(pluginDir, "profile/");
|
||||||
|
i2pBrowser = new I2PBrowser(profileDir.getAbsolutePath());
|
||||||
}
|
}
|
||||||
public I2PBrowserPlugin(I2PAppContext ctx, ClientAppManager mgr,
|
public I2PBrowserPlugin(I2PAppContext ctx, ClientAppManager mgr,
|
||||||
String args[]) {
|
String args[]) {
|
||||||
@ -51,6 +59,9 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
|
|||||||
_mgr = mgr;
|
_mgr = mgr;
|
||||||
_args = args;
|
_args = args;
|
||||||
_log = ctx.logManager().getLog(I2PBrowserPlugin.class);
|
_log = ctx.logManager().getLog(I2PBrowserPlugin.class);
|
||||||
|
pluginDir = new File(_context.getAppDir(), "plugins/i2pfirefox/");
|
||||||
|
profileDir = new File(pluginDir, "profile/");
|
||||||
|
i2pBrowser = new I2PBrowser(profileDir.getAbsolutePath());
|
||||||
}
|
}
|
||||||
public String getDisplayName() { return "I2P Browser"; }
|
public String getDisplayName() { return "I2P Browser"; }
|
||||||
public String getName() { return "I2P Browser"; }
|
public String getName() { return "I2P Browser"; }
|
||||||
@ -69,6 +80,7 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
|
|||||||
if (!isSystrayEnabled()) {
|
if (!isSystrayEnabled()) {
|
||||||
System.out.println("I2P Browser tray manager not supported");
|
System.out.println("I2P Browser tray manager not supported");
|
||||||
i2pBrowser.stop();
|
i2pBrowser.stop();
|
||||||
|
changeState(ClientAppState.STOPPED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +170,10 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
|
|||||||
* @since 0.9.61
|
* @since 0.9.61
|
||||||
*/
|
*/
|
||||||
public class StarterThread implements Runnable {
|
public class StarterThread implements Runnable {
|
||||||
public void run() { i2pBrowser.launch(false); }
|
public void run() {
|
||||||
|
i2pBrowser.launch(false);
|
||||||
|
changeState(ClientAppState.RUNNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,8 +197,16 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
|
|||||||
* @since 0.9.61
|
* @since 0.9.61
|
||||||
*/
|
*/
|
||||||
public class StopperThread implements Runnable {
|
public class StopperThread implements Runnable {
|
||||||
public void run() { i2pBrowser.stop(); }
|
public void run() {
|
||||||
|
i2pBrowser.stop();
|
||||||
|
changeState(ClientAppState.STOPPED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void changeState(ClientAppState state) {
|
||||||
|
if (_mgr != null)
|
||||||
|
_mgr.notify(this, state, null, null);
|
||||||
|
}
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
I2PBrowserPlugin plugin = new I2PBrowserPlugin();
|
I2PBrowserPlugin plugin = new I2PBrowserPlugin();
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user