Hello community, here is the log from the commit of package libyui for openSUSE:Factory checked in at 2017-08-12 19:59:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libyui (Old) and /work/SRC/openSUSE:Factory/.libyui.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui" Sat Aug 12 19:59:11 2017 rev:32 rq:514211 version:3.3.3 Changes: -------- --- /work/SRC/openSUSE:Factory/libyui/libyui.changes 2016-12-01 10:25:35.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libyui.new/libyui.changes 2017-08-12 19:59:12.423370832 +0200 @@ -1,0 +2,27 @@ +Thu Aug 3 12:51:02 CEST 2017 - besse...@fedoraproject.org + +- CMake 3.9 warns about CMP0028 being obsolete +- 3.3.3 + +------------------------------------------------------------------- +Fri Apr 14 11:02:37 CEST 2017 - besse...@fedoraproject.org + +- Add $(ENV:YUI_PREFERED_BACKEND) to set prefered UI-backend +- Avoid several warnings from CMake +- 3.3.2 + +------------------------------------------------------------------- +Thu Apr 13 19:32:00 CEST 2017 - besse...@fedoraproject.org + +- Fix detection of Desktop Environments +- 3.3.1 + +------------------------------------------------------------------- +Thu Apr 13 10:44:07 CEST 2017 - besse...@fedoraproject.org + +- Add YSettings::loadedUI option (gh#libyui/libyui#35) +- Prefer Gtk-UI on Gtk-based desktop enviroments +- Bump SO-name and minor version for API-change +- 3.3.0 + +------------------------------------------------------------------- Old: ---- libyui-3.2.9.tar.bz2 New: ---- libyui-3.3.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libyui-doc.spec ++++++ --- /var/tmp/diff_new_pack.l5CG6u/_old 2017-08-12 19:59:13.279250951 +0200 +++ /var/tmp/diff_new_pack.l5CG6u/_new 2017-08-12 19:59:13.287249831 +0200 @@ -1,7 +1,7 @@ # # spec file for package libyui-doc # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,10 +17,10 @@ %define parent libyui -%define so_version 7 +%define so_version 8 Name: %{parent}-doc -Version: 3.2.9 +Version: 3.3.3 Release: 0 Source: %{parent}-%{version}.tar.bz2 ++++++ libyui.spec ++++++ --- /var/tmp/diff_new_pack.l5CG6u/_old 2017-08-12 19:59:13.355240308 +0200 +++ /var/tmp/diff_new_pack.l5CG6u/_new 2017-08-12 19:59:13.363239187 +0200 @@ -1,7 +1,7 @@ # # spec file for package libyui # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,18 @@ Name: libyui -Version: 3.2.9 +Version: 3.3.3 Release: 0 Source: %{name}-%{version}.tar.bz2 -%define so_version 7 +%define so_version 8 %define bin_name %{name}%{so_version} +%if 0%{?suse_version} > 1325 +BuildRequires: libboost_headers-devel +%else BuildRequires: boost-devel +%endif BuildRequires: cmake >= 2.8 BuildRequires: gcc-c++ BuildRequires: pkg-config @@ -65,8 +69,12 @@ %package devel -Requires: %{bin_name} = %{version} +%if 0%{?suse_version} > 1325 +Requires: libboost_headers-devel +%else Requires: boost-devel +%endif +Requires: %{bin_name} = %{version} Requires: glibc-devel Requires: libstdc++-devel ++++++ libyui-3.2.9.tar.bz2 -> libyui-3.3.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/.travis.yml new/libyui-3.3.3/.travis.yml --- old/libyui-3.2.9/.travis.yml 2016-11-25 14:41:08.902226503 +0100 +++ new/libyui-3.3.3/.travis.yml 2017-05-04 15:17:37.025375667 +0200 @@ -1,14 +1,11 @@ -language: cpp -compiler: - - gcc -# install additional packages -# http://docs.travis-ci.com/user/installing-dependencies/ +sudo: required +language: bash +services: + - docker + before_install: - - sudo apt-get update -qq - - sudo apt-get install -y libboost-dev + - docker build -t libyui-image . script: - - make -f Makefile.cvs - - cd build - - make -j 4 - - sudo make install - + # the "libyui-travis" script is included in the base libyui/devel image + # see https://github.com/libyui/docker-devel/blob/master/libyui-travis + - docker run -it libyui-image libyui-travis diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/Dockerfile new/libyui-3.3.3/Dockerfile --- old/libyui-3.2.9/Dockerfile 1970-01-01 01:00:00.000000000 +0100 +++ new/libyui-3.3.3/Dockerfile 2017-05-04 15:17:37.029375667 +0200 @@ -0,0 +1,4 @@ +# Use the libyui/devel image as the base +FROM libyui/devel + +COPY . /usr/src/app diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/README.md new/libyui-3.3.3/README.md --- old/libyui-3.2.9/README.md 2016-11-25 14:41:08.906226503 +0100 +++ new/libyui-3.3.3/README.md 2017-05-04 15:17:37.029375667 +0200 @@ -1,4 +1,70 @@ -![libYUI-boilerplate](http://img191.imageshack.us/img191/9364/libyui.png) +# LibYUI - The Base Library +[![Build Status](https://travis-ci.org/libyui/libyui.svg?branch=master)](https://travis-ci.org/libyui/libyui) -[![Build Status](https://travis-ci.org/libyui/libyui.png?branch=master)](https://travis-ci.org/libyui/libyui) +Libyui is a widget abstraction library providing Qt, GTK and ncurses +frontends. Originally it was developed for [YaST](https://yast.github.io/) +but it can be used in any independent project. + +This part contains the base abstraction layer which is implemented in several +target frontends. + + +### Selecting the used UI-plugin + +By default LibYUI tries to load any of the available UI-plugins in this order: + +* Qt: + - if $DISPLAY is set + - NCurses is user-selected and stdout is *not* a TTY + +* Gtk: + - if $DISPLAY is set and Qt is not available, + - a GTK-based desktop environment is detected from the environment variable + XDG_CURRENT_DESKTOP + - any of the above pre-conditions are met and NCurses is user-selected, but + stdout is *not* a TTY + +* NCurses: + - if $DISPLAY is *not* set and stdout is a TTY + - Qt and Gtk are not available and stdout is a TTY + +This can be overridden by either: + +* specifing one of the switches on the command-line of the program + - `--gtk`, + - `--ncurses`, or + - `--qt` + +* setting the environment variable YUI_PREFERED_BACKEND to one of + - `gtk`, + - `ncurses`, or + - `qt` + +If a command-line switch is given to the program, the setting from the environment +variable will be overridden by the UI-plugin chosen with the switch. + +If the user-selected UI-plugin is not installed on the system, an installed +UI-plugin will be chosen by the above criteria. + + +### Building + +Libyui uses CMake, driven by a slightly complex set of +[CMakefiles](https://github.com/libyui/libyui/tree/master/buildtools). For +reproducible builds it is best to use the [libyui-rake]( +https://github.com/libyui/libyui-rake) Ruby gem like the [Jenkins CI]( +https://ci.opensuse.org/view/libyui/) jobs do. + +It can be installed from [rubygems.org](https://rubygems.org/gems/libyui-rake/) +using this command (Ruby needs to be installed in the system): + +``` +gem install libyui-rake +``` + +Then to build the package run: + +``` +rake osc:build +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/VERSION.cmake new/libyui-3.3.3/VERSION.cmake --- old/libyui-3.2.9/VERSION.cmake 2016-11-25 14:41:08.906226503 +0100 +++ new/libyui-3.3.3/VERSION.cmake 2017-08-03 13:11:10.664609964 +0200 @@ -1,12 +1,12 @@ SET( VERSION_MAJOR "3") -SET( VERSION_MINOR "2" ) -SET( VERSION_PATCH "9" ) +SET( VERSION_MINOR "3" ) +SET( VERSION_PATCH "3" ) SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${GIT_SHA1_VERSION}" ) ##### This is need for the libyui core, ONLY. ##### These will be overridden from exports in LibyuiConfig.cmake # must also adjust "Requires: yui_backend = SONAME_MAJOR" in libyui.spec.in -SET( SONAME_MAJOR "7" ) +SET( SONAME_MAJOR "8" ) SET( SONAME_MINOR "0" ) SET( SONAME_PATCH "0" ) SET( SONAME "${SONAME_MAJOR}.${SONAME_MINOR}.${SONAME_PATCH}" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/buildtools/CMakeLists.common new/libyui-3.3.3/buildtools/CMakeLists.common --- old/libyui-3.2.9/buildtools/CMakeLists.common 2016-11-25 14:41:08.906226503 +0100 +++ new/libyui-3.3.3/buildtools/CMakeLists.common 2017-08-03 13:11:10.664609964 +0200 @@ -1,5 +1,25 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) +# Avoid 6000 lines(!) of warnings for cmake-bundled(!) files +# CMP0053: Simplify variable reference and escape sequence evaluation +if( POLICY CMP0053 ) + cmake_policy( SET CMP0053 OLD ) +endif() + +# Avoid several warnings in cmake-files from Qt5. +# CMP0043: Ignore COMPILE_DEFINITIONS_<Config> properties +if( POLICY CMP0043 ) + cmake_policy( SET CMP0043 OLD ) +endif() + +# Avoid several warnings when building qt-graph. +# CMP0028: Double colon in target name means ALIAS or IMPORTED target +# This policy will be removed some time in CMake 3.10. Stop warnings +# from CMake 3.9 about this. +if( POLICY CMP0028 ) + cmake_policy( SET CMP0028 NEW ) +endif() + INCLUDE( "${CMAKE_SOURCE_DIR}/PROJECTINFO.cmake" ) SET( BUILDTOOLS_DIR "buildtools/" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/package/libyui-doc.spec new/libyui-3.3.3/package/libyui-doc.spec --- old/libyui-3.2.9/package/libyui-doc.spec 2016-11-25 14:41:08.906226503 +0100 +++ new/libyui-3.3.3/package/libyui-doc.spec 2017-08-03 13:11:10.664609964 +0200 @@ -17,10 +17,10 @@ %define parent libyui -%define so_version 7 +%define so_version 8 Name: %{parent}-doc -Version: 3.2.9 +Version: 3.3.3 Release: 0 Source: %{parent}-%{version}.tar.bz2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/package/libyui.changes new/libyui-3.3.3/package/libyui.changes --- old/libyui-3.2.9/package/libyui.changes 2016-11-25 14:41:08.910226503 +0100 +++ new/libyui-3.3.3/package/libyui.changes 2017-08-03 13:11:10.668609964 +0200 @@ -1,4 +1,31 @@ ------------------------------------------------------------------- +Thu Aug 3 12:51:02 CEST 2017 - besse...@fedoraproject.org + +- CMake 3.9 warns about CMP0028 being obsolete +- 3.3.3 + +------------------------------------------------------------------- +Fri Apr 14 11:02:37 CEST 2017 - besse...@fedoraproject.org + +- Add $(ENV:YUI_PREFERED_BACKEND) to set prefered UI-backend +- Avoid several warnings from CMake +- 3.3.2 + +------------------------------------------------------------------- +Thu Apr 13 19:32:00 CEST 2017 - besse...@fedoraproject.org + +- Fix detection of Desktop Environments +- 3.3.1 + +------------------------------------------------------------------- +Thu Apr 13 10:44:07 CEST 2017 - besse...@fedoraproject.org + +- Add YSettings::loadedUI option (gh#libyui/libyui#35) +- Prefer Gtk-UI on Gtk-based desktop enviroments +- Bump SO-name and minor version for API-change +- 3.3.0 + +------------------------------------------------------------------- Fri Nov 25 09:22:14 UTC 2016 - jreidin...@suse.com - implement shortcut conflicts resolver for menu buttons diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/package/libyui.spec new/libyui-3.3.3/package/libyui.spec --- old/libyui-3.2.9/package/libyui.spec 2016-11-25 14:41:08.910226503 +0100 +++ new/libyui-3.3.3/package/libyui.spec 2017-08-03 13:11:10.668609964 +0200 @@ -16,14 +16,18 @@ # Name: libyui -Version: 3.2.9 +Version: 3.3.3 Release: 0 Source: %{name}-%{version}.tar.bz2 -%define so_version 7 +%define so_version 8 %define bin_name %{name}%{so_version} +%if 0%{?suse_version} > 1325 +BuildRequires: libboost_headers-devel +%else BuildRequires: boost-devel +%endif BuildRequires: cmake >= 2.8 BuildRequires: gcc-c++ BuildRequires: pkg-config @@ -64,7 +68,11 @@ %package devel +%if 0%{?suse_version} > 1325 +Requires: libboost_headers-devel +%else Requires: boost-devel +%endif Requires: glibc-devel Requires: libstdc++-devel Requires: %{bin_name} = %{version} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/src/YSettings.cc new/libyui-3.3.3/src/YSettings.cc --- old/libyui-3.2.9/src/YSettings.cc 2016-11-25 14:41:08.926226503 +0100 +++ new/libyui-3.3.3/src/YSettings.cc 2017-05-04 15:17:37.049375667 +0200 @@ -43,6 +43,7 @@ std::string YSettings::_iconDir = ""; std::string YSettings::_themeDir = ""; std::string YSettings::_localeDir = ""; +std::string YSettings::_loadedUI = ""; YSettings::YSettings() { @@ -170,4 +171,30 @@ return "/usr/share/locale/"; } +void YSettings::loadedUI( std::string ui, bool force ) +{ + if ( _loadedUI.empty() || force ) + { + _loadedUI = ui; + yuiMilestone () << "Set loadedUI to \"" << ui << "\"" << endl; + yuiMilestone () << "loadedUI is now locked." << endl; + } + else + { + yuiMilestone () << "Can't set loadedUI to \"" << ui << "\"" << endl; + yuiMilestone () << "It is locked to: \"" << _loadedUI << "\"" << endl; + YUI_THROW ( YUIException ( "loadedUI is locked to: \"" + _loadedUI + "\"" ) ); + } +} +void YSettings::loadedUI( std::string ui ) +{ + loadedUI( ui, false ); +} + +std::string YSettings::loadedUI () +{ + yuiMilestone () << "loadedUI: \"" << _loadedUI << "\"" << endl; + + return _loadedUI; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/src/YSettings.h new/libyui-3.3.3/src/YSettings.h --- old/libyui-3.2.9/src/YSettings.h 2016-11-25 14:41:08.926226503 +0100 +++ new/libyui-3.3.3/src/YSettings.h 2017-05-04 15:17:37.049375667 +0200 @@ -35,6 +35,12 @@ #include <string> + +/** + * Predeclaration of YUILoader + **/ +class YUILoader; + /** * Settings for libyui * @@ -42,6 +48,8 @@ **/ class YSettings { +friend YUILoader; + public: /** * This can be used to set a subdir beneath PLUGINDIR or THEMEDIR, @@ -95,11 +103,33 @@ **/ static std::string localeDir (); + /** + * This can be used to set the loaded UI-backend. + * + * Once this is set, it can't be altered. If you do so although an + * exception will be thrown. + **/ + static void loadedUI ( std::string ui ); + /** + * Returns the value of the loaded UI-backend. + **/ + static std::string loadedUI (); + +protected: + /** + * This can be used to set the loaded UI-backend. + * + * Once this is set, it can't be altered, except if you force it. + * If you do so without force an exception will be thrown. + **/ + static void loadedUI ( std::string ui, bool force ); + private: static std::string _progDir; static std::string _iconDir; static std::string _themeDir; static std::string _localeDir; + static std::string _loadedUI; YSettings (); YSettings ( const YSettings& ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/src/YUILoader.cc new/libyui-3.3.3/src/YUILoader.cc --- old/libyui-3.2.9/src/YUILoader.cc 2016-11-25 14:41:08.930226503 +0100 +++ new/libyui-3.3.3/src/YUILoader.cc 2017-05-04 15:17:37.053375667 +0200 @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2012 Novell, Inc + Copyright (C) 2000-2017 Novell, Inc This library 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 @@ -34,63 +34,122 @@ #include "YUIPlugin.h" #include "YUIException.h" #include "YPath.h" +#include "YSettings.h" #include "Libyui_config.h" void YUILoader::loadUI( bool withThreads ) { - const char * envDisplay = getenv( "DISPLAY" ); + bool isGtk = false; + const char * envDesktop = getenv( "XDG_CURRENT_DESKTOP" ) ?: ""; + const char * envDisplay = getenv( "DISPLAY" ) ?: ""; + const char * envPreset = getenv( "YUI_PREFERED_BACKEND" ) ?: ""; + std::string wantedGUI; + + yuiMilestone () << "DISPLAY: \"" << envDisplay << "\"" << std::endl; + yuiMilestone () << "XDG_CURRENT_DESKTOP: \"" << envDesktop << "\"" << std::endl; + yuiMilestone () << "YUI_PREFERED_BACKEND: \"" << envPreset << "\"" << std::endl; + + // Taken from: https://specifications.freedesktop.org/menu-spec/menu-spec-1.1.html#onlyshowin-registry + isGtk = ( ( strstr( envDesktop, "Cinnamon" ) != NULL ) || isGtk ); + isGtk = ( ( strstr( envDesktop, "GNOME" ) != NULL ) || isGtk ); + isGtk = ( ( strstr( envDesktop, "LXDE" ) != NULL ) || isGtk ); + isGtk = ( ( strstr( envDesktop, "MATE" ) != NULL ) || isGtk ); + isGtk = ( ( strstr( envDesktop, "Pantheon" ) != NULL ) || isGtk ); + isGtk = ( ( strstr( envDesktop, "ROX" ) != NULL ) || isGtk ); + isGtk = ( ( strstr( envDesktop, "Unity" ) != NULL ) || isGtk ); + isGtk = ( ( strstr( envDesktop, "XFCE" ) != NULL ) || isGtk ); + + if( isGtk ) yuiMilestone () << "Detected a Gtk-based desktop environment." << std::endl + << "Prefering Gtk-UI if available and no" << std::endl + << "user-selected override is present." << std::endl; YCommandLine cmdline; - bool wantNcurses = cmdline.find("--ncurses") != -1; - bool wantQt = cmdline.find("--qt") != -1; - bool wantGtk = cmdline.find("--gtk") != -1; + bool wantGtk = ( cmdline.find( "--gtk" ) != -1 ); + bool wantNcurses = ( cmdline.find( "--ncurses" ) != -1 ); + bool wantQt = ( cmdline.find( "--qt" ) != -1 ); + bool haveUIPreset = ( wantGtk || wantNcurses || wantQt ); - bool haveQt = pluginExists( YUIPlugin_Qt ); - bool haveGtk = pluginExists( YUIPlugin_Gtk ); + if( !haveUIPreset ) + { + wantGtk = ( strcmp( envPreset, YUIPlugin_Gtk ) == 0 ); + wantNcurses = ( strcmp( envPreset, YUIPlugin_NCurses ) == 0 ); + wantQt = ( strcmp( envPreset, YUIPlugin_Qt ) == 0 ); + } + + if( wantGtk ) wantedGUI = YUIPlugin_Gtk; + if( wantNcurses ) wantedGUI = YUIPlugin_NCurses; + if( wantQt ) wantedGUI = YUIPlugin_Qt; + + yuiMilestone () << "User-selected UI-plugin: \"" << wantedGUI << "\"" << std::endl; - if ( envDisplay && !wantNcurses ) + bool haveGtk = pluginExists( YUIPlugin_Gtk ); + bool haveNcurses = pluginExists( YUIPlugin_NCurses ); + bool haveQt = pluginExists( YUIPlugin_Qt ); + + // This reset is intentional, so the loader can work it's magic + // selecting an UI-plugin as described in the documentation. + wantedGUI=""; + + // Set the UI-Plugin + if ( ( haveGtk || haveQt ) && strcmp ( envDisplay, "" ) && + ( !wantNcurses || !isatty( STDOUT_FILENO ) ) ) { - std::string wantedGUI; + // Qt is default if available. + if ( haveQt ) + wantedGUI = YUIPlugin_Qt; - if ( haveQt && !wantGtk) - wantedGUI = YUIPlugin_Qt; - else if ( haveGtk && !wantQt ) - wantedGUI = YUIPlugin_Gtk; + // Do we want to use Gtk instead? + if ( haveGtk && ( ( ( isGtk || wantGtk ) && !wantQt ) || !haveQt ) ) + wantedGUI = YUIPlugin_Gtk; + } - if ( strcmp( wantedGUI.c_str(), "" ) ) - { - try - { - loadPlugin( wantedGUI, withThreads ); - return; - } - catch ( YUIException & ex) - { - YUI_CAUGHT( ex ); - } - } + else if ( haveNcurses && isatty( STDOUT_FILENO ) ) + { + // We use NCurses. + wantedGUI = YUIPlugin_NCurses; } - if ( isatty( STDOUT_FILENO ) ) + // Load the wanted UI-plugin. + if( wantedGUI != "" ) { - // - // NCurses UI - // + yuiMilestone () << "Using UI-plugin: \"" << wantedGUI << "\""<< std::endl; + YSettings::loadedUI( wantedGUI, true ); try { - loadPlugin( YUIPlugin_NCurses, withThreads ); + loadPlugin( wantedGUI, withThreads ); return; } - catch ( YUIException & ex) + + catch ( YUIException & ex ) { YUI_CAUGHT( ex ); + + // Default to NCurses, if possible. + if( wantedGUI != YUIPlugin_NCurses && haveNcurses && isatty( STDOUT_FILENO ) ) + { + yuiWarning () << "Defaulting to: \"" << YUIPlugin_NCurses << "\""<< std::endl; + YSettings::loadedUI( YUIPlugin_NCurses, true ); + + try + { + loadPlugin( YUIPlugin_NCurses, withThreads ); + return; + } + + catch ( YUIException & ex ) + { + YUI_CAUGHT( ex ); + } + } + YUI_RETHROW( ex ); // what else to do here? } } + else { YUI_THROW( YUICantLoadAnyUIException() ); @@ -158,54 +217,29 @@ void YUILoader::loadExternalWidgets ( const std::string& name, const std::string& symbol ) { - const char * envDisplay = getenv( "DISPLAY" ); + std::string wantedGUI = name; + wantedGUI.append( "-" ); + wantedGUI.append( YSettings::loadedUI() ); - YCommandLine cmdline; + bool haveExternal = pluginExists( wantedGUI ); - bool wantNcurses = cmdline.find("--ncurses") != -1; - bool wantQt = cmdline.find("--qt") != -1; - bool wantGtk = cmdline.find("--gtk") != -1; - - bool haveQt = pluginExists( YUIPlugin_Qt ); - bool haveGtk = pluginExists( YUIPlugin_Gtk ); - - if ( envDisplay && !wantNcurses ) - { - std::string wantedGUI = name; - wantedGUI.append("-"); - - if ( haveQt && !wantGtk) - wantedGUI.append(YUIPlugin_Qt); - else if ( haveGtk && !wantQt ) - wantedGUI.append(YUIPlugin_Gtk); - - try - { - loadExternalWidgetsPlugin(name, wantedGUI, symbol ); - return; - } - catch ( YUIException & ex) - { - YUI_CAUGHT( ex ); - } - } - - // - // NCurses UI (test on tty has already been done by loadUI) - // - - try - { - std::string wantedNcurses = name; - wantedNcurses.append("-"); - wantedNcurses.append(YUIPlugin_NCurses); - loadExternalWidgetsPlugin(name, wantedNcurses, symbol ); - return; + if( haveExternal ) + { + try + { + loadExternalWidgetsPlugin(name, wantedGUI, symbol ); + return; + } + catch ( YUIException & ex ) + { + YUI_CAUGHT( ex ); + YUI_RETHROW( ex ); // what else to do here? + } } - catch ( YUIException & ex) + + else { - YUI_CAUGHT( ex ); - YUI_RETHROW( ex ); // what else to do here? + YUI_THROW( YUICantLoadAnyUIException() ); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.2.9/src/YUILoader.h new/libyui-3.3.3/src/YUILoader.h --- old/libyui-3.2.9/src/YUILoader.h 2016-11-25 14:41:08.930226503 +0100 +++ new/libyui-3.3.3/src/YUILoader.h 2017-05-04 15:17:37.053375667 +0200 @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2012 Novell, Inc + Copyright (C) 2000-2017 Novell, Inc This library 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 @@ -46,9 +46,44 @@ { public: /** - * Load any of the available UI plug-ins in this order: - * - Qt if $DISPLAY is set - * - NCurses if stdout is a tty + * Load any of the available UI-plugins by this order and criteria: + * + * - Qt: + * - if $DISPLAY is set + * - NCurses is user-selected and stdout is *not* a TTY + * + * - Gtk: + * - if $DISPLAY is set and Qt is not available, + * - a GTK-based desktop environment is detected + * from the environment variable XDG_CURRENT_DESKTOP + * - any of the above pre-conditions are met and + * NCurses is user-selected, but stdout is *not* a TTY + * + * - NCurses: + * - if $DISPLAY is *not* set and stdout is a TTY + * - Qt and Gtk are not available and stdout is a TTY + * + * This can be overridden by either: + * + * - specifing one of the switches on the + * command-line of the program + * - '--gtk', + * - '--ncurses', or + * - '--qt' + * + * - setting the environment variable + * YUI_PREFERED_BACKEND to one of + * - 'gtk', + * - 'ncurses', or + * - 'qt' + * + * If a command-line switch is given to the program, the + * setting from the environment variable will be overridden + * by the UI-plugin chosen with the switch. + * + * If the user-selected UI-plugin is not installed on the + * system, an installed UI-plugin will be chosen by the + * above criteria. **/ static void loadUI( bool withThreads = false );