A small documentation update for evoke.

Do not compile running code for ede-launch-sn in ede-launch when startup-notification was not found.
Allow report button only for ede applications.
This commit is contained in:
Sanel Zukan 2009-07-07 11:57:45 +00:00
parent fffdfec7e7
commit be2cb085b9
4 changed files with 87 additions and 27 deletions

View File

@ -1,8 +1,19 @@
/* /*
* $Id$
*
* ede-launch, launch external application
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2008-2009 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*
* This is an helper program for startup notification system, and * This is an helper program for startup notification system, and
* is run from ede-launch. To simplify things, it was written as separate * is run from ede-launch. To simplify things, it was written as separate
* program, but it does not mean that will stay ;) (Sanel) * program, but it does not mean that will stay ;) (Sanel)
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif

View File

@ -1,3 +1,15 @@
/*
* $Id$
*
* ede-launch, launch external application
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2008-2009 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@ -19,7 +31,9 @@
#include <FL/Fl_Check_Button.H> #include <FL/Fl_Check_Button.H>
#include <FL/Fl_Input.H> #include <FL/Fl_Input.H>
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/Resource.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/Nls.h> #include <edelib/Nls.h>
#include <edelib/Debug.h> #include <edelib/Debug.h>
@ -29,11 +43,13 @@
#include "icons/run.xpm" #include "icons/run.xpm"
/* /*
* Window from X11 is alread included with Fl.H so we can't use * Window from X11 is alread included with Fl.H so we can't use EDELIB_NS_USING(Window) here.
* EDELIB_NS_USING(Window) here. Stupid C++ namespaces * Stupid C++ namespaces
*/ */
#define LaunchWindow edelib::Window #define LaunchWindow edelib::Window
EDELIB_NS_USING(Resource)
EDELIB_NS_USING(RES_USER_ONLY)
EDELIB_NS_USING(run_sync) EDELIB_NS_USING(run_sync)
EDELIB_NS_USING(run_async) EDELIB_NS_USING(run_async)
EDELIB_NS_USING(alert) EDELIB_NS_USING(alert)
@ -42,11 +58,19 @@ static Fl_Pixmap image_run((const char**)run_xpm);
static Fl_Input* dialog_input; static Fl_Input* dialog_input;
static Fl_Check_Button* in_term; static Fl_Check_Button* in_term;
void help(void) { static void help(void) {
puts("Usage: ede-launch [OPTIONS] program"); puts("Usage: ede-launch program");
puts("EDE program launcher"); puts("EDE program launcher");
} }
static char* get_basename(const char* path) {
char *p = strrchr(path, '/');
if(p)
return (p + 1);
return (char*)p;
}
static char** cmd_split(const char* cmd) { static char** cmd_split(const char* cmd) {
int sz = 10; int sz = 10;
int i = 0; int i = 0;
@ -69,11 +93,22 @@ static char** cmd_split(const char* cmd) {
} }
static void start_crasher(const char* cmd, int sig) { static void start_crasher(const char* cmd, int sig) {
const char* base = get_basename(cmd);
const char* ede_app_flag = "";
/* this means the app was called without full path */
if(!base)
base = cmd;
/* /*
* call edelib implementation instead start_child_process() * determine is our app by checking the prefix; we don't want user to send bug reports about crashes
* to prevents loops if 'ede-crasher' crashes * of foreign applications
*/ */
run_sync("ede-crasher --apppath %s --signal %i", cmd, sig); if(strncmp(base, "ede-", 4) == 0)
ede_app_flag = "--edeapp";
/* call edelib implementation instead start_child_process() to prevents loops if 'ede-crasher' crashes */
run_sync("ede-crasher %s --appname %s --apppath %s --signal %i", ede_app_flag, base, cmd, sig);
} }
static int start_child_process(const char* cmd) { static int start_child_process(const char* cmd) {
@ -183,12 +218,17 @@ static int start_child_process_with_core(const char* cmd) {
} }
static bool start_child(const char* cmd) { static bool start_child(const char* cmd) {
#ifdef HAVE_LIBSTARTUP_NOTIFICATION
run_async("ede-launch-sn --program %s --icon applications-order", cmd); run_async("ede-launch-sn --program %s --icon applications-order", cmd);
#endif
int ret = start_child_process_with_core(cmd); int ret = start_child_process_with_core(cmd);
if(ret == 199) { if(ret == 199) {
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); 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; return false;
} }
@ -236,20 +276,38 @@ static void ok_cb(Fl_Widget*, void* w) {
if(!started) { if(!started) {
/* show dialog again */ /* show dialog again */
win->show(); win->show();
if(cmd)
dialog_input->position(0, dialog_input->size());
} else {
Resource rc;
rc.set("History", "open", cmd);
rc.save("ede-launch-history");
} }
} }
static void start_dialog(int argc, char** argv) { static int start_dialog(int argc, char** argv) {
LaunchWindow* win = new LaunchWindow(370, 195, _("Run Command")); LaunchWindow* win = new LaunchWindow(370, 195, _("Run Command"));
win->begin(); win->begin();
Fl_Box* icon = new Fl_Box(10, 10, 55, 55); Fl_Box* icon = new Fl_Box(10, 10, 55, 55);
icon->image(image_run); icon->image(image_run);
Fl_Box* txt = new Fl_Box(70, 10, 290, 69, _("Enter the name of the application you would like to run or the URL you would like to view")); Fl_Box* txt = new Fl_Box(70, 10, 290, 69, _("Enter the name of the application "
"you would like to run or the URL you would like to view"));
txt->align(132|FL_ALIGN_INSIDE); txt->align(132|FL_ALIGN_INSIDE);
dialog_input = new Fl_Input(70, 90, 290, 25, _("Open:")); dialog_input = new Fl_Input(70, 90, 290, 25, _("Open:"));
Resource rc;
char buf[128];
if(rc.load("ede-launch-history") && rc.get("History", "open", buf, sizeof(buf))) {
dialog_input->value(buf);
/* make text appear selected */
dialog_input->position(0, dialog_input->size());
}
in_term = new Fl_Check_Button(70, 125, 290, 25, _("Run in terminal")); in_term = new Fl_Check_Button(70, 125, 290, 25, _("Run in terminal"));
in_term->down_box(FL_DOWN_BOX); in_term->down_box(FL_DOWN_BOX);
@ -258,21 +316,20 @@ static void start_dialog(int argc, char** argv) {
Fl_Button* cancel = new Fl_Button(270, 160, 90, 25, _("&Cancel")); Fl_Button* cancel = new Fl_Button(270, 160, 90, 25, _("&Cancel"));
cancel->callback(cancel_cb, win); cancel->callback(cancel_cb, win);
win->end(); win->end();
win->window_icon(run_xpm);
win->show(argc, argv); win->show(argc, argv);
while(win->shown()) return Fl::run();
Fl::wait();
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
if(argc == 1) if(argc == 1)
start_dialog(argc, argv); return start_dialog(argc, argv);
else if(argc != 2) {
help(); if(argc == 2)
return 0;
} else {
start_child(argv[1]); start_child(argv[1]);
} else
help();
return 0; return 0;
} }

View File

@ -73,8 +73,8 @@ static void send_dbus_ede_quit(void) {
E_RETURN_IF_FAIL(c.connect(EDBUS_SESSION)); E_RETURN_IF_FAIL(c.connect(EDBUS_SESSION));
EdbusMessage msg; EdbusMessage msg;
msg.create_signal("/org/equinoxproject/Shutdown", "org.equinoxproject.Shutdown", "Shutdown");
msg.create_signal("/org/equinoxproject/Shutdown", "org.equinoxproject.Shutdown", "Shutdown");
c.send(msg); c.send(msg);
} }

View File

@ -28,14 +28,6 @@ Options
Only useful in startup mode (if '-s' or '--startup' are given). Mainly to test Only useful in startup mode (if '-s' or '--startup' are given). Mainly to test
splash screen themes splash screen themes
-a, --autostart::
Run in autostart mode. It will check 'autostart' directory and run .desktop
files from it. This will be done according to freedesktop.org autostart specification.
-u, --autostart-safe::
Same as '-a' or '--autostart' option, but display dialog with items that should
be run.
-h, --help:: -h, --help::
This help. This help.