commit 3422f42fffd136ccfea3ab74c5f12d21be43d0b1
parent 246734ca3fc8d0145f927b2327ed41be4bcebf7f
Author: Kyle Milz <kmilz@ucalgary.ca>
Date: Fri, 19 Oct 2012 19:14:02 -0600
commands: TRUE -> EINA_TRUE
Diffstat:
M | src/commands.c | | | 127 | ++++++++++++++++++++++++++++++++++++++++--------------------------------------- |
1 file changed, 64 insertions(+), 63 deletions(-)
diff --git a/src/commands.c b/src/commands.c
@@ -1,7 +1,6 @@
#include <Elementary.h>
#include <EWebKit2.h>
-#include <libsoup/soup.h>
#include "viking_state.h"
#include "viking.h"
@@ -145,32 +144,32 @@ complete(const Arg *arg, void *data)
Eina_Bool
descend(const Arg *arg, void *data)
{
- Window_Data *ad = data;
+ Window_Data *wd = data;
// char *source = (char*)webkit_web_view_get_uri(webview), *p = &source[0], *new;
- const char *source = ewk_view_url_get(ad->cur_buf->view);
+ const char *source = ewk_view_url_get(wd->cur_buf->view);
const char *p = &source[0];
char *new;
int i, len;
- ad->count = ad->count ? ad->count : 1;
+ wd->count = wd->count ? wd->count : 1;
if (!source)
- return TRUE;
+ return EINA_TRUE;
if (arg->i == Rootdir) {
for (i = 0; i < 3; i++) /* get to the third slash */
if (!(p = strchr(++p, '/')))
- return TRUE; /* if we cannot find it quit */
+ return EINA_TRUE; /* if we cannot find it quit */
} else {
len = strlen(source);
if (!len) /* if string is empty quit */
- return TRUE;
+ return EINA_TRUE;
p = source + len; /* start at the end */
if (*(p - 1) == '/') /* /\/$/ is not an additional level */
- ++(ad->count);
- for (i = 0; i < ad->count; i++)
+ ++(wd->count);
+ for (i = 0; i < wd->count; i++)
while(*(p--) != '/' || *p == '/') /* count /\/+/ as one slash */
if (p == source) /* if we reach the first char pointer quit */
- return TRUE;
+ return EINA_TRUE;
++p; /* since we do p-- in the while, we are pointing at
the char before the slash, so +1 */
}
@@ -178,10 +177,10 @@ descend(const Arg *arg, void *data)
new = malloc(len + 1);
memcpy(new, source, len);
new[len] = '\0';
- // webkit_web_view_load_uri(webview, new);
- ewk_view_url_set(ad->cur_buf->view, new);
+ ewk_view_url_set(wd->cur_buf->view, new);
free(new);
- return TRUE;
+
+ return EINA_TRUE;
}
Eina_Bool
@@ -191,14 +190,14 @@ input(const Arg *arg, void *data)
const char *url;
// int index = Info;
Arg a;
- Window_Data *ad = data;
- ad->count = 0;
+ Window_Data *wd = data;
+ wd->count = 0;
/* if inputbox hidden, show it again */
// if (!gtk_widget_get_visible(inputbox))
// gtk_widget_set_visible(inputbox, TRUE);
- if (!evas_object_visible_get(ad->url))
- evas_object_show(ad->url);
+ if (!evas_object_visible_get(wd->url))
+ evas_object_show(wd->url);
// update_state(data);
@@ -206,11 +205,11 @@ input(const Arg *arg, void *data)
* maintain a red colour from a warning from an end of search indicator,
* etc.
*/
- // set_widget_font_and_color(ad->url, urlboxfont[index], urlboxbgcolor[index], urlboxcolor[index]);
+ // set_widget_font_and_color(wd->url, urlboxfont[index], urlboxbgcolor[index], urlboxcolor[index]);
/* to avoid things like :open URL :open URL2 or :open :open URL */
// gtk_entry_set_text(GTK_ENTRY(inputbox), "");
- elm_entry_entry_set(ad->url, "");
+ elm_entry_entry_set(wd->url, "");
/*
gtk_editable_insert_text(GTK_EDITABLE(inputbox), arg->s, -1, &pos);
@@ -221,18 +220,18 @@ input(const Arg *arg, void *data)
gtk_editable_set_position(GTK_EDITABLE(inputbox), -1);
*/
- elm_entry_entry_set(ad->url, arg->s);
- if (arg->i & InsertCurrentURL && (url = ewk_view_url_get(ad->cur_buf->view)))
- elm_entry_entry_append(ad->url, url);
+ elm_entry_entry_set(wd->url, arg->s);
+ if (arg->i & InsertCurrentURL && (url = ewk_view_url_get(wd->cur_buf->view)))
+ elm_entry_entry_append(wd->url, url);
// evas_object_focus_set(ad->cur_buf->view, EINA_FALSE);
- elm_object_focus_set(ad->url, EINA_TRUE);
- elm_entry_cursor_end_set(ad->url);
+ elm_object_focus_set(wd->url, EINA_TRUE);
+ elm_entry_cursor_end_set(wd->url);
if (arg->s[0] == '.' || arg->s[0] == ',' || arg->s[0] == ';') {
- ad->mode = ModeHints;
- memset(ad->followTarget, 0, 8);
- strncpy(ad->followTarget, "current", 8);
+ wd->mode = ModeHints;
+ memset(wd->followTarget, 0, 8);
+ strncpy(wd->followTarget, "current", 8);
a.i = Silent;
switch (arg->s[0]) {
@@ -276,14 +275,14 @@ input(const Arg *arg, void *data)
break;
}
- ad->count = 0;
+ wd->count = 0;
if (a.s) {
script(&a, data);
free(a.s);
}
}
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
@@ -310,14 +309,14 @@ navigate(const Arg *arg, void *data)
Eina_Bool
number(const Arg *arg, void *data)
{
- Window_Data *ad = data;
+ Window_Data *wd = data;
// const char *source = webkit_web_view_get_uri(webview);
- const char *source = ewk_view_url_get(ad->cur_buf->view);
+ const char *source = ewk_view_url_get(wd->cur_buf->view);
char *uri, *p, *new;
- int number, diff = (ad->count ? ad->count : 1) * (arg->i == Increment ? 1 : -1);
+ int number, diff = (wd->count ? wd->count : 1) * (arg->i == Increment ? 1 : -1);
if (!source)
- return TRUE;
+ return EINA_TRUE;
uri = strdup(source); /* copy string */
p =& uri[0];
while(*p != '\0') /* goto the end of the string */
@@ -327,35 +326,35 @@ number(const Arg *arg, void *data)
--p;
if (*(++p) == '\0') { /* if no numbers were found abort */
free(uri);
- return TRUE;
+ return EINA_TRUE;
}
number = atoi(p) + diff; /* apply diff on number */
*p = '\0';
new = strdup_printf("%s%d", uri, number); /* create new uri */
- // webkit_web_view_load_uri(webview, new);
- ewk_view_url_set(ad->cur_buf->view, new);
+ ewk_view_url_set(wd->cur_buf->view, new);
free(new);
free(uri);
- return TRUE;
+
+ return EINA_TRUE;
}
Eina_Bool
open_arg(const Arg *arg, void *data)
{
Arg a = { .i = NavigationReload };
- Window_Data *ad = data;
+ Window_Data *wd = data;
if (!arg->s) {
- navigate(&a, data);
+ navigate(&a, wd);
}
else if (arg->i == TargetCurrent) {
- ewk_view_url_set(ad->cur_buf->view, uri_sanitize(arg->s));
+ ewk_view_url_set(wd->cur_buf->view, uri_sanitize(arg->s));
}
else {
- buffer_add(SwitchToBuffer, ad, NULL, NULL);
+ buffer_add(SwitchToBuffer, wd, NULL, NULL);
a.i = TargetCurrent;
a.s = arg->s;
- open_arg(&a, ad);
+ open_arg(&a, wd);
}
return EINA_TRUE;
}
@@ -363,14 +362,14 @@ open_arg(const Arg *arg, void *data)
Eina_Bool
open_remembered(const Arg *arg, void *data)
{
- Window_Data *ad = data;
+ Window_Data *wd = data;
- Arg a = {arg->i, ad->rememberedURI};
+ Arg a = {arg->i, wd->rememberedURI};
- if (strcmp(ad->rememberedURI, "")) {
- open_arg(&a, data);
- }
- return TRUE;
+ if (strcmp(wd->rememberedURI, ""))
+ open_arg(&a, wd);
+
+ return EINA_TRUE;
}
Eina_Bool
@@ -406,7 +405,7 @@ yank(const Arg *arg, void *data) {
gtk_clipboard_set_text(clipboards[1], url, -1);
}
*/
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
@@ -430,7 +429,7 @@ paste(const Arg *arg, void *data) {
g_free(a.s);
}
*/
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
@@ -456,6 +455,7 @@ quit(const Arg *arg, void *data)
{
Window_Data *wd = data;
App_Data *ad = wd->app;
+
ad->exiting = EINA_TRUE;
elm_exit();
@@ -477,7 +477,7 @@ print_frame(const Arg *arg, void *data)
WebKitWebFrame *frame = webkit_web_view_get_main_frame(webview);
webkit_web_frame_print (frame);
*/
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
@@ -495,7 +495,7 @@ search(const Arg *arg, void *data)
ad->search_handle = strdup(arg->s);
}
if (!ad->search_handle)
- return TRUE;
+ return EINA_TRUE;
if (arg->i & DirectionAbsolute)
ad->search_direction = direction;
else
@@ -527,7 +527,7 @@ search(const Arg *arg, void *data)
echo(&a, data);
free(a.s);
}
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
@@ -564,10 +564,10 @@ set(const Arg *arg, void *data)
free(a.s);
break;
default:
- return TRUE;
+ return EINA_TRUE;
}
ad->mode = arg->i;
- return TRUE;
+ return EINA_TRUE;
}
/*
@@ -648,7 +648,7 @@ script(const Arg *arg, void *data)
} else if (strncmp(value, "insert;", 7) == 0) {
a.i = ModeInsert;
set(&a, data);
- ad->manual_focus = TRUE;
+ ad->manual_focus = EINA_TRUE;
} else if (strncmp(value, "save;", 5) == 0) {
/* forced download */
a.i = ModeNormal;
@@ -692,7 +692,7 @@ script(const Arg *arg, void *data)
}
// free(value);
eina_stringshare_del(value);
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
@@ -749,7 +749,7 @@ scroll(const Arg *arg, void *data)
update_state(data);
}
*/
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
@@ -794,22 +794,23 @@ view_source(const Arg * arg, void *data)
webkit_web_view_set_view_source_mode(webview, !current_mode);
webkit_web_view_reload(webview);
*/
- return TRUE;
+ return EINA_TRUE;
}
Eina_Bool
focus_input(const Arg *arg, void *data)
{
static Arg a;
- Window_Data *ad = data;
+ Window_Data *wd = data;
a.s = strdup("hints.focusInput();");
a.i = Silent;
script(&a, data);
free(a.s);
- gui_scroll_update(ad);
- ad->manual_focus = TRUE;
- return TRUE;
+ gui_scroll_update(wd);
+ wd->manual_focus = EINA_TRUE;
+
+ return EINA_TRUE;
}
/*