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:
Lucas De Marchi 2010-08-27 17:51:04 +00:00
parent 50f87c6bcb
commit fce46e4793
5 changed files with 1031 additions and 964 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
#ifndef _LIBGETTEXT_H #ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1 #define _LIBGETTEXT_H 1
#define _(x) gettext(x) #define _(x) gettext(x)
#define N_(x) gettext_noop(x) #define N_(x) gettext_noop(x)
/* NLS can be disabled through the configure --disable-nls option. */ /* NLS can be disabled through the configure --disable-nls option. */
@ -30,11 +30,11 @@
textdomain(), and is useful for libraries. */ textdomain(), and is useful for libraries. */
# ifdef DEFAULT_TEXT_DOMAIN # ifdef DEFAULT_TEXT_DOMAIN
# undef gettext # undef gettext
# define gettext(Msgid) \ # define gettext(Msgid)\
dgettext (DEFAULT_TEXT_DOMAIN, Msgid) dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
# undef ngettext # undef ngettext
# define ngettext(Msgid1, Msgid2, N) \ # define ngettext(Msgid1, Msgid2, N)\
dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
# endif # endif
#else #else
@ -61,23 +61,23 @@
for invalid uses of the value returned from these functions. for invalid uses of the value returned from these functions.
On pre-ANSI systems without 'const', the config.h file is supposed to On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */ contain "#define const". */
# define gettext(Msgid) ((const char *) (Msgid)) # define gettext(Msgid) ((const char *)(Msgid))
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) # define dgettext(Domainname, Msgid) ((void)(Domainname), gettext (Msgid))
# define dcgettext(Domainname, Msgid, Category) \ # define dcgettext(Domainname, Msgid, Category)\
((void) (Category), dgettext (Domainname, Msgid)) ((void)(Category), dgettext (Domainname, Msgid))
# define ngettext(Msgid1, Msgid2, N) \ # define ngettext(Msgid1, Msgid2, N)\
((N) == 1 \ ((N) == 1\
? ((void) (Msgid2), (const char *) (Msgid1)) \ ? ((void)(Msgid2), (const char *)(Msgid1))\
: ((void) (Msgid1), (const char *) (Msgid2))) : ((void)(Msgid1), (const char *)(Msgid2)))
# define dngettext(Domainname, Msgid1, Msgid2, N) \ # define dngettext(Domainname, Msgid1, Msgid2, N)\
((void) (Domainname), ngettext (Msgid1, Msgid2, N)) ((void)(Domainname), ngettext (Msgid1, Msgid2, N))
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ # define dcngettext(Domainname, Msgid1, Msgid2, N, Category)\
((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) ((void)(Category), dngettext(Domainname, Msgid1, Msgid2, N))
# define textdomain(Domainname) ((const char *) (Domainname)) # define textdomain(Domainname) ((const char *)(Domainname))
# define bindtextdomain(Domainname, Dirname) \ # define bindtextdomain(Domainname, Dirname)\
((void) (Domainname), (const char *) (Dirname)) ((void)(Domainname), (const char *)(Dirname))
# define bind_textdomain_codeset(Domainname, Codeset) \ # define bind_textdomain_codeset(Domainname, Codeset)\
((void) (Domainname), (const char *) (Codeset)) ((void)(Domainname), (const char *)(Codeset))
#endif #endif
@ -98,27 +98,27 @@
short and rarely need to change. short and rarely need to change.
The letter 'p' stands for 'particular' or 'special'. */ The letter 'p' stands for 'particular' or 'special'. */
#ifdef DEFAULT_TEXT_DOMAIN #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) pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#else #else
# define pgettext(Msgctxt, Msgid) \ # define pgettext(Msgctxt, Msgid)\
pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#endif #endif
#define dpgettext(Domainname, Msgctxt, Msgid) \ #define dpgettext(Domainname, Msgctxt, Msgid)\
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ #define dcpgettext(Domainname, Msgctxt, Msgid, Category)\
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
#ifdef DEFAULT_TEXT_DOMAIN #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) npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
#else #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) npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
#endif #endif
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N)\
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category)\
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
#ifdef __GNUC__ #ifdef __GNUC__
__inline __inline
@ -129,14 +129,14 @@ inline
#endif #endif
static const char * static const char *
pgettext_aux (const char *domain, pgettext_aux (const char *domain,
const char *msg_ctxt_id, const char *msgid, const char *msg_ctxt_id, const char *msgid,
int category) int category)
{ {
const char *translation = dcgettext (domain, msg_ctxt_id, category); const char *translation = dcgettext (domain, msg_ctxt_id, category);
if (translation == msg_ctxt_id) if (translation == msg_ctxt_id)
return msgid; return msgid;
else else
return translation; return translation;
} }
#ifdef __GNUC__ #ifdef __GNUC__
@ -148,16 +148,16 @@ inline
#endif #endif
static const char * static const char *
npgettext_aux (const char *domain, npgettext_aux (const char *domain,
const char *msg_ctxt_id, const char *msgid, const char *msg_ctxt_id, const char *msgid,
const char *msgid_plural, unsigned long int n, const char *msgid_plural, unsigned long int n,
int category) int category)
{ {
const char *translation = const char *translation =
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
if (translation == msg_ctxt_id || translation == msgid_plural) if (translation == msg_ctxt_id || translation == msgid_plural)
return (n == 1 ? msgid : msgid_plural); return (n == 1 ? msgid : msgid_plural);
else else
return translation; return translation;
} }
/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID /* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
@ -166,18 +166,18 @@ npgettext_aux (const char *domain,
#include <string.h> #include <string.h>
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS\
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__)\
/* || __STDC_VERSION__ >= 199901L */ ) /* || __STDC_VERSION__ >= 199901L */)
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#define pgettext_expr(Msgctxt, Msgid) \ #define pgettext_expr(Msgctxt, Msgid)\
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ #define dpgettext_expr(Domainname, Msgctxt, Msgid)\
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
#ifdef __GNUC__ #ifdef __GNUC__
__inline __inline
@ -188,41 +188,43 @@ inline
#endif #endif
static const char * static const char *
dcpgettext_expr (const char *domain, dcpgettext_expr (const char *domain,
const char *msgctxt, const char *msgid, const char *msgctxt, const char *msgid,
int category) int category)
{ {
size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgctxt_len = strlen (msgctxt) + 1;
size_t msgid_len = strlen (msgid) + 1; size_t msgid_len = strlen (msgid) + 1;
const char *translation; const char *translation;
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
char msg_ctxt_id[msgctxt_len + msgid_len]; char msg_ctxt_id[msgctxt_len + msgid_len];
#else #else
char buf[1024]; char buf[1024];
char *msg_ctxt_id = char *msg_ctxt_id =
(msgctxt_len + msgid_len <= sizeof (buf) (msgctxt_len + msgid_len <= sizeof (buf)
? buf ? buf
: (char *) malloc (msgctxt_len + msgid_len)); : (char *)malloc (msgctxt_len + msgid_len));
if (msg_ctxt_id) if (msg_ctxt_id)
#endif #endif
{ {
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004'; msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcgettext (domain, msg_ctxt_id, category); translation = dcgettext (domain, msg_ctxt_id, category);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf) if (msg_ctxt_id != buf)
free (msg_ctxt_id); free (msg_ctxt_id);
#endif #endif
if (translation != msg_ctxt_id) if (translation != msg_ctxt_id)
return translation; return translation;
} }
return msgid;
return msgid;
} }
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ #define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N)\
dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N)\
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
#ifdef __GNUC__ #ifdef __GNUC__
__inline __inline
@ -233,36 +235,38 @@ inline
#endif #endif
static const char * static const char *
dcnpgettext_expr (const char *domain, dcnpgettext_expr (const char *domain,
const char *msgctxt, const char *msgid, const char *msgctxt, const char *msgid,
const char *msgid_plural, unsigned long int n, const char *msgid_plural, unsigned long int n,
int category) int category)
{ {
size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgctxt_len = strlen (msgctxt) + 1;
size_t msgid_len = strlen (msgid) + 1; size_t msgid_len = strlen (msgid) + 1;
const char *translation; const char *translation;
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
char msg_ctxt_id[msgctxt_len + msgid_len]; char msg_ctxt_id[msgctxt_len + msgid_len];
#else #else
char buf[1024]; char buf[1024];
char *msg_ctxt_id = char *msg_ctxt_id =
(msgctxt_len + msgid_len <= sizeof (buf) (msgctxt_len + msgid_len <= sizeof (buf)
? buf ? buf
: (char *) malloc (msgctxt_len + msgid_len)); : (char *)malloc (msgctxt_len + msgid_len));
if (msg_ctxt_id) if (msg_ctxt_id)
#endif #endif
{ {
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004'; msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf) if (msg_ctxt_id != buf)
free (msg_ctxt_id); free (msg_ctxt_id);
#endif #endif
if (!(translation == msg_ctxt_id || translation == msgid_plural)) if (!(translation == msg_ctxt_id || translation == msgid_plural))
return translation; return translation;
} }
return (n == 1 ? msgid : msgid_plural);
return (n == 1 ? msgid : msgid_plural);
} }
#endif /* _LIBGETTEXT_H */ #endif /* _LIBGETTEXT_H */

View File

@ -25,7 +25,7 @@ Hist *hist = NULL;
App app; App app;
static void static void
del_win(App * app, Evas_Object * win) del_win(App *app, Evas_Object *win)
{ {
Browser_Window *win_data; Browser_Window *win_data;
Eina_List *l; Eina_List *l;
@ -42,14 +42,14 @@ del_win(App * app, Evas_Object * win)
} }
static void 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); del_win(data, win);
} }
/* this should be in elm_win... */ /* this should be in elm_win... */
static void static void
win_mouse_disable(Evas_Object * win) win_mouse_disable(Evas_Object *win)
{ {
Evas *e = evas_object_evas_get(win); Evas *e = evas_object_evas_get(win);
Ecore_Evas *ee = evas_data_attach_get(e); Ecore_Evas *ee = evas_data_attach_get(e);
@ -61,15 +61,16 @@ win_mouse_disable(Evas_Object * win)
} }
Eina_Bool 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); Evas_Object *chrome = chrome_add(win, url);
if (!chrome) if (!chrome)
{ {
CRITICAL("Could not create chrome."); CRITICAL("Could not create chrome.");
goto error_chrome_create; goto error_chrome_create;
} }
evas_object_size_hint_weight_set(chrome, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(chrome, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(chrome); evas_object_show(chrome);
@ -80,14 +81,14 @@ tab_add(Browser_Window * win, const char *url)
return EINA_TRUE; return EINA_TRUE;
error_chrome_create: error_chrome_create:
evas_object_del(evas_object_data_get(chrome, "view")); evas_object_del(evas_object_data_get(chrome, "view"));
return EINA_FALSE; return EINA_FALSE;
} }
Eina_Bool Eina_Bool
tab_focus_chrome(Browser_Window * win, Evas_Object * chrome) tab_focus_chrome(Browser_Window *win, Evas_Object *chrome)
{ {
Eina_List *itr; Eina_List *itr;
int n; int n;
@ -95,7 +96,7 @@ tab_focus_chrome(Browser_Window * win, Evas_Object * chrome)
if (!chrome) if (!chrome)
return EINA_FALSE; 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); evas_object_hide(win->current_chrome);
@ -111,31 +112,33 @@ tab_focus_chrome(Browser_Window * win, Evas_Object * chrome)
} }
Eina_Bool 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)); return tab_focus_chrome(win, eina_list_nth(win->chromes, n));
} }
Eina_Bool Eina_Bool
tab_focus_next(Browser_Window * win) tab_focus_next(Browser_Window *win)
{ {
unsigned int n_tabs = eina_list_count(win->chromes); unsigned int n_tabs = eina_list_count(win->chromes);
if (win->current_tab > n_tabs) if (win->current_tab > n_tabs)
return EINA_FALSE; return EINA_FALSE;
return tab_focus_nth(win, win->current_tab + 1); return tab_focus_nth(win, win->current_tab + 1);
} }
Eina_Bool Eina_Bool
tab_focus_prev(Browser_Window * win) tab_focus_prev(Browser_Window *win)
{ {
if (win->current_tab == 0) if (win->current_tab == 0)
return EINA_FALSE; return EINA_FALSE;
return tab_focus_nth(win, win->current_tab - 1); return tab_focus_nth(win, win->current_tab - 1);
} }
Eina_Bool Eina_Bool
tab_close_chrome(Browser_Window * win, Evas_Object * chrome) tab_close_chrome(Browser_Window *win, Evas_Object *chrome)
{ {
Evas_Object *edje; 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); EINA_SAFETY_ON_TRUE_RETURN_VAL(!chrome, EINA_FALSE);
if (!win->chromes->next) if (!win->chromes->next)
{ {
del_win(win->app, win->win); del_win(win->app, win->win);
return EINA_TRUE; return EINA_TRUE;
} }
evas_object_del(chrome); evas_object_del(chrome);
win->chromes = eina_list_remove(win->chromes, chrome); win->chromes = eina_list_remove(win->chromes, chrome);
@ -160,26 +163,26 @@ tab_close_chrome(Browser_Window * win, Evas_Object * chrome)
} }
Eina_Bool 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)); return tab_close_chrome(win, eina_list_nth(win->chromes, n));
} }
Eina_Bool 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")); return tab_close_chrome(win, evas_object_data_get(view, "chrome"));
} }
static Browser_Window * static Browser_Window *
add_win(App * app, const char *url) add_win(App *app, const char *url)
{ {
Browser_Window *win = malloc(sizeof(*win)); Browser_Window *win = malloc(sizeof(*win));
if (!win) if (!win)
{ {
CRITICAL("Could not create window data."); CRITICAL("Could not create window data.");
goto error_win_data; goto error_win_data;
} }
win->app = app; win->app = app;
@ -193,8 +196,8 @@ add_win(App * app, const char *url)
win->win = elm_win_add(NULL, "eve", ELM_WIN_BASIC); win->win = elm_win_add(NULL, "eve", ELM_WIN_BASIC);
if (!win->win) if (!win->win)
{ {
CRITICAL("Could not create window."); CRITICAL("Could not create window.");
goto error_win_create; goto error_win_create;
} }
elm_win_title_set(win->win, PACKAGE_STRING); 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)); win->bg = edje_object_add(evas_object_evas_get(win->win));
if (!win->bg) if (!win->bg)
{ {
CRITICAL("Could not create background."); CRITICAL("Could not create background.");
goto error_bg_create; goto error_bg_create;
} }
if (!edje_object_file_set(win->bg, PACKAGE_DATA_DIR "/default.edj", "bg")) 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); CRITICAL("Could not load background theme: %s", msg);
goto error_bg_theme_set; goto error_bg_theme_set;
} }
evas_object_size_hint_weight_set(win->bg, EVAS_HINT_EXPAND, 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); elm_win_resize_object_add(win->win, win->bg);
evas_object_layer_set(win->bg, EVAS_LAYER_MIN); evas_object_layer_set(win->bg, EVAS_LAYER_MIN);
evas_object_show(win->bg); evas_object_show(win->bg);
win->pager = elm_pager_add(win->win); win->pager = elm_pager_add(win->win);
if (!win->pager) if (!win->pager)
{ {
CRITICAL("Could not create pager"); CRITICAL("Could not create pager");
goto error_pager_create; goto error_pager_create;
} }
elm_object_style_set(win->pager, "ewebkit"); elm_object_style_set(win->pager, "ewebkit");
evas_object_size_hint_weight_set(win->pager, EVAS_HINT_EXPAND, 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); elm_win_resize_object_add(win->win, win->pager);
evas_object_show(win->pager); evas_object_show(win->pager);
@ -248,15 +254,15 @@ add_win(App * app, const char *url)
return win; return win;
error_bg_theme_set: error_bg_theme_set:
evas_object_del(win->bg); evas_object_del(win->bg);
error_bg_create: error_bg_create:
evas_object_del(win->win); evas_object_del(win->win);
error_win_create: error_win_create:
free(win); free(win);
error_win_data: error_win_data:
error_tab_add: error_tab_add:
error_pager_create: error_pager_create:
return NULL; return NULL;
} }
@ -286,19 +292,20 @@ static const Ecore_Getopt options = {
"WebKit-EFL demo browser for mobile systems with touchscreen.", "WebKit-EFL demo browser for mobile systems with touchscreen.",
EINA_TRUE, EINA_TRUE,
{ {
ECORE_GETOPT_STORE_DEF_BOOL('F', "fullscreen", "start in fullscreen.", 1), ECORE_GETOPT_STORE_DEF_BOOL('F', "fullscreen", "start in fullscreen.", 1),
ECORE_GETOPT_STORE_DEF_BOOL('P', "disable-plugins", ECORE_GETOPT_STORE_DEF_BOOL('P', "disable-plugins",
"disable plugins (flash, etc).", 1), "disable plugins (flash, etc).", 1),
ECORE_GETOPT_STORE_DEF_BOOL('M', "disable-mouse", ECORE_GETOPT_STORE_DEF_BOOL('M', "disable-mouse",
"disable mouse (hide it).", 1), "disable mouse (hide it).", 1),
ECORE_GETOPT_STORE_STR('U', "user-agent", ECORE_GETOPT_STORE_STR('U', "user-agent",
"user agent string to use. Special case=iphone."), "user agent string to use. Special case=iphone."),
ECORE_GETOPT_STORE_DEF_UINT('R', "rotate", "Screen Rotation in degrees", 0), ECORE_GETOPT_STORE_DEF_UINT('R', "rotate", "Screen Rotation in degrees", 0),
ECORE_GETOPT_VERSION('V', "version"), ECORE_GETOPT_VERSION('V', "version"),
ECORE_GETOPT_COPYRIGHT('C', "copyright"), ECORE_GETOPT_COPYRIGHT('C', "copyright"),
ECORE_GETOPT_LICENSE('L', "license"), ECORE_GETOPT_LICENSE('L', "license"),
ECORE_GETOPT_HELP('h', "help"), ECORE_GETOPT_HELP('h', "help"),
ECORE_GETOPT_SENTINEL} ECORE_GETOPT_SENTINEL
}
}; };
EAPI int EAPI int
@ -334,21 +341,21 @@ elm_main(int argc, char **argv)
_log_domain = eina_log_domain_register("eve", NULL); _log_domain = eina_log_domain_register("eve", NULL);
if (_log_domain < 0) if (_log_domain < 0)
{ {
EINA_LOG_CRIT("could not create log domain 'eve'."); EINA_LOG_CRIT("could not create log domain 'eve'.");
return -1; return -1;
} }
args = ecore_getopt_parse(&options, values, argc, argv); args = ecore_getopt_parse(&options, values, argc, argv);
if (args < 0) if (args < 0)
{ {
ERR("Could not parse command line options."); ERR("Could not parse command line options.");
return -1; return -1;
} }
if (quit_option) if (quit_option)
{ {
DBG("Command lines option requires quit."); DBG("Command lines option requires quit.");
return 0; return 0;
} }
if (args < argc) if (args < argc)
@ -358,7 +365,7 @@ elm_main(int argc, char **argv)
if (user_agent && strcasecmp(user_agent, "iphone") == 0) if (user_agent && strcasecmp(user_agent, "iphone") == 0)
user_agent = 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); app.user_agent = eina_stringshare_add(user_agent);
@ -370,49 +377,50 @@ elm_main(int argc, char **argv)
home = getenv("HOME"); home = getenv("HOME");
if (!home || !home[0]) if (!home || !home[0])
{ {
CRITICAL("Could not get $HOME"); CRITICAL("Could not get $HOME");
r = -1; r = -1;
goto end; goto end;
} }
snprintf(path, sizeof(path), "%s/.config/ewebkit", home); snprintf(path, sizeof(path), "%s/.config/ewebkit", home);
if (!ecore_file_mkpath(path)) if (!ecore_file_mkpath(path))
{ {
ERR("Could not create %s", path); ERR("Could not create %s", path);
r = -1; r = -1;
goto end; goto end;
} }
if (!ewk_settings_icon_database_path_set(path)) if (!ewk_settings_icon_database_path_set(path))
{ {
ERR("Could not set icon database path to %s", path); ERR("Could not set icon database path to %s", path);
r = -1; r = -1;
goto end; goto end;
} }
snprintf(path, sizeof(path), "%s/.config/ewebkit/favorites.db", home); snprintf(path, sizeof(path), "%s/.config/ewebkit/favorites.db", home);
fav = fav_load(path); fav = fav_load(path);
if (!fav) if (!fav)
{ {
fav = fav_new(0); fav = fav_new(0);
fav_save(fav, path); fav_save(fav, path);
} }
snprintf(path, sizeof(path), "%s/.config/ewebkit/history.db", home); snprintf(path, sizeof(path), "%s/.config/ewebkit/history.db", home);
hist = hist_load(path); hist = hist_load(path);
if (!hist) if (!hist)
{ {
hist = hist_new(0); hist = hist_new(0);
hist_save(hist, path); hist_save(hist, path);
} }
if (!add_win(&app, url)) if (!add_win(&app, url))
{ {
r = -1; r = -1;
goto end; goto end;
} }
elm_run(); elm_run();
end: end:
fav_save(fav, NULL); fav_save(fav, NULL);
fav_free(fav); fav_free(fav);
@ -429,5 +437,6 @@ elm_main(int argc, char **argv)
history_shutdown(); history_shutdown();
return r; return r;
} }
#endif #endif
ELM_MAIN() ELM_MAIN()

View File

@ -11,9 +11,9 @@
#include "favorite.h" #include "favorite.h"
#include "history.h" #include "history.h"
typedef struct _App App; typedef struct _App App;
typedef struct _Browser_Window Browser_Window; typedef struct _Browser_Window Browser_Window;
typedef struct _View_Zoom_Interactive View_Zoom_Interactive; typedef struct _View_Zoom_Interactive View_Zoom_Interactive;
extern int _log_domain; extern int _log_domain;
extern Fav *fav; extern Fav *fav;
@ -21,26 +21,26 @@ extern Hist *hist;
extern App app; extern App app;
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__) #define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_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 WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(_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 DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
#define DEFAULT_URL "http://www.google.com" #define DEFAULT_URL "http://www.google.com"
/* TODO: Move all tab related stuff to its own struct */ /* TODO: Move all tab related stuff to its own struct */
struct _Browser_Window struct _Browser_Window
{ {
App *app; App *app;
Evas_Object *win; Evas_Object *win;
Evas_Object *bg; Evas_Object *bg;
Evas_Object *pager; Evas_Object *pager;
Eina_List *chromes; Eina_List *chromes;
Eina_List *list_history; Eina_List *list_history;
Eina_List *list_history_titles; Eina_List *list_history_titles;
Evas_Object *current_chrome; Evas_Object *current_chrome;
Evas_Object *current_view; Evas_Object *current_view;
@ -50,19 +50,19 @@ struct _Browser_Window
struct _App struct _App
{ {
Eina_List *windows; Eina_List *windows;
const char *user_agent; const char *user_agent;
Eina_Bool is_fullscreen; Eina_Bool is_fullscreen;
Eina_Bool disable_plugins; Eina_Bool disable_plugins;
Eina_Bool disable_mouse; Eina_Bool disable_mouse;
unsigned int rotate; unsigned int rotate;
}; };
struct _View_Zoom_Interactive struct _View_Zoom_Interactive
{ {
Evas_Coord x, y; 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. * * "zoom,interactive,end" void: report zoom interactive is finished.
*/ */
Evas_Object *window_create(); Evas_Object * window_create();
Evas_Object *view_add(Evas_Object *parent); Evas_Object * view_add(Evas_Object *parent);
void view_zoom_next_up(Evas_Object *view); void view_zoom_next_up(Evas_Object *view);
void view_zoom_next_down(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); 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); Evas_Object * view_context_menu_widget_get(Evas_Object *view);
Ewk_Context_Menu *view_context_menu_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_add(Browser_Window *win, const char *url);
Eina_Bool tab_focus_nth(Browser_Window *win, unsigned int n); 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_chrome(Browser_Window *win, Evas_Object *chrome);
Eina_Bool tab_focus_next(Browser_Window *win); Eina_Bool tab_focus_next(Browser_Window *win);
Eina_Bool tab_focus_prev(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_nth(Browser_Window *win, int n);
Eina_Bool tab_close_view(Browser_Window *win, Evas_Object * view); 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_close_chrome(Browser_Window *win, Evas_Object *chrome);
#endif #endif

File diff suppressed because it is too large Load Diff