GOptionEntry entries[] =
{
{ "uri", 'u', 0, G_OPTION_ARG_STRING, &uzbl.state.uri,
- "Uri to load at startup (equivalent to 'set uri = URI')", "URI" },
+ "Uri to load at startup (equivalent to 'uzbl <uri>' or 'set uri = URI' after uzbl has launched)", "URI" },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &uzbl.state.verbose,
"Whether to print all messages or just errors.", NULL },
{ "name", 'n', 0, G_OPTION_ARG_STRING, &uzbl.state.instance_name,
"Name of the current instance (defaults to Xorg window id)", "NAME" },
{ "config", 'c', 0, G_OPTION_ARG_STRING, &uzbl.state.config_file,
- "Config file (this is pretty much equivalent to uzbl < FILE )", "FILE" },
+ "Path to config file or '-' for stdin", "FILE" },
{ "socket", 's', 0, G_OPTION_ARG_INT, &uzbl.state.socket_id,
"Socket ID", "SOCKET" },
{ "geometry", 'g', 0, G_OPTION_ARG_STRING, &uzbl.gui.geometry,
};
/* 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. */
void **ptr;
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 = malloc(sizeof(char *));
+ *c->ptr = 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;
}
}
-GtkWidget*
+void
create_browser () {
GUI *g = &uzbl.gui;
- GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- //main_window_ref = g_object_ref(scrolled_window);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_NEVER); //todo: some sort of display of position/total length. like what emacs does
-
g->web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
- gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (g->web_view));
g_signal_connect (G_OBJECT (g->web_view), "notify::title", G_CALLBACK (title_change_cb), NULL);
g_signal_connect (G_OBJECT (g->web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), g->web_view);
g_signal_connect (G_OBJECT (g->web_view), "download-requested", G_CALLBACK (download_cb), g->web_view);
g_signal_connect (G_OBJECT (g->web_view), "create-web-view", G_CALLBACK (create_web_view_cb), g->web_view);
g_signal_connect (G_OBJECT (g->web_view), "mime-type-policy-decision-requested", G_CALLBACK (mime_policy_cb), g->web_view);
-
- return scrolled_window;
}
GtkWidget*
}
void
-retreive_geometry() {
+retrieve_geometry() {
int w, h, x, y;
GString *buf = g_string_new("");
* external applications need to do anyhow */
void
initialize(int argc, char *argv[]) {
- gtk_init (&argc, &argv);
if (!g_thread_supported ())
g_thread_init (NULL);
uzbl.state.executable_path = g_strdup(argv[0]);
commands_hash ();
make_var_to_name_hash();
- uzbl.gui.scrolled_win = create_browser();
+ create_browser();
}
#ifndef UZBL_LIBRARY
main (int argc, char* argv[]) {
initialize(argc, argv);
+ gtk_init (&argc, &argv);
+
+ uzbl.gui.scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+ //main_window_ref = g_object_ref(scrolled_window);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (uzbl.gui.scrolled_win),
+ GTK_POLICY_NEVER, GTK_POLICY_NEVER); //todo: some sort of display of position/total length. like what emacs does
+
+ gtk_container_add (GTK_CONTAINER (uzbl.gui.scrolled_win),
+ GTK_WIDGET (uzbl.gui.web_view));
+
uzbl.gui.vbox = gtk_vbox_new (FALSE, 0);
create_mainbar();
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)
+ uri_override = g_strdup(argv[1]);
gboolean verbose_override = uzbl.state.verbose;
settings_init ();