From 4b2802c546be242b212be09277f83099557eb429 Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Thu, 9 Oct 2008 23:07:38 +0000 Subject: Whole bunch of warning fixes in GTK svn path=/trunk/netsurf/; revision=5521 --- gtk/dialogs/gtk_options.c | 3 +++ gtk/dialogs/gtk_options.h | 3 --- gtk/font_pango.c | 2 +- gtk/gtk_gui.c | 1 - gtk/gtk_history.c | 33 +++++++++++++++------------------ gtk/gtk_plotters.c | 2 -- gtk/gtk_print.c | 7 ------- gtk/gtk_scaffolding.c | 28 ++++++++++++++++++++++++++-- 8 files changed, 45 insertions(+), 34 deletions(-) (limited to 'gtk') diff --git a/gtk/dialogs/gtk_options.c b/gtk/dialogs/gtk_options.c index 666394781..4b4ac986b 100644 --- a/gtk/dialogs/gtk_options.c +++ b/gtk/dialogs/gtk_options.c @@ -40,6 +40,9 @@ static struct browser_window *current_browser; static int proxy_type; static float animation_delay; +static void dialog_response_handler (GtkDialog *dlg, gint res_id); +static gboolean on_dialog_close (GtkDialog *dlg, gboolean stay_alive); + /* Declares both widget and callback */ #define DECLARE(x) GtkWidget *x; gboolean on_##x##_changed( \ GtkWidget *widget, gpointer data) diff --git a/gtk/dialogs/gtk_options.h b/gtk/dialogs/gtk_options.h index 49932ff89..cc269d178 100644 --- a/gtk/dialogs/gtk_options.h +++ b/gtk/dialogs/gtk_options.h @@ -27,7 +27,4 @@ GtkDialog* nsgtk_options_init(struct browser_window *bw, GtkWindow *parent); /* void nsgtk_options_load(void); /** Load current options into window */ void nsgtk_options_save(void); /** Save options from window */ -/** Callbacks */ -static void dialog_response_handler (GtkDialog *dlg, gint res_id); -static gboolean on_dialog_close (GtkDialog *dlg, gboolean stay_alive); #endif diff --git a/gtk/font_pango.c b/gtk/font_pango.c index e1ec7b6fe..e5994e71e 100644 --- a/gtk/font_pango.c +++ b/gtk/font_pango.c @@ -314,7 +314,7 @@ PangoFontDescription *nsfont_style_to_description( else size = css_len2pt(&style->font_size.value.length, style); - if (size < abs(option_font_min_size / 10)) + if (size < (unsigned)abs(option_font_min_size / 10)) size = option_font_min_size / 10; size *= PANGO_SCALE; diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c index abcd3efab..6158d7058 100644 --- a/gtk/gtk_gui.c +++ b/gtk/gtk_gui.c @@ -182,7 +182,6 @@ static void *myrealloc(void *ptr, size_t len, void *pw) void gui_init(int argc, char** argv) { char buf[PATH_MAX]; - PangoFontDescription *fontdesc; gtk_init(&argc, &argv); diff --git a/gtk/gtk_history.c b/gtk/gtk_history.c index add76c1a1..e873c92c0 100644 --- a/gtk/gtk_history.c +++ b/gtk/gtk_history.c @@ -60,18 +60,18 @@ static const gchar* domainAll; static struct history_model *history; -static void nsgtk_history_init_model(); -static void nsgtk_history_init_filters(); -static void nsgtk_history_init_sort(); -static void nsgtk_history_init_treeviews(); -static void nsgtk_history_init_list(); +static void nsgtk_history_init_model(void); +static void nsgtk_history_init_filters(void); +static void nsgtk_history_init_sort(void); +static void nsgtk_history_init_treeviews(void); +static void nsgtk_history_init_list(void); static bool nsgtk_history_add_internal(const char *, const struct url_data *); static void nsgtk_history_show_domain(GtkTreeSelection *treesel, GString *domain_filter); -static void nsgtk_history_show_all(); +static void nsgtk_history_show_all(void); static gboolean nsgtk_history_filter_search(GtkTreeModel *model, GtkTreeIter *iter, GtkWidget *search_entry); @@ -87,7 +87,7 @@ static gint nsgtk_history_domain_sort_compare(GtkTreeModel *model, GtkTreeIter * static void nsgtk_history_domain_set_visible (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gboolean has_sites); -static void nsgtk_history_search(); +static void nsgtk_history_search(void); static void nsgtk_history_search_clear (GtkEntry *entry); static gchar *nsgtk_history_date_parse(time_t visit_time); @@ -99,8 +99,6 @@ static void nsgtk_history_scroll_top (GtkScrolledWindow *scrolled_window); void nsgtk_history_init(void) { - GtkTreeIter iter; - dateToday = messages_get("DateToday"); dateYesterday = messages_get("DateYesterday"); dateAt = messages_get("DateAt"); @@ -123,7 +121,7 @@ void nsgtk_history_init(void) nsgtk_history_show_all(); } -void nsgtk_history_init_model() +void nsgtk_history_init_model(void) { history = malloc(sizeof(struct history_model)); @@ -162,7 +160,7 @@ void nsgtk_history_init_model() gtk_tree_view_get_selection(history->domain_treeview); } -void nsgtk_history_init_list() +void nsgtk_history_init_list(void) { GtkTreeIter iter; @@ -180,7 +178,7 @@ void nsgtk_history_init_list() urldb_iterate_entries(nsgtk_history_add_internal); } -void nsgtk_history_init_filters() +void nsgtk_history_init_filters(void) { GtkWidget *search_entry, *clear_button; GString *filter_string = g_string_new(NULL); @@ -212,7 +210,7 @@ void nsgtk_history_init_filters() G_CALLBACK(nsgtk_history_show_domain), filter_string); } -void nsgtk_history_init_sort() +void nsgtk_history_init_sort(void) { GtkWidget *domain_window = glade_xml_get_widget(gladeFile, "windowDomain"); @@ -248,7 +246,7 @@ void nsgtk_history_init_sort() GUINT_TO_POINTER(SITE_TOTALVISITS), NULL); } -void nsgtk_history_init_treeviews() +void nsgtk_history_init_treeviews(void) { GtkCellRenderer *renderer; @@ -364,7 +362,6 @@ void nsgtk_history_show_domain(GtkTreeSelection *treesel, { GtkTreeIter iter; GtkTreeModel *model; - gint columns[] = { DOM_DOMAIN, DOM_LASTVISIT, DOM_TOTALVISITS }; if (gtk_tree_selection_get_selected(treesel, &model, &iter)) { gtk_tree_model_get(model, &iter, DOM_DOMAIN, @@ -376,7 +373,7 @@ void nsgtk_history_show_domain(GtkTreeSelection *treesel, nsgtk_history_update_info(treesel, TRUE); } -void nsgtk_history_show_all() +static void nsgtk_history_show_all(void) { GtkTreePath *path = gtk_tree_path_new_from_string("0"); @@ -501,7 +498,7 @@ void nsgtk_history_search_clear (GtkEntry *entry) gchar *nsgtk_history_date_parse(time_t visit_time) { gchar *date_string = malloc(30); - gchar *format = malloc(30); + gchar format[30]; time_t current_time = time(NULL); gint current_day = localtime(¤t_time)->tm_yday; struct tm *visit_date = localtime(&visit_time); @@ -516,7 +513,7 @@ gchar *nsgtk_history_date_parse(time_t visit_time) g_snprintf(format, 30, "%%A %s %%I:%%M %%p", dateAt); else - format = "%B %d, %Y"; + g_snprintf(format, 30, "%%B %%d, %%Y"); strftime(date_string, 30, format, visit_date); diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c index 9532119fd..016d487b2 100644 --- a/gtk/gtk_plotters.c +++ b/gtk/gtk_plotters.c @@ -451,7 +451,6 @@ void nsgtk_set_solid() void nsgtk_set_dotted() { double cdashes = 1; - gint8 dashes[] = { 1, 1 }; cairo_set_dash(current_cr, &cdashes, 1, 0); } @@ -459,7 +458,6 @@ void nsgtk_set_dotted() void nsgtk_set_dashed() { double cdashes = 3; - gint8 dashes[] = { 3, 3 }; cairo_set_dash(current_cr, &cdashes, 1, 0); } diff --git a/gtk/gtk_print.c b/gtk/gtk_print.c index 5828ead75..19ed8e867 100644 --- a/gtk/gtk_print.c +++ b/gtk/gtk_print.c @@ -77,8 +77,6 @@ static void nsgtk_print_set_dashed(void); /**< Set for drawing dashed lines */ static void nsgtk_print_set_colour(colour c); -static void nsgtk_print_plot_caret(int x, int y, int h); - static bool gtk_print_font_paint(const struct css_style *style, const char *string, size_t length, @@ -430,7 +428,6 @@ void nsgtk_print_set_solid() void nsgtk_print_set_dotted() { double cdashes = 1; - gint8 dashes[] = { 1, 1 }; cairo_set_dash(gtk_print_current_cr, &cdashes, 1, 0); @@ -439,7 +436,6 @@ void nsgtk_print_set_dotted() void nsgtk_print_set_dashed() { double cdashes = 3; - gint8 dashes[] = { 3, 3 }; cairo_set_dash(gtk_print_current_cr, &cdashes, 1, 0); } @@ -453,9 +449,6 @@ bool gtk_print_font_paint(const struct css_style *style, gint size; PangoLayoutLine *line; - int width, height; - - if (length == 0) return true; diff --git a/gtk/gtk_scaffolding.c b/gtk/gtk_scaffolding.c index 62c78efe1..0ab2b9f35 100644 --- a/gtk/gtk_scaffolding.c +++ b/gtk/gtk_scaffolding.c @@ -139,7 +139,8 @@ static gboolean nsgtk_history_button_press_event(GtkWidget *, GdkEventButton *, gpointer); static void nsgtk_attach_menu_handlers(GladeXML *, gpointer); - +static void nsgtk_window_tabs_num_changed(GtkNotebook *notebook, + GtkWidget *page, guint page_num, struct gtk_scaffolding *g); void nsgtk_openfile_open(char *filename); #define MENUEVENT(x) { #x, G_CALLBACK(nsgtk_on_##x##_activate) } @@ -345,16 +346,22 @@ void nsgtk_throb(void *p) static gboolean nsgtk_window_edit_menu_clicked(GtkWidget *widget, struct gtk_scaffolding *g) { nsgtk_scaffolding_update_edit_actions_sensitivity (g, g->xml, FALSE); + + return TRUE; } static gboolean nsgtk_window_edit_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g) { nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->xml); + return TRUE; + } static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g) { nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->popup_xml); + return TRUE; + } gboolean nsgtk_window_back_button_clicked(GtkWidget *widget, gpointer data) @@ -648,6 +655,8 @@ MENUHANDLER(cut) gtk_editable_cut_clipboard (GTK_EDITABLE(gw->url_bar)); else browser_window_key_press(bw, 24); + + return TRUE; } MENUHANDLER(copy) @@ -661,6 +670,8 @@ MENUHANDLER(copy) gtk_editable_copy_clipboard(GTK_EDITABLE(gw->url_bar)); else gui_copy_to_clipboard(bw->sel); + + return TRUE; } MENUHANDLER(paste) @@ -672,8 +683,10 @@ MENUHANDLER(paste) /* If the url bar has focus, let gtk handle it */ if (GTK_IS_EDITABLE (focused)) gtk_editable_paste_clipboard (GTK_EDITABLE (focused)); - else + else gui_paste_from_clipboard(gui, 0, 0); + + return TRUE; } MENUHANDLER(select_all) @@ -683,6 +696,8 @@ MENUHANDLER(select_all) LOG(("Selecting all text")); selection_select_all(bw->sel); + + return TRUE; } MENUHANDLER(preferences) @@ -693,6 +708,7 @@ MENUHANDLER(preferences) gw->preferences_dialog = nsgtk_options_init(bw, gw->window); else gtk_widget_show (GTK_WIDGET(gw->preferences_dialog)); + return TRUE; } @@ -869,6 +885,8 @@ MENUHANDLER(save_box_tree) } gtk_widget_destroy(save_dialog); + + return TRUE; } MENUHANDLER(save_dom_tree) @@ -917,6 +935,8 @@ MENUHANDLER(save_dom_tree) } gtk_widget_destroy(save_dialog); + + return TRUE; } @@ -968,6 +988,8 @@ MENUHANDLER(next_tab) struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g; gtk_notebook_next_page(gw->notebook); + + return TRUE; } MENUHANDLER(prev_tab) @@ -975,6 +997,8 @@ MENUHANDLER(prev_tab) struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g; gtk_notebook_prev_page(gw->notebook); + + return TRUE; } MENUHANDLER(about) -- cgit v1.2.3