Commit de4c527a authored by Antoine Cellerier's avatar Antoine Cellerier

Activate 2 more one instance mode optins with DBus

Now that we have a one instance mode with DBus under linux, also make
it possible to use the "one-instance-when-started-from-file" and
"started-from-file" options.
Consider using --started-from-file in the file association scripts,
like what we do in the win32 NSIS script, so that all files opened
through the GUI are enqueued/played in the same instance.
(cherry picked from commit a8821cd8)
parent a07d237e
......@@ -1041,16 +1041,16 @@ static const char *const ppsz_clock_descriptions[] =
#define SYSLOG_LONGTEXT N_( \
"Log all VLC messages to syslog (UNIX systems)." )
#define ONEINSTANCE_WIN_TEXT N_("Allow only one running instance")
#define ONEINSTANCE_WIN_LONGTEXT N_( \
#define ONEINSTANCE_TEXT N_("Allow only one running instance")
#if defined( WIN32 )
#define ONEINSTANCE_LONGTEXT N_( \
"Allowing only one running instance of VLC can sometimes be useful, " \
"for example if you associated VLC with some media types and you " \
"don't want a new instance of VLC to be opened each time you " \
"double-click on a file in the explorer. This option will allow you " \
"to play the file with the already running instance or enqueue it.")
#define ONEINSTANCE_DBUS_TEXT ONEINSTANCE_WIN_TEXT
#define ONEINSTANCE_DBUS_LONGTEXT N_( \
#elif defined( HAVE_DBUS )
#define ONEINSTANCE_LONGTEXT N_( \
"Allowing only one running instance of VLC can sometimes be useful, " \
"for example if you associated VLC with some media types and you " \
"don't want a new instance of VLC to be opened each time you " \
......@@ -1058,6 +1058,7 @@ static const char *const ppsz_clock_descriptions[] =
"to play the file with the already running instance or enqueue it. " \
"This option require the D-Bus session daemon to be active " \
"and the running instance of VLC to use D-Bus control interface.")
#endif
#define STARTEDFROMFILE_TEXT N_("VLC is started from file association")
#define STARTEDFROMFILE_LONGTEXT N_( \
......@@ -1869,18 +1870,13 @@ vlc_module_begin();
#endif
#if defined(HAVE_DBUS)
add_bool( "one-instance", 0, NULL, ONEINSTANCE_DBUS_TEXT,
ONEINSTANCE_DBUS_LONGTEXT, true );
add_bool( "playlist-enqueue", 0, NULL, PLAYLISTENQUEUE_TEXT,
PLAYLISTENQUEUE_LONGTEXT, true );
add_bool( "inhibit", 1, NULL, INHIBIT_TEXT,
INHIBIT_LONGTEXT, true );
#endif
#if defined(WIN32)
add_bool( "one-instance", 0, NULL, ONEINSTANCE_WIN_TEXT,
ONEINSTANCE_WIN_LONGTEXT, true );
#if defined(WIN32) || defined(HAVE_DBUS)
add_bool( "one-instance", 0, NULL, ONEINSTANCE_TEXT,
ONEINSTANCE_LONGTEXT, true );
add_bool( "started-from-file", 0, NULL, STARTEDFROMFILE_TEXT,
STARTEDFROMFILE_LONGTEXT, true );
change_internal();
......@@ -1891,6 +1887,9 @@ vlc_module_begin();
add_bool( "playlist-enqueue", 0, NULL, PLAYLISTENQUEUE_TEXT,
PLAYLISTENQUEUE_LONGTEXT, true );
change_unsaveable();
#endif
#if defined(WIN32)
add_bool( "high-priority", 0, NULL, HPRIORITY_TEXT,
HPRIORITY_LONGTEXT, false );
change_need_restart();
......
......@@ -536,7 +536,9 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
#ifdef HAVE_DBUS
dbus_threads_init_default();
if( config_GetInt( p_libvlc, "one-instance" ) > 0 )
if( config_GetInt( p_libvlc, "one-instance" ) > 0
|| ( config_GetInt( p_libvlc, "one-instance-when-started-from-file" )
&& config_GetInt( p_libvlc, "started-from-file" ) ) )
{
/* Initialise D-Bus interface, check for other instances */
DBusConnection *p_conn = NULL;
......@@ -834,7 +836,9 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
#ifdef HAVE_DBUS
/* loads dbus control interface if in one-instance mode
* we do it only when playlist exists, because dbus module needs it */
if( config_GetInt( p_libvlc, "one-instance" ) > 0 )
if( config_GetInt( p_libvlc, "one-instance" ) > 0
|| ( config_GetInt( p_libvlc, "one-instance-when-started-from-file" )
&& config_GetInt( p_libvlc, "started-from-file" ) ) )
libvlc_InternalAddIntf( p_libvlc, "dbus,none" );
/* Prevents the power management daemon from suspending the system
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment