enlightenment/src/bin/e_fm_prop.c

710 lines
25 KiB
C
Raw Normal View History

#include "e.h"
/* FIXME:
2012-06-20 23:19:43 -07:00
*
* basic -
2012-06-20 23:19:43 -07:00
* + show file
* + show size
* + show last access date
* + show modified date
* + show mimetype
* + show permissions (others read, others write)
* + show preview
* + show owner
2007-05-03 10:58:35 -07:00
* + show icon
* * show symlink/fifo/socket/etc. status
* + show broken link status
2007-05-03 10:58:35 -07:00
* + change icon for mime type
* * change icon for just this file
* + change permissions
2012-06-20 23:19:43 -07:00
*
* advanced (extra) -
* * show change date
* * show comment
* * show generic
* * show mount status
* * show setuid bit
* + show link destination (if symlink or link)
* * show group
* * change link destination
* * change app to open THIS file with (or dir)
2012-06-20 23:19:43 -07:00
*
*/
/* PROTOTYPES - same all the time */
2012-07-17 03:32:01 -07:00
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
#if 0
2012-07-17 03:32:01 -07:00
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
#endif
2012-07-17 03:32:01 -07:00
static void _cb_icon_sel(void *data, void *data2);
static void _cb_type(void *data, Evas_Object *obj, void *event_info);
static void _cb_preview_update(void *data, Evas_Object *obj, void *event_info);
static void _cb_fsel_sel(void *data, Evas_Object *obj);
static void _cb_fsel_ok(void *data, E_Dialog *dia);
static void _cb_fsel_cancel(void *data, E_Dialog *dia);
/* Actual config data we will be playing with while the dialog is active */
struct _E_Config_Dialog_Data
{
2012-07-17 03:32:01 -07:00
E_Fm2_Icon *ic;
E_Fm2_Icon_Info *fi;
2012-07-17 03:32:01 -07:00
struct
{
Evas_Object *icon_wid;
Evas_Object *preview;
Evas_Object *preview_table;
Evas_Object *fsel_wid;
2012-07-17 03:32:01 -07:00
E_Dialog *fsel;
} gui;
/*- BASIC -*/
2012-07-17 03:32:01 -07:00
char *file;
char *location;
2012-07-17 03:32:01 -07:00
char *size;
char *mod_date;
char *acc_date;
char *pms_date;
2012-07-17 03:32:01 -07:00
char *mime;
char *owner;
char *link;
char *plink;
char *blocks;
2012-07-17 03:32:01 -07:00
int owner_read;
int owner_write;
int owner_exec;
2012-07-17 03:32:01 -07:00
int others_read;
int others_write;
int others_exec;
int group_read;
int group_write;
int group_exec;
2012-07-17 03:32:01 -07:00
int picon_type;
int picon_mime;
int picon_changed;
int icon_type;
int icon_mime;
char *icon;
/*- ADVANCED -*/
};
/* a nice easy setup function that does the dirty work */
EAPI E_Config_Dialog *
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
e_fm_prop_file(E_Comp *c, E_Fm2_Icon *ic)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
2012-06-20 23:19:43 -07:00
v = E_NEW(E_Config_Dialog_View, 1);
2012-06-20 23:19:43 -07:00
/* methods */
2012-07-17 03:32:01 -07:00
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
2012-06-20 23:19:43 -07:00
#if 0
2012-07-17 03:32:01 -07:00
v->advanced.apply_cfdata = _advanced_apply_data;
v->advanced.create_widgets = _advanced_create_widgets;
2012-06-20 23:19:43 -07:00
#endif
/* create config dialog for NULL object/data */
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
cfd = e_config_dialog_new(c,
2012-07-17 03:32:01 -07:00
_("File Properties"),
"E", "_fm_prop",
"enlightenment/file_properties", 0, v, ic);
return cfd;
}
/**--CREATE--**/
static void
_fill_data(E_Config_Dialog_Data *cfdata, E_Fm2_Icon *ic)
{
char loc[PATH_MAX];
char blks[256];
struct passwd *pw;
2012-06-20 23:19:43 -07:00
cfdata->ic = ic;
cfdata->fi = e_fm2_icon_file_info_get(ic);
if (cfdata->fi->file) cfdata->file = strdup(cfdata->fi->file);
cfdata->size = e_util_size_string_get(cfdata->fi->statinfo.st_size);
cfdata->mod_date = e_util_file_time_get(cfdata->fi->statinfo.st_mtime);
cfdata->acc_date = e_util_file_time_get(cfdata->fi->statinfo.st_atime);
cfdata->pms_date = e_util_file_time_get(cfdata->fi->statinfo.st_ctime);
if (cfdata->fi->mime) cfdata->mime = strdup(cfdata->fi->mime);
snprintf(blks, sizeof(blks), "%lu", (unsigned long)cfdata->fi->statinfo.st_blocks);
cfdata->blocks = strdup(blks);
snprintf(loc, sizeof(loc), "%s", e_fm2_real_path_get(cfdata->fi->fm));
cfdata->location = strdup(loc);
pw = getpwuid(cfdata->fi->statinfo.st_uid);
if (pw) cfdata->owner = strdup(pw->pw_name);
if (cfdata->fi->link) cfdata->link = strdup(cfdata->fi->link);
if (cfdata->fi->link) cfdata->plink = strdup(cfdata->fi->link);
if (cfdata->fi->statinfo.st_mode & S_IRUSR) cfdata->owner_read = 1;
if (cfdata->fi->statinfo.st_mode & S_IWUSR) cfdata->owner_write = 1;
if (cfdata->fi->statinfo.st_mode & S_IEXEC) cfdata->owner_exec = 1;
if (cfdata->fi->statinfo.st_mode & S_IROTH) cfdata->others_read = 1;
if (cfdata->fi->statinfo.st_mode & S_IWOTH) cfdata->others_write = 1;
if (cfdata->fi->statinfo.st_mode & S_IXOTH) cfdata->others_exec = 1;
if (cfdata->fi->statinfo.st_mode & S_IRGRP) cfdata->group_read = 1;
if (cfdata->fi->statinfo.st_mode & S_IWGRP) cfdata->group_write = 1;
if (cfdata->fi->statinfo.st_mode & S_IXGRP) cfdata->group_exec = 1;
}
static void *
_create_data(E_Config_Dialog *cfd)
{
/* Create cfdata - cfdata is a temporary block of config data that this
* dialog will be dealing with while configuring. it will be applied to
* the running systems/config in the apply methods
*/
E_Config_Dialog_Data *cfdata;
2012-06-20 23:19:43 -07:00
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata, cfd->data);
return cfdata;
}
static void
2010-08-18 14:25:29 -07:00
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
if (cfdata->gui.fsel)
e_object_del(E_OBJECT(cfdata->gui.fsel));
E_FREE(cfdata->file);
E_FREE(cfdata->location);
E_FREE(cfdata->size);
E_FREE(cfdata->blocks);
E_FREE(cfdata->mod_date);
E_FREE(cfdata->acc_date);
E_FREE(cfdata->pms_date);
E_FREE(cfdata->mime);
E_FREE(cfdata->owner);
E_FREE(cfdata->link);
E_FREE(cfdata->plink);
E_FREE(cfdata->icon);
free(cfdata);
}
/**--APPLY--**/
static int
2010-08-18 14:25:29 -07:00
_basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
2010-08-18 14:25:29 -07:00
char buf[PATH_MAX];
Eina_Bool fperm = EINA_FALSE;
2012-06-20 23:19:43 -07:00
snprintf(buf, sizeof(buf), "%s/%s",
cfdata->location, cfdata->fi->file);
2007-01-10 08:38:20 -08:00
if (((cfdata->fi->statinfo.st_mode & S_IRUSR) && (cfdata->owner_read)) ||
((!(cfdata->fi->statinfo.st_mode & S_IRUSR)) && (!cfdata->owner_read)))
fperm = EINA_TRUE;
2007-01-10 08:38:20 -08:00
if (((cfdata->fi->statinfo.st_mode & S_IWUSR) && (cfdata->owner_write)) ||
((!(cfdata->fi->statinfo.st_mode & S_IWUSR)) && (!cfdata->owner_write)))
fperm = EINA_TRUE;
2007-01-10 08:38:20 -08:00
if (((cfdata->fi->statinfo.st_mode & S_IROTH) && (cfdata->others_read)) ||
((!(cfdata->fi->statinfo.st_mode & S_IROTH)) && (!cfdata->others_read)))
fperm = EINA_TRUE;
if (((cfdata->fi->statinfo.st_mode & S_IEXEC) && (cfdata->owner_exec)) ||
((!(cfdata->fi->statinfo.st_mode & S_IEXEC)) && (!cfdata->owner_exec)))
fperm = EINA_TRUE;
2007-01-10 08:38:20 -08:00
if (((cfdata->fi->statinfo.st_mode & S_IWOTH) && (cfdata->others_write)) ||
((!(cfdata->fi->statinfo.st_mode & S_IWOTH)) && (!cfdata->others_write)))
fperm = EINA_TRUE;
if (((cfdata->fi->statinfo.st_mode & S_IXOTH) && (cfdata->others_exec)) ||
((!(cfdata->fi->statinfo.st_mode & S_IXOTH)) && (!cfdata->others_exec)))
fperm = EINA_TRUE;
if (((cfdata->fi->statinfo.st_mode & S_IRGRP) && (cfdata->group_read)) ||
((!(cfdata->fi->statinfo.st_mode & S_IRGRP)) && (!cfdata->group_read)))
fperm = EINA_TRUE;
if (((cfdata->fi->statinfo.st_mode & S_IWGRP) && (cfdata->group_write)) ||
((!(cfdata->fi->statinfo.st_mode & S_IWGRP)) && (!cfdata->group_write)))
fperm = EINA_TRUE;
if (((cfdata->fi->statinfo.st_mode & S_IXGRP) && (cfdata->group_exec)) ||
((!(cfdata->fi->statinfo.st_mode & S_IXGRP)) && (!cfdata->group_exec)))
fperm = EINA_TRUE;
if (fperm == EINA_TRUE)
{
2012-07-17 03:32:01 -07:00
mode_t pmode;
pmode = cfdata->fi->statinfo.st_mode;
if (cfdata->owner_read) cfdata->fi->statinfo.st_mode |= S_IRUSR;
else cfdata->fi->statinfo.st_mode &= ~S_IRUSR;
if (cfdata->owner_write) cfdata->fi->statinfo.st_mode |= S_IWUSR;
else cfdata->fi->statinfo.st_mode &= ~S_IWUSR;
if (cfdata->owner_exec) cfdata->fi->statinfo.st_mode |= S_IEXEC;
else cfdata->fi->statinfo.st_mode &= ~S_IEXEC;
2012-07-17 03:32:01 -07:00
if (cfdata->others_read) cfdata->fi->statinfo.st_mode |= S_IROTH;
else cfdata->fi->statinfo.st_mode &= ~S_IROTH;
if (cfdata->others_write) cfdata->fi->statinfo.st_mode |= S_IWOTH;
else cfdata->fi->statinfo.st_mode &= ~S_IWOTH;
if (cfdata->others_exec) cfdata->fi->statinfo.st_mode |= S_IXOTH;
else cfdata->fi->statinfo.st_mode &= ~S_IXOTH;
if (cfdata->group_read) cfdata->fi->statinfo.st_mode |= S_IRGRP;
else cfdata->fi->statinfo.st_mode &= ~S_IRGRP;
if (cfdata->group_write) cfdata->fi->statinfo.st_mode |= S_IWGRP;
else cfdata->fi->statinfo.st_mode &= ~S_IWGRP;
if (cfdata->group_exec) cfdata->fi->statinfo.st_mode |= S_IXGRP;
else cfdata->fi->statinfo.st_mode &= ~S_IXGRP;
2012-07-17 03:32:01 -07:00
if (chmod(buf, cfdata->fi->statinfo.st_mode) == -1)
{
e_util_dialog_show(_("Error"),
_("Cannot change permissions: %s"),
strerror(errno));
2012-07-17 03:32:01 -07:00
cfdata->fi->statinfo.st_mode = pmode;
}
}
if ((cfdata->link) && ((cfdata->fi->real_link) || (cfdata->fi->broken_link)))
{
2012-07-17 03:32:01 -07:00
if ((cfdata->link[0]) && (strcmp(cfdata->plink, cfdata->link)))
{
ecore_file_unlink(buf);
ecore_file_symlink(cfdata->link, buf);
free(cfdata->plink);
cfdata->plink = strdup(cfdata->link);
}
}
if ((cfdata->picon_type != cfdata->icon_type) ||
(cfdata->picon_mime != cfdata->icon_mime) ||
(cfdata->picon_changed))
{
2012-07-17 03:32:01 -07:00
if ((cfdata->icon_mime) && (cfdata->mime)) /* modify mimetype */
{
Eina_List *l;
E_Config_Mime_Icon *mi = NULL;
Eina_Bool found = EINA_FALSE;
2012-07-17 03:32:01 -07:00
if (!cfdata->picon_mime) /* remove previous custom icon info */
e_fm2_custom_file_del(buf);
EINA_LIST_FOREACH(e_config->mime_icons, l, mi)
{
if (!mi) continue;
if (strcmp(mi->mime, cfdata->mime)) continue;
if (mi->icon)
{
eina_stringshare_del(mi->icon);
mi->icon = NULL;
}
found = EINA_TRUE;
2012-07-17 03:32:01 -07:00
break;
}
if ((found == EINA_FALSE) && (cfdata->icon_type != 0))
2012-07-17 03:32:01 -07:00
{
mi = E_NEW(E_Config_Mime_Icon, 1);
mi->mime = eina_stringshare_add(cfdata->mime);
e_config->mime_icons = eina_list_append(e_config->mime_icons, mi);
}
/* FIXME: modify mime info */
if (cfdata->icon_type == 0)
{
if (found == EINA_TRUE)
2012-07-17 03:32:01 -07:00
{
e_config->mime_icons = eina_list_remove(e_config->mime_icons, mi);
if (mi->mime) eina_stringshare_del(mi->mime);
if (mi->icon) eina_stringshare_del(mi->icon);
free(mi);
}
}
else if (cfdata->icon_type == 1)
{
mi->icon = eina_stringshare_add("THUMB");
}
else if (cfdata->icon_type == 2)
{
mi->icon = eina_stringshare_add(cfdata->icon);
}
e_config_save_queue();
e_fm_mime_icon_cache_flush();
}
else /* custom for this file */
{
E_Fm2_Custom_File *cf, cf0;
cf = e_fm2_custom_file_get(buf);
if (cf)
{
cf->icon.type = cfdata->icon_type;
if (cf->icon.icon)
eina_stringshare_del(cf->icon.icon);
cf->icon.icon = NULL;
if (cfdata->icon_type == 2)
cf->icon.icon = eina_stringshare_add(cfdata->icon);
if (cfdata->icon_type == 0)
cf->icon.valid = 0;
else
cf->icon.valid = 1;
}
else
{
memset(&cf0, 0, sizeof(E_Fm2_Custom_File));
cf = &cf0;
cf->icon.type = cfdata->icon_type;
if (cfdata->icon_type == 2)
cf->icon.icon = cfdata->icon;
if (cfdata->icon_type == 0)
cf->icon.valid = 0;
else
cf->icon.valid = 1;
}
e_fm2_custom_file_set(buf, cf);
e_fm2_custom_file_flush();
}
cfdata->picon_type = cfdata->icon_type;
cfdata->picon_mime = cfdata->icon_mime;
e_fm2_all_icons_update();
}
2012-06-20 23:19:43 -07:00
return 1; /* Apply was OK */
}
#if 0
static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
return 1; /* Apply was OK */
}
2012-07-17 03:32:01 -07:00
#endif
/**--GUI--**/
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
/* generate the core widget layout for a basic dialog */
Evas_Object *o, *ot, *ob, *of, *oi;
E_Radio_Group *rg;
char buf[PATH_MAX];
const char *itype = NULL;
2012-06-20 23:19:43 -07:00
snprintf(buf, sizeof(buf), "%s/%s",
cfdata->location, cfdata->fi->file);
o = e_widget_table_add(evas, 0);
ot = e_widget_table_add(evas, 0);
2012-06-20 23:19:43 -07:00
ob = e_widget_label_add(evas, _("Name:"));
e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->file), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 1, 0, 1, 0);
2012-06-20 23:19:43 -07:00
ob = e_widget_label_add(evas, _("Location:"));
e_widget_table_object_append(ot, ob, 0, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->location), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Size:"));
e_widget_table_object_append(ot, ob, 0, 2, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->size), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 2, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Occupied blocks on disk:"));
e_widget_table_object_append(ot, ob, 0, 3, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->blocks), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 3, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Last Accessed:"));
e_widget_table_object_append(ot, ob, 0, 4, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->acc_date), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 4, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Last Modified:"));
e_widget_table_object_append(ot, ob, 0, 5, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->mod_date), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 5, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Last Modified Permissions:"));
e_widget_table_object_append(ot, ob, 0, 6, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->pms_date), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 6, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("File Type:"));
e_widget_table_object_append(ot, ob, 0, 7, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(evas, &(cfdata->mime), NULL, NULL, NULL);
e_widget_size_min_set(ob, 140, -1);
e_widget_entry_readonly_set(ob, 1);
e_widget_table_object_append(ot, ob, 1, 7, 1, 1, 1, 0, 1, 0);
of = e_widget_frametable_add(evas, _("Permissions"), 0);
ob = e_widget_entry_add(evas, &(cfdata->owner), NULL, NULL, NULL);
e_widget_entry_readonly_set(ob, 1);
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("read"), &(cfdata->owner_read));
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("write"), &(cfdata->owner_write));
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("execute"), &(cfdata->owner_exec));
e_widget_frametable_object_append(of, ob, 0, 3, 1, 1, 1, 1, 1, 1);
ob = e_widget_label_add(evas, _("Group:"));
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("read"), &(cfdata->group_read));
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("write"), &(cfdata->group_write));
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("execute"), &(cfdata->group_exec));
e_widget_frametable_object_append(of, ob, 1, 3, 1, 1, 1, 1, 1, 1);
ob = e_widget_label_add(evas, _("Others:"));
e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("read"), &(cfdata->others_read));
e_widget_frametable_object_append(of, ob, 2, 1, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("write"), &(cfdata->others_write));
e_widget_frametable_object_append(of, ob, 2, 2, 1, 1, 1, 1, 1, 1);
ob = e_widget_check_add(evas, _("execute"), &(cfdata->others_exec));
e_widget_frametable_object_append(of, ob, 2, 3, 1, 1, 1, 1, 1, 1);
e_widget_table_object_append(ot, of, 0, 8, 2, 1, 1, 0, 1, 0);
2012-06-20 23:19:43 -07:00
e_widget_table_object_append(o, ot, 0, 0, 1, 1, 1, 1, 1, 1);
2012-06-20 23:19:43 -07:00
of = e_widget_frametable_add(evas, _("Preview"), 0);
2012-06-20 23:19:43 -07:00
ot = e_widget_table_add(evas, 0);
ob = e_widget_preview_add(evas, 128, 128);
cfdata->gui.preview = ob;
cfdata->gui.preview_table = ot;
evas_object_smart_callback_add(ob, "preview_update",
2012-07-17 03:32:01 -07:00
_cb_preview_update, cfdata);
e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 0, 0, 1, 1);
e_widget_preview_thumb_set(ob, buf,
2012-07-17 03:32:01 -07:00
"e/desktop/background", 128, 128);
e_widget_frametable_object_append(of, ot, 0, 0, 1, 1, 1, 1, 1, 1);
2012-06-20 23:19:43 -07:00
e_widget_table_object_append(o, of, 1, 0, 1, 1, 1, 1, 1, 1);
2012-06-20 23:19:43 -07:00
ot = e_widget_frametable_add(evas, _("Icon"), 0);
2012-06-20 23:19:43 -07:00
ob = e_widget_button_add(evas, "", NULL, _cb_icon_sel, cfdata, cfd);
cfdata->gui.icon_wid = ob;
oi = e_fm2_icon_get(evas,
2012-07-17 03:32:01 -07:00
cfdata->ic,
NULL, NULL, 0, &itype);
e_widget_button_icon_set(ob, oi);
e_widget_frametable_object_append(ot, ob, 0, 0, 1, 3, 1, 1, 1, 1);
if (itype)
{
2012-07-17 03:32:01 -07:00
if ((!strcmp(itype, "THEME_ICON")) ||
(!strcmp(itype, "DESKTOP")) ||
(!strcmp(itype, "FILE_TYPE")))
{
e_widget_disabled_set(ob, 1);
cfdata->icon_type = 0;
}
else if (!strcmp(itype, "THUMB"))
{
cfdata->icon_type = 1;
e_widget_disabled_set(ob, 1);
}
else if (!strcmp(itype, "CUSTOM"))
cfdata->icon_type = 2;
}
else
cfdata->icon_type = 0;
cfdata->picon_type = cfdata->icon_type;
2012-06-20 23:19:43 -07:00
rg = e_widget_radio_group_new(&cfdata->icon_type);
ob = e_widget_radio_add(evas, _("Default"), 0, rg);
evas_object_smart_callback_add(ob, "changed", _cb_type, cfdata);
e_widget_frametable_object_append(ot, ob, 1, 0, 1, 1, 1, 1, 1, 1);
ob = e_widget_radio_add(evas, _("Thumbnail"), 1, rg);
evas_object_smart_callback_add(ob, "changed", _cb_type, cfdata);
e_widget_frametable_object_append(ot, ob, 1, 1, 1, 1, 1, 1, 1, 1);
ob = e_widget_radio_add(evas, _("Custom"), 2, rg);
evas_object_smart_callback_add(ob, "changed", _cb_type, cfdata);
e_widget_frametable_object_append(ot, ob, 1, 2, 1, 1, 1, 1, 1, 1);
cfdata->icon_mime = 1;
if ((cfdata->fi->icon) || ((itype) && (!strcmp(itype, "DESKTOP"))))
cfdata->icon_mime = 0;
cfdata->picon_mime = cfdata->icon_mime;
if (cfdata->mime)
{
2012-07-17 03:32:01 -07:00
ob = e_widget_check_add(evas, _("Use this icon for all files of this type"), &(cfdata->icon_mime));
e_widget_frametable_object_append(ot, ob, 0, 3, 2, 1, 1, 1, 1, 1);
}
2012-06-20 23:19:43 -07:00
e_widget_table_object_append(o, ot, 0, 1, 1, 1, 1, 1, 1, 1);
if ((cfdata->link) && ((cfdata->fi->real_link) || (cfdata->fi->broken_link)))
{
2012-07-17 03:32:01 -07:00
ot = e_widget_frametable_add(evas, _("Link Information"), 0);
2012-06-20 23:19:43 -07:00
2012-07-17 03:32:01 -07:00
ob = e_widget_entry_add(evas, &(cfdata->link), NULL, NULL, NULL);
e_widget_frametable_object_append(ot, ob, 0, 0, 1, 1, 1, 0, 1, 0);
2012-06-20 23:19:43 -07:00
if (cfdata->fi->broken_link)
{
ob = e_widget_label_add(evas, _("This link is broken."));
e_widget_frametable_object_append(ot, ob, 0, 1, 1, 1, 1, 0, 1, 0);
}
e_widget_table_object_append(o, ot, 1, 1, 2, 1, 1, 1, 1, 1);
}
return o;
}
#if 0
static Evas_Object *
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
/* generate the core widget layout for an advanced dialog */
Evas_Object *o;
2012-06-20 23:19:43 -07:00
o = e_widget_table_add(evas, 0);
return o;
}
2012-07-17 03:32:01 -07:00
#endif
static void
_dia_del(void *data)
{
E_Dialog *dia = data;
E_Config_Dialog_Data *cfdata;
cfdata = dia->data;
if (!cfdata) return;
cfdata->gui.fsel = NULL;
cfdata->gui.fsel_wid = NULL;
}
static void
_cb_icon_sel(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
E_Config_Dialog *cfd;
E_Dialog *dia;
Evas_Object *o;
Evas_Coord w, h;
cfdata = data;
if (!cfdata) return;
if (cfdata->gui.fsel) return;
cfd = data2;
if (!cfd) return;
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
dia = e_dialog_new(cfd->comp, "E", "_fm2_file_properties_icon_select_dialog");
if (!dia) return;
// if (cfdata->type == EDJ)
// e_dialog_title_set(dia, _("Select an Edj File"));
// else if (cfdata->type == IMG)
2012-07-17 03:32:01 -07:00
e_dialog_title_set(dia, _("Select an Image"));
2012-06-20 23:19:43 -07:00
dia->data = cfdata;
o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
2012-07-17 03:32:01 -07:00
_cb_fsel_sel, cfdata, NULL, cfdata, 1);
2012-06-20 23:19:43 -07:00
cfdata->gui.fsel_wid = o;
evas_object_show(o);
e_widget_size_min_get(o, &w, &h);
e_dialog_content_set(dia, o, w, h);
2012-06-20 23:19:43 -07:00
e_dialog_button_add(dia, _("OK"), NULL, _cb_fsel_ok, cfdata);
e_dialog_button_add(dia, _("Cancel"), NULL, _cb_fsel_cancel, cfdata);
e_util_win_auto_resize_fill(dia->win);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
e_object_del_attach_func_set(E_OBJECT(dia), _dia_del);
cfdata->gui.fsel = dia;
}
static void
2010-08-18 14:25:29 -07:00
_cb_type(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
E_Config_Dialog_Data *cfdata;
2012-06-20 23:19:43 -07:00
cfdata = data;
if (cfdata->icon_type == 2)
e_widget_disabled_set(cfdata->gui.icon_wid, 0);
else
e_widget_disabled_set(cfdata->gui.icon_wid, 1);
}
static void
2010-08-18 14:25:29 -07:00
_cb_preview_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
E_Config_Dialog_Data *cfdata;
2012-06-20 23:19:43 -07:00
cfdata = data;
e_widget_table_object_repack(cfdata->gui.preview_table,
2012-07-17 03:32:01 -07:00
cfdata->gui.preview,
0, 0, 1, 1, 0, 0, 1, 1);
}
static void
2010-08-18 14:25:29 -07:00
_cb_fsel_sel(void *data, Evas_Object *obj __UNUSED__)
{
E_Config_Dialog_Data *cfdata;
2010-08-18 14:25:29 -07:00
cfdata = data;
if (!cfdata) return;
}
static void
_cb_fsel_ok(void *data, E_Dialog *dia)
{
E_Config_Dialog_Data *cfdata;
const char *file, *ext;
Evas_Object *icon = NULL;
2012-06-20 23:19:43 -07:00
cfdata = data;
if (!cfdata) return;
2012-06-20 23:19:43 -07:00
file = e_widget_fsel_selection_path_get(cfdata->gui.fsel_wid);
E_FREE(cfdata->icon);
if (file) cfdata->icon = strdup(file);
_cb_fsel_cancel(data, dia);
ext = strrchr(cfdata->icon, '.');
if (ext)
{
2012-07-17 03:32:01 -07:00
if (!strcasecmp(ext, ".edj"))
{
icon = edje_object_add(evas_object_evas_get(cfdata->gui.icon_wid));
edje_object_file_set(icon, cfdata->file, "icon");
}
else
{
icon = e_widget_image_add_from_file(evas_object_evas_get(cfdata->gui.icon_wid), cfdata->icon, 48, 48);
}
}
else
{
2012-07-17 03:32:01 -07:00
icon = e_widget_image_add_from_file(evas_object_evas_get(cfdata->gui.icon_wid), cfdata->icon, 48, 48);
}
if (icon) e_widget_button_icon_set(cfdata->gui.icon_wid, icon);
}
static void
_cb_fsel_cancel(void *data, E_Dialog *dia)
{
E_Config_Dialog_Data *cfdata;
2012-06-20 23:19:43 -07:00
cfdata = data;
e_object_del(E_OBJECT(dia));
cfdata->gui.fsel = NULL;
}
2012-07-17 03:32:01 -07:00