diff options
Diffstat (limited to 'frontends/gtk')
-rw-r--r-- | frontends/gtk/cookies.c | 7 | ||||
-rw-r--r-- | frontends/gtk/corewindow.c | 14 | ||||
-rw-r--r-- | frontends/gtk/download.c | 4 | ||||
-rw-r--r-- | frontends/gtk/fetch.c | 3 | ||||
-rw-r--r-- | frontends/gtk/gdk.c | 2 | ||||
-rw-r--r-- | frontends/gtk/global_history.c | 7 | ||||
-rw-r--r-- | frontends/gtk/gui.c | 80 | ||||
-rw-r--r-- | frontends/gtk/hotlist.c | 7 | ||||
-rw-r--r-- | frontends/gtk/layout_pango.c | 12 | ||||
-rw-r--r-- | frontends/gtk/local_history.c | 2 | ||||
-rw-r--r-- | frontends/gtk/login.c | 2 | ||||
-rw-r--r-- | frontends/gtk/plotters.c | 4 | ||||
-rw-r--r-- | frontends/gtk/preferences.c | 11 | ||||
-rw-r--r-- | frontends/gtk/print.c | 28 | ||||
-rw-r--r-- | frontends/gtk/res/options.gtk2.ui | 589 | ||||
-rw-r--r-- | frontends/gtk/res/toolbar.gtk2.ui | 183 | ||||
-rw-r--r-- | frontends/gtk/res/toolbar.gtk3.ui | 242 | ||||
-rw-r--r-- | frontends/gtk/resources.c | 55 | ||||
-rw-r--r-- | frontends/gtk/scaffolding.c | 41 | ||||
-rw-r--r-- | frontends/gtk/schedule.c | 16 | ||||
-rw-r--r-- | frontends/gtk/ssl_cert.c | 2 | ||||
-rw-r--r-- | frontends/gtk/tabs.c | 8 | ||||
-rw-r--r-- | frontends/gtk/throbber.c | 6 | ||||
-rw-r--r-- | frontends/gtk/toolbar.c | 129 | ||||
-rw-r--r-- | frontends/gtk/viewdata.c | 23 | ||||
-rw-r--r-- | frontends/gtk/window.c | 29 |
26 files changed, 756 insertions, 750 deletions
diff --git a/frontends/gtk/cookies.c b/frontends/gtk/cookies.c index 500cd07f6..1f7833cca 100644 --- a/frontends/gtk/cookies.c +++ b/frontends/gtk/cookies.c @@ -164,8 +164,9 @@ static void nsgtk_cookies_init_menu(struct nsgtk_cookie_window *ncwin) w = GTK_WIDGET(gtk_builder_get_object(ncwin->builder, event->widget)); if (w == NULL) { - LOG("Unable to connect menu widget ""%s""", - event->widget); + NSLOG(netsurf, INFO, + "Unable to connect menu widget ""%s""", + event->widget); } else { g_signal_connect(G_OBJECT(w), "activate", @@ -253,7 +254,7 @@ static nserror nsgtk_cookies_init(void) res = nsgtk_builder_new_from_resname("cookies", &ncwin->builder); if (res != NSERROR_OK) { - LOG("Cookie UI builder init failed"); + NSLOG(netsurf, INFO, "Cookie UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/corewindow.c b/frontends/gtk/corewindow.c index ddc61c717..6ca5d228f 100644 --- a/frontends/gtk/corewindow.c +++ b/frontends/gtk/corewindow.c @@ -145,6 +145,7 @@ nsgtk_cw_button_release_event(GtkWidget *widget, { struct nsgtk_corewindow *nsgtk_cw = (struct nsgtk_corewindow *)g; struct nsgtk_corewindow_mouse *mouse = &nsgtk_cw->mouse_state; + bool was_drag = false; /* only button 1 clicks are considered double clicks. If the * mouse state is PRESS then we are waiting for a release to @@ -168,9 +169,11 @@ nsgtk_cw_button_release_event(GtkWidget *widget, } else if (mouse->state & BROWSER_MOUSE_HOLDING_1) { mouse->state ^= (BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON); + was_drag = true; } else if (mouse->state & BROWSER_MOUSE_HOLDING_2) { mouse->state ^= (BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON); + was_drag = true; } /* Handle modifiers being removed */ @@ -188,9 +191,10 @@ nsgtk_cw_button_release_event(GtkWidget *widget, } /* end drag with modifiers */ - if (mouse->state & (BROWSER_MOUSE_MOD_1 | - BROWSER_MOUSE_MOD_2 | - BROWSER_MOUSE_MOD_3)) { + if (was_drag && (mouse->state & ( + BROWSER_MOUSE_MOD_1 | + BROWSER_MOUSE_MOD_2 | + BROWSER_MOUSE_MOD_3))) { mouse->state = BROWSER_MOUSE_HOVER; } @@ -413,14 +417,14 @@ nsgtk_cw_keypress_event(GtkWidget *widget, GdkEventKey *event, gpointer g) if (res == NSERROR_OK) { return TRUE; } else if (res != NSERROR_NOT_IMPLEMENTED) { - LOG("%s", messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res)); return FALSE; } /* deal with unprocessed keypress */ res = nsgtk_cw_key(nsgtk_cw, nskey); if (res != NSERROR_OK) { - LOG("%s", messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res)); return FALSE; } return TRUE; diff --git a/frontends/gtk/download.c b/frontends/gtk/download.c index 8c8161459..d11036ea8 100644 --- a/frontends/gtk/download.c +++ b/frontends/gtk/download.c @@ -331,6 +331,7 @@ static gboolean nsgtk_download_update(gboolean force_update) switch (dl->status) { case NSGTK_DOWNLOAD_WORKING: pulse_mode = TRUE; + /* Fall through */ case NSGTK_DOWNLOAD_NONE: dl->speed = dl->size_downloaded / @@ -347,6 +348,7 @@ static gboolean nsgtk_download_update(gboolean force_update) nsgtk_downloads_num_active++; update = TRUE; + /* Fall through */ case NSGTK_DOWNLOAD_COMPLETE: downloaded += dl->size_downloaded; @@ -475,7 +477,7 @@ nserror nsgtk_download_init(void) res = nsgtk_builder_new_from_resname("downloads", &builder); if (res != NSERROR_OK) { - LOG("Download UI builder init failed"); + NSLOG(netsurf, INFO, "Download UI builder init failed"); return res; } diff --git a/frontends/gtk/fetch.c b/frontends/gtk/fetch.c index 154f43708..7286aec34 100644 --- a/frontends/gtk/fetch.c +++ b/frontends/gtk/fetch.c @@ -90,7 +90,8 @@ void gtk_fetch_filetype_init(const char *mimefile) fh = fopen(mimefile, "r"); if (fh == NULL) { - LOG("Unable to open a mime.types file, so using a minimal one for you."); + NSLOG(netsurf, INFO, + "Unable to open a mime.types file, so using a minimal one for you."); return; } diff --git a/frontends/gtk/gdk.c b/frontends/gtk/gdk.c index 9ed90bd8e..fd82af5b2 100644 --- a/frontends/gtk/gdk.c +++ b/frontends/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"); + NSLOG(netsurf, INFO, "Surface creation failed"); return NULL; } diff --git a/frontends/gtk/global_history.c b/frontends/gtk/global_history.c index 360eb4e1a..f204168d0 100644 --- a/frontends/gtk/global_history.c +++ b/frontends/gtk/global_history.c @@ -214,8 +214,9 @@ nsgtk_global_history_init_menu(struct nsgtk_global_history_window *ghwin) w = GTK_WIDGET(gtk_builder_get_object(ghwin->builder, event->widget)); if (w == NULL) { - LOG("Unable to connect menu widget ""%s""", - event->widget); + NSLOG(netsurf, INFO, + "Unable to connect menu widget ""%s""", + event->widget); } else { g_signal_connect(G_OBJECT(w), "activate", @@ -306,7 +307,7 @@ static nserror nsgtk_global_history_init(void) res = nsgtk_builder_new_from_resname("globalhistory", &ncwin->builder); if (res != NSERROR_OK) { - LOG("History UI builder init failed"); + NSLOG(netsurf, INFO, "History UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c index a183e521f..0f79a1b8e 100644 --- a/frontends/gtk/gui.c +++ b/frontends/gtk/gui.c @@ -208,7 +208,8 @@ 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"); + NSLOG(netsurf, INFO, + "Failed initialising default resource paths"); return NSERROR_BAD_PARAMETER; } @@ -238,7 +239,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) error = nsgtk_builder_new_from_resname("warning", &warning_builder); if (error != NSERROR_OK) { - LOG("Unable to initialise warning dialog"); + NSLOG(netsurf, INFO, "Unable to initialise warning dialog"); return error; } @@ -248,7 +249,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) error = nsgdk_pixbuf_new_from_resname("netsurf.xpm", &win_default_icon_pixbuf); if (error == NSERROR_OK) { - LOG("Seting default window icon"); + NSLOG(netsurf, INFO, "Seting default window icon"); gtk_window_set_default_icon(win_default_icon_pixbuf); } @@ -256,7 +257,8 @@ 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); + NSLOG(netsurf, INFO, "Using '%s' as Search Engines file", + resource_filename); free(resource_filename); } @@ -278,13 +280,20 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) /* initialise throbber */ error = nsgtk_throbber_init(); if (error != NSERROR_OK) { - LOG("Unable to initialise throbber."); + NSLOG(netsurf, INFO, "Unable to initialise throbber."); return error; } /* Initialise completions - cannot fail */ nsgtk_completion_init(); + /* The tree view system needs to know the screen's DPI, so we + * find that out here, rather than when we create a first browser + * window. + */ + browser_set_dpi(gdk_screen_get_resolution(gdk_screen_get_default())); + NSLOG(netsurf, INFO, "Set CSS DPI to %d", browser_get_dpi()); + filepath_sfinddef(respath, buf, "mime.types", "/etc/"); gtk_fetch_filetype_init(buf); @@ -295,17 +304,10 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) hotlist_init(nsoption_charp(hotlist_path), nsoption_charp(hotlist_path)); - /* The tree view system needs to know the screen's DPI, so we - * find that out here, rather than when we create a first browser - * window. - */ - browser_set_dpi(gdk_screen_get_resolution(gdk_screen_get_default())); - LOG("Set CSS DPI to %d", browser_get_dpi()); - /* Initialise top level UI elements */ error = nsgtk_download_init(); if (error != NSERROR_OK) { - LOG("Unable to initialise download window."); + NSLOG(netsurf, INFO, "Unable to initialise download window."); return error; } @@ -426,7 +428,7 @@ static void gui_quit(void) { nserror res; - LOG("Quitting GUI"); + NSLOG(netsurf, INFO, "Quitting GUI"); /* Ensure all scaffoldings are destroyed before we go into exit */ nsgtk_download_destroy(); @@ -435,32 +437,34 @@ static void gui_quit(void) res = nsgtk_cookies_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising cookie viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "Error finalising cookie viewer: %s", + messages_get_errorcode(res)); } res = nsgtk_local_history_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising local history viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, + "Error finalising local history viewer: %s", + messages_get_errorcode(res)); } res = nsgtk_global_history_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising global history viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, + "Error finalising global history viewer: %s", + messages_get_errorcode(res)); } res = nsgtk_hotlist_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising hotlist viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "Error finalising hotlist viewer: %s", + messages_get_errorcode(res)); } res = hotlist_fini(); if (res != NSERROR_OK) { - LOG("Error finalising hotlist: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "Error finalising hotlist: %s", + messages_get_errorcode(res)); } free(nsgtk_config_home); @@ -492,7 +496,7 @@ nserror nsgtk_warning(const char *warning, const char *detail) static GtkWindow *nsgtk_warning_window; GtkLabel *WarningLabel; - LOG("%s %s", warning, detail ? detail : ""); + NSLOG(netsurf, INFO, "%s %s", warning, detail ? detail : ""); fflush(stdout); nsgtk_warning_window = GTK_WINDOW(gtk_builder_get_object(warning_builder, "wndWarning")); @@ -600,7 +604,7 @@ static void nsgtk_pdf_password(char **owner_pass, char **user_pass, char *path) res = nsgtk_builder_new_from_resname("password", &password_builder); if (res != NSERROR_OK) { - LOG("Password UI builder init failed"); + NSLOG(netsurf, INFO, "Password UI builder init failed"); return; } @@ -821,7 +825,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); + NSLOG(netsurf, INFO, "\"%s\"", config_home); *config_home_out = config_home; return ret; } @@ -861,7 +865,7 @@ static nserror get_config_home(char **config_home_out) } } - LOG("\"%s\"", config_home); + NSLOG(netsurf, INFO, "\"%s\"", config_home); *config_home_out = config_home; return NSERROR_OK; @@ -874,7 +878,7 @@ static nserror create_config_home(char **config_home_out) char *xdg_config_dir; nserror ret; - LOG("Attempting to create configuration directory"); + NSLOG(netsurf, INFO, "Attempting to create configuration directory"); /* $XDG_CONFIG_HOME defines the base directory * relative to which user specific configuration files @@ -910,7 +914,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); + NSLOG(netsurf, INFO, "\"%s\"", config_home); *config_home_out = config_home; @@ -959,7 +963,7 @@ static nserror get_cache_home(char **cache_home_out) } } - LOG("\"%s\"", cache_home); + NSLOG(netsurf, INFO, "\"%s\"", cache_home); *cache_home_out = cache_home; return NSERROR_OK; @@ -972,7 +976,7 @@ static nserror create_cache_home(char **cache_home_out) char *xdg_cache_dir; nserror ret; - LOG("Attempting to create configuration directory"); + NSLOG(netsurf, INFO, "Attempting to create configuration directory"); /* $XDG_CACHE_HOME defines the base directory * relative to which user specific cache files @@ -1008,7 +1012,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); + NSLOG(netsurf, INFO, "\"%s\"", cache_home); *cache_home_out = cache_home; @@ -1115,7 +1119,8 @@ int main(int argc, char** argv) ret = create_config_home(&nsgtk_config_home); } if (ret != NSERROR_OK) { - LOG("Unable to locate a configuration directory."); + NSLOG(netsurf, INFO, + "Unable to locate a configuration directory."); nsgtk_config_home = NULL; } @@ -1155,7 +1160,7 @@ int main(int argc, char** argv) if (ret != NSERROR_OK) { fprintf(stderr, "Unable to load translated messages (%s)\n", messages_get_errorcode(ret)); - LOG("Unable to load translated messages"); + NSLOG(netsurf, INFO, "Unable to load translated messages"); /** \todo decide if message load faliure should be fatal */ } @@ -1166,7 +1171,7 @@ int main(int argc, char** argv) ret = create_cache_home(&cache_home); } if (ret != NSERROR_OK) { - LOG("Unable to locate a cache directory."); + NSLOG(netsurf, INFO, "Unable to locate a cache directory."); } /* core initialisation */ @@ -1193,5 +1198,8 @@ int main(int argc, char** argv) /* finalise options */ nsoption_finalise(nsoptions, nsoptions_default); + /* finalise logging */ + nslog_finalise(); + return 0; } diff --git a/frontends/gtk/hotlist.c b/frontends/gtk/hotlist.c index 936573a0b..843e47736 100644 --- a/frontends/gtk/hotlist.c +++ b/frontends/gtk/hotlist.c @@ -236,8 +236,9 @@ static void nsgtk_hotlist_init_menu(struct nsgtk_hotlist_window *hlwin) w = GTK_WIDGET(gtk_builder_get_object(hlwin->builder, event->widget)); if (w == NULL) { - LOG("Unable to connect menu widget ""%s""", - event->widget); + NSLOG(netsurf, INFO, + "Unable to connect menu widget ""%s""", + event->widget); } else { g_signal_connect(G_OBJECT(w), "activate", @@ -326,7 +327,7 @@ static nserror nsgtk_hotlist_init(void) res = nsgtk_builder_new_from_resname("hotlist", &ncwin->builder); if (res != NSERROR_OK) { - LOG("Hotlist UI builder init failed"); + NSLOG(netsurf, INFO, "Hotlist UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c index fb065b127..a5964eb37 100644 --- a/frontends/gtk/layout_pango.c +++ b/frontends/gtk/layout_pango.c @@ -30,6 +30,7 @@ #include "utils/log.h" #include "utils/nsoption.h" +#include "netsurf/inttypes.h" #include "netsurf/layout.h" #include "netsurf/plot_style.h" @@ -42,12 +43,12 @@ static PangoLayout *nsfont_pango_layout = NULL; static inline void nsfont_pango_check(void) { if (nsfont_pango_context == NULL) { - LOG("Creating nsfont_pango_context."); + NSLOG(netsurf, INFO, "Creating nsfont_pango_context."); nsfont_pango_context = gdk_pango_context_get(); } if (nsfont_pango_layout == NULL) { - LOG("Creating nsfont_pango_layout."); + NSLOG(netsurf, INFO, "Creating nsfont_pango_layout."); nsfont_pango_layout = pango_layout_new(nsfont_pango_context); } } @@ -84,9 +85,10 @@ nsfont_width(const plot_font_style_t *fstyle, pango_layout_get_pixel_size(nsfont_pango_layout, width, 0); - /* LOG("fstyle: %p string:\"%.*s\", length: %u, width: %dpx", - fstyle, length, string, length, *width); - */ + NSLOG(netsurf, DEEPDEBUG, + "fstyle: %p string:\"%.*s\", length: %" PRIsizet ", width: %dpx", + fstyle, (int)length, string, length, *width); + return NSERROR_OK; } diff --git a/frontends/gtk/local_history.c b/frontends/gtk/local_history.c index cc9580130..35b7a4ad6 100644 --- a/frontends/gtk/local_history.c +++ b/frontends/gtk/local_history.c @@ -148,7 +148,7 @@ nsgtk_local_history_init(struct browser_window *bw, res = nsgtk_builder_new_from_resname("localhistory", &ncwin->builder); if (res != NSERROR_OK) { - LOG("Local history UI builder init failed"); + NSLOG(netsurf, INFO, "Local history UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/login.c b/frontends/gtk/login.c index 3e29903fe..91d8b37f0 100644 --- a/frontends/gtk/login.c +++ b/frontends/gtk/login.c @@ -222,7 +222,7 @@ void gui_401login_open(nsurl *url, res = create_login_window(url, host, realm, cb, cbpw); if (res != NSERROR_OK) { - LOG("Login init failed"); + NSLOG(netsurf, INFO, "Login init failed"); /* creating login failed so cancel navigation */ cb(false, cbpw); diff --git a/frontends/gtk/plotters.c b/frontends/gtk/plotters.c index c57b03294..88e7760c6 100644 --- a/frontends/gtk/plotters.c +++ b/frontends/gtk/plotters.c @@ -413,7 +413,7 @@ nsgtk_plot_path(const struct redraw_context *ctx, return NSERROR_OK; if (p[0] != PLOTTER_PATH_MOVE) { - LOG("Path does not start with move"); + NSLOG(netsurf, INFO, "Path does not start with move"); return NSERROR_INVALID; } @@ -451,7 +451,7 @@ nsgtk_plot_path(const struct redraw_context *ctx, p[i+5], p[i+6]); i += 7; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); /* Reset matrix for safety */ cairo_set_matrix(current_cr, &old_ctm); return NSERROR_INVALID; diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c index e51e77014..65f41ed27 100644 --- a/frontends/gtk/preferences.c +++ b/frontends/gtk/preferences.c @@ -621,7 +621,7 @@ comboboxLanguage_add_from_file(GtkListStore *liststore, gtk_list_store_clear(liststore); - LOG("Used %s for languages", file_location); + NSLOG(netsurf, INFO, "Used %s for languages", file_location); while (fgets(buf, sizeof(buf), fp)) { /* Ignore blank lines */ if (buf[0] == '\0') @@ -668,7 +668,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget, const char *accept_language; if (priv->content_language == NULL) { - LOG("content language list store unavailable"); + NSLOG(netsurf, INFO, "content language list store unavailable"); return; } @@ -697,7 +697,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget, } } if (res != NSERROR_OK) { - LOG("error populatiung languages combo"); + NSLOG(netsurf, INFO, "error populatiung languages combo"); } } @@ -989,14 +989,15 @@ GtkWidget* nsgtk_preferences(struct browser_window *bw, GtkWindow *parent) res = nsgtk_builder_new_from_resname("options", &preferences_builder); if (res != NSERROR_OK) { - LOG("Preferences UI builder init failed"); + NSLOG(netsurf, INFO, "Preferences UI builder init failed"); return NULL; } priv->dialog = gtk_builder_get_object(preferences_builder, "dialogPreferences"); if (priv->dialog == NULL) { - LOG("Unable to get object for preferences dialog"); + NSLOG(netsurf, INFO, + "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/frontends/gtk/print.c b/frontends/gtk/print.c index 54edeee61..8f71230a6 100644 --- a/frontends/gtk/print.c +++ b/frontends/gtk/print.c @@ -145,8 +145,9 @@ static inline void nsgtk_print_set_dashed(void) static nserror nsgtk_print_plot_clip(const struct redraw_context *ctx, 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); + NSLOG(netsurf, INFO, + "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. */ @@ -324,8 +325,8 @@ nsgtk_print_plot_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) { - LOG("x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", - rect->x0, rect->y0, rect->x1, rect->y1); + NSLOG(netsurf, INFO, "x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", + rect->x0, rect->y0, rect->x1, rect->y1); if (style->fill_type != PLOT_OP_TYPE_NONE) { int x0,y0,x1,y1; @@ -395,7 +396,7 @@ nsgtk_print_plot_polygon(const struct redraw_context *ctx, { unsigned int i; - LOG("Plotting polygon."); + NSLOG(netsurf, INFO, "Plotting polygon."); nsgtk_print_set_colour(style->fill_colour); nsgtk_print_set_solid(); @@ -403,11 +404,12 @@ nsgtk_print_plot_polygon(const struct redraw_context *ctx, 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]); + NSLOG(netsurf, INFO, "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]); + NSLOG(netsurf, INFO, "Drawing line to: %i\t%i", p[i * 2], + p[i * 2 + 1]); } cairo_fill(gtk_print_current_cr); @@ -700,7 +702,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation, int page_number; double height_on_page, height_to_print; - LOG("Begin print"); + NSLOG(netsurf, INFO, "Begin print"); settings = user_data; @@ -719,7 +721,11 @@ 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); + NSLOG(netsurf, INFO, + "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 - @@ -743,7 +749,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"); + NSLOG(netsurf, INFO, "Draw Page"); gtk_print_current_cr = gtk_print_context_get_cairo_context(context); print_draw_next_page(>k_printer, settings); } @@ -755,7 +761,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"); + NSLOG(netsurf, INFO, "End print"); print_cleanup(content_to_print, >k_printer, user_data); } diff --git a/frontends/gtk/res/options.gtk2.ui b/frontends/gtk/res/options.gtk2.ui index d5542ba5d..a1162585d 100644 --- a/frontends/gtk/res/options.gtk2.ui +++ b/frontends/gtk/res/options.gtk2.ui @@ -2,6 +2,297 @@ <interface> <requires lib="gtk+" version="2.16"/> <!-- interface-naming-policy project-wide --> + <object class="GtkAdjustment" id="adjustment_animation_time"> + <property name="lower">0.10000000000000001</property> + <property name="upper">10</property> + <property name="value">0.10000000000000001</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment_cache_disc_size"> + <property name="upper">4096</property> + <property name="value">1024</property> + <property name="step_increment">32</property> + <property name="page_increment">256</property> + </object> + <object class="GtkAdjustment" id="adjustment_cache_memory_size"> + <property name="upper">2048</property> + <property name="value">16</property> + <property name="step_increment">4</property> + <property name="page_increment">16</property> + </object> + <object class="GtkAdjustment" id="adjustment_disc_cache_age"> + <property name="upper">999</property> + <property name="value">28</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment_fetching_cached"> + <property name="upper">100</property> + <property name="value">1</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment_fetching_max"> + <property name="lower">1</property> + <property name="upper">100</property> + <property name="value">10</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment_fetching_perhost"> + <property name="lower">1</property> + <property name="upper">100</property> + <property name="value">1</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment_font_default_size"> + <property name="lower">1</property> + <property name="upper">99.900000000000006</property> + <property name="value">16</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">2</property> + </object> + <object class="GtkAdjustment" id="adjustment_history_age"> + <property name="upper">999</property> + <property name="value">28</property> + <property name="step_increment">1</property> + <property name="page_increment">28</property> + </object> + <object class="GtkAdjustment" id="adjustment_pdf_lmargin"> + <property name="upper">999</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment_pdf_scale"> + <property name="lower">1</property> + <property name="upper">1000</property> + <property name="value">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment_proxy_port"> + <property name="lower">1</property> + <property name="upper">65535</property> + <property name="value">3128</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xpad">3</property> + <property name="stock">gtk-apply</property> + </object> + <object class="GtkListStore" id="liststore_content_language"> + <columns> + <!-- column-name Code --> + <column type="gchararray"/> + <!-- column-name Description --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">en</col> + <col id="1" translatable="yes">English</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststore_defaultfont"> + <columns> + <!-- column-name Type --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">preferencesFonttypeSans</col> + </row> + <row> + <col id="0" translatable="yes">preferencesFonttypeSerif</col> + </row> + <row> + <col id="0" translatable="yes">preferencesFonttypeMonospace</col> + </row> + <row> + <col id="0" translatable="yes">preferencesFonttypeCursive</col> + </row> + <row> + <col id="0" translatable="yes">preferencesFonttypeFantasy</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststore_developer_view"> + <columns> + <!-- column-name Type --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">preferencesDeveloperViewWindow</col> + </row> + <row> + <col id="0" translatable="yes">preferencesDeveloperViewTab</col> + </row> + <row> + <col id="0" translatable="yes">preferencesDeveloperViewEditor</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststore_image_loading"> + <columns> + <!-- column-name Type --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">preferencesImageLoadBoth</col> + </row> + <row> + <col id="0" translatable="yes">preferencesImageLoadFore</col> + </row> + <row> + <col id="0" translatable="yes">preferencesImageLoadBack</col> + </row> + <row> + <col id="0" translatable="yes">preferencesImageLoadNone</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststore_proxy_type"> + <columns> + <!-- column-name Type --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">preferencesProxyTypeDirect</col> + </row> + <row> + <col id="0" translatable="yes">preferencesProxyTypeManual</col> + </row> + <row> + <col id="0" translatable="yes">preferencesProxyTypeBasic</col> + </row> + <row> + <col id="0" translatable="yes">preferencesProxyTypeNLTM</col> + </row> + <row> + <col id="0" translatable="yes">preferencesProxyTypeSystem</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststore_search_provider"> + <columns> + <!-- column-name Provider --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0">Google</col> + </row> + <row> + <col id="0">Yahoo!</col> + </row> + <row> + <col id="0">Microsoft Live</col> + </row> + <row> + <col id="0">Buisiness.com</col> + </row> + <row> + <col id="0">Omgili</col> + </row> + <row> + <col id="0">BBC News</col> + </row> + <row> + <col id="0">Ubuntu Packages</col> + </row> + <row> + <col id="0">Creative Commons</col> + </row> + <row> + <col id="0">Ask</col> + </row> + <row> + <col id="0">Answers</col> + </row> + <row> + <col id="0">Dictionary.com</col> + </row> + <row> + <col id="0">YouTube</col> + </row> + <row> + <col id="0">AeroMP3</col> + </row> + <row> + <col id="0">AOL</col> + </row> + <row> + <col id="0">Baidu</col> + </row> + <row> + <col id="0">Amazon</col> + </row> + <row> + <col id="0">Ebay</col> + </row> + <row> + <col id="0">IMBD</col> + </row> + <row> + <col id="0">ESPN</col> + </row> + <row> + <col id="0">Wikipedia</col> + </row> + <row> + <col id="0">DuckDuckGo</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststore_tab_position"> + <columns> + <!-- column-name Position --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">preferencesTabLocTop</col> + </row> + <row> + <col id="0" translatable="yes">preferencesTabLocLeft</col> + </row> + <row> + <col id="0" translatable="yes">preferencesTabLocRight</col> + </row> + <row> + <col id="0" translatable="yes">preferencesTabLocBottom</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststore_toolbar_buttontype"> + <columns> + <!-- column-name Type --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">preferencesButtonTypeSmall</col> + </row> + <row> + <col id="0" translatable="yes">preferencesButtonTypeLarge</col> + </row> + <row> + <col id="0" translatable="yes">preferencesButtonTypeLargeText</col> + </row> + <row> + <col id="0" translatable="yes">preferencesButtonTypeText</col> + </row> + </data> + </object> <object class="GtkDialog" id="dialogPreferences"> <property name="can_focus">False</property> <property name="border_width">5</property> @@ -2178,7 +2469,6 @@ </child> <child> <object class="GtkVBox" id="vbox_pdfexport"> - <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">6</property> <child> @@ -2583,6 +2873,12 @@ <property name="x_options">GTK_EXPAND</property> </packing> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">True</property> @@ -2710,295 +3006,4 @@ <action-widget response="-7">close</action-widget> </action-widgets> </object> - <object class="GtkListStore" id="liststore_search_provider"> - <columns> - <!-- column-name Provider --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0">Google</col> - </row> - <row> - <col id="0">Yahoo!</col> - </row> - <row> - <col id="0">Microsoft Live</col> - </row> - <row> - <col id="0">Buisiness.com</col> - </row> - <row> - <col id="0">Omgili</col> - </row> - <row> - <col id="0">BBC News</col> - </row> - <row> - <col id="0">Ubuntu Packages</col> - </row> - <row> - <col id="0">Creative Commons</col> - </row> - <row> - <col id="0">Ask</col> - </row> - <row> - <col id="0">Answers</col> - </row> - <row> - <col id="0">Dictionary.com</col> - </row> - <row> - <col id="0">YouTube</col> - </row> - <row> - <col id="0">AeroMP3</col> - </row> - <row> - <col id="0">AOL</col> - </row> - <row> - <col id="0">Baidu</col> - </row> - <row> - <col id="0">Amazon</col> - </row> - <row> - <col id="0">Ebay</col> - </row> - <row> - <col id="0">IMBD</col> - </row> - <row> - <col id="0">ESPN</col> - </row> - <row> - <col id="0">Wikipedia</col> - </row> - <row> - <col id="0">DuckDuckGo</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststore_tab_position"> - <columns> - <!-- column-name Position --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">preferencesTabLocTop</col> - </row> - <row> - <col id="0" translatable="yes">preferencesTabLocLeft</col> - </row> - <row> - <col id="0" translatable="yes">preferencesTabLocRight</col> - </row> - <row> - <col id="0" translatable="yes">preferencesTabLocBottom</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststore_toolbar_buttontype"> - <columns> - <!-- column-name Type --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">preferencesButtonTypeSmall</col> - </row> - <row> - <col id="0" translatable="yes">preferencesButtonTypeLarge</col> - </row> - <row> - <col id="0" translatable="yes">preferencesButtonTypeLargeText</col> - </row> - <row> - <col id="0" translatable="yes">preferencesButtonTypeText</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststore_image_loading"> - <columns> - <!-- column-name Type --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">preferencesImageLoadBoth</col> - </row> - <row> - <col id="0" translatable="yes">preferencesImageLoadFore</col> - </row> - <row> - <col id="0" translatable="yes">preferencesImageLoadBack</col> - </row> - <row> - <col id="0" translatable="yes">preferencesImageLoadNone</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststore_defaultfont"> - <columns> - <!-- column-name Type --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">preferencesFonttypeSans</col> - </row> - <row> - <col id="0" translatable="yes">preferencesFonttypeSerif</col> - </row> - <row> - <col id="0" translatable="yes">preferencesFonttypeMonospace</col> - </row> - <row> - <col id="0" translatable="yes">preferencesFonttypeCursive</col> - </row> - <row> - <col id="0" translatable="yes">preferencesFonttypeFantasy</col> - </row> - </data> - </object> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xpad">3</property> - <property name="stock">gtk-apply</property> - </object> - <object class="GtkListStore" id="liststore_proxy_type"> - <columns> - <!-- column-name Type --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">preferencesProxyTypeDirect</col> - </row> - <row> - <col id="0" translatable="yes">preferencesProxyTypeManual</col> - </row> - <row> - <col id="0" translatable="yes">preferencesProxyTypeBasic</col> - </row> - <row> - <col id="0" translatable="yes">preferencesProxyTypeNLTM</col> - </row> - <row> - <col id="0" translatable="yes">preferencesProxyTypeSystem</col> - </row> - </data> - </object> - <object class="GtkAdjustment" id="adjustment_animation_time"> - <property name="value">0.10000000000000001</property> - <property name="lower">0.10000000000000001</property> - <property name="upper">10</property> - <property name="step_increment">0.10000000000000001</property> - <property name="page_increment">1</property> - </object> - <object class="GtkAdjustment" id="adjustment_font_default_size"> - <property name="value">16</property> - <property name="lower">1</property> - <property name="upper">99.900000000000006</property> - <property name="step_increment">0.10000000000000001</property> - <property name="page_increment">2</property> - </object> - <object class="GtkAdjustment" id="adjustment_history_age"> - <property name="value">28</property> - <property name="upper">999</property> - <property name="step_increment">1</property> - <property name="page_increment">28</property> - </object> - <object class="GtkAdjustment" id="adjustment_cache_memory_size"> - <property name="value">16</property> - <property name="upper">2048</property> - <property name="step_increment">4</property> - <property name="page_increment">16</property> - </object> - <object class="GtkAdjustment" id="adjustment_cache_disc_size"> - <property name="value">1024</property> - <property name="upper">4096</property> - <property name="step_increment">32</property> - <property name="page_increment">256</property> - </object> - <object class="GtkAdjustment" id="adjustment_disc_cache_age"> - <property name="value">28</property> - <property name="upper">999</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment_proxy_port"> - <property name="value">3128</property> - <property name="lower">1</property> - <property name="upper">65535</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment_fetching_max"> - <property name="value">10</property> - <property name="lower">1</property> - <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment_fetching_perhost"> - <property name="value">1</property> - <property name="lower">1</property> - <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment_fetching_cached"> - <property name="value">1</property> - <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment_pdf_scale"> - <property name="value">100</property> - <property name="lower">1</property> - <property name="upper">1000</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment_pdf_lmargin"> - <property name="upper">999</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkListStore" id="liststore_content_language"> - <columns> - <!-- column-name Code --> - <column type="gchararray"/> - <!-- column-name Description --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">en</col> - <col id="1" translatable="yes">English</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststore_developer_view"> - <columns> - <!-- column-name Type --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">preferencesDeveloperViewWindow</col> - </row> - <row> - <col id="0" translatable="yes">preferencesDeveloperViewTab</col> - </row> - <row> - <col id="0" translatable="yes">preferencesDeveloperViewEditor</col> - </row> - </data> - </object> </interface> diff --git a/frontends/gtk/res/toolbar.gtk2.ui b/frontends/gtk/res/toolbar.gtk2.ui index d84db5c8c..4e8805a6f 100644 --- a/frontends/gtk/res/toolbar.gtk2.ui +++ b/frontends/gtk/res/toolbar.gtk2.ui @@ -1,67 +1,84 @@ -<?xml version="1.0"?> -<!--*- mode: xml -*--> +<?xml version="1.0" encoding="UTF-8"?> <interface> - <object class="GtkWindow" id="toolbarwindow"> + <!-- interface-requires gtk+ 2.12 --> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkDialog" id="dialogToolbar"> <property name="width_request">700</property> <property name="height_request">450</property> - <property name="title" translatable="yes"/> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <child> - <object class="GtkVBox" id="windowvbox"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">gtkToolBarTitle</property> + <property name="window_position">center-on-parent</property> + <property name="destroy_with_parent">True</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox1"> <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> <child> - <object class="GtkLabel" id="toolbarlabel"> + <object class="GtkHBox" id="hbox1"> <property name="visible">True</property> - <property name="label" translatable="yes">Move items from store to toolbar Rearrange items in toolbar Move items from toolbar to store</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> + <property name="can_focus">False</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Move items from store to toolbar</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Rearrange items in toolbar</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Move items from toolbar to store</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> - <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> + <property name="padding">2</property> + <property name="position">0</property> </packing> </child> <child> <object class="GtkScrolledWindow" id="scrolledwindow1"> <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + <property name="can_focus">False</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> <child> <object class="GtkViewport" id="viewport1"> <property name="visible">True</property> - <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="can_focus">False</property> <child> <object class="GtkVBox" id="widgetvbox"> <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="can_focus">False</property> <child> <placeholder/> </child> @@ -71,119 +88,85 @@ </child> </object> <packing> - <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> + <property name="position">1</property> </packing> </child> - <child> - <object class="GtkHBox" id="buttonhbox"> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="can_focus">False</property> + <property name="layout_style">end</property> <child> - <object class="GtkButton" id="resetbutton"> + <object class="GtkButton" id="reset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> + <property name="receives_default">False</property> <child> <object class="GtkHBox" id="button1hbox"> <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="can_focus">False</property> <child> <object class="GtkImage" id="image1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="stock">gtk-refresh</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> </object> <packing> - <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> <object class="GtkLabel" id="refreshbuttonlabel"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">Reset to defaults</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </object> <packing> - <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> + <property name="position">1</property> </packing> </child> </object> </child> </object> <packing> - <property name="padding">10</property> <property name="expand">False</property> <property name="fill">True</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <object class="GtkButton" id="okbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="label">gtk-apply</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </object> - <packing> <property name="padding">10</property> - <property name="expand">False</property> - <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkButton" id="cancelbutton"> + <object class="GtkButton" id="close"> + <property name="label">gtk-close</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> + <property name="receives_default">True</property> <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> </object> <packing> - <property name="padding">0</property> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> + <property name="position">1</property> </packing> </child> </object> <packing> - <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> </child> + <action-widgets> + <action-widget response="0">reset</action-widget> + <action-widget response="0">close</action-widget> + </action-widgets> </object> </interface> diff --git a/frontends/gtk/res/toolbar.gtk3.ui b/frontends/gtk/res/toolbar.gtk3.ui index d84db5c8c..1f1148703 100644 --- a/frontends/gtk/res/toolbar.gtk3.ui +++ b/frontends/gtk/res/toolbar.gtk3.ui @@ -1,186 +1,134 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> <!--*- mode: xml -*--> <interface> - <object class="GtkWindow" id="toolbarwindow"> + <requires lib="gtk+" version="3.0"/> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-refresh</property> + </object> + <object class="GtkDialog" id="dialogToolbar"> <property name="width_request">700</property> <property name="height_request">450</property> - <property name="title" translatable="yes"/> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <child> - <object class="GtkVBox" id="windowvbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - <child> - <object class="GtkLabel" id="toolbarlabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">Move items from store to toolbar Rearrange items in toolbar Move items from toolbar to store</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + <property name="can_focus">False</property> + <property name="title" translatable="yes">gtkToolBarTitle</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> <child> - <object class="GtkViewport" id="viewport1"> + <object class="GtkButton" id="reset"> + <property name="label" translatable="yes">Reset To Defaults</property> <property name="visible">True</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <child> - <object class="GtkVBox" id="widgetvbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - <child> - <placeholder/> - </child> - </object> - </child> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image2</property> + <property name="yalign">0.52999997138977051</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="close"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> </object> <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkHBox" id="buttonhbox"> + <object class="GtkGrid" id="grid1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="can_focus">False</property> + <property name="column_homogeneous">True</property> <child> - <object class="GtkButton" id="resetbutton"> + <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <child> - <object class="GtkHBox" id="button1hbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - <child> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-refresh</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="refreshbuttonlabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">Reset to defaults</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </object> - </child> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Move items from store to toolbar</property> </object> <packing> - <property name="padding">10</property> - <property name="expand">False</property> - <property name="fill">True</property> + <property name="left_attach">0</property> + <property name="top_attach">0</property> </packing> </child> <child> - <placeholder/> - </child> - <child> - <object class="GtkButton" id="okbutton"> + <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="label">gtk-apply</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Rearrange items in toolbar</property> </object> <packing> - <property name="padding">10</property> - <property name="expand">False</property> - <property name="fill">True</property> + <property name="left_attach">1</property> + <property name="top_attach">0</property> </packing> </child> <child> - <object class="GtkButton" id="cancelbutton"> + <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Move items from toolbar to store</property> </object> <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> + <property name="left_attach">2</property> + <property name="top_attach">0</property> </packing> </child> </object> <packing> - <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <object class="GtkViewport" id="viewport1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkVBox" id="widgetvbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> diff --git a/frontends/gtk/resources.c b/frontends/gtk/resources.c index 4f9afb034..ef92fefc8 100644 --- a/frontends/gtk/resources.c +++ b/frontends/gtk/resources.c @@ -198,10 +198,12 @@ init_resource(char **respath, struct nsgtk_resource_s *resource) /* found an entry in the resources */ resource->path = resname; resource->type = NSGTK_RESOURCE_GLIB; - LOG("Found gresource path %s", resource->path); + NSLOG(netsurf, INFO, "Found gresource path %s", + resource->path); return NSERROR_OK; } - /*LOG("gresource \"%s\" not found", resname);*/ + NSLOG(netsurf, DEEPDEBUG, + "gresource \"%s\" not found", resname); free(resname); langc++; @@ -221,18 +223,20 @@ init_resource(char **respath, struct nsgtk_resource_s *resource) /* found an entry in the resources */ resource->path = resname; resource->type = NSGTK_RESOURCE_GLIB; - LOG("Found gresource path %s", resource->path); + NSLOG(netsurf, INFO, "Found gresource path %s", + resource->path); return NSERROR_OK; } - /*LOG("gresource \"%s\" not found", resname);*/ + NSLOG(netsurf, DEEPDEBUG, "gresource \"%s\" not found", resname); free(resname); #endif resname = filepath_find(respath, resource->name); if (resname == NULL) { - LOG("Unable to find resource %s on resource path", - resource->name); + NSLOG(netsurf, INFO, + "Unable to find resource %s on resource path", + resource->name); return NSERROR_NOT_FOUND; } @@ -240,7 +244,7 @@ init_resource(char **respath, struct nsgtk_resource_s *resource) resource->path = resname; resource->type = NSGTK_RESOURCE_FILE; - LOG("Found file resource path %s", resource->path); + NSLOG(netsurf, INFO, "Found file resource path %s", resource->path); return NSERROR_OK; } @@ -295,21 +299,21 @@ init_pixbuf_resource(char **respath, struct nsgtk_resource_s *resource) if (strncmp(resource->name, "menu_cursor.png", resource->len) == 0) { resource->path = (char *)&menu_cursor_pixdata[0]; resource->type = NSGTK_RESOURCE_INLINE; - LOG("Found builtin for %s", resource->name); + NSLOG(netsurf, INFO, "Found builtin for %s", resource->name); return NSERROR_OK; } if (strncmp(resource->name, "netsurf.xpm", resource->len) == 0) { resource->path = (char *)&netsurf_pixdata[0]; resource->type = NSGTK_RESOURCE_INLINE; - LOG("Found builtin for %s", resource->name); + NSLOG(netsurf, INFO, "Found builtin for %s", resource->name); return NSERROR_OK; } if (strncmp(resource->name, "favicon.png", resource->len) == 0) { resource->path = (char *)&favicon_pixdata[0]; resource->type = NSGTK_RESOURCE_INLINE; - LOG("Found builtin for %s", resource->name); + NSLOG(netsurf, INFO, "Found builtin for %s", resource->name); return NSERROR_OK; } #endif @@ -389,13 +393,13 @@ static void list_gresource(void) G_RESOURCE_LOOKUP_FLAGS_NONE, &gerror); if (gerror) { - LOG("gerror %s", gerror->message); + NSLOG(netsurf, INFO, "gerror %s", gerror->message); g_error_free(gerror); } else { cur = reslist; while (cur != NULL && *cur != NULL) { - LOG("gres %s", *cur); + NSLOG(netsurf, INFO, "gres %s", *cur); cur++; } g_strfreev(reslist); @@ -488,12 +492,17 @@ nsgdk_pixbuf_new_from_resname(const char *resname, GdkPixbuf **pixbuf_out) if (new_pixbuf == NULL) { if (error != NULL) { - LOG("Unable to create pixbuf from file for %s with path %s \"%s\"", - resource->name, resource->path, error->message); + NSLOG(netsurf, INFO, + "Unable to create pixbuf from file for %s with path %s \"%s\"", + resource->name, + resource->path, + error->message); g_error_free(error); } else { - LOG("Unable to create pixbuf from file for %s with path %s", - resource->name, resource->path); + NSLOG(netsurf, INFO, + "Unable to create pixbuf from file for %s with path %s", + resource->name, + resource->path); } return NSERROR_INIT_FAILED; } @@ -521,8 +530,11 @@ nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out) if (!gtk_builder_add_from_file(new_builder, ui_res->path, &error)) { - LOG("Unable to add UI builder from file for %s with path %s \"%s\"", - ui_res->name, ui_res->path, error->message); + NSLOG(netsurf, INFO, + "Unable to add UI builder from file for %s with path %s \"%s\"", + ui_res->name, + ui_res->path, + error->message); g_error_free(error); g_object_unref(G_OBJECT(new_builder)); return NSERROR_INIT_FAILED; @@ -531,8 +543,11 @@ nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out) if (!nsgtk_builder_add_from_resource(new_builder, ui_res->path, &error)) { - LOG("Unable to add UI builder from resource for %s with path %s \"%s\"", - ui_res->name, ui_res->path, error->message); + NSLOG(netsurf, INFO, + "Unable to add UI builder from resource for %s with path %s \"%s\"", + ui_res->name, + ui_res->path, + error->message); g_error_free(error); g_object_unref(G_OBJECT(new_builder)); return NSERROR_INIT_FAILED; diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c index 25f36c5d3..6f81e91db 100644 --- a/frontends/gtk/scaffolding.c +++ b/frontends/gtk/scaffolding.c @@ -269,7 +269,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data) { struct nsgtk_scaffolding *gs = data; - LOG("scaffold:%p", gs); + NSLOG(netsurf, INFO, "scaffold:%p", gs); nsgtk_local_history_hide(); @@ -282,7 +282,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data) gs->next->prev = gs->prev; } - LOG("scaffold list head: %p", scaf_list); + NSLOG(netsurf, INFO, "scaffold list head: %p", scaf_list); if (scaf_list == NULL) { /* no more open windows - stop the browser */ @@ -805,7 +805,10 @@ 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)); + NSLOG(netsurf, INFO, + "Unable to open directory %s for complete save: %s", + path, + strerror(errno)); if (errno == ENOTDIR) nsgtk_warning("NoDirError", path); else @@ -837,7 +840,7 @@ MULTIHANDLER(pdf) char *url_name; nserror res; - LOG("Print preview (generating PDF) started."); + NSLOG(netsurf, INFO, "Print preview (generating PDF) started."); res = nsurl_nice(browser_window_get_url(bw), &url_name, true); if (res != NSERROR_OK) { @@ -1221,10 +1224,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"); + NSLOG(netsurf, INFO, "Selecting all URL bar text"); gtk_editable_select_region(GTK_EDITABLE(g->url_bar), 0, -1); } else { - LOG("Selecting all document text"); + NSLOG(netsurf, INFO, "Selecting all document text"); browser_window_key_press(bw, NS_KEY_SELECT_ALL); } @@ -1590,7 +1593,8 @@ MULTIHANDLER(localhistory) res = nsgtk_local_history_present(g->window, bw); if (res != NSERROR_OK) { - LOG("Unable to initialise local history window."); + NSLOG(netsurf, INFO, + "Unable to initialise local history window."); } return TRUE; } @@ -1600,7 +1604,8 @@ MULTIHANDLER(globalhistory) nserror res; res = nsgtk_global_history_present(); if (res != NSERROR_OK) { - LOG("Unable to initialise global history window."); + NSLOG(netsurf, INFO, + "Unable to initialise global history window."); } return TRUE; } @@ -1620,7 +1625,7 @@ MULTIHANDLER(showbookmarks) nserror res; res = nsgtk_hotlist_present(); if (res != NSERROR_OK) { - LOG("Unable to initialise bookmark window."); + NSLOG(netsurf, INFO, "Unable to initialise bookmark window."); } return TRUE; } @@ -1630,7 +1635,7 @@ MULTIHANDLER(showcookies) nserror res; res = nsgtk_cookies_present(); if (res != NSERROR_OK) { - LOG("Unable to initialise cookies window."); + NSLOG(netsurf, INFO, "Unable to initialise cookies window."); } return TRUE; } @@ -2068,12 +2073,13 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) int i; GtkAccelGroup *group; - gs = malloc(sizeof(*gs)); + gs = calloc(1, sizeof(*gs)); if (gs == NULL) { return NULL; } - LOG("Constructing a scaffold of %p for gui_window %p", gs, toplevel); + NSLOG(netsurf, INFO, + "Constructing a scaffold of %p for gui_window %p", gs, toplevel); gs->top_level = toplevel; @@ -2278,7 +2284,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) /* finally, show the window. */ gtk_widget_show(GTK_WIDGET(gs->window)); - LOG("creation complete"); + NSLOG(netsurf, INFO, "creation complete"); return gs; } @@ -2466,7 +2472,8 @@ gui_search_web_provider_update(const char *provider_name, GdkPixbuf *srch_pixbuf = NULL; char *searchcontent; - LOG("name:%s bitmap %p", provider_name, provider_bitmap); + NSLOG(netsurf, INFO, "name:%s bitmap %p", provider_name, + provider_bitmap); if (provider_bitmap != NULL) { srch_pixbuf = nsgdk_pixbuf_get_from_surface(provider_bitmap->surface, 16, 16); @@ -2484,7 +2491,11 @@ gui_search_web_provider_update(const char *provider_name, /* set the search provider parameters up in each scaffold */ for (current = scaf_list; current != NULL; current = current->next) { - /* add ico to each window's toolbar */ + if (current->webSearchEntry == NULL) { + continue; + } + + /* add ico to each window's toolbar */ if (srch_pixbuf != NULL) { nsgtk_entry_set_icon_from_pixbuf(current->webSearchEntry, GTK_ENTRY_ICON_PRIMARY, diff --git a/frontends/gtk/schedule.c b/frontends/gtk/schedule.c index cf0333388..d5b45674b 100644 --- a/frontends/gtk/schedule.c +++ b/frontends/gtk/schedule.c @@ -21,14 +21,10 @@ #include <stdbool.h> #include "utils/errors.h" +#include "utils/log.h" #include "gtk/schedule.h" -#ifdef DEBUG_GTK_SCHEDULE -#include "utils/log.h" -#else -#define LOG(format, args...) ((void) 0) -#endif /** Killable callback closure embodiment. */ typedef struct { @@ -50,7 +46,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); + NSLOG(schedule, DEBUG, "CB at %p already dead.", cb); } queued_callbacks = g_list_remove(queued_callbacks, cb); pending_callbacks = g_list_append(pending_callbacks, cb); @@ -64,7 +60,9 @@ 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); + NSLOG(schedule, DEBUG, + "Found match for %p(%p), killing.", + target->callback, target->context); target->callback = NULL; target->context = NULL; target->callback_killed = true; @@ -122,7 +120,9 @@ schedule_run(void) /* Clear the pending list. */ pending_callbacks = NULL; - LOG("Captured a run of %d callbacks to fire.", g_list_length(this_run)); + NSLOG(schedule, DEBUG, + "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/frontends/gtk/ssl_cert.c b/frontends/gtk/ssl_cert.c index 5388f0194..9d98db1f6 100644 --- a/frontends/gtk/ssl_cert.c +++ b/frontends/gtk/ssl_cert.c @@ -183,7 +183,7 @@ nserror gtk_cert_verify(struct nsurl *url, res = nsgtk_builder_new_from_resname("ssl", &ncwin->builder); if (res != NSERROR_OK) { - LOG("SSL UI builder init failed"); + NSLOG(netsurf, INFO, "SSL UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/tabs.c b/frontends/gtk/tabs.c index 6adce3a06..dbe9d405b 100644 --- a/frontends/gtk/tabs.c +++ b/frontends/gtk/tabs.c @@ -147,18 +147,20 @@ 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); + NSLOG(netsurf, INFO, "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)) { error = nsgtk_scaffolding_new_tab(gw); if (error != NSERROR_OK) { - LOG("Failed to open new tab."); + NSLOG(netsurf, INFO, + "Failed to open new tab."); } } } } else { - LOG("sel %d", selpagenum); + NSLOG(netsurf, INFO, "sel %d", selpagenum); /* tab with page in it */ gw = g_object_get_data(G_OBJECT(selpage), "gui_window"); if (gw != NULL) { diff --git a/frontends/gtk/throbber.c b/frontends/gtk/throbber.c index 9392c3909..b8efceca1 100644 --- a/frontends/gtk/throbber.c +++ b/frontends/gtk/throbber.c @@ -59,12 +59,14 @@ nserror nsgtk_throbber_init(void) if (res != NSERROR_OK) { break; } - LOG("%s",resname); + NSLOG(netsurf, INFO, "%s", resname); } if (frame < 1) { /* we need at least two frames - one for idle, one for active */ - LOG("Insufficent number of frames (%d) in throbber animation.", frame); + NSLOG(netsurf, INFO, + "Insufficent number of frames (%d) in throbber animation.", + frame); res = NSERROR_INIT_FAILED; } diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c index 1f8dbbb7c..e93bd49f9 100644 --- a/frontends/gtk/toolbar.c +++ b/frontends/gtk/toolbar.c @@ -26,6 +26,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/nsoption.h" +#include "utils/file.h" #include "gtk/gui.h" #include "gtk/warn.h" @@ -44,7 +45,7 @@ static bool edit_mode = false; struct nsgtk_toolbar_custom_store { GtkWidget *window; - GtkWidget *store_buttons[PLACEHOLDER_BUTTON]; + GtkWidget *store_buttons[PLACEHOLDER_BUTTON]; GtkWidget *widgetvbox; GtkWidget *currentbar; char numberh; /* current horizontal location while adding */ @@ -107,13 +108,13 @@ static char *remove_underscores(const char *s, bool replacespace) ret = malloc(len + 1); if (ret == NULL) { return NULL; - } + } for (i = 0, ii = 0; i < len; i++) { if (s[i] != '_') { ret[ii++] = s[i]; - } else if (replacespace) { + } else if (replacespace) { ret[ii++] = ' '; - } + } } ret[ii] = '\0'; return ret; @@ -208,18 +209,18 @@ nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton, switch (tbbutton) { case (SEARCH_BACK_BUTTON): - image = GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_GO_BACK, - iconsize)); + image = GTK_IMAGE(nsgtk_image_new_from_stock( + NSGTK_STOCK_GO_BACK, iconsize)); break; case (SEARCH_FORWARD_BUTTON): - image = GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_GO_FORWARD, - iconsize)); + image = GTK_IMAGE(nsgtk_image_new_from_stock( + NSGTK_STOCK_GO_FORWARD, iconsize)); break; case (SEARCH_CLOSE_BUTTON): - image = GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_CLOSE, - iconsize)); + image = GTK_IMAGE(nsgtk_image_new_from_stock( + NSGTK_STOCK_CLOSE, iconsize)); break; default: @@ -227,7 +228,8 @@ nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton, } if (usedef && (image == NULL)) { - image = GTK_IMAGE(nsgtk_image_new_from_stock("gtk-missing-image", iconsize)); + image = GTK_IMAGE(nsgtk_image_new_from_stock( + "gtk-missing-image", iconsize)); } return image; @@ -255,7 +257,6 @@ static struct nsgtk_theme *nsgtk_theme_load(GtkIconSize iconsize, bool usedef) theme->image[btnloop] = nsgtk_theme_image_default(btnloop, iconsize, usedef); - } for (btnloop = SEARCH_BACK_BUTTON; @@ -823,8 +824,9 @@ static void nsgtk_toolbar_close(struct nsgtk_scaffolding *g) */ static gboolean nsgtk_toolbar_cancel_clicked(GtkWidget *widget, gpointer data) { - edit_mode = false; struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data; + + edit_mode = false; /* reset g->buttons->location */ for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) { nsgtk_scaffolding_button(g, i)->location = @@ -950,6 +952,7 @@ void nsgtk_toolbar_customization_load(struct nsgtk_scaffolding *g) */ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g) { + char *choices = NULL; char *order; int order_len = PLACEHOLDER_BUTTON * 12; /* length of order buffer */ int tbidx; @@ -971,7 +974,8 @@ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g) nsgtk_scaffolding_button(g, tbidx)->location); if (plen == order_len) { /* ran out of space, bail early */ - LOG("toolbar ordering exceeded available space"); + NSLOG(netsurf, INFO, + "toolbar ordering exceeded available space"); break; } cur += plen; @@ -980,6 +984,13 @@ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g) nsoption_set_charp(toolbar_order, order); + /* ensure choices are saved */ + netsurf_mkpath(&choices, NULL, 2, nsgtk_config_home, "Choices"); + if (choices != NULL) { + nsoption_write(choices, NULL, NULL); + free(choices); + } + return NSERROR_OK; } @@ -989,8 +1000,9 @@ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g) */ static gboolean nsgtk_toolbar_persist(GtkWidget *widget, gpointer data) { - edit_mode = false; struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data; + + edit_mode = false; /* save state to file, update toolbars for all windows */ nsgtk_toolbar_customization_save(g); nsgtk_toolbar_cast(g); @@ -1097,7 +1109,6 @@ nsgtk_toolbar_store_action(GtkWidget *widget, GdkDragContext *gdc, */ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) { - int x = 0, y = 0; struct nsgtk_theme *theme; nserror res; @@ -1110,8 +1121,8 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) res = nsgtk_builder_new_from_resname("toolbar", &window->builder); if (res != NSERROR_OK) { - LOG("Toolbar UI builder init failed"); - nsgtk_warning(messages_get("NoMemory"), 0); + NSLOG(netsurf, INFO, "Toolbar UI builder init failed"); + nsgtk_warning("Toolbar UI builder init failed", 0); nsgtk_toolbar_cancel_clicked(NULL, g); free(theme); return; @@ -1119,8 +1130,8 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) gtk_builder_connect_signals(window->builder, NULL); - window->window = GTK_WIDGET(gtk_builder_get_object(window->builder, - "toolbarwindow")); + window->window = GTK_WIDGET(gtk_builder_get_object( + window->builder, "dialogToolbar")); if (window->window == NULL) { nsgtk_warning(messages_get("NoMemory"), 0); nsgtk_toolbar_cancel_clicked(NULL, g); @@ -1128,8 +1139,11 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) return; } - window->widgetvbox = GTK_WIDGET(gtk_builder_get_object(window->builder, - "widgetvbox")); + gtk_window_set_transient_for(GTK_WINDOW(window->window), + nsgtk_scaffolding_window(g)); + + window->widgetvbox = GTK_WIDGET(gtk_builder_get_object( + window->builder, "widgetvbox")); if (window->widgetvbox == NULL) { nsgtk_warning(messages_get("NoMemory"), 0); nsgtk_toolbar_cancel_clicked(NULL, g); @@ -1137,9 +1151,12 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) return; } - window->numberh = NSGTK_STORE_WIDTH; /* preset to width [in buttons] of */ + /* preset to width [in buttons] of */ + window->numberh = NSGTK_STORE_WIDTH; + /* store to cause creation of a new toolbar */ window->currentbutton = -1; + /* load toolbuttons */ /* add toolbuttons to window */ /* set event handlers */ @@ -1159,33 +1176,20 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) } free(theme); - gtk_window_set_transient_for(GTK_WINDOW(window->window), - nsgtk_scaffolding_window(g)); - gtk_window_set_title(GTK_WINDOW(window->window), messages_get( - "gtkToolBarTitle")); + gtk_window_set_accept_focus(GTK_WINDOW(window->window), FALSE); + gtk_drag_dest_set(GTK_WIDGET(window->window), GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, &entry, 1, GDK_ACTION_COPY); - gtk_widget_show_all(window->window); - gtk_window_set_position(GTK_WINDOW(window->window), - GTK_WIN_POS_CENTER_ON_PARENT); - gtk_window_get_position(nsgtk_scaffolding_window(g), &x, &y); - gtk_window_move(GTK_WINDOW(window->window), x, y + 100); - - g_signal_connect(GTK_WIDGET(gtk_builder_get_object(window->builder, - "cancelbutton")), - "clicked", - G_CALLBACK(nsgtk_toolbar_cancel_clicked), - g); - g_signal_connect(GTK_WIDGET(gtk_builder_get_object(window->builder, - "okbutton")), + g_signal_connect(GTK_WIDGET(gtk_builder_get_object( + window->builder, "close")), "clicked", G_CALLBACK(nsgtk_toolbar_persist), g); - g_signal_connect(GTK_WIDGET(gtk_builder_get_object(window->builder, - "resetbutton")), + g_signal_connect(GTK_WIDGET(gtk_builder_get_object( + window->builder, "reset")), "clicked", G_CALLBACK(nsgtk_toolbar_reset), g); @@ -1198,6 +1202,8 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) g_signal_connect(window->window, "drag-motion", G_CALLBACK(nsgtk_toolbar_store_action), g); + + gtk_widget_show_all(window->window); } /** @@ -1341,33 +1347,37 @@ nsgtk_toolbar_set_handler(struct nsgtk_scaffolding *g, nsgtk_toolbar_button i) case URL_BAR_ITEM: nsgtk_scaffolding_update_url_bar_ref(g); g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)), - "activate", G_CALLBACK( - nsgtk_window_url_activate_event), g); + "activate", G_CALLBACK( + nsgtk_window_url_activate_event), g); g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)), - "changed", G_CALLBACK( - nsgtk_window_url_changed), g); + "changed", G_CALLBACK( + nsgtk_window_url_changed), g); break; + case THROBBER_ITEM: nsgtk_scaffolding_update_throbber_ref(g); break; + case WEBSEARCH_ITEM: nsgtk_scaffolding_update_websearch_ref(g); g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)), - "activate", G_CALLBACK( - nsgtk_websearch_activate), g); + "activate", G_CALLBACK( + nsgtk_websearch_activate), g); g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)), - "button-press-event", G_CALLBACK( - nsgtk_websearch_clear), g); + "button-press-event", G_CALLBACK( + nsgtk_websearch_clear), g); break; + default: if ((nsgtk_scaffolding_button(g, i)->bhandler != NULL) && - (nsgtk_scaffolding_button(g, i)->button - != NULL)) - g_signal_connect(nsgtk_scaffolding_button(g, i)-> - button, "clicked", - G_CALLBACK(nsgtk_scaffolding_button(g, - i)->bhandler), g); - break; + (nsgtk_scaffolding_button(g, i)->button != NULL)) { + g_signal_connect( + nsgtk_scaffolding_button(g, i)->button, + "clicked", + G_CALLBACK(nsgtk_scaffolding_button( + g, i)->bhandler), g); + } + break; } } @@ -1459,7 +1469,8 @@ DATAHANDLER(prevtab, PREVTAB, window) DATAHANDLER(guide, GUIDE, window) DATAHANDLER(info, INFO, window) #undef DATAHANDLER -#define DATAHANDLER(p, q, r)\ + +#define DATAHANDLER(p, q, r) \ gboolean nsgtk_toolbar_##p##_button_data(GtkWidget *widget, GdkDragContext\ *cont, GtkSelectionData *selection, guint info, guint time,\ gpointer data)\ @@ -1480,5 +1491,3 @@ gboolean nsgtk_toolbar_##p##_toolbar_button_data(GtkWidget *widget,\ DATAHANDLER(throbber, THROBBER, window) DATAHANDLER(websearch, WEBSEARCH, window) #undef DATAHANDLER - - diff --git a/frontends/gtk/viewdata.c b/frontends/gtk/viewdata.c index 6ed9dd9ac..d633238d0 100644 --- a/frontends/gtk/viewdata.c +++ b/frontends/gtk/viewdata.c @@ -371,7 +371,7 @@ window_init(const char *title, res = nsgtk_builder_new_from_resname("viewdata", &newctx->builder); if (res != NSERROR_OK) { - LOG("Viewdata UI builder init failed"); + NSLOG(netsurf, INFO, "Viewdata UI builder init failed"); free(newctx); return res; } @@ -381,7 +381,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 "); + NSLOG(netsurf, INFO, "Unable to find window in builder "); /* free the builder */ g_object_unref(G_OBJECT(newctx->builder)); @@ -616,7 +616,7 @@ static char** xdg_data_strvec(void) xdg_data_home, xdg_data_dirs); } - LOG("%s", xdg_data_path); + NSLOG(netsurf, INFO, "%s", xdg_data_path); svec = filepath_path_to_strvec(xdg_data_path); free(xdg_data_path); @@ -651,7 +651,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); + NSLOG(netsurf, INFO, "Checking %s", fname); fp = fopen(fname, "r"); free(fname); @@ -674,8 +674,11 @@ 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); + NSLOG(netsurf, INFO, + "Found line match for %s length %zu\n", + mimetype, + rd); + NSLOG(netsurf, INFO, "Result %s", ret); break; } @@ -714,7 +717,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); + NSLOG(netsurf, INFO, "Checking %s", fname); fp = fopen(fname, "r"); free(fname); @@ -735,8 +738,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); + NSLOG(netsurf, INFO, "Found Exec length %zu", rd); + NSLOG(netsurf, INFO, "Result %s", ret); break; } @@ -801,7 +804,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]); + NSLOG(netsurf, INFO, "adding \"%s\"", argv[aidx]); aidx++; } } diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c index de5311e2e..7f24d40ac 100644 --- a/frontends/gtk/window.c +++ b/frontends/gtk/window.c @@ -42,7 +42,6 @@ #include "netsurf/plotters.h" #include "netsurf/form.h" #include "netsurf/keypress.h" -#include "desktop/textarea.h" #include "desktop/searchweb.h" #include "desktop/textinput.h" @@ -355,6 +354,7 @@ static gboolean nsgtk_window_button_press_event(GtkWidget *widget, break; case 3: /* Right button, usually. Action button, context menu. */ + /** \todo determine if hiding the caret here is necessary */ browser_window_remove_caret(g->bw, true); nsgtk_scaffolding_context_menu(g->scaffold, g->mouse.pressed_x, @@ -458,7 +458,7 @@ nsgtk_window_scroll_event(GtkWidget *widget, break; #endif default: - LOG("Unhandled mouse scroll direction"); + NSLOG(netsurf, INFO, "Unhandled mouse scroll direction"); return TRUE; } @@ -741,7 +741,7 @@ gui_window_create(struct browser_window *bw, res = nsgtk_builder_new_from_resname("tabcontents", &tab_builder); if (res != NSERROR_OK) { - LOG("Tab contents UI builder init failed"); + NSLOG(netsurf, INFO, "Tab contents UI builder init failed"); return NULL; } @@ -754,7 +754,8 @@ gui_window_create(struct browser_window *bw, return NULL; } - LOG("Creating gui window %p for browser window %p", g, bw); + NSLOG(netsurf, INFO, "Creating gui window %p for browser window %p", + g, bw); g->bw = bw; g->mouse.state = 0; @@ -903,10 +904,10 @@ void nsgtk_window_destroy_browser(struct gui_window *gw) static void gui_window_destroy(struct gui_window *g) { - LOG("gui_window: %p", g); + NSLOG(netsurf, INFO, "gui_window: %p", g); assert(g != NULL); assert(g->bw != NULL); - LOG("scaffolding: %p", g->scaffold); + NSLOG(netsurf, INFO, "scaffolding: %p", g->scaffold); if (g->prev) { g->prev->next = g->next; @@ -918,7 +919,7 @@ static void gui_window_destroy(struct gui_window *g) g->next->prev = g->prev; } - LOG("window list head: %p", window_list); + NSLOG(netsurf, INFO, "window list head: %p", window_list); } /** @@ -940,13 +941,13 @@ static void gui_window_set_icon(struct gui_window *gw, struct hlcache_handle *ic if (icon != NULL) { icon_bitmap = content_get_bitmap(icon); if (icon_bitmap != NULL) { - LOG("Using %p bitmap", icon_bitmap); + NSLOG(netsurf, INFO, "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"); + NSLOG(netsurf, INFO, "Using default favicon"); g_object_ref(favicon_pixbuf); gw->icon = favicon_pixbuf; } @@ -1236,7 +1237,7 @@ gui_window_get_dimensions(struct gui_window *gw, *width /= scale; *height /= scale; } - LOG("gw:%p width:%i height:%i", gw, *width, *height); + NSLOG(netsurf, INFO, "gw:%p width:%i height:%i", gw, *width, *height); return NSERROR_OK; } @@ -1269,8 +1270,8 @@ 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 %"PRIdPTR" option %p text %s", - item, option, option->text); + NSLOG(netsurf, INFO, "Item %"PRIdPTR" option %p text %s", + item, option, option->text); menu_item = gtk_check_menu_item_new_with_label(option->text); if (option->selected) { gtk_check_menu_item_set_active( @@ -1313,10 +1314,10 @@ gui_window_file_gadget_open(struct gui_window *g, NSGTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); - LOG("*** open dialog: %p", dialog); + NSLOG(netsurf, INFO, "*** open dialog: %p", dialog); int ret = gtk_dialog_run(GTK_DIALOG(dialog)); - LOG("*** return value: %d", ret); + NSLOG(netsurf, INFO, "*** return value: %d", ret); if (ret == GTK_RESPONSE_ACCEPT) { char *filename; |