diff --git a/.gitignore b/.gitignore index 7d897de2..383f3829 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,6 @@ Makefile.in # CMake CMakeCache.txt CMakeFiles -CMakeLists.txt Makefile cmake_install.cmake install_manifest.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..509220e6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,63 @@ +# CMakeLists.txt for libyui-qt +# +# Usage: +# +# mkdir build +# cd build +# cmake .. +# +# make +# sudo make install +# +# Restart with a clean build environment: +# rm -rf build +# +# Show the complete compiler commands with all arguments: +# make VERBOSE=1 + +cmake_minimum_required( VERSION 3.17 ) +project( libyui-gtk ) + +# Options usage: +# +# cmake -DBUILD_DOC=on -DBUILD_EXAMPLES=off .. + +option( BUILD_SRC "Build in src/ subdirectory" on ) +option( BUILD_PKGCONFIG "Build pkg-config support files" on ) +option( BUILD_DOC "Build class documentation" off ) +option( WERROR "Treat all compiler warnings as errors" off ) + +# Non-boolean options +set( DOC_DESTDIR "" CACHE STRING "Destination directory prefix for installing docs" ) + +#---------------------------------------------------------------------- + + +set( CMAKE_INSTALL_MESSAGE LAZY ) # Suppress "up-to-date" messages during "make install" + +add_compile_options( "-Wall" ) +IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + # Initialize compiler flags for all targets in all subdirectories + add_compile_options( "-Os" ) # Optimize for size (overrides CMake's -O3 in RELEASE builds) +endif() + +if ( WERROR ) + add_compile_options( "-Werror" ) +endif() + + +# +# Descend into subdirectories +# + +if ( BUILD_SRC ) + add_subdirectory( src ) +endif() + +if ( BUILD_PKGCONFIG ) + add_subdirectory( pkgconfig ) +endif() + +if ( BUILD_DOC ) + add_subdirectory( doc ) +endif() diff --git a/Makefile.cvs b/Makefile.cvs deleted file mode 100644 index d49dfe60..00000000 --- a/Makefile.cvs +++ /dev/null @@ -1,25 +0,0 @@ -# -# Makefile.cvs -# - -all: configure - -configure: clean - ./bootstrap.sh ; \ - mkdir build ; \ - cd build ; \ - cmake .. \ - -DENABLE_WERROR=OFF \ - -DCMAKE_BUILD_TYPE=RELEASE - -install: configure - cd build ; \ - make && make install - -reconf: - cd build ; \ - cmake rebuild_cache - -clean: - rm -rf build \ - CMakeLists.txt diff --git a/Makefile.repo b/Makefile.repo new file mode 100644 index 00000000..665f1af2 --- /dev/null +++ b/Makefile.repo @@ -0,0 +1,63 @@ +# +# Makefile.repo for libyui-gtk +# + +# Local Variables: +# mode: Makefile +# End: + + +all: clean configure build-hint + +build-hint: + @echo "" + @echo "To build:" + @echo "" + @echo " cd build" + @echo " make" + @echo "" + +configure: + mkdir build; \ + cd build; \ + cmake -DCMAKE_INSTALL_PREFIX=/usr .. + +build: clean configure + cd build; \ + make -j $$(nproc) + +# This needs root privileges, of course +install: configure + cd build; \ + make -j $$(nproc) && make install + +clean: + rm -rf build + +package: + rake package + +doc: + test -d build || mkdir build + cd build; \ + cmake -DBUILD_DOC=on .. ; \ + make doc + +install-doc: doc + cd build; \ + make install-doc + +version-bump: + rake version:bump + +# Just an alias +bump-version: version-bump + + +# Enforce rebuilding some targets unconditionally, even if a file or directory +# with that name exists; otherwise the timestamp of that file or directory +# would be checked. +# +# We need this because we have a subdirectory doc/, a subdirectory package/ +# and possibly a subdirectory build/ here. +.PHONY: doc package build diff --git a/PROJECTINFO.cmake b/PROJECTINFO.cmake deleted file mode 100644 index d034b0cf..00000000 --- a/PROJECTINFO.cmake +++ /dev/null @@ -1,17 +0,0 @@ -##### PROJECTINFO for CMake - -SET( BASELIB "yui" ) # don't change this - -##### MAKE ALL NEEDED CHANGES HERE ##### - -SET( SUBDIRS src ) -SET( PLUGINNAME "gtk" ) -SET( LIB_DEPS GTK3 ) -SET( INTERNAL_DEPS Libyui ) -SET( LIB_LINKER boost_system boost_filesystem ) # define the libs to link against with their -l name for separated with spaces, e.g. pthread dl... -SET( EXTRA_INCLUDES ) -SET( PROGSUBDIR "" ) -SET( URL "http://github.com/libyui/" ) -SET( SUMMARY "Libyui - Gtk User Interface" ) -SET( DESCRIPTION "This package contains the Gtk user interface\ncomponent for libYUI.\n" ) - diff --git a/SOURCECONF.cmake b/SOURCECONF.cmake deleted file mode 100644 index d932ed35..00000000 --- a/SOURCECONF.cmake +++ /dev/null @@ -1,68 +0,0 @@ -SET( ${TARGETLIB}_SOURCES - YGBarGraph.cc - YGComboBox.cc - YGDialog.cc - ygdkmngloader.c - YGDumbTab.cc - YGFrame.cc - YGImage.cc - YGInputField.cc - YGIntField.cc - YGLabel.cc - YGLayout.cc - YGMenuBar.cc - YGMenuButton.cc - YGPackageSelectorPluginStub.cc - YGProgressBar.cc - YGPushButton.cc - YGRadioButton.cc - YGSelectionStore.cc - YGText.cc - ygtkbargraph.c - ygtkfieldentry.c - ygtkfixed.c - ygtkhtmlwrap.c - ygtkimage.c - ygtklinklabel.c - ygtkmenubutton.c - ygtkratiobox.c - ygtkrichtext.c - ygtksteps.c - ygtktextview.c - ygtktimezonepicker.c - ygtktreeview.c - ygtkwindow.c - ygtkwizard.c - YGTreeView.cc - YGUI.cc - YGUtils.cc - YGWidget.cc - YGWizard.cc -) - -SET( ${TARGETLIB}_HEADERS - YGDialog.h - YGMenuBar.h - ygdkmngloader.h - YGi18n.h - YGPackageSelectorPluginIf.h - YGSelectionStore.h - ygtkbargraph.h - ygtkfieldentry.h - ygtkfixed.h - ygtkhtmlwrap.h - ygtkimage.h - ygtklinklabel.h - ygtkmenubutton.h - ygtkratiobox.h - ygtkrichtext.h - ygtksteps.h - ygtktextview.h - ygtktimezonepicker.h - ygtktreeview.h - ygtkwindow.h - ygtkwizard.h - YGUI.h - YGUtils.h - YGWidget.h -) diff --git a/VERSION.cmake b/VERSION.cmake index 37fea870..d6826009 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -1,11 +1,5 @@ SET( VERSION_MAJOR "2" ) -SET( VERSION_MINOR "51" ) +SET( VERSION_MINOR "52" ) SET( VERSION_PATCH "0" ) SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SHA1}" ) -##### This is need for the libyui core, ONLY. -##### These will be overridden from exports in LibyuiConfig.cmake -SET( SONAME_MAJOR "0" ) -SET( SONAME_MINOR "0" ) -SET( SONAME_PATCH "0" ) -SET( SONAME "${SONAME_MAJOR}.${SONAME_MINOR}.${SONAME_PATCH}" ) diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 12bc0c9c..00000000 --- a/bootstrap.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -set -e - -prefix="/usr" - -if [ ! -z $1 ] -then - prefix="$1" -fi - -cmake_common="$prefix/share/libyui/buildtools/CMakeLists.common" -cmake_target="./CMakeLists.txt" - -echo "checking for $cmake_common..." - -if [ -f "$cmake_common" ] -then - ln -fs "$cmake_common" "$cmake_target" - echo "OK: linked to `pwd`/$cmake_target." -else - echo " Use must have libyui(-devel) >= 3.0.4 installed" - echo " in \"$prefix\" first !!!" - exit 1 -fi - -exit 0 diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..2a080c84 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,24 @@ +# CMakeLists.txt for libyui*/doc + +include( ../VERSION.cmake ) + +find_package( Doxygen REQUIRED dot ) + + +# +# Doxygen-generated autodocs +# + +if ( DOXYGEN_FOUND ) + + set( DOXYGEN_GENERATE_TREEVIEW yes ) # Enable views tree HTML frame + set( DOXYGEN_QUIET yes ) # Less verbose output + set( DOXYGEN_WARN_LOGFILE doxygen-warnings.log ) + # See build/CMakeDoxyfile.in for more supported variables + + doxygen_add_docs( doc ../src ) + +else() + message( WARNING "Missing doxygen package" ) +endif() + diff --git a/pkgconfig/CMakeLists.txt b/pkgconfig/CMakeLists.txt new file mode 100644 index 00000000..ba5bc11e --- /dev/null +++ b/pkgconfig/CMakeLists.txt @@ -0,0 +1,38 @@ +# CMakeLists.txt for libyui-gtk/pkgconfig +# +# Support for pkg-config: +# +# Generate a libyui-gtk.pc file from libyui-gtk.pc.in and install it to +# /usr/lib64/pkgconfig. +# +# A .pc file specifies how to use a development package, in particular linker +# flags (-lyui-gtk), compiler flags (including include directories) and paths. +# See man pkg-config. +# +# This .pc file is intended for extensions of the Gtk UI plug-in, not for +# applications using libyui. + +include( ../VERSION.cmake ) +include( GNUInstallDirs ) # set CMAKE_INSTALL_LIBDIR + +FIND_PACKAGE(PkgConfig REQUIRED) + +PKG_CHECK_MODULES(YUI REQUIRED libyui) +pkg_get_variable(YUI_SO_VERSION libyui soversion) +pkg_get_variable(YUI_SO_MAJOR libyui soversion_major) +pkg_get_variable(YUI_SO_MINOR libyui soversion_minor) +pkg_get_variable(YUI_SO_PATCH libyui soversion_patch) + +##### This is needed to be set for the libyui core +SET( SONAME ${YUI_SO_VERSION} ) +SET( SONAME_MAJOR ${YUI_SO_MAJOR} ) +SET( SONAME_MINOR ${YUI_SO_MINOR} ) +SET( SONAME_PATCH ${YUI_SO_PATCH} ) + +set( PKGCONFIG_INSTALL_DIR ${DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig ) + +# Generate libyui-gtk.pc where some CMake variables are expanded from libyui-gtk.pc.in, +# but only expand @VARIABLE@, not ${VARIABLE} +configure_file( libyui-gtk.pc.in libyui-gtk.pc @ONLY ) + +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libyui-gtk.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) diff --git a/pkgconfig/libyui-gtk.pc.in b/pkgconfig/libyui-gtk.pc.in new file mode 100644 index 00000000..2f5b4f03 --- /dev/null +++ b/pkgconfig/libyui-gtk.pc.in @@ -0,0 +1,26 @@ +# +# Pkg-Config file for libyui-gtk +# +# Generated by CMake from libyui-gtk.pc.in +# + +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} + +datarootdir=${exec_prefix}/share +datadir=${datarootdir}/libyui +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${exec_prefix}/include +plugindir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@/yui + +soversion_major=@SONAME_MAJOR@ +soversion_minor=@SONAME_MINOR@ +soversion_patch=@SONAME_PATCH@ +soversion=@SONAME@ + +Name: libyui-gtk +Version: @VERSION@ +Description: libyui-gtk - Gtk plugin for libyui GUI-abstraction library +Libs: -L${plugindir} -lyui-gtk +Libs.private: -ldl -lpthread +Cflags: -I${includedir}/yui/gtk -I${includedir}/yui -I${includedir} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b47bd4db..eddf60fa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1 +1,171 @@ -PROCESS_SOURCES() \ No newline at end of file +# CMakeLists.txt for libyui-gtk/src + +include( ../VERSION.cmake ) +include( GNUInstallDirs ) # set CMAKE_INSTALL_INCLUDEDIR, ..._LIBDIR + +# Use the package PkgConfig to detect GTK+ headers/library files +FIND_PACKAGE(PkgConfig REQUIRED) +PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0) + +PKG_CHECK_MODULES(YUI REQUIRED libyui) +pkg_get_variable(YUI_SO_VERSION libyui soversion) +pkg_get_variable(YUI_SO_MAJOR libyui soversion_major) +#pkg_get_variable(YUI_SO_MINOR libyui soversion_minor) +#pkg_get_variable(YUI_SO_PATCH libyui soversion_patch) + +message (STATUS "Using ${YUI_LIBRARY_DIRS}/libyui.so.${YUI_SO_VERSION}") +find_package(Boost COMPONENTS system filesystem REQUIRED) + +##### This is needed to be set for the libyui core +SET( SONAME_MAJOR ${YUI_SO_MAJOR} ) +SET( SONAME ${YUI_SO_VERSION} ) + + +# +# libyui plugin specific +# + +set( TARGETLIB libyui-gtk ) +set( TARGETLIB_BASE yui-gtk ) + +set( HEADERS_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/yui/gtk ) +set( PLUGIN_DIR ${CMAKE_INSTALL_LIBDIR}/yui ) # /usr/lib64/yui + +# if DESTDIR is set, CMAKE_INSTALL_INCLUDEDIR already contains it +# during "make install" (but not for other make targets!): +# +# sudo make install DESTDIR=/work/foo +# or +# DESTDIR=/work/foo sudo make install +# +# -> the include files are installed to /work/foo/usr/include/... +# We need that for RPM builds to install everything to $RPM_BUILD_ROOT. + + +set( SOURCES + YGBarGraph.cc + YGComboBox.cc + YGDialog.cc + ygdkmngloader.c + YGDumbTab.cc + YGFrame.cc + YGImage.cc + YGInputField.cc + YGIntField.cc + YGLabel.cc + YGLayout.cc + YGMenuBar.cc + YGMenuButton.cc + YGPackageSelectorPluginStub.cc + YGProgressBar.cc + YGPushButton.cc + YGRadioButton.cc + YGSelectionStore.cc + YGText.cc + ygtkbargraph.c + ygtkfieldentry.c + ygtkfixed.c + ygtkhtmlwrap.c + ygtkimage.c + ygtklinklabel.c + ygtkmenubutton.c + ygtkratiobox.c + ygtkrichtext.c + ygtksteps.c + ygtktextview.c + ygtktimezonepicker.c + ygtktreeview.c + ygtkwindow.c + ygtkwizard.c + YGTreeView.cc + YGUI.cc + YGUtils.cc + YGWidget.cc + YGWizard.cc + ) + + +set( HEADERS + YGDialog.h + YGMenuBar.h + ygdkmngloader.h + YGi18n.h + YGPackageSelectorPluginIf.h + YGSelectionStore.h + ygtkbargraph.h + ygtkfieldentry.h + ygtkfixed.h + ygtkhtmlwrap.h + ygtkimage.h + ygtklinklabel.h + ygtkmenubutton.h + ygtkratiobox.h + ygtkrichtext.h + ygtksteps.h + ygtktextview.h + ygtktimezonepicker.h + ygtktreeview.h + ygtkwindow.h + ygtkwizard.h + YGUI.h + YGUtils.h + YGWidget.h + ) + + +# Add shared lib to be built +add_library( ${TARGETLIB} SHARED + ${SOURCES} + ${HEADERS} + ) + + +# Include directories and compile options +# + +# Setup CMake to use GTK+, tell the compiler where to look for headers +# and to the linker where to look for libraries +INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS} ${YUI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) + + +# Make the version from ../../VERSION.cmake available as a #define +target_compile_definitions( ${TARGETLIB} PUBLIC VERSION="${VERSION}" ) + + +# +# Linking +# + +# https://cmake.org/cmake/help/latest/command/link_directories.html suggests to use target_link_libraries +# and anyway LINK_DIRECTORIES command will apply only to targets created after it is called, so must be set +# before add_library in the case. +target_link_directories( ${TARGETLIB} + PUBLIC ${YUI_LIBRARY_DIRS} + PUBLIC ${GTK3_LIBRARY_DIRS} +) + + +# Libraries that are needed to build this shared lib +# +# If in doubt what is really needed, check with "ldd -u" which libs are unused. +target_link_libraries( ${TARGETLIB} + ${YUI_LIBRARIES} + ${GTK3_LIBRARIES} + ${Boost_FILESYSTEM_LIBRARY} + ) + +# https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#target-properties +set_target_properties( ${TARGETLIB} PROPERTIES + VERSION ${SONAME} + SOVERSION ${SONAME_MAJOR} + OUTPUT_NAME ${TARGETLIB_BASE} + ) + + +# +# Install +# + +# Install the headers first so the message about the lib does not scroll away +install( FILES ${HEADERS} DESTINATION ${HEADERS_INSTALL_DIR} ) +install( TARGETS ${TARGETLIB} LIBRARY DESTINATION ${PLUGIN_DIR} ) diff --git a/src/Y2CCGtk.cc b/src/Y2CCGtk.cc index 1e72faad..1d3eac3d 100644 --- a/src/Y2CCGtk.cc +++ b/src/Y2CCGtk.cc @@ -2,7 +2,7 @@ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK * ********************************************************************/ -#include + #include #include diff --git a/src/YGBarGraph.cc b/src/YGBarGraph.cc index aa30c1ae..d0fc14d9 100644 --- a/src/YGBarGraph.cc +++ b/src/YGBarGraph.cc @@ -2,7 +2,7 @@ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK * ********************************************************************/ -#include + #include "YGUI.h" #include "YGWidget.h" #include "ygtkbargraph.h" diff --git a/src/YGComboBox.cc b/src/YGComboBox.cc index 72c6995c..53d86f86 100644 --- a/src/YGComboBox.cc +++ b/src/YGComboBox.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include #include "YGUtils.h" #include "YComboBox.h" diff --git a/src/YGDialog.cc b/src/YGDialog.cc index b1cf2625..b9a06486 100644 --- a/src/YGDialog.cc +++ b/src/YGDialog.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGDialog.h" #include "YGUtils.h" @@ -14,6 +14,7 @@ #include #include "ygtkwindow.h" #include "YGMacros.h" +#include /* In the main dialog case, it doesn't necessarly have a window of its own. If @@ -49,105 +50,97 @@ class YGWindow YGWindowCloseFn m_canClose; void *m_canCloseData; - YGWindow (bool _main_window, YGDialog *ydialog) - { - m_widget = ygtk_window_new(); - -# if GTK_CHECK_VERSION (3, 12, 0) -# else - gtk_container_set_resize_mode (GTK_CONTAINER (m_widget), GTK_RESIZE_PARENT); -# endif - - g_object_ref_sink (G_OBJECT (m_widget)); - -# if GTK_CHECK_VERSION (3, 14, 0) -# else - gtk_window_set_has_resize_grip (GTK_WINDOW (m_widget), TRUE); -# endif - - m_refcount = 0; - m_child = NULL; - m_canClose = NULL; - m_busyCursor = NULL; - m_isBusy = false; - - { - std::stack &stack = YDialog::_dialogStack; - YDialog *ylast = stack.size() ? stack.top() : 0; - if (ylast == ydialog) { - if (stack.size() > 1) { - YDialog *t = ylast; - stack.pop(); - ylast = stack.top(); - stack.push (t); - } - else - ylast = NULL; - } - - GtkWindow *parent = NULL; - if (ylast) { - YGDialog *yglast = static_cast (ylast); - parent = GTK_WINDOW (yglast->m_window->getWidget()); - } - GtkWindow *window = GTK_WINDOW (m_widget); - // to be back compatible - std::string dialogTitle = "YaSt"; - -#ifdef LIBYUI_VERSION_NUM - #if LIBYUI_VERSION_AT_LEAST(2,42,3) - dialogTitle = YUI::app()->applicationTitle(); - #endif -#endif - if (parent) { - // if there is a parent, this would be a dialog - gtk_window_set_title (window, dialogTitle.c_str()); - gtk_window_set_modal (window, TRUE); - gtk_window_set_transient_for (window, parent); - gtk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DIALOG); - AtkObject *peer = gtk_widget_get_accessible (GTK_WIDGET (window)); - if (peer != NULL) - atk_object_set_role (peer, ATK_ROLE_DIALOG); - } - else { - gtk_window_set_title (window, dialogTitle.c_str()); -#ifdef LIBYUI_VERSION_NUM - #if LIBYUI_VERSION_AT_LEAST(2,42,3) - GdkPixbuf *pixbuf = YGUtils::loadPixbuf (YUI::app()->applicationIcon()); - if (pixbuf) { // default window icon - gtk_window_set_default_icon (pixbuf); - g_object_unref (G_OBJECT (pixbuf)); - } - #endif -#endif - if (YGUI::ui()->unsetBorder()) - gtk_window_set_decorated (window, FALSE); - } - - if (_main_window) { - int width = YUI::app()->defaultWidth(); - int height = YUI::app()->defaultHeight(); - gtk_window_set_default_size ( window, width, height ); - gtk_window_resize( window, width, height ); - if (YGUI::ui()->setFullscreen()) - gtk_window_fullscreen (window); - } - gtk_window_set_role (window, "yast2"); - } + YGWindow (bool _main_window, YGDialog *ydialog) + { + m_widget = ygtk_window_new(); + + g_object_ref_sink (G_OBJECT (m_widget)); + + m_refcount = 0; + m_child = NULL; + m_canClose = NULL; + m_busyCursor = NULL; + m_isBusy = false; + + { + std::stack &stack = YDialog::_dialogStack; + YDialog *ylast = stack.size() ? stack.top() : 0; + if (ylast == ydialog) { + if (stack.size() > 1) { + YDialog *t = ylast; + stack.pop(); + ylast = stack.top(); + stack.push (t); + } + else + ylast = NULL; + } + + GtkWindow *parent = NULL; + if (ylast) { + YGDialog *yglast = static_cast (ylast); + parent = GTK_WINDOW (yglast->m_window->getWidget()); + } + GtkWindow *window = GTK_WINDOW (m_widget); + std::string dialogTitle = YUI::app()->applicationTitle(); + gtk_window_set_title (window, dialogTitle.c_str()); + + if (parent) { + // if there is a parent, this would be a dialog + gtk_window_set_modal (window, TRUE); + gtk_window_set_transient_for (window, parent); + gtk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DIALOG); + AtkObject *peer = gtk_widget_get_accessible (GTK_WIDGET (window)); + if (peer != NULL) + atk_object_set_role (peer, ATK_ROLE_DIALOG); + } + else { + // if extension is present we consider a full path name, theme icons don't have extensions + std::string icon = YUI::app()->applicationIcon(); + if (boost::filesystem::path(icon).has_extension()) + { + GError *err = 0; + if (!gtk_window_set_icon_from_file (window, icon.c_str(), &err)) + { + yuiWarning() << "Could not load icon: " << icon << "\n" + "Reason: " << err->message << "\n"; + } + } + else + { + gtk_window_set_icon_name (window, icon.c_str()); + } + + if (YGUI::ui()->unsetBorder()) + gtk_window_set_decorated (window, FALSE); + } + + if (_main_window) { + int width = YUI::app()->defaultWidth(); + int height = YUI::app()->defaultHeight(); + gtk_window_set_default_size ( window, width, height ); + gtk_window_resize( window, width, height ); + if (YGUI::ui()->setFullscreen()) + gtk_window_fullscreen (window); + } + // https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-set-role + // If a window already has a unique title, you don’t need to set the role, since the WM can use the title to identify the window when restoring the session. + // gtk_window_set_role (window, "yast2"); + } - if (_main_window) - main_window = this; - - g_signal_connect (G_OBJECT (m_widget), "delete-event", - G_CALLBACK (close_window_cb), this); - g_signal_connect_after (G_OBJECT (m_widget), "key-press-event", - G_CALLBACK (key_pressed_cb), this); - g_signal_connect (G_OBJECT (m_widget), "focus-in-event", - G_CALLBACK (focus_in_event_cb), this); - // set busy cursor at start - g_signal_connect_after (G_OBJECT (m_widget), "realize", - G_CALLBACK (realize_cb), this); - } + if (_main_window) + main_window = this; + + g_signal_connect (G_OBJECT (m_widget), "delete-event", + G_CALLBACK (close_window_cb), this); + g_signal_connect_after (G_OBJECT (m_widget), "key-press-event", + G_CALLBACK (key_pressed_cb), this); + g_signal_connect (G_OBJECT (m_widget), "focus-in-event", + G_CALLBACK (focus_in_event_cb), this); + // set busy cursor at start + g_signal_connect_after (G_OBJECT (m_widget), "realize", + G_CALLBACK (realize_cb), this); + } ~YGWindow() { @@ -543,12 +536,22 @@ void ygdialog_setTitle (const gchar *title, gboolean sticky) void YGDialog::setIcon (const std::string &icon) { - GtkWindow *window = GTK_WINDOW (m_window->getWidget()); - GdkPixbuf *pixbuf = YGUtils::loadPixbuf (icon); - if (pixbuf) { - gtk_window_set_icon (window, pixbuf); - g_object_unref (G_OBJECT (pixbuf)); - } + GtkWindow *window = GTK_WINDOW (m_window->getWidget()); + + // if extension is present we consider a full path name, theme icons don't have extensions + if (boost::filesystem::path(icon).has_extension()) + { + GError *err = 0; + if (!gtk_window_set_icon_from_file (window, icon.c_str(), &err)) + { + yuiWarning() << "Could not load icon: " << icon << "\n" + "Reason: " << err->message << "\n"; + } + } + else + { + gtk_window_set_icon_name (window, icon.c_str()); + } } typedef bool (*FindWidgetsCb) (YWidget *widget, void *data) ; diff --git a/src/YGDumbTab.cc b/src/YGDumbTab.cc index cf56698d..ef892d26 100644 --- a/src/YGDumbTab.cc +++ b/src/YGDumbTab.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGWidget.h" #include "YGUtils.h" @@ -52,8 +52,7 @@ class YGDumbTab : public YDumbTab, public YGWidget label = gtk_label_new (YGUtils::mapKBAccel (item->label()).c_str()); gtk_label_set_use_underline (GTK_LABEL (label), TRUE); if (item->hasIconName()) { - std::string path = iconFullPath (item->iconName()); - GdkPixbuf *pixbuf = YGUtils::loadPixbuf (path); + GdkPixbuf *pixbuf = YGUtils::loadPixbuf (item->iconName()); if (pixbuf) { image = gtk_image_new_from_pixbuf (pixbuf); g_object_unref (G_OBJECT (pixbuf)); diff --git a/src/YGFrame.cc b/src/YGFrame.cc index eb91fcc1..55b41086 100644 --- a/src/YGFrame.cc +++ b/src/YGFrame.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGWidget.h" #include "YGUtils.h" diff --git a/src/YGImage.cc b/src/YGImage.cc index 2376ba85..7f4b0afa 100644 --- a/src/YGImage.cc +++ b/src/YGImage.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "ygdkmngloader.h" #include "YGUI.h" #include "YGWidget.h" diff --git a/src/YGInputField.cc b/src/YGInputField.cc index fb14db4d..5ce665b5 100644 --- a/src/YGInputField.cc +++ b/src/YGInputField.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGWidget.h" #include "YGUtils.h" diff --git a/src/YGLayout.cc b/src/YGLayout.cc index 076ad8ea..9c012205 100644 --- a/src/YGLayout.cc +++ b/src/YGLayout.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGWidget.h" #include "YGUtils.h" diff --git a/src/YGMenuBar.cc b/src/YGMenuBar.cc index 39f2e140..7ad6c97a 100644 --- a/src/YGMenuBar.cc +++ b/src/YGMenuBar.cc @@ -152,26 +152,9 @@ void YGMenuBar::doCreateMenu (GtkWidget *menu, YItemIterator begin, YItemIterato std::string action_name = YGUtils::mapKBAccel (yitem->label()); if (yitem->hasIconName()) { + // if extension is present we consider a full path name, theme icons don't have extensions - GtkWidget *icon; - if (boost::filesystem::path(yitem->iconName()).has_extension()) - { - icon = gtk_image_new_from_file(yitem->iconName().c_str()); - } - else - { - GtkIconTheme * theme = gtk_icon_theme_get_default(); - std::string ico = boost::filesystem::path(yitem->iconName()).stem().c_str(); - if (gtk_icon_theme_has_icon (theme, ico.c_str())) - { - icon = gtk_image_new_from_icon_name (ico.c_str(), GTK_ICON_SIZE_MENU); - } - else - { - // last chance, just to add an icon - icon = gtk_image_new_from_file(yitem->iconName().c_str()); - } - } + GtkWidget *icon = YGUI::ui()->loadIcon(yitem->iconName()); GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); GtkWidget *label = gtk_label_new (action_name.c_str()); diff --git a/src/YGMenuButton.cc b/src/YGMenuButton.cc index 719544e7..450aba8e 100644 --- a/src/YGMenuButton.cc +++ b/src/YGMenuButton.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGUtils.h" #include "YGWidget.h" diff --git a/src/YGProgressBar.cc b/src/YGProgressBar.cc index 8c1a25ae..3ed3d567 100644 --- a/src/YGProgressBar.cc +++ b/src/YGProgressBar.cc @@ -7,7 +7,7 @@ */ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGWidget.h" #include "YGi18n.h" diff --git a/src/YGPushButton.cc b/src/YGPushButton.cc index 3217b61a..9927b905 100644 --- a/src/YGPushButton.cc +++ b/src/YGPushButton.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include #include "YGUtils.h" @@ -89,51 +89,27 @@ bool m_customIcon, m_labelIcon; setStockIcon (label()); } - virtual void setIcon (const std::string &icon) - { - GtkButton *button = GTK_BUTTON (getWidget()); - if (icon.empty()) { - m_customIcon = false; - // no need to worry about freeing the image, let it live with button - GtkWidget *image = gtk_button_get_image (button); - if (image) - gtk_widget_hide (image); - } - else { - m_customIcon = true; - std::string path (icon); - if (path[0] != '/') - path = std::string (THEMEDIR) + "/" + path; - - char *p = strdup(path.c_str()); - char *p1 = strdup(path.c_str()); - char *dname = dirname(p); - char *fname = basename(p1); - char *name = strtok (fname, "."); - GtkIconTheme * theme = gtk_icon_theme_get_default (); - gtk_icon_theme_add_resource_path (theme, dname); - gtk_icon_theme_prepend_search_path (theme, dname); - gtk_icon_theme_rescan_if_needed (theme); - GError *error = 0; - GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (theme, - name, // icon name - 16, // icon size (default button size) - GTK_ICON_LOOKUP_FORCE_SIZE, // flags - &error); - free (p); - free (p1); - if (pixbuf) { - GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf); - gtk_button_set_image (button, image); - // disregard gtk-button-images setting for explicitly set icons - gtk_button_set_always_show_image (button, TRUE); - g_object_unref (G_OBJECT (pixbuf)); - } - else - yuiWarning() << "YGPushButton: Couldn't load icon image: " << path << std::endl - << "Reason: " << error->message << std::endl; - } - } + virtual void setIcon (const std::string &icon) + { + GtkButton *button = GTK_BUTTON (getWidget()); + if (icon.empty()) { + m_customIcon = false; + // no need to worry about freeing the image, let it live with button + GtkWidget *image = gtk_button_get_image (button); + if (image) + gtk_widget_hide (image); + } + else { + + GtkWidget *image = YGUI::ui()->loadIcon(icon); + if (image) { + gtk_button_set_image (button, image); + gtk_button_set_always_show_image (button, TRUE); + } + else + yuiWarning() << "YGPushButton: Couldn't load icon image: " << icon << std::endl; + } + } virtual void setDefaultButton (bool isDefault) { diff --git a/src/YGRadioButton.cc b/src/YGRadioButton.cc index 80fc069d..de7f411d 100644 --- a/src/YGRadioButton.cc +++ b/src/YGRadioButton.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGUtils.h" #include "YGWidget.h" diff --git a/src/YGSelectionStore.cc b/src/YGSelectionStore.cc index 06f3f63d..8242f2f7 100644 --- a/src/YGSelectionStore.cc +++ b/src/YGSelectionStore.cc @@ -3,12 +3,13 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include #include #include #include "YGUtils.h" #include "YGSelectionStore.h" +#include "YGUI.h" static inline int getYItemCol (GtkTreeModel *model) { return gtk_tree_model_get_n_columns (model) - 2; } @@ -58,18 +59,17 @@ void YGSelectionStore::addRow (YItem *item, GtkTreeIter *iter, GtkTreeIter *pare void YGSelectionStore::setRowText (GtkTreeIter *iter, int iconCol, const std::string &icon, int labelCol, const std::string &label, const YSelectionWidget *widget) { - GdkPixbuf *pixbuf = 0; - if (!icon.empty()) { - std::string path (widget->iconFullPath (icon)); - pixbuf = YGUtils::loadPixbuf (path); - } - - if (isTree) - gtk_tree_store_set (getTreeStore(), iter, iconCol, pixbuf, - labelCol, label.c_str(), -1); - else - gtk_list_store_set (getListStore(), iter, iconCol, pixbuf, - labelCol, label.c_str(), -1); + GdkPixbuf *pixbuf = 0; + if (!icon.empty()) { + pixbuf = YGUtils::loadPixbuf (icon); + } + + if (isTree) + gtk_tree_store_set (getTreeStore(), iter, iconCol, pixbuf, + labelCol, label.c_str(), -1); + else + gtk_list_store_set (getListStore(), iter, iconCol, pixbuf, + labelCol, label.c_str(), -1); } void YGSelectionStore::setRowMark (GtkTreeIter *iter, int markCol, bool mark) diff --git a/src/YGText.cc b/src/YGText.cc index 4a5a9581..33febea3 100644 --- a/src/YGText.cc +++ b/src/YGText.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include #include "YGUtils.h" diff --git a/src/YGTreeView.cc b/src/YGTreeView.cc index 6540812d..44d1c2a2 100644 --- a/src/YGTreeView.cc +++ b/src/YGTreeView.cc @@ -7,7 +7,7 @@ #include "YGi18n.h" #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGUtils.h" #include "YGWidget.h" diff --git a/src/YGUI.cc b/src/YGUI.cc index bcfc0cbb..42a7ecb9 100644 --- a/src/YGUI.cc +++ b/src/YGUI.cc @@ -18,6 +18,7 @@ #include "YGUtils.h" #include "YGDialog.h" #include +#include static std::string askForFileOrDirectory (GtkFileChooserAction action, const std::string &path, const std::string &filter, const std::string &title); @@ -189,11 +190,33 @@ void YGUI::checkInit() g_object_unref (provider); - GdkPixbuf *pixbuf = YGUtils::loadPixbuf (THEMEDIR "/icons/32x32/apps/yast.png"); - if (pixbuf) { // default window icon - gtk_window_set_default_icon (pixbuf); - g_object_unref (G_OBJECT (pixbuf)); - } +} + + +GtkWidget* YGUI::loadIcon( const std::string & iconName ) const +{ + // if extension is present we consider a full path name, theme icons don't have extensions + GtkWidget *icon = NULL; + if (boost::filesystem::path(iconName).has_extension()) + { + icon = gtk_image_new_from_file(iconName.c_str()); + } + else + { + GtkIconTheme * theme = gtk_icon_theme_get_default(); + std::string ico = boost::filesystem::path(iconName).stem().c_str(); + if (gtk_icon_theme_has_icon (theme, ico.c_str())) + { + icon = gtk_image_new_from_icon_name (ico.c_str(), GTK_ICON_SIZE_MENU); + } + else + { + // last chance, just to add an icon + icon = gtk_image_new_from_file(iconName.c_str()); + } + } + + return icon; } static gboolean ycp_wakeup_fn (GIOChannel *source, GIOCondition condition, @@ -376,11 +399,8 @@ void YGUI::askSaveLogs() //** YGApplication -#define ICONDIR THEMEDIR "/icons/22x22/apps/" - YGApplication::YGApplication() { - setIconBasePath (ICONDIR); } void YGApplication::makeScreenShot (const std::string &_filename) diff --git a/src/YGUI.h b/src/YGUI.h index e22da1f9..491583be 100644 --- a/src/YGUI.h +++ b/src/YGUI.h @@ -5,7 +5,7 @@ #ifndef YGUI_H #define YGUI_H -#include + #include #define YUILogComponent "gtk" #include @@ -25,6 +25,17 @@ class YGUI: public YUI static YGUI *ui() { return (YGUI *) YUI::ui(); } + /** + * Load an icon. This tries several locations: + * + * - The given pathname + * - The icon theme from the current desktop + * - The default icon if failing others + * + * If the icon does not have a filename extension it is retrieved by name from theme. + **/ + GtkWidget* loadIcon( const std::string & iconName ) const; + protected: virtual YWidgetFactory *createWidgetFactory(); virtual YOptionalWidgetFactory *createOptionalWidgetFactory(); diff --git a/src/YGUtils.cc b/src/YGUtils.cc index 2bc3623c..7b35ffd8 100644 --- a/src/YGUtils.cc +++ b/src/YGUtils.cc @@ -6,11 +6,12 @@ */ #define YUILogComponent "gtk" -#include + #include #include "YGUtils.h" #include "YGUI.h" #include "YGi18n.h" +#include static inline void skipSpace (const char *instr, int *i) { while (g_ascii_isspace (instr[*i])) (*i)++; } @@ -533,17 +534,38 @@ void YGUtils::setPaneRelPosition (GtkWidget *paned, gdouble rel) void ygutils_setPaneRelPosition (GtkWidget *paned, gdouble rel) { YGUtils::setPaneRelPosition (paned, rel); } + GdkPixbuf *YGUtils::loadPixbuf (const std::string &filename) { - GdkPixbuf *pixbuf = NULL; - if (!filename.empty()) { - GError *error = 0; - pixbuf = gdk_pixbuf_new_from_file (filename.c_str(), &error); - if (!pixbuf) - yuiWarning() << "Could not load icon: " << filename << "\n" - "Reason: " << error->message << "\n"; - } - return pixbuf; + GdkPixbuf *pixbuf = NULL; + if (!filename.empty()) + { + GtkIconTheme *icon_theme = gtk_icon_theme_get_default (); + if (!boost::filesystem::path(filename).has_extension() + && gtk_icon_theme_has_icon(icon_theme, filename.c_str())) + { + pixbuf = gtk_icon_theme_load_icon (icon_theme, + filename.c_str(), + 16, // icon size + GTK_ICON_LOOKUP_FORCE_SVG, // flags + NULL); + + } + else + { + GError *error = 0; + pixbuf = gdk_pixbuf_new_from_file (filename.c_str(), &error); + if (!pixbuf) + { + yuiWarning() << "Could not load icon: " << filename << "\n" + "Reason: " << error->message << "\n"; + g_warning ("Couldn’t load icon: %s", error->message); + g_error_free (error); + } + } + } + + return pixbuf; } // Code from Banshee: shades a pixbuf a bit, used e.g. for hover effects diff --git a/src/YGUtils.h b/src/YGUtils.h index bd4d97b0..dd2fdee9 100644 --- a/src/YGUtils.h +++ b/src/YGUtils.h @@ -46,8 +46,19 @@ namespace YGUtils /* Instead of setting GtkPaned::position in pixels, do so in percents. */ void setPaneRelPosition (GtkWidget *paned, gdouble rel); - /* Saves some code and standardizes the error. Returns NULL if failed. - Don't forget to g_object_unref it! */ + /* + * + * Load a pixbuf. This tries several locations: + * + * - The given pathname + * - The icon theme from the current desktop + * - The default icon if failing others + * + * If the icon does not have a filename extension it is retrieved by name from theme. + * Returns NULL if failed. + * + * Pixbuf need to to g_object_unref it to be removed. + */ GdkPixbuf *loadPixbuf (const std::string &fileneme); /* Shifts colors in a GdkPixbuf. */ diff --git a/src/YGWidget.cc b/src/YGWidget.cc index 29d9ae8a..9caffc74 100644 --- a/src/YGWidget.cc +++ b/src/YGWidget.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include #include "YGWidget.h" #include "YGUtils.h" diff --git a/src/YGWizard.cc b/src/YGWizard.cc index 5ed5f7ed..a3f0ad08 100644 --- a/src/YGWizard.cc +++ b/src/YGWizard.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include "YGUI.h" #include "YGWidget.h" #include "YGUtils.h" diff --git a/src/dummy.cc b/src/dummy.cc index aca55dab..c7b51fa5 100644 --- a/src/dummy.cc +++ b/src/dummy.cc @@ -2,7 +2,7 @@ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK * ********************************************************************/ -#include + #include int main (int argc, char **argv) diff --git a/src/test.cc b/src/test.cc index f274f9af..a58efdbc 100644 --- a/src/test.cc +++ b/src/test.cc @@ -3,7 +3,7 @@ ********************************************************************/ #define YUILogComponent "gtk" -#include + #include #include #include diff --git a/src/ygtkbargraph.c b/src/ygtkbargraph.c index f087e620..fc132cc5 100644 --- a/src/ygtkbargraph.c +++ b/src/ygtkbargraph.c @@ -5,7 +5,7 @@ /* YGtkBarGraph widget */ // check the header file for information about this widget -#include + #include "ygtkratiobox.h" #include "ygtkbargraph.h" #include diff --git a/src/ygtkfieldentry.c b/src/ygtkfieldentry.c index 5c6922d5..241328c1 100644 --- a/src/ygtkfieldentry.c +++ b/src/ygtkfieldentry.c @@ -5,7 +5,7 @@ /* YGtkFieldEntry widget */ // check the header file for information about this widget -#include + #include "ygtkfieldentry.h" #include #include diff --git a/src/ygtkfixed.c b/src/ygtkfixed.c index 36d619a7..e4c40955 100644 --- a/src/ygtkfixed.c +++ b/src/ygtkfixed.c @@ -5,7 +5,7 @@ /* YGtkFixed container */ // check the header file for information about this container -#include + #include #include #include "ygtkfixed.h" diff --git a/src/ygtkhtmlwrap.c b/src/ygtkhtmlwrap.c index 8199e770..b6961294 100644 --- a/src/ygtkhtmlwrap.c +++ b/src/ygtkhtmlwrap.c @@ -5,7 +5,7 @@ /* YGtkHtmlWrap widget */ // check the header file for information about this widget -#include + #include #include #include "ygtkhtmlwrap.h" diff --git a/src/ygtkimage.c b/src/ygtkimage.c index b5c74998..f850536c 100644 --- a/src/ygtkimage.c +++ b/src/ygtkimage.c @@ -5,7 +5,7 @@ /* YGtkImage widget */ // check the header file for information about this widget -#include + #include "ygdkmngloader.h" #include "ygtkimage.h" #include diff --git a/src/ygtklinklabel.c b/src/ygtklinklabel.c index fcabea28..e335561d 100644 --- a/src/ygtklinklabel.c +++ b/src/ygtklinklabel.c @@ -5,7 +5,7 @@ /* YGtkLinkLabel container */ // check the header file for information about this container -#include + #include #include #include "ygtklinklabel.h" diff --git a/src/ygtkmenubutton.c b/src/ygtkmenubutton.c index b7b72e95..a0a772d8 100644 --- a/src/ygtkmenubutton.c +++ b/src/ygtkmenubutton.c @@ -5,7 +5,7 @@ /* YGtkMenuButton widget */ // check the header file for information about this widget -#include + #include "ygtkmenubutton.h" #include #include diff --git a/src/ygtkratiobox.c b/src/ygtkratiobox.c index 0b9010f9..43b827e2 100644 --- a/src/ygtkratiobox.c +++ b/src/ygtkratiobox.c @@ -5,7 +5,7 @@ /* YGtkRatioBox container */ // check the header file for information about this container -#include + #include #include "ygtkratiobox.h" diff --git a/src/ygtkrichtext.c b/src/ygtkrichtext.c index 2b68050a..ec010efc 100644 --- a/src/ygtkrichtext.c +++ b/src/ygtkrichtext.c @@ -5,7 +5,7 @@ /* YGtkRichText widget */ // check the header file for information about this widget -#include + #include "ygtkrichtext.h" #include #include diff --git a/src/ygtksteps.c b/src/ygtksteps.c index 9c6357db..a2530f00 100644 --- a/src/ygtksteps.c +++ b/src/ygtksteps.c @@ -9,7 +9,7 @@ Textdomain "gtk" */ -#include + #include "ygtksteps.h" #include #define YGI18N_C diff --git a/src/ygtktextview.c b/src/ygtktextview.c index ffb5f6ee..0d624943 100644 --- a/src/ygtktextview.c +++ b/src/ygtktextview.c @@ -5,7 +5,7 @@ /* YGtkTextView widget */ // check the header file for information about this widget -#include + #include "ygtktextview.h" #include diff --git a/src/ygtktimezonepicker.c b/src/ygtktimezonepicker.c index 1d51813c..7d963f4b 100644 --- a/src/ygtktimezonepicker.c +++ b/src/ygtktimezonepicker.c @@ -5,7 +5,7 @@ /* YGtkTimeZonePicker widget */ // check the header file for information about this widget -#include + #include "ygtktimezonepicker.h" #include #include diff --git a/src/ygtktreeview.c b/src/ygtktreeview.c index c04cfd2e..5c0d83f6 100644 --- a/src/ygtktreeview.c +++ b/src/ygtktreeview.c @@ -8,7 +8,7 @@ Textdomain "gtk" */ -#include + #include "ygtktreeview.h" #include #define YGI18N_C diff --git a/src/ygtkwindow.c b/src/ygtkwindow.c index 5807768c..5c7d740b 100644 --- a/src/ygtkwindow.c +++ b/src/ygtkwindow.c @@ -5,7 +5,7 @@ /* YGtkWindow widget */ // check the header file for information about this widget -#include + #include "ygtkwindow.h" #include diff --git a/src/ygtkwizard.c b/src/ygtkwizard.c index e687ab6f..74428248 100644 --- a/src/ygtkwizard.c +++ b/src/ygtkwizard.c @@ -9,7 +9,7 @@ Textdomain "gtk" */ -#include + #include "ygtkwizard.h" #include #include diff --git a/tests/ButtonOrder.ycp b/tests/ButtonOrder.ycp deleted file mode 100644 index 7fd260ca..00000000 --- a/tests/ButtonOrder.ycp +++ /dev/null @@ -1,39 +0,0 @@ -/* - -This example was made to test behaviour of button ordering (initially due to bnc#479874). - - */ - -{ -import "Label"; - UI::OpenDialog( - `VBox( - `Label ("`PushButton (`id (`cancel), `opt(`cancelButton, `key_F9, `default), Label::BackButton()),"), - `Label ("`PushButton (`id (`ok), `opt (`okButton, `key_F10), Label::InstallButton ())"), - `ButtonBox ( - `PushButton (`id (`cancel), `opt(`cancelButton, `key_F9, `default), Label::BackButton()), - `PushButton (`id (`ok), `opt (`okButton, `key_F10), Label::InstallButton ()) - ) - ) - ); - any ret = UI::UserInput(); - if (ret == `cancel) y2milestone ("Cancel pressed"); - if (ret == `ok) y2milestone ("Ok pressed"); - UI::CloseDialog(); - UI::OpenDialog( - `VBox( - `Label ("`PushButton (`id (`cancel), `opt(`cancelButton, `key_F10, `default), Label::BackButton()),"), - `Label ("`PushButton (`id (`ok), `opt (`okButton, `key_F9), Label::InstallButton ())"), - `ButtonBox ( - `PushButton (`id (`cancel), `opt(`cancelButton, `key_F10, `default), Label::BackButton()), - `PushButton (`id (`ok), `opt (`okButton, `key_F9), Label::InstallButton ()) - ) - ) - ); - ret = UI::UserInput(); - if (ret == `cancel) y2milestone ("Cancel pressed"); - if (ret == `ok) y2milestone ("Ok pressed"); - UI::CloseDialog(); - - -} diff --git a/tests/Cursor.ycp b/tests/Cursor.ycp deleted file mode 100644 index 15f851c5..00000000 --- a/tests/Cursor.ycp +++ /dev/null @@ -1,21 +0,0 @@ -// Cursor test -{ - UI::OpenDialog ( - `VBox ( - `IntField (`id (`time), "Work for (secs):", 0, 10, 2), - `PushButton (`id (`work), "&Work!"), - `PushButton (`id (`cancel), "&Close") - ) - ); - - any ret = nil; - repeat { - ret = UI::UserInput(); - - if (ret == `work) - sleep ((integer) UI::QueryWidget (`time, `Value) * 1000); - - } until (ret == `cancel); - - UI::CloseDialog(); -} diff --git a/tests/Dialog-Several.ycp b/tests/Dialog-Several.ycp deleted file mode 100644 index bc29e67e..00000000 --- a/tests/Dialog-Several.ycp +++ /dev/null @@ -1,14 +0,0 @@ -// bug 389635 -{ - UI::OpenDialog(`opt (`defaultsize), `PushButton ("One")); - UI::WaitForEvent(); - sleep (2000); - - UI::OpenDialog(`PushButton ("Two")); - UI::WaitForEvent(); - sleep (2000); - - UI::OpenDialog(`PushButton ("Three")); - UI::WaitForEvent(); -} - diff --git a/tests/FileDialog.ycp b/tests/FileDialog.ycp deleted file mode 100644 index b4d8c6f1..00000000 --- a/tests/FileDialog.ycp +++ /dev/null @@ -1,63 +0,0 @@ -// Tests for file dialog calls: -// string UI::AskForExistingFile (startWith, filter, headline) -// string UI::AskForSaveFileName (startWith, filter, headline) -// string UI::AskForExistingDirectory (startWith, headline) - -{ - define void show_selected (string selected) - { - UI::OpenDialog ( - `VBox ( - `HBox ( - `Label ("You have selected:"), - `Label (`opt (`outputField), selected) - ), - `PushButton ("OK") - ) - ); - UI::UserInput(); - UI::CloseDialog(); - }; - - while (true) { - UI::OpenDialog ( - `VBox ( - `ComboBox (`id (`combo_action), "Action:", - [ - `item (`id (`open_file), "Open File"), - `item (`id (`save_file), "Save File"), - `item (`id (`select_folder), "Select Folder") - ] ), - `TextEntry (`id (`entry_path), "Some path:"), - `TextEntry (`id (`entry_filter), "Filter:", "*"), - `HBox ( - `PushButton (`id (`ok), "OK"), - `PushButton (`id (`cancel), "Cancel") - ) - ) - ); - any ret = UI::UserInput(); - - if (ret == `cancel) - break; - - string start_path = (string) UI::QueryWidget (`id (`entry_path), `Value); - string filter_str = (string) UI::QueryWidget (`id (`entry_filter), `Value); - - string ret_path = nil; - - any action = UI::QueryWidget (`id (`combo_action), `Value); - UI::CloseDialog(); - - if (action == `open_file) - ret_path = UI::AskForExistingFile (start_path, filter_str, "Choose a File"); - else if (action == `save_file) - ret_path = UI::AskForSaveFileName (start_path, filter_str, "Choose a File"); - else if (action == `select_folder) - ret_path = UI::AskForExistingDirectory (start_path, "Choose a Folder"); - - if (ret_path == nil) - ret_path = "(none)"; - show_selected (ret_path); - } -} diff --git a/tests/Frame.ycp b/tests/Frame.ycp deleted file mode 100644 index 4d87cbb0..00000000 --- a/tests/Frame.ycp +++ /dev/null @@ -1,27 +0,0 @@ -{ -UI::OpenDialog ( - `VBox ( - `Frame ("CPU &Speed", - `VBox ( - `RadioButtonGroup( - `VBox ( - `Left(`RadioButton("Normal")), - `Left(`RadioButton("Overclocked")), - `Left(`RadioButton("Red Hot")), - `Left(`RadioButton("Melting", true)), - `Left(`TextEntry ("Delay:", "20")) - ) - ), - `Frame - ( "Exact speed", - `Slider ("CPU", 0, 100, 85) - ) - ) - ), - `PushButton("&OK") - ) - ); - -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/IconButton.ycp b/tests/IconButton.ycp deleted file mode 100755 index 457dea2a..00000000 --- a/tests/IconButton.ycp +++ /dev/null @@ -1,20 +0,0 @@ -// PushButton with icons (relative path) -{ - UI::OpenDialog ( - `VBox ( - `Heading( "YaST2 Mini Control Center" ), - `IconButton (`id ("keyboard "), "yast-keyboard.png", "Keyboard"), - `IconButton (`id ("mouse" ), "yast-mouse.png", "Mouse"), - `IconButton (`id ("timezone" ), "yast-timezone.png", "Time zone"), - `IconButton (`id ("lan" ), "yast-lan.png", "Network"), - `IconButton (`id ("sw_single"), "yast-software.png", "Software") - ) - ); - - string tool = (string) UI::UserInput(); - UI::CloseDialog(); - - UI::OpenDialog (`Label ("Running " + tool + "...")); - sleep (4000); - UI::CloseDialog(); -} diff --git a/tests/IconItems-ComboBox.ycp b/tests/IconItems-ComboBox.ycp deleted file mode 100755 index 50d894c9..00000000 --- a/tests/IconItems-ComboBox.ycp +++ /dev/null @@ -1,25 +0,0 @@ -// ComboBox with icons -{ - UI::OpenDialog ( - `VBox ( - `Heading( "YaST2 Mini Control Center" ), - `ComboBox (`id (`mod), `opt (`editable), "Modules", - [ "Auto-Yast", - `item(`id ("keyboard" ), `icon( "yast-keyboard.png"), "Keyboard" ), - `item(`id ("mouse" ), `icon( "yast-mouse.png" ), "Mouse" ), - `item(`id ("timezone" ), `icon( "yast-timezone.png"), "Time zone"), - `item(`id ("lan" ), `icon( "yast-lan.png" ), "Network" ), - `item(`id ("sw_single"), `icon( "yast-software.png"), "Software" ) - ] ), - `PushButton("&OK") - ) - ); - - UI::UserInput(); - string tool = (string) UI::QueryWidget (`id(`mod ), `Value); - UI::CloseDialog(); - - UI::OpenDialog (`Label ("Running " + tool + "...")); - sleep (4000); - UI::CloseDialog(); -} diff --git a/tests/IconItems-MultiSelectionBox.ycp b/tests/IconItems-MultiSelectionBox.ycp deleted file mode 100755 index ce6c65b1..00000000 --- a/tests/IconItems-MultiSelectionBox.ycp +++ /dev/null @@ -1,31 +0,0 @@ -// ComboBox with icons -{ - UI::OpenDialog ( - `VBox ( - `Heading( "YaST2 Mini Control Center" ), - `MultiSelectionBox (`id (`mod), "Modules", - [ "auto-yast", - `item(`id ("keyboard" ), `icon( "yast-keyboard.png"), "Keyboard", true ), - `item(`id ("mouse" ), `icon( "yast-mouse.png" ), "Mouse", true ), - `item(`id ("timezone" ), `icon( "yast-timezone.png"), "Time zone"), - `item(`id ("lan" ), `icon( "yast-lan.png" ), "Network" ), - `item(`id ("sw_single"), `icon( "yast-software.png"), "Software" ) - ] ), - `PushButton("&OK") - ) - ); - - UI::UserInput(); - list mods = (list) UI::QueryWidget (`id(`mod ), `SelectedItems); - UI::CloseDialog(); - - string text = "Running "; - foreach (`it, mods, - ``{ text = sformat( "%1, %2", text, it); } - ); - text = text + "..."; - - UI::OpenDialog (`Label (text)); - sleep (4000); - UI::CloseDialog(); -} diff --git a/tests/IconItems-SelectionBox.ycp b/tests/IconItems-SelectionBox.ycp deleted file mode 100755 index cd107cad..00000000 --- a/tests/IconItems-SelectionBox.ycp +++ /dev/null @@ -1,25 +0,0 @@ -// ComboBox with icons -{ - UI::OpenDialog ( - `VBox ( - `Heading( "YaST2 Mini Control Center" ), - `SelectionBox (`id (`mod), "Modules", - [ "Auto-Yast", - `item(`id ("keyboard" ), `icon( "yast-keyboard.png"), "Keyboard" ), - `item(`id ("mouse" ), `icon( "yast-mouse.png" ), "Mouse" ), - `item(`id ("timezone" ), `icon( "yast-timezone.png"), "Time zone"), - `item(`id ("lan" ), `icon( "yast-lan.png" ), "Network" ), - `item(`id ("sw_single"), `icon( "yast-software.png"), "Software" ) - ] ), - `PushButton("&OK") - ) - ); - - UI::UserInput(); - string mod = (string) UI::QueryWidget (`id(`mod ), `CurrentItem); - UI::CloseDialog(); - - UI::OpenDialog (`Label ("Running " + mod + "...")); - sleep (4000); - UI::CloseDialog(); -} diff --git a/tests/Image.ycp b/tests/Image.ycp deleted file mode 100644 index 384910d5..00000000 --- a/tests/Image.ycp +++ /dev/null @@ -1,68 +0,0 @@ -// Image test -string filename = "tests/image.gif"; - -{ - UI::OpenDialog ( - `VBox ( - `ReplacePoint (`id (`replace_image), - `ColoredLabel ("Choose an image type option!", `rgb (0, 0, 0), - `rgb (255, 0, 0), 5) - ), - - `Frame ("Image type:", - `RadioButtonGroup (`id(`rb), - `VBox( - `Left (`RadioButton(`id (`static),`opt(`notify), "&Static")), - `Left (`RadioButton(`id (`animation), `opt(`notify), "&Animation")) - ) - ) - ), - - `Frame ("Image effect:", - `RadioButtonGroup (`id(`rb), - `VBox( - `Left (`RadioButton(`id (`no_effect), `opt(`notify), "&None", true)), - `Left (`RadioButton(`id (`tiled_effect),`opt(`notify), "&Tiled")), - `Left (`RadioButton(`id (`scaled_effect), `opt(`notify), "&Scaled")) - ) - ) - ), - `Right (`Label ("Resize the window!")), - `PushButton(`id (`close), "&Close") - ) - ); - - any ret = nil; - while (true) - { - ret = UI::UserInput(); - if (ret == `close || ret == `cancel) - break; - - any type_opt = nil; - if (!(boolean) UI::QueryWidget(`id(`static), `Value)) - type_opt = `animated; - - any effect_opt = nil; - if ((boolean) UI::QueryWidget(`id(`tiled_effect), `Value)) - effect_opt = `tiled; - else if ((boolean) UI::QueryWidget(`id(`scaled_effect), `Value)) - effect_opt = `scaleToFit; - - // needed for tiling (scaling sets this automatically, anyway...) - any zerowidth = nil; - any zeroheight = nil; - if (effect_opt != nil) { - zerowidth = `zeroWidth; - zeroheight = `zeroHeight; - } - - UI::ReplaceWidget (`replace_image, - `Image (`opt (type_opt, effect_opt, zerowidth, zeroheight), - filename, filename + " not found")); - - } - - UI::CloseDialog(); -} - diff --git a/tests/ImageMng.ycp b/tests/ImageMng.ycp deleted file mode 100644 index 7f59e6f0..00000000 --- a/tests/ImageMng.ycp +++ /dev/null @@ -1,91 +0,0 @@ -// Image test -// TODO: make it getting the filename as an argument - -{ - UI::OpenDialog ( - `VBox ( - `ReplacePoint (`id (`replace_image), - `ColoredLabel ("Choose an image first!", `rgb (0, 0, 0), - `rgb (255, 0, 0), 5) - ), - - `Frame ("Which MNG file:", - `RadioButtonGroup (`id(`rb), - `VBox( - `Left (`RadioButton(`id (`movie1), `opt(`notify), "&Movie1")), - `Left (`RadioButton(`id (`movie2), `opt(`notify), "&Movie2")), - `Left (`RadioButton(`id (`movie3), `opt(`notify), "&Movie3")), - `Left (`RadioButton(`id (`movie4), `opt(`notify), "&Movie4")), - `Left (`RadioButton(`id (`movie5), `opt(`notify), "&Movie5")), - `Left (`RadioButton(`id (`movie6), `opt(`notify), "&Movie6")), - `Left (`RadioButton(`id (`movie7), `opt(`notify), "&Movie7")), - `Left (`RadioButton(`id (`movie8), `opt(`notify), "&Movie8")) - ) - ) - ), - - `Frame ("Image effect:", - `RadioButtonGroup (`id(`rb), - `VBox( - `Left (`RadioButton(`id (`no_effect), `opt(`notify), "&None", true)), - `Left (`RadioButton(`id (`tiled_effect),`opt(`notify), "&Tiled")), - `Left (`RadioButton(`id (`scaled_effect), `opt(`notify), "&Scaled")) - ) - ) - ), - `Right (`Label ("Resize the window!")), - `PushButton(`id (`close), "&Close") - ) - ); - - any ret = nil; - while (true) - { - ret = UI::UserInput(); - if (ret == `close || ret == `cancel) - break; - - any effect_opt = nil; - if ((boolean) UI::QueryWidget(`id(`tiled_effect), `Value)) - effect_opt = `tiled; - else if ((boolean) UI::QueryWidget(`id(`scaled_effect), `Value)) - effect_opt = `scaleToFit; - - // needed for tiling (scaling sets this automatically, anyway...) - any zerowidth = nil; - any zeroheight = nil; - if (effect_opt != nil) { - zerowidth = `zeroWidth; - zeroheight = `zeroHeight; - } - - string filename = ""; - if ((boolean) UI::QueryWidget(`id(`movie1), `Value)) - filename = "tests/movie1.mng"; - else if ((boolean) UI::QueryWidget(`id(`movie2), `Value)) - filename = "tests/movie2.mng"; - else if ((boolean) UI::QueryWidget(`id(`movie3), `Value)) - filename = "tests/movie3.mng"; - else if ((boolean) UI::QueryWidget(`id(`movie4), `Value)) - filename = "tests/movie4.mng"; - else if ((boolean) UI::QueryWidget(`id(`movie5), `Value)) - filename = "tests/movie5.mng"; - else if ((boolean) UI::QueryWidget(`id(`movie6), `Value)) - filename = "tests/movie6.mng"; - else if ((boolean) UI::QueryWidget(`id(`movie7), `Value)) - filename = "tests/movie7.mng"; - else - filename = "tests/movie8.mng"; - - // to test inline images, uncomment next line and pass it to `Image - //byteblock data = (byteblock) SCR::Read (.target.byte, filename); - - UI::ReplaceWidget (`replace_image, - `Image (`opt (`animated, effect_opt, zerowidth, zeroheight), - filename, filename + " not found")); - - } - - UI::CloseDialog(); -} - diff --git a/tests/InputField-Event.ycp b/tests/InputField-Event.ycp deleted file mode 100644 index aad9b720..00000000 --- a/tests/InputField-Event.ycp +++ /dev/null @@ -1,36 +0,0 @@ -{ - UI::OpenDialog( - `VBox( - `InputField(`id(`field1), `opt(`notify), ""), - `InputField(`id(`field2), `opt(`notify), "") - ) - ); - - symbol widget = nil; - - do { - - widget = (symbol) UI::UserInput(); - - switch (widget) - { - case `field1: - { - string v = (string) UI::QueryWidget(`id(`field1), `Value); - UI::ChangeWidget(`id(`field2), `Value, v + "a"); - } - break; - - case `field2: - { - string v = (string) UI::QueryWidget(`id(`field2), `Value); - UI::ChangeWidget(`id(`field1), `Value, v + "b"); - } - break; - } - - } while (widget != `cancel); - - UI::CloseDialog(); -} - diff --git a/tests/InvalidWidget.ycp b/tests/InvalidWidget.ycp deleted file mode 100644 index 452b84f4..00000000 --- a/tests/InvalidWidget.ycp +++ /dev/null @@ -1,33 +0,0 @@ -// Invalid Widget -- bug 421794 - -{ - // a top dialog, so we don't get an error on the UserInput() at the end - UI::OpenDialog (`Label ("top")); - - // press the button to emit some events - UI::OpenDialog ( - `VBox ( - `Label ("Press the Button"), - `PushButton (`id (`ok), "Ok") - ) - ); - sleep (4000); - - UI::CloseDialog(); // destroy the thing - - // overwrite the memory - UI::OpenDialog ( - `VBox ( - `Label ("Wait a sec") - ) - ); - sleep (500); - UI::CloseDialog(); - - UI::PollInput(); // crash on -gtk, if button clicked -// UI::UserInput(); // use either: both crash the thing - - sleep (2000); - UI::CloseDialog(); -} - diff --git a/tests/Label-Underline.ycp b/tests/Label-Underline.ycp deleted file mode 100644 index 71911c71..00000000 --- a/tests/Label-Underline.ycp +++ /dev/null @@ -1,31 +0,0 @@ -// Underline Example - bug 559226 -// -// Escape literal '&' - -{ - import "Wizard"; - import "Popup"; - import "Label"; - - Wizard::CreateDialog (); - Wizard::SetContentsButtons ("Default button demo", - `VBox( - `PushButton("&One"), - `PushButton("&Tw&o"), - `PushButton("Escape&&"), - `PushButton("&Escape &&2"), - `PushButton("&Escape &&2&&&&"), - `PushButton("Escape &&&2&&&&"), - `PushButton("_gtk1"), - `PushButton("__gtk2") - ), - "Help", - Label::BackButton(), - Label::NextButton() - ); - - - Wizard::UserInput(); - Wizard::CloseDialog(); -} - diff --git a/tests/Layout-Align-Weight.ycp b/tests/Layout-Align-Weight.ycp deleted file mode 100755 index 0105dd17..00000000 --- a/tests/Layout-Align-Weight.ycp +++ /dev/null @@ -1,11 +0,0 @@ -// alignment - weight test -{ -UI::OpenDialog( - `HBox( - `Right (`HWeight (1, `PushButton ("Left"))), - `Left (`HWeight (1, `PushButton ("Right"))) - ) -); -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/Layout-AlignStretch.ycp b/tests/Layout-AlignStretch.ycp deleted file mode 100644 index 78ded82a..00000000 --- a/tests/Layout-AlignStretch.ycp +++ /dev/null @@ -1,15 +0,0 @@ -// alignment (test case for inst_productsources bug) -{ -UI::OpenDialog( - `VBox( - `HBox( - `PushButton ("Fixed"), - `Bottom (`PushButton ("Test")) - ), - `VWeight( 1, `MultiLineEdit("Description", "bla bla") ) - ) -); -UI::UserInput(); -UI::CloseDialog(); -} - diff --git a/tests/Layout-Expand.ycp b/tests/Layout-Expand.ycp deleted file mode 100755 index e0a4cc67..00000000 --- a/tests/Layout-Expand.ycp +++ /dev/null @@ -1,32 +0,0 @@ -// Widgets expand and align -{ -// stand-alone -UI::OpenDialog( - `HBox( - `VBox ( - `MultiLineEdit ("Multi Line Edit", "some text"), - `PushButton ("Yes") - ), - `PushButton ("No") - ) - ); -UI::UserInput(); - -// on wizard -UI::OpenDialog( - `Wizard (`back, "&Back", `abort, "Ab&ort", `next, "&Next") - ); - -UI::ReplaceWidget (`id (`contents), - `HBox( - `VBox ( - `MultiLineEdit ("Multi Line Edit", "some text"), - `PushButton ("Yes") - ), - `PushButton ("No") - ) - ); - -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/Layout-Frame2.ycp b/tests/Layout-Frame2.ycp deleted file mode 100755 index 416fec9c..00000000 --- a/tests/Layout-Frame2.ycp +++ /dev/null @@ -1,18 +0,0 @@ -{ - UI::OpenDialog( `VBox( - `Frame ( `opt (`vstretch), "CPU &Speed", - `RadioButtonGroup( - `VBox( - `Left(`RadioButton("Normal" )), - `Left(`RadioButton("Overclocked" )), - `Left(`RadioButton("Red Hot" )), - `Left(`RadioButton("Melting", true )) - ) - ) - ), - `PushButton("&OK") - ) - ); - UI::UserInput(); - UI::CloseDialog(); -} diff --git a/tests/Layout-HVCenter-Align.ycp b/tests/Layout-HVCenter-Align.ycp deleted file mode 100755 index 52d5315e..00000000 --- a/tests/Layout-HVCenter-Align.ycp +++ /dev/null @@ -1,9 +0,0 @@ -// HVCenter alignment test -{ -UI::OpenDialog( - `HVCenter (`ColoredLabel(`opt (`hstretch, `vstretch), "Hello, World!", `rgb (200, 0, 0), `rgb (200, 200, 50), 20)) -); - -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/Layout-ReplacePoint.ycp b/tests/Layout-ReplacePoint.ycp deleted file mode 100755 index 9dbae348..00000000 --- a/tests/Layout-ReplacePoint.ycp +++ /dev/null @@ -1,13 +0,0 @@ -// replacement stretchable test -{ -UI::OpenDialog( - `ReplacePoint (`id (`rp), `PushButton ("Push Me!")) -); - -UI::UserInput(); - -UI::ReplaceWidget (`rp, `MultiLineEdit ("", "I should be all stretched!")); - -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/Layout-Split-Split.ycp b/tests/Layout-Split-Split.ycp deleted file mode 100755 index 2e65b3af..00000000 --- a/tests/Layout-Split-Split.ycp +++ /dev/null @@ -1,21 +0,0 @@ -// Split in a split behavior -{ -UI::OpenDialog (`opt (`defaultsize), `HBox (`PushButton ("Okay"))); -UI::UserInput(); - -UI::OpenDialog (`opt (`defaultsize), `HBox (`PushButton ("Okay"), `VBox (`PushButton ("Nay"), `PushButton ("Pay")))); -UI::UserInput(); - -UI::OpenDialog(`opt (`defaultsize), `Wizard (`back, "&Back", `abort, "Ab&ort", `next, "&Next")); -UI::ReplaceWidget (`contents, `HBox (`VBox(`PushButton ("Okay")), `VBox (`PushButton ("Nay"), `PushButton ("Pay")))); -UI::UserInput(); - -UI::OpenDialog (`opt (`defaultsize), `VBox (`HBox (`VBox(`PushButton ("Okay")), `VBox (`PushButton ("Nay"), `PushButton ("Pay"))))); -UI::UserInput(); - -UI::OpenDialog (`opt (`defaultsize), `VBox (`HBox(`PushButton ("Okay")))); -UI::UserInput(); - -UI::OpenDialog (`opt (`defaultsize), `HBox (`VBox(`PushButton ("Okay")))); -UI::UserInput(); -} diff --git a/tests/Layout-Truncated-Widget.ycp b/tests/Layout-Truncated-Widget.ycp deleted file mode 100644 index ca318a53..00000000 --- a/tests/Layout-Truncated-Widget.ycp +++ /dev/null @@ -1,44 +0,0 @@ -// Let's create and destroy something - -{ - -list strings = - [ "What a long button I am :D", ":/" ]; -integer cur_string = 1; - -UI::OpenDialog - ( - `MarginBox (5, 5, `VBox - ( - `ReplacePoint(`id(`kill_replaceable), `PushButton( `id(`kill), - "I am a waste of space" )), - `PushButton( `id(`transform), select(strings, cur_string, nil) ), - `Left (`PushButton( `id(`quit), "Exit" )) - ) - ) - ); - -any button_id = nil; - -while (true) - { - button_id = UI::UserInput(); - - if (button_id == `quit) - break; - - if (button_id == `transform) - { - cur_string = (cur_string + 1) % 2; - UI::ChangeWidget (`transform, `Label, select(strings, cur_string, nil)); - } - - if (button_id == `kill) - { - UI::ReplaceWidget (`kill_replaceable, `Empty()); - } - - - } -UI::CloseDialog(); -} diff --git a/tests/Layout-Wizard-BackgroundWidget.ycp b/tests/Layout-Wizard-BackgroundWidget.ycp deleted file mode 100755 index 7c4a3cf4..00000000 --- a/tests/Layout-Wizard-BackgroundWidget.ycp +++ /dev/null @@ -1,15 +0,0 @@ -// Widget with background on wizard -{ -UI::OpenDialog (`opt(`defaultsize), - `Wizard (`back, "&Back", `abort, "Ab&ort", `next, "&Next") - ); - - UI::ReplaceWidget (`contents, - `VBox ( - `HVCenter (`BackgroundPixmap ("wallpapers/welcome.jpg"), - `MultiLineEdit ("", "I should have a background around me.")) - ) - ); -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/Layout-Wizard-OneWidget.ycp b/tests/Layout-Wizard-OneWidget.ycp deleted file mode 100755 index fa95cbab..00000000 --- a/tests/Layout-Wizard-OneWidget.ycp +++ /dev/null @@ -1,13 +0,0 @@ -// wizard, one widget test -{ -UI::OpenDialog( - `Wizard (`back, "&Back", `abort, "Ab&ort", `next, "&Next") -); - -UI::ReplaceWidget (`contents, `ColoredLabel(`opt (`hstretch, `vstretch), "Hello, World!", `rgb (200, 0, 0), `rgb (200, 200, 50), 20)); -// non-stretchable: -//UI::ReplaceWidget (`contents, `ColoredLabel("Hello, World!", `rgb (200, 0, 0), `rgb (200, 200, 50), 20)); - -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/Layout-Wizard3.ycp b/tests/Layout-Wizard3.ycp deleted file mode 100755 index 4e06b084..00000000 --- a/tests/Layout-Wizard3.ycp +++ /dev/null @@ -1,30 +0,0 @@ -// The widget should get center aligned on wizard, but not ordinary dialogs -{ -// stand-alone -UI::OpenDialog( - `VBox( - `Heading ("Header"), - `VSpacing (0.5), - `Label ("This text should get on top") - ) - ); -UI::UserInput(); - -// on wizard -UI::OpenDialog( - `Wizard (`back, "&Back", `abort, "Ab&ort", `next, "&Next") - ); - - -UI::ReplaceWidget (`id (`contents), - `VBox( - `Heading ("Header"), - `VSpacing (0.5), - `Label ("This text should get centered") - ) - ); - - -UI::UserInput(); -UI::CloseDialog(); -} diff --git a/tests/LogView.ycp b/tests/LogView.ycp deleted file mode 100644 index 9e41a1bd..00000000 --- a/tests/LogView.ycp +++ /dev/null @@ -1,27 +0,0 @@ -// LogView test - -{ - UI::OpenDialog ( - `VBox ( - `LogView (`id (`text), "", 5, 50), - `MultiLineEdit (`id (`source), `opt(`notify), "Source code", ""), - `PushButton (`id (`close), `opt(`default), "&Close") - ) - ); - - any ret = nil; - repeat - { - ret = UI::UserInput(); - - if (ret == `source) - { - UI::ChangeWidget (`id (`text), `Value, - (string) UI::QueryWidget(`id(`source), `Value)); - } - - } until (ret == `close || ret == `cancel); - - UI::CloseDialog(); -} - diff --git a/tests/MainDialogs.ycp b/tests/MainDialogs.ycp deleted file mode 100644 index 859cfe75..00000000 --- a/tests/MainDialogs.ycp +++ /dev/null @@ -1,38 +0,0 @@ -// This is a test for the usage of multiple main dialogs -// (that is with the defaultsize attribute). They should -// all share the same window. - -{ - UI::OpenDialog (`opt (`defaultsize), - `VBox ( - `Heading ("First dialog"), - `PushButton (`id (`next), "Next"), - `PushButton ("Close") - ) - ); - - while (UI::UserInput() == `next) { - UI::OpenDialog (`opt (`defaultsize), - `VBox ( - `Heading ("Second dialog"), - `PushButton (`id (`next), "Next"), - `PushButton ("Back") - ) - ); - - while (UI::UserInput() == `next) { - UI::OpenDialog (`opt (`defaultsize), - `VBox ( - `Heading ("Third dialog"), - `PushButton ("Close") - ) - ); - UI::UserInput(); - UI::CloseDialog(); - } - - UI::CloseDialog(); - } - - UI::CloseDialog(); -} diff --git a/tests/MultiLine.ycp b/tests/MultiLine.ycp deleted file mode 100644 index c2151198..00000000 --- a/tests/MultiLine.ycp +++ /dev/null @@ -1,62 +0,0 @@ -// MultiLine Example -{ - string description = "Below is test Archive Description, please ignore its content ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -PSA Peugeot Citroën Chooses SUSE Linux Enterprise Desktop from Novell -PARIS (Solutions Linux 2007) -30 Jan 2007 - -Giant French automaker to deploy Linux desktops, citing cost, usability, integration and support - -PSA Peugeot Citroën, the second-largest automobile manufacturer in Europe, and Novell just signed a multiyear contract allowing the deployment of up to 20,000 Linux* desktops plus 2,500 Linux servers from Novell. - -“We found SUSE® Linux Enterprise Desktop to be well supported and extremely user friendly,” said an IT representative for PSA Peugeot Citroën. “Novell's commitment to open source and close collaboration with leading hardware and application vendors to ensure the support of our IT requirements were key factors in our choice. In addition, SUSE Linux Enterprise Desktop integrates seamlessly in our Windows-based infrastructure.” - -Ron Hovsepian, president and CEO of Novell, said, “PSA Peugeot Citroën has discovered the value a market-ready Linux platform can bring to their business, and SUSE Linux Enterprise Desktop is the market's only enterprise-class Linux desktop ready for routine business use. We are pleased to provide a compelling alternative to PSA Peugeot Citroën's current proprietary desktop platform and help the organization reduce costs while advancing its next-generation IT architecture.” - -SUSE Linux Enterprise Desktop delivers ease of use at lower hardware cost and many innovative features including three-dimensional desktop graphics, integrated search and a fully compatible office productivity suite through the Novell® edition of OpenOffice.org 2, all at a small fraction of the price of the proprietary operating system and office suite alternatives. SUSE Linux Enterprise Desktop is suited for complete desktop replacements, retail point of service solutions, thin-client deployments and engineering workstations. For more information on SUSE Linux Enterprise offerings from Novell, visit http://www.novell.com/linux. -About Novell - -Novell, Inc. (Nasdaq: NOVL) delivers infrastructure software for the Open Enterprise. We are a leader in enterprise-wide operating systems based on Linux and open source and the security and systems management services required to operate mixed IT environments. We help our customers minimize cost, complexity and risk, allowing them to focus on innovation and growth. For more information, visit http://www.novell.com . - -Novell and SUSE are registered trademarks of Novell, Inc. in the United States and other countries. *Linux is a registered trademark of Linus Torvalds. All other third-party trademarks are the property of their respective owners. -Press Contact - -Ian Bruce -Novell, Inc. -Telephone: +1 781 464-8034 -Email: ibruce@novell.com"; - UI::OpenDialog ( - `VBox ( - `RadioButtonGroup (`id(`rb), - `VBox( - `Left (`RadioButton(`id(`edit_enabled), `opt(`notify), "&Enabled", true)), - `Left (`RadioButton(`id(`edit_disabled), `opt(`notify), "&Disabled")) - ) - ), - `ReplacePoint (`id(`replace_edit), - `MultiLineEdit(`id(`description), `opt(nil),"Archive &Description", description) - ), - `PushButton(`id (`close), "&Close") - ) - ); - - any ret = nil; - while (true) - { - ret = UI::UserInput(); - if (ret == `close || ret == `cancel) - break; - any edit_status = nil; - if ((boolean) UI::QueryWidget(`id(`edit_enabled), `Value)) - edit_status = nil; - else if ((boolean) UI::QueryWidget(`id(`edit_disabled), `Value)) - edit_status = `disabled; - UI::ReplaceWidget (`replace_edit, - `MultiLineEdit(`id(`description), `opt(edit_status), - "Archive &Description", description)); - } - - UI::CloseDialog(); -} - diff --git a/tests/MultiProgressMeterHuge.ycp b/tests/MultiProgressMeterHuge.ycp deleted file mode 100644 index 01ec1e90..00000000 --- a/tests/MultiProgressMeterHuge.ycp +++ /dev/null @@ -1,39 +0,0 @@ -// Simple example for MultiProgressMeter -{ - if ( ! UI::HasSpecialWidget(`HMultiProgressMeter ) ) - { - UI::OpenDialog( - `VBox( - `Label("Error: This UI doesn't support the MultiProgressMeter widget!"), - `PushButton(`opt(`default), "&OK") - ) - ); - UI::UserInput(); - UI::CloseDialog(); - - return; - } - - - UI::OpenDialog( - `VBox( - `HMultiProgressMeter(`id(`prog), [ 10000, 200, 500, 20, 100 ] ), - `PushButton(`opt(`default), "&Ok" ) - ) - ); - - UI::ChangeWidget(`prog, `Values, [ 1000, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 800, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 500, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 200, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 200, 500, 20, 100 ] ); UI::UserInput(); - - UI::ChangeWidget(`prog, `Values, [ 0, 100, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 20, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 500, 20, 100 ] ); UI::UserInput(); - - UI::ChangeWidget(`prog, `Values, [ 0, 0, 400, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 300, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 200, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 100, 20, 100 ] ); UI::UserInput(); -} diff --git a/tests/MultiProgressMeterVer.ycp b/tests/MultiProgressMeterVer.ycp deleted file mode 100644 index ca624e95..00000000 --- a/tests/MultiProgressMeterVer.ycp +++ /dev/null @@ -1,39 +0,0 @@ -// Simple example for MultiProgressMeter -{ - if ( ! UI::HasSpecialWidget(`HMultiProgressMeter ) ) - { - UI::OpenDialog( - `VBox( - `Label("Error: This UI doesn't support the MultiProgressMeter widget!"), - `PushButton(`opt(`default), "&OK") - ) - ); - UI::UserInput(); - UI::CloseDialog(); - - return; - } - - - UI::OpenDialog( - `VBox( - `VMultiProgressMeter(`id(`prog), [ 100, 200, 500, 20, 100 ] ), - `PushButton(`opt(`default), "&Ok" ) - ) - ); - - UI::ChangeWidget(`prog, `Values, [ 1000, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 800, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 500, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 200, 200, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 200, 500, 20, 100 ] ); UI::UserInput(); - - UI::ChangeWidget(`prog, `Values, [ 0, 100, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 20, 500, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 500, 20, 100 ] ); UI::UserInput(); - - UI::ChangeWidget(`prog, `Values, [ 0, 0, 400, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 300, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 200, 20, 100 ] ); UI::UserInput(); - UI::ChangeWidget(`prog, `Values, [ 0, 0, 100, 20, 100 ] ); UI::UserInput(); -} diff --git a/tests/MultiSelectionBox.ycp b/tests/MultiSelectionBox.ycp deleted file mode 100644 index 08a3b454..00000000 --- a/tests/MultiSelectionBox.ycp +++ /dev/null @@ -1,16 +0,0 @@ -// MultiSelectionBox -- test notify flag -{ -list items = - [ "Spaghetti", "Steak Sandwich", "Chili", "Salami Baguette" ]; - -UI::OpenDialog ( - `MinSize (30, 10, - `MultiSelectionBox (`id(`list), `opt (`notify), - "Plates", items) - ) - ); - -UI::UserInput(); -UI::CloseDialog(); -} - diff --git a/tests/PollInput.ycp b/tests/PollInput.ycp deleted file mode 100644 index 6f095535..00000000 --- a/tests/PollInput.ycp +++ /dev/null @@ -1,26 +0,0 @@ -// Event pooling -- test bug that causes package manager post-script -// `cancel events to be ignored. -{ - UI::OpenDialog ( - `VBox( - `Label ("Blocked - UserInput()"), - `PushButton (`id (`button), "Ok") - ) - ); - UI::UserInput(); - UI::CloseDialog(); - - UI::OpenDialog ( - `VBox( - `Label ("Un-blocked - PollInput()"), - `PushButton (`id (`button), "Ok") - ) - ); - any event = nil; - repeat { - sleep (1000); - event = UI::PollInput(); - } until (event != nil); - UI::CloseDialog(); -} - diff --git a/tests/ProgressBar.ycp b/tests/ProgressBar.ycp deleted file mode 100644 index 338f0110..00000000 --- a/tests/ProgressBar.ycp +++ /dev/null @@ -1,45 +0,0 @@ -// Auto ProgressBar example -{ - integer max_progress = 10; - integer progress = 0; - - UI::OpenDialog( - `VBox( - `MinSize (60, 0, `ProgressBar (`id (`pr), "Progress bar", max_progress, progress)), - `Right (`PushButton (`id (`close), "&Close")) - ) - ); - - symbol strategy = `same; - integer timeout = 0; - - while (progress < max_progress) { - if (strategy == `same) - timeout = 2000; - else if (strategy == `incremental) { - if (timeout == 0) - timeout = 3000; - else - timeout = timeout - 250; - } - else if (strategy == `decremental) { - if (timeout == 0) - timeout = 500; - else - timeout = timeout + 250; - } -/* else if (strategy == `random) - timeout = 2000;*/ - sleep (timeout); - - symbol event = (symbol) UI::PollInput(); - if (event == `close || event == `cancel) - break; - - progress = progress + 1; - UI::ChangeWidget(`id(`pr), `Value, progress); - } - - UI::CloseDialog(); -} - diff --git a/tests/RichText1.ycp b/tests/RichText1.ycp deleted file mode 100644 index a5843510..00000000 --- a/tests/RichText1.ycp +++ /dev/null @@ -1,26 +0,0 @@ -// RichText test - -{ - UI::OpenDialog (`opt (`defaultsize), - `VBox ( - `RichText (`id (`rtext), ""), - `MultiLineEdit (`id (`source), `opt(`notify), "Source code", ""), - `PushButton (`id (`close), `opt(`default), "&Close") - ) - ); - - any ret = nil; - repeat - { - ret = UI::UserInput(); - - if (ret == `source) - { - UI::ChangeWidget (`id (`rtext), `Value, - (string) UI::QueryWidget(`id(`source), `Value)); - } - - } until (ret == `close || ret == `cancel); - - UI::CloseDialog(); -} diff --git a/tests/RichText2.ycp b/tests/RichText2.ycp deleted file mode 100644 index 2330a99b..00000000 --- a/tests/RichText2.ycp +++ /dev/null @@ -1,112 +0,0 @@ -// RichText test (with a list of examples) -{ - list texts = [ - // simple - "

Hello world!

", - "

Operating Systems

Linux

Suse", - - // the br & hr tags - "Drinking ice tea

is good for you.", - - // Broken end element - "Broken end element elided", - - // the li tags - "Things to do
  • foo
  • baa
  • baz.", - - // unclosed tags - "No outer tag

    Unclosed paragraphs

    several of them unclosed bold", - - // Some more complete text, with an image - "

    Super Man " - + "to the rescue

    Super Man is a very " - + "estimated super hero in Metropolis, but he is looked down by others " - + "like mad scientists and politiceans. ", - - // table (from SlideShow) - "" - + "" - + "" - + "" - + "" - + "
    " - + "" - + "" - + "

    XMMS and JuK - Powerful Jukeboxes

    " - + "

    XMMS is an excellent sound player for Linux. It is easy to use and supports" - + "various formats, including audio CDs. Test the many visualization plug-ins or" - + "download your favorite XMMS skins from the web.

    " - + "

    New in KDE: JuK, which classifies your MP3s and organizes your music" - + "collection.

    " - + "

    Want More?

    " - + "

    The SUSE distribution features a wide range of applications for playing" - + "your CDs and MP3 songs. For example, KsCD is a user-friendly CD player. The" - + "track information for most CDs is available on the Internet. Simply activate" - + "the respective function to display the list.

    " - + "
    " - ]; - - UI::OpenDialog ( - `VBox ( - `ReplacePoint (`id (`replace_text), - `RichText (`id (`text), texts[0]:nil) - ), - `MultiLineEdit (`id (`source), `opt (`notify), "Source code", texts[0]:nil), - `Label (`id(`link), `opt(`hstretch), ""), - `Slider (`id (`slider), `opt(`notify), "Test text case:", 0, size (texts)-1, 0), - `HBox ( - `CheckBox (`id (`scroll), `opt (`notify), "&Auto-scroll", false), - `CheckBox (`id (`plain), `opt (`notify), "&Plain", false), - `HStretch(), - `PushButton (`id (`close), `opt (`default), "&Close") - ) - ) - ); - - any ret = nil; - repeat - { - ret = UI::UserInput(); - - if (ret == `slider) - { - integer cur_text = (integer) UI::QueryWidget (`id(`slider), `Value); - UI::ChangeWidget (`id (`source), `Value, texts[cur_text]:nil); - UI::ChangeWidget (`id (`text), `Value, texts[cur_text]:nil); - UI::ChangeWidget (`id(`link), `Value, ""); - } - - else if (ret == `source) - { - UI::ChangeWidget (`id (`text), `Value, - (string) UI::QueryWidget(`id(`source), `Value)); - UI::ChangeWidget (`id(`link), `Value, ""); - } - - else if (ret == `scroll || ret == `plain) - { - any scroll_opt = nil; - if ((boolean) UI::QueryWidget (`scroll, `Value)) - scroll_opt = `autoScrollDown; - any plain_opt = nil; - if ((boolean) UI::QueryWidget (`plain, `Value)) - plain_opt = `plainText; - UI::ReplaceWidget (`replace_text, - `RichText (`id (`text), `opt (scroll_opt, plain_opt), "")); - - integer cur_text = (integer) UI::QueryWidget (`id(`slider), `Value); - UI::ChangeWidget (`id (`text), `Value, texts[cur_text]:nil); - } - - else - { // RichText doesn't seem to pass its id... - string url = sformat ("%1", ret); - UI::ChangeWidget (`id(`link), `Value, "You pressed: " + url); - } - - } until (ret == `close || ret == `cancel); - - UI::CloseDialog(); -} diff --git a/tests/RussianAccel.ycp b/tests/RussianAccel.ycp deleted file mode 100644 index 49a97560..00000000 --- a/tests/RussianAccel.ycp +++ /dev/null @@ -1,10 +0,0 @@ -{ - UI::OpenDialog( - `VBox( - `Label("Привет!"), - `PushButton("Хоро&шо") - ) - ); - UI::UserInput(); - UI::CloseDialog(); -} diff --git a/tests/SelectionBox.ycp b/tests/SelectionBox.ycp deleted file mode 100755 index 22beb1d8..00000000 --- a/tests/SelectionBox.ycp +++ /dev/null @@ -1,45 +0,0 @@ -// SelectionBox change and lookup test -{ -list itemlist1 = - [ "Spaghetti", "Steak Sandwich", "Chili", "Salami Baguette" ]; - -list itemlist2 = - [ "Mercedes", "AUDI", "VW", "BMW", "Porsche" ]; - -list itemslists = [ itemlist1, itemlist2 ]; - -integer listnum = 0; - -UI::OpenDialog ( - `VBox ( - `MinSize (30, 10, - `SelectionBox (`id(`list), `opt (`immediate), - "Prices", itemlist1) - ), - `TextEntry (`id(`text), "Current item:", ""), - `Right ( - `HBox ( - `PushButton (`id (`next), "Change &List Contents"), - `PushButton (`id (`cancel), "&Close") - ) - ) - ) - ); - -any ret = nil; -while (ret != `cancel) { - ret = UI::UserInput(); - - if (ret == `next) { - listnum = 1 - listnum; - UI::ChangeWidget (`id(`list), `Items, select (itemslists, listnum, nil)); - } - - if (ret == `list) { - string item = (string) UI::QueryWidget(`id(`list), `CurrentItem); - UI::ChangeWidget (`id (`text), `Value, item); - } -} - -UI::CloseDialog(); -} diff --git a/tests/Sleep.ycp b/tests/Sleep.ycp deleted file mode 100644 index dd711322..00000000 --- a/tests/Sleep.ycp +++ /dev/null @@ -1,33 +0,0 @@ -// wait for event (sleep) -// strangely, the Qt UI doesn't show the buttons being pressed, though -// they obviously are since the event gets caught - -{ - UI::OpenDialog ( - `VBox ( - `Label ("Press the Button"), - `CheckBox ("Check this"), - `PushButton (`id (`one), "One"), - `PushButton (`id (`two), "Two") - ) - ); - sleep (4000); - - any widget = nil; - widget = UI::PollInput(); - UI::CloseDialog(); - - string text = "none"; - if (widget == `one) - text = "One"; - if (widget == `two) - text = "Two"; - - UI::OpenDialog ( - `VBox ( - `Label ("You pressed " + text) - ) - ); - sleep (4000); -} - diff --git a/tests/Slider-Event.ycp b/tests/Slider-Event.ycp deleted file mode 100644 index 9c06b56b..00000000 --- a/tests/Slider-Event.ycp +++ /dev/null @@ -1,36 +0,0 @@ -{ - UI::OpenDialog( - `VBox( - `Slider(`id(`slider1), `opt(`notify), "", 0, 1000, 50), - `Slider(`id(`slider2), `opt(`notify), "", 0, 1000, 500) - ) - ); - - symbol widget = nil; - - do { - - widget = (symbol) UI::UserInput(); - - switch (widget) - { - case `slider1: - { - integer i = (integer) UI::QueryWidget(`id(`slider1), `Value); - UI::ChangeWidget(`id(`slider2), `Value, i+1); - } - break; - - case `slider2: - { - integer i = (integer) UI::QueryWidget(`id(`slider2), `Value); - UI::ChangeWidget(`id(`slider1), `Value, i+1); - } - break; - } - - } while (widget != `cancel); - - UI::CloseDialog(); -} - diff --git a/tests/StockButtons.ycp b/tests/StockButtons.ycp deleted file mode 100644 index 86412b58..00000000 --- a/tests/StockButtons.ycp +++ /dev/null @@ -1,20 +0,0 @@ -{ - UI::OpenDialog( - `VBox( - `PushButton ("&Add"), - `PushButton ("&Edit"), - `PushButton ("&Resize"), - `PushButton ("&Remove"), - `HBox( - `PushButton ("&Add"), - `PushButton ("&Edit"), - `PushButton ("&Resize"), - `PushButton ("&Remove") - ) - ) - ); - - UI::UserInput(); - UI::CloseDialog(); -} - diff --git a/tests/StockIcons.ycp b/tests/StockIcons.ycp deleted file mode 100644 index abf7cee8..00000000 --- a/tests/StockIcons.ycp +++ /dev/null @@ -1,55 +0,0 @@ -// Stock Icons test - -{ - list stock_icons = [ - "Ok", - "Cancel", - "Abort", - "Apply", - "About", - "Connect", - "Disconnect", - "Edit", - "Open", - "Close", - "New", - "Quit", - "Print", - "Save", - "Save As", - "Yes", - "No", - - ]; - integer i = 0; - - UI::OpenDialog ( - `ReplacePoint (`id (`rp), - `PushButton (`opt (`icon (stock_icons[i]:nil)), stock_icons[i]:"") - ) - ); - - any ret = nil; - while (true) - { - ret = UI::TimeoutUserInput (1000); - - if (ret == `timeout) - { - i = i + 1; - if (i == size (stock_icons)) - break; - else - UI::ReplaceWidget (`rp, - `PushButton (`opt (`icon (stock_icons[i]:nil)), stock_icons[i]:"") - ); - UI::RecalcLayout(); - } - - else - break; - - }; - - UI::CloseDialog(); -} diff --git a/tests/Table-Edit.ycp b/tests/Table-Edit.ycp deleted file mode 100644 index 85b2b8b7..00000000 --- a/tests/Table-Edit.ycp +++ /dev/null @@ -1,60 +0,0 @@ -// bug 459313 - -{ - UI::OpenDialog( - `VBox( - `MinSize( 25, 8, - `Table(`id(`table), `opt(`keepSorting), - `header("Mark", "Name"), - [ - `item(`id(1), "", "Salami Baguette"), - `item(`id(2), "", "Chili"), - `item(`id(3), "", "Steak Sandwich"), - `item(`id(4), "", "Spaghetti") - ] - ) - ), - `HBox ( - `PushButton(`id(`select), "&Select / de-select"), - `PushButton(`id(`lookup), "&Lookup"), - `PushButton(`id(`cancel), "&Close") - ) - ) - ); - - any ret = nil; - repeat { - ret = UI::UserInput(); - - if (ret == `select) { - integer current_item_id = (integer) UI::QueryWidget(`id(`table), `CurrentItem); - boolean selected = UI::QueryWidget(`table, `Cell( current_item_id, 0 ) ) == "X"; - string write = ""; - if (!selected) - write = "X"; - UI::ChangeWidget(`id(`table), `Cell( current_item_id, 0 ), write ); - } - if (ret == `lookup) { - any id = UI::QueryWidget(`id(`table), `CurrentItem); - if (is(id, integer)) { - string text = sformat ( - "Line: %1", UI::QueryWidget(`id(`table), `Item(id))); - UI::OpenDialog ( - `MarginBox (1, 0.2, - `VBox ( - `Left (`Label ("Current Table Item")), - `Label(`opt(`outputField), text), - `PushButton("&OK") - ) - ) - ); - UI::UserInput(); - UI::CloseDialog(); - } - } - - } until (ret == `cancel); - - UI::CloseDialog(); -} - diff --git a/tests/Table3-4.ycp b/tests/Table3-4.ycp deleted file mode 100644 index bb850ff8..00000000 --- a/tests/Table3-4.ycp +++ /dev/null @@ -1,68 +0,0 @@ -// merge of Table3 and Table4 tests -{ -list itemlist1 = - [ `item(`id(3), "Spaghetti", 8), - `item(`id(4), "Steak Sandwich", 12), - `item(`id(1), "Chili", 6), - `item(`id(2), "Salami Baguette", nil) - ]; - -list itemlist2 = - [ `item(`id(0), "Mercedes", 60000), - `item(`id(1), "AUDI", 50000), - `item(`id(2), "VW", 40000), - `item(`id(3), "BMW", 60000), - `item(`id(3), "Porsche", 80000) - ]; - -list itemslists = [ itemlist1, itemlist2 ]; - -integer listnum = 0; - -UI::OpenDialog ( - `VBox ( - `Heading ("Prices"), - `MinSize (30, 10, - `Table (`id(`table), `header("Name", `Right ("price")), itemlist1) - ), - `Right ( - `HBox ( - `PushButton (`id (`lookup), "&Lookup"), - `PushButton (`id (`next), "Change &Table Contents"), - `PushButton (`id (`cancel), "&Close") - ) - ) - ) - ); - -any ret = nil; -while (ret != `cancel) { - ret = UI::UserInput(); - - if (ret == `next) { - listnum = 1 - listnum; - UI::ChangeWidget(`id(`table), `Items, select(itemslists, listnum, nil)); - } - - if (ret == `lookup) { - any id = UI::QueryWidget(`id(`table), `CurrentItem); - if (is(id, integer)) { - string text = sformat ( - "Line: %1", UI::QueryWidget(`id(`table), `Item(id))); - UI::OpenDialog ( - `MarginBox (1, 0.2, - `VBox ( - `Left (`Label ("Current Table Item")), - `Label(`opt(`outputField), text), - `PushButton("&OK") - ) - ) - ); - UI::UserInput(); - UI::CloseDialog(); - } - } -} - -UI::CloseDialog(); -} diff --git a/tests/Tree-rebuild.ycp b/tests/Tree-rebuild.ycp deleted file mode 100644 index 615e4784..00000000 --- a/tests/Tree-rebuild.ycp +++ /dev/null @@ -1,55 +0,0 @@ -{ - // Test Case for Bug 668602 - // Crashing in printer tool: when rebuilding tree after item is selected. - // See if Label is properly set to the item selected. - - UI::OpenDialog(`VBox ( - `Tree(`id(`tree), - `opt(`notify), - "Select destination directory:", - [ - `item( "/" , true, - [ - `item( "etc", - [ - `item("opt"), - `item("SuSEconfig"), - `item("X11") - ] - ) - ] - ) - ] ), - `PushButton (`id (`sel), "Select Value 1"), - `Label (`id (`label), "Selected: (none)") - ) - ); - - any id = nil; - - repeat - { - id = UI::UserInput(); - - if (id == `sel) - UI::ChangeWidget( `id( `tree ), `CurrentItem, "Value 1" ); - - else { - any item = UI::QueryWidget (`tree, `CurrentItem); - - UI::ChangeWidget( `id( `label ), `Value, sformat( "%1", item ) ); - - - UI::ChangeWidget (`tree, `Items, ( [ - `item( "Option 1:" , false, - [ - `item( "Value 1" , true ), - `item( "Value 2" , true ) - ] ) - ])); - } - - } until ( id == `cancel ); - UI::CloseDialog(); -} - diff --git a/tests/Tree3.ycp b/tests/Tree3.ycp deleted file mode 100644 index a0c9061b..00000000 --- a/tests/Tree3.ycp +++ /dev/null @@ -1,123 +0,0 @@ -{ - // Build a dialog with a tree for directory selection, three - // buttons with common values and a label that directly echoes any - // selected directory. - // - // The tree in this example uses the `notify option that makes - // UI::UserInput() return immediately as soon as the user selects a - // tree item rather than the default behaviour which waits for the - // user to activate a button. - - UI::OpenDialog( - `MinWidth( 50, - `VBox( - `Tree(`id(`dest_dir), - `opt(`notify), - "Select destination directory:", - [ - `item( "/" , true, - [ - `item( "etc", - [ - `item("opt"), - `item("SuSEconfig"), - `item("X11") - ] - ), - `item( "usr", false, - [ - "bin", - "lib", - `item("share", - [ - "man", - "info", - "emacs" - ] - ), - `item( `id(`usr_local), "local" ), - `item("X11R6", - [ - "bin", - "lib", - "share", - "man", - "etc" - ] - ) - ] - ), - `item( `id(`opt), "opt", true, - [ - "kde", - "netscape", - "Office51" - ] - ), - `item("home"), - "work", - `item( "") - ] - ) - ] ), - `HBox( - `PushButton(`id(`sel_opt), `opt(`hstretch), "/&opt" ), - `PushButton(`id(`sel_usr), `opt(`hstretch), "/&usr" ), - `PushButton(`id(`sel_usr_local), `opt(`hstretch), "/usr/&local" ) - ), - `HBox( - `HWeight( 2, `Label("Current Item:") ), - `HWeight( 5, `Label(`id(`echoItem), `opt(`outputField, `hstretch), "") ) - ), - `HBox( - `HWeight( 2, `Label("Current Branch:") ), - `HWeight( 5, `Label(`id(`echoBranch), `opt(`outputField, `hstretch), "") ) - ), - `HBox( - `HWeight( 2, `Label("Current Path:") ), - `HWeight( 5, `Label(`id(`echoPath), `opt(`outputField, `hstretch), "") ) - ), - `PushButton(`id(`ok), `opt(`default, `icon ("ok")), "&OK") - ) - ) - ); - - any id = nil; - - repeat - { - id = UI::UserInput(); - - if ( id == `sel_usr) UI::ChangeWidget( `id( `dest_dir ), `CurrentItem, "usr" ); - else if ( id == `sel_usr_local) UI::ChangeWidget( `id( `dest_dir ), `CurrentItem, `usr_local ); - else if ( id == `sel_opt) UI::ChangeWidget( `id( `dest_dir ), `CurrentItem, `opt ); - else if ( id == `dest_dir) - { - any current_dir = UI::QueryWidget(`dest_dir, `CurrentItem ); - - if ( current_dir != nil ) - UI::ChangeWidget( `id( `echoItem ), `Value, sformat( "%1", current_dir ) ); - - list current_branch = (list) UI::QueryWidget(`dest_dir, `CurrentBranch ); - - if ( current_branch != nil ) - { - UI::ChangeWidget(`echoBranch, `Value, sformat( "%1", current_branch) ); - - string current_path = mergestring( current_branch, "/" ); - if ( size( current_path ) > 2 ) - // Remove duplicate "/" at start - current_path = substring( current_path, 1, size( current_path )-1 ); - - UI::ChangeWidget(`echoPath, `Value, sformat( "%1", current_path ) ); - } - } - - } until ( id == `ok ); - - - // Close the dialog. - // Remember to read values from the dialog's widgets BEFORE closing it! - UI::CloseDialog(); - -} diff --git a/tests/Wizard-ChangingTitle.ycp b/tests/Wizard-ChangingTitle.ycp deleted file mode 100644 index 5b5da6a5..00000000 --- a/tests/Wizard-ChangingTitle.ycp +++ /dev/null @@ -1,29 +0,0 @@ -// wizard change must replace window title -// bug 385710 - -{ - UI::OpenDialog(`opt(`defaultsize ), - `Wizard(`opt(`stepsEnabled), - `back, "&Back", - `abort, "Ab&ort", - `next, "&Next" ) ); - - UI::WizardCommand(`SetDialogIcon( "/usr/share/YaST2/theme/current/icons/22x22/apps/YaST.png" ) ); - UI::WizardCommand(`SetDialogHeading( "Welcome to the YaST2 installation" ) ); - - UI::UserInput(); - - UI::OpenDialog(`opt(`defaultsize ), - `Wizard(`opt(`stepsEnabled), - `back, "&Back", - `abort, "Ab&ort", - `next, "&Next" ) ); - - UI::WizardCommand(`SetDialogIcon( "/usr/share/YaST2/theme/current/icons/22x22/apps/YaST.png" ) ); - UI::WizardCommand(`SetDialogHeading( "Goodbye installation!!!" ) ); - - UI::UserInput(); - UI::CloseDialog(); - UI::UserInput(); -} - diff --git a/tests/Wizard.ycp b/tests/Wizard.ycp deleted file mode 100644 index 9aa6f40d..00000000 --- a/tests/Wizard.ycp +++ /dev/null @@ -1,16 +0,0 @@ -// Problematic sizing example... -{ - term contents = `VBox ( - `MinSize ( - 80, 23, // tweak me ! :-) - `ReplacePoint (`id (`base_license_rp), `Empty()) - ), - `PushButton (`id (`show_fulscreen_license), "&Show License...") - ); - - UI::OpenDialog(`opt(`defaultsize ), contents); - UI::WaitForEvent(); - - UI::CloseDialog(); - -} diff --git a/tests/Wizard2.ycp b/tests/Wizard2.ycp deleted file mode 100644 index 3b59cb20..00000000 --- a/tests/Wizard2.ycp +++ /dev/null @@ -1,23 +0,0 @@ -// Problematic labeling example... -{ - import "Label"; - import "Wizard"; - - Wizard::CreateDialog(); - Wizard::SetContents ( - "Installed Add-On Products", - `VBox ( - `Left (`Label("select a monitor")) - ), - "

    Here you can foo.

    ", - false, - true - ); - - Wizard::HideBackButton(); - Wizard::SetAbortButton (`abort, Label::CancelButton()); - Wizard::SetNextButton (`next, Label::OKButton()); - - UI::WaitForEvent(); - UI::CloseDialog(); -} diff --git a/tests/WizardList.ycp b/tests/WizardList.ycp deleted file mode 100644 index 6161e7fc..00000000 --- a/tests/WizardList.ycp +++ /dev/null @@ -1,33 +0,0 @@ -{ -UI::OpenDialog( - `Wizard (`opt (`treeEnabled), - `back, "", `cancel, "", `cancel, "&Exit") - ); - -UI::WizardCommand (`AddTreeItem ("", "Computer", "computer")); -UI::WizardCommand (`AddTreeItem ("computer", "Hardware", "hardware")); -UI::WizardCommand (`AddTreeItem ("hardware", "CPU", "cpu@hardware")); -UI::WizardCommand (`AddTreeItem ("cpu@hardware", "MMU", "mmu")); -UI::WizardCommand (`AddTreeItem ("hardware", "RAM", "ram@hardware")); -UI::WizardCommand (`AddTreeItem ("computer", "Software", "software")); - -any ret = nil; -repeat { - ret = UI::UserInput(); - - string selected = (string) UI::QueryWidget (`id(`wizard), `CurrentItem ); - - if (selected == "mmu") { - UI::ReplaceWidget (`id (`contents), - `Label ("MMU setup") - ); - } - if (selected == "ram@hardware") { - UI::ReplaceWidget (`id (`contents), - `Label ("RAM setup") - ); - } -} until (ret == `cancel); - -UI::CloseDialog(); -} diff --git a/tests/image.gif b/tests/image.gif deleted file mode 100644 index df503810..00000000 Binary files a/tests/image.gif and /dev/null differ diff --git a/tests/movie1.mng b/tests/movie1.mng deleted file mode 100644 index fbea0917..00000000 Binary files a/tests/movie1.mng and /dev/null differ diff --git a/tests/movie2.mng b/tests/movie2.mng deleted file mode 100644 index ed66435c..00000000 Binary files a/tests/movie2.mng and /dev/null differ diff --git a/tests/movie3.mng b/tests/movie3.mng deleted file mode 100644 index 9278819e..00000000 Binary files a/tests/movie3.mng and /dev/null differ diff --git a/tests/movie4.mng b/tests/movie4.mng deleted file mode 100644 index 1678bf66..00000000 Binary files a/tests/movie4.mng and /dev/null differ diff --git a/tests/movie5.mng b/tests/movie5.mng deleted file mode 100644 index 81544780..00000000 Binary files a/tests/movie5.mng and /dev/null differ diff --git a/tests/movie6.mng b/tests/movie6.mng deleted file mode 100644 index 9d5a7960..00000000 Binary files a/tests/movie6.mng and /dev/null differ diff --git a/tests/movie7.mng b/tests/movie7.mng deleted file mode 100644 index c6695c83..00000000 Binary files a/tests/movie7.mng and /dev/null differ diff --git a/tests/movie8.mng b/tests/movie8.mng deleted file mode 100644 index caae44c7..00000000 Binary files a/tests/movie8.mng and /dev/null differ diff --git a/ycc/Makefile b/ycc/Makefile deleted file mode 100644 index e5336bd0..00000000 --- a/ycc/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# Yast Control Center (Yast-GTK) - -CC = g++ -CFLAGS = -Wall `pkg-config gtk+-2.0 --cflags` -LIBS =`pkg-config gtk+-2.0 --libs` - -all: ycc-gtk - -ycc.o: ycc.cpp - $(CC) $(CFLAGS) ycc.cpp -c -o ycc.o - -ycc-gtk: ycc.o - $(CC) $(LIBS) ycc.o -o ycc-gtk - -clean: - rm -f *.o *~ ycc-gtk diff --git a/ycc/ycc.cpp b/ycc/ycc.cpp deleted file mode 100644 index 9269ee07..00000000 --- a/ycc/ycc.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* Yast Control Center (Yast-GTK) */ - -#include -#include -#include -#include -#include -#include -#include - -/* Definitions */ -#define YAST_GROUPS "/usr/share/applications/YaST2/groups/" -#define YAST_ENTRIES "/usr/share/applications/YaST2/" -#define ICONS "/usr/share/YaST2/theme/current/icons/32x32/apps/" - -/* Globals */ -static GtkWidget *window; - -/* Get all names of files in a certain directory. */ -#include -#include -#include -#include -#include - -std::set subfiles(const std::string& path) { - DIR *dirStructP; - struct dirent *direntp; - std::set sfiles; - - if((dirStructP = opendir(path.c_str())) != NULL) { - while((direntp = readdir(dirStructP)) != NULL) { - std::string filename; - struct stat buf; - filename = path + "/" + direntp->d_name; - - if(std::string (direntp->d_name) == "." || - std::string (direntp->d_name) == "..") - continue; // ignore . and .. directories - - if (stat(filename.c_str(), &buf) == 0 && S_ISREG(buf.st_mode)) - sfiles.insert(direntp->d_name); - } - closedir(dirStructP); - } - return sfiles; -} - -/* Erase everything from the given characters. */ -void erase_from (std::string &str, const std::string &chars) -{ - for (unsigned int i = 0; i < chars.length(); i++) { - std::string::size_type pos; - pos = str.find (chars[i], 0); - if (pos != std::string::npos) - str.erase (pos); - } -} - -/* The widget with the icons. */ -class View { - GtkWidget *m_widget; - GtkAdjustment *adjustment; - std::map m_stores; - std::list sort_keys; - -public: - View() - { - m_widget = gtk_notebook_new(); - gtk_notebook_set_tab_pos (GTK_NOTEBOOK (m_widget), GTK_POS_LEFT); - } - - ~View() {} - - GtkWidget *getWidget() - { return m_widget; } - - void addGroup (const gchar *name, const gchar *icon_path, - const gchar *nick, const gchar *sort_key) - { - // calculate position - int pos; - { - std::list ::iterator it; - for (it = sort_keys.begin(), pos = 0; it != sort_keys.end(); it++, pos++) - if (strcmp (it->c_str(), sort_key) >= 0) - break; - sort_keys.insert (it, sort_key); - } - - // label widget - GtkWidget *tab_label, *image, *label; - - GdkPixbuf *icon = NULL; - if (icon_path) { - GError *error = 0; - std::string path = ICONS + std::string (icon_path) + ".png"; - icon = gdk_pixbuf_new_from_file (path.c_str(), &error); - if (!icon) - g_warning ("Could not load icon: %s.\nReason: %s", icon_path, error->message); - } - - tab_label = gtk_hbox_new (FALSE, 0); - label = gtk_label_new (name); - if (icon) - image = gtk_image_new_from_pixbuf (icon); - - if (icon) - gtk_box_pack_start (GTK_BOX (tab_label), image, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (tab_label), label, TRUE, TRUE, icon ? 6 : 0); - - // page widget - GtkListStore *store = gtk_list_store_new (3, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING); - m_stores [nick] = store; - - GtkWidget *icons_view; - icons_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store)); - gtk_icon_view_set_text_column (GTK_ICON_VIEW (icons_view), 0); - gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icons_view), 1); - g_signal_connect(G_OBJECT (icons_view), "item-activated", - G_CALLBACK (executeCommand), this); - - GtkWidget *page; - page = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (page), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (page), GTK_SHADOW_IN); - gtk_container_add (GTK_CONTAINER (page), icons_view); - - // add those to the notebook - gtk_widget_show_all (tab_label); - gtk_notebook_insert_page_menu (GTK_NOTEBOOK (m_widget), page, tab_label, NULL, pos); - } - - void addEntry (const gchar *group, const gchar *name, - const gchar *icon_path, const gchar *execute) - { - GtkListStore *store = m_stores [group]; - if (!store) { - g_warning ("Didn't find group '%s' for entry '%s'.", group, name); - return; - } - - GdkPixbuf *icon = NULL; - if (icon_path) { - GError *error = 0; - std::string path = ICONS + std::string (icon_path) + ".png"; - icon = gdk_pixbuf_new_from_file (path.c_str(), &error); - if (!icon) - g_warning ("Could not load icon: %s.\nReason: %s", icon_path, error->message); - } - - GtkTreeIter iter; - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, name, 1, icon, 2, execute, -1); - } - - static void executeCommand (GtkIconView *iconview, GtkTreePath *path, View *pThis) - { - GtkTreeModel *model = gtk_icon_view_get_model (iconview); - GtkTreeIter iter; - if (gtk_tree_model_get_iter (model, &iter, path)) { - gchar *command_; - gtk_tree_model_get (model, &iter, 2, &command_, -1); - - std::string command = command_; - g_free (command_); - - command += " &"; - printf ("running %s\n", command.c_str()); - system (command.c_str()); - - static GdkCursor *cursor = NULL; - if (!cursor) { - GdkDisplay *display = gtk_widget_get_display (window); - cursor = gdk_cursor_new_for_display (display, GDK_WATCH); - } - gdk_window_set_cursor (window->window, cursor); - g_timeout_add (1500, set_normal_cursor_cb, NULL); - } - } - - static gboolean set_normal_cursor_cb (gpointer data) - { - gdk_window_set_cursor (window->window, NULL); - return FALSE; - } -}; - -/* Main code */ -int main(int argc, char* argv[]) -{ - gtk_init (&argc, &argv); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), "Suse Control Center"); - gtk_window_set_default_size (GTK_WINDOW (window), 650, 400); - g_signal_connect(G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); - - bool is_root = getuid () == 0; - - View view; - { // adding groups - GKeyFile *file = g_key_file_new(); - std::set groups = subfiles (YAST_GROUPS); - for (std::set ::iterator it = groups.begin(); - it != groups.end(); it++) { - if (!g_key_file_load_from_file (file, (YAST_GROUPS + (*it)).c_str(), - G_KEY_FILE_NONE, NULL)) - continue; - - gchar* name = g_key_file_get_locale_string (file, "Desktop Entry", "Name", 0, NULL); - gchar *nick = g_key_file_get_string (file, "Desktop Entry", "X-SuSE-YaST-Group", NULL); - gchar *icon = g_key_file_get_string (file, "Desktop Entry", "Icon", NULL); - gchar *sort_key = g_key_file_get_string (file, "Desktop Entry", - "X-SuSE-YaST-SortKey", NULL); - if (name && nick) - view.addGroup (name, icon, nick, sort_key); - - if (name) g_free (name); - if (nick) g_free (nick); - if (icon) g_free (icon); - if (sort_key) g_free (sort_key); - } - g_key_file_free (file); - } - { // adding entries - GKeyFile *file = g_key_file_new(); - std::set entries = subfiles (YAST_ENTRIES); - for (std::set ::iterator it = entries.begin(); - it != entries.end(); it++) { - if (!g_key_file_load_from_file (file, (YAST_ENTRIES + (*it)).c_str(), - G_KEY_FILE_NONE, NULL)) - continue; - - gchar *group = g_key_file_get_string (file, "Desktop Entry", "X-SuSE-YaST-Group", NULL); - gchar* name = g_key_file_get_locale_string (file, "Desktop Entry", "Name", 0, NULL); - gchar *icon = g_key_file_get_string (file, "Desktop Entry", "Icon", NULL); - gchar *command = g_key_file_get_string (file, "Desktop Entry", "Exec", NULL); - gboolean needs_root = g_key_file_get_boolean (file, "Desktop Entry", - "X-SuSE-YaST-RootOnly", NULL); - - if (group && name && command && (!needs_root || is_root)) - view.addEntry (group, name, icon, command); - - if (group) g_free (group); - if (name) g_free (name); - if (icon) g_free (icon); - if (command) g_free (command); - } - g_key_file_free (file); - } - - gtk_container_add (GTK_CONTAINER (window), view.getWidget()); - gtk_widget_show_all (window); - - if (!is_root) { - GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window), - GtkDialogFlags (0), GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - "You are executing the control center as an ordinary user.\n" - "Only a few modules will be available."); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - } - - gtk_main(); - return 0; -}