#include <errno.h>
#include <fcntl.h>
#include <signal.h>
+#include <assert.h>
#include <poll.h>
#include <sys/uio.h>
#include <sys/ioctl.h>
enum ptr_type {TYPE_INT, TYPE_STR, TYPE_FLOAT};
/* associate command names to their properties */
-typedef const struct {
+typedef struct {
/* TODO: Make this ambiguous void **ptr into a union { char *char_p; int *int_p; float *float_p; } val;
the PTR() macro is kind of preventing this change at the moment. */
enum ptr_type type;
the above setting and we don't want to end up with
wrong geometry information
*/
- retreive_geometry();
+ retrieve_geometry();
}
void
{ "keycmd_nl", {keycmd_nl, TRUE} },
{ "keycmd_bs", {keycmd_bs, 0} },
{ "chain", {chain, 0} },
- { "print", {print, TRUE} }
+ { "print", {print, TRUE} },
+ { "update_gui", {update_gui, TRUE} }
};
void
}
void
+update_gui(WebKitWebView *page, GArray *argv, GString *result) {
+ (void) page; (void) argv; (void) result;
+
+ update_title();
+}
+
+void
print(WebKitWebView *page, GArray *argv, GString *result) {
(void) page; (void) result;
gchar* buf;
void
move_statusbar() {
+ if (!uzbl.gui.scrolled_win &&
+ !uzbl.gui.mainbar)
+ return;
+
gtk_widget_ref(uzbl.gui.scrolled_win);
gtk_widget_ref(uzbl.gui.mainbar);
gtk_container_remove(GTK_CONTAINER(uzbl.gui.vbox), uzbl.gui.scrolled_win);
uzbl_cmdprop *c = NULL;
char *endp = NULL;
char *buf = NULL;
+ char *invalid_chars = "^°!\"§$%&/()=?'`'+~*'#-.:,;@<>| \\{}[]¹²³¼½";
if( (c = g_hash_table_lookup(uzbl.comm.proto_var, name)) ) {
if(!c->writeable) return FALSE;
/* invoke a command specific function */
if(c->func) c->func();
+ } else {
+ /* check wether name violates our naming scheme */
+ if(strpbrk(name, invalid_chars)) {
+ if (uzbl.state.verbose)
+ printf("Invalid variable name\n");
+ return FALSE;
+ }
+
+ /* custom vars */
+ c = malloc(sizeof(uzbl_cmdprop));
+ c->type = TYPE_STR;
+ c->dump = 0;
+ c->func = NULL;
+ c->writeable = 1;
+ buf = expand(val, 0);
+ c->ptr.s = malloc(sizeof(char *));
+ *c->ptr.s = buf;
+ g_hash_table_insert(uzbl.comm.proto_var,
+ g_strdup(name), (gpointer) c);
}
return TRUE;
}
(void) window;
(void) event;
- retreive_geometry();
+ retrieve_geometry();
return FALSE;
}
}
void
-retreive_geometry() {
+retrieve_geometry() {
int w, h, x, y;
GString *buf = g_string_new("");
if(uzbl.gui.geometry)
cmd_set_geometry();
else
- retreive_geometry();
+ retrieve_geometry();
gchar *uri_override = (uzbl.state.uri ? g_strdup(uzbl.state.uri) : NULL);
if (argc > 1 && !uzbl.state.uri)