~ubuntu-branches/ubuntu/oneiric/midori/oneiric-updates

« back to all changes in this revision

Viewing changes to midori/midori-preferences.c

  • Committer: Bazaar Package Importer
  • Author(s): Micah Gersten
  • Date: 2011-05-18 21:07:34 UTC
  • mfrom: (1.1.16 upstream) (3.3.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110518210734-232wzq1tc88gtz2p
Tags: 0.3.6-1ubuntu1
* Merge from debian unstable. (LP: #784944) Remaining changes:
  - debian/control:
    + Change build-depends from libwebkit-dev to libwebkitgtk-dev
  - debian/rules:
    + Change package query from libwebkit-dev to libwebkitgtk-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#endif
17
17
 
18
18
#include "sokoke.h"
 
19
#include "midori-stock.h"
19
20
 
20
21
#include <string.h>
21
22
#include <glib/gi18n.h>
158
159
    return GTK_WIDGET (preferences);
159
160
}
160
161
 
161
 
#if GTK_CHECK_VERSION (2, 16, 0)
162
 
static void
163
 
midori_preferences_homepage_icon_press_cb (GtkWidget*           button,
164
 
                                           GtkEntryIconPosition position,
165
 
                                           GdkEvent*            event,
166
 
                                           MidoriWebSettings*   settings)
167
 
#else
168
162
static void
169
163
midori_preferences_homepage_current_clicked_cb (GtkWidget*         button,
170
164
                                                MidoriWebSettings* settings)
171
 
#endif
172
165
{
173
166
    GtkWidget* preferences = gtk_widget_get_toplevel (button);
174
167
    GtkWidget* browser = katze_object_get_object (preferences, "transient-for");
196
189
}
197
190
#endif
198
191
 
199
 
static void
200
 
midori_preferences_delete_cookies_toggled_cb (GtkToggleButton*   button,
201
 
                                              MidoriWebSettings* settings)
202
 
{
203
 
    gboolean toggled = gtk_toggle_button_get_active (button);
204
 
    g_object_set (settings, "accept-cookies",
205
 
        toggled ? MIDORI_ACCEPT_COOKIES_SESSION : MIDORI_ACCEPT_COOKIES_ALL, NULL);
206
 
}
207
 
 
208
 
static void
209
 
midori_preferences_delete_cookies_changed_cb (GtkComboBox*       combo,
210
 
                                              MidoriWebSettings* settings)
211
 
{
212
 
    gint active = gtk_combo_box_get_active (combo);
213
 
    gint max_age;
214
 
    switch (active)
215
 
    {
216
 
    case 0: max_age =   0; break;
217
 
    case 1: max_age =   1; break;
218
 
    case 2: max_age =   7; break;
219
 
    case 3: max_age =  30; break;
220
 
    case 4: max_age = 365; break;
221
 
    default:
222
 
        max_age = 30;
223
 
    }
224
 
    g_object_set (settings, "maximum-cookie-age", max_age, NULL);
225
 
}
226
 
 
227
192
#if HAVE_OSX
228
193
static void
229
194
midori_preferences_toolbutton_clicked_cb (GtkWidget* toolbutton,
326
291
    #define SPANNED_ADD(__widget) \
327
292
     katze_preferences_add_widget (_preferences, __widget, "spanned")
328
293
    /* Page "General" */
329
 
    PAGE_NEW (GTK_STOCK_HOME, _("General"));
330
 
    FRAME_NEW (_("Startup"));
 
294
    PAGE_NEW (GTK_STOCK_HOME, _("Startup"));
 
295
    FRAME_NEW (NULL);
331
296
    label = katze_property_label (settings, "load-on-startup");
332
297
    INDENTED_ADD (label);
333
298
    button = katze_property_proxy (settings, "load-on-startup", NULL);
334
299
    SPANNED_ADD (button);
335
300
    label = katze_property_label (settings, "homepage");
336
301
    INDENTED_ADD (label);
337
 
    entry = katze_property_proxy (settings, "homepage", NULL);
 
302
    entry = katze_property_proxy (settings, "homepage", "address");
338
303
    SPANNED_ADD (entry);
339
304
    if (parent && katze_object_has_property (parent, "uri"))
340
305
    {
341
 
        #if GTK_CHECK_VERSION (2, 16, 0)
342
 
        gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
343
 
            GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_JUMP_TO);
344
 
        gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
345
 
            GTK_ENTRY_ICON_SECONDARY, _("Use current page as homepage"));
346
 
        g_signal_connect (entry, "icon-press",
347
 
            G_CALLBACK (midori_preferences_homepage_icon_press_cb), settings);
 
306
        #if 0
 
307
        button = gtk_button_new_with_mnemonic (_("Use _current page"));
348
308
        #else
349
 
        button = gtk_button_new ();
350
 
        label = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON);
351
 
        gtk_button_set_image (GTK_BUTTON (button), label);
352
 
        gtk_widget_set_tooltip_text (button, _("Use current page as homepage"));
 
309
        label = gtk_label_new (NULL);
 
310
        INDENTED_ADD (label);
 
311
        button = gtk_button_new_with_label (_("Use current page as homepage"));
 
312
        #endif
353
313
        g_signal_connect (button, "clicked",
354
314
            G_CALLBACK (midori_preferences_homepage_current_clicked_cb), settings);
355
315
        SPANNED_ADD (button);
356
 
        #endif
357
316
    }
358
 
    button = katze_property_proxy (settings, "show-crash-dialog", NULL);
359
 
    INDENTED_ADD (button);
360
 
    button = katze_property_proxy (settings, "speed-dial-in-new-tabs", NULL);
361
 
    SPANNED_ADD (button);
362
 
    FRAME_NEW (_("Transfers"));
363
 
    #if !HAVE_HILDON
364
 
    label = katze_property_label (settings, "download-folder");
365
 
    INDENTED_ADD (label);
366
 
    button = katze_property_proxy (settings, "download-folder", "folder");
367
 
    SPANNED_ADD (button);
368
 
    #endif
369
317
 
370
318
    /* Page "Appearance" */
371
319
    PAGE_NEW (GTK_STOCK_SELECT_FONT, _("Appearance"));
372
 
    FRAME_NEW (_("Font settings"));
 
320
    FRAME_NEW (NULL);
373
321
    #if !HAVE_HILDON
374
322
    label = gtk_label_new (_("Default Font Family"));
 
323
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
375
324
    INDENTED_ADD (label);
376
325
    button = katze_property_proxy (settings, "default-font-family", "font");
377
326
    gtk_widget_set_tooltip_text (button, _("The default font family used to display text"));
380
329
    gtk_widget_set_tooltip_text (entry, _("The default font size used to display text"));
381
330
    SPANNED_ADD (entry);
382
331
    label = gtk_label_new (_("Fixed-width Font Family"));
 
332
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
383
333
    INDENTED_ADD (label);
384
334
    button = katze_property_proxy (settings, "monospace-font-family", "font-monospace");
385
335
    gtk_widget_set_tooltip_text (button, _("The font family used to display fixed-width text"));
388
338
    gtk_widget_set_tooltip_text (entry, _("The font size used to display fixed-width text"));
389
339
    SPANNED_ADD (entry);
390
340
    label = gtk_label_new (_("Minimum Font Size"));
 
341
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
391
342
    INDENTED_ADD (label);
392
343
    entry = katze_property_proxy (settings, "minimum-font-size", NULL);
393
344
    gtk_widget_set_tooltip_text (entry, _("The minimum font size used to display text"));
400
351
 
401
352
    /* Page "Behavior" */
402
353
    PAGE_NEW (GTK_STOCK_SELECT_COLOR, _("Behavior"));
403
 
    FRAME_NEW (_("Features"));
 
354
    FRAME_NEW (NULL);
404
355
    #if !HAVE_HILDON
405
356
    button = katze_property_proxy (settings, "auto-load-images", NULL);
406
357
    INDENTED_ADD (button);
435
386
    #endif
436
387
    if (button != NULL)
437
388
        INDENTED_ADD (button);
 
389
    FRAME_NEW (NULL);
438
390
    button = katze_property_label (settings, "preferred-languages");
439
391
    INDENTED_ADD (button);
440
392
    entry = katze_property_proxy (settings, "preferred-languages", "languages");
441
393
    SPANNED_ADD (entry);
 
394
    #if !HAVE_HILDON
 
395
    label = katze_property_label (settings, "download-folder");
 
396
    INDENTED_ADD (label);
 
397
    button = katze_property_proxy (settings, "download-folder", "folder");
 
398
    SPANNED_ADD (button);
 
399
    #endif
442
400
 
443
401
    /* Page "Interface" */
444
 
    PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));
445
 
    FRAME_NEW (_("Navigationbar"));
 
402
    PAGE_NEW (GTK_STOCK_CONVERT, _("Browsing"));
446
403
    #if !HAVE_HILDON
447
 
    INDENTED_ADD (katze_property_label (settings, "toolbar-style"));
448
 
    button = katze_property_proxy (settings, "toolbar-style", NULL);
449
 
    SPANNED_ADD (button);
 
404
    if (!g_getenv ("DESKTOP_SESSION"))
 
405
    {
 
406
        FRAME_NEW (NULL);
 
407
        INDENTED_ADD (katze_property_label (settings, "toolbar-style"));
 
408
        button = katze_property_proxy (settings, "toolbar-style", NULL);
 
409
        SPANNED_ADD (button);
 
410
    }
450
411
    #endif
451
 
    FRAME_NEW (_("Browsing"));
 
412
    FRAME_NEW (NULL);
452
413
    label = katze_property_label (settings, "open-new-pages-in");
453
414
    INDENTED_ADD (label);
454
415
    button = katze_property_proxy (settings, "open-new-pages-in", NULL);
463
424
    INDENTED_ADD (button);
464
425
    button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
465
426
    SPANNED_ADD (button);
466
 
 
467
427
    #if !HAVE_HILDON
468
 
    /* Page "Applications" */
469
 
    PAGE_NEW (GTK_STOCK_CONVERT, _("Applications"));
470
 
    FRAME_NEW (_("External applications"));
 
428
    FRAME_NEW (NULL);
471
429
    label = katze_property_label (settings, "text-editor");
472
430
    INDENTED_ADD (label);
473
431
    entry = katze_property_proxy (settings, "text-editor", "application-text/plain");
474
432
    SPANNED_ADD (entry);
475
 
    label = katze_property_label (settings, "download-manager");
476
 
    INDENTED_ADD (label);
477
 
    entry = katze_property_proxy (settings, "download-manager", "application-FileTransfer");
478
 
    SPANNED_ADD (entry);
479
433
    label = katze_property_label (settings, "news-aggregator");
480
434
    INDENTED_ADD (label);
481
435
    entry = katze_property_proxy (settings, "news-aggregator", "application-News");
484
438
 
485
439
    /* Page "Network" */
486
440
    PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));
487
 
    FRAME_NEW (_("Network"));
 
441
    FRAME_NEW (NULL);
488
442
    #if !HAVE_HILDON
489
443
    label = katze_property_label (settings, "proxy-type");
490
444
    INDENTED_ADD (label);
491
445
    button = katze_property_proxy (settings, "proxy-type", NULL);
492
446
    SPANNED_ADD (button);
493
447
    label = gtk_label_new (_("Hostname"));
 
448
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
494
449
    INDENTED_ADD (label);
495
450
    entry = katze_property_proxy (settings, "http-proxy", NULL);
496
451
    SPANNED_ADD (entry);
498
453
        G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry);
499
454
    midori_preferences_notify_proxy_type_cb (settings, NULL, entry);
500
455
    #endif
 
456
    #if WEBKIT_CHECK_VERSION (1, 3, 11)
 
457
    label = katze_property_label (settings, "maximum-cache-size");
 
458
    INDENTED_ADD (label);
 
459
    button = katze_property_proxy (settings, "maximum-cache-size", NULL);
 
460
    SPANNED_ADD (button);
 
461
    label = gtk_label_new (_("MB"));
 
462
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
 
463
    SPANNED_ADD (label);
 
464
    #endif
501
465
    label = katze_property_label (settings, "identify-as");
502
466
    INDENTED_ADD (label);
503
467
    button = katze_property_proxy (settings, "identify-as", "custom-user-agent");
504
468
    SPANNED_ADD (button);
505
 
 
506
 
    /* Page "Privacy" */
507
 
    PAGE_NEW (GTK_STOCK_INDEX, _("Privacy"));
508
 
    FRAME_NEW (_("Web Cookies"));
509
 
    button = gtk_check_button_new_with_mnemonic (_("Delete cookies when quitting Midori"));
510
 
    INDENTED_ADD (button);
511
 
    if (katze_object_get_enum (settings, "accept-cookies") == MIDORI_ACCEPT_COOKIES_SESSION)
512
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
513
 
    g_signal_connect (button, "toggled",
514
 
        G_CALLBACK (midori_preferences_delete_cookies_toggled_cb), settings);
515
 
    button = gtk_combo_box_new_text ();
516
 
    gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 hour"));
517
 
    gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 day"));
518
 
    gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 week"));
519
 
    gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 month"));
520
 
    gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 year"));
521
 
    {
522
 
        gint max_age = katze_object_get_int (settings, "maximum-cookie-age");
523
 
        guint active;
524
 
        switch (max_age)
525
 
        {
526
 
        case   0: active = 0; break;
527
 
        case   1: active = 1; break;
528
 
        case   7: active = 2; break;
529
 
        case  30: active = 3; break;
530
 
        case 365: active = 4; break;
531
 
        default:
532
 
            active = 3;
533
 
        }
534
 
        gtk_combo_box_set_active (GTK_COMBO_BOX (button), active);
535
 
    }
536
 
    g_signal_connect (button, "changed",
537
 
        G_CALLBACK (midori_preferences_delete_cookies_changed_cb), settings);
538
 
    SPANNED_ADD (button);
539
 
    {
540
 
        gchar* markup = g_strdup_printf ("<span size=\"smaller\">%s</span>",
541
 
            _("Cookies store login data, saved games, "
542
 
              "or user profiles for advertisement purposes."));
543
 
        label = gtk_label_new (NULL);
544
 
        gtk_label_set_markup (GTK_LABEL (label), markup);
545
 
        g_free (markup);
546
 
    }
547
 
    FILLED_ADD (label);
548
 
    #if WEBKIT_CHECK_VERSION (1, 1, 13)
549
 
    INDENTED_ADD (katze_property_proxy (settings, "enable-offline-web-application-cache", NULL));
550
 
    #endif
551
 
    #if WEBKIT_CHECK_VERSION (1, 1, 8)
552
 
    SPANNED_ADD (katze_property_proxy (settings, "enable-html5-local-storage", NULL));
553
 
    #if !WEBKIT_CHECK_VERSION (1, 1, 14)
554
 
    INDENTED_ADD (katze_property_proxy (settings, "enable-html5-database", NULL));
555
 
    #endif
556
 
    #endif
557
 
    FRAME_NEW (_("History"));
558
 
    button = katze_property_label (settings, "maximum-history-age");
559
 
    INDENTED_ADD (button);
560
 
    button = katze_property_proxy (settings, "maximum-history-age", NULL);
561
 
    SPANNED_ADD (button);
562
 
    label = gtk_label_new (_("days"));
563
 
    SPANNED_ADD (label);
564
469
}