1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
|
Update midori 0.17 to the new pkgconfig and header location. Taken from upstream git
diff -Nurd midori-0.0.17/src/browser.c midori/src/browser.c
--- midori-0.0.17/src/browser.c 2008-01-23 02:20:22.000000000 +0100
+++ midori/src/browser.c 2008-03-05 10:43:08.028499025 +0100
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -290,6 +290,15 @@
g_free(source);*/
}
+void on_action_fullscreen_activate(GtkAction* action, CBrowser* browser)
+{
+ GdkWindowState state = gdk_window_get_state(browser->window->window);
+ if(state & GDK_WINDOW_STATE_FULLSCREEN)
+ gtk_window_unfullscreen(GTK_WINDOW(browser->window));
+ else
+ gtk_window_fullscreen(GTK_WINDOW(browser->window));
+}
+
void on_action_back_activate(GtkAction* action, CBrowser* browser)
{
webkit_web_view_go_back(WEBKIT_WEB_VIEW(get_nth_webView(-1, browser)));
@@ -1125,13 +1134,35 @@
update_search_engines(browser);
}
+static void on_window_state_changed(GtkWidget* widget
+ , GdkEventWindowState* event, CBrowser* browser)
+{
+ if(event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
+ {
+ if(event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
+ {
+ gtk_widget_hide(browser->menubar);
+ g_object_set(browser->fullscreen, "stock-id"
+ , GTK_STOCK_LEAVE_FULLSCREEN, NULL);
+ gtk_widget_show(browser->fullscreen);
+ }
+ else
+ {
+ gtk_widget_show(browser->menubar);
+ gtk_widget_hide(browser->fullscreen);
+ g_object_set(browser->fullscreen, "stock-id"
+ , GTK_STOCK_FULLSCREEN, NULL);
+ }
+ }
+}
+
static void on_window_size_allocate(GtkWidget* widget, GtkAllocation* allocation
, CBrowser* browser)
{
if(GTK_WIDGET_REALIZED(widget))
{
- if(!(gdk_window_get_state(widget->window)
- & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)))
+ GdkWindowState state = gdk_window_get_state(widget->window);
+ if(!(state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)))
{
config->winWidth = allocation->width;
config->winHeight = allocation->height;
@@ -1180,6 +1211,8 @@
// Setup the window metrics
browser->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ g_signal_connect(browser->window, "window-state-event"
+ , G_CALLBACK(on_window_state_changed), browser);
GdkScreen* screen = gtk_window_get_screen(GTK_WINDOW(browser->window));
const gint defaultWidth = (gint)gdk_screen_get_width(screen) / 1.7;
const gint defaultHeight = (gint)gdk_screen_get_height(screen) / 1.7;
@@ -1351,6 +1384,13 @@
gtk_toolbar_insert(GTK_TOOLBAR(browser->navibar)
, GTK_TOOL_ITEM(browser->closedTabs), -1);
sokoke_container_show_children(GTK_CONTAINER(browser->navibar));
+ action = gtk_action_group_get_action(browser->actiongroup, "Fullscreen");
+ browser->fullscreen = gtk_action_create_tool_item(action);
+ gtk_widget_hide(browser->fullscreen);
+ g_signal_connect(browser->fullscreen, "clicked"
+ , G_CALLBACK(on_action_fullscreen_activate), browser);
+ gtk_toolbar_insert(GTK_TOOLBAR(browser->navibar)
+ , GTK_TOOL_ITEM(browser->fullscreen), -1);
action_set_active("ToolbarNavigation", config->toolbarNavigation, browser);
// Bookmarkbar
@@ -1605,6 +1645,7 @@
browser->location = oldBrowser->location;
browser->webSearch = oldBrowser->webSearch;
browser->closedTabs = oldBrowser->closedTabs;
+ browser->fullscreen = oldBrowser->fullscreen;
browser->bookmarkbar = oldBrowser->bookmarkbar;
browser->panels = oldBrowser->panels;
browser->panels_notebook = oldBrowser->panels_notebook;
@@ -1691,7 +1732,9 @@
// Connect signals
#define DOC_CONNECT(__sig, __func) g_signal_connect \
- (G_OBJECT(browser->webView), __sig, G_CALLBACK(__func), browser);
+ (browser->webView, __sig, G_CALLBACK(__func), browser);
+ #define DOC_CONNECTA(__sig, __func) g_signal_connect_after \
+ (browser->webView, __sig, G_CALLBACK(__func), browser);
DOC_CONNECT ("navigation-requested" , on_webView_navigation_requested)
DOC_CONNECT ("title-changed" , on_webView_title_changed)
DOC_CONNECT ("icon-loaded" , on_webView_icon_changed)
@@ -1704,11 +1747,13 @@
DOC_CONNECT ("console-message" , on_webView_console_message)
DOC_CONNECT ("button-press-event" , on_webView_button_press)
+ DOC_CONNECTA ("button-press-event" , on_webView_button_press_after)
DOC_CONNECT ("popup-menu" , on_webView_popup);
DOC_CONNECT ("scroll-event" , on_webView_scroll);
DOC_CONNECT ("leave-notify-event" , on_webView_leave)
DOC_CONNECT ("destroy" , on_webView_destroy)
#undef DOC_CONNECT
+ #undef DOC_CONNECTA
webkit_web_view_set_settings(WEBKIT_WEB_VIEW(browser->webView), webSettings);
diff -Nurd midori-0.0.17/src/browser.h midori/src/browser.h
--- midori-0.0.17/src/browser.h 2008-01-20 19:16:17.000000000 +0100
+++ midori/src/browser.h 2008-03-05 10:43:08.028499025 +0100
@@ -39,6 +39,7 @@
GtkWidget* location;
GtkWidget* webSearch;
GtkWidget* closedTabs;
+ GtkWidget* fullscreen;
GtkWidget* bookmarkbar;
// panels
GtkWidget* panels;
@@ -161,6 +162,9 @@
on_action_source_view_activate(GtkAction*, CBrowser*);
void
+on_action_fullscreen_activate(GtkAction*, CBrowser*);
+
+void
on_action_back_activate(GtkAction*, CBrowser*);
void
@@ -364,6 +368,9 @@
{ "Properties", GTK_STOCK_PROPERTIES
, NULL, ""
, "hm?", NULL/*G_CALLBACK(on_action_properties_activate)*/ },
+ { "Fullscreen", GTK_STOCK_FULLSCREEN
+ , NULL, "F11"
+ , "Toggle fullscreen view", G_CALLBACK(on_action_fullscreen_activate) },
{ "Go", NULL, "_Go" },
{ "Back", GTK_STOCK_GO_BACK
diff -Nurd midori-0.0.17/src/conf.c midori/src/conf.c
--- midori-0.0.17/src/conf.c 2008-01-23 05:12:24.000000000 +0100
+++ midori/src/conf.c 2008-03-05 10:43:08.028499025 +0100
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -64,6 +64,7 @@
GET_INT(config->newPages, "NewPages", CONFIG_NEWPAGES_TAB_NEW);
GET_INT(config->openTabsInTheBackground, "OpenTabsInTheBackground", FALSE);
GET_INT(config->openPopupsInTabs, "OpenPopupsInTabs", FALSE);
+ GET_INT(config->middleClickGoto, "MiddleClickGoto", FALSE);
#undef GET_INT
#undef GET_STR
@@ -73,6 +74,10 @@
#define GET_STR(var, key, default) \
var = sokoke_key_file_get_string_default( \
keyFile, "content", key, default, NULL)
+ GET_STR(config->defaultFontFamily, "DefaultFontFamily", "Sans");
+ GET_INT(config->defaultFontSize, "DefaultFontSize", 10);
+ GET_INT(config->minimumFontSize, "MinimumFontSize", 5);
+ GET_STR(config->defaultEncoding, "DefaultEncoding", "UTF-8");
GET_INT(config->autoLoadImages, "AutoLoadImages", TRUE);
GET_INT(config->autoShrinkImages, "AutoShrinkImages", TRUE);
GET_INT(config->printBackgrounds, "PrintBackgrounds", FALSE);
@@ -143,7 +148,12 @@
g_key_file_set_integer(keyFile, "browser", "NewPages", config->newPages);
g_key_file_set_integer(keyFile, "browser", "OpenTabsInTheBackground", config->openTabsInTheBackground);
g_key_file_set_integer(keyFile, "browser", "OpenPopupsInTabs", config->openPopupsInTabs);
+ g_key_file_set_integer(keyFile, "browser", "MiddleClickGoto", config->middleClickGoto);
+ g_key_file_set_string (keyFile, "content", "DefaultFontFamily", config->defaultFontFamily);
+ g_key_file_set_integer(keyFile, "content", "DefaultFontSize", config->defaultFontSize);
+ g_key_file_set_integer(keyFile, "content", "MinimumFontSize", config->minimumFontSize);
+ g_key_file_set_string (keyFile, "content", "DefaultEncoding", config->defaultEncoding);
g_key_file_set_integer(keyFile, "content", "AutoLoadImages", config->autoLoadImages);
g_key_file_set_integer(keyFile, "content", "AutoShrinkImages", config->autoShrinkImages);
g_key_file_set_integer(keyFile, "content", "PrintBackgrounds", config->printBackgrounds);
diff -Nurd midori-0.0.17/src/conf.h midori/src/conf.h
--- midori-0.0.17/src/conf.h 2008-01-23 05:11:13.000000000 +0100
+++ midori/src/conf.h 2008-03-05 10:43:08.028499025 +0100
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -36,8 +36,12 @@
guint newPages; // where to open new pages
gboolean openTabsInTheBackground;
gboolean openPopupsInTabs;
+ gboolean middleClickGoto;
-
+ gchar* defaultFontFamily;
+ guint defaultFontSize;
+ guint minimumFontSize;
+ gchar* defaultEncoding;
gboolean autoLoadImages;
gboolean autoShrinkImages;
gboolean printBackgrounds;
diff -Nurd midori-0.0.17/src/global.h midori/src/global.h
--- midori-0.0.17/src/global.h 2008-01-23 03:13:40.000000000 +0100
+++ midori/src/global.h 2008-03-05 10:43:08.028499025 +0100
@@ -16,7 +16,7 @@
#include "../katze/katze.h"
#include <gtk/gtk.h>
-#include <webkit.h>
+#include <webkit/webkit.h>
// -- globals
@@ -81,5 +81,9 @@
#if !GTK_CHECK_VERSION(2, 10, 0)
#define GTK_STOCK_SELECT_ALL "gtk-select-all"
#endif
+#if !GTK_CHECK_VERSION(2, 8, 0)
+#define GTK_STOCK_FULLSCREEN "gtk-fullscreen"
+#define GTK_STOCK_LEAVE_FULLSCREEN "gtk-leave-fullscreen"
+#endif
#endif /* !__GLOBAL_H__ */
diff -Nurd midori-0.0.17/src/helpers.c midori/src/helpers.c
--- midori-0.0.17/src/helpers.c 2008-01-20 17:46:16.000000000 +0100
+++ midori/src/helpers.c 2008-03-05 10:43:08.028499025 +0100
@@ -16,7 +16,7 @@
#include "../katze/katze.h"
#include <string.h>
-#include <webkit.h>
+#include <webkit/webkit.h>
GtkIconTheme* get_icon_theme(GtkWidget* widget)
{
@@ -417,7 +417,7 @@
if(!strstr(uri, "://"))
{
// Do we have a domain, ip address or localhost?
- if(strstr(uri, ".") != NULL || !strcmp(uri, "localhost"))
+ if(strchr(uri, '.') != NULL || !strcmp(uri, "localhost"))
return g_strconcat("http://", uri, NULL);
// We don't want to search? So return early.
if(!search)
diff -Nurd midori-0.0.17/src/main.c midori/src/main.c
--- midori-0.0.17/src/main.c 2008-01-23 05:13:21.000000000 +0100
+++ midori/src/main.c 2008-03-05 10:43:08.031832796 +0100
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,7 @@
#include <string.h>
#include <gtk/gtk.h>
+#include <webkit/webkit.h>
#include "config.h"
@@ -58,6 +59,10 @@
#if !GTK_CHECK_VERSION(2, 10, 0)
{ GTK_STOCK_SELECT_ALL, "Select _All", 0, 0, (gchar*)"gtk20" },
#endif
+ #if !GTK_CHECK_VERSION(2, 8, 0)
+ { GTK_STOCK_FULLSCREEN, "_Fullscreen", 0, 0, (gchar*)"gtk20" },
+ { GTK_STOCK_FULLSCREEN, "_Leave Fullscreen", 0, 0, (gchar*)"gtk20" },
+ #endif
};
GtkIconFactory* factory = gtk_icon_factory_new();
guint i;
@@ -244,8 +249,11 @@
stock_items_init();
browsers = NULL;
- webSettings = webkit_web_settings_new();
- g_object_set(webSettings
+ webSettings = g_object_new(WEBKIT_TYPE_WEB_SETTINGS
+ , "default-font-family" , config->defaultFontFamily
+ , "default-font-size" , config->defaultFontSize
+ , "minimum-font-size" , config->minimumFontSize
+ , "default-encoding" , config->defaultEncoding
, "auto-load-images" , config->autoLoadImages
, "auto-shrink-images" , config->autoShrinkImages
, "print-backgrounds" , config->printBackgrounds
diff -Nurd midori-0.0.17/src/prefs.c midori/src/prefs.c
--- midori-0.0.17/src/prefs.c 2008-01-23 05:10:45.000000000 +0100
+++ midori/src/prefs.c 2008-03-05 10:43:08.031832796 +0100
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,8 @@
#include "global.h"
#include "sokoke.h"
-#include "string.h"
+#include <stdlib.h>
+#include <string.h>
static gboolean on_prefs_homepage_focus_out(GtkWidget* widget
, GdkEventFocus event, CPrefs* prefs)
@@ -29,11 +30,65 @@
config->startup = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
}
+static void on_prefs_defaultFont_changed(GtkWidget* widget, CPrefs* prefs)
+{
+ const gchar* font = gtk_font_button_get_font_name(GTK_FONT_BUTTON(widget));
+ gchar** components = g_strsplit(font, " ", 0);
+ guint i, n = g_strv_length(components) - 1;
+ GString* fontName = g_string_new(NULL);
+ for(i = 0; i < n; i++)
+ g_string_append_printf(fontName, "%s ", components[i]);
+ katze_assign(config->defaultFontFamily, g_string_free(fontName, FALSE));
+ config->defaultFontSize = atoi(components[n]);
+ g_strfreev(components);
+ g_object_set(webSettings, "default-font-family", config->defaultFontFamily
+ , "default-font-size", config->defaultFontSize, NULL);
+}
+
+static void on_prefs_minimumFontSize_changed(GtkWidget* widget, CPrefs* prefs)
+{
+ config->minimumFontSize = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+ g_object_set(webSettings, "minimum-font-size", config->minimumFontSize, NULL);
+}
+
+static void on_prefs_defaultEncoding_changed(GtkWidget* widget, CPrefs* prefs)
+{
+ gchar* encoding;
+ switch(gtk_combo_box_get_active(GTK_COMBO_BOX(widget)))
+ {
+ case 0:
+ encoding = g_strdup("BIG5");
+ break;
+ case 1:
+ encoding = g_strdup("SHIFT_JIS");
+ break;
+ case 2:
+ encoding = g_strdup("KOI8-R");
+ break;
+ case 3:
+ encoding = g_strdup("UTF-8");
+ break;
+ case 4:
+ encoding = g_strdup("ISO-8859-1");
+ break;
+ default:
+ encoding = g_strdup("UTF-8");
+ g_warning("Invalid default encoding");
+ }
+ katze_assign(config->defaultEncoding, encoding);
+ g_object_set(webSettings, "default-encoding", config->defaultEncoding, NULL);
+}
+
static void on_prefs_newpages_changed(GtkWidget* widget, CPrefs* prefs)
{
config->newPages = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
}
+void on_prefs_middleClickGoto_toggled(GtkWidget* widget, CPrefs* prefs)
+{
+ config->middleClickGoto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+}
+
void on_prefs_openTabsInTheBackground_toggled(GtkWidget* widget, CPrefs* prefs)
{
config->openTabsInTheBackground = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -302,7 +357,7 @@
#define WIDGET_ADD(__widget, __left, __right, __top, __bottom)\
gtk_table_attach(GTK_TABLE(table), __widget\
, __left, __right, __top, __bottom\
- , 0, GTK_FILL, 8, 2)
+ , GTK_FILL, GTK_FILL, 8, 2)
#define FILLED_ADD(__widget, __left, __right, __top, __bottom)\
gtk_table_attach(GTK_TABLE(table), __widget\
, __left, __right, __top, __bottom\
@@ -371,30 +426,42 @@
PAGE_NEW("Appearance");
FRAME_NEW("Font settings");
TABLE_NEW(5, 2);
- INDENTED_ADD(gtk_label_new("Standard font"), 0, 1, 0, 1);
- button = gtk_font_button_new_with_font("Sans 10"/*config->sFontStandard*/);
- gtk_widget_set_sensitive(button, FALSE); //...
+ INDENTED_ADD(gtk_label_new_with_mnemonic("Default _font"), 0, 1, 0, 1);
+ gchar* defaultFont = g_strdup_printf("%s %d"
+ , config->defaultFontFamily, config->defaultFontSize);
+ button = gtk_font_button_new_with_font(defaultFont);
+ g_free(defaultFont);
+ g_signal_connect(button, "font-set", G_CALLBACK(on_prefs_defaultFont_changed), prefs);
FILLED_ADD(button, 1, 2, 0, 1);
- INDENTED_ADD(gtk_label_new("Minimum font size"), 0, 1, 1, 2);
+ INDENTED_ADD(gtk_label_new_with_mnemonic("_Minimum font size"), 0, 1, 1, 2);
hbox = gtk_hbox_new(FALSE, 4);
- spinbutton = gtk_spin_button_new_with_range(5, 12, 1);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbutton), 5/*config->iFontSizeMin*/);
- gtk_widget_set_sensitive(spinbutton, FALSE); //...
+ spinbutton = gtk_spin_button_new_with_range(1, G_MAXINT, 1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbutton), config->minimumFontSize);
+ g_signal_connect(spinbutton, "value-changed"
+ , G_CALLBACK(on_prefs_minimumFontSize_changed), prefs);
gtk_box_pack_start(GTK_BOX(hbox), spinbutton, FALSE, FALSE, 0);
button = gtk_button_new_with_mnemonic("_Advanced");
gtk_widget_set_sensitive(button, FALSE); //...
gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 4);
FILLED_ADD(hbox, 1, 2, 1, 2);
- INDENTED_ADD(gtk_label_new("Default encoding"), 0, 1, 2, 3);
+ INDENTED_ADD(gtk_label_new_with_mnemonic("Default _encoding"), 0, 1, 2, 3);
combobox = gtk_combo_box_new_text();
- const gchar* encoding = NULL; g_get_charset(&encoding);
- // TODO: Fallback to utf-8 if the encoding is not sane (e.g. when lang=C)
- gchar* sEncodingDefault = g_strdup_printf("System (%s)", encoding);
sokoke_combo_box_add_strings(GTK_COMBO_BOX(combobox)
- , sEncodingDefault, "Chinese", "Greek", "Japanese (SHIFT_JIS)"
- , "Korean", "Russian", "Unicode (UTF-8)", "Western (ISO-8859-1)", NULL);
- gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0); //...
- gtk_widget_set_sensitive(combobox, FALSE); //...
+ , "Chinese (BIG5)", "Japanese (SHIFT_JIS)", "Russian (KOI8-R)"
+ , "Unicode (UTF-8)", "Western (ISO-8859-1)", NULL);
+ if(!strcmp(config->defaultEncoding, "BIG5"))
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
+ else if(!strcmp(config->defaultEncoding, "SHIFT_JIS"))
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 1);
+ else if(!strcmp(config->defaultEncoding, "KOI8-R"))
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 2);
+ else if(!strcmp(config->defaultEncoding, "UTF-8"))
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 3);
+ else if(!strcmp(config->defaultEncoding, "ISO-8859-1"))
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 4);
+ // FIXME: Provide a 'Custom' item
+ g_signal_connect(combobox, "changed"
+ , G_CALLBACK(on_prefs_defaultEncoding_changed), prefs);
FILLED_ADD(combobox, 1, 2, 2, 3);
button = gtk_button_new_with_label("Advanced settings");
gtk_widget_set_sensitive(button, FALSE); //...
@@ -427,15 +494,19 @@
sokoke_combo_box_add_strings(GTK_COMBO_BOX(combobox)
, "New tab", "New window", "Current tab", NULL);
gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), config->newPages);
- g_signal_connect(combobox, "changed"
- , G_CALLBACK(on_prefs_newpages_changed), prefs);
+ g_signal_connect(combobox, "changed", G_CALLBACK(on_prefs_newpages_changed), prefs);
gtk_widget_set_sensitive(combobox, FALSE); //...
FILLED_ADD(combobox, 1, 2, 0, 1);
+ checkbutton = gtk_check_button_new_with_mnemonic("_Middle click goto");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->middleClickGoto);
+ g_signal_connect(checkbutton, "toggled"
+ , G_CALLBACK(on_prefs_middleClickGoto_toggled), prefs);
+ INDENTED_ADD(checkbutton, 0, 1, 1, 2);
checkbutton = gtk_check_button_new_with_mnemonic("Open tabs in the _background");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->openTabsInTheBackground);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_openTabsInTheBackground_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 2, 1, 2);
+ SPANNED_ADD(checkbutton, 1, 2, 1, 2);
checkbutton = gtk_check_button_new_with_mnemonic("Open popups in _tabs");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->openPopupsInTabs);
g_signal_connect(checkbutton, "toggled"
@@ -448,7 +519,7 @@
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->autoLoadImages);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_loadImagesAutomatically_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 0, 1);
+ INDENTED_ADD(checkbutton, 0, 1, 0, 1);
checkbutton = gtk_check_button_new_with_mnemonic("_Shrink images to fit");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->autoShrinkImages);
g_signal_connect(checkbutton, "toggled"
@@ -458,7 +529,7 @@
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->printBackgrounds);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_printBackgrounds_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 1, 2);
+ INDENTED_ADD(checkbutton, 0, 1, 1, 2);
checkbutton = gtk_check_button_new_with_mnemonic("_Resizable textareas");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->resizableTextAreas);
g_signal_connect(checkbutton, "toggled"
@@ -468,7 +539,7 @@
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->enableScripts);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_enableJavaScript_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 2, 3);
+ INDENTED_ADD(checkbutton, 0, 1, 2, 3);
checkbutton = gtk_check_button_new_with_mnemonic("Enable _plugins");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->enablePlugins);
g_signal_connect(checkbutton, "toggled"
@@ -504,7 +575,7 @@
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->toolbarSmall);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_toolbarSmall_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 1, 2);
+ INDENTED_ADD(checkbutton, 0, 1, 1, 2);
checkbutton = gtk_check_button_new_with_mnemonic("Show web_search");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->toolbarWebSearch);
g_signal_connect(checkbutton, "toggled"
@@ -514,42 +585,34 @@
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->toolbarNewTab);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_toolbarNewTab_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 2, 3);
+ INDENTED_ADD(checkbutton, 0, 1, 2, 3);
checkbutton = gtk_check_button_new_with_mnemonic("Show _closed tabs button");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->toolbarClosedTabs);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_toolbarClosedTabs_toggled), prefs);
SPANNED_ADD(checkbutton, 1, 2, 2, 3);
FRAME_NEW("Miscellaneous");
- TABLE_NEW(3, 2);
- checkbutton = gtk_check_button_new_with_mnemonic
- ("Show close _buttons on tabs");
+ TABLE_NEW(2, 2);
+ checkbutton = gtk_check_button_new_with_mnemonic("Close _buttons on tabs");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->tabClose);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_tabClose_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 0, 1);
+ INDENTED_ADD(checkbutton, 0, 1, 0, 1);
hbox = gtk_hbox_new(FALSE, 4);
gtk_box_pack_start(GTK_BOX(hbox)
- , gtk_label_new_with_mnemonic("Tab Si_ze"), FALSE, FALSE, 0);
+ , gtk_label_new_with_mnemonic("Tab Si_ze"), FALSE, FALSE, 4);
spinbutton = gtk_spin_button_new_with_range(0, 36, 1);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbutton), config->tabSize);
g_signal_connect(spinbutton, "changed"
, G_CALLBACK(on_prefs_tabSize_changed), prefs);
gtk_box_pack_start(GTK_BOX(hbox), spinbutton, FALSE, FALSE, 0);
FILLED_ADD(hbox, 1, 2, 0, 1);
- INDENTED_ADD(gtk_label_new_with_mnemonic("Tabbar _placement"), 0, 1, 1, 2);
- combobox = gtk_combo_box_new_text();
- sokoke_combo_box_add_strings(GTK_COMBO_BOX(combobox)
- , "Left", "Top", "Right", "Bottom", NULL);
- gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 1); //...
- gtk_widget_set_sensitive(combobox, FALSE); //...
- FILLED_ADD(combobox, 1, 2, 1, 2);
- INDENTED_ADD(gtk_label_new_with_mnemonic("_Location search engine"), 0, 1, 2, 3);
+ INDENTED_ADD(gtk_label_new_with_mnemonic("_Location search engine"), 0, 1, 1, 2);
entry = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry), config->locationSearch);
g_signal_connect(entry, "focus-out-event"
, G_CALLBACK(on_prefs_locationsearch_focus_out), prefs);
- FILLED_ADD(entry, 1, 2, 2, 3);
+ FILLED_ADD(entry, 1, 2, 1, 2);
// Page "Network"
PAGE_NEW("Network");
diff -Nurd midori-0.0.17/src/ui.h midori/src/ui.h
--- midori-0.0.17/src/ui.h 2008-01-20 19:16:17.000000000 +0100
+++ midori/src/ui.h 2008-03-05 10:43:08.071832738 +0100
@@ -91,9 +91,8 @@
"<menuitem action='ZoomOut'/>"
"<menuitem action='ZoomNormal'/>"
"<separator/>"
- "<menuitem action='BackgroundImage'/>"
"<menuitem action='SourceView'/>"
- "<menuitem action='Properties'/>"
+ "<menuitem action='Fullscreen'/>"
"</menu>"
"<menu action='Go'>"
"<menuitem action='Back'/>"
diff -Nurd midori-0.0.17/src/webSearch.h midori/src/webSearch.h
--- midori-0.0.17/src/webSearch.h 2007-12-15 04:09:47.000000000 +0100
+++ midori/src/webSearch.h 2008-03-05 10:43:08.071832738 +0100
@@ -16,7 +16,7 @@
#include <gtk/gtk.h>
#include <libsexy/sexy.h>
-#include <webkit.h>
+#include <webkit/webkit.h>
// -- Types
diff -Nurd midori-0.0.17/src/webView.c midori/src/webView.c
--- midori-0.0.17/src/webView.c 2008-01-13 02:47:38.000000000 +0100
+++ midori/src/webView.c 2008-03-05 10:43:08.071832738 +0100
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -251,6 +251,27 @@
return FALSE;
}
+gboolean on_webView_button_press_after(GtkWidget* webView, GdkEventButton* event
+ , CBrowser* browser)
+{
+ if(event->button == 2 && config->middleClickGoto)
+ {
+ GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+ gchar* text = gtk_clipboard_wait_for_text(clipboard);
+ gchar* uri = NULL;
+ if(text && strchr(text, '.') && !strchr(text, ' '))
+ uri = magic_uri(text, FALSE);
+ g_free(text);
+ if(uri)
+ {
+ webkit_web_view_open(WEBKIT_WEB_VIEW(browser->webView), uri);
+ g_free(uri);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
void on_webView_popup(GtkWidget* webView, CBrowser* browser)
{
webView_popup(webView, NULL, browser);
diff -Nurd midori-0.0.17/src/webView.h midori/src/webView.h
--- midori-0.0.17/src/webView.h 2008-01-04 08:46:44.000000000 +0100
+++ midori/src/webView.h 2008-03-05 10:43:08.071832738 +0100
@@ -16,7 +16,7 @@
#include "browser.h"
#include "debug.h"
-#include <webkit.h>
+#include <webkit/webkit.h>
WebKitNavigationResponse
on_webView_navigation_requested(GtkWidget* webView, WebKitWebFrame* frame
@@ -60,6 +60,9 @@
gboolean
on_webView_button_press(GtkWidget*, GdkEventButton*, CBrowser*);
+gboolean
+on_webView_button_press_after(GtkWidget*, GdkEventButton*, CBrowser*);
+
void
on_webView_popup(GtkWidget*, CBrowser*);
--- midori-0.0.17/configure.in 2008-01-24 03:47:18.000000000 +0100
+++ midori/configure.in 2008-03-05 10:43:08.025165254 +0100
@@ -52,15 +52,15 @@
GTK_VER=`pkg-config --modversion gtk+-2.0`
AC_DEFINE_UNQUOTED([GTK_VER], "$GTK_VER", [GTK+ version])
-# Checks for WebKitGtk
-PKG_CHECK_MODULES(WEBKIT, WebKitGtk, have_webkit=true, have_webkit=false)
+# Checks for WebKit
+PKG_CHECK_MODULES(WEBKIT, webkit-1.0, have_webkit=true, have_webkit=false)
if test "x${have_webkit}" = "xfalse" ; then
- AC_MSG_ERROR([No WebKitGtk package information found])
+ AC_MSG_ERROR([No WebKit package information found])
fi
AC_SUBST(WEBKIT_CFLAGS)
AC_SUBST(WEBKIT_LIBS)
-WEBKIT_VER=`pkg-config --modversion WebKitGtk`
-AC_DEFINE_UNQUOTED([WEBKIT_VER], "$WEBKITGTK_VER", [WebKitGtk version])
+WEBKIT_VER=`pkg-config --modversion webkit-1.0`
+AC_DEFINE_UNQUOTED([WEBKIT_VER], "$WEBKIT_VER", [WebKit version])
# Checks for libsexy
PKG_CHECK_MODULES(LIBSEXY, libsexy, have_libsexy=true, have_libsexy=false)
|