aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-09-19 09:47:22 +0200
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-09-19 09:47:22 +0200
commit86df99cf27a6e833f175060288eb8cef9d0cb593 (patch)
treed27437be1e31df494e61282a5675b6b952b82612
parent0a216341c42744720990140a4ca1d42decab2ccd (diff)
deprecate insert/command mode, always_insert_mode, mode indicators, in favor of soon to be implemented EM replacements. uzbl-core now only knows if it should forward_keys to the webkitview or not
-rw-r--r--README13
-rw-r--r--tests/test-command.c4
-rw-r--r--tests/test-expand.c4
-rw-r--r--uzbl-core.c64
-rw-r--r--uzbl-core.h22
5 files changed, 15 insertions, 92 deletions
diff --git a/README b/README
index e1e7682..a6305a4 100644
--- a/README
+++ b/README
@@ -147,7 +147,7 @@ The following commands are recognized:
* `search <string>`
* `search_reverse <string>`
- search with no string will search for the next/previous occurrence of the string previously searched for
-* `toggle_insert_mode <optional state>`
+* `toggle_insert_mode <optional state>` TODO new plugin based syntax
- if the optional state is 0, disable insert mode. If 1, enable insert mode.
* `dump_config`
- dumps your current config (which may have been changed at runtime) to stdout, in a format you can use to pipe into uzbl again (or use as config file)
@@ -186,14 +186,15 @@ Besides the builtin variables you can also define your own ones and use them in
- status_pbar_pending: character to denote pending % of pageload
- status_pbar_width: width of progressbar
- status_background: color which can be used to override Gtk theme.
- - insert_indicator: string to denote insert mode
- - command_indicator: string to denote command mode
+ - insert_indicator: string to denote insert mode TODO plugin variable
+ - command_indicator: string to denote command mode TODO plugin variable
- title_format_long: titlebar string when no statusbar shown (will be expanded
- title_format_short: titlebar string when statusbar shown (will be expanded)
- icon: path to icon for Gtk
- - insert_mode: whether insert mode is active
- - always_insert_mode: set this to true if you don't like modal (vim-like) interfaces
- - reset_command_mode: automatically revert to command mode on pageload (unless always_insert_mode is set)
+ - forward_keys: whether uzbl-core should send key events to the webkit view
+ - insert_mode: whether insert mode is active TODO explain plugin variable
+ - always_insert_mode: set this to true if you don't like modal (vim-like) interfaces TODO explain plugin variable
+ - reset_command_mode: automatically revert to command mode on pageload (unless always_insert_mode is set) TODO explain plugin variable
- modkey: modkey which can be pressed to activate keybind from inside insert mode
- load_finish_handler
- load_start_handler
diff --git a/tests/test-command.c b/tests/test-command.c
index a752ca6..2a226b2 100644
--- a/tests/test-command.c
+++ b/tests/test-command.c
@@ -35,13 +35,13 @@ test_keycmd (void) {
/* the 'keycmd' command */
parse_command("keycmd", "insert", NULL);
- g_assert_cmpint(1, ==, uzbl.behave.insert_mode);
+ g_assert_cmpint(1, ==, uzbl.behave.forward_keys);
g_assert_cmpstr("", ==, uzbl.state.keycmd);
/* setting the keycmd variable directly, equivalent to the 'keycmd' comand */
set_var_value("keycmd", "command");
- g_assert_cmpint(0, ==, uzbl.behave.insert_mode);
+ g_assert_cmpint(0, ==, uzbl.behave.forward_keys);
g_assert_cmpstr("", ==, uzbl.state.keycmd);
}
diff --git a/tests/test-expand.c b/tests/test-expand.c
index 0ced1f4..f01e5c7 100644
--- a/tests/test-expand.c
+++ b/tests/test-expand.c
@@ -79,10 +79,10 @@ test_NAME (void) {
void
test_MODE (void) {
- set_var_value("insert_mode", "0");
+ set_var_value("forward_keys", "0");
g_assert_cmpstr(expand("@MODE", 0), ==, "C");
- set_var_value("insert_mode", "1");
+ set_var_value("forward_keys", "1");
g_assert_cmpstr(expand("@MODE", 0), ==, "I");
}
diff --git a/uzbl-core.c b/uzbl-core.c
index e0af0e4..2ad11ac 100644
--- a/uzbl-core.c
+++ b/uzbl-core.c
@@ -126,14 +126,10 @@ const struct var_name_to_ptr_t {
{ "status_pbar_pending", PTR_V_STR(uzbl.gui.sbar.progress_u, 1, update_title)},
{ "status_pbar_width", PTR_V_INT(uzbl.gui.sbar.progress_w, 1, update_title)},
{ "status_background", PTR_V_STR(uzbl.behave.status_background, 1, update_title)},
- { "insert_indicator", PTR_V_STR(uzbl.behave.insert_indicator, 1, update_indicator)},
- { "command_indicator", PTR_V_STR(uzbl.behave.cmd_indicator, 1, update_indicator)},
{ "title_format_long", PTR_V_STR(uzbl.behave.title_format_long, 1, update_title)},
{ "title_format_short", PTR_V_STR(uzbl.behave.title_format_short, 1, update_title)},
{ "icon", PTR_V_STR(uzbl.gui.icon, 1, set_icon)},
- { "insert_mode", PTR_V_INT(uzbl.behave.insert_mode, 1, set_mode_indicator)},
- { "always_insert_mode", PTR_V_INT(uzbl.behave.always_insert_mode, 1, cmd_always_insert_mode)},
- { "reset_command_mode", PTR_V_INT(uzbl.behave.reset_command_mode, 1, NULL)},
+ { "forward_keys", PTR_V_INT(uzbl.behave.forward_keys, 1, NULL)},
{ "load_finish_handler", PTR_V_STR(uzbl.behave.load_finish_handler, 1, NULL)},
{ "load_start_handler", PTR_V_STR(uzbl.behave.load_start_handler, 1, NULL)},
{ "load_commit_handler", PTR_V_STR(uzbl.behave.load_commit_handler, 1, NULL)},
@@ -186,7 +182,6 @@ const struct var_name_to_ptr_t {
{ "LOAD_PROGRESSBAR", PTR_C_STR(uzbl.gui.sbar.progress_bar, NULL)},
{ "TITLE", PTR_C_STR(uzbl.gui.main_title, NULL)},
{ "SELECTED_URI", PTR_C_STR(uzbl.state.selected_url, NULL)},
- { "MODE", PTR_C_STR(uzbl.gui.sbar.mode_indicator, NULL)},
{ "NAME", PTR_C_STR(uzbl.state.instance_name, NULL)},
{ "PID", PTR_C_STR(uzbl.info.pid_str, NULL)},
@@ -923,10 +918,7 @@ load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data) {
g_free (uzbl.state.uri);
GString* newuri = g_string_new (webkit_web_frame_get_uri (frame));
uzbl.state.uri = g_string_free (newuri, FALSE);
- if (uzbl.behave.reset_command_mode && uzbl.behave.insert_mode) {
- set_insert_mode(uzbl.behave.always_insert_mode);
- update_title();
- }
+
if (uzbl.behave.load_commit_handler)
run_handler(uzbl.behave.load_commit_handler, uzbl.state.uri);
@@ -981,7 +973,6 @@ struct {const char *key; CommandInfo value;} cmdlist[] =
{ "search", {search_forward_text, TRUE} },
{ "search_reverse", {search_reverse_text, TRUE} },
{ "dehilight", {dehilight, 0} },
- { "toggle_insert_mode", {toggle_insert_mode, 0} },
{ "set", {set_var, TRUE} },
{ "dump_config", {act_dump_config, 0} },
{ "dump_config_as_events", {act_dump_config_as_events, 0} },
@@ -1088,42 +1079,6 @@ act_dump_config_as_events() {
}
void
-set_mode_indicator() {
- uzbl.gui.sbar.mode_indicator = (uzbl.behave.insert_mode ?
- uzbl.behave.insert_indicator : uzbl.behave.cmd_indicator);
-}
-
-void
-update_indicator() {
- set_mode_indicator();
- update_title();
-}
-
-void
-set_insert_mode(gboolean mode) {
- uzbl.behave.insert_mode = mode;
- send_event(VARIABLE_SET, uzbl.behave.insert_mode ? "insert_mode int 1" : "insert_mode int 0", NULL);
- set_mode_indicator();
-}
-
-void
-toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result) {
- (void) page; (void) result;
-
- if (argv_idx(argv, 0)) {
- if (strcmp (argv_idx(argv, 0), "0") == 0) {
- set_insert_mode(FALSE);
- } else {
- set_insert_mode(TRUE);
- }
- } else {
- set_insert_mode( !uzbl.behave.insert_mode );
- }
-
- update_title();
-}
-
-void
load_uri (WebKitWebView *web_view, GArray *argv, GString *result) {
(void) result;
@@ -1727,12 +1682,6 @@ cmd_load_uri() {
}
void
-cmd_always_insert_mode() {
- set_insert_mode(uzbl.behave.always_insert_mode);
- update_title();
-}
-
-void
cmd_max_conns() {
g_object_set(G_OBJECT(uzbl.net.soup_session),
SOUP_SESSION_MAX_CONNS, uzbl.net.max_conns, NULL);
@@ -2374,7 +2323,7 @@ key_press_cb (GtkWidget* window, GdkEventKey* event) {
if(event->type == GDK_KEY_PRESS)
key_to_event(event->keyval, GDK_KEY_PRESS);
- return uzbl.behave.insert_mode ? FALSE : TRUE;
+ return uzbl.behave.forward_keys ? FALSE : TRUE;
}
gboolean
@@ -2889,10 +2838,6 @@ initialize(int argc, char *argv[]) {
uzbl.gui.sbar.progress_u = g_strdup("ยท");
uzbl.gui.sbar.progress_w = 10;
- /* default mode indicators */
- uzbl.behave.insert_indicator = g_strdup("I");
- uzbl.behave.cmd_indicator = g_strdup("C");
-
uzbl.info.webkit_major = WEBKIT_MAJOR_VERSION;
uzbl.info.webkit_minor = WEBKIT_MINOR_VERSION;
uzbl.info.webkit_micro = WEBKIT_MICRO_VERSION;
@@ -2982,9 +2927,6 @@ main (int argc, char* argv[]) {
settings_init ();
- if (!uzbl.behave.always_insert_mode)
- set_insert_mode(FALSE);
-
if (!uzbl.behave.show_status)
gtk_widget_hide(uzbl.gui.mainbar);
else
diff --git a/uzbl-core.h b/uzbl-core.h
index b88dd7e..55f5eb1 100644
--- a/uzbl-core.h
+++ b/uzbl-core.h
@@ -18,7 +18,6 @@ typedef struct {
gchar *progress_s, *progress_u;
int progress_w;
gchar *progress_bar;
- gchar *mode_indicator;
} StatusBar;
@@ -107,11 +106,9 @@ typedef struct {
gchar* fantasy_font_family;
gchar* cursive_font_family;
gchar* scheme_handler;
- gboolean always_insert_mode;
gboolean show_status;
- gboolean insert_mode;
+ gboolean forward_keys;
gboolean status_top;
- gboolean reset_command_mode;
guint modmask;
guint http_debug;
gchar* shell_cmd;
@@ -136,8 +133,6 @@ typedef struct {
guint caret_browsing;
guint mode;
gchar* base_url;
- gchar* insert_indicator;
- gchar* cmd_indicator;
gboolean print_version;
/* command list: (key)name -> (value)Command */
@@ -302,18 +297,6 @@ void
set_keycmd();
void
-set_mode_indicator();
-
-void
-update_indicator();
-
-void
-set_insert_mode(gboolean mode);
-
-void
-toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
-
-void
load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
void
@@ -505,9 +488,6 @@ void
move_statusbar();
void
-cmd_always_insert_mode();
-
-void
cmd_http_debug();
void