30 #include "YCommandLine.h"
31 #include "YUILoader.h"
32 #include "YUIPlugin.h"
33 #include "YUIException.h"
36 #include "Libyui_config.h"
41 const char * envDisplay = getenv(
"DISPLAY" );
45 bool wantNcurses = cmdline.
find(
"--ncurses") != -1;
46 bool wantQt = cmdline.
find(
"--qt") != -1;
47 bool wantGtk = cmdline.
find(
"--gtk") != -1;
49 bool haveQt = pluginExists( YUIPlugin_Qt );
50 bool haveGtk = pluginExists( YUIPlugin_Gtk );
52 if ( envDisplay && !wantNcurses )
54 std::string wantedGUI;
56 if ( haveQt && !wantGtk)
57 wantedGUI = YUIPlugin_Qt;
58 else if ( haveGtk && !wantQt )
59 wantedGUI = YUIPlugin_Gtk;
61 if ( strcmp( wantedGUI.c_str(),
"" ) )
75 if ( isatty( STDOUT_FILENO ) )
103 if ( uiPlugin.success() )
105 createUIFunction_t createUI = (createUIFunction_t) uiPlugin.locateSymbol(
"_Z8createUIb" );
109 YUI * ui = createUI( withThreads );
119 bool YUILoader::pluginExists(
const std::string & pluginBaseName )
121 struct stat fileinfo;
122 std::string pluginName = PLUGIN_PREFIX;
124 pluginName.append( pluginBaseName );
125 pluginName.append( PLUGIN_SUFFIX );
127 YPath plugin ( PLUGINDIR, pluginName );
129 return stat( plugin.path().c_str(), &fileinfo) == 0;
static void loadPlugin(const std::string &name, bool withThreads=false)
int find(const std::string &argName) const
static void loadUI(bool withThreads=false)