Daniel,

You were suggesting I should work at the bugs; now I understand what the
bug page is referring to, I've resolved the warnings, adding all the
functions/variables/prototypes as appropriate

– unless Rob has already solved it

Best

Mark

http://www.halloit.com

Key ID 046B65CF

Index: gtk/options.h
===================================================================
--- gtk/options.h	(revision 7048)
+++ gtk/options.h	(working copy)
@@ -27,6 +27,11 @@
 extern char *option_downloads_directory;
 extern char *option_url_file;
 extern bool option_show_single_tab;
+extern int option_button_type;
+extern bool option_disable_popups;
+extern bool option_disable_plugins;
+extern int option_history_age;
+extern bool option_hover_urls;
 
 #define EXTRA_OPTION_DEFINE \
 bool option_render_resample = false; \
@@ -34,7 +39,12 @@
 bool option_request_overwrite = true; \
 char *option_downloads_directory = 0; \
 char *option_url_file = 0;            \
-bool option_show_single_tab = false;
+bool option_show_single_tab = false; \
+int option_button_type = 0; \
+bool option_disable_popups = false; \
+bool option_disable_plugins = false; \
+int option_history_age = 0; \
+bool option_hover_urls = false;
 
 #define EXTRA_OPTION_TABLE \
 { "render_resample",	OPTION_BOOL,	&option_render_resample }, \
@@ -42,6 +52,11 @@
 { "request_overwrite",	OPTION_BOOL,	&option_request_overwrite }, \
 { "downloads_directory",OPTION_STRING,	&option_downloads_directory }, \
 { "url_file",		OPTION_STRING,	&option_url_file }, \
-{ "show_single_tab",    OPTION_BOOL,    &option_show_single_tab },
+{ "show_single_tab",    OPTION_BOOL,    &option_show_single_tab }, \
+{ "button_type",		OPTION_INTEGER, &option_button_type}, \
+{ "disable_popups",		OPTION_BOOL,	&option_disable_popups}, \
+{ "disable_plugins",	OPTION_BOOL,	&option_disable_plugins}, \
+{ "history_age",		OPTION_INTEGER,	&option_history_age}, \
+{ "hover_urls",			OPTION_BOOL,	&option_hover_urls}
 
 #endif
Index: gtk/gtk_window.c
===================================================================
--- gtk/gtk_window.c	(revision 7048)
+++ gtk/gtk_window.c	(working copy)
@@ -34,7 +34,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <assert.h>
 
-static struct gui_window *window_list = 0;	/**< first entry in win list*/
+struct gui_window *window_list = 0;	/**< first entry in win list*/
 
 static uint32_t gdkkey_to_nskey(GdkEventKey *);
 static void nsgtk_gui_window_attach_child(struct gui_window *parent,
Index: gtk/gtk_window.h
===================================================================
--- gtk/gtk_window.h	(revision 7048)
+++ gtk/gtk_window.h	(working copy)
@@ -63,6 +63,8 @@
 	browser_mouse_state state;
 };
 
+extern struct gui_window * window_list;
+
 void nsgtk_reflow_all_windows(void);
 void nsgtk_window_process_reformats(void);
 
Index: gtk/gtk_scaffolding.c
===================================================================
--- gtk/gtk_scaffolding.c	(revision 7048)
+++ gtk/gtk_scaffolding.c	(working copy)
@@ -22,7 +22,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 #include <libxml/debugXML.h>
 #include "content/content.h"
 #include "desktop/browser.h"
@@ -41,6 +40,7 @@
 #include "gtk/gtk_completion.h"
 #include "gtk/dialogs/gtk_options.h"
 #include "gtk/dialogs/gtk_about.h"
+#include "gtk/dialogs/gtk_source.h"
 #include "gtk/gtk_download.h"
 #include "gtk/gtk_gui.h"
 #include "gtk/gtk_history.h"
@@ -65,42 +65,7 @@
 
 struct gtk_history_window;
 
-struct gtk_scaffolding {
-	GtkWindow		*window;
-	GtkNotebook		*notebook;
-	GtkEntry		*url_bar;
-	GtkEntryCompletion	*url_bar_completion;
-	GtkStatusbar		*status_bar;
-	GtkMenuItem		*edit_menu;
-	GtkMenuItem		*tabs_menu;
-	GtkToolbar		*tool_bar;
-	GtkToolButton		*back_button;
-	GtkToolButton		*forward_button;
-	GtkToolButton		*stop_button;
-	GtkToolButton		*reload_button;
-	GtkMenuBar		*menu_bar;
-	GtkMenuItem		*back_menu;
-	GtkMenuItem		*forward_menu;
-	GtkMenuItem		*stop_menu;
-	GtkMenuItem		*reload_menu;
-	GtkImage		*throbber;
-	GtkPaned		*status_pane;
 
-	GladeXML		*xml;
-
-	GladeXML		*popup_xml;
-	GtkMenu			*popup_menu;
-
-	struct gtk_history_window *history_window;
-	GtkDialog 		*preferences_dialog;
-
-	int			throb_frame;
-        struct gui_window	*top_level;
-        int			being_destroyed;
-
-	bool			fullscreen;
-};
-
 struct gtk_history_window {
 	struct gtk_scaffolding 	*g;
 	GtkWindow		*window;
@@ -187,6 +152,7 @@
 MENUPROTO(normal_size);
 MENUPROTO(zoom_out);
 MENUPROTO(full_screen);
+MENUPROTO(view_source);
 MENUPROTO(menu_bar);
 MENUPROTO(tool_bar);
 MENUPROTO(status_bar);
@@ -244,6 +210,7 @@
 	MENUEVENT(normal_size),
 	MENUEVENT(zoom_out),
 	MENUEVENT(full_screen),
+	MENUEVENT(view_source),
 	MENUEVENT(menu_bar),
 	MENUEVENT(tool_bar),
 	MENUEVENT(status_bar),
@@ -305,7 +272,7 @@
         LOG(("Being Destroyed = %d", g->being_destroyed));
         gtk_widget_destroy(GTK_WIDGET(g->history_window->window));
 	gtk_widget_destroy(GTK_WIDGET(g->window));
-
+	
 	if (--open_windows == 0)
 		netsurf_quit = true;
 
@@ -659,7 +626,7 @@
 	}
 
 	content_to_print = bw->current_content;
-	
+
 	page_setup = gtk_print_run_page_setup_dialog(gw->window, NULL, NULL);
 	if (page_setup == NULL) {
 		warn_user(messages_get("NoMemory"), 0);
@@ -676,8 +643,8 @@
 			G_CALLBACK(gtk_print_signal_draw_page), NULL);
 	g_signal_connect(print_op, "end_print", 
 			G_CALLBACK(gtk_print_signal_end_print), settings);
-	
-	res = gtk_print_operation_run(print_op,
+	if (bw->current_content->type != CONTENT_TEXTPLAIN)
+		res = gtk_print_operation_run(print_op,
 				GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
     				gw->window,
 				NULL);
@@ -691,7 +658,6 @@
 		gtk_print_settings_to_file(gtk_print_settings,
 				print_options_file_location, NULL);
 	}
-
 	/* Our print_settings object is destroyed by the end print handler */
 	g_object_unref(page_setup);
 	g_object_unref(print_op);
@@ -852,6 +818,14 @@
 	return TRUE;
 }
 
+MENUHANDLER(view_source)
+{
+	struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
+	nsgtk_source_dialog_init(gw->window,
+			nsgtk_get_browser_for_gui(gw->top_level));
+	return TRUE;
+}
+
 MENUHANDLER(menu_bar)
 {
 	struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
@@ -1167,7 +1141,7 @@
         LOG(("Constructing a scaffold of %p for gui_window %p", g, toplevel));
 
         g->top_level = toplevel;
-
+        
 	open_windows++;
 
 	/* load the window template from the glade xml file, and extract
@@ -1209,6 +1183,53 @@
 	} else {
 		gtk_window_set_default_size(g->window, 600, 600);
 	}
+	
+	if (option_button_type == 0) {
+		GtkSettings *settings = gtk_settings_get_default();
+		GtkIconSize tooliconsize;
+		GtkToolbarStyle toolbarstyle;
+		g_object_get(settings, "gtk-toolbar-icon-size",  &tooliconsize,
+				"gtk-toolbar-style", &toolbarstyle, NULL);
+		switch (toolbarstyle) {
+			case GTK_TOOLBAR_ICONS :
+				option_button_type = (tooliconsize ==
+						GTK_ICON_SIZE_SMALL_TOOLBAR) ? 1 : 2;
+				break;
+			case GTK_TOOLBAR_TEXT :
+				option_button_type = 4;
+				break;
+			case GTK_TOOLBAR_BOTH :
+			case GTK_TOOLBAR_BOTH_HORIZ :
+			default :
+				option_button_type = 3;
+				break;
+		}
+	}
+	switch(option_button_type) {
+		case 1:
+			gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+					GTK_TOOLBAR_ICONS);
+			gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
+					GTK_ICON_SIZE_SMALL_TOOLBAR);
+			break;
+		case 2:
+			gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+					GTK_TOOLBAR_ICONS);
+			gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
+					GTK_ICON_SIZE_LARGE_TOOLBAR);
+			break;
+		case 3:
+			gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+					GTK_TOOLBAR_BOTH);
+			gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
+					GTK_ICON_SIZE_LARGE_TOOLBAR);
+			break;
+		case 4:
+			gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+					GTK_TOOLBAR_TEXT);
+		default:
+			break;
+	}
 
 	nsgtk_tab_init(GTK_WIDGET(g->notebook));
 
@@ -1572,4 +1593,3 @@
 	widget = glade_xml_get_widget(xml, "separator");
 	gtk_widget_show(widget);
 }
-	
Index: gtk/gtk_scaffolding.h
===================================================================
--- gtk/gtk_scaffolding.h	(revision 7048)
+++ gtk/gtk_scaffolding.h	(working copy)
@@ -20,11 +20,48 @@
 #define NETSURF_GTK_SCAFFOLDING_H 1
 
 #include <gtk/gtk.h>
+#include <glade/glade.h>
 #include "desktop/gui.h"
 #include "desktop/plotters.h"
 
 typedef struct gtk_scaffolding nsgtk_scaffolding;
 
+struct gtk_scaffolding {
+	GtkWindow		*window;
+	GtkNotebook		*notebook;
+	GtkEntry		*url_bar;
+	GtkEntryCompletion	*url_bar_completion;
+	GtkStatusbar		*status_bar;
+	GtkMenuItem		*edit_menu;
+	GtkMenuItem		*tabs_menu;
+	GtkToolbar		*tool_bar;
+	GtkToolButton		*back_button;
+	GtkToolButton		*forward_button;
+	GtkToolButton		*stop_button;
+	GtkToolButton		*reload_button;
+	GtkMenuBar		*menu_bar;
+	GtkMenuItem		*back_menu;
+	GtkMenuItem		*forward_menu;
+	GtkMenuItem		*stop_menu;
+	GtkMenuItem		*reload_menu;
+	GtkImage		*throbber;
+	GtkPaned		*status_pane;
+
+	GladeXML		*xml;
+
+	GladeXML		*popup_xml;
+	GtkMenu			*popup_menu;
+
+	struct gtk_history_window *history_window;
+	GtkDialog 		*preferences_dialog;
+
+	int			throb_frame;
+        struct gui_window	*top_level;
+        int			being_destroyed;
+
+	bool			fullscreen;
+};
+
 GtkWindow *nsgtk_get_window_for_scaffold(struct gtk_scaffolding *g);
 
 nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel);
Index: gtk/dialogs/gtk_options.c
===================================================================
--- gtk/dialogs/gtk_options.c	(revision 7048)
+++ gtk/dialogs/gtk_options.c	(working copy)
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <math.h>
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 #include "utils/log.h"
@@ -85,6 +86,8 @@
 DECLARE(spinMinimumSize);
 DECLARE(fontPreview);
 
+DECLARE(comboButtonType);
+
 DECLARE(spinMemoryCacheSize);
 DECLARE(spinDiscCacheAge);
 
@@ -135,12 +138,12 @@
 	CONNECT(setCurrentPage, "clicked");
 	CONNECT(setDefaultPage, "clicked");
 	CONNECT(checkHideAdverts, "toggled");
-	/* mike: why are these commented out?
+	/* mike: why are these commented out? Mark: 'cos the functions weren't defined yet? */
 	CONNECT(checkDisablePopups, "toggled");
 	CONNECT(checkDisablePlugins, "toggled");
 	CONNECT(spinHistoryAge, "focus-out-event");
 	CONNECT(checkHoverURLs, "toggled");
-	*/
+	
 	CONNECT(checkDisplayRecentURLs, "toggled");
 	CONNECT(checkSendReferer, "toggled");
 	CONNECT(checkShowSingleTab, "toggled");
@@ -167,6 +170,8 @@
 	CONNECT(spinDefaultSize, "value-changed");
 	CONNECT(spinMinimumSize, "value-changed");
 	CONNECT(fontPreview, "clicked");
+	
+	CONNECT(comboButtonType, "changed");
 
 	CONNECT(spinMemoryCacheSize, "value-changed");
 	CONNECT(spinDiscCacheAge, "value-changed");
@@ -251,7 +256,27 @@
 {
 	char b[20];
 	int proxytype = 0;
-
+	if (option_button_type == 0) {
+		GtkSettings *settings = gtk_settings_get_default();
+		GtkIconSize tooliconsize;
+		GtkToolbarStyle toolbarstyle;
+		g_object_get(settings, "gtk-toolbar-icon-size",  &tooliconsize,
+				"gtk-toolbar-style", &toolbarstyle, NULL);
+		switch (toolbarstyle) {
+			case GTK_TOOLBAR_ICONS :
+				option_button_type = (tooliconsize ==
+						GTK_ICON_SIZE_SMALL_TOOLBAR) ? 1 : 2;
+				break;
+			case GTK_TOOLBAR_TEXT :
+				option_button_type = 4;
+				break;
+			case GTK_TOOLBAR_BOTH :
+			case GTK_TOOLBAR_BOTH_HORIZ :
+			default :
+				option_button_type = 3;
+				break;
+		}
+	}
 	SET_ENTRY(entryHomePageURL,
 			option_homepage_url ? option_homepage_url : "");
 	SET_BUTTON(setCurrentPage);
@@ -297,6 +322,8 @@
 	SET_SPIN(spinDefaultSize, option_font_size / 10);
 	SET_SPIN(spinMinimumSize, option_font_min_size / 10);
 	SET_BUTTON(fontPreview);
+	
+	SET_COMBO(comboButtonType, option_button_type -1);
 
 	SET_SPIN(spinMemoryCacheSize, option_memory_cache_size >> 20);
 	SET_SPIN(spinDiscCacheAge, option_disc_cache_age);
@@ -334,7 +361,11 @@
 {
 	LOG(("Writing options to file"));
 	options_write(options_file_location);
-	if (stay_alive) gtk_widget_hide(GTK_WIDGET(wndPreferences));
+	if ((stay_alive) && GTK_IS_WIDGET(dlg))
+		gtk_widget_hide(GTK_WIDGET(dlg));
+	else {
+		stay_alive = FALSE;
+	}
 	return stay_alive;
 }
 	
@@ -500,6 +531,18 @@
 	option_animate_images = !option_animate_images;
 END_HANDLER
 
+CHECK_CHANGED(checkDisablePopups, option_disable_popups)
+END_HANDLER
+
+CHECK_CHANGED(checkDisablePlugins, option_disable_plugins)
+END_HANDLER
+
+SPIN_CHANGED(spinHistoryAge, option_history_age)
+END_HANDLER
+
+CHECK_CHANGED(checkHoverURLs, option_hover_urls)
+END_HANDLER
+
 FONT_CHANGED(fontSansSerif, option_font_sans)
 END_HANDLER
 
@@ -531,6 +574,41 @@
 	nsgtk_reflow_all_windows();
 END_HANDLER
 
+COMBO_CHANGED(comboButtonType, option_button_type)
+	option_button_type++;
+	struct gui_window *current;
+	current = window_list;
+	while (current)
+	{
+		switch(option_button_type) {
+			case 1:
+				gtk_toolbar_set_style(GTK_TOOLBAR(current->scaffold->tool_bar),
+						GTK_TOOLBAR_ICONS);
+				gtk_toolbar_set_icon_size(GTK_TOOLBAR(current->scaffold->tool_bar),
+						GTK_ICON_SIZE_SMALL_TOOLBAR);
+				break;
+			case 2:
+				gtk_toolbar_set_style(GTK_TOOLBAR(current->scaffold->tool_bar),
+						GTK_TOOLBAR_ICONS);
+				gtk_toolbar_set_icon_size(GTK_TOOLBAR(current->scaffold->tool_bar),
+						GTK_ICON_SIZE_LARGE_TOOLBAR);
+				break;
+			case 3:
+				gtk_toolbar_set_style(GTK_TOOLBAR(current->scaffold->tool_bar),
+						GTK_TOOLBAR_BOTH);
+				gtk_toolbar_set_icon_size(GTK_TOOLBAR(current->scaffold->tool_bar),
+						GTK_ICON_SIZE_LARGE_TOOLBAR);
+				break;
+			case 4:
+				gtk_toolbar_set_style(GTK_TOOLBAR(current->scaffold->tool_bar),
+						GTK_TOOLBAR_TEXT);
+			default:
+				break;
+		}
+		current = current->next;
+	}
+END_HANDLER
+
 SPIN_CHANGED(spinMemoryCacheSize, option_memory_cache_size)
 	option_memory_cache_size <<= 20;
 END_HANDLER
Index: Makefile.sources
===================================================================
--- Makefile.sources	(revision 7048)
+++ Makefile.sources	(working copy)
@@ -60,7 +60,7 @@
 	gtk_completion.c gtk_login.c gtk_throbber.c gtk_selection.c	\
 	gtk_history.c gtk_window.c gtk_filetype.c gtk_download.c	\
 	gtk_print.c gtk_tabs.c						\
-	$(addprefix dialogs/,gtk_options.c gtk_about.c)
+	$(addprefix dialogs/,gtk_options.c gtk_about.c gtk_source.c)
 S_GTK := $(addprefix gtk/,$(S_GTK))
 
 # S_BEOS are sources purely for the BeOS build
Index: desktop/options.c
===================================================================
--- desktop/options.c	(revision 7048)
+++ desktop/options.c	(working copy)
@@ -389,7 +389,7 @@
 				break;
 		}
 		fprintf(fp, "\n");
-        }
+	}
 
 	fclose(fp);
 }

Reply via email to