]> git.sesse.net Git - vlc/commitdiff
control: move CONSOLE_INTRO_MSG to a private header
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 2 Mar 2015 20:44:17 +0000 (22:44 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 2 Mar 2015 20:45:12 +0000 (22:45 +0200)
include/vlc_interface.h
modules/control/Makefile.am
modules/control/dummy.c
modules/control/intromsg.h [new file with mode: 0644]
modules/control/rc.c

index f5a888dbbb047b5fc310e148d09dc91c4d7bace3..ca1c5646b318f4bff1b852db87098d4ff05ee3aa 100644 (file)
@@ -114,25 +114,6 @@ VLC_API void vlc_LogSet(libvlc_int_t *, vlc_log_cb cb, void *data);
 
 /*@}*/
 
-#if defined( _WIN32 ) && !VLC_WINSTORE_APP
-#    define CONSOLE_INTRO_MSG \
-         if( !getenv( "PWD" ) ) /* detect Cygwin shell or Wine */ \
-         { \
-         AllocConsole(); \
-         freopen( "CONOUT$", "w", stdout ); \
-         freopen( "CONOUT$", "w", stderr ); \
-         freopen( "CONIN$", "r", stdin ); \
-         } \
-         msg_Info( p_intf, "VLC media player - %s", VERSION_MESSAGE ); \
-         msg_Info( p_intf, "%s", COPYRIGHT_MESSAGE ); \
-         msg_Info( p_intf, _("\nWarning: if you cannot access the GUI " \
-                             "anymore, open a command-line window, go to the " \
-                             "directory where you installed VLC and run " \
-                             "\"vlc -I qt\"\n") )
-#else
-#    define CONSOLE_INTRO_MSG (void)0
-#endif
-
 /* Interface dialog ids for dialog providers */
 typedef enum vlc_dialog {
     INTF_DIALOG_FILE_SIMPLE = 1,
index f4d0d6a66f6e514c0e496be741824beb07d6ffae..70a8486277c34bef72e71ddb89de57667085f48c 100644 (file)
@@ -1,12 +1,12 @@
 controldir = $(pluginsdir)/control
 
-libdummy_plugin_la_SOURCES = control/dummy.c
+libdummy_plugin_la_SOURCES = control/dummy.c control/intromsg.h
 libgestures_plugin_la_SOURCES = control/gestures.c
 libhotkeys_plugin_la_SOURCES = control/hotkeys.c
 libhotkeys_plugin_la_LIBADD = $(LIBM)
 libnetsync_plugin_la_SOURCES = control/netsync.c
 libnetsync_plugin_la_LIBADD = $(SOCKET_LIBS)
-liboldrc_plugin_la_SOURCES = control/rc.c
+liboldrc_plugin_la_SOURCES = control/rc.c control/intromsg.h
 liboldrc_plugin_la_LIBADD = $(SOCKET_LIBS) $(LIBM)
 
 control_LTLIBRARIES = \
index c0bc3cd6ec29c6f276056c1db9e8d2299e9d91f6..e541698c5a4ed4670b67444aabf34f2d67eea26e 100644 (file)
@@ -40,6 +40,7 @@
     "Enabling the quiet mode will not bring this command box but can also " \
     "be pretty annoying when you want to stop VLC and no video window is " \
     "open." )
+#include "intromsg.h"
 #endif
 
 static int Open( vlc_object_t * );
@@ -65,7 +66,7 @@ static int Open( vlc_object_t *p_this )
     bool b_quiet;
     b_quiet = var_InheritBool( p_intf, "dummy-quiet" );
     if( !b_quiet )
-        CONSOLE_INTRO_MSG;
+        intf_consoleIntroMsg(p_intf);
 #endif
 
     msg_Info( p_intf, "using the dummy interface module..." );
diff --git a/modules/control/intromsg.h b/modules/control/intromsg.h
new file mode 100644 (file)
index 0000000..7af9520
--- /dev/null
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * intromsg.h
+ *****************************************************************************
+ * Copyright (C) 1999-2015 VLC authors and VideoLAN
+ * $Id$
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+static inline void intf_consoleIntroMsg(intf_thread_t *intf)
+{
+    if (getenv( "PWD" ) == NULL) /* detect Cygwin shell or Wine */
+    {
+        AllocConsole();
+        freopen("CONOUT$", "w", stdout);
+        freopen("CONOUT$", "w", stderr);
+        freopen("CONIN$", "r", stdin);
+    }
+
+    msg_Info(intf, "VLC media player - %s", VERSION_MESSAGE);
+    msg_Info(intf, "%s", COPYRIGHT_MESSAGE);
+    msg_Info(intf, _("\nWarning: if you cannot access the GUI "
+                     "anymore, open a command-line window, go to the "
+                     "directory where you installed VLC and run "
+                     "\"vlc -I qt\"\n"));
+}
index d3c8673a402e405a8dc04bdf812dd7572ce95e71..efa1893f00c281c47e0e278afc4ae03c468c8dc8 100644 (file)
@@ -178,6 +178,7 @@ static void msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
     "Enabling the quiet mode will not bring this command box but can also " \
     "be pretty annoying when you want to stop VLC and no video window is " \
     "open." )
+#include "intromsg.h"
 #endif
 
 vlc_module_begin ()
@@ -342,7 +343,7 @@ static int Activate( vlc_object_t *p_this )
     p_sys->b_quiet = var_InheritBool( p_intf, "rc-quiet" );
 # if !VLC_WINSTORE_APP
     if( !p_sys->b_quiet )
-        CONSOLE_INTRO_MSG;
+        intf_consoleIntroMsg( p_intf );
 # endif
 #endif