2010-07-01 11:49:22 -07:00
|
|
|
#include "ephoto.h"
|
|
|
|
|
2011-02-01 13:44:38 -08:00
|
|
|
#ifndef ELM_LIB_QUICKLAUNCH
|
2010-07-10 14:52:14 -07:00
|
|
|
|
2011-02-01 13:44:38 -08:00
|
|
|
static void _ephoto_display_usage(void);
|
|
|
|
Ephoto *ephoto;
|
2010-09-13 15:24:59 -07:00
|
|
|
|
2010-10-11 21:58:04 -07:00
|
|
|
EAPI int
|
|
|
|
elm_main(int argc, char **argv)
|
2010-07-01 11:49:22 -07:00
|
|
|
{
|
2010-10-08 12:04:34 -07:00
|
|
|
Ethumb_Client *client;
|
|
|
|
int r = 0;
|
2010-10-08 12:03:21 -07:00
|
|
|
|
2010-10-11 21:58:04 -07:00
|
|
|
#if ENABLE_NLS
|
|
|
|
setlocale(LC_ALL, "");
|
|
|
|
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
|
|
|
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
textdomain(GETTEXT_PACKAGE);
|
|
|
|
#endif
|
|
|
|
|
2010-10-12 23:15:16 -07:00
|
|
|
eio_init();
|
2010-10-08 12:04:34 -07:00
|
|
|
elm_need_efreet();
|
|
|
|
elm_need_ethumb();
|
|
|
|
elm_init(argc, argv);
|
2010-10-08 12:03:21 -07:00
|
|
|
|
2011-02-01 13:44:38 -08:00
|
|
|
elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/themes/default/ephoto.edj");
|
2010-10-09 12:13:35 -07:00
|
|
|
|
2010-10-08 12:04:34 -07:00
|
|
|
if (!efreet_mime_init())
|
2011-02-01 13:44:38 -08:00
|
|
|
printf("Ephoto could not init efreet_mime!\n");
|
2010-09-13 15:24:59 -07:00
|
|
|
|
2010-10-08 12:04:34 -07:00
|
|
|
client = elm_thumb_ethumb_client_get();
|
|
|
|
if (!client)
|
|
|
|
{
|
2011-02-01 13:44:38 -08:00
|
|
|
printf("Ephoto could not get ethumb_client; Terminating...\n");
|
2010-10-08 12:04:34 -07:00
|
|
|
r = 1;
|
2011-02-01 13:44:38 -08:00
|
|
|
goto end;
|
2010-10-08 12:04:34 -07:00
|
|
|
}
|
|
|
|
ethumb_client_crop_align_set(client, 0.5, 0.5);
|
2010-10-08 16:03:22 -07:00
|
|
|
ethumb_client_aspect_set(client, ETHUMB_THUMB_CROP);
|
2010-10-08 12:04:34 -07:00
|
|
|
ethumb_client_orientation_set(client, ETHUMB_THUMB_ORIENT_ORIGINAL);
|
2010-09-13 15:24:59 -07:00
|
|
|
|
2010-10-09 18:13:53 -07:00
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
2010-10-08 12:03:21 -07:00
|
|
|
|
2011-02-01 13:44:38 -08:00
|
|
|
ephoto = calloc(1, sizeof(Ephoto));
|
|
|
|
ephoto->client = client;
|
|
|
|
|
2010-10-08 12:04:34 -07:00
|
|
|
if (argc > 2)
|
|
|
|
{
|
2011-02-01 13:44:38 -08:00
|
|
|
printf("Too many arguments; Terminating...\n");
|
2010-10-08 12:04:34 -07:00
|
|
|
_ephoto_display_usage();
|
|
|
|
r = 1;
|
|
|
|
goto end;
|
|
|
|
}
|
2011-02-01 13:44:38 -08:00
|
|
|
if (argc == 2)
|
2010-10-08 12:04:34 -07:00
|
|
|
{
|
2011-02-01 13:44:38 -08:00
|
|
|
if (!strncmp(argv[1], "--help", 6) || !strncmp(argv[1], "-h", 2))
|
2010-10-09 18:13:53 -07:00
|
|
|
{
|
2011-02-01 13:44:38 -08:00
|
|
|
_ephoto_display_usage();
|
|
|
|
r = 0;
|
2010-10-09 18:13:53 -07:00
|
|
|
goto end;
|
|
|
|
}
|
2011-02-01 13:44:38 -08:00
|
|
|
else if (argc == 2)
|
|
|
|
{
|
|
|
|
char *real = ecore_file_realpath(argv[1]);
|
|
|
|
if (!real)
|
|
|
|
{
|
|
|
|
printf("Invalid file or directory: '%s'; Terminating...\n", argv[1]);
|
|
|
|
r = 1;
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
if (ecore_file_is_dir(real))
|
|
|
|
ephoto->directory = eina_stringshare_add(real);
|
|
|
|
else if (ecore_file_exists(real))
|
|
|
|
ephoto->file = eina_stringshare_add(real);
|
|
|
|
free(real);
|
|
|
|
}
|
2010-10-08 12:04:34 -07:00
|
|
|
}
|
2011-02-01 13:44:38 -08:00
|
|
|
|
|
|
|
if (!ephoto_window_add())
|
2010-10-08 12:04:34 -07:00
|
|
|
{
|
2011-02-01 13:44:38 -08:00
|
|
|
printf("Could not create the main window; Terminating...\n");
|
|
|
|
r = 1;
|
2010-10-08 12:04:34 -07:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_run();
|
2010-07-01 11:49:22 -07:00
|
|
|
|
2010-10-08 12:03:21 -07:00
|
|
|
end:
|
2011-02-01 13:44:38 -08:00
|
|
|
if (ephoto)
|
|
|
|
free(ephoto);
|
2010-10-08 12:04:34 -07:00
|
|
|
efreet_mime_shutdown();
|
|
|
|
elm_shutdown();
|
2010-10-12 23:15:16 -07:00
|
|
|
eio_shutdown();
|
2011-02-01 13:44:38 -08:00
|
|
|
|
2010-10-08 12:04:34 -07:00
|
|
|
return r;
|
2010-07-01 11:49:22 -07:00
|
|
|
}
|
|
|
|
|
2010-07-10 14:52:14 -07:00
|
|
|
static void
|
|
|
|
_ephoto_display_usage(void)
|
|
|
|
{
|
2010-10-15 11:12:29 -07:00
|
|
|
printf("Ephoto Usage: \n"
|
2011-02-01 13:44:38 -08:00
|
|
|
"ephoto --help | -h : This page\n"
|
|
|
|
"ephoto filename : Specifies a file to open\n"
|
|
|
|
"ephoto directory : Specifies a directory to open\n");
|
2010-07-10 14:52:14 -07:00
|
|
|
}
|
|
|
|
|
2010-10-11 21:58:04 -07:00
|
|
|
#endif
|
|
|
|
ELM_MAIN()
|