From 1995d88b51921392347e0fbb391f69fae7666611 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 5 Jun 2007 13:58:05 +0000 Subject: [PATCH] fwin windows have icon right now... :) SVN revision: 30253 --- TODO | 1 - src/bin/e_border.c | 47 +++++++++++++++++++++----------- src/bin/e_border.h | 1 + src/bin/e_fwin.c | 67 ++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 91 insertions(+), 25 deletions(-) diff --git a/TODO b/TODO index a55363605..b5bef78a5 100644 --- a/TODO +++ b/TODO @@ -38,7 +38,6 @@ Some of the things (in very short form) that need to be done to E17... ------------------------------------------------------------------------------- * fm2 mv between fs's (removable to hd for example) doesn't work. -* fm2 fwin windows need to use icon for that dir on window border * fm2 theme needs to not suck * fm2 custom icon view mode needs to have cleanup,align etc. * fm2 custom icon view mode initial placement needs some fixing diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 1083b0ace..4d884fa5b 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -2586,22 +2586,35 @@ e_border_icon_add(E_Border *bd, Evas *evas) e_util_edje_icon_set(o, "enlightenment/e"); else { - char *ext; - - ext = strrchr(bd->internal_icon, '.'); - if ((ext) && ((!strcmp(ext, ".edj")))) + if (!bd->internal_icon_key) { - if (!edje_object_file_set(o, bd->internal_icon, "icon")) - e_util_edje_icon_set(o, "enlightenment/e"); + char *ext; + + ext = strrchr(bd->internal_icon, '.'); + if ((ext) && ((!strcmp(ext, ".edj")))) + { + if (!edje_object_file_set(o, bd->internal_icon, "icon")) + e_util_edje_icon_set(o, "enlightenment/e"); + } + else if (ext) + { + evas_object_del(o); + o = e_icon_add(evas); + e_icon_file_set(o, bd->internal_icon); + } + else + { + if (!e_util_edje_icon_set(o, bd->internal_icon)) + e_util_edje_icon_set(o, "enlightenment/e"); + } } - else + else { - if (!e_util_edje_icon_set(o, bd->internal_icon)) - e_util_edje_icon_set(o, "enlightenment/e"); + edje_object_file_set(o, bd->internal_icon, + bd->internal_icon_key); } } - if (o) - return o; + return o; } if (e_config->use_app_icon) { @@ -2612,6 +2625,7 @@ e_border_icon_add(E_Border *bd, Evas *evas) bd->client.netwm.icons[0].width, bd->client.netwm.icons[0].height); e_icon_alpha_set(o, 1); + return o; } } if (!o) @@ -2619,6 +2633,7 @@ e_border_icon_add(E_Border *bd, Evas *evas) if (bd->desktop) { o = e_util_desktop_icon_add(bd->desktop, "24x24", evas); + return o; } else if (bd->client.netwm.icons) { @@ -2627,13 +2642,12 @@ e_border_icon_add(E_Border *bd, Evas *evas) bd->client.netwm.icons[0].width, bd->client.netwm.icons[0].height); e_icon_alpha_set(o, 1); + return o; } } - if (!o) - { - o = edje_object_add(evas); - e_util_edje_icon_set(o, "enlightenment/unknown"); - } + + o = edje_object_add(evas); + e_util_edje_icon_set(o, "enlightenment/unknown"); return o; } @@ -3159,6 +3173,7 @@ _e_border_free(E_Border *bd) if (bd->client.netwm.icon_name) free(bd->client.netwm.icon_name); e_object_del(E_OBJECT(bd->shape)); if (bd->internal_icon) evas_stringshare_del(bd->internal_icon); + if (bd->internal_icon_key) evas_stringshare_del(bd->internal_icon_key); if (bd->icon_object) evas_object_del(bd->icon_object); evas_object_del(bd->bg_object); e_canvas_del(bd->bg_ecore_evas); diff --git a/src/bin/e_border.h b/src/bin/e_border.h index 7063f88ac..c4ae2d97f 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -144,6 +144,7 @@ struct _E_Border Evas_Object *icon_object; Ecore_X_Window event_win; const char *internal_icon; + const char *internal_icon_key; struct { Ecore_X_Window shell_win; diff --git a/src/bin/e_fwin.c b/src/bin/e_fwin.c index 65c5f0a8a..1ea2893bb 100644 --- a/src/bin/e_fwin.c +++ b/src/bin/e_fwin.c @@ -208,6 +208,13 @@ e_fwin_new(E_Container *con, const char *dev, const char *path) e_win_size_min_set(fwin->win, 24, 24); e_win_resize(fwin->win, 280, 200); e_win_show(fwin->win); + if (fwin->win->border) + { + if (fwin->win->border->internal_icon) + evas_stringshare_del(fwin->win->border->internal_icon); + fwin->win->border->internal_icon = + evas_stringshare_add("enlightenment/fileman"); + } return fwin; } @@ -856,6 +863,7 @@ _e_fwin_file_exec(E_Fwin *fwin, E_Fm2_Icon_Info *ici, E_Fwin_Exec_Type ext) static void _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always) { + E_Fwin *fwin2 = NULL; E_Dialog *dia; Evas_Coord mw, mh; Evas_Object *o, *ocon, *of, *oi, *mt; @@ -884,25 +892,25 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always) if ((ici->link) && (ici->mount)) { if (fwin->win) - e_fwin_new(fwin->win->container, ici->link, "/"); + fwin2 = e_fwin_new(fwin->win->container, ici->link, "/"); else if (fwin->zone) - e_fwin_new(fwin->zone->container, ici->link, "/"); + fwin2 = e_fwin_new(fwin->zone->container, ici->link, "/"); } else if ((ici->link) && (ici->removable)) { if (fwin->win) - e_fwin_new(fwin->win->container, ici->link, "/"); + fwin2 = e_fwin_new(fwin->win->container, ici->link, "/"); else if (fwin->zone) - e_fwin_new(fwin->zone->container, ici->link, "/"); + fwin2 = e_fwin_new(fwin->zone->container, ici->link, "/"); } else if (ici->real_link) { if (S_ISDIR(ici->statinfo.st_mode)) { if (fwin->win) - e_fwin_new(fwin->win->container, NULL, ici->real_link); + fwin2 = e_fwin_new(fwin->win->container, NULL, ici->real_link); else if (fwin->zone) - e_fwin_new(fwin->zone->container, NULL, ici->real_link); + fwin2 = e_fwin_new(fwin->zone->container, NULL, ici->real_link); } else need_dia = 1; @@ -914,13 +922,56 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always) if (S_ISDIR(ici->statinfo.st_mode)) { if (fwin->win) - e_fwin_new(fwin->win->container, NULL, buf); + fwin2 = e_fwin_new(fwin->win->container, NULL, buf); else - e_fwin_new(fwin->zone->container, NULL, buf); + fwin2 = e_fwin_new(fwin->zone->container, NULL, buf); } else need_dia = 1; } + if (fwin2) + { + if ((fwin2->win) && (fwin2->win->border)) + { + Evas_Object *oic; + const char *itype = NULL; + + oic = e_fm2_icon_get(evas_object_evas_get(fwin->fm_obj), + ici->ic, NULL, NULL, 0, &itype); + if (oic) + { + const char *file = NULL, *group = NULL; + + if (fwin2->win->border->internal_icon) + evas_stringshare_del(fwin2->win->border->internal_icon); + fwin2->win->border->internal_icon = NULL; + if (fwin2->win->border->internal_icon_key) + evas_stringshare_del(fwin2->win->border->internal_icon_key); + fwin2->win->border->internal_icon_key = NULL; + + if (!strcmp(evas_object_type_get(oic), "edje")) + { + edje_object_file_get(oic, &file, &group); + if (file) + { + fwin2->win->border->internal_icon = + evas_stringshare_add(file); + if (group) + fwin2->win->border->internal_icon_key = + evas_stringshare_add(group); + } + } + else + { + file = e_icon_file_get(oic); + fwin2->win->border->internal_icon = + evas_stringshare_add(file); + } + evas_object_del(oic); + } + } + fwin2 = NULL; + } } if (!need_dia) return; need_dia = 0;