/** * Initialize GTK interface. */ static void gui_init(int argc, char** argv, char **respath) { char buf[PATH_MAX]; const char *addr = NETSURF_HOMEPAGE; char *resource_filename; /* check user options */ check_options(respath); /* find the languages file */ languages_file_location = filepath_find(respath, "languages"); if ((languages_file_location == NULL) || (strlen(languages_file_location) < 10)) { die("Unable to find resources.\n"); } /* Obtain resources path location. * * Uses the directory the languages file was found in, * @todo find and slaughter all references to this! */ res_dir_location = calloc(1, strlen(languages_file_location) - 8); memcpy(res_dir_location, languages_file_location, strlen(languages_file_location) - 9); LOG(("Using '%s' for resource path", res_dir_location)); /* initialise the glade templates */ nsgtk_init_glade(respath); /* set default icon if its available */ resource_filename = filepath_find(respath, "netsurf.xpm"); if (resource_filename != NULL) { gtk_window_set_default_icon_from_file(resource_filename, NULL); free(resource_filename); } /* Search engine sources */ search_engines_file_location = filepath_find(respath, "SearchEngines"); LOG(("Using '%s' as Search Engines file", search_engines_file_location)); /* Default Icon */ search_default_ico_location = filepath_find(respath, "default.ico"); LOG(("Using '%s' as default search ico", search_default_ico_location)); /* Default favicon */ resource_filename = filepath_find(respath, "favicon.png"); if (resource_filename != NULL) { favicon_pixbuf = gdk_pixbuf_new_from_file(resource_filename, NULL); free(resource_filename); if (favicon_pixbuf == NULL) { favicon_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 16,16); } } /* Toolbar inicies file */ toolbar_indices_file_location = filepath_find(respath, "toolbarIndices"); LOG(("Using '%s' as custom toolbar settings file", toolbar_indices_file_location)); /* load throbber images */ if (nsgtk_throbber_init(respath, THROBBER_FRAMES) == false) die("Unable to load throbber image.\n"); /* Initialise completions - cannot fail */ nsgtk_completion_init(); filepath_sfinddef(respath, buf, "mime.types", "/etc/"); gtk_fetch_filetype_init(buf); urldb_load(nsoption_charp(url_file)); urldb_load_cookies(nsoption_charp(cookie_file)); /* 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. */ nscss_screen_dpi = FLTTOFIX(gdk_screen_get_resolution( gdk_screen_get_default())); LOG(("Set CSS DPI to %f", FIXTOFLT(nscss_screen_dpi))); if (nsgtk_history_init(glade_file_location->history) == false) die("Unable to initialise history window.\n"); if (nsgtk_download_init(glade_file_location->downloads) == false) die("Unable to initialise download window.\n"); if (nsgtk_cookies_init(glade_file_location->cookies) == false) die("Unable to initialise cookies window.\n"); if (nsgtk_hotlist_init(glade_file_location->hotlist) == false) die("Unable to initialise hotlist window.\n"); sslcert_init(tree_content_icon_name); if (nsoption_charp(homepage_url) != NULL) { addr = nsoption_charp(homepage_url); } if (2 <= argc) addr = argv[1]; /* Last step of initialization. Opens the main browser window. */ browser_window_create(addr, 0, 0, true, false); }
void ro_gui_cert_postinitialise(void) { /* Initialise the SSL module. */ sslcert_init(tree_content_icon_name); }