From 51b488fb149f904610a116bad41fedd0bf1efbab Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Fri, 6 Mar 2009 12:12:27 +0000 Subject: [PATCH] Added EdeProgramBare rule, that will link with FLTK libs, without images libstartup-notification checks in configure.in ede-launch now uses startup notification protocol via ede-launch-sn helper Added removal of /tmp/.evoke.lock at the startup, in case evoke crashed during sesssion --- Jamconfig.in | 4 ++++ build/Program.jam | 21 +++++++++++++++++++++ configure.in | 9 +++++++++ data/startede.in | 3 +++ ede-launch/Jamfile | 6 +++++- ede-launch/ede-launch.cpp | 21 ++++++++++++++++----- 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/Jamconfig.in b/Jamconfig.in index 3479df8..8db65fc 100644 --- a/Jamconfig.in +++ b/Jamconfig.in @@ -86,6 +86,10 @@ COMPOSITELIB ?= @COMPOSITE_LIBS@ ; HALINCLUDE ?= @HAL_CFLAGS@ ; HALLIB ?= @HAL_LIBS@ ; +# startup-notification +STARTUP_NOTIFICATION_INCLUDE ?= @LIBSTARTUP_NOTIFICATION_CFLAGS@ ; +STARTUP_NOTIFICATION_LIB ?= @LIBSTARTUP_NOTIFICATION_LIBS@ ; + # X libraries (could be empty if are on standard paths) X_CFLAGS ?= @X_CFLAGS@ ; X_LIBS ?= @X_LIBS@ ; diff --git a/build/Program.jam b/build/Program.jam index 196178e..1b94e8a 100644 --- a/build/Program.jam +++ b/build/Program.jam @@ -90,6 +90,27 @@ rule EdeProgram } } +# EdeProgramBare [target] : [sources] : [noinstall] ; +# Creates EDE specific programs. They will be linked with EDELIBLIB +# and FLTKLIB. If [noinstall] is given, [target] will not be installed wit 'jam install'. +rule EdeProgramBare +{ + if ! $(EDELIBINCLUDE) || ! $(EDELIBLIB) { + Echo "EDELIBINCLUDE or EDELIBLIB not defined; $(1) will not be built" ; + return ; + } + + MakeProgramPrivate $(1) : $(2) + : $(EDELIBLIB) $(FLTKLIB_NOIMAGES) $(STDLIB) + : $(GLOBALFLAGS) $(EDELIBINCLUDE) $(FLTKINCLUDE) ; + + if $(3) != "noinstall" { + InstallEdeProgram $(1) ; + } +} + + + # EfltkProgram [target] : [sources] : [noinstall] ; # Creates programs that will be linked with efltk. If [noinstall] is given, # [target] will not be installed wit 'jam install'. diff --git a/configure.in b/configure.in index a816086..b9a53ff 100644 --- a/configure.in +++ b/configure.in @@ -95,6 +95,15 @@ if test "$enable_hal" = "yes"; then fi fi +PKG_CHECK_MODULES(LIBSTARTUP_NOTIFICATION, [libstartup-notification-1.0], + [have_libstartup_notification=yes], [have_libstartup_notification=no]) +if test "$have_libstartup_notification" = "yes"; then + AC_DEFINE(HAVE_LIBSTARTUP_NOTIFICATION, 1, [Define to 1 if you have libstartup-notification libraries]) +else + AC_MSG_RESULT(no) +fi + + PKG_CHECK_MODULES(EDELIB, [edelib],, [have_edelib=no]) if test "$have_edelib" = "no"; then AC_MSG_ERROR(edelib not found! You must install it first) diff --git a/data/startede.in b/data/startede.in index e7526d7..ef38691 100644 --- a/data/startede.in +++ b/data/startede.in @@ -65,5 +65,8 @@ if [ "$XSETROOT" ]; then $XSETROOT -solid black fi +# remove leftovers if evoke crashed +rm -f /tmp/.evoke.lock + # start the session evoke --startup --autostart-safe diff --git a/ede-launch/Jamfile b/ede-launch/Jamfile index 8783949..fcd33ab 100644 --- a/ede-launch/Jamfile +++ b/ede-launch/Jamfile @@ -12,5 +12,9 @@ SubDir TOP ede-launch ; SOURCE = ede-launch.cpp ; -EdeProgram ede-launch : $(SOURCE) ; +EdeProgram ede-launch : $(SOURCE) ; TranslationStrings locale : $(SOURCE) ; + +ObjectC++Flags ede-launch-sn.cpp : $(STARTUP_NOTIFICATION_INCLUDE) ; +EdeProgramBare ede-launch-sn : ede-launch-sn.cpp ; +LinkAgainst ede-launch-sn : $(STARTUP_NOTIFICATION_LIB) ; diff --git a/ede-launch/ede-launch.cpp b/ede-launch/ede-launch.cpp index abfd18e..9953767 100644 --- a/ede-launch/ede-launch.cpp +++ b/ede-launch/ede-launch.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,9 @@ #include #include #include +#include #include + #include "icons/run.xpm" /* @@ -32,6 +35,7 @@ #define LaunchWindow edelib::Window EDELIB_NS_USING(run_sync) +EDELIB_NS_USING(run_async) EDELIB_NS_USING(alert) static Fl_Pixmap image_run(run_xpm); @@ -179,15 +183,22 @@ static int start_child_process_with_core(const char* cmd) { } static bool start_child(const char* cmd) { + run_async("ede-launch-sn --program %s --icon applications-order", cmd); + int ret = start_child_process_with_core(cmd); if(ret == 199) { - alert(_("Program '%s' not found"), cmd); + alert(_("Program '%s' not found.\n\nPlease check if given path to the executable was correct or adjust $PATH environment variable to point to the directory where target executable exists"), cmd); return false; } if(ret == EACCES) { - alert(_("You do not have enough permissions to execute '%s'"), cmd); + /* now check the if file is executable since EACCES is common error if not so */ + if(access(cmd, X_OK) != 0) + alert(_("You are trying to execute '%s', but it is not executable file"), cmd); + else + alert(_("You do not have enough permissions to execute '%s'"), cmd); + return false; } @@ -211,13 +222,13 @@ static void ok_cb(Fl_Widget*, void* w) { /* TODO: is 'cmd' safe after hide? */ if(in_term->value()) { - char buff[128]; + char buf[128]; char* term = getenv("TERM"); if(!term) term = "xterm"; - snprintf(buff, sizeof(buff), "%s -e %s", term, cmd); - started = start_child(buff); + snprintf(buf, sizeof(buf), "%s -e %s", term, cmd); + started = start_child(buf); } else { started = start_child(cmd); }