This patch adds an extra button to the .desktop file editor which allows
to select an executable file using the file selection dialog.
People will like it i guess. :)
Greets,
Brian 'morlenxus' Miculcy
Index: e_eap_editor.c
===
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_eap_editor.c,v
retrieving revision 1.83
diff -u -r1.83 e_eap_editor.c
--- e_eap_editor.c 19 May 2007 03:29:08 - 1.83
+++ e_eap_editor.c 29 Jun 2007 13:40:56 -
@@ -36,10 +36,16 @@
static Evas_Object *_e_desktop_edit_basic_create_widgets(E_Config_Dialog
*cfd, Evas *evas, E_Config_Dialog_Data *data);
static Evas_Object *_e_desktop_edit_advanced_create_widgets(E_Config_Dialog
*cfd, Evas *evas, E_Config_Dialog_Data *data);
static void _e_desktop_editor_cb_icon_select(void *data1, void
*data2);
-static void _e_desktop_edit_select_cb(void *data, Evas_Object *obj);
+static void _e_desktop_edit_cb_icon_select_destroy(void *obj);
static void _e_desktop_edit_cb_icon_select_ok(void *data, E_Dialog
*dia);
static void _e_desktop_edit_cb_icon_select_cancel(void *data,
E_Dialog *dia);
static void _e_desktop_editor_icon_update(E_Config_Dialog_Data
*cfdata);
+static void _e_desktop_editor_cb_exec_select(void *data1, void
*data2);
+static void _e_desktop_edit_cb_exec_select_destroy(void *obj);
+static void _e_desktop_edit_cb_exec_select_ok(void *data, E_Dialog
*dia);
+static void _e_desktop_edit_cb_exec_select_cancel(void *data,
E_Dialog *dia);
+static void _e_desktop_editor_exec_update(E_Config_Dialog_Data
*cfdata);
+static void _e_desktop_edit_select_cb(void *data, Evas_Object *obj);
#define IFADD(src, dst) if (src) dst = evas_stringshare_add(src); else dst =
NULL
#define IFDEL(src) if (src) evas_stringshare_del(src); src = NULL;
@@ -465,10 +471,14 @@
e_widget_frametable_object_append(o, e_widget_label_add(evas,
_("Executable")),
0, 1, 1, 1,
1, 1, 1, 1);
- e_widget_frametable_object_append(o, e_widget_entry_add(evas,
&(cfdata->exec)),
+ editor->entry_widget = e_widget_entry_add(evas, &(cfdata->exec));
+ e_widget_frametable_object_append(o, editor->entry_widget,
1, 1, 1, 1,
1, 1, 1, 1);
-
+ e_widget_frametable_object_append(o, e_widget_button_add(evas, "...", NULL,
+_e_desktop_editor_cb_exec_select, cfdata,
editor),
+2, 1, 1, 1,
+1, 1, 1, 1);
e_widget_frametable_object_append(o, e_widget_label_add(evas, _("Comment")),
0, 2, 1, 1,
1, 1, 1, 1);
@@ -563,10 +573,11 @@
editor = data2;
cfdata = data1;
- if (editor->fsel_dia) return;
+ if (editor->icon_fsel_dia) return;
dia = e_dialog_new(cfdata->editor->cfd->con, "E",
"_eap_icon_select_dialog");
if (!dia) return;
+ e_object_del_attach_func_set(E_OBJECT(dia),
_e_desktop_edit_cb_icon_select_destroy);
e_dialog_title_set(dia, _("Select an Icon"));
dia->data = cfdata;
@@ -591,7 +602,7 @@
}
evas_object_show(o);
- editor->fsel = o;
+ editor->icon_fsel = o;
e_widget_min_size_get(o, &mw, &mh);
e_dialog_content_set(dia, o, mw, mh);
@@ -602,7 +613,61 @@
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
e_win_resize(dia->win, 475, 341);
- editor->fsel_dia = dia;
+ editor->icon_fsel_dia = dia;
+}
+
+static void
+_e_desktop_editor_cb_exec_select(void *data1, void *data2)
+{
+ E_Config_Dialog_Data *cfdata;
+ E_Dialog *dia;
+ Evas_Object *o;
+ Evas_Coord mw, mh;
+ E_Desktop_Edit *editor;
+ char *dir = NULL;
+
+ editor = data2;
+ cfdata = data1;
+
+ if (editor->exec_fsel_dia) return;
+
+ dia = e_dialog_new(cfdata->editor->cfd->con, "E",
"_eap_exec_select_dialog");
+ if (!dia) return;
+ e_object_del_attach_func_set(E_OBJECT(dia),
_e_desktop_edit_cb_exec_select_destroy);
+ e_dialog_title_set(dia, _("Select an Executable"));
+ dia->data = cfdata;
+
+ /* absolute path to exe */
+ if (cfdata->exec)
+ dir = ecore_file_get_dir(cfdata->exec);
+
+ if (dir)
+ {
+ o = e_widget_fsel_add(dia->win->evas, dir, "/", NULL, NULL,
+ _e_desktop_edit_select_cb, cfdata,
+ NULL, cfdata, 1);
+ free(dir);
+ }
+ else
+ {
+ o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
+ _e_desktop_edit_select_cb, cfdata,
+ NULL, cfdata, 1);
+ }
+
+ evas_object_show(o);
+ editor->exec_fsel = o;
+ e_widget_min_size_get(o, &mw, &mh);
+ e_dialog_content_set(dia, o, mw, mh);
+
+ /* buttons at the bottom */
+ e_dialog_button_add(dia, _("OK"), NULL, _e_desktop_edit_cb_exec_