From a7baa4bc7aa30deaca0cbe5298a51b8a5fe22e6b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 11 Jun 2015 16:14:14 +0200 Subject: [PATCH] Restore option to enable/disable the assistant. --- CMakeLists.txt | 15 +++++++++++++++ build/android/config.h | 3 +++ config.h.cmake | 1 + configure.ac | 26 ++++++++++++++++++++++++++ coreapi/Makefile.am | 4 ++++ gtk/CMakeLists.txt | 10 +++------- gtk/Makefile.am | 6 +++++- gtk/main.c | 4 ++++ gtk/main.ui | 1 - gtk/propertybox.c | 5 +++++ tester/CMakeLists.txt | 5 ----- 11 files changed, 66 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 756091018..5781ed29e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,7 @@ option(ENABLE_TUTORIALS "Enable compilation of tutorials." YES) option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES) option(ENABLE_UPNP "Build with uPnP support." YES) option(ENABLE_VIDEO "Build with video support." YES) +cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO) option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO) @@ -120,6 +121,20 @@ if(ENABLE_NOTIFY) set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE) endif() endif() +if(ENABLE_GTK_UI) + if(WIN32) + set(GTK2_ADDITIONAL_SUFFIXES "../lib/glib-2.0/include" "../lib/gtk-2.0/include") + endif() + find_package(GTK2 2.18 REQUIRED gtk) + find_package(Intl REQUIRED) + if(ENABLE_ASSISTANT AND GTK2_VERSION VERSION_LESS 2.22) + message(WARNING "You need at least GTK 2.22 to enable the assistant") + set(ENABLE_ASSISTANT OFF CACHE BOOL "Turn on assistant compiling." FORCE) + endif() +endif() +if(ENABLE_ASSISTANT) + set(BUILD_WIZARD 1) +endif() find_package(Gettext) diff --git a/build/android/config.h b/build/android/config.h index 9b6d33412..d57ed6264 100644 --- a/build/android/config.h +++ b/build/android/config.h @@ -7,6 +7,9 @@ /* Define if tools enabled */ /* #undef BUILD_TOOLS */ +/* Define if wizard enabled */ +/* #undef BUILD_WIZARD */ + /* Tells whether localisation is possible */ /* #undef ENABLE_NLS */ diff --git a/config.h.cmake b/config.h.cmake index 6d0015a20..3adb3cae4 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -37,6 +37,7 @@ #define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}" #define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}" +#cmakedefine BUILD_WIZARD #cmakedefine HAVE_NOTIFY4 #cmakedefine HAVE_ZLIB 1 #cmakedefine HAVE_CU_GET_SUITE 1 diff --git a/configure.ac b/configure.ac index afc805e7a..1678d6e15 100644 --- a/configure.ac +++ b/configure.ac @@ -729,6 +729,31 @@ if test "$has_sighandler_t" = "yes" ; then AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] ) fi +AC_ARG_ENABLE(assistant, + [AS_HELP_STRING([--enable-assistant], [Turn on assistant compiling])], + [case "${enableval}" in + yes) build_wizard=true ;; + no) build_wizard=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-assistant) ;; + esac], + [build_wizard=check] +) + +if test "$build_wizard" != "false" ; then + PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[], + [if test "$build_wizard" = "true" ; then + AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.]) + else + build_wizard=false + fi] + ) +fi +AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard != xfalse) +if test "$build_wizard" != "false" ; then + build_wizard=true + AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] ) +fi + AC_CHECK_HEADERS(libudev.h) AC_CHECK_LIB(udev,udev_new) @@ -1037,6 +1062,7 @@ echo "Linphone build configuration ended." echo "Summary of build options:" printf "* %-30s %s\n" "Video support" $video printf "* %-30s %s\n" "GTK interface" $gtk_ui +printf "* %-30s %s\n" "Account assistant" $build_wizard printf "* %-30s %s\n" "Console interface" $console_ui printf "* %-30s %s\n" "Tools" $build_tools printf "* %-30s %s\n" "Message storage" $enable_msg_storage diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 8130a8037..b16105aea 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -181,6 +181,10 @@ COMMON_CFLAGS=\ $(SASL_CFLAGS) \ $(ZLIB_CFLAGS) +if BUILD_WIZARD +COMMON_CFLAGS+= -DBUILD_WIZARD +endif + COMMON_CFLAGS+= -DUSE_BELLESIP AM_CFLAGS=$(COMMON_CFLAGS) $(STRICT_OPTIONS_CC) diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index 91ec2fdba..d7e103fb4 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -20,12 +20,6 @@ # ############################################################################ -if(WIN32) - set(GTK2_ADDITIONAL_SUFFIXES "../lib/glib-2.0/include" "../lib/gtk-2.0/include") -endif() -find_package(GTK2 2.18 REQUIRED gtk) -find_package(Intl REQUIRED) - set(UI_FILES about.ui audio_assistant.ui @@ -63,7 +57,6 @@ set(SOURCE_FILES loginframe.c main.c propertybox.c - setupwizard.c singleinstance.c status_icon.c status_notifier.c @@ -72,6 +65,9 @@ set(SOURCE_FILES utils.c videowindow.c ) +if(ENABLE_ASSISTANT) + list(APPEND SOURCE_FILES setupwizard.c) +endif() if(WIN32) list(APPEND SOURCE_FILES linphone.rc) endif() diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 946de574b..aab21b3ba 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -53,12 +53,16 @@ linphone_SOURCES= \ singleinstance.c \ conference.c \ config-fetching.c \ - setupwizard.c \ audio_assistant.c \ videowindow.c \ status_icon.c status_icon.h \ linphone.h +if BUILD_WIZARD +linphone_SOURCES+= \ + setupwizard.c +endif + if BUILD_STATUS_NOTIFIER linphone_SOURCES+= \ status_notifier.c \ diff --git a/gtk/main.c b/gtk/main.c index 99e464874..2446473fb 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1979,7 +1979,9 @@ static void linphone_gtk_check_soundcards(){ static void linphone_gtk_quit_core(void){ linphone_gtk_unmonitor_usb(); g_source_remove_by_user_data(linphone_gtk_get_core()); +#ifdef BUILD_WIZARD linphone_gtk_close_assistant(); +#endif linphone_gtk_set_ldap(NULL); linphone_gtk_destroy_log_window(); linphone_core_destroy(the_core); @@ -2019,10 +2021,12 @@ static gboolean on_block_termination(void){ static void linphone_gtk_init_ui(void){ linphone_gtk_init_main_window(); +#ifdef BUILD_WIZARD // Veryfing if at least one sip account is configured. If not, show wizard if (linphone_core_get_proxy_config_list(linphone_gtk_get_core()) == NULL) { linphone_gtk_show_assistant(the_ui); } +#endif if(run_audio_assistant){ linphone_gtk_show_audio_assistant(); diff --git a/gtk/main.ui b/gtk/main.ui index df7bbc6e2..48e5a61d6 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -923,7 +923,6 @@ Account assistant - True False connect_image False diff --git a/gtk/propertybox.c b/gtk/propertybox.c index ff0aa9baa..6f4816ece 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1584,6 +1584,11 @@ void linphone_gtk_show_parameters(void){ gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),linphone_address_get_username(contact)); linphone_address_destroy(contact); } +#ifdef BUILD_WIZARD + gtk_widget_show(linphone_gtk_get_widget(pb,"wizard")); +#else + gtk_widget_hide(linphone_gtk_get_widget(pb,"wizard")); +#endif linphone_gtk_show_sip_accounts(pb); /* CODECS CONFIG */ linphone_gtk_init_codec_list(GTK_TREE_VIEW(codec_list)); diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 4fcfd0cc0..2b02ff6c0 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -20,11 +20,6 @@ # ############################################################################ -if(WIN32) - set(GTK2_ADDITIONAL_SUFFIXES "../lib/glib-2.0/include" "../lib/gtk-2.0/include") -endif() -find_package(GTK2 2.18 COMPONENTS gtk) - set(SOURCE_FILES common/bc_tester_utils.c accountmanager.c