summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
committerVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
commitc105738fa36bb2400adc47399c5b878d252d1c86 (patch)
tree138eeb449e1bf51ee1726b5f820740aada0ccd0b /gtk
parent20f2c86a511f7913cf858e7bd3668b0b59663ba0 (diff)
downloadnetsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.gz
netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.bz2
Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all callsites to have double bracketing and allows for future improvement on how we use the logging macros. The callsites were changed with coccinelle and the changes checked by hand. Compile tested for several frontends but not all. A formatting annotation has also been added which allows the compiler to check the parameters and types passed to the logging.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/cookies.c2
-rw-r--r--gtk/fetch.c2
-rw-r--r--gtk/font_pango.c4
-rw-r--r--gtk/gdk.c2
-rw-r--r--gtk/gui.c36
-rw-r--r--gtk/history.c2
-rw-r--r--gtk/hotlist.c2
-rw-r--r--gtk/plotters.c4
-rw-r--r--gtk/preferences.c10
-rw-r--r--gtk/print.c21
-rw-r--r--gtk/scaffolding.c21
-rw-r--r--gtk/schedule.c9
-rw-r--r--gtk/tabs.c4
-rw-r--r--gtk/theme.c2
-rw-r--r--gtk/throbber.c8
-rw-r--r--gtk/toolbar.c2
-rw-r--r--gtk/treeview.c2
-rw-r--r--gtk/viewdata.c20
-rw-r--r--gtk/window.c34
19 files changed, 94 insertions, 93 deletions
diff --git a/gtk/cookies.c b/gtk/cookies.c
index ee7238746..cb59d0ae8 100644
--- a/gtk/cookies.c
+++ b/gtk/cookies.c
@@ -142,7 +142,7 @@ void nsgtk_cookies_init_menu()
while (event->widget != NULL) {
w = GTK_WIDGET(gtk_builder_get_object(gladeFile, event->widget));
if (w == NULL) {
- LOG(("Unable to connect menu widget ""%s""", event->widget)); } else {
+ LOG("Unable to connect menu widget ""%s""", event->widget); } else {
g_signal_connect(G_OBJECT(w), "activate", event->handler, cookies_window);
}
event++;
diff --git a/gtk/fetch.c b/gtk/fetch.c
index f56e99d81..f68f203d5 100644
--- a/gtk/fetch.c
+++ b/gtk/fetch.c
@@ -73,7 +73,7 @@ void gtk_fetch_filetype_init(const char *mimefile)
hash_add(mime_hash, "spr", "image/x-riscos-sprite");
if (fh == NULL) {
- LOG(("Unable to open a mime.types file, so using a minimal one for you."));
+ LOG("Unable to open a mime.types file, so using a minimal one for you.");
return;
}
diff --git a/gtk/font_pango.c b/gtk/font_pango.c
index ee506380f..d3a2a2a94 100644
--- a/gtk/font_pango.c
+++ b/gtk/font_pango.c
@@ -59,12 +59,12 @@ static PangoLayout *nsfont_pango_layout = NULL;
static inline void nsfont_pango_check(void)
{
if (nsfont_pango_context == NULL) {
- LOG(("Creating nsfont_pango_context."));
+ LOG("Creating nsfont_pango_context.");
nsfont_pango_context = gdk_pango_context_get();
}
if (nsfont_pango_layout == NULL) {
- LOG(("Creating nsfont_pango_layout."));
+ LOG("Creating nsfont_pango_layout.");
nsfont_pango_layout = pango_layout_new(nsfont_pango_context);
}
}
diff --git a/gtk/gdk.c b/gtk/gdk.c
index 22569285d..9ed90bd8e 100644
--- a/gtk/gdk.c
+++ b/gtk/gdk.c
@@ -86,7 +86,7 @@ nsgdk_pixbuf_get_from_surface(cairo_surface_t *surface, int scwidth, int scheigh
if (cairo_surface_status(scsurface) != CAIRO_STATUS_SUCCESS) {
cairo_surface_destroy(scsurface);
g_object_unref(pixbuf);
- LOG(("Surface creation failed"));
+ LOG("Surface creation failed");
return NULL;
}
diff --git a/gtk/gui.c b/gtk/gui.c
index 6f51133e4..b8d8fc152 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -192,7 +192,7 @@ nsgtk_new_ui(char **respath, const char *name, GtkBuilder **pglade)
gtk_builder_connect_signals(builder, NULL);
- LOG(("Using '%s' as %s ui template file", filepath, name));
+ LOG("Using '%s' as %s ui template file", filepath, name);
if (pglade != NULL) {
*pglade = builder;
@@ -290,7 +290,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
(nsoption_charp(hotlist_path) == NULL) ||
(nsoption_charp(downloads_directory) == NULL) ||
(nsoption_charp(ca_path) == NULL)) {
- LOG(("Failed initialising default resource paths"));
+ LOG("Failed initialising default resource paths");
return NSERROR_BAD_PARAMETER;
}
@@ -333,7 +333,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
themelist_file_location = NULL;
}
if (themelist_file_location == NULL) {
- LOG(("Unable to find themelist - disabling"));
+ LOG("Unable to find themelist - disabling");
}
/* Obtain resources path location.
@@ -345,7 +345,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
memcpy(res_dir_location,
languages_file_location,
strlen(languages_file_location) - 9);
- LOG(("Using '%s' for resource path", res_dir_location));
+ LOG("Using '%s' for resource path", res_dir_location);
/* initialise the glade templates */
nsgtk_init_glade(respath);
@@ -361,7 +361,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
resource_filename = filepath_find(respath, "SearchEngines");
search_web_init(resource_filename);
if (resource_filename != NULL) {
- LOG(("Using '%s' as Search Engines file", resource_filename));
+ LOG("Using '%s' as Search Engines file", resource_filename);
free(resource_filename);
}
@@ -378,7 +378,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
/* Toolbar inicies file */
toolbar_indices_file_location = filepath_find(respath, "toolbarIndices");
- LOG(("Using '%s' as custom toolbar settings file", toolbar_indices_file_location));
+ LOG("Using '%s' as custom toolbar settings file", toolbar_indices_file_location);
/* load throbber images */
if (nsgtk_throbber_init(respath, THROBBER_FRAMES) == false)
@@ -400,7 +400,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
* window.
*/
browser_set_dpi(gdk_screen_get_resolution(gdk_screen_get_default()));
- LOG(("Set CSS DPI to %d", browser_get_dpi()));
+ LOG("Set CSS DPI to %d", browser_get_dpi());
if (nsgtk_history_init(glade_file_location->history) == false)
die("Unable to initialise history window.\n");
@@ -529,7 +529,7 @@ static void nsgtk_main(void)
static void gui_quit(void)
{
- LOG(("Quitting GUI"));
+ LOG("Quitting GUI");
/* Ensure all scaffoldings are destroyed before we go into exit */
nsgtk_download_destroy();
@@ -567,7 +567,7 @@ void warn_user(const char *warning, const char *detail)
{
char buf[300]; /* 300 is the size the RISC OS GUI uses */
- LOG(("%s %s", warning, detail ? detail : ""));
+ LOG("%s %s", warning, detail ? detail : "");
fflush(stdout);
snprintf(buf, sizeof(buf), "%s %s", messages_get(warning),
@@ -856,7 +856,7 @@ static nserror get_config_home(char **config_home_out)
if (home_dir != NULL) {
ret = check_dirname(home_dir, ".netsurf", &config_home);
if (ret == NSERROR_OK) {
- LOG(("\"%s\"", config_home));
+ LOG("\"%s\"", config_home);
*config_home_out = config_home;
return ret;
}
@@ -896,7 +896,7 @@ static nserror get_config_home(char **config_home_out)
}
}
- LOG(("\"%s\"", config_home));
+ LOG("\"%s\"", config_home);
*config_home_out = config_home;
return NSERROR_OK;
@@ -909,7 +909,7 @@ static nserror create_config_home(char **config_home_out)
char *xdg_config_dir;
nserror ret;
- LOG(("Attempting to create configuration directory"));
+ LOG("Attempting to create configuration directory");
/* $XDG_CONFIG_HOME defines the base directory
* relative to which user specific configuration files
@@ -945,7 +945,7 @@ static nserror create_config_home(char **config_home_out)
/* strip the trailing separator */
config_home[strlen(config_home) - 1] = 0;
- LOG(("\"%s\"", config_home));
+ LOG("\"%s\"", config_home);
*config_home_out = config_home;
@@ -994,7 +994,7 @@ static nserror get_cache_home(char **cache_home_out)
}
}
- LOG(("\"%s\"", cache_home));
+ LOG("\"%s\"", cache_home);
*cache_home_out = cache_home;
return NSERROR_OK;
@@ -1007,7 +1007,7 @@ static nserror create_cache_home(char **cache_home_out)
char *xdg_cache_dir;
nserror ret;
- LOG(("Attempting to create configuration directory"));
+ LOG("Attempting to create configuration directory");
/* $XDG_CACHE_HOME defines the base directory
* relative to which user specific cache files
@@ -1043,7 +1043,7 @@ static nserror create_cache_home(char **cache_home_out)
/* strip the trailing separator */
cache_home[strlen(cache_home) - 1] = 0;
- LOG(("\"%s\"", cache_home));
+ LOG("\"%s\"", cache_home);
*cache_home_out = cache_home;
@@ -1131,7 +1131,7 @@ int main(int argc, char** argv)
ret = create_config_home(&nsgtk_config_home);
}
if (ret != NSERROR_OK) {
- LOG(("Unable to locate a configuration directory."));
+ LOG("Unable to locate a configuration directory.");
nsgtk_config_home = NULL;
}
@@ -1161,7 +1161,7 @@ int main(int argc, char** argv)
ret = create_cache_home(&cache_home);
}
if (ret != NSERROR_OK) {
- LOG(("Unable to locate a cache directory."));
+ LOG("Unable to locate a cache directory.");
}
/* core initialisation */
diff --git a/gtk/history.c b/gtk/history.c
index 9a507ef1f..2dbedf98a 100644
--- a/gtk/history.c
+++ b/gtk/history.c
@@ -146,7 +146,7 @@ void nsgtk_history_init_menu(void)
while (event->widget != NULL) {
w = GTK_WIDGET(gtk_builder_get_object(gladeFile, event->widget));
if (w == NULL) {
- LOG(("Unable to connect menu widget ""%s""", event->widget));
+ LOG("Unable to connect menu widget ""%s""", event->widget);
} else {
g_signal_connect(G_OBJECT(w), "activate", event->handler, global_history_window);
}
diff --git a/gtk/hotlist.c b/gtk/hotlist.c
index 3f2515ec8..fed6ae735 100644
--- a/gtk/hotlist.c
+++ b/gtk/hotlist.c
@@ -154,7 +154,7 @@ void nsgtk_hotlist_init_menu(void)
while (event->widget != NULL) {
w = GTK_WIDGET(gtk_builder_get_object(gladeFile, event->widget));
if (w == NULL) {
- LOG(("Unable to connect menu widget ""%s""", event->widget)); } else {
+ LOG("Unable to connect menu widget ""%s""", event->widget); } else {
g_signal_connect(G_OBJECT(w), "activate", event->handler, hotlist_window);
}
event++;
diff --git a/gtk/plotters.c b/gtk/plotters.c
index ab7e4c5fb..33f4c65fe 100644
--- a/gtk/plotters.c
+++ b/gtk/plotters.c
@@ -450,7 +450,7 @@ static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float w
return true;
if (p[0] != PLOTTER_PATH_MOVE) {
- LOG(("Path does not start with move"));
+ LOG("Path does not start with move");
return false;
}
@@ -489,7 +489,7 @@ static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float w
p[i+5], p[i+6]);
i += 7;
} else {
- LOG(("bad path command %f", p[i]));
+ LOG("bad path command %f", p[i]);
/* Reset matrix for safety */
cairo_set_matrix(current_cr, &old_ctm);
return false;
diff --git a/gtk/preferences.c b/gtk/preferences.c
index 446732651..9ca8eb759 100644
--- a/gtk/preferences.c
+++ b/gtk/preferences.c
@@ -566,7 +566,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget,
gtk_list_store_clear(priv->content_language);
active_language = -1;
- LOG(("Used %s for languages", languages_file_location));
+ LOG("Used %s for languages", languages_file_location);
while (fgets(buf, sizeof(buf), fp)) {
/* Ignore blank lines */
if (buf[0] == '\0')
@@ -597,7 +597,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget,
fclose(fp);
} else {
- LOG(("Failed opening languages file"));
+ LOG("Failed opening languages file");
}
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), active_language);
@@ -667,7 +667,7 @@ nsgtk_preferences_comboTheme_realize(GtkWidget *widget, struct ppref *priv)
((fp = fopen(themelist_file_location, "r")) != NULL)) {
gtk_list_store_clear(priv->themes);
- LOG(("Used %s for themelist", themelist_file_location));
+ LOG("Used %s for themelist", themelist_file_location);
while (fgets(buf, sizeof(buf), fp)) {
/* Ignore blank lines */
@@ -685,7 +685,7 @@ nsgtk_preferences_comboTheme_realize(GtkWidget *widget, struct ppref *priv)
fclose(fp);
} else {
- LOG(("Failed opening themes file"));
+ LOG("Failed opening themes file");
}
/* get configured theme and sanity check value */
@@ -1065,7 +1065,7 @@ GtkWidget* nsgtk_preferences(struct browser_window *bw, GtkWindow *parent)
priv->dialog = gtk_builder_get_object(preferences_builder,
"dialogPreferences");
if (priv->dialog == NULL) {
- LOG(("Unable to get object for preferences dialog"));
+ LOG("Unable to get object for preferences dialog");
/* release builder as were done with it */
g_object_unref(G_OBJECT(preferences_builder));
return NULL;
diff --git a/gtk/print.c b/gtk/print.c
index 53fbed083..e5e9e847f 100644
--- a/gtk/print.c
+++ b/gtk/print.c
@@ -137,8 +137,7 @@ static inline void nsgtk_print_set_dashed(void)
/** Set clipping area for subsequent plot operations. */
static bool nsgtk_print_plot_clip(const struct rect *clip)
{
- LOG(("Clipping. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i",
- clip->x0, clip->y0, clip->x1, clip->y1));
+ LOG("Clipping. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", clip->x0, clip->y0, clip->x1, clip->y1);
/* Normalize cllipping area - to prevent overflows.
* See comment in pdf_plot_fill. */
@@ -248,7 +247,7 @@ static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, const plot_sty
static bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- LOG(("x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", x0,y0,x1,y1));
+ LOG("x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", x0, y0, x1, y1);
if (style->fill_type != PLOT_OP_TYPE_NONE) {
@@ -302,7 +301,7 @@ static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, const plot_st
{
unsigned int i;
- LOG(("Plotting polygon."));
+ LOG("Plotting polygon.");
nsgtk_print_set_colour(style->fill_colour);
nsgtk_print_set_solid();
@@ -310,11 +309,11 @@ static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, const plot_st
cairo_set_line_width(gtk_print_current_cr, 0);
cairo_move_to(gtk_print_current_cr, p[0], p[1]);
- LOG(("Starting line at: %i\t%i",p[0],p[1]));
+ LOG("Starting line at: %i\t%i", p[0], p[1]);
for (i = 1; i != n; i++) {
cairo_line_to(gtk_print_current_cr, p[i * 2], p[i * 2 + 1]);
- LOG(("Drawing line to: %i\t%i",p[i * 2], p[i * 2 + 1]));
+ LOG("Drawing line to: %i\t%i", p[i * 2], p[i * 2 + 1]);
}
cairo_fill(gtk_print_current_cr);
@@ -553,7 +552,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation,
int page_number;
double height_on_page, height_to_print;
- LOG(("Begin print"));
+ LOG("Begin print");
settings = user_data;
@@ -572,9 +571,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation,
} else {
- LOG(("page_width: %f ;page_height: %f; content height: %lf",
- settings->page_width, settings->page_height,
- height_to_print));
+ LOG("page_width: %f ;page_height: %f; content height: %lf", settings->page_width, settings->page_height, height_to_print);
height_on_page = settings->page_height;
height_on_page = height_on_page -
@@ -598,7 +595,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation,
void gtk_print_signal_draw_page(GtkPrintOperation *operation,
GtkPrintContext *context, gint page_nr, gpointer user_data)
{
- LOG(("Draw Page"));
+ LOG("Draw Page");
gtk_print_current_cr = gtk_print_context_get_cairo_context(context);
print_draw_next_page(&gtk_printer, settings);
}
@@ -610,7 +607,7 @@ void gtk_print_signal_draw_page(GtkPrintOperation *operation,
void gtk_print_signal_end_print(GtkPrintOperation *operation,
GtkPrintContext *context, gpointer user_data)
{
- LOG(("End print"));
+ LOG("End print");
print_cleanup(content_to_print, &gtk_printer, user_data);
}
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 661902b9e..3151ba145 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -227,7 +227,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
{
struct nsgtk_scaffolding *gs = data;
- LOG(("scaffold:%p", gs));
+ LOG("scaffold:%p", gs);
if ((gs->history_window) && (gs->history_window->window)) {
gtk_widget_destroy(GTK_WIDGET(gs->history_window->window));
@@ -242,7 +242,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
gs->next->prev = gs->prev;
}
- LOG(("scaffold list head: %p", scaf_list));
+ LOG("scaffold list head: %p", scaf_list);
if (scaf_list == NULL) {
/* no more open windows - stop the browser */
@@ -668,8 +668,7 @@ MULTIHANDLER(savepage)
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc));
d = opendir(path);
if (d == NULL) {
- LOG(("Unable to open directory %s for complete save: %s", path,
- strerror(errno)));
+ LOG("Unable to open directory %s for complete save: %s", path, strerror(errno));
if (errno == ENOTDIR)
warn_user("NoDirError", path);
else
@@ -701,7 +700,7 @@ MULTIHANDLER(pdf)
char *url_name;
nserror res;
- LOG(("Print preview (generating PDF) started."));
+ LOG("Print preview (generating PDF) started.");
res = nsurl_nice(browser_window_get_url(bw), &url_name, true);
if (res != NSERROR_OK) {
@@ -1085,10 +1084,10 @@ MULTIHANDLER(selectall)
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (nsgtk_widget_has_focus(GTK_WIDGET(g->url_bar))) {
- LOG(("Selecting all URL bar text"));
+ LOG("Selecting all URL bar text");
gtk_editable_select_region(GTK_EDITABLE(g->url_bar), 0, -1);
} else {
- LOG(("Selecting all document text"));
+ LOG("Selecting all document text");
browser_window_key_press(bw, NS_KEY_SELECT_ALL);
}
@@ -1704,7 +1703,7 @@ static gboolean nsgtk_history_button_press_event(GtkWidget *widget,
struct browser_window *bw =
nsgtk_get_browser_window(hw->g->top_level);
- LOG(("X=%g, Y=%g", event->x, event->y));
+ LOG("X=%g, Y=%g", event->x, event->y);
browser_window_history_click(bw, event->x, event->y, false);
@@ -2043,7 +2042,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
return NULL;
}
- LOG(("Constructing a scaffold of %p for gui_window %p", g, toplevel));
+ LOG("Constructing a scaffold of %p for gui_window %p", g, toplevel);
g->top_level = toplevel;
@@ -2293,7 +2292,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(g->window));
- LOG(("creation complete"));
+ LOG("creation complete");
return g;
}
@@ -2470,7 +2469,7 @@ gui_search_web_provider_update(const char *provider_name,
GdkPixbuf *srch_pixbuf = NULL;
char *searchcontent;
- LOG(("name:%s bitmap %p", provider_name, provider_bitmap));
+ LOG("name:%s bitmap %p", provider_name, provider_bitmap);
if (provider_bitmap != NULL) {
srch_pixbuf = nsgdk_pixbuf_get_from_surface(provider_bitmap->surface, 16, 16);
diff --git a/gtk/schedule.c b/gtk/schedule.c
index e28675a0b..cf0333388 100644
--- a/gtk/schedule.c
+++ b/gtk/schedule.c
@@ -27,7 +27,7 @@
#ifdef DEBUG_GTK_SCHEDULE
#include "utils/log.h"
#else
-#define LOG(X)
+#define LOG(format, args...) ((void) 0)
#endif
/** Killable callback closure embodiment. */
@@ -50,7 +50,7 @@ nsgtk_schedule_generic_callback(gpointer data)
_nsgtk_callback_t *cb = (_nsgtk_callback_t *)(data);
if (cb->callback_killed) {
/* This callback instance has been killed. */
- LOG(("CB at %p already dead.", cb));
+ LOG("CB at %p already dead.", cb);
}
queued_callbacks = g_list_remove(queued_callbacks, cb);
pending_callbacks = g_list_append(pending_callbacks, cb);
@@ -64,8 +64,7 @@ nsgtk_schedule_kill_callback(void *_target, void *_match)
_nsgtk_callback_t *match = (_nsgtk_callback_t *)_match;
if ((target->callback == match->callback) &&
(target->context == match->context)) {
- LOG(("Found match for %p(%p), killing.",
- target->callback, target->context));
+ LOG("Found match for %p(%p), killing.", target->callback, target->context);
target->callback = NULL;
target->context = NULL;
target->callback_killed = true;
@@ -123,7 +122,7 @@ schedule_run(void)
/* Clear the pending list. */
pending_callbacks = NULL;
- LOG(("Captured a run of %d callbacks to fire.", g_list_length(this_run)));
+ LOG("Captured a run of %d callbacks to fire.", g_list_length(this_run));
/* Run all the callbacks which made it this far. */
while (this_run != NULL) {
diff --git a/gtk/tabs.c b/gtk/tabs.c
index c50c11400..0a1923604 100644
--- a/gtk/tabs.c
+++ b/gtk/tabs.c
@@ -148,7 +148,7 @@ nsgtk_tab_switch_page_after(GtkNotebook *notebook,
if ((srcpagenum != -1) &&
(srcpagenum != (gint)selpagenum)) {
/* ensure the add tab is not actually selected */
- LOG(("src %d sel %d",srcpagenum,selpagenum ));
+ LOG("src %d sel %d", srcpagenum, selpagenum);
srcpage = gtk_notebook_get_nth_page(notebook, srcpagenum);
gw = g_object_get_data(G_OBJECT(srcpage), "gui_window");
if ((gw != NULL) && (nsgtk_get_scaffold(gw) != NULL)) {
@@ -156,7 +156,7 @@ nsgtk_tab_switch_page_after(GtkNotebook *notebook,
}
}
} else {
- LOG(("sel %d", selpagenum ));
+ LOG("sel %d", selpagenum);
/* tab with page in it */
gw = g_object_get_data(G_OBJECT(selpage), "gui_window");
if (gw != NULL) {
diff --git a/gtk/theme.c b/gtk/theme.c
index 4cd02d478..eb43fc588 100644
--- a/gtk/theme.c
+++ b/gtk/theme.c
@@ -130,7 +130,7 @@ static bool nsgtk_theme_verify(const char *themename)
}
val = fwrite(filecontent, strlen(filecontent), 1, fp);
if (val == 0)
- LOG(("empty write themelist"));
+ LOG("empty write themelist");
fclose(fp);
free(filecontent);
return true;
diff --git a/gtk/throbber.c b/gtk/throbber.c
index dac79e39d..8726763ed 100644
--- a/gtk/throbber.c
+++ b/gtk/throbber.c
@@ -48,9 +48,8 @@ bool nsgtk_throbber_initialise_from_png(const int frames, char** frame_files)
if (frames < 2) {
/* we need at least two frames - one for idle, one for active */
- LOG(("Insufficent number of frames in throbber animation!"));
- LOG(("(called with %d frames, where 2 is a minimum.)",
- frames));
+ LOG("Insufficent number of frames in throbber animation!");
+ LOG("(called with %d frames, where 2 is a minimum.)", frames);
return false;
}
@@ -68,8 +67,7 @@ bool nsgtk_throbber_initialise_from_png(const int frames, char** frame_files)
for (frame_loop = 0; frame_loop < frames; frame_loop++) {
throb->framedata[frame_loop] = gdk_pixbuf_new_from_file(frame_files[frame_loop], &err);
if (err != NULL) {
- LOG(("Error when loading %s: %s (%d)",
- frame_files[frame_loop], err->message, err->code));
+ LOG("Error when loading %s: %s (%d)", frame_files[frame_loop], err->message, err->code);
throb->framedata[frame_loop] = NULL;
errors_when_loading = true;
}
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index b6bf8d98a..35ff25ccc 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -1118,7 +1118,7 @@ void nsgtk_toolbar_customization_load(struct nsgtk_scaffolding *g)
}
val = fgets(buffer, sizeof buffer, f);
if (val == NULL) {
- LOG(("empty read toolbar settings"));
+ LOG("empty read toolbar settings");
}
fclose(f);
i = BACK_BUTTON;
diff --git a/gtk/treeview.c b/gtk/treeview.c
index 9613f11fd..2b2e6c781 100644
--- a/gtk/treeview.c
+++ b/gtk/treeview.c
@@ -534,7 +534,7 @@ struct nsgtk_treeview *nsgtk_treeview_create(unsigned int flags,
tv = malloc(sizeof(struct nsgtk_treeview));
if (tv == NULL) {
- LOG(("malloc failed"));
+ LOG("malloc failed");
warn_user("NoMemory", 0);
return NULL;
}
diff --git a/gtk/viewdata.c b/gtk/viewdata.c
index bde87a70a..94dc5c573 100644
--- a/gtk/viewdata.c
+++ b/gtk/viewdata.c
@@ -376,7 +376,7 @@ window_init(const char *title,
if (!gtk_builder_add_from_file(newctx->builder,
glade_file_location->viewdata,
&error)) {
- LOG(("Couldn't load builder file: %s", error->message));
+ LOG("Couldn't load builder file: %s", error->message);
g_error_free(error);
free(newctx);
return NSERROR_INIT_FAILED;
@@ -386,7 +386,7 @@ window_init(const char *title,
window = GTK_WINDOW(gtk_builder_get_object(newctx->builder, "ViewDataWindow"));
if (window == NULL) {
- LOG(("Unable to find window in builder "));
+ LOG("Unable to find window in builder ");
/* free the builder */
g_object_unref(G_OBJECT(newctx->builder));
@@ -621,7 +621,7 @@ static char** xdg_data_strvec(void)
xdg_data_home, xdg_data_dirs);
}
- LOG(("%s", xdg_data_path));
+ LOG("%s", xdg_data_path);
svec = filepath_path_to_strvec(xdg_data_path);
free(xdg_data_path);
@@ -656,7 +656,7 @@ static char *xdg_get_default_app(const char *path, const char *mimetype)
fname = malloc(fname_len);
snprintf(fname, fname_len, "%s/applications/defaults.list", path);
- LOG(("Checking %s", fname));
+ LOG("Checking %s", fname);
fp = fopen(fname, "r");
free(fname);
@@ -679,8 +679,8 @@ static char *xdg_get_default_app(const char *path, const char *mimetype)
ret = strdup(line + mimetype_len + 1);
- LOG(("Found line match for %s length %zu\n", mimetype, rd));
- LOG(("Result %s", ret));
+ LOG("Found line match for %s length %zu\n", mimetype, rd);
+ LOG("Result %s", ret);
break;
}
@@ -719,7 +719,7 @@ static char *xdg_get_exec_cmd(const char *path, const char *desktop)
fname = malloc(fname_len);
snprintf(fname, fname_len, "%s/applications/%s", path, desktop);
- LOG(("Checking %s", fname));
+ LOG("Checking %s", fname);
fp = fopen(fname, "r");
free(fname);
@@ -740,8 +740,8 @@ static char *xdg_get_exec_cmd(const char *path, const char *desktop)
ret = strdup(line + SLEN("Exec="));
- LOG(("Found Exec length %zu", rd));
- LOG(("Result %s", ret));
+ LOG("Found Exec length %zu", rd);
+ LOG("Result %s", ret);
break;
}
@@ -806,7 +806,7 @@ static char **build_exec_argv(const char *fname, const char *exec_cmd)
argv[aidx] = exec_arg(start, cur - start, fname);
if (argv[aidx] != NULL) {
- LOG(("adding \"%s\"", argv[aidx]));
+ LOG("adding \"%s\"", argv[aidx]);
aidx++;
}
}
diff --git a/gtk/window.c b/gtk/window.c
index 375f232a8..75a6d9f6b 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -463,7 +463,7 @@ nsgtk_window_scroll_event(GtkWidget *widget,
break;
#endif
default:
- LOG(("Unhandled mouse scroll direction"));
+ LOG("Unhandled mouse scroll direction");
return TRUE;
}
@@ -760,7 +760,7 @@ gui_window_create(struct browser_window *bw,
return NULL;
}
- LOG(("Creating gui window %p for browser window %p", g, bw));
+ LOG("Creating gui window %p for browser window %p", g, bw);
g->bw = bw;
g->mouse.state = 0;
@@ -920,10 +920,10 @@ void nsgtk_window_destroy_browser(struct gui_window *gw)
static void gui_window_destroy(struct gui_window *g)
{
- LOG(("gui_window: %p", g));
+ LOG("gui_window: %p", g);
assert(g != NULL);
assert(g->bw != NULL);
- LOG(("scaffolding: %p", g->scaffold));
+ LOG("scaffolding: %p", g->scaffold);
if (g->prev) {
g->prev->next = g->next;
@@ -935,7 +935,7 @@ static void gui_window_destroy(struct gui_window *g)
g->next->prev = g->prev;
}
- LOG(("window list head: %p", window_list));
+ LOG("window list head: %p", window_list);
}
/**
@@ -954,13 +954,13 @@ static void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon)
if (icon != NULL) {
icon_bitmap = content_get_bitmap(icon);
if (icon_bitmap != NULL) {
- LOG(("Using %p bitmap", icon_bitmap));
+ LOG("Using %p bitmap", icon_bitmap);
gw->icon = nsgdk_pixbuf_get_from_surface(icon_bitmap->surface, 16, 16);
}
}
if (gw->icon == NULL) {
- LOG(("Using default favicon"));
+ LOG("Using default favicon");
g_object_ref(favicon_pixbuf);
gw->icon = favicon_pixbuf;
}
@@ -1218,8 +1218,8 @@ static void gui_window_get_dimensions(struct gui_window *g, int *width, int *hei
*width /= scale;
*height /= scale;
}
- LOG(("width: %i", *width));
- LOG(("height: %i", *height));
+ LOG("width: %i", *width);
+ LOG("height: %i", *height);
}
static void gui_window_start_selection(struct gui_window *g)
@@ -1250,12 +1250,20 @@ static void gui_window_create_form_select_menu(struct gui_window *g,
item = 0;
option = form_select_get_option(control, item);
while (option != NULL) {
- LOG(("Item %d option %p text %s", item, option, option->text));
+ LOG("Item %"PRIdPTR" option %p text %s",
+ item, option, option->text);
menu_item = gtk_check_menu_item_new_with_label(option->text);
- if (option->selected)
+ if (option->selected) {
gtk_check_menu_item_set_active(
GTK_CHECK_MENU_ITEM(menu_item), TRUE);
+ }
+ /*
+ * This casts the item index integer into an integer
+ * the size of a pointer. This allows the callback
+ * parameter to be passed avoiding allocating memory
+ * for a context with a single integer in it.
+ */
g_signal_connect(menu_item, "toggled",
G_CALLBACK(nsgtk_select_menu_clicked), (gpointer)item);
@@ -1286,10 +1294,10 @@ gui_window_file_gadget_open(struct gui_window *g,
NSGTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- LOG(("*** open dialog: %p", dialog));
+ LOG("*** open dialog: %p", dialog);
int ret = gtk_dialog_run(GTK_DIALOG(dialog));
- LOG(("*** return value: %d", ret));
+ LOG("*** return value: %d", ret);
if (ret == GTK_RESPONSE_ACCEPT) {
char *filename;