aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-09-18 10:00:37 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-09-18 10:00:37 +0000
commite574adfed748be8f7f742c4039346c97bd523057 (patch)
tree5be2fa22dcf92f23af61c7d3c325fbc4715abfc0
parent34c247ee402ea5c9d5c70da0462544af4b40ac55 (diff)
downloadenlightenment-e574adfed748be8f7f742c4039346c97bd523057.tar.gz
enlightenment-e574adfed748be8f7f742c4039346c97bd523057.tar.xz
enlightenment-e574adfed748be8f7f742c4039346c97bd523057.zip
add single-instance launching infra support for e17 as well as launch
tracking for ibar. SVN revision: 76793
-rw-r--r--config/default/e.src1
-rw-r--r--config/mobile/e.src1
-rw-r--r--config/standard/e.src1
-rw-r--r--data/themes/default.edc30
-rw-r--r--src/bin/e_border.c1
-rw-r--r--src/bin/e_config.c2
-rw-r--r--src/bin/e_config.h6
-rw-r--r--src/bin/e_exec.c145
-rw-r--r--src/bin/e_exec.h15
-rw-r--r--src/modules/conf_applications/e_int_config_deskenv.c26
-rw-r--r--src/modules/ibar/e_mod_config.c29
-rw-r--r--src/modules/ibar/e_mod_main.c76
-rw-r--r--src/modules/ibar/e_mod_main.h1
13 files changed, 277 insertions, 57 deletions
diff --git a/config/default/e.src b/config/default/e.src
index 0598c4c85..947b9074e 100644
--- a/config/default/e.src
+++ b/config/default/e.src
@@ -525,6 +525,7 @@ group "E_Config" struct {
value "update.later" uchar: 0;
value "xkb.only_label" int: 0;
value "xkb.default_model" string: "default";
+ value "exe_always_single_instance" uchar: 0;
value "powersave.none" double: 0.25;
value "powersave.low" double: 5.0;
value "powersave.medium" double: 60.0;
diff --git a/config/mobile/e.src b/config/mobile/e.src
index 4f74b74d5..7fcd6b4b6 100644
--- a/config/mobile/e.src
+++ b/config/mobile/e.src
@@ -1792,4 +1792,5 @@ group "E_Config" struct {
}
value "xkb.only_label" int: 0;
value "xkb.default_model" string: "default";
+ value "exe_always_single_instance" uchar: 1;
}
diff --git a/config/standard/e.src b/config/standard/e.src
index 98cd62a49..ebc40f93f 100644
--- a/config/standard/e.src
+++ b/config/standard/e.src
@@ -2029,4 +2029,5 @@ group "E_Config" struct {
}
value "xkb.only_label" int: 0;
value "xkb.default_model" string: "default";
+ value "exe_always_single_instance" uchar: 0;
}
diff --git a/data/themes/default.edc b/data/themes/default.edc
index ceda56f65..e6d9e147c 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -13432,22 +13432,22 @@ CONNMAN_ICON(ethernet)
name: "item_clip";
type: RECT;
mouse_events: 0;
- description {
- state: "default" 0.0;
+ description { state: "default" 0.0;
color: 255 255 255 255;
}
+ description { state: "disabled" 0.0;
+ color: 255 255 255 64;
+ }
}
part {
name: "e.swallow.content";
type: SWALLOW;
clip_to: "item_clip";
- description {
- state: "default" 0.0;
+ description { state: "default" 0.0;
rel1.offset: 2 2;
rel2.offset: -3 -3;
}
- description {
- state: "bigger" 0.0;
+ description { state: "bigger" 0.0;
}
}
part {
@@ -13529,12 +13529,18 @@ CONNMAN_ICON(ethernet)
}
programs {
program {
- name: "hover_in";
- signal: "mouse,in";
- source: "over";
- action: STATE_SET "bigger" 0.0;
- transition: LINEAR 0.1;
- target: "e.swallow.content";
+ name: "starting";
+ signal: "e,state,starting";
+ source: "e";
+ action: STATE_SET "disabled" 0.0;
+ target: "item_clip";
+ }
+ program {
+ name: "started";
+ signal: "e,state,started";
+ source: "e";
+ action: STATE_SET "default" 0.0;
+ target: "item_clip";
}
program {
name: "hover_out";
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index 039bda332..7ac2298d8 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -7553,6 +7553,7 @@ _e_border_eval0(E_Border *bd)
desk = e_desk_at_xy_get(bd->zone, inst->desk_x,
inst->desk_y);
if (desk) e_border_desk_set(bd, desk);
+ e_exec_instance_found(inst);
}
if (e_config->window_grouping) // FIXME: We may want to make the border "urgent" so that the user knows it appeared.
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index 9372b86ae..e43675c6a 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -932,6 +932,8 @@ e_config_init(void)
E_CONFIG_VAL(D, T, xkb.only_label, INT);
E_CONFIG_VAL(D, T, xkb.default_model, STR);
//E_CONFIG_VAL(D, T, xkb.cur_group, INT);
+
+ E_CONFIG_VAL(D, T, exe_always_single_instance, UCHAR);
e_config_load();
e_config_save_queue();
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index 8814c429b..751880011 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -260,12 +260,12 @@ struct _E_Config
double thumbscroll_momentum_threshhold; // GUI
double thumbscroll_friction; // GUI
- Eina_Bool filemanager_single_click; // GUI
+ unsigned char filemanager_single_click; // GUI
int device_desktop; // GUI
int device_auto_mount; // GUI
int device_auto_open; // GUI
Efm_Mode device_detect_mode; /* not saved, display-only */
- Eina_Bool filemanager_copy; // GUI
+ unsigned char filemanager_copy; // GUI
struct
{
@@ -386,6 +386,8 @@ struct _E_Config
const char *default_model;
int cur_group;
} xkb;
+
+ unsigned char exe_always_single_instance;
};
struct _E_Config_Desklock_Background
diff --git a/src/bin/e_exec.c b/src/bin/e_exec.c
index c48fbbe47..cedcdeefb 100644
--- a/src/bin/e_exec.c
+++ b/src/bin/e_exec.c
@@ -11,6 +11,7 @@
typedef struct _E_Exec_Launch E_Exec_Launch;
typedef struct _E_Exec_Search E_Exec_Search;
+typedef struct _E_Exec_Watch E_Exec_Watch;
struct _E_Exec_Launch
{
@@ -21,10 +22,18 @@ struct _E_Exec_Launch
struct _E_Exec_Search
{
E_Exec_Instance *inst;
+ Efreet_Desktop *desktop;
int startup_id;
pid_t pid;
};
+struct _E_Exec_Watch
+{
+ void (*func) (void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type);
+ const void *data;
+ Eina_Bool delete_me : 1;
+};
+
struct _E_Config_Dialog_Data
{
Efreet_Desktop *desktop;
@@ -99,18 +108,36 @@ e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec,
{
E_Exec_Launch *launch;
E_Exec_Instance *inst = NULL;
- const char *single = NULL;
if ((!desktop) && (!exec)) return NULL;
if (desktop)
{
+ const char *single;
+
single = eina_hash_find(desktop->x, "X-Enlightenment-Single-Instance");
- if (single)
+ if ((single) ||
+ (e_config->exe_always_single_instance))
{
- if ((!strcasecmp(single, "true")) ||
- (!strcasecmp(single, "yes"))||
- (!strcasecmp(single, "1")))
+ Eina_Bool dosingle = EINA_FALSE;
+
+ // first take system config for always single instance if set
+ if (e_config->exe_always_single_instance) dosingle = EINA_TRUE;
+
+ // and now let desktop file override it
+ if (single)
+ {
+ if ((!strcasecmp(single, "true")) ||
+ (!strcasecmp(single, "yes"))||
+ (!strcasecmp(single, "1")))
+ dosingle = EINA_TRUE;
+ else if ((!strcasecmp(single, "false")) ||
+ (!strcasecmp(single, "no"))||
+ (!strcasecmp(single, "0")))
+ dosingle = EINA_FALSE;
+ }
+
+ if (dosingle)
{
Eina_List *l;
E_Border *bd;
@@ -121,7 +148,8 @@ e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec,
{
if (bd)
{
- if (!bd->focused) e_border_activate(bd, EINA_TRUE);
+ if (!bd->focused)
+ e_border_activate(bd, EINA_TRUE);
else e_border_raise(bd);
return NULL;
}
@@ -166,6 +194,7 @@ e_exec_startup_id_pid_instance_find(int id, pid_t pid)
E_Exec_Search search;
search.inst = NULL;
+ search.desktop = NULL;
search.startup_id = id;
search.pid = pid;
eina_hash_foreach(e_exec_instances, _e_exec_startup_id_pid_find, &search);
@@ -182,6 +211,87 @@ e_exec_startup_id_pid_find(int id, pid_t pid)
return inst->desktop;
}
+EAPI E_Exec_Instance *
+e_exec_startup_desktop_instance_find(Efreet_Desktop *desktop)
+{
+ E_Exec_Search search;
+
+ search.inst = NULL;
+ search.desktop = desktop;
+ search.startup_id = 0;
+ search.pid = 0;
+ eina_hash_foreach(e_exec_instances, _e_exec_startup_id_pid_find, &search);
+ return search.inst;
+}
+
+static void
+_e_exe_instance_watchers_call(E_Exec_Instance *inst, E_Exec_Watch_Type type)
+{
+ E_Exec_Watch *iw;
+ Eina_List *l, *ln;
+
+ inst->walking++;
+ EINA_LIST_FOREACH(inst->watchers, l, iw)
+ {
+ if (iw->func) iw->func((void *)(iw->data), inst, type);
+ }
+ inst->walking--;
+ if (inst->walking == 0)
+ {
+ EINA_LIST_FOREACH_SAFE(inst->watchers, l, ln, iw)
+ {
+ if (iw->delete_me)
+ {
+ inst->watchers = eina_list_remove_list(inst->watchers, l);
+ free(iw);
+ }
+ }
+ }
+}
+
+EAPI void
+e_exec_instance_found(E_Exec_Instance *inst)
+{
+ _e_exe_instance_watchers_call(inst, E_EXEC_WATCH_STARTED);
+}
+
+EAPI void
+e_exec_instance_watcher_add(E_Exec_Instance *inst, void (*func) (void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data)
+{
+ E_Exec_Watch *iw;
+
+ iw = E_NEW(E_Exec_Watch, 1);
+ if (!iw) return;
+ iw->func = func;
+ iw->data = data;
+ inst->watchers = eina_list_append(inst->watchers, iw);
+}
+
+EAPI void
+e_exec_instance_watcher_del(E_Exec_Instance *inst, void (*func) (void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data)
+{
+ E_Exec_Watch *iw;
+ Eina_List *l, *ln;
+
+ EINA_LIST_FOREACH_SAFE(inst->watchers, l, ln, iw)
+ {
+ if ((iw->func == func) && (iw->data == data))
+ {
+ if (inst->walking == 0)
+ {
+ inst->watchers = eina_list_remove_list(inst->watchers, l);
+ free(iw);
+ return;
+ }
+ else
+ {
+ iw->delete_me = EINA_TRUE;
+ return;
+ }
+ }
+ }
+}
+
/* local subsystem functions */
static E_Exec_Instance *
_e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining)
@@ -407,6 +517,7 @@ _e_exec_cb_expire_timer(void *data)
e_exec_start_pending = eina_list_remove(e_exec_start_pending,
inst->desktop);
inst->expire_timer = NULL;
+ _e_exe_instance_watchers_call(inst, E_EXEC_WATCH_TIMEOUT);
return ECORE_CALLBACK_CANCEL;
}
@@ -414,7 +525,11 @@ static void
_e_exec_instance_free(E_Exec_Instance *inst)
{
Eina_List *instances;
-
+ E_Exec_Watch *iw;
+
+ _e_exe_instance_watchers_call(inst, E_EXEC_WATCH_STOPPED);
+ EINA_LIST_FREE(inst->watchers, iw) free(iw);
+
if (inst->key)
{
instances = eina_hash_find(e_exec_instances, inst->key);
@@ -435,13 +550,14 @@ _e_exec_instance_free(E_Exec_Instance *inst)
if (inst->desktop) efreet_desktop_free(inst->desktop);
free(inst);
}
-
+/*
static Eina_Bool
_e_exec_cb_instance_finish(void *data)
{
_e_exec_instance_free(data);
return ECORE_CALLBACK_CANCEL;
}
+*/
static Eina_Bool
_e_exec_cb_exit(void *data __UNUSED__, int type __UNUSED__, void *event)
@@ -509,14 +625,17 @@ _e_exec_cb_exit(void *data __UNUSED__, int type __UNUSED__, void *event)
}
}
- /* maybe better 1 minute? it might be openoffice */
- if (ecore_time_get() - inst->launch_time < 2.0)
+/* scripts that fork off children with & break child tracking... but this hack
+ * also breaks apps that handle single-instance themselves */
+/*
+ if ((ecore_time_get() - inst->launch_time) < 2.0)
{
inst->exe = NULL;
if (inst->expire_timer) ecore_timer_del(inst->expire_timer);
inst->expire_timer = ecore_timer_add(e_config->exec.expire_timeout, _e_exec_cb_instance_finish, inst);
}
else
+ */
_e_exec_instance_free(inst);
return ECORE_CALLBACK_PASS_ON;
@@ -532,8 +651,12 @@ _e_exec_startup_id_pid_find(const Eina_Hash *hash __UNUSED__, const void *key __
search = data;
EINA_LIST_FOREACH(value, l, inst)
{
- if (((search->startup_id > 0) &&
+ if (((search->desktop) &&
+ (search->desktop == inst->desktop)) ||
+
+ ((search->startup_id > 0) &&
(search->startup_id == inst->startup_id)) ||
+
((inst->exe) && (search->pid > 1) &&
(search->pid == ecore_exe_pid_get(inst->exe))))
{
diff --git a/src/bin/e_exec.h b/src/bin/e_exec.h
index 488c6355e..84378aa1c 100644
--- a/src/bin/e_exec.h
+++ b/src/bin/e_exec.h
@@ -17,15 +17,26 @@ struct _E_Exec_Instance
int screen;
int desk_x, desk_y;
int used;
+ int walking;
+ Eina_List *watchers;
};
+typedef enum
+{
+ E_EXEC_WATCH_STARTED,
+ E_EXEC_WATCH_STOPPED,
+ E_EXEC_WATCH_TIMEOUT
+} E_Exec_Watch_Type;
+
EINTERN int e_exec_init(void);
EINTERN int e_exec_shutdown(void);
EAPI E_Exec_Instance *e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method);
-
EAPI E_Exec_Instance *e_exec_startup_id_pid_instance_find(int id, pid_t pid);
EAPI Efreet_Desktop *e_exec_startup_id_pid_find(int startup_id, pid_t pid);
-
+EAPI E_Exec_Instance *e_exec_startup_desktop_instance_find(Efreet_Desktop *desktop);
+EAPI void e_exec_instance_found(E_Exec_Instance *inst);
+EAPI void e_exec_instance_watcher_add(E_Exec_Instance *inst, void (*func) (void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data);
+EAPI void e_exec_instance_watcher_del(E_Exec_Instance *inst, void (*func) (void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data);
#endif
#endif
diff --git a/src/modules/conf_applications/e_int_config_deskenv.c b/src/modules/conf_applications/e_int_config_deskenv.c
index ee18a5353..6a88a99fa 100644
--- a/src/modules/conf_applications/e_int_config_deskenv.c
+++ b/src/modules/conf_applications/e_int_config_deskenv.c
@@ -14,6 +14,7 @@ struct _E_Config_Dialog_Data
int load_xmodmap;
int load_gnome;
int load_kde;
+ int exe_always_single_instance;
};
/* a nice easy setup function that does the dirty work */
@@ -48,6 +49,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->load_xmodmap = e_config->deskenv.load_xmodmap;
cfdata->load_gnome = e_config->deskenv.load_gnome;
cfdata->load_kde = e_config->deskenv.load_kde;
+ cfdata->exe_always_single_instance = e_config->exe_always_single_instance;
}
static void *
@@ -74,6 +76,7 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
e_config->deskenv.load_xmodmap = cfdata->load_xmodmap;
e_config->deskenv.load_gnome = cfdata->load_gnome;
e_config->deskenv.load_kde = cfdata->load_kde;
+ e_config->exe_always_single_instance = cfdata->exe_always_single_instance;
e_config_save_queue();
return 1; /* Apply was OK */
}
@@ -83,21 +86,34 @@ static Evas_Object *
_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
{
/* generate the core widget layout for a basic dialog */
- Evas_Object *o, *ob;
+ Evas_Object *o, *fr, *ob;
o = e_widget_list_add(evas, 0, 0);
+
+ fr = e_widget_framelist_add(evas, _("Execution"), 0);
+ ob = e_widget_check_add(evas, _("Only launch single instances"),
+ &(cfdata->exe_always_single_instance));
+ e_widget_framelist_object_append(fr, ob);
+ e_widget_list_object_append(o, fr, 1, 0, 0.0);
+
+ fr = e_widget_framelist_add(evas, _("X11 Basics"), 0);
ob = e_widget_check_add(evas, _("Load X Resources"),
&(cfdata->load_xrdb));
- e_widget_list_object_append(o, ob, 1, 0, 0.0);
+ e_widget_framelist_object_append(fr, ob);
ob = e_widget_check_add(evas, _("Load X Modifier Map"),
&(cfdata->load_xmodmap));
- e_widget_list_object_append(o, ob, 1, 0, 0.0);
+ e_widget_framelist_object_append(fr, ob);
+ e_widget_list_object_append(o, fr, 1, 0, 0.0);
+
+ fr = e_widget_framelist_add(evas, _("Major Desktops"), 0);
ob = e_widget_check_add(evas, _("Start GNOME services on login"),
&(cfdata->load_gnome));
- e_widget_list_object_append(o, ob, 1, 0, 0.0);
+ e_widget_framelist_object_append(fr, ob);
ob = e_widget_check_add(evas, _("Start KDE services on login"),
&(cfdata->load_kde));
- e_widget_list_object_append(o, ob, 1, 0, 0.0);
+ e_widget_framelist_object_append(fr, ob);
+ e_widget_list_object_append(o, fr, 1, 0, 0.0);
+
return o;
}
diff --git a/src/modules/ibar/e_mod_config.c b/src/modules/ibar/e_mod_config.c
index 2196c4b77..9d531162c 100644
--- a/src/modules/ibar/e_mod_config.c
+++ b/src/modules/ibar/e_mod_config.c
@@ -6,6 +6,7 @@ struct _E_Config_Dialog_Data
const char *dir;
int show_label, eap_label;
int lock_move;
+ int track_launch;
Evas_Object *tlist;
Evas_Object *radio_name;
@@ -66,6 +67,7 @@ _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
cfdata->show_label = ci->show_label;
cfdata->eap_label = ci->eap_label;
cfdata->lock_move = ci->lock_move;
+ cfdata->track_launch = !ci->dont_track_launch;
}
static void *
@@ -97,7 +99,7 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
o = e_widget_list_add(evas, 0, 0);
- of = e_widget_frametable_add(evas, _("Selected Bar Source"), 0);
+ of = e_widget_frametable_add(evas, _("Selected source"), 0);
ol = e_widget_ilist_add(evas, 32, 32, &(cfdata->dir));
cfdata->tlist = ol;
_load_tlist(cfdata);
@@ -119,28 +121,30 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Icon Labels"), 0);
- ob = e_widget_check_add(evas, _("Show Icon Label"), &(cfdata->show_label));
+ ob = e_widget_check_add(evas, _("Show icon label"), &(cfdata->show_label));
e_widget_on_change_hook_set(ob, _show_label_cb_change, cfdata);
e_widget_framelist_object_append(of, ob);
rg = e_widget_radio_group_new(&(cfdata->eap_label));
- cfdata->radio_name = e_widget_radio_add(evas, _("Display App Name"), 0, rg);
+ cfdata->radio_name = e_widget_radio_add(evas, _("Name"), 0, rg);
e_widget_framelist_object_append(of, cfdata->radio_name);
if (!cfdata->show_label) e_widget_disabled_set(cfdata->radio_name, 1);
- cfdata->radio_comment = e_widget_radio_add(evas, _("Display App Comment"), 1, rg);
+ cfdata->radio_comment = e_widget_radio_add(evas, _("Comment"), 1, rg);
e_widget_framelist_object_append(of, cfdata->radio_comment);
if (!cfdata->show_label) e_widget_disabled_set(cfdata->radio_comment, 1);
- cfdata->radio_generic = e_widget_radio_add(evas, _("Display App Generic"), 2, rg);
+ cfdata->radio_generic = e_widget_radio_add(evas, _("Generic"), 2, rg);
e_widget_framelist_object_append(of, cfdata->radio_generic);
if (!cfdata->show_label) e_widget_disabled_set(cfdata->radio_generic, 1);
e_widget_list_object_append(o, of, 1, 1, 0.5);
- of = e_widget_framelist_add(evas, _("Icon Movement"), 0);
- ob = e_widget_check_add(evas, _("Lock Icon Move"), &(cfdata->lock_move));
+ of = e_widget_framelist_add(evas, _("Misc"), 0);
+ ob = e_widget_check_add(evas, _("Lock icon move"), &(cfdata->lock_move));
+ e_widget_framelist_object_append(of, ob);
+ ob = e_widget_check_add(evas, _("Track launch"), &(cfdata->track_launch));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
@@ -160,6 +164,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
ci->show_label = cfdata->show_label;
ci->eap_label = cfdata->eap_label;
ci->lock_move = cfdata->lock_move;
+ ci->dont_track_launch = !cfdata->track_launch;
_ibar_config_update(ci);
e_config_save_queue();
return 1;
@@ -231,9 +236,13 @@ _cb_entry_ok(void *data, char *text)
int ret = 0;
/* Populate this .order file with some defaults */
- snprintf(tmp, sizeof(tmp), "xterm.desktop\n" "sylpheed.desktop\n"
- "firefox.desktop\n" "openoffice.desktop\n" "xchat.desktop\n"
- "gimp.desktop\n" "xmms.desktop\n");
+ snprintf(tmp, sizeof(tmp),
+ "terminology.desktop\n"
+ "sylpheed.desktop\n"
+ "firefox.desktop\n"
+ "openoffice.desktop\n"
+ "xchat.desktop\n"
+ "gimp.desktop\n");
ret = fwrite(tmp, sizeof(char), strlen(tmp), f);
fclose(f);
}
diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c
index 391ee4257..05dc9c695 100644
--- a/src/modules/ibar/e_mod_main.c
+++ b/src/modules/ibar/e_mod_main.c
@@ -66,12 +66,13 @@ struct _IBar
struct _IBar_Icon
{
- IBar *ibar;
- Evas_Object *o_holder, *o_icon;
- Evas_Object *o_holder2, *o_icon2;
- Efreet_Desktop *app;
- Ecore_Timer *reset_timer;
- int mouse_down;
+ IBar *ibar;
+ Evas_Object *o_holder, *o_icon;
+ Evas_Object *o_holder2, *o_icon2;
+ Efreet_Desktop *app;
+ Ecore_Timer *reset_timer;
+ E_Exec_Instance *exe_inst;
+ int mouse_down;
struct
{
unsigned char start : 1;
@@ -85,6 +86,7 @@ static IBar *_ibar_new(Evas *evas, Instance *inst);
static void _ibar_free(IBar *b);
static void _ibar_cb_empty_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _ibar_empty_handle(IBar *b);
+static void _ibar_instance_watch(void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type);
static void _ibar_fill(IBar *b);
static void _ibar_empty(IBar *b);
static void _ibar_orient_set(IBar *b, int horizontal);
@@ -515,7 +517,8 @@ _ibar_config_item_get(const char *id)
ci->dir = eina_stringshare_add("default");
ci->show_label = 1;
ci->eap_label = 0;
- ci->lock_move= 0;
+ ci->lock_move = 0;
+ ci->dont_track_launch = 0;
ibar_config->items = eina_list_append(ibar_config->items, ci);
return ci;
}
@@ -630,6 +633,11 @@ _ibar_icon_free(IBar_Icon *ic)
_ibar_icon_empty(ic);
evas_object_del(ic->o_holder);
evas_object_del(ic->o_holder2);
+ if (ic->exe_inst)
+ {
+ e_exec_instance_watcher_del(ic->exe_inst, _ibar_instance_watch, ic);
+ ic->exe_inst = NULL;
+ }
E_FREE(ic);
}
@@ -788,6 +796,7 @@ _ibar_cb_icon_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED
ic = data;
if (ic->reset_timer) ecore_timer_del(ic->reset_timer);
ic->reset_timer = NULL;
+ if (ic->exe_inst) return;
ic->focused = EINA_TRUE;
_ibar_icon_signal_emit(ic, "e,state,focused", "e");
if (ic->ibar->inst->ci->show_label)
@@ -907,10 +916,50 @@ _ibar_cb_icon_reset(void *data)
}
static void
+_ibar_instance_watch(void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type)
+{
+ IBar_Icon *ic = data;
+
+ switch (type)
+ {
+ case E_EXEC_WATCH_STARTED:
+ case E_EXEC_WATCH_STOPPED:
+ case E_EXEC_WATCH_TIMEOUT:
+ if (ic->exe_inst == inst)
+ {
+ _ibar_icon_signal_emit(ic, "e,state,started", "e");
+ e_exec_instance_watcher_del(inst, _ibar_instance_watch, ic);
+ ic->exe_inst = NULL;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static void
_ibar_icon_go(IBar_Icon *ic, Eina_Bool keep_going)
{
if (ic->app->type == EFREET_DESKTOP_TYPE_APPLICATION)
- e_exec(ic->ibar->inst->gcc->gadcon->zone, ic->app, NULL, NULL, "ibar");
+ {
+ if (ic->ibar->inst->ci->dont_track_launch)
+ e_exec(ic->ibar->inst->gcc->gadcon->zone,
+ ic->app, NULL, NULL, "ibar");
+ else
+ {
+ E_Exec_Instance *einst;
+
+ if (ic->exe_inst) return;
+ einst = e_exec(ic->ibar->inst->gcc->gadcon->zone,
+ ic->app, NULL, NULL, "ibar");
+ if (einst)
+ {
+ ic->exe_inst = einst;
+ e_exec_instance_watcher_add(einst, _ibar_instance_watch, ic);
+ _ibar_icon_signal_emit(ic, "e,state,starting", "e");
+ }
+ }
+ }
else if (ic->app->type == EFREET_DESKTOP_TYPE_LINK)
{
if (!strncasecmp(ic->app->url, "file:", 5))
@@ -921,14 +970,9 @@ _ibar_icon_go(IBar_Icon *ic, Eina_Bool keep_going)
if (act) act->func.go(NULL, ic->app->url + 5);
}
}
- /* TODO: bring back "e,action,start|stop" for the startup_notify apps
- * when startup_notify is used again
- */
_ibar_icon_signal_emit(ic, "e,action,exec", "e");
if (keep_going)
- {
- ic->reset_timer = ecore_timer_add(1.0, _ibar_cb_icon_reset, ic);
- }
+ ic->reset_timer = ecore_timer_add(1.0, _ibar_cb_icon_reset, ic);
}
static void
@@ -1713,6 +1757,7 @@ e_modapi_init(E_Module *m)
E_CONFIG_VAL(D, T, show_label, INT);
E_CONFIG_VAL(D, T, eap_label, INT);
E_CONFIG_VAL(D, T, lock_move, INT);
+ E_CONFIG_VAL(D, T, dont_track_launch, UCHAR);
conf_edd = E_CONFIG_DD_NEW("IBar_Config", Config);
#undef T
@@ -1734,7 +1779,8 @@ e_modapi_init(E_Module *m)
ci->dir = eina_stringshare_add("default");
ci->show_label = 1;
ci->eap_label = 0;
- ci->lock_move= 0;
+ ci->lock_move = 0;
+ ci->dont_track_launch = 0;
ibar_config->items = eina_list_append(ibar_config->items, ci);
}
diff --git a/src/modules/ibar/e_mod_main.h b/src/modules/ibar/e_mod_main.h
index b6bf3f664..47bdd7d48 100644
--- a/src/modules/ibar/e_mod_main.h
+++ b/src/modules/ibar/e_mod_main.h
@@ -22,6 +22,7 @@ struct _Config_Item
int show_label;
int eap_label;
int lock_move;
+ unsigned char dont_track_launch;
};
EAPI extern E_Module_Api e_modapi;