guint alloc_timeout;
guint panel_timeout;
+ gint clear_private_data;
+
MidoriWebSettings* settings;
KatzeArray* proxy_array;
KatzeArray* bookmarks;
LAST_SIGNAL
};
+enum
+{
+ MIDORI_CLEAR_NONE = 0,
+ MIDORI_CLEAR_HISTORY = 1,
+ MIDORI_CLEAR_COOKIES = 2,
+ MIDORI_CLEAR_FLASH_COOKIES = 4,
+ MIDORI_CLEAR_WEBSITE_ICONS = 8,
+ MIDORI_CLEAR_TRASH = 16
+};
+
static guint signals[LAST_SIGNAL];
static void
if (response_id == GTK_RESPONSE_ACCEPT)
{
GtkToggleButton* button;
+ gint clear_prefs = MIDORI_CLEAR_NONE;
+ gint saved_prefs = MIDORI_CLEAR_NONE;
+
+ g_object_get (browser->settings, "clear-private-data", &saved_prefs, NULL);
button = g_object_get_data (G_OBJECT (dialog), "history");
if (gtk_toggle_button_get_active (button))
+ {
katze_array_clear (browser->history);
+ clear_prefs |= MIDORI_CLEAR_HISTORY;
+ }
button = g_object_get_data (G_OBJECT (dialog), "cookies");
if (gtk_toggle_button_get_active (button))
{
soup_cookie_free (cookie);
}
g_slist_free (cookies);
+ clear_prefs |= MIDORI_CLEAR_COOKIES;
}
button = g_object_get_data (G_OBJECT (dialog), "flash-cookies");
if (gtk_toggle_button_get_active (button))
"Flash_Player", NULL);
sokoke_remove_path (cache, TRUE);
g_free (cache);
+ clear_prefs |= MIDORI_CLEAR_FLASH_COOKIES;
}
button = g_object_get_data (G_OBJECT (dialog), "website-icons");
if (gtk_toggle_button_get_active (button))
PACKAGE_NAME, "icons", NULL);
sokoke_remove_path (cache, TRUE);
g_free (cache);
+ clear_prefs |= MIDORI_CLEAR_WEBSITE_ICONS;
}
button = g_object_get_data (G_OBJECT (dialog), "trash");
if (gtk_toggle_button_get_active (button))
katze_array_clear (browser->trash);
_midori_browser_update_actions (browser);
}
+ clear_prefs |= MIDORI_CLEAR_TRASH;
}
+
+ if (clear_prefs != saved_prefs)
+ g_object_set (browser->settings, "clear-private-data", clear_prefs, NULL);
}
if (response_id != GTK_RESPONSE_DELETE_EVENT)
gtk_widget_destroy (dialog);
GtkWidget* label;
GtkWidget* button;
+ gint clear_prefs = MIDORI_CLEAR_NONE;
+ g_object_get (browser->settings, "clear-private-data", &clear_prefs, NULL);
+
dialog = gtk_dialog_new_with_buttons (_("Clear Private Data"),
GTK_WINDOW (browser), GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
vbox = gtk_vbox_new (TRUE, 4);
button = gtk_check_button_new_with_mnemonic (_("History"));
+ if ((clear_prefs & MIDORI_CLEAR_HISTORY) == MIDORI_CLEAR_HISTORY)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE);
g_object_set_data (G_OBJECT (dialog), "history", button);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
button = gtk_check_button_new_with_mnemonic (_("Cookies"));
+ if ((clear_prefs & MIDORI_CLEAR_COOKIES) == MIDORI_CLEAR_COOKIES)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE);
g_object_set_data (G_OBJECT (dialog), "cookies", button);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
button = gtk_check_button_new_with_mnemonic (_("'Flash' Cookies"));
+ if ((clear_prefs & MIDORI_CLEAR_FLASH_COOKIES) == MIDORI_CLEAR_FLASH_COOKIES)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE);
g_object_set_data (G_OBJECT (dialog), "flash-cookies", button);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
button = gtk_check_button_new_with_mnemonic (_("Website icons"));
+ if ((clear_prefs & MIDORI_CLEAR_WEBSITE_ICONS) == MIDORI_CLEAR_WEBSITE_ICONS)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE);
g_object_set_data (G_OBJECT (dialog), "website-icons", button);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
button = gtk_check_button_new_with_mnemonic (_("_Closed Tabs and Windows"));
+ if ((clear_prefs & MIDORI_CLEAR_TRASH) == MIDORI_CLEAR_TRASH)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE);
g_object_set_data (G_OBJECT (dialog), "trash", button);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 8);
MidoriIdentity identify_as;
gchar* ident_string;
gint cache_size;
+
+ gint clear_private_data;
};
struct _MidoriWebSettingsClass
PROP_AUTO_DETECT_PROXY,
PROP_IDENTIFY_AS,
PROP_IDENT_STRING,
- PROP_CACHE_SIZE
+ PROP_CACHE_SIZE,
+
+ PROP_CLEAR_PRIVATE_DATA
};
GType
_("The allowed size of the cache"),
0, G_MAXINT, 100,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * MidoriWebSettings:clear-private-data:
+ *
+ * The private data selected for deletion.
+ *
+ * Since: 0.1.7
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_CLEAR_PRIVATE_DATA,
+ g_param_spec_int (
+ "clear-private-data",
+ _("Clear private data"),
+ _("The private data selected for deletion"),
+ 0, G_MAXINT, 0,
+ flags));
+
}
static void
case PROP_CACHE_SIZE:
web_settings->cache_size = g_value_get_int (value);
break;
+ case PROP_CLEAR_PRIVATE_DATA:
+ web_settings->clear_private_data = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_CACHE_SIZE:
g_value_set_int (value, web_settings->cache_size);
break;
+ case PROP_CLEAR_PRIVATE_DATA:
+ g_value_set_int (value, web_settings->clear_private_data);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;