> Index: render/html_redraw.c
>   
some gui_window references modified to browser_window, especially in
search branch
> ===================================================================
> --- render/html_redraw.c      (revision 8438)
> +++ render/html_redraw.c      (working copy)
> @@ -795,7 +795,7 @@
>  
>               /* what about the current search operation, if any? */
>               if (!highlighted && search_current_window ==
> -                             current_redraw_browser->window &&
> +                             current_redraw_browser &&
>                               gui_search_term_highlighted(
>                                               current_redraw_browser->window,
>                                               offset, offset + len,
> Index: render/textplain.c
> ===================================================================
> --- render/textplain.c        (revision 8438)
> +++ render/textplain.c        (working copy)
> @@ -427,7 +427,7 @@
>                                               highlighted = true;
>                               }
>  
> -                             if (!highlighted && search_current_window == 
> bw->window) {
> +                             if (!highlighted && search_current_window == 
> bw) {
>                                       unsigned start_idx, end_idx;
>                                       if 
> (gui_search_term_highlighted(bw->window,
>                                               tab_ofst, tab_ofst + 1,

> Index: gtk/gtk_gui.h
>   
modifications from 2 branches; glade branch for multiple glade files;
toolbar customization branch for toolbar glade file as well as toolbar
settings file
> ===================================================================
> --- gtk/gtk_gui.h     (revision 8438)
> +++ gtk/gtk_gui.h     (working copy)
> @@ -25,8 +25,18 @@
>  #include <glade/glade.h>
>  
>  extern bool gui_in_multitask;
> -extern GladeXML *gladeWindows;
> -extern char *glade_file_location;
> +extern GladeXML *gladeNetsurf;
> +extern GladeXML *gladePassword;
> +extern GladeXML *gladeWarning;
> +extern GladeXML *gladeLogin;
> +extern GladeXML *gladeSsl;
> +extern char *glade_netsurf_file_location;
> +extern char *glade_password_file_location;
> +extern char *glade_warning_file_location;
> +extern char *glade_login_file_location;
> +extern char *glade_ssl_file_location;
> +extern char *glade_toolbar_file_location;
> +extern char *toolbar_indices_file_location;
>  extern char *options_file_location;
>  extern char *res_dir_location;
>  extern char *print_options_file_location;

> Index: gtk/options.h
>   
the view source in new tab code slipped into the favicon branch as I recall
> ===================================================================
> --- gtk/options.h     (revision 8438)
> +++ gtk/options.h     (working copy)
> @@ -34,6 +34,8 @@
>  extern bool option_hover_urls;
>  extern bool option_focus_new;
>  extern bool option_new_blank;
> +extern bool option_source_tab;
> +extern int option_current_theme;
>  
>  #define EXTRA_OPTION_DEFINE \
>  bool option_render_resample = false; \
> @@ -48,7 +50,9 @@
>  int option_history_age = 0; \
>  bool option_hover_urls = false; \
>  bool option_focus_new = false; \
> -bool option_new_blank = false;
> +bool option_new_blank = false; \
> +bool option_source_tab = false;\
> +int option_current_theme = 0;
>  
>  #define EXTRA_OPTION_TABLE \
>  { "render_resample", OPTION_BOOL,    &option_render_resample }, \
> @@ -63,6 +67,8 @@
>  { "history_age",             OPTION_INTEGER, &option_history_age}, \
>  { "hover_urls",                      OPTION_BOOL,    &option_hover_urls}, \
>  { "focus_new",                       OPTION_BOOL,    &option_focus_new}, \
> -{ "new_blank",                       OPTION_BOOL,    &option_new_blank}
> +{ "new_blank",                       OPTION_BOOL,    &option_new_blank}, \
> +{ "source_tab",                      OPTION_BOOL,    &option_source_tab},\
> +{ "current_theme",           OPTION_INTEGER, &option_current_theme}
>  
>  #endif
> Index: gtk/gtk_download.c
>   
from gtkmain branch; after merging, reinstating encapsulation privacy of
gui_window
> ===================================================================
> --- gtk/gtk_download.c        (revision 8438)
> +++ gtk/gtk_download.c        (working copy)
> @@ -33,6 +33,7 @@
>  #include "gtk/gtk_scaffolding.h"
>  #include "gtk/options.h"
>  #include "gtk/gtk_download.h"
> +#include "gtk/gtk_window.h"
>  
>  #define UPDATE_RATE 500 /* In milliseconds */
>  #define GLADE_NAME "downloads.glade"
> @@ -206,7 +207,8 @@
>                       messages_get("gtkUnknownSize") :
>                       human_friendly_bytesize(total_size));
>       
> -     nsgtk_download_parent = nsgtk_scaffolding_get_window(gui);
> +     nsgtk_download_parent = nsgtk_scaffolding_window(nsgtk_get_scaffold(
> +                     gui));
>       struct gui_download_window *download = malloc(sizeof *download);
>       
>       if (url_nice(url, &filename, false) != URL_FUNC_OK)

> Index: gtk/gtk_window.c
>   
encapsulation privacy; clearing duplicate functions; additional
references [signal handlers] for toolbar customization; hide local
history window when main window clicked
> ===================================================================
> --- gtk/gtk_window.c  (revision 8438)
> +++ gtk/gtk_window.c  (working copy)
> @@ -22,6 +22,7 @@
>  #include "gtk/gtk_window.h"
>  #include "desktop/browser.h"
>  #include "desktop/options.h"
> +#include "desktop/searchweb.h"
>  #include "desktop/textinput.h"
>  #include "desktop/selection.h"
>  #include "gtk/gtk_gui.h"
> @@ -35,6 +36,37 @@
>  #include <gdk/gdkkeysyms.h>
>  #include <assert.h>
>  
> +struct gui_window {
> +     /* All gui_window objects have an ultimate scaffold */
> +     nsgtk_scaffolding       *scaffold;
> +     /* A gui_window is the rendering of a browser_window */
> +     struct browser_window   *bw;
> +     struct browser_mouse    *mouse;
> +
> +     /* These are the storage for the rendering */
> +     int                     caretx, carety, careth;
> +     gui_pointer_shape       current_pointer;
> +     int                     last_x, last_y;
> +
> +     /* Within GTK, a gui_window is a scrolled window
> +      * with a viewport inside
> +      * with a gtkfixed in that
> +      * with a drawing area in that
> +      * The scrolled window is optional and only chosen
> +      * for frames which need it. Otherwise we just use
> +      * a viewport.
> +      */
> +     GtkWidget               *tab;
> +     GtkScrolledWindow       *scrolledwindow;
> +     GtkViewport             *viewport;
> +     GtkFixed                *fixed;
> +     GtkDrawingArea          *drawing_area;
> +     gulong                  signalhandler[2];
> +
> +     /* Keep gui_windows in a list for cleanup later */
> +     struct gui_window       *next, *prev;
> +};
> +
>  struct gui_window *window_list = 0;  /**< first entry in win list*/
>  int temp_open_background = -1;
>  
> @@ -60,21 +92,47 @@
>  
>  static GdkCursor *nsgtk_create_menu_cursor(void);
>  
> -struct browser_window *nsgtk_get_browser_window(struct gui_window *g)
> +nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g)
>  {
> +        return g->scaffold;
> +}
> +
> +struct browser_window *gui_window_get_browser_window(struct gui_window *g)
> +{
>       return g->bw;
>  }
>  
> -nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g)
> +unsigned long nsgtk_window_get_signalhandler(struct gui_window *g, int i)
>  {
> -        return g->scaffold;
> +     return g->signalhandler[i];
>  }
>  
> -struct browser_window *nsgtk_get_browser_for_gui(struct gui_window *g)
> +GtkDrawingArea *nsgtk_window_get_drawing_area(struct gui_window *g)
>  {
> -        return g->bw;
> +     return g->drawing_area;
>  }
>  
> +GtkScrolledWindow *nsgtk_window_get_scrolledwindow(struct gui_window *g)
> +{
> +     return g->scrolledwindow;
> +}
> +
> +GtkWidget *nsgtk_window_get_tab(struct gui_window *g)
> +{
> +     return g->tab;
> +}
> +
> +void nsgtk_window_set_tab(struct gui_window *g, GtkWidget *w)
> +{
> +     g->tab = w;
> +}
> +
> +
> +struct gui_window *nsgtk_window_iterate(struct gui_window *g)
> +{
> +     return g->next;
> +}
> +
>  float nsgtk_get_scale_for_gui(struct gui_window *g)
>  {
>          return g->bw->scale;
> @@ -111,13 +169,6 @@
>  
>       g->careth = 0;
>  
> -        /* Attach ourselves to the list (push_top) */
> -     if (window_list)
> -             window_list->prev = g;
> -             g->next = window_list;
> -             g->prev = NULL;
> -             window_list = g;
> -
>       if (bw->parent != NULL)
>               /* Find our parent's scaffolding */
>               g->scaffold = bw->parent->window->scaffold;
> @@ -127,9 +178,20 @@
>       else
>               /* Now construct and attach a scaffold */
>               g->scaffold = nsgtk_new_scaffolding(g);
> +     if (g->scaffold == NULL) {
> +             free(g);
> +             return NULL;
> +     }
>  
> -        /* Construct our primary elements */
> -        g->fixed = GTK_FIXED(gtk_fixed_new());
> +        /* Attach ourselves to the list (push_top) */
> +     if (window_list)
> +             window_list->prev = g;
> +     g->next = window_list;
> +     g->prev = NULL;
> +     window_list = g;
> +     
> +     /* Construct our primary elements */
> +     g->fixed = GTK_FIXED(gtk_fixed_new());
>          g->drawing_area = GTK_DRAWING_AREA(gtk_drawing_area_new());
>          gtk_fixed_put(g->fixed, GTK_WIDGET(g->drawing_area), 0, 0);
>          gtk_container_set_border_width(GTK_CONTAINER(g->fixed), 0);
> @@ -229,17 +291,18 @@
>  
>  #define CONNECT(obj, sig, callback, ptr) \
>       g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
> -     CONNECT(g->drawing_area, "expose_event", nsgtk_window_expose_event, g);
> +     g->signalhandler[0] = CONNECT(g->drawing_area, "expose_event",
> +                     nsgtk_window_expose_event, g);
>       CONNECT(g->drawing_area, "motion_notify_event",
> -             nsgtk_window_motion_notify_event, g);
> -     CONNECT(g->drawing_area, "button_press_event",
> -             nsgtk_window_button_press_event, g);
> +                     nsgtk_window_motion_notify_event, g);
> +     g->signalhandler[1] = CONNECT(g->drawing_area, "button_press_event",
> +                     nsgtk_window_button_press_event, g);
>       CONNECT(g->drawing_area, "button_release_event",
> -         nsgtk_window_button_release_event, g);
> +                     nsgtk_window_button_release_event, g);
>       CONNECT(g->drawing_area, "key_press_event",
> -             nsgtk_window_keypress_event, g);
> +                     nsgtk_window_keypress_event, g);
>       CONNECT(g->viewport, "size_allocate",
> -             nsgtk_window_size_allocate_event, g);
> +                     nsgtk_window_size_allocate_event, g);
>  
>          return g;
>  }
> @@ -382,6 +445,8 @@
>       struct gui_window *g = data;
>  
>       gtk_widget_grab_focus(GTK_WIDGET(g->drawing_area));
> +     gtk_widget_hide(GTK_WIDGET(nsgtk_scaffolding_history_window(
> +                     g->scaffold)->window));
>  
>       g->mouse->pressed_x = event->x / g->bw->scale;
>       g->mouse->pressed_y = event->y / g->bw->scale;
> @@ -562,7 +627,7 @@
>  {
>       for (struct gui_window *g = window_list; g; g = g->next) {
>                  nsgtk_tab_options_changed(GTK_WIDGET(
> -                                                     
> nsgtk_scaffolding_get_notebook(g)));
> +                             nsgtk_scaffolding_notebook(g->scaffold)));
>               g->bw->reformat_pending = true;
>          }
>  
> @@ -697,7 +762,13 @@
>          gtk_adjustment_set_value(hadj, x);
>  }
>  
> +void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
> +             int x1, int y1)
> +{
> +     gui_window_set_scroll(g,x0,y0);
> +}
>  
> +
>  /**
>   * Set the scale setting of a window
>   *
> Index: gtk/gtk_window.h
> ===================================================================
> --- gtk/gtk_window.h  (revision 8438)
> +++ gtk/gtk_window.h  (working copy)
> @@ -23,36 +23,6 @@
>  #include "desktop/browser.h"
>  #include "gtk/gtk_scaffolding.h"
>  
> -struct gui_window {
> -     /* All gui_window objects have an ultimate scaffold */
> -     nsgtk_scaffolding       *scaffold;
> -     /* A gui_window is the rendering of a browser_window */
> -     struct browser_window   *bw;
> -     struct browser_mouse    *mouse;
> -
> -     /* These are the storage for the rendering */
> -     int                     caretx, carety, careth;
> -     gui_pointer_shape       current_pointer;
> -     int                     last_x, last_y;
> -
> -     /* Within GTK, a gui_window is a scrolled window
> -      * with a viewport inside
> -      * with a gtkfixed in that
> -      * with a drawing area in that
> -      * The scrolled window is optional and only chosen
> -      * for frames which need it. Otherwise we just use
> -      * a viewport.
> -      */
> -     GtkWidget               *tab;
> -     GtkScrolledWindow       *scrolledwindow;
> -     GtkViewport             *viewport;
> -     GtkFixed                *fixed;
> -     GtkDrawingArea          *drawing_area;
> -
> -     /* Keep gui_windows in a list for cleanup later */
> -     struct gui_window       *next, *prev;
> -};
> -
>  struct browser_mouse {
>       struct gui_window *gui;
>       struct box *box;
> @@ -63,19 +33,23 @@
>       browser_mouse_state state;
>  };
>  
> -extern struct gui_window * window_list;
> +extern struct gui_window *window_list;
>  extern int temp_open_background;
>  
>  void nsgtk_reflow_all_windows(void);
>  void nsgtk_window_process_reformats(void);
>  
>  nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g);
> -struct browser_window *nsgtk_get_browser_for_gui(struct gui_window *g);
>  
>  float nsgtk_get_scale_for_gui(struct gui_window *g);
>  int nsgtk_gui_window_update_targets(struct gui_window *g);
>  void nsgtk_window_destroy_browser(struct gui_window *g);
> +unsigned long nsgtk_window_get_signalhandler(struct gui_window *g, int i);
> +GtkDrawingArea *nsgtk_window_get_drawing_area(struct gui_window *g);
> +struct gui_window *nsgtk_window_iterate(struct gui_window *g);
> +GtkScrolledWindow *nsgtk_window_get_scrolledwindow(struct gui_window *g);
> +GtkWidget *nsgtk_window_get_tab(struct gui_window *g);
> +void nsgtk_window_set_tab(struct gui_window *g, GtkWidget *w);
>  
> -struct browser_window *nsgtk_get_browser_window(struct gui_window *g);
>  
>  #endif /* NETSURF_GTK_WINDOW_H */

> Index: gtk/dialogs/gtk_source.c
>   
view source in new tab code from the first branch I wrote; improved
indentation of view source code;
> ===================================================================
> --- gtk/dialogs/gtk_source.c  (revision 8438)
> +++ gtk/dialogs/gtk_source.c  (working copy)
> @@ -28,8 +28,10 @@
>  #include "gtk/gtk_gui.h"
>  #include "gtk/gtk_print.h"
>  #include "gtk/gtk_selection.h"
> +#include "gtk/options.h"
>  #include "desktop/netsurf.h"
>  #include "desktop/print.h"
> +#include "desktop/options.h"
>  #include "utils/messages.h"
>  #include "utils/url.h"
>  #include "utils/utils.h"
> @@ -61,6 +63,7 @@
>  static struct nsgtk_source_window *nsgtk_source_list = 0;
>  static char source_zoomlevel = 10;
>  
> +void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw);
>  static void nsgtk_attach_source_menu_handlers(GladeXML *xml, gpointer g);
>  static gboolean nsgtk_source_delete_event(GtkWindow *window, gpointer g);
>  static gboolean nsgtk_source_destroy_event(GtkWindow *window, gpointer g);
> @@ -103,111 +106,148 @@
>  
>  void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
>  {            
> -     if (bw->current_content->type == CONTENT_HTML) {
> -             glade_Location = g_strconcat(res_dir_location, "source.glade", 
> -                             NULL);
> -             glade_File = glade_xml_new(glade_Location, NULL, NULL);
> -             if (glade_File == NULL) {
> -                     LOG(("error loading glade tree"));
> -             }
> +     if (bw->current_content->type != CONTENT_HTML)
> +             return;
> +     
> +     if (option_source_tab) {
> +             nsgtk_source_tab_init(parent, bw);
> +             return;
> +     }
> +     
> +     glade_Location = g_strconcat(res_dir_location, "source.glade", 
> +                     NULL);
> +     glade_File = glade_xml_new(glade_Location, NULL, NULL);
> +     if (glade_File == NULL) {
> +             LOG(("error loading glade tree"));
> +     }
> +     g_free(glade_Location);
>  
> -             char *data = NULL;
> +     char *data = NULL;
>  
> -             utf8_convert_ret r = utf8_from_enc(
> -                             bw->current_content->source_data,
> -                             bw->current_content->data.html.encoding,
> -                             bw->current_content->source_size,
> -                             &data);
> -             if (r == UTF8_CONVERT_NOMEM) {
> -                     warn_user("NoMemory",0);
> -                     return;
> -             } else if (r == UTF8_CONVERT_BADENC) {
> -                     warn_user("EncNotRec",0);
> -                     return;
> -             }
> +     utf8_convert_ret r = utf8_from_enc(
> +                     bw->current_content->source_data,
> +                     bw->current_content->data.html.encoding,
> +                     bw->current_content->source_size,
> +                     &data);
> +     if (r == UTF8_CONVERT_NOMEM) {
> +             warn_user("NoMemory",0);
> +             return;
> +     } else if (r == UTF8_CONVERT_BADENC) {
> +             warn_user("EncNotRec",0);
> +             return;
> +     }
>  
> -             GtkWindow *wndSource = GTK_WINDOW(glade_xml_get_widget(
> -                             glade_File, "wndSource"));
> -             GtkWidget *cutbutton = glade_xml_get_widget(
> -                             glade_File, "source_cut");
> -             GtkWidget *pastebutton = glade_xml_get_widget(
> -                             glade_File, "source_paste");
> -             GtkWidget *deletebutton = glade_xml_get_widget(
> -                             glade_File, "source_delete");
> -             GtkWidget *printbutton = glade_xml_get_widget(
> -                             glade_File, "source_print");
> -             gtk_widget_set_sensitive(cutbutton, FALSE);
> -             gtk_widget_set_sensitive(pastebutton, FALSE);
> -             gtk_widget_set_sensitive(deletebutton, FALSE);
> -             /* for now */
> -             gtk_widget_set_sensitive(printbutton, FALSE);
> -                                                     
> -             struct nsgtk_source_window *thiswindow = 
> -                             malloc(sizeof(struct nsgtk_source_window));
> -             if (thiswindow == NULL) {
> -                     free(data);
> -                     warn_user("NoMemory", 0);
> -                     return;
> -             }
> +     GtkWindow *wndSource = GTK_WINDOW(glade_xml_get_widget(
> +                     glade_File, "wndSource"));
> +     GtkWidget *cutbutton = glade_xml_get_widget(
> +                     glade_File, "source_cut");
> +     GtkWidget *pastebutton = glade_xml_get_widget(
> +                     glade_File, "source_paste");
> +     GtkWidget *deletebutton = glade_xml_get_widget(
> +                     glade_File, "source_delete");
> +     GtkWidget *printbutton = glade_xml_get_widget(
> +                     glade_File, "source_print");
> +     gtk_widget_set_sensitive(cutbutton, FALSE);
> +     gtk_widget_set_sensitive(pastebutton, FALSE);
> +     gtk_widget_set_sensitive(deletebutton, FALSE);
> +     /* for now */
> +     gtk_widget_set_sensitive(printbutton, FALSE);
> +                                             
> +     struct nsgtk_source_window *thiswindow = 
> +                     malloc(sizeof(struct nsgtk_source_window));
> +     if (thiswindow == NULL) {
> +             free(data);
> +             warn_user("NoMemory", 0);
> +             return;
> +     }
>  
> -             thiswindow->url = strdup(bw->current_content->url);
> -             if (thiswindow->url == NULL) {
> -                     free(thiswindow);
> -                     free(data);
> -                     warn_user("NoMemory", 0);
> -                     return;
> -             }
> +     thiswindow->url = strdup(bw->current_content->url);
> +     if (thiswindow->url == NULL) {
> +             free(thiswindow);
> +             free(data);
> +             warn_user("NoMemory", 0);
> +             return;
> +     }
>  
> -             thiswindow->data = data;
> -             
> -             thiswindow->sourcewindow = wndSource;
> -             thiswindow->bw = bw;
> +     thiswindow->data = data;
>       
> -             char *title = malloc(strlen(bw->current_content->url) 
> -                             + SLEN("Source of ") + 1);
> -             if (title == NULL) {
> -                     free(thiswindow->url);
> -                     free(thiswindow);
> -                     free(data);
> -                     warn_user("NoMemory", 0);
> -                     return;
> -             }
> -             sprintf(title, "Source of %s", bw->current_content->url);
> +     thiswindow->sourcewindow = wndSource;
> +     thiswindow->bw = bw;
>  
> -             thiswindow->next = nsgtk_source_list;
> -             thiswindow->prev = NULL;
> -             if (nsgtk_source_list != NULL)
> -                     nsgtk_source_list->prev = thiswindow;
> -             nsgtk_source_list = thiswindow;
> -                                     
> -             nsgtk_attach_source_menu_handlers(glade_File, thiswindow);
> +     char *title = malloc(strlen(bw->current_content->url) 
> +                     + SLEN("Source of ") + 1);
> +     if (title == NULL) {
> +             free(thiswindow->url);
> +             free(thiswindow);
> +             free(data);
> +             warn_user("NoMemory", 0);
> +             return;
> +     }
> +     sprintf(title, "Source of %s", bw->current_content->url);
> +
> +     thiswindow->next = nsgtk_source_list;
> +     thiswindow->prev = NULL;
> +     if (nsgtk_source_list != NULL)
> +             nsgtk_source_list->prev = thiswindow;
> +     nsgtk_source_list = thiswindow;
>                               
> -             gtk_window_set_title(wndSource, title);
> +     nsgtk_attach_source_menu_handlers(glade_File, thiswindow);
>                       
> -             g_signal_connect(G_OBJECT(wndSource), "destroy",
> -                             G_CALLBACK(nsgtk_source_destroy_event),
> -                             thiswindow);
> -             g_signal_connect(G_OBJECT(wndSource), "delete-event", 
> -                             G_CALLBACK(nsgtk_source_delete_event),
> -                             thiswindow);
> +     gtk_window_set_title(wndSource, title);
> +             
> +     g_signal_connect(G_OBJECT(wndSource), "destroy",
> +                     G_CALLBACK(nsgtk_source_destroy_event),
> +                     thiswindow);
> +     g_signal_connect(G_OBJECT(wndSource), "delete-event", 
> +                     G_CALLBACK(nsgtk_source_delete_event),
> +                     thiswindow);
> +             
> +     GtkTextView *sourceview = GTK_TEXT_VIEW(
> +                     glade_xml_get_widget(glade_File, 
> +                     "source_view"));
> +     PangoFontDescription *fontdesc =
> +             pango_font_description_from_string("Monospace 8");
> +
> +     thiswindow->gv = sourceview;
> +     gtk_widget_modify_font(GTK_WIDGET(sourceview), fontdesc);
> +     GtkTextBuffer *tb = gtk_text_view_get_buffer(sourceview);
> +     gtk_text_buffer_set_text(tb, thiswindow->data, -1);
>                       
> -             GtkTextView *sourceview = GTK_TEXT_VIEW(
> -                             glade_xml_get_widget(glade_File, 
> -                             "source_view"));
> -             PangoFontDescription *fontdesc =
> -                     pango_font_description_from_string("Monospace 8");
> +     gtk_widget_show(GTK_WIDGET(wndSource));
>  
> -             thiswindow->gv = sourceview;
> -             gtk_widget_modify_font(GTK_WIDGET(sourceview), fontdesc);
> -             GtkTextBuffer *tb = gtk_text_view_get_buffer(sourceview);
> -             gtk_text_buffer_set_text(tb, thiswindow->data, -1);
> -                             
> -             gtk_widget_show(GTK_WIDGET(wndSource));
> -
> -             free(title);
> +     free(title);
> +}
> +void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
> +{
> +     char *ndata = 0;
> +     utf8_convert_ret r = utf8_from_enc(
> +                     bw->current_content->source_data,
> +                     bw->current_content->data.html.encoding,
> +                     bw->current_content->source_size,
> +                     &ndata);
> +     if (r == UTF8_CONVERT_NOMEM) {
> +             warn_user("NoMemory",0);
> +             return;
> +     } else if (r == UTF8_CONVERT_BADENC) {
> +             warn_user("EncNotRec",0);
> +             return;
>       }
> +     gchar *filename;
> +     gint handle = g_file_open_tmp("nsgtksourceXXXXXX", &filename, NULL);
> +     close (handle); /* in case it was binary mode */
> +     FILE *f = fopen(filename, "w");
> +     fprintf(f, "%s", ndata);
> +     fclose(f);
> +     filename = g_strconcat("file://", filename, NULL);
> +     struct browser_window *newbw = browser_window_create(filename, bw,
> +                     NULL, false, true);
> +     g_free(filename);
> +     if (newbw->current_content)
> +             newbw->current_content->title = g_strconcat("source of ", 
> +                             bw->current_content->url , NULL);
>  }
>  
> +
>  void nsgtk_attach_source_menu_handlers(GladeXML *xml, gpointer g)
>  {
>       struct menu_events *event = source_menu_events;

> Index: gtk/gtk_selection.c
> ===================================================================
> --- gtk/gtk_selection.c       (revision 8438)
> +++ gtk/gtk_selection.c       (working copy)
> @@ -79,7 +79,7 @@
>       else
>               g_string_set_size(current_selection, 0);
>               
> -     gtk_widget_grab_focus(GTK_WIDGET(g->drawing_area));
> +     gtk_widget_grab_focus(GTK_WIDGET(nsgtk_window_get_drawing_area(g)));
>  }
>  
>  void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
> @@ -89,7 +89,8 @@
>       text = gtk_clipboard_wait_for_text (clipboard);
>       /* clipboard_wait... converts the string to utf8 for us */
>       if (text != NULL)
> -             browser_window_paste_text(g->bw, text, strlen(text), true);
> +             browser_window_paste_text(gui_window_get_browser_window(g), 
> +                             text, strlen(text), true);
>       g_free(text);
>  }
>  

> Index: desktop/browser.c
>   
modifications from favicon branch; 'blank window' is an idea that really
needs further looking into; when I originally tried to write it I was
thinking a core dev could take it up further
> ===================================================================
> --- desktop/browser.c (revision 8438)
> +++ desktop/browser.c (working copy)
> @@ -85,6 +85,7 @@
>  static void browser_window_convert_to_download(struct browser_window *bw);
>  static void browser_window_start_throbber(struct browser_window *bw);
>  static void browser_window_stop_throbber(struct browser_window *bw);
> +static void browser_window_set_icon(struct browser_window *bw);
>  static void browser_window_set_status(struct browser_window *bw,
>               const char *text);
>  static void browser_window_set_pointer(struct gui_window *g,
> @@ -167,6 +168,23 @@
>       if (url)
>               browser_window_go(bw, url, referer, history_add);
>  
> +     else {
> +             LOG(("creating blank content"));
> +             struct content *c = content_create(" ");
> +             const char *params[] = { 0 };
> +             int length;
> +             const char *blankcontent = "<html><head><title>blank page \
> +             </title></head><body></body></html>";           
> +             length = strlen(blankcontent);
> +             if (content_set_type(c, CONTENT_HTML, "text/html", params) 
> +                             && content_process_data(c, blankcontent, 
> +                             length)) {
> +             /* here need to retrieve width, height from browser */
> +                     content_convert(c, c->width, c->height);
> +                     c->fresh = false;
> +             }
> +     }
> +     
>       return bw;
>  }
>  
> @@ -491,6 +509,7 @@
>               browser_window_update(bw, false);
>               browser_window_set_status(bw, c->status_message);
>               browser_window_stop_throbber(bw);
> +             browser_window_set_icon(bw);
>               history_update(bw->history, c);
>               hotlist_visited(c);
>               free(bw->referer);
> @@ -764,6 +783,21 @@
>       return false;
>  }
>  
> +/**
> + * when ready, set icon at top level
> + * \param bw browser_window
> + * current implementation ignores lower-levels' link rels completely
> + */
> +void browser_window_set_icon(struct browser_window *bw)
> +{
> +     while (bw->parent)
> +             bw = bw->parent;
> +     if ((bw->current_content != NULL) && (bw->current_content->type == 
> CONTENT_HTML))
> +             gui_window_set_icon(bw->window,
> +                             bw->current_content->data.html.favicon);
> +     else
> +             gui_window_set_icon(bw->window, NULL);
> +}
>  
>  /**
>   * Redraw browser window, set extent to content, and update title.
> Index: desktop/browser.h
> ===================================================================
> --- desktop/browser.h (revision 8438)
> +++ desktop/browser.h (working copy)
> @@ -213,6 +213,7 @@
>  
>  
>  extern struct browser_window *current_redraw_browser;
> +extern struct browser_window *search_current_window;
>  extern bool browser_reformat_pending;
>  
>  struct browser_window * browser_window_create(const char *url,

-- 
Mark

http://www.halloit.com

Key ID 046B65CF


Reply via email to