mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-01 02:26:58 +03:00
Whole bunch of warning fixes in GTK
svn path=/trunk/netsurf/; revision=5521
This commit is contained in:
parent
56500ce8e8
commit
4b2802c546
@ -40,6 +40,9 @@ static struct browser_window *current_browser;
|
|||||||
static int proxy_type;
|
static int proxy_type;
|
||||||
static float animation_delay;
|
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 */
|
/* Declares both widget and callback */
|
||||||
#define DECLARE(x) GtkWidget *x; gboolean on_##x##_changed( \
|
#define DECLARE(x) GtkWidget *x; gboolean on_##x##_changed( \
|
||||||
GtkWidget *widget, gpointer data)
|
GtkWidget *widget, gpointer data)
|
||||||
|
@ -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_load(void); /** Load current options into window */
|
||||||
void nsgtk_options_save(void); /** Save options from 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
|
#endif
|
||||||
|
@ -314,7 +314,7 @@ PangoFontDescription *nsfont_style_to_description(
|
|||||||
else
|
else
|
||||||
size = css_len2pt(&style->font_size.value.length, style);
|
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 = option_font_min_size / 10;
|
||||||
|
|
||||||
size *= PANGO_SCALE;
|
size *= PANGO_SCALE;
|
||||||
|
@ -182,7 +182,6 @@ static void *myrealloc(void *ptr, size_t len, void *pw)
|
|||||||
void gui_init(int argc, char** argv)
|
void gui_init(int argc, char** argv)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
PangoFontDescription *fontdesc;
|
|
||||||
|
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
|
@ -60,18 +60,18 @@ static const gchar* domainAll;
|
|||||||
|
|
||||||
static struct history_model *history;
|
static struct history_model *history;
|
||||||
|
|
||||||
static void nsgtk_history_init_model();
|
static void nsgtk_history_init_model(void);
|
||||||
static void nsgtk_history_init_filters();
|
static void nsgtk_history_init_filters(void);
|
||||||
static void nsgtk_history_init_sort();
|
static void nsgtk_history_init_sort(void);
|
||||||
static void nsgtk_history_init_treeviews();
|
static void nsgtk_history_init_treeviews(void);
|
||||||
static void nsgtk_history_init_list();
|
static void nsgtk_history_init_list(void);
|
||||||
|
|
||||||
static bool nsgtk_history_add_internal(const char *, const struct url_data *);
|
static bool nsgtk_history_add_internal(const char *, const struct url_data *);
|
||||||
|
|
||||||
static void nsgtk_history_show_domain(GtkTreeSelection *treesel,
|
static void nsgtk_history_show_domain(GtkTreeSelection *treesel,
|
||||||
GString *domain_filter);
|
GString *domain_filter);
|
||||||
|
|
||||||
static void nsgtk_history_show_all();
|
static void nsgtk_history_show_all(void);
|
||||||
|
|
||||||
static gboolean nsgtk_history_filter_search(GtkTreeModel *model,
|
static gboolean nsgtk_history_filter_search(GtkTreeModel *model,
|
||||||
GtkTreeIter *iter, GtkWidget *search_entry);
|
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,
|
static void nsgtk_history_domain_set_visible (GtkTreeModel *model,
|
||||||
GtkTreePath *path, GtkTreeIter *iter, gboolean has_sites);
|
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 void nsgtk_history_search_clear (GtkEntry *entry);
|
||||||
|
|
||||||
static gchar *nsgtk_history_date_parse(time_t visit_time);
|
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)
|
void nsgtk_history_init(void)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
dateToday = messages_get("DateToday");
|
dateToday = messages_get("DateToday");
|
||||||
dateYesterday = messages_get("DateYesterday");
|
dateYesterday = messages_get("DateYesterday");
|
||||||
dateAt = messages_get("DateAt");
|
dateAt = messages_get("DateAt");
|
||||||
@ -123,7 +121,7 @@ void nsgtk_history_init(void)
|
|||||||
nsgtk_history_show_all();
|
nsgtk_history_show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsgtk_history_init_model()
|
void nsgtk_history_init_model(void)
|
||||||
{
|
{
|
||||||
history = malloc(sizeof(struct history_model));
|
history = malloc(sizeof(struct history_model));
|
||||||
|
|
||||||
@ -162,7 +160,7 @@ void nsgtk_history_init_model()
|
|||||||
gtk_tree_view_get_selection(history->domain_treeview);
|
gtk_tree_view_get_selection(history->domain_treeview);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsgtk_history_init_list()
|
void nsgtk_history_init_list(void)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
@ -180,7 +178,7 @@ void nsgtk_history_init_list()
|
|||||||
urldb_iterate_entries(nsgtk_history_add_internal);
|
urldb_iterate_entries(nsgtk_history_add_internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsgtk_history_init_filters()
|
void nsgtk_history_init_filters(void)
|
||||||
{
|
{
|
||||||
GtkWidget *search_entry, *clear_button;
|
GtkWidget *search_entry, *clear_button;
|
||||||
GString *filter_string = g_string_new(NULL);
|
GString *filter_string = g_string_new(NULL);
|
||||||
@ -212,7 +210,7 @@ void nsgtk_history_init_filters()
|
|||||||
G_CALLBACK(nsgtk_history_show_domain), filter_string);
|
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,
|
GtkWidget *domain_window = glade_xml_get_widget(gladeFile,
|
||||||
"windowDomain");
|
"windowDomain");
|
||||||
@ -248,7 +246,7 @@ void nsgtk_history_init_sort()
|
|||||||
GUINT_TO_POINTER(SITE_TOTALVISITS), NULL);
|
GUINT_TO_POINTER(SITE_TOTALVISITS), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsgtk_history_init_treeviews()
|
void nsgtk_history_init_treeviews(void)
|
||||||
{
|
{
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
|
|
||||||
@ -364,7 +362,6 @@ void nsgtk_history_show_domain(GtkTreeSelection *treesel,
|
|||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
gint columns[] = { DOM_DOMAIN, DOM_LASTVISIT, DOM_TOTALVISITS };
|
|
||||||
|
|
||||||
if (gtk_tree_selection_get_selected(treesel, &model, &iter)) {
|
if (gtk_tree_selection_get_selected(treesel, &model, &iter)) {
|
||||||
gtk_tree_model_get(model, &iter, DOM_DOMAIN,
|
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);
|
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");
|
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 *nsgtk_history_date_parse(time_t visit_time)
|
||||||
{
|
{
|
||||||
gchar *date_string = malloc(30);
|
gchar *date_string = malloc(30);
|
||||||
gchar *format = malloc(30);
|
gchar format[30];
|
||||||
time_t current_time = time(NULL);
|
time_t current_time = time(NULL);
|
||||||
gint current_day = localtime(¤t_time)->tm_yday;
|
gint current_day = localtime(¤t_time)->tm_yday;
|
||||||
struct tm *visit_date = localtime(&visit_time);
|
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",
|
g_snprintf(format, 30, "%%A %s %%I:%%M %%p",
|
||||||
dateAt);
|
dateAt);
|
||||||
else
|
else
|
||||||
format = "%B %d, %Y";
|
g_snprintf(format, 30, "%%B %%d, %%Y");
|
||||||
|
|
||||||
strftime(date_string, 30, format, visit_date);
|
strftime(date_string, 30, format, visit_date);
|
||||||
|
|
||||||
|
@ -451,7 +451,6 @@ void nsgtk_set_solid()
|
|||||||
void nsgtk_set_dotted()
|
void nsgtk_set_dotted()
|
||||||
{
|
{
|
||||||
double cdashes = 1;
|
double cdashes = 1;
|
||||||
gint8 dashes[] = { 1, 1 };
|
|
||||||
|
|
||||||
cairo_set_dash(current_cr, &cdashes, 1, 0);
|
cairo_set_dash(current_cr, &cdashes, 1, 0);
|
||||||
}
|
}
|
||||||
@ -459,7 +458,6 @@ void nsgtk_set_dotted()
|
|||||||
void nsgtk_set_dashed()
|
void nsgtk_set_dashed()
|
||||||
{
|
{
|
||||||
double cdashes = 3;
|
double cdashes = 3;
|
||||||
gint8 dashes[] = { 3, 3 };
|
|
||||||
|
|
||||||
cairo_set_dash(current_cr, &cdashes, 1, 0);
|
cairo_set_dash(current_cr, &cdashes, 1, 0);
|
||||||
}
|
}
|
||||||
|
@ -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_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,
|
static bool gtk_print_font_paint(const struct css_style *style,
|
||||||
const char *string, size_t length,
|
const char *string, size_t length,
|
||||||
@ -430,7 +428,6 @@ void nsgtk_print_set_solid()
|
|||||||
void nsgtk_print_set_dotted()
|
void nsgtk_print_set_dotted()
|
||||||
{
|
{
|
||||||
double cdashes = 1;
|
double cdashes = 1;
|
||||||
gint8 dashes[] = { 1, 1 };
|
|
||||||
|
|
||||||
cairo_set_dash(gtk_print_current_cr, &cdashes, 1, 0);
|
cairo_set_dash(gtk_print_current_cr, &cdashes, 1, 0);
|
||||||
|
|
||||||
@ -439,7 +436,6 @@ void nsgtk_print_set_dotted()
|
|||||||
void nsgtk_print_set_dashed()
|
void nsgtk_print_set_dashed()
|
||||||
{
|
{
|
||||||
double cdashes = 3;
|
double cdashes = 3;
|
||||||
gint8 dashes[] = { 3, 3 };
|
|
||||||
|
|
||||||
cairo_set_dash(gtk_print_current_cr, &cdashes, 1, 0);
|
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;
|
gint size;
|
||||||
PangoLayoutLine *line;
|
PangoLayoutLine *line;
|
||||||
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
|
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -139,7 +139,8 @@ static gboolean nsgtk_history_button_press_event(GtkWidget *, GdkEventButton *,
|
|||||||
gpointer);
|
gpointer);
|
||||||
|
|
||||||
static void nsgtk_attach_menu_handlers(GladeXML *, 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);
|
void nsgtk_openfile_open(char *filename);
|
||||||
|
|
||||||
#define MENUEVENT(x) { #x, G_CALLBACK(nsgtk_on_##x##_activate) }
|
#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)
|
static gboolean nsgtk_window_edit_menu_clicked(GtkWidget *widget, struct gtk_scaffolding *g)
|
||||||
{
|
{
|
||||||
nsgtk_scaffolding_update_edit_actions_sensitivity (g, g->xml, FALSE);
|
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)
|
static gboolean nsgtk_window_edit_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g)
|
||||||
{
|
{
|
||||||
nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->xml);
|
nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->xml);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g)
|
static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g)
|
||||||
{
|
{
|
||||||
nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->popup_xml);
|
nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->popup_xml);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean nsgtk_window_back_button_clicked(GtkWidget *widget, gpointer data)
|
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));
|
gtk_editable_cut_clipboard (GTK_EDITABLE(gw->url_bar));
|
||||||
else
|
else
|
||||||
browser_window_key_press(bw, 24);
|
browser_window_key_press(bw, 24);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUHANDLER(copy)
|
MENUHANDLER(copy)
|
||||||
@ -661,6 +670,8 @@ MENUHANDLER(copy)
|
|||||||
gtk_editable_copy_clipboard(GTK_EDITABLE(gw->url_bar));
|
gtk_editable_copy_clipboard(GTK_EDITABLE(gw->url_bar));
|
||||||
else
|
else
|
||||||
gui_copy_to_clipboard(bw->sel);
|
gui_copy_to_clipboard(bw->sel);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUHANDLER(paste)
|
MENUHANDLER(paste)
|
||||||
@ -674,6 +685,8 @@ MENUHANDLER(paste)
|
|||||||
gtk_editable_paste_clipboard (GTK_EDITABLE (focused));
|
gtk_editable_paste_clipboard (GTK_EDITABLE (focused));
|
||||||
else
|
else
|
||||||
gui_paste_from_clipboard(gui, 0, 0);
|
gui_paste_from_clipboard(gui, 0, 0);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUHANDLER(select_all)
|
MENUHANDLER(select_all)
|
||||||
@ -683,6 +696,8 @@ MENUHANDLER(select_all)
|
|||||||
|
|
||||||
LOG(("Selecting all text"));
|
LOG(("Selecting all text"));
|
||||||
selection_select_all(bw->sel);
|
selection_select_all(bw->sel);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUHANDLER(preferences)
|
MENUHANDLER(preferences)
|
||||||
@ -693,6 +708,7 @@ MENUHANDLER(preferences)
|
|||||||
gw->preferences_dialog = nsgtk_options_init(bw, gw->window);
|
gw->preferences_dialog = nsgtk_options_init(bw, gw->window);
|
||||||
else
|
else
|
||||||
gtk_widget_show (GTK_WIDGET(gw->preferences_dialog));
|
gtk_widget_show (GTK_WIDGET(gw->preferences_dialog));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,6 +885,8 @@ MENUHANDLER(save_box_tree)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy(save_dialog);
|
gtk_widget_destroy(save_dialog);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUHANDLER(save_dom_tree)
|
MENUHANDLER(save_dom_tree)
|
||||||
@ -917,6 +935,8 @@ MENUHANDLER(save_dom_tree)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy(save_dialog);
|
gtk_widget_destroy(save_dialog);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -968,6 +988,8 @@ MENUHANDLER(next_tab)
|
|||||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||||
|
|
||||||
gtk_notebook_next_page(gw->notebook);
|
gtk_notebook_next_page(gw->notebook);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUHANDLER(prev_tab)
|
MENUHANDLER(prev_tab)
|
||||||
@ -975,6 +997,8 @@ MENUHANDLER(prev_tab)
|
|||||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||||
|
|
||||||
gtk_notebook_prev_page(gw->notebook);
|
gtk_notebook_prev_page(gw->notebook);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUHANDLER(about)
|
MENUHANDLER(about)
|
||||||
|
Loading…
Reference in New Issue
Block a user