2011-02-24 14:26:47 -08:00
|
|
|
#include <Elementary.h>
|
2015-01-29 13:06:33 -08:00
|
|
|
#include "config.h"
|
2011-02-24 14:26:47 -08:00
|
|
|
#include "ephoto.h"
|
|
|
|
|
2011-02-01 13:44:38 -08:00
|
|
|
static void _ephoto_display_usage(void);
|
2010-09-13 15:24:59 -07:00
|
|
|
|
2011-02-24 14:26:47 -08:00
|
|
|
/* Global log domain pointer */
|
|
|
|
int __log_domain = -1;
|
|
|
|
|
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
|
|
|
int r = 0;
|
2010-10-08 12:03:21 -07:00
|
|
|
|
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
|
|
|
|
2015-01-29 13:06:33 -08:00
|
|
|
#if HAVE_GETTEXT && ENABLE_NLS
|
|
|
|
elm_app_compile_locale_set(LOCALEDIR);
|
|
|
|
bindtextdomain(PACKAGE, elm_app_locale_dir_get());
|
|
|
|
textdomain(PACKAGE);
|
2015-02-20 08:07:50 -08:00
|
|
|
#endif
|
2015-01-29 13:06:33 -08:00
|
|
|
|
2012-08-22 13:01:30 -07:00
|
|
|
__log_domain = eina_log_domain_register("ephoto", EINA_COLOR_ORANGE);
|
|
|
|
if (!__log_domain)
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Could not register log domain: Ephoto");
|
|
|
|
r = 1;
|
|
|
|
goto end_log_domain;
|
|
|
|
}
|
|
|
|
|
2011-02-24 14:26:47 -08:00
|
|
|
if (!efreet_mime_init())
|
2012-08-22 13:01:30 -07:00
|
|
|
ERR("Could not init efreet_mime!");
|
2010-10-09 12:13:35 -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-24 14:26:47 -08:00
|
|
|
DBG("Logging initialized");
|
2010-10-08 12:04:34 -07:00
|
|
|
if (argc > 2)
|
|
|
|
{
|
2011-02-24 14:26:47 -08:00
|
|
|
printf("Too Many Arguments!\n");
|
2010-10-08 12:04:34 -07:00
|
|
|
_ephoto_display_usage();
|
|
|
|
r = 1;
|
|
|
|
goto end;
|
|
|
|
}
|
2011-02-24 14:26:47 -08:00
|
|
|
else if (argc < 2)
|
2010-10-08 12:04:34 -07:00
|
|
|
{
|
2011-02-24 14:26:47 -08:00
|
|
|
Evas_Object *win = ephoto_window_add(NULL);
|
|
|
|
if (!win)
|
2010-10-09 18:13:53 -07:00
|
|
|
{
|
2011-02-24 14:26:47 -08:00
|
|
|
r = 1;
|
2010-10-09 18:13:53 -07:00
|
|
|
goto end;
|
|
|
|
}
|
2011-02-24 14:26:47 -08:00
|
|
|
}
|
|
|
|
else if (!strncmp(argv[1], "--help", 6))
|
|
|
|
{
|
|
|
|
_ephoto_display_usage();
|
|
|
|
r = 0;
|
|
|
|
goto end;
|
2010-10-08 12:04:34 -07:00
|
|
|
}
|
2011-02-21 17:55:08 -08:00
|
|
|
else
|
2010-10-08 12:04:34 -07:00
|
|
|
{
|
2011-02-24 14:26:47 -08:00
|
|
|
char *real = ecore_file_realpath(argv[1]);
|
|
|
|
if (!real)
|
|
|
|
{
|
|
|
|
printf("invalid file or directory: '%s'\n", argv[1]);
|
|
|
|
r = 1;
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
Evas_Object *win = ephoto_window_add(real);
|
|
|
|
free(real);
|
|
|
|
if (!win)
|
2011-02-21 17:55:08 -08:00
|
|
|
{
|
|
|
|
r = 1;
|
|
|
|
goto end;
|
|
|
|
}
|
2010-10-08 12:04:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
elm_run();
|
2010-07-01 11:49:22 -07:00
|
|
|
|
2010-10-08 12:03:21 -07:00
|
|
|
end:
|
2011-02-24 14:26:47 -08:00
|
|
|
eina_log_domain_unregister(__log_domain);
|
|
|
|
efreet_mime_shutdown();
|
2012-08-22 13:01:30 -07:00
|
|
|
end_log_domain:
|
2010-10-08 12:04:34 -07:00
|
|
|
elm_shutdown();
|
2010-10-12 23:15:16 -07:00
|
|
|
eio_shutdown();
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2010-10-08 12:04:34 -07:00
|
|
|
return r;
|
2010-07-01 11:49:22 -07:00
|
|
|
}
|
|
|
|
|
2011-02-24 14:26:47 -08:00
|
|
|
/*Display useage commands for ephoto*/
|
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-24 14:26:47 -08:00
|
|
|
"ephoto --help : This page\n"
|
|
|
|
"ephoto filename : Specifies a file to open\n"
|
|
|
|
"ephoto dirname : Specifies a directory to open\n");
|
2010-07-10 14:52:14 -07:00
|
|
|
}
|
|
|
|
|
2010-10-11 21:58:04 -07:00
|
|
|
ELM_MAIN()
|