forked from enlightenment/enlightenment
shot always save shots to your users new shots dir and show dir on save
when you select save from shot now it always saves to your user shots dir (~/.e/e/shots) and then opens up this fir for you to browse/see/dnd out of etc. etc. for easier quick and fast access to what you just saved. also you keep a history of your shots (you do get to clean it up yourself when you save... no auto-cleaning - i decided not to bother as realistically it's just more config to swizzle and mystery deletion of files that some user has to figure out how and why it happens and where to go change the config - just delete the ones you don't want anymore - simple and easy.)
This commit is contained in:
parent
5ad9734c9a
commit
f32ac2d1a9
2
TODO
2
TODO
|
@ -151,8 +151,6 @@ TODO:
|
||||||
* provide fuller status per line (reception and other info?)
|
* provide fuller status per line (reception and other info?)
|
||||||
* massively flesh out connman vpn support in the gui
|
* massively flesh out connman vpn support in the gui
|
||||||
* vpnmanager + create method support
|
* vpnmanager + create method support
|
||||||
* shot: create special save dir for shots (~/.e/...) and keep last N
|
|
||||||
* shot: use efm and offer save dir to dnd from
|
|
||||||
* bz5: add icon set for actions/states per bt device (pair.unpair, etc.)
|
* bz5: add icon set for actions/states per bt device (pair.unpair, etc.)
|
||||||
* bz5: add obex agent support integrated with efm for sharing via bt
|
* bz5: add obex agent support integrated with efm for sharing via bt
|
||||||
and downloads when received via obex bt (~/Downloads/...)
|
and downloads when received via obex bt (~/Downloads/...)
|
||||||
|
|
|
@ -15,5 +15,6 @@ out = join_paths(_dir, edc + '.edj')
|
||||||
install_data(['BD_Cartoon_Shout.ttf',
|
install_data(['BD_Cartoon_Shout.ttf',
|
||||||
'ComiquitaSans.ttf',
|
'ComiquitaSans.ttf',
|
||||||
'FuturaHandwritten.ttf',
|
'FuturaHandwritten.ttf',
|
||||||
'Suplexmentary_Comic_NC.ttf'],
|
'Suplexmentary_Comic_NC.ttf',
|
||||||
|
'shots.desktop'],
|
||||||
install_dir: _dir)
|
install_dir: _dir)
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Screenshots
|
||||||
|
Comment=My saved screenshots
|
||||||
|
Type=Link
|
||||||
|
X-Enlightenment-Type=Mount
|
||||||
|
URL=file:$E_HOME_DIR/shots
|
||||||
|
Icon=user-bookmarks
|
||||||
|
NotShowIn=GNOME;KDE;LXDE;ROX;XFCE;
|
|
@ -86,7 +86,7 @@ static void
|
||||||
_shot_now(E_Zone *zone, E_Client *ec, const char *params)
|
_shot_now(E_Zone *zone, E_Client *ec, const char *params)
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
if (preview_have() || save_have() || share_have() || (snap)) return;
|
if (preview_have() || share_have() || (snap)) return;
|
||||||
if ((!zone) && (!ec)) return;
|
if ((!zone) && (!ec)) return;
|
||||||
if (zone)
|
if (zone)
|
||||||
{
|
{
|
||||||
|
@ -377,7 +377,6 @@ E_API int
|
||||||
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
||||||
{
|
{
|
||||||
share_abort();
|
share_abort();
|
||||||
save_abort();
|
|
||||||
preview_abort();
|
preview_abort();
|
||||||
delay_abort();
|
delay_abort();
|
||||||
if (delfn_client)
|
if (delfn_client)
|
||||||
|
|
|
@ -23,9 +23,7 @@ Eina_Bool preview_have (void);
|
||||||
void preview_abort (void);
|
void preview_abort (void);
|
||||||
Evas_Object *preview_image_get (void);
|
Evas_Object *preview_image_get (void);
|
||||||
void save_to (const char *file);
|
void save_to (const char *file);
|
||||||
void save_dialog_show (void);
|
void save_show (void);
|
||||||
Eina_Bool save_have (void);
|
|
||||||
void save_abort (void);
|
|
||||||
|
|
||||||
Evas_Object *ui_edit(Evas_Object *window, Evas_Object *o_bg, E_Zone *zone,
|
Evas_Object *ui_edit(Evas_Object *window, Evas_Object *o_bg, E_Zone *zone,
|
||||||
E_Client *ec, void *dst, int sx, int sy, int sw, int sh,
|
E_Client *ec, void *dst, int sx, int sy, int sw, int sh,
|
||||||
|
|
|
@ -9,7 +9,7 @@ Eina_Rectangle crop = { 0, 0, 0, 0 };
|
||||||
static void
|
static void
|
||||||
_win_save_cb(void *data EINA_UNUSED, void *data2 EINA_UNUSED)
|
_win_save_cb(void *data EINA_UNUSED, void *data2 EINA_UNUSED)
|
||||||
{
|
{
|
||||||
save_dialog_show();
|
save_show();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
static Evas_Object *o_fsel = NULL;
|
|
||||||
static E_Dialog *fsel_dia = NULL;
|
|
||||||
|
|
||||||
static void _file_select_ok_cb(void *data EINA_UNUSED, E_Dialog *dia);
|
|
||||||
static void _file_select_cancel_cb(void *data EINA_UNUSED, E_Dialog *dia);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *path, *outfile;
|
char *path, *outfile;
|
||||||
|
@ -174,91 +168,44 @@ save_to(const char *file)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_file_select_ok_cb(void *data EINA_UNUSED, E_Dialog *dia)
|
|
||||||
{
|
|
||||||
const char *file;
|
|
||||||
|
|
||||||
dia = fsel_dia;
|
|
||||||
file = e_widget_fsel_selection_path_get(o_fsel);
|
|
||||||
if ((!file) || (!file[0]) ||
|
|
||||||
((!eina_str_has_extension(file, ".jpg")) &&
|
|
||||||
(!eina_str_has_extension(file, ".png"))))
|
|
||||||
{
|
|
||||||
e_util_dialog_show
|
|
||||||
(_("Error - Unknown format"),
|
|
||||||
_("File has an unspecified extension.<ps/>"
|
|
||||||
"Please use '.jpg' or '.png' extensions<ps/>"
|
|
||||||
"only as other formats are not<ps/>"
|
|
||||||
"supported currently."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
save_to(file);
|
|
||||||
if (dia) e_util_defer_object_del(E_OBJECT(dia));
|
|
||||||
preview_abort();
|
|
||||||
fsel_dia = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_file_select_cancel_cb(void *data EINA_UNUSED, E_Dialog *dia)
|
|
||||||
{
|
|
||||||
if (dia) e_util_defer_object_del(E_OBJECT(dia));
|
|
||||||
preview_abort();
|
|
||||||
fsel_dia = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_file_select_del_cb(void *d EINA_UNUSED)
|
|
||||||
{
|
|
||||||
preview_abort();
|
|
||||||
fsel_dia = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
save_dialog_show(void)
|
save_show(void)
|
||||||
{
|
{
|
||||||
E_Dialog *dia;
|
char path[PATH_MAX + 512];
|
||||||
Evas_Object *o;
|
char path2[PATH_MAX + 512];
|
||||||
Evas_Coord mw, mh;
|
char buf[256];
|
||||||
|
const char *dirs[] = { "shots", NULL };
|
||||||
time_t tt;
|
time_t tt;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
char buf[PATH_MAX];
|
E_Action *a;
|
||||||
|
|
||||||
|
ecore_file_mksubdirs(e_user_dir_get(), dirs);
|
||||||
time(&tt);
|
time(&tt);
|
||||||
tm = localtime(&tt);
|
tm = localtime(&tt);
|
||||||
if (quality == 100)
|
if (quality == 100)
|
||||||
strftime(buf, sizeof(buf), "shot-%Y-%m-%d_%H-%M-%S.png", tm);
|
strftime(buf, sizeof(buf), "shot-%Y-%m-%d_%H-%M-%S.png", tm);
|
||||||
else
|
else
|
||||||
strftime(buf, sizeof(buf), "shot-%Y-%m-%d_%H-%M-%S.jpg", tm);
|
strftime(buf, sizeof(buf), "shot-%Y-%m-%d_%H-%M-%S.jpg", tm);
|
||||||
fsel_dia = dia = e_dialog_new(NULL, "E", "_e_shot_fsel");
|
e_user_dir_snprintf(path, sizeof(path), "shots/%s", buf);
|
||||||
e_dialog_resizable_set(dia, EINA_TRUE);
|
save_to(path);
|
||||||
e_dialog_title_set(dia, _("Select screenshot save location"));
|
snprintf(path, sizeof(path), "%s/shots.desktop",
|
||||||
o = e_widget_fsel_add(evas_object_evas_get(dia->win), "desktop", "/",
|
e_module_dir_get(shot_module));
|
||||||
buf, NULL, NULL, NULL, NULL, NULL, 1);
|
snprintf(path2, sizeof(path2), "%s/fileman/favorites/shots.desktop",
|
||||||
e_object_del_attach_func_set(E_OBJECT(dia), _file_select_del_cb);
|
e_user_dir_get());
|
||||||
e_widget_fsel_window_set(o, dia->win);
|
if (!ecore_file_exists(path2))
|
||||||
o_fsel = o;
|
{
|
||||||
evas_object_show(o);
|
printf("CP [%s]->[%s]\n", path, path2);
|
||||||
e_widget_size_min_get(o, &mw, &mh);
|
ecore_file_cp(path, path2);
|
||||||
e_dialog_content_set(dia, o, mw, mh);
|
}
|
||||||
e_dialog_button_add(dia, _("Save"), NULL,
|
a = e_action_find("fileman");
|
||||||
_file_select_ok_cb, NULL);
|
if (a)
|
||||||
e_dialog_button_add(dia, _("Cancel"), NULL,
|
{
|
||||||
_file_select_cancel_cb, NULL);
|
a->func.go(NULL, "$E_HOME_DIR/shots");
|
||||||
elm_win_center(dia->win, 1, 1);
|
}
|
||||||
o = evas_object_rectangle_add(evas_object_evas_get(dia->win));
|
else
|
||||||
e_dialog_show(dia);
|
e_util_dialog_show
|
||||||
}
|
(_("Error - No Filemanager"),
|
||||||
|
_("No filemanager action and/or module was found.<br>"
|
||||||
Eina_Bool
|
"Cannot show the location of your screenshots."));
|
||||||
save_have(void)
|
preview_abort();
|
||||||
{
|
|
||||||
if (fsel_dia) return EINA_TRUE;
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
save_abort(void)
|
|
||||||
{
|
|
||||||
E_FREE_FUNC(fsel_dia, e_object_del);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue