Redraw nsgtk browser windows when Choices...Apply is clicked.

svn path=/trunk/netsurf/; revision=2860
This commit is contained in:
Rob Kendrick 2006-08-17 20:03:28 +00:00
parent 097044996c
commit 20d7717c7d
3 changed files with 41 additions and 7 deletions

View File

@ -14,6 +14,7 @@
#include "netsurf/desktop/options.h"
#include "netsurf/gtk/options.h"
#include "netsurf/gtk/gtk_gui.h"
#include "netsurf/gtk/gtk_window.h"
#include "netsurf/gtk/gtk_options.h"
GtkWindow *wndChoices;
@ -156,5 +157,6 @@ void nsgtk_options_save(void) {
/* TODO: save the other options */
options_write(options_file_location);
nsgtk_reflow_all_windows();
}

View File

@ -65,6 +65,8 @@ struct gui_window {
struct gtk_history_window *history_window;
int last_x, last_y;
struct gui_window *next, *prev;
};
struct gtk_history_window {
@ -87,6 +89,7 @@ struct menu_events {
};
static int open_windows = 0; /**< current number of open browsers */
static struct gui_window *window_list = 0; /**< first entry in win list*/
static wchar_t gdkkey_to_nskey(GdkEventKey *);
static void nsgtk_window_destroy_event(GtkWidget *, gpointer);
@ -184,6 +187,16 @@ static struct menu_events menu_events[] = {
{ NULL, NULL }
};
void nsgtk_reflow_all_windows(void)
{
struct gui_window *g = window_list;
while (g != NULL) {
nsgtk_perform_deferred_resize(g);
g = g->next;
}
}
void nsgtk_attach_menu_handlers(GladeXML *xml, gpointer g)
{
struct menu_events *event = menu_events;
@ -240,10 +253,7 @@ void nsgtk_window_destroy_event(GtkWidget *widget, gpointer data)
{
struct gui_window *g = data;
gtk_widget_destroy(GTK_WIDGET(g->history_window->window));
gui_window_destroy(g);
if (--open_windows == 0)
netsurf_quit = true;
}
gboolean nsgtk_window_expose_event(GtkWidget *widget,
@ -663,6 +673,16 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
g->careth = 0;
/* add the window to the list of open windows. */
g->prev = 0;
g->next = window_list;
if (window_list)
window_list->prev = g;
window_list = g;
open_windows++;
/* load the window template from the glade xml file, and extract
* widget references from it for later use.
*/
@ -807,9 +827,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
/* set up the menu signal handlers */
nsgtk_attach_menu_handlers(g->xml, g);
/* increase the number of open windows. */
open_windows++;
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(g->window));
@ -819,7 +836,21 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
void gui_window_destroy(struct gui_window *g)
{
if (g->prev)
g->prev->next = g->next;
else
window_list = g->next;
if (g->next)
g->next->prev = g->prev;
gtk_widget_destroy(GTK_WIDGET(g->history_window->window));
gtk_widget_destroy(GTK_WIDGET(g->window));
free(g);
if (--open_windows == 0)
netsurf_quit = true;
}
void gui_window_set_title(struct gui_window *g, const char *title)

View File

@ -6,7 +6,7 @@
*/
#include <gtk/gtk.h>
#include "netsurf/desktop/plotters.h"
extern GtkWidget *current_widget;
extern GdkDrawable *current_drawable;
@ -18,3 +18,4 @@ extern cairo_t *current_cr;
void nsgtk_plot_set_scale(float s);
float nsgtk_plot_get_scale(void);
void nsgtk_set_colour(colour c);
void nsgtk_reflow_all_windows(void);