tazweb view src/tazweb.c @ rev 194
Make pot and up french translation
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Mar 16 13:34:09 2017 +0100 (2017-03-16) |
parents | 6a5a94a11ff7 |
children | b043c09b31f0 |
line source
1 /*
2 * TazWeb is a radically simple web browser providing a single window
3 * with a single toolbar with buttons, a URL entry and search as well
4 * as a contextual menu, but no menu bar or tabs. Commented line code
5 * starts with // and comments are between * *
6 *
7 * Copyright (C) 2011-2017 SliTaz GNU/Linux - BSD License
8 * See AUTHORS and LICENSE for detailed information
9 *
10 */
12 #include <getopt.h>
13 #include <glib.h>
14 #include <glib/gi18n.h>
16 #include <gtk/gtk.h>
17 #include <webkit/webkit.h>
18 #include <libsoup/soup.h>
20 #define HOME g_get_home_dir()
21 #define CONFIG g_strdup_printf("%s/.config/tazweb", HOME)
22 #define BMTXT g_strdup_printf("%s/bookmarks.txt", CONFIG)
23 #define BOOKMARKS g_strdup_printf("%s/bookmarks.txt", CONFIG)
24 #define COOKIES g_strdup_printf("%s/cookies.txt", CONFIG)
25 #define DOWNLOADS g_strdup_printf("%s/Downloads", HOME)
26 #define WEBHOME "file:///usr/share/webhome/index.html"
27 #define SEARCH "http://duckduckgo.com/?q=%s&t=slitaz"
28 #define GETTEXT_PACKAGE "tazweb"
30 int width = 800;
31 int height = 600;
32 int private = 0;
34 static gchar *useragent = "TazWeb (X11; SliTaz GNU/Linux; U; en_US)";
35 static gboolean notoolbar;
36 static gboolean nomenu;
37 static gboolean kiosk;
39 static GtkWidget* create_window(WebKitWebView** newwebview);
40 static GtkWidget *tazweb_window, *vbox, *browser, *toolbar;
41 static WebKitWebView *webview;
42 static WebKitWebFrame *frame;
43 static SoupSession *session;
44 static SoupCookieJar *cookiejar;
45 static gint count = 0;
46 const gchar* uri;
48 /* Create an icon */
49 static GdkPixbuf*
50 create_pixbuf(const gchar* image)
51 {
52 GdkPixbuf *pixbuf;
53 pixbuf = gdk_pixbuf_new_from_file(image, NULL);
54 return pixbuf;
55 }
57 /* Can be: http://hg.slitaz.org or hg.slitaz.org */
58 static void
59 check_requested_uri()
60 {
61 uri = g_strrstr(uri, "://") ? g_strdup(uri)
62 : g_strdup_printf("http://%s", uri);
63 }
65 /* Update title */
66 static void
67 update_title(GtkWindow* window, WebKitWebView* webview)
68 {
69 GString *string;
70 gdouble progress;
71 gchar *title;
73 string = g_string_new(webkit_web_view_get_title(webview));
74 progress = webkit_web_view_get_progress(webview) * 100;
75 if (progress < 100)
76 g_string_append_printf(string, " [ %f%% ] ", progress);
78 title = g_string_free(string, FALSE);
79 gtk_window_set_title(window, title);
80 g_free(title);
81 }
83 /* Get the page title */
84 static void
85 notify_title_cb(WebKitWebView* webview, GParamSpec* pspec, GtkWidget* window)
86 {
87 update_title(GTK_WINDOW(window), webview);
88 }
90 /* Request progress in window title */
91 static void
92 notify_progress_cb(WebKitWebView* webview, GParamSpec* pspec, GtkWidget* window)
93 {
94 update_title(GTK_WINDOW(window), webview);
95 }
97 /* Notify url entry */
98 static void
99 notify_load_status_cb(WebKitWebView* webview, GParamSpec* pspec, GtkWidget* urientry)
100 {
101 if (webkit_web_view_get_load_status(webview) == WEBKIT_LOAD_COMMITTED) {
102 frame = webkit_web_view_get_main_frame(webview);
103 uri = webkit_web_frame_get_uri(frame);
104 if (uri)
105 gtk_entry_set_text(GTK_ENTRY(urientry), uri);
106 }
107 }
109 /* Destroy the window */
110 static void
111 destroy_cb(GtkWidget* widget, GtkWindow* window)
112 {
113 if (g_atomic_int_dec_and_test(&count))
114 gtk_main_quit();
115 }
117 /* Show page source */
118 static void
119 view_source_cb(GtkWidget* widget, WebKitWebView* webview)
120 {
121 gboolean source;
123 frame = webkit_web_view_get_main_frame(webview);
124 uri = webkit_web_frame_get_uri(frame);
125 source = webkit_web_view_get_view_source_mode(webview);
127 webkit_web_view_set_view_source_mode(webview, !source);
128 webkit_web_view_reload(webview);
129 }
131 /* URL entry callback function */
132 static void
133 uri_entry_cb(GtkWidget* urientry, WebKitWebView* webview)
134 {
135 uri = gtk_entry_get_text(GTK_ENTRY(urientry));
136 g_assert(uri);
137 check_requested_uri();
138 webkit_web_view_load_uri(webview, uri);
139 }
141 /* Search entry and icon callback function */
142 static void
143 search_web(GtkWidget* search, WebKitWebView* webview)
144 {
145 uri = g_strdup_printf(SEARCH, gtk_entry_get_text(GTK_ENTRY(search)));
146 g_assert(uri);
147 webkit_web_view_load_uri(webview, uri);
148 }
150 static void
151 search_entry_cb(GtkWidget* search, WebKitWebView* webview)
152 {
153 search_web(search, webview);
154 }
156 static void
157 search_icon_press_cb(GtkWidget *search, GtkEntryIconPosition pos,
158 GdkEvent *event, WebKitWebView* webview)
159 {
160 search_web(search, webview);
161 }
163 /*
164 *
165 * Navigation functions
166 *
167 */
169 static void
170 bookmarks_edit_cb(GtkWidget* widget, WebKitWebView* webview)
171 {
172 system("/usr/lib/tazweb/helper.sh bookmarks_handler &");
173 }
175 static void
176 go_bookmarks_cb(GtkWidget* widget, WebKitWebView* webview)
177 {
178 system("/usr/lib/tazweb/helper.sh html_bookmarks");
179 uri = g_strdup_printf("file://%s/bookmarks.html", CONFIG);
180 g_assert(uri);
181 webkit_web_view_load_uri(webview, uri);
182 }
184 static void
185 go_home_cb(GtkWidget* widget, WebKitWebView* webview)
186 {
187 uri = WEBHOME;
188 g_assert(uri);
189 webkit_web_view_load_uri(webview, uri);
190 }
192 static void
193 go_back_cb(GtkWidget* widget, WebKitWebView* webview)
194 {
195 webkit_web_view_go_back(webview);
196 }
198 static void
199 go_forward_cb(GtkWidget* widget, WebKitWebView* webview)
200 {
201 webkit_web_view_go_forward(webview);
202 }
204 /* Documentation callback */
205 static void
206 tazweb_doc_cb(GtkWidget* widget, WebKitWebView *webview)
207 {
208 uri = ("file:///usr/share/doc/tazweb/tazweb.html");
209 g_assert(uri);
210 webkit_web_view_load_uri(webview, uri);
211 }
213 /* Download callback */
214 static gboolean
215 download_requested_cb(WebKitWebView *webview, WebKitDownload *download,
216 gpointer user_data)
217 {
218 const gchar* buffer;
219 uri = webkit_download_get_uri(download);
220 asprintf(&buffer, "xterm -T 'TazWeb Download' -geom 72x12+0-24 -e \
221 'mkdir -p %s && wget -P %s -c %s; sleep 2' &",
222 DOWNLOADS, DOWNLOADS, uri);
223 system(buffer);
224 }
226 /* Printing callback function */
227 static void
228 print_page_cb (GtkWidget *widget, gpointer data)
229 {
230 webkit_web_frame_print (webkit_web_view_get_main_frame (
231 WEBKIT_WEB_VIEW (webview)));
232 }
234 /* New webview callbacks */
235 static WebKitWebView*
236 create_web_view_cb(WebKitWebView* webview, WebKitWebFrame* web_frame,
237 GtkWidget* window)
238 {
239 WebKitWebView *newview;
240 create_window(&newview);
241 return newview;
242 }
244 static gboolean
245 webview_ready_cb(WebKitWebView* webview, GtkWidget* window)
246 {
247 gtk_widget_grab_focus(GTK_WIDGET(webview));
248 gtk_widget_show_all(window);
249 return FALSE;
250 }
252 static gboolean
253 close_webview_cb(WebKitWebView* webview, GtkWidget* window)
254 {
255 gtk_widget_destroy(window);
256 return TRUE;
257 }
259 /* Add a bookmark */
260 void
261 add_bookmark_cb(GtkWidget *widget, gpointer data)
262 {
263 const gchar* title;
264 const gchar* buffer;
266 title = webkit_web_view_get_title(WEBKIT_WEB_VIEW (webview));
267 uri = webkit_web_view_get_uri(WEBKIT_WEB_VIEW (webview));
269 asprintf(&buffer, "echo '%s|%s' >> %s", title, uri, BOOKMARKS);
270 system(buffer);
271 }
273 /* Setup session cookies */
274 void
275 cookies_setup(void)
276 {
277 if (cookiejar) {
278 soup_session_remove_feature(session,
279 (SoupSessionFeature*)cookiejar);
280 g_object_unref(cookiejar);
281 cookiejar = NULL;
282 }
284 cookiejar = soup_cookie_jar_text_new(COOKIES, 0);
285 soup_session_add_feature(session, (SoupSessionFeature*)cookiejar);
286 }
288 static void
289 cookies_view_cb(GtkWidget* widget, WebKitWebView* webview)
290 {
291 system("/usr/lib/tazweb/helper.sh html_cookies");
292 uri = g_strdup_printf("file://%s/cookies.html", CONFIG);
293 g_assert(uri);
294 webkit_web_view_load_uri(webview, uri);
295 }
297 static void
298 cookies_clean_cb(GtkWidget* widget, WebKitWebView* webview)
299 {
300 system("/usr/lib/tazweb/helper.sh clean_cookies");
301 }
303 /* Add items to WebKit contextual menu */
304 static void
305 populate_menu_cb(WebKitWebView *webview, GtkMenu *menu, gpointer data)
306 {
307 GtkWidget* item;
309 /* Separator */
310 item = gtk_separator_menu_item_new();
311 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
313 /* Bookmark */
314 item = gtk_image_menu_item_new_with_label(_("Bookmarks"));
315 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
316 gtk_image_new_from_stock(GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_MENU));
317 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
318 g_signal_connect(item, "activate", G_CALLBACK(go_bookmarks_cb), webview);
320 if (! kiosk) {
321 /* Add a bookmark */
322 item = gtk_image_menu_item_new_with_label(_("Add a bookmark"));
323 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
324 gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU));
325 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
326 g_signal_connect(item, "activate", G_CALLBACK(add_bookmark_cb), webview);
328 /* Edit bookmarks */
329 item = gtk_image_menu_item_new_with_label(_("Edit bookmarks"));
330 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
331 gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU));
332 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
333 g_signal_connect(item, "activate", G_CALLBACK(bookmarks_edit_cb), webview);
335 /* Separator */
336 item = gtk_separator_menu_item_new();
337 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
338 }
340 /* Printing */
341 item = gtk_image_menu_item_new_with_label(_("Print this page"));
342 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
343 gtk_image_new_from_stock(GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU));
344 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
345 g_signal_connect(item, "activate", G_CALLBACK(print_page_cb), webview);
347 /* View source mode */
348 item = gtk_image_menu_item_new_with_label(_("View source mode"));
349 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
350 gtk_image_new_from_stock(GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_MENU));
351 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
352 g_signal_connect(item, "activate", G_CALLBACK(view_source_cb), webview);
354 /* Separator */
355 item = gtk_separator_menu_item_new();
356 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
358 /* Cookies */
359 if (! private) {
360 item = gtk_image_menu_item_new_with_label(_("View cookies"));
361 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
362 gtk_image_new_from_stock(GTK_STOCK_HELP, GTK_ICON_SIZE_MENU));
363 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
364 g_signal_connect(item, "activate", G_CALLBACK(cookies_view_cb), webview);
366 item = gtk_image_menu_item_new_with_label(_("Clean all cookies"));
367 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
368 gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU));
369 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
370 g_signal_connect(item, "activate", G_CALLBACK(cookies_clean_cb), webview);
372 /* Separator */
373 item = gtk_separator_menu_item_new();
374 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
375 }
377 /* TazWeb documentation */
378 item = gtk_image_menu_item_new_with_label(_("TazWeb manual"));
379 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
380 gtk_image_new_from_stock(GTK_STOCK_HELP, GTK_ICON_SIZE_MENU));
381 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
382 g_signal_connect(item, "activate", G_CALLBACK(tazweb_doc_cb), webview);
384 /* Quit TazWeb */
385 item = gtk_image_menu_item_new_with_label(_("Quit TazWeb"));
386 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
387 gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU));
388 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
389 g_signal_connect(item, "activate", G_CALLBACK(destroy_cb), webview);
391 gtk_widget_show_all(GTK_WIDGET(menu));
392 }
394 /* Scrolled window for the webview */
395 static GtkWidget*
396 create_browser(GtkWidget* window, GtkWidget* urientry, GtkWidget* search,
397 WebKitWebView* webview)
398 {
399 WebKitWebSettings *settings;
401 browser = gtk_scrolled_window_new(NULL, NULL);
402 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(browser),
403 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
405 gtk_container_add(GTK_CONTAINER(browser), GTK_WIDGET(webview));
407 /* Webkit settings */
408 settings = webkit_web_view_get_settings (webview);
409 g_object_set(G_OBJECT(settings), "user-agent", useragent, NULL);
411 if (private)
412 g_object_set(G_OBJECT(settings), "enable-private-browsing", TRUE);
414 /* Connect Webkit events */
415 g_signal_connect(webview, "notify::title",
416 G_CALLBACK(notify_title_cb), window);
417 g_signal_connect(webview, "notify::progress",
418 G_CALLBACK(notify_progress_cb), window);
419 g_signal_connect(webview, "notify::load-status",
420 G_CALLBACK(notify_load_status_cb), urientry);
421 g_signal_connect(webview, "web-view-ready",
422 G_CALLBACK(webview_ready_cb), window);
423 g_signal_connect(webview, "close-web-view",
424 G_CALLBACK(close_webview_cb), window);
426 /* Impossible to open in new window or download in kiosk mode */
427 if (! kiosk) {
428 g_signal_connect(webview, "download-requested",
429 G_CALLBACK(download_requested_cb), NULL);
430 g_signal_connect(webview, "create-web-view",
431 G_CALLBACK(create_web_view_cb), window);
432 }
434 if (! nomenu) {
435 /* Connect WebKit contextual menu items */
436 g_object_connect(G_OBJECT(webview), "signal::populate-popup",
437 G_CALLBACK(populate_menu_cb), webview, NULL);
438 }
439 return browser;
440 }
442 static GtkWidget*
443 create_toolbar(GtkWidget* urientry, GtkWidget* search, WebKitWebView* webview)
444 {
445 GtkToolItem* item;
447 toolbar = gtk_toolbar_new();
448 gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar),
449 GTK_ORIENTATION_HORIZONTAL);
450 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
451 GTK_TOOLBAR_BOTH_HORIZ);
453 /* The back button */
454 item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK);
455 g_signal_connect(G_OBJECT(item), "clicked",
456 G_CALLBACK(go_back_cb), webview);
457 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
459 /* The forward button */
460 item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD);
461 g_signal_connect(G_OBJECT(item), "clicked",
462 G_CALLBACK(go_forward_cb), webview);
463 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
465 /* URL entry */
466 item = gtk_tool_item_new();
467 gtk_tool_item_set_expand(item, TRUE);
468 gtk_container_add(GTK_CONTAINER(item), urientry);
469 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
470 g_signal_connect(G_OBJECT(urientry), "activate",
471 G_CALLBACK(uri_entry_cb), webview);
473 /* Separator */
474 item = gtk_separator_tool_item_new();
475 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
477 /* Search entry */
478 item = gtk_tool_item_new();
479 gtk_tool_item_set_expand(item, FALSE);
480 gtk_widget_set_size_request(GTK_WIDGET(item), 200, 0);
481 gtk_container_add(GTK_CONTAINER(item), search);
482 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
483 gtk_entry_set_icon_from_stock(GTK_ENTRY(search),
484 GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FIND);
485 g_signal_connect(GTK_ENTRY(search), "icon-press",
486 G_CALLBACK(search_icon_press_cb), webview);
487 g_signal_connect(G_OBJECT(search), "activate",
488 G_CALLBACK(search_entry_cb), webview);
490 /* Home button */
491 item = gtk_tool_button_new_from_stock(GTK_STOCK_HOME);
492 gtk_widget_set_tooltip_text(GTK_WIDGET(item), "Home page");
493 g_signal_connect(G_OBJECT(item), "clicked",
494 G_CALLBACK(go_home_cb), webview);
495 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
497 /* Bookmark button */
498 item = gtk_tool_button_new_from_stock(GTK_STOCK_PROPERTIES);
499 gtk_widget_set_tooltip_text(GTK_WIDGET(item), "Bookmarks");
500 g_signal_connect(G_OBJECT(item), "clicked",
501 G_CALLBACK(go_bookmarks_cb), webview);
502 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
504 return toolbar;
505 }
507 /* Main window */
508 static GtkWidget*
509 create_window(WebKitWebView** newwebview)
510 {
511 GtkWidget *window;
512 GtkWidget *urientry;
513 GtkWidget *search;
515 g_atomic_int_inc(&count);
517 /* Default TazWeb window */
518 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
519 gtk_window_set_default_size(GTK_WINDOW(window), width, height);
520 gtk_window_set_icon_name(GTK_WINDOW(window), "tazweb");
521 gtk_widget_set_name(window, "TazWeb");
522 gtk_window_set_wmclass(GTK_WINDOW(window), "tazweb", "TazWeb");
523 g_signal_connect(window, "destroy", G_CALLBACK(destroy_cb), NULL);
525 /* Webview and widgets */
526 webview = WEBKIT_WEB_VIEW(webkit_web_view_new());
527 urientry = gtk_entry_new();
528 search = gtk_entry_new();
529 vbox = gtk_vbox_new(FALSE, 0);
531 /* Pack box and container */
532 if (! notoolbar)
533 gtk_box_pack_start(GTK_BOX(vbox),
534 create_toolbar(urientry, search, webview), FALSE, FALSE, 0);
535 gtk_box_pack_start(GTK_BOX(vbox),
536 create_browser(window, urientry, search, webview), TRUE, TRUE, 0);
538 gtk_container_add(GTK_CONTAINER(window), vbox);
540 if (newwebview)
541 *newwebview = webview;
543 return window;
544 }
546 /* Cmdline Help & usage */
547 void
548 help(void)
549 {
550 printf("\nTazWeb - Light and fast web browser using Webkit engine\n\n\
551 Usage: tazweb [--options] [value] url\n\
552 \n\
553 Options:\n\
554 -h --help Print TazWeb command line help\n\
555 -p --private Disable on-disk cache, cookies, history\n\
556 -u --useragent [ua] Configure the user agent string\n\
557 -k --kiosk Fullscreen, no bookmarks and download support\n\
558 -r --raw Raw webkit window without toolbar and menu\n\
559 -s --small Small Tazweb window for tiny web applications\n\
560 --notoolbar Disable the top toolbar\n\
561 --nomenu Disable TazWeb contextual menu\n\n");
563 return;
564 }
566 int
567 main(int argc, char *argv[])
568 {
569 textdomain (GETTEXT_PACKAGE);
570 int c;
572 /* Cmdline parsing with getopt_long to handle --option or -o */
573 while (1) {
574 static struct option long_options[] =
575 {
576 /* Set flag */
577 { "notoolbar", no_argument, ¬oolbar, 1 },
578 { "nomenu", no_argument, &nomenu, 1 },
579 /* No flag */
580 { "help", no_argument, 0, 'h' },
581 { "private", no_argument, 0, 'p' },
582 { "useragent", required_argument, 0, 'u' },
583 { "kiosk", no_argument, 0, 'k' },
584 { "raw", no_argument, 0, 'r' },
585 { "small", no_argument, 0, 's' },
586 { 0, 0, 0, 0}
587 };
589 int index = 0;
590 c = getopt_long (argc, argv, "hpu:krs", long_options, &index);
592 /* Detect the end of the options */
593 if (c == -1)
594 break;
596 switch (c) {
597 case 0:
598 /* Options with flag */
599 break;
601 case 'h':
602 help();
603 return 0;
605 case 'p':
606 private++;
607 break;
609 case 'u':
610 useragent = optarg;
611 break;
613 case 'k':
614 kiosk++;
615 break;
617 case 'r':
618 notoolbar++;
619 nomenu++;
620 break;
622 case 's':
623 width = 640;
624 height = 480;
625 break;
627 default:
628 help();
629 return 0;
630 }
631 }
633 argc -= optind;
634 argv += optind;
637 /* Initialize GTK */
638 gtk_init(NULL, NULL);
640 /* Get a default bookmarks.txt if missing */
641 if (! g_file_test(BMTXT, G_FILE_TEST_EXISTS)) {
642 system("install -m 0700 -d $HOME/.config/tazweb");
643 system("install -m 0600 /usr/share/tazweb/bookmarks.txt \
644 $HOME/.config/tazweb/bookmarks.txt");
645 }
647 /* Load the start page or the url in argument */
648 uri =(char*)(argc == 1 ? argv[0] : WEBHOME);
649 if (argv[0])
650 check_requested_uri();
652 tazweb_window = create_window(&webview);
653 gtk_widget_show_all(tazweb_window);
655 /* Handle cookies */
656 if (! private) {
657 session = webkit_get_default_session();
658 snprintf(COOKIES, sizeof COOKIES, "%s", COOKIES);
659 cookies_setup();
660 }
662 /* Fullscreen for Kiosk mode */
663 if (kiosk)
664 gtk_window_fullscreen(GTK_WINDOW(tazweb_window));
666 webkit_web_view_load_uri(webview, uri);
667 gtk_widget_grab_focus(GTK_WIDGET(webview));
668 gtk_main();
670 return 0;
671 }