Greetings,
The following patch is to add a "Run in Terminal" feature to exebuf.
If you press Ctrl+Enter/KPEnter after entering in the command or
selecting it from the file list, the command is run in a terminal. You
can change the terminal settings in the Run Command configuration dialog
box.
This is my first enlightenment code/patch, so if I've done things
drastically wrong, or mucked up some stuff let me know.
metrics
Index: src/bin/e_config.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_config.c,v
retrieving revision 1.203
diff -u -r1.203 e_config.c
--- src/bin/e_config.c 16 Sep 2006 11:35:54 -0000 1.203
+++ src/bin/e_config.c 17 Sep 2006 03:39:28 -0000
@@ -457,6 +457,7 @@
E_CONFIG_VAL(D, T, exebuf_pos_min_h, INT);
E_CONFIG_VAL(D, T, exebuf_pos_max_w, INT);
E_CONFIG_VAL(D, T, exebuf_pos_max_h, INT);
+ E_CONFIG_VAL(D, T, exebuf_term_cmd, STR);
E_CONFIG_LIST(D, T, color_classes, _e_config_color_class_edd);
E_CONFIG_VAL(D, T, use_app_icon, INT);
E_CONFIG_VAL(D, T, cfgdlg_auto_apply, INT); /**/
@@ -653,6 +654,7 @@
e_config->exebuf_pos_min_h = 160;
e_config->exebuf_pos_max_w = 400;
e_config->exebuf_pos_max_h = 320;
+ e_config->exebuf_term_cmd = evas_stringshare_add("xterm -e");
e_config->color_classes = NULL;
e_config->use_app_icon = 0;
e_config->cfgdlg_auto_apply = 0;
Index: src/bin/e_config.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_config.h,v
retrieving revision 1.120
diff -u -r1.120 e_config.h
--- src/bin/e_config.h 16 Sep 2006 11:35:54 -0000 1.120
+++ src/bin/e_config.h 17 Sep 2006 03:39:28 -0000
@@ -209,6 +209,7 @@
int exebuf_pos_min_h; // GUI
int exebuf_pos_max_w; // GUI
int exebuf_pos_max_h; // GUI
+ const char *exebuf_term_cmd; // GUI
Evas_List *color_classes;
int use_app_icon; // GUI
int cfgdlg_auto_apply; // GUI
Index: src/bin/e_exebuf.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_exebuf.c,v
retrieving revision 1.22
diff -u -r1.22 e_exebuf.c
--- src/bin/e_exebuf.c 23 Aug 2006 03:39:01 -0000 1.22
+++ src/bin/e_exebuf.c 17 Sep 2006 03:39:29 -0000
@@ -35,6 +35,7 @@
static int _e_exebuf_cb_sort_exe(void *data1, void *data2);
static void _e_exebuf_update(void);
static void _e_exebuf_exec(void);
+static void _e_exebuf_exec_term(void);
static void _e_exebuf_exe_sel(E_Exebuf_Exe *exe);
static void _e_exebuf_exe_desel(E_Exebuf_Exe *exe);
static void _e_exebuf_exe_scroll_to(int i);
@@ -428,6 +429,42 @@
}
static void
+_e_exebuf_exec_term(void)
+{
+ char tmp[EXEBUFLEN];
+ char *active_cmd;
+
+ if (exe_sel)
+ {
+ if (exe_sel->app)
+ {
+ if (exe_sel->app->exe)
+ active_cmd = exe_sel->app->exe;
+ else
+ {
+ e_zone_app_exec(exebuf->zone, exe_sel->app);
+ e_exehist_add("exebuf", exe_sel->app->exe);
+ }
+ }
+ else
+ active_cmd = exe_sel->file;
+ }
+ else
+ active_cmd = cmd_buf;
+
+ if (strlen(active_cmd) > 0)
+ {
+ /* Copy the terminal command to the start of the string...
+ * making sure it has a null terminator if greater than EXEBUFLEN */
+ snprintf(tmp, EXEBUFLEN, "%s %s", e_config->exebuf_term_cmd,
active_cmd);
+ e_zone_exec(exebuf->zone, tmp);
+ e_exehist_add("exebuf", tmp);
+ }
+
+ e_exebuf_hide();
+}
+
+static void
_e_exebuf_exe_sel(E_Exebuf_Exe *exe)
{
edje_object_signal_emit(exe->bg_object, "e,state,selected", "e");
@@ -984,8 +1021,12 @@
_e_exebuf_complete();
else if (!strcmp(ev->keysymbol, "Tab"))
_e_exebuf_complete();
+ else if (!strcmp(ev->keysymbol, "Return") && (ev->modifiers &
ECORE_X_MODIFIER_CTRL))
+ _e_exebuf_exec_term();
else if (!strcmp(ev->keysymbol, "Return"))
_e_exebuf_exec();
+ else if (!strcmp(ev->keysymbol, "KP_Enter") && (ev->modifiers &
ECORE_X_MODIFIER_CTRL))
+ _e_exebuf_exec_term();
else if (!strcmp(ev->keysymbol, "KP_Enter"))
_e_exebuf_exec();
else if (!strcmp(ev->keysymbol, "Escape"))
Index: src/bin/e_int_config_exebuf.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_int_config_exebuf.c,v
retrieving revision 1.4
diff -u -r1.4 e_int_config_exebuf.c
--- src/bin/e_int_config_exebuf.c 14 Aug 2006 15:22:45 -0000 1.4
+++ src/bin/e_int_config_exebuf.c 17 Sep 2006 03:39:30 -0000
@@ -23,6 +23,7 @@
int pos_min_h;
int pos_max_w;
int pos_max_h;
+ char * term_cmd;
};
EAPI E_Config_Dialog *
@@ -63,6 +64,9 @@
cfdata->pos_min_h = e_config->exebuf_pos_min_h;
cfdata->pos_max_w = e_config->exebuf_pos_max_w;
cfdata->pos_max_h = e_config->exebuf_pos_max_h;
+ if (e_config->exebuf_term_cmd)
+ cfdata->term_cmd = strdup(e_config->exebuf_term_cmd);
+
}
static void *
@@ -99,11 +103,11 @@
o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("General Settings"), 0);
- ob = e_widget_label_add(evas, _("Maximum Number Of Matched Eaps To List"));
+ ob = e_widget_label_add(evas, _("Maximum Number of Matched Eaps to List"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 50, 5, 0, NULL,
&(cfdata->max_eap_list), 200);
e_widget_framelist_object_append(of, ob);
- ob = e_widget_label_add(evas, _("Maximum Number Of Matched Exes To List"));
+ ob = e_widget_label_add(evas, _("Maximum Number of Matched Exes to List"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 50, 5, 0, NULL,
&(cfdata->max_exe_list), 200);
e_widget_framelist_object_append(of, ob);
@@ -129,6 +133,13 @@
e_config->exebuf_pos_min_h = cfdata->pos_min_h;
e_config->exebuf_pos_max_w = cfdata->pos_max_w;
e_config->exebuf_pos_max_h = cfdata->pos_max_h;
+ if (e_config->exebuf_term_cmd)
+ evas_stringshare_del(e_config->exebuf_term_cmd);
+ e_config->exebuf_term_cmd = NULL;
+ if (cfdata->term_cmd)
+ {
+ e_config->exebuf_term_cmd = evas_stringshare_add(cfdata->term_cmd);
+ }
e_config_save_queue();
return 1;
@@ -192,6 +203,13 @@
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(ot, of, 1, 0, 1, 2, 1, 0, 1, 0);
+ of = e_widget_framelist_add(evas, _("Terminal Settings"), 0);
+ ob = e_widget_label_add(evas, _("Terminal Command"));
+ e_widget_framelist_object_append(of, ob);
+ ob = e_widget_entry_add(evas, &(cfdata->term_cmd));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_table_object_append(ot, of, 1, 2, 1, 1, 1, 1, 1, 1);
+
e_widget_list_object_append(o, ot, 1, 1, 0.5);
return o;
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel