Uncrustify eve
Exceptions: - auto-generated files by geneet (favorite.[ch] and history.[ch]) Config not used: - *_closebrace_comment in uncrustify config SVN revision: 51682
This commit is contained in:
parent
50f87c6bcb
commit
fce46e4793
798
src/bin/chrome.c
798
src/bin/chrome.c
File diff suppressed because it is too large
Load Diff
|
@ -19,7 +19,7 @@
|
|||
#ifndef _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
#define _(x) gettext(x)
|
||||
#define _(x) gettext(x)
|
||||
#define N_(x) gettext_noop(x)
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
|
@ -30,11 +30,11 @@
|
|||
textdomain(), and is useful for libraries. */
|
||||
# ifdef DEFAULT_TEXT_DOMAIN
|
||||
# undef gettext
|
||||
# define gettext(Msgid) \
|
||||
dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
|
||||
# define gettext(Msgid)\
|
||||
dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
|
||||
# define ngettext(Msgid1, Msgid2, N)\
|
||||
dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
@ -61,23 +61,23 @@
|
|||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
|
||||
# define dcgettext(Domainname, Msgid, Category) \
|
||||
((void) (Category), dgettext (Domainname, Msgid))
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 \
|
||||
? ((void) (Msgid2), (const char *) (Msgid1)) \
|
||||
: ((void) (Msgid1), (const char *) (Msgid2)))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) \
|
||||
((void) (Domainname), (const char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) \
|
||||
((void) (Domainname), (const char *) (Codeset))
|
||||
# define gettext(Msgid) ((const char *)(Msgid))
|
||||
# define dgettext(Domainname, Msgid) ((void)(Domainname), gettext (Msgid))
|
||||
# define dcgettext(Domainname, Msgid, Category)\
|
||||
((void)(Category), dgettext (Domainname, Msgid))
|
||||
# define ngettext(Msgid1, Msgid2, N)\
|
||||
((N) == 1\
|
||||
? ((void)(Msgid2), (const char *)(Msgid1))\
|
||||
: ((void)(Msgid1), (const char *)(Msgid2)))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N)\
|
||||
((void)(Domainname), ngettext (Msgid1, Msgid2, N))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category)\
|
||||
((void)(Category), dngettext(Domainname, Msgid1, Msgid2, N))
|
||||
# define textdomain(Domainname) ((const char *)(Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname)\
|
||||
((void)(Domainname), (const char *)(Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset)\
|
||||
((void)(Domainname), (const char *)(Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -98,27 +98,27 @@
|
|||
short and rarely need to change.
|
||||
The letter 'p' stands for 'particular' or 'special'. */
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
# define pgettext(Msgctxt, Msgid)\
|
||||
pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#else
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
# define pgettext(Msgctxt, Msgid)\
|
||||
pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#endif
|
||||
#define dpgettext(Domainname, Msgctxt, Msgid) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
|
||||
#define dpgettext(Domainname, Msgctxt, Msgid)\
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#define dcpgettext(Domainname, Msgctxt, Msgid, Category)\
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N)\
|
||||
npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#else
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N)\
|
||||
npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#endif
|
||||
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
|
||||
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N)\
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category)\
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
|
@ -129,14 +129,14 @@ inline
|
|||
#endif
|
||||
static const char *
|
||||
pgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
int category)
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
const char *translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
if (translation == msg_ctxt_id)
|
||||
return msgid;
|
||||
else
|
||||
return translation;
|
||||
const char *translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
if (translation == msg_ctxt_id)
|
||||
return msgid;
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -148,16 +148,16 @@ inline
|
|||
#endif
|
||||
static const char *
|
||||
npgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
const char *translation =
|
||||
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
if (translation == msg_ctxt_id || translation == msgid_plural)
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
else
|
||||
return translation;
|
||||
const char *translation =
|
||||
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
if (translation == msg_ctxt_id || translation == msgid_plural)
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
|
||||
|
@ -166,18 +166,18 @@ npgettext_aux (const char *domain,
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
|
||||
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
|
||||
/* || __STDC_VERSION__ >= 199901L */ )
|
||||
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS\
|
||||
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__)\
|
||||
/* || __STDC_VERSION__ >= 199901L */)
|
||||
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define pgettext_expr(Msgctxt, Msgid) \
|
||||
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
|
||||
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
|
||||
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
|
||||
#define pgettext_expr(Msgctxt, Msgid)\
|
||||
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
|
||||
#define dpgettext_expr(Domainname, Msgctxt, Msgid)\
|
||||
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
|
@ -188,41 +188,43 @@ inline
|
|||
#endif
|
||||
static const char *
|
||||
dcpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
int category)
|
||||
const char *msgctxt, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id)
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *)malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id)
|
||||
#endif
|
||||
{
|
||||
{
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
free (msg_ctxt_id);
|
||||
|
||||
#endif
|
||||
if (translation != msg_ctxt_id)
|
||||
return translation;
|
||||
}
|
||||
return msgid;
|
||||
return translation;
|
||||
}
|
||||
|
||||
return msgid;
|
||||
}
|
||||
|
||||
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N)\
|
||||
dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N)\
|
||||
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
|
@ -233,36 +235,38 @@ inline
|
|||
#endif
|
||||
static const char *
|
||||
dcnpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
const char *msgctxt, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id)
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *)malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id)
|
||||
#endif
|
||||
{
|
||||
{
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
free (msg_ctxt_id);
|
||||
|
||||
#endif
|
||||
if (!(translation == msg_ctxt_id || translation == msgid_plural))
|
||||
return translation;
|
||||
}
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
return translation;
|
||||
}
|
||||
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
}
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
||||
|
|
165
src/bin/main.c
165
src/bin/main.c
|
@ -25,7 +25,7 @@ Hist *hist = NULL;
|
|||
App app;
|
||||
|
||||
static void
|
||||
del_win(App * app, Evas_Object * win)
|
||||
del_win(App *app, Evas_Object *win)
|
||||
{
|
||||
Browser_Window *win_data;
|
||||
Eina_List *l;
|
||||
|
@ -42,14 +42,14 @@ del_win(App * app, Evas_Object * win)
|
|||
}
|
||||
|
||||
static void
|
||||
on_win_del_req(void *data, Evas_Object * win, void *event_info __UNUSED__)
|
||||
on_win_del_req(void *data, Evas_Object *win, void *event_info __UNUSED__)
|
||||
{
|
||||
del_win(data, win);
|
||||
}
|
||||
|
||||
/* this should be in elm_win... */
|
||||
static void
|
||||
win_mouse_disable(Evas_Object * win)
|
||||
win_mouse_disable(Evas_Object *win)
|
||||
{
|
||||
Evas *e = evas_object_evas_get(win);
|
||||
Ecore_Evas *ee = evas_data_attach_get(e);
|
||||
|
@ -61,15 +61,16 @@ win_mouse_disable(Evas_Object * win)
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_add(Browser_Window * win, const char *url)
|
||||
tab_add(Browser_Window *win, const char *url)
|
||||
{
|
||||
Evas_Object *chrome = chrome_add(win, url);
|
||||
|
||||
if (!chrome)
|
||||
{
|
||||
CRITICAL("Could not create chrome.");
|
||||
goto error_chrome_create;
|
||||
CRITICAL("Could not create chrome.");
|
||||
goto error_chrome_create;
|
||||
}
|
||||
|
||||
evas_object_size_hint_weight_set(chrome, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(chrome);
|
||||
|
||||
|
@ -80,14 +81,14 @@ tab_add(Browser_Window * win, const char *url)
|
|||
|
||||
return EINA_TRUE;
|
||||
|
||||
error_chrome_create:
|
||||
error_chrome_create:
|
||||
evas_object_del(evas_object_data_get(chrome, "view"));
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_focus_chrome(Browser_Window * win, Evas_Object * chrome)
|
||||
tab_focus_chrome(Browser_Window *win, Evas_Object *chrome)
|
||||
{
|
||||
Eina_List *itr;
|
||||
int n;
|
||||
|
@ -95,7 +96,7 @@ tab_focus_chrome(Browser_Window * win, Evas_Object * chrome)
|
|||
if (!chrome)
|
||||
return EINA_FALSE;
|
||||
|
||||
for (n = 0, itr = win->chromes; itr->data != chrome; n++, itr = itr->next);
|
||||
for (n = 0, itr = win->chromes; itr->data != chrome; n++, itr = itr->next) ;
|
||||
|
||||
evas_object_hide(win->current_chrome);
|
||||
|
||||
|
@ -111,31 +112,33 @@ tab_focus_chrome(Browser_Window * win, Evas_Object * chrome)
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_focus_nth(Browser_Window * win, unsigned int n)
|
||||
tab_focus_nth(Browser_Window *win, unsigned int n)
|
||||
{
|
||||
return tab_focus_chrome(win, eina_list_nth(win->chromes, n));
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_focus_next(Browser_Window * win)
|
||||
tab_focus_next(Browser_Window *win)
|
||||
{
|
||||
unsigned int n_tabs = eina_list_count(win->chromes);
|
||||
|
||||
if (win->current_tab > n_tabs)
|
||||
return EINA_FALSE;
|
||||
|
||||
return tab_focus_nth(win, win->current_tab + 1);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_focus_prev(Browser_Window * win)
|
||||
tab_focus_prev(Browser_Window *win)
|
||||
{
|
||||
if (win->current_tab == 0)
|
||||
return EINA_FALSE;
|
||||
|
||||
return tab_focus_nth(win, win->current_tab - 1);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_close_chrome(Browser_Window * win, Evas_Object * chrome)
|
||||
tab_close_chrome(Browser_Window *win, Evas_Object *chrome)
|
||||
{
|
||||
Evas_Object *edje;
|
||||
|
||||
|
@ -143,10 +146,10 @@ tab_close_chrome(Browser_Window * win, Evas_Object * chrome)
|
|||
EINA_SAFETY_ON_TRUE_RETURN_VAL(!chrome, EINA_FALSE);
|
||||
|
||||
if (!win->chromes->next)
|
||||
{
|
||||
del_win(win->app, win->win);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
{
|
||||
del_win(win->app, win->win);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
evas_object_del(chrome);
|
||||
win->chromes = eina_list_remove(win->chromes, chrome);
|
||||
|
@ -160,26 +163,26 @@ tab_close_chrome(Browser_Window * win, Evas_Object * chrome)
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_close_nth(Browser_Window * win, int n)
|
||||
tab_close_nth(Browser_Window *win, int n)
|
||||
{
|
||||
return tab_close_chrome(win, eina_list_nth(win->chromes, n));
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
tab_close_view(Browser_Window * win, Evas_Object *view)
|
||||
tab_close_view(Browser_Window *win, Evas_Object *view)
|
||||
{
|
||||
return tab_close_chrome(win, evas_object_data_get(view, "chrome"));
|
||||
}
|
||||
|
||||
static Browser_Window *
|
||||
add_win(App * app, const char *url)
|
||||
add_win(App *app, const char *url)
|
||||
{
|
||||
Browser_Window *win = malloc(sizeof(*win));
|
||||
|
||||
if (!win)
|
||||
{
|
||||
CRITICAL("Could not create window data.");
|
||||
goto error_win_data;
|
||||
CRITICAL("Could not create window data.");
|
||||
goto error_win_data;
|
||||
}
|
||||
|
||||
win->app = app;
|
||||
|
@ -193,8 +196,8 @@ add_win(App * app, const char *url)
|
|||
win->win = elm_win_add(NULL, "eve", ELM_WIN_BASIC);
|
||||
if (!win->win)
|
||||
{
|
||||
CRITICAL("Could not create window.");
|
||||
goto error_win_create;
|
||||
CRITICAL("Could not create window.");
|
||||
goto error_win_create;
|
||||
}
|
||||
|
||||
elm_win_title_set(win->win, PACKAGE_STRING);
|
||||
|
@ -206,33 +209,36 @@ add_win(App * app, const char *url)
|
|||
win->bg = edje_object_add(evas_object_evas_get(win->win));
|
||||
if (!win->bg)
|
||||
{
|
||||
CRITICAL("Could not create background.");
|
||||
goto error_bg_create;
|
||||
CRITICAL("Could not create background.");
|
||||
goto error_bg_create;
|
||||
}
|
||||
|
||||
if (!edje_object_file_set(win->bg, PACKAGE_DATA_DIR "/default.edj", "bg"))
|
||||
{
|
||||
int err = edje_object_load_error_get(win->bg);
|
||||
int err = edje_object_load_error_get(win->bg);
|
||||
|
||||
const char *msg = edje_load_error_str(err);
|
||||
const char *msg = edje_load_error_str(err);
|
||||
|
||||
CRITICAL("Could not load background theme: %s", msg);
|
||||
goto error_bg_theme_set;
|
||||
CRITICAL("Could not load background theme: %s", msg);
|
||||
goto error_bg_theme_set;
|
||||
}
|
||||
|
||||
evas_object_size_hint_weight_set(win->bg, EVAS_HINT_EXPAND,
|
||||
EVAS_HINT_EXPAND);
|
||||
EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win->win, win->bg);
|
||||
evas_object_layer_set(win->bg, EVAS_LAYER_MIN);
|
||||
evas_object_show(win->bg);
|
||||
|
||||
win->pager = elm_pager_add(win->win);
|
||||
if (!win->pager)
|
||||
{
|
||||
CRITICAL("Could not create pager");
|
||||
goto error_pager_create;
|
||||
}
|
||||
{
|
||||
CRITICAL("Could not create pager");
|
||||
goto error_pager_create;
|
||||
}
|
||||
|
||||
elm_object_style_set(win->pager, "ewebkit");
|
||||
evas_object_size_hint_weight_set(win->pager, EVAS_HINT_EXPAND,
|
||||
EVAS_HINT_EXPAND);
|
||||
EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win->win, win->pager);
|
||||
evas_object_show(win->pager);
|
||||
|
||||
|
@ -248,15 +254,15 @@ add_win(App * app, const char *url)
|
|||
|
||||
return win;
|
||||
|
||||
error_bg_theme_set:
|
||||
error_bg_theme_set:
|
||||
evas_object_del(win->bg);
|
||||
error_bg_create:
|
||||
error_bg_create:
|
||||
evas_object_del(win->win);
|
||||
error_win_create:
|
||||
error_win_create:
|
||||
free(win);
|
||||
error_win_data:
|
||||
error_tab_add:
|
||||
error_pager_create:
|
||||
error_win_data:
|
||||
error_tab_add:
|
||||
error_pager_create:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -286,19 +292,20 @@ static const Ecore_Getopt options = {
|
|||
"WebKit-EFL demo browser for mobile systems with touchscreen.",
|
||||
EINA_TRUE,
|
||||
{
|
||||
ECORE_GETOPT_STORE_DEF_BOOL('F', "fullscreen", "start in fullscreen.", 1),
|
||||
ECORE_GETOPT_STORE_DEF_BOOL('P', "disable-plugins",
|
||||
"disable plugins (flash, etc).", 1),
|
||||
ECORE_GETOPT_STORE_DEF_BOOL('M', "disable-mouse",
|
||||
"disable mouse (hide it).", 1),
|
||||
ECORE_GETOPT_STORE_STR('U', "user-agent",
|
||||
"user agent string to use. Special case=iphone."),
|
||||
ECORE_GETOPT_STORE_DEF_UINT('R', "rotate", "Screen Rotation in degrees", 0),
|
||||
ECORE_GETOPT_VERSION('V', "version"),
|
||||
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
|
||||
ECORE_GETOPT_LICENSE('L', "license"),
|
||||
ECORE_GETOPT_HELP('h', "help"),
|
||||
ECORE_GETOPT_SENTINEL}
|
||||
ECORE_GETOPT_STORE_DEF_BOOL('F', "fullscreen", "start in fullscreen.", 1),
|
||||
ECORE_GETOPT_STORE_DEF_BOOL('P', "disable-plugins",
|
||||
"disable plugins (flash, etc).", 1),
|
||||
ECORE_GETOPT_STORE_DEF_BOOL('M', "disable-mouse",
|
||||
"disable mouse (hide it).", 1),
|
||||
ECORE_GETOPT_STORE_STR('U', "user-agent",
|
||||
"user agent string to use. Special case=iphone."),
|
||||
ECORE_GETOPT_STORE_DEF_UINT('R', "rotate", "Screen Rotation in degrees", 0),
|
||||
ECORE_GETOPT_VERSION('V', "version"),
|
||||
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
|
||||
ECORE_GETOPT_LICENSE('L', "license"),
|
||||
ECORE_GETOPT_HELP('h', "help"),
|
||||
ECORE_GETOPT_SENTINEL
|
||||
}
|
||||
};
|
||||
|
||||
EAPI int
|
||||
|
@ -334,21 +341,21 @@ elm_main(int argc, char **argv)
|
|||
_log_domain = eina_log_domain_register("eve", NULL);
|
||||
if (_log_domain < 0)
|
||||
{
|
||||
EINA_LOG_CRIT("could not create log domain 'eve'.");
|
||||
return -1;
|
||||
EINA_LOG_CRIT("could not create log domain 'eve'.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
args = ecore_getopt_parse(&options, values, argc, argv);
|
||||
if (args < 0)
|
||||
{
|
||||
ERR("Could not parse command line options.");
|
||||
return -1;
|
||||
ERR("Could not parse command line options.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (quit_option)
|
||||
{
|
||||
DBG("Command lines option requires quit.");
|
||||
return 0;
|
||||
DBG("Command lines option requires quit.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args < argc)
|
||||
|
@ -358,7 +365,7 @@ elm_main(int argc, char **argv)
|
|||
|
||||
if (user_agent && strcasecmp(user_agent, "iphone") == 0)
|
||||
user_agent =
|
||||
"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3";
|
||||
"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3";
|
||||
|
||||
app.user_agent = eina_stringshare_add(user_agent);
|
||||
|
||||
|
@ -370,49 +377,50 @@ elm_main(int argc, char **argv)
|
|||
home = getenv("HOME");
|
||||
if (!home || !home[0])
|
||||
{
|
||||
CRITICAL("Could not get $HOME");
|
||||
r = -1;
|
||||
goto end;
|
||||
CRITICAL("Could not get $HOME");
|
||||
r = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "%s/.config/ewebkit", home);
|
||||
if (!ecore_file_mkpath(path))
|
||||
{
|
||||
ERR("Could not create %s", path);
|
||||
r = -1;
|
||||
goto end;
|
||||
ERR("Could not create %s", path);
|
||||
r = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!ewk_settings_icon_database_path_set(path))
|
||||
{
|
||||
ERR("Could not set icon database path to %s", path);
|
||||
r = -1;
|
||||
goto end;
|
||||
ERR("Could not set icon database path to %s", path);
|
||||
r = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "%s/.config/ewebkit/favorites.db", home);
|
||||
fav = fav_load(path);
|
||||
if (!fav)
|
||||
{
|
||||
fav = fav_new(0);
|
||||
fav_save(fav, path);
|
||||
fav = fav_new(0);
|
||||
fav_save(fav, path);
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "%s/.config/ewebkit/history.db", home);
|
||||
hist = hist_load(path);
|
||||
if (!hist)
|
||||
{
|
||||
hist = hist_new(0);
|
||||
hist_save(hist, path);
|
||||
hist = hist_new(0);
|
||||
hist_save(hist, path);
|
||||
}
|
||||
|
||||
if (!add_win(&app, url))
|
||||
{
|
||||
r = -1;
|
||||
goto end;
|
||||
r = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
elm_run();
|
||||
end:
|
||||
end:
|
||||
fav_save(fav, NULL);
|
||||
fav_free(fav);
|
||||
|
||||
|
@ -429,5 +437,6 @@ elm_main(int argc, char **argv)
|
|||
history_shutdown();
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
ELM_MAIN()
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include "favorite.h"
|
||||
#include "history.h"
|
||||
|
||||
typedef struct _App App;
|
||||
typedef struct _Browser_Window Browser_Window;
|
||||
typedef struct _View_Zoom_Interactive View_Zoom_Interactive;
|
||||
typedef struct _App App;
|
||||
typedef struct _Browser_Window Browser_Window;
|
||||
typedef struct _View_Zoom_Interactive View_Zoom_Interactive;
|
||||
|
||||
extern int _log_domain;
|
||||
extern Fav *fav;
|
||||
|
@ -21,26 +21,26 @@ extern Hist *hist;
|
|||
extern App app;
|
||||
|
||||
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
|
||||
|
||||
#define DEFAULT_URL "http://www.google.com"
|
||||
|
||||
/* TODO: Move all tab related stuff to its own struct */
|
||||
struct _Browser_Window
|
||||
{
|
||||
App *app;
|
||||
App *app;
|
||||
|
||||
Evas_Object *win;
|
||||
Evas_Object *bg;
|
||||
Evas_Object *pager;
|
||||
|
||||
Eina_List *chromes;
|
||||
Eina_List *chromes;
|
||||
|
||||
Eina_List *list_history;
|
||||
Eina_List *list_history_titles;
|
||||
Eina_List *list_history;
|
||||
Eina_List *list_history_titles;
|
||||
|
||||
Evas_Object *current_chrome;
|
||||
Evas_Object *current_view;
|
||||
|
@ -50,19 +50,19 @@ struct _Browser_Window
|
|||
|
||||
struct _App
|
||||
{
|
||||
Eina_List *windows;
|
||||
const char *user_agent;
|
||||
Eina_List *windows;
|
||||
const char *user_agent;
|
||||
|
||||
Eina_Bool is_fullscreen;
|
||||
Eina_Bool disable_plugins;
|
||||
Eina_Bool disable_mouse;
|
||||
Eina_Bool is_fullscreen;
|
||||
Eina_Bool disable_plugins;
|
||||
Eina_Bool disable_mouse;
|
||||
unsigned int rotate;
|
||||
};
|
||||
|
||||
struct _View_Zoom_Interactive
|
||||
{
|
||||
Evas_Coord x, y;
|
||||
float zoom;
|
||||
float zoom;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -77,23 +77,23 @@ struct _View_Zoom_Interactive
|
|||
* * "zoom,interactive,end" void: report zoom interactive is finished.
|
||||
*/
|
||||
|
||||
Evas_Object *window_create();
|
||||
Evas_Object *view_add(Evas_Object *parent);
|
||||
void view_zoom_next_up(Evas_Object *view);
|
||||
void view_zoom_next_down(Evas_Object *view);
|
||||
Eina_Bool view_context_menu_set(Evas_Object *view, Evas_Object *widget, Ewk_Context_Menu *menu);
|
||||
Evas_Object *view_context_menu_widget_get(Evas_Object *view);
|
||||
Ewk_Context_Menu *view_context_menu_get(Evas_Object *view);
|
||||
Evas_Object * window_create();
|
||||
Evas_Object * view_add(Evas_Object *parent);
|
||||
void view_zoom_next_up(Evas_Object *view);
|
||||
void view_zoom_next_down(Evas_Object *view);
|
||||
Eina_Bool view_context_menu_set(Evas_Object *view, Evas_Object *widget, Ewk_Context_Menu *menu);
|
||||
Evas_Object * view_context_menu_widget_get(Evas_Object *view);
|
||||
Ewk_Context_Menu * view_context_menu_get(Evas_Object *view);
|
||||
|
||||
Evas_Object *chrome_add(Browser_Window *win, const char *url);
|
||||
Evas_Object * chrome_add(Browser_Window *win, const char *url);
|
||||
|
||||
Eina_Bool tab_add(Browser_Window *win, const char *url);
|
||||
Eina_Bool tab_focus_nth(Browser_Window *win, unsigned int n);
|
||||
Eina_Bool tab_focus_chrome(Browser_Window * win, Evas_Object * chrome);
|
||||
Eina_Bool tab_focus_next(Browser_Window *win);
|
||||
Eina_Bool tab_focus_prev(Browser_Window *win);
|
||||
Eina_Bool tab_close_nth(Browser_Window *win, int n);
|
||||
Eina_Bool tab_close_view(Browser_Window *win, Evas_Object * view);
|
||||
Eina_Bool tab_close_chrome(Browser_Window * win, Evas_Object * chrome);
|
||||
Eina_Bool tab_add(Browser_Window *win, const char *url);
|
||||
Eina_Bool tab_focus_nth(Browser_Window *win, unsigned int n);
|
||||
Eina_Bool tab_focus_chrome(Browser_Window *win, Evas_Object *chrome);
|
||||
Eina_Bool tab_focus_next(Browser_Window *win);
|
||||
Eina_Bool tab_focus_prev(Browser_Window *win);
|
||||
Eina_Bool tab_close_nth(Browser_Window *win, int n);
|
||||
Eina_Bool tab_close_view(Browser_Window *win, Evas_Object *view);
|
||||
Eina_Bool tab_close_chrome(Browser_Window *win, Evas_Object *chrome);
|
||||
|
||||
#endif
|
||||
|
|
754
src/bin/view.c
754
src/bin/view.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue