Count both cookies and history expiry in months
This commit is contained in:
parent
98da02a5fd
commit
20d47ffac4
4 changed files with 53 additions and 48 deletions
|
@ -189,6 +189,26 @@ proxy_entry_focus_out_event_cb (GtkEntry* entry,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
proxy_days_changed_cb (GtkComboBox* combo,
|
||||||
|
GObject* object)
|
||||||
|
{
|
||||||
|
gint active = gtk_combo_box_get_active (combo);
|
||||||
|
const gchar* property = g_object_get_data (G_OBJECT (combo), "property");
|
||||||
|
gint max_age;
|
||||||
|
switch (active)
|
||||||
|
{
|
||||||
|
case 0: max_age = 0; break;
|
||||||
|
case 1: max_age = 1; break;
|
||||||
|
case 2: max_age = 7; break;
|
||||||
|
case 3: max_age = 30; break;
|
||||||
|
case 4: max_age = 365; break;
|
||||||
|
default:
|
||||||
|
max_age = 30;
|
||||||
|
}
|
||||||
|
g_object_set (object, property, max_age, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
proxy_spin_button_changed_cb (GtkSpinButton* button,
|
proxy_spin_button_changed_cb (GtkSpinButton* button,
|
||||||
GObject* object)
|
GObject* object)
|
||||||
|
@ -480,6 +500,9 @@ g_icon_to_string (GIcon *icon)
|
||||||
* Since 0.3.6 the following hints are also supported:
|
* Since 0.3.6 the following hints are also supported:
|
||||||
* "address": the widget will be particularly suitable for typing
|
* "address": the widget will be particularly suitable for typing
|
||||||
* a valid URI or IP address and highlight errors.
|
* a valid URI or IP address and highlight errors.
|
||||||
|
* Since 0.3.7 the following hints are also supported:
|
||||||
|
* "days": the widget will be particularly suitable for choosing
|
||||||
|
* a period of time in days.
|
||||||
*
|
*
|
||||||
* Any other values for @hint are silently ignored.
|
* Any other values for @hint are silently ignored.
|
||||||
*
|
*
|
||||||
|
@ -788,6 +811,30 @@ katze_property_proxy (gpointer object,
|
||||||
g_signal_connect (widget, "value-changed",
|
g_signal_connect (widget, "value-changed",
|
||||||
G_CALLBACK (proxy_spin_button_changed_cb), object);
|
G_CALLBACK (proxy_spin_button_changed_cb), object);
|
||||||
}
|
}
|
||||||
|
else if (type == G_TYPE_PARAM_INT && _hint == I_("days"))
|
||||||
|
{
|
||||||
|
gint value = katze_object_get_int (object, property);
|
||||||
|
gint active;
|
||||||
|
widget = gtk_combo_box_new_text ();
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 hour"));
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 day"));
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 week"));
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 month"));
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 year"));
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case 0: active = 0; break;
|
||||||
|
case 1: active = 1; break;
|
||||||
|
case 7: active = 2; break;
|
||||||
|
case 30: active = 3; break;
|
||||||
|
case 365: active = 4; break;
|
||||||
|
default:
|
||||||
|
active = 3;
|
||||||
|
}
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active);
|
||||||
|
g_signal_connect (widget, "changed",
|
||||||
|
G_CALLBACK (proxy_days_changed_cb), object);
|
||||||
|
}
|
||||||
else if (type == G_TYPE_PARAM_INT)
|
else if (type == G_TYPE_PARAM_INT)
|
||||||
{
|
{
|
||||||
gint value = katze_object_get_int (object, property);
|
gint value = katze_object_get_int (object, property);
|
||||||
|
|
|
@ -717,25 +717,6 @@ midori_browser_show_preferences_cb (MidoriBrowser* browser,
|
||||||
gtk_box_pack_start (GTK_BOX (page), scrolled, TRUE, TRUE, 4);
|
gtk_box_pack_start (GTK_BOX (page), scrolled, TRUE, TRUE, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
midori_preferences_delete_cookies_changed_cb (GtkComboBox* combo,
|
|
||||||
MidoriWebSettings* settings)
|
|
||||||
{
|
|
||||||
gint active = gtk_combo_box_get_active (combo);
|
|
||||||
gint max_age;
|
|
||||||
switch (active)
|
|
||||||
{
|
|
||||||
case 0: max_age = 0; break;
|
|
||||||
case 1: max_age = 1; break;
|
|
||||||
case 2: max_age = 7; break;
|
|
||||||
case 3: max_age = 30; break;
|
|
||||||
case 4: max_age = 365; break;
|
|
||||||
default:
|
|
||||||
max_age = 30;
|
|
||||||
}
|
|
||||||
g_object_set (settings, "maximum-cookie-age", max_age, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_browser_privacy_preferences_cb (MidoriBrowser* browser,
|
midori_browser_privacy_preferences_cb (MidoriBrowser* browser,
|
||||||
KatzePreferences* preferences,
|
KatzePreferences* preferences,
|
||||||
|
@ -744,34 +725,13 @@ midori_browser_privacy_preferences_cb (MidoriBrowser* browser,
|
||||||
MidoriWebSettings* settings = midori_browser_get_settings (browser);
|
MidoriWebSettings* settings = midori_browser_get_settings (browser);
|
||||||
GtkWidget* button;
|
GtkWidget* button;
|
||||||
GtkWidget* label;
|
GtkWidget* label;
|
||||||
gint max_age = katze_object_get_int (settings, "maximum-cookie-age");
|
|
||||||
guint active;
|
|
||||||
gchar* markup;
|
gchar* markup;
|
||||||
|
|
||||||
katze_preferences_add_category (preferences, _("Privacy"), GTK_STOCK_INDEX);
|
katze_preferences_add_category (preferences, _("Privacy"), GTK_STOCK_INDEX);
|
||||||
katze_preferences_add_group (preferences, NULL);
|
katze_preferences_add_group (preferences, NULL);
|
||||||
button = katze_property_label (settings, "maximum-cookie-age");
|
button = katze_property_label (settings, "maximum-cookie-age");
|
||||||
katze_preferences_add_widget (preferences, button, "indented");
|
katze_preferences_add_widget (preferences, button, "indented");
|
||||||
button = gtk_combo_box_new_text ();
|
button = katze_property_proxy (settings, "maximum-cookie-age", "days");
|
||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 hour"));
|
|
||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 day"));
|
|
||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 week"));
|
|
||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 month"));
|
|
||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 year"));
|
|
||||||
|
|
||||||
switch (max_age)
|
|
||||||
{
|
|
||||||
case 0: active = 0; break;
|
|
||||||
case 1: active = 1; break;
|
|
||||||
case 7: active = 2; break;
|
|
||||||
case 30: active = 3; break;
|
|
||||||
case 365: active = 4; break;
|
|
||||||
default:
|
|
||||||
active = 3;
|
|
||||||
}
|
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (button), active);
|
|
||||||
g_signal_connect (button, "changed",
|
|
||||||
G_CALLBACK (midori_preferences_delete_cookies_changed_cb), settings);
|
|
||||||
katze_preferences_add_widget (preferences, button, "spanned");
|
katze_preferences_add_widget (preferences, button, "spanned");
|
||||||
|
|
||||||
markup = g_strdup_printf ("<span size=\"smaller\">%s</span>",
|
markup = g_strdup_printf ("<span size=\"smaller\">%s</span>",
|
||||||
|
@ -797,13 +757,11 @@ midori_browser_privacy_preferences_cb (MidoriBrowser* browser,
|
||||||
button = katze_property_proxy (settings, "strip-referer", NULL);
|
button = katze_property_proxy (settings, "strip-referer", NULL);
|
||||||
katze_preferences_add_widget (preferences, button, "indented");
|
katze_preferences_add_widget (preferences, button, "indented");
|
||||||
#endif
|
#endif
|
||||||
katze_preferences_add_group (preferences, NULL);
|
katze_preferences_add_widget (preferences, gtk_label_new (NULL), "indented");
|
||||||
button = katze_property_label (settings, "maximum-history-age");
|
button = katze_property_label (settings, "maximum-history-age");
|
||||||
katze_preferences_add_widget (preferences, button, "indented");
|
katze_preferences_add_widget (preferences, button, "indented");
|
||||||
button = katze_property_proxy (settings, "maximum-history-age", NULL);
|
button = katze_property_proxy (settings, "maximum-history-age", "days");
|
||||||
katze_preferences_add_widget (preferences, button, "spanned");
|
katze_preferences_add_widget (preferences, button, "spanned");
|
||||||
label = gtk_label_new (_("days"));
|
|
||||||
katze_preferences_add_widget (preferences, label, "spanned");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -425,7 +425,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
||||||
button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
|
button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
|
||||||
SPANNED_ADD (button);
|
SPANNED_ADD (button);
|
||||||
#if !HAVE_HILDON
|
#if !HAVE_HILDON
|
||||||
FRAME_NEW (NULL);
|
INDENTED_ADD (gtk_label_new (NULL));
|
||||||
label = katze_property_label (settings, "text-editor");
|
label = katze_property_label (settings, "text-editor");
|
||||||
INDENTED_ADD (label);
|
INDENTED_ADD (label);
|
||||||
entry = katze_property_proxy (settings, "text-editor", "application-text/plain");
|
entry = katze_property_proxy (settings, "text-editor", "application-text/plain");
|
||||||
|
|
|
@ -828,7 +828,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
||||||
PROP_MAXIMUM_COOKIE_AGE,
|
PROP_MAXIMUM_COOKIE_AGE,
|
||||||
g_param_spec_int (
|
g_param_spec_int (
|
||||||
"maximum-cookie-age",
|
"maximum-cookie-age",
|
||||||
_("Maximum cookie age"),
|
_("Delete old Cookies after:"),
|
||||||
_("The maximum number of days to save cookies for"),
|
_("The maximum number of days to save cookies for"),
|
||||||
0, G_MAXINT, 30,
|
0, G_MAXINT, 30,
|
||||||
flags));
|
flags));
|
||||||
|
@ -838,7 +838,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
||||||
PROP_MAXIMUM_HISTORY_AGE,
|
PROP_MAXIMUM_HISTORY_AGE,
|
||||||
g_param_spec_int (
|
g_param_spec_int (
|
||||||
"maximum-history-age",
|
"maximum-history-age",
|
||||||
_("Maximum history age"),
|
_("Delete pages from history after:"),
|
||||||
_("The maximum number of days to save the history for"),
|
_("The maximum number of days to save the history for"),
|
||||||
0, G_MAXINT, 30,
|
0, G_MAXINT, 30,
|
||||||
flags));
|
flags));
|
||||||
|
|
Loading…
Reference in a new issue