diff options
Diffstat (limited to 'src/uzbl-core.c')
-rw-r--r-- | src/uzbl-core.c | 84 |
1 files changed, 51 insertions, 33 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 4125514..cb20fd7 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -85,7 +85,7 @@ const struct var_name_to_ptr_t { { "show_status", PTR_V_INT(uzbl.behave.show_status, 1, cmd_set_status)}, { "status_top", PTR_V_INT(uzbl.behave.status_top, 1, move_statusbar)}, { "status_format", PTR_V_STR(uzbl.behave.status_format, 1, NULL)}, - { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, NULL)}, + { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, set_status_background)}, { "title_format_long", PTR_V_STR(uzbl.behave.title_format_long, 1, NULL)}, { "title_format_short", PTR_V_STR(uzbl.behave.title_format_short, 1, NULL)}, { "icon", PTR_V_STR(uzbl.gui.icon, 1, set_icon)}, @@ -117,6 +117,7 @@ const struct var_name_to_ptr_t { { "fantasy_font_family", PTR_V_STR(uzbl.behave.fantasy_font_family, 1, cmd_fantasy_font_family)}, { "monospace_size", PTR_V_INT(uzbl.behave.monospace_size, 1, cmd_font_size)}, { "minimum_font_size", PTR_V_INT(uzbl.behave.minimum_font_size, 1, cmd_minimum_font_size)}, + { "enable_pagecache", PTR_V_INT(uzbl.behave.enable_pagecache, 1, cmd_enable_pagecache)}, { "disable_plugins", PTR_V_INT(uzbl.behave.disable_plugins, 1, cmd_disable_plugins)}, { "disable_scripts", PTR_V_INT(uzbl.behave.disable_scripts, 1, cmd_disable_scripts)}, { "autoload_images", PTR_V_INT(uzbl.behave.autoload_img, 1, cmd_autoload_img)}, @@ -654,7 +655,8 @@ struct {const char *key; CommandInfo value;} cmdlist[] = { "menu_image_remove", {menu_remove_image, TRUE} }, { "menu_editable_remove", {menu_remove_edit, TRUE} }, { "hardcopy", {hardcopy, TRUE} }, - { "include", {include, TRUE} } + { "include", {include, TRUE} }, + { "show_inspector", {show_inspector, 0} } }; void @@ -946,6 +948,13 @@ include(WebKitWebView *page, GArray *argv, GString *result) { } void +show_inspector(WebKitWebView *page, GArray *argv, GString *result) { + (void) page; (void) argv; (void) result; + + webkit_web_inspector_show(uzbl.gui.inspector); +} + +void act_dump_config() { dump_config(); } @@ -1211,6 +1220,7 @@ run_command (const gchar *command, const guint npre, const gchar **args, gchar *pid = itos(getpid()); gchar *xwin = itos(uzbl.xwin); guint i; + sharg_append(a, command); for (i = 0; i < npre; i++) /* add n args before the default vars */ sharg_append(a, args[i]); @@ -1817,32 +1827,29 @@ void update_title (void) { Behaviour *b = &uzbl.behave; gchar *parsed; + const gchar *current_title; + /* this check is here because if we're starting up or shutting down it might not be a window */ + gboolean have_main_window = !uzbl.state.plug_mode && GTK_IS_WINDOW(uzbl.gui.main_window); + + if(have_main_window) + current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window)); if (b->show_status) { - if (b->title_format_short) { + if (b->title_format_short && have_main_window) { parsed = expand(b->title_format_short, 0); - if (uzbl.gui.main_window) + if(!current_title || strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } - if (b->status_format) { + if (b->status_format && GTK_IS_LABEL(uzbl.gui.mainbar_label)) { parsed = expand(b->status_format, 0); gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label), parsed); g_free(parsed); } - if (b->status_background) { - GdkColor color; - gdk_color_parse (b->status_background, &color); - //labels and hboxes do not draw their own background. applying this on the vbox/main_window is ok as the statusbar is the only affected widget. (if not, we could also use GtkEventBox) - if (uzbl.gui.main_window) - gtk_widget_modify_bg (uzbl.gui.main_window, GTK_STATE_NORMAL, &color); - else if (uzbl.gui.plug) - gtk_widget_modify_bg (GTK_WIDGET(uzbl.gui.plug), GTK_STATE_NORMAL, &color); - } } else { - if (b->title_format_long) { + if (b->title_format_long && have_main_window) { parsed = expand(b->title_format_long, 0); - if (uzbl.gui.main_window) + if(!current_title || strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } @@ -1861,12 +1868,10 @@ create_browser () { "signal::button-press-event", (GCallback)button_press_cb, NULL, "signal::button-release-event", (GCallback)button_release_cb, NULL, "signal::motion-notify-event", (GCallback)motion_notify_cb, NULL, - "signal::title-changed", (GCallback)title_change_cb, NULL, + "signal::notify::title", (GCallback)title_change_cb, NULL, "signal::selection-changed", (GCallback)selection_changed_cb, NULL, - "signal::load-progress-changed", (GCallback)progress_change_cb, NULL, - "signal::load-committed", (GCallback)load_commit_cb, NULL, - "signal::load-started", (GCallback)load_start_cb, NULL, - "signal::load-finished", (GCallback)load_finish_cb, NULL, + "signal::notify::progress", (GCallback)progress_change_cb, NULL, + "signal::notify::load-status", (GCallback)load_status_change_cb, NULL, "signal::load-error", (GCallback)load_error_cb, NULL, "signal::hovering-over-link", (GCallback)link_hover_cb, NULL, "signal::navigation-policy-decision-requested", (GCallback)navigation_decision_cb, NULL, @@ -2258,6 +2263,7 @@ initialize(int argc, char *argv[]) { void load_uri_imp(gchar *uri) { GString* newuri; + SoupURI* soup_uri; /* Strip leading whitespaces */ while (*uri) { @@ -2269,26 +2275,28 @@ load_uri_imp(gchar *uri) { eval_js(uzbl.gui.web_view, uri, NULL, "javascript:"); return; } + newuri = g_string_new (uri); - if (!soup_uri_new(uri)) { - GString* fullpath = g_string_new (""); + soup_uri = soup_uri_new(uri); + + if (!soup_uri) { + gchar* fullpath; if (g_path_is_absolute (newuri->str)) - g_string_assign (fullpath, newuri->str); + fullpath = newuri->str; else { - gchar* wd; - wd = g_get_current_dir (); - g_string_assign (fullpath, g_build_filename (wd, newuri->str, NULL)); - free(wd); + gchar* wd = g_get_current_dir (); + fullpath = g_build_filename (wd, newuri->str, NULL); + g_free(wd); } struct stat stat_result; - if (! g_stat(fullpath->str, &stat_result)) { - g_string_prepend (fullpath, "file://"); - g_string_assign (newuri, fullpath->str); - } + if (! g_stat(fullpath, &stat_result)) + g_string_printf (newuri, "file://%s", fullpath); else g_string_prepend (newuri, "http://"); - g_string_free (fullpath, TRUE); + } else { + soup_uri_free(soup_uri); } + /* if we do handle cookies, ask our handler for them */ webkit_web_view_load_uri (uzbl.gui.web_view, newuri->str); g_string_free (newuri, TRUE); @@ -2339,6 +2347,16 @@ main (int argc, char* argv[]) { uzbl.gui.bar_h = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_h); gtk_widget_set_scroll_adjustments ((GtkWidget*) uzbl.gui.web_view, uzbl.gui.bar_h, uzbl.gui.bar_v); + g_object_connect((GObject*)uzbl.gui.bar_v, + "signal::value-changed", (GCallback)scroll_vert_cb, NULL, + "signal::changed", (GCallback)scroll_vert_cb, NULL, + NULL); + + g_object_connect((GObject*)uzbl.gui.bar_h, + "signal::value-changed", (GCallback)scroll_horiz_cb, NULL, + "signal::changed", (GCallback)scroll_horiz_cb, NULL, + NULL); + if(!uzbl.state.instance_name) uzbl.state.instance_name = itos((int)uzbl.xwin); |