Remember options in Clear private data dialogue
This commit is contained in:
parent
3f3898fe65
commit
1fa9dec7b4
2 changed files with 67 additions and 1 deletions
|
@ -75,6 +75,8 @@ struct _MidoriBrowser
|
||||||
guint alloc_timeout;
|
guint alloc_timeout;
|
||||||
guint panel_timeout;
|
guint panel_timeout;
|
||||||
|
|
||||||
|
gint clear_private_data;
|
||||||
|
|
||||||
MidoriWebSettings* settings;
|
MidoriWebSettings* settings;
|
||||||
KatzeArray* proxy_array;
|
KatzeArray* proxy_array;
|
||||||
KatzeArray* bookmarks;
|
KatzeArray* bookmarks;
|
||||||
|
@ -133,6 +135,16 @@ enum
|
||||||
LAST_SIGNAL
|
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 guint signals[LAST_SIGNAL];
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3450,10 +3462,17 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
||||||
if (response_id == GTK_RESPONSE_ACCEPT)
|
if (response_id == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
GtkToggleButton* button;
|
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");
|
button = g_object_get_data (G_OBJECT (dialog), "history");
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
|
{
|
||||||
katze_array_clear (browser->history);
|
katze_array_clear (browser->history);
|
||||||
|
clear_prefs |= MIDORI_CLEAR_HISTORY;
|
||||||
|
}
|
||||||
button = g_object_get_data (G_OBJECT (dialog), "cookies");
|
button = g_object_get_data (G_OBJECT (dialog), "cookies");
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
{
|
{
|
||||||
|
@ -3469,6 +3488,7 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
||||||
soup_cookie_free (cookie);
|
soup_cookie_free (cookie);
|
||||||
}
|
}
|
||||||
g_slist_free (cookies);
|
g_slist_free (cookies);
|
||||||
|
clear_prefs |= MIDORI_CLEAR_COOKIES;
|
||||||
}
|
}
|
||||||
button = g_object_get_data (G_OBJECT (dialog), "flash-cookies");
|
button = g_object_get_data (G_OBJECT (dialog), "flash-cookies");
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
|
@ -3477,6 +3497,7 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
||||||
"Flash_Player", NULL);
|
"Flash_Player", NULL);
|
||||||
sokoke_remove_path (cache, TRUE);
|
sokoke_remove_path (cache, TRUE);
|
||||||
g_free (cache);
|
g_free (cache);
|
||||||
|
clear_prefs |= MIDORI_CLEAR_FLASH_COOKIES;
|
||||||
}
|
}
|
||||||
button = g_object_get_data (G_OBJECT (dialog), "website-icons");
|
button = g_object_get_data (G_OBJECT (dialog), "website-icons");
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
|
@ -3485,6 +3506,7 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
||||||
PACKAGE_NAME, "icons", NULL);
|
PACKAGE_NAME, "icons", NULL);
|
||||||
sokoke_remove_path (cache, TRUE);
|
sokoke_remove_path (cache, TRUE);
|
||||||
g_free (cache);
|
g_free (cache);
|
||||||
|
clear_prefs |= MIDORI_CLEAR_WEBSITE_ICONS;
|
||||||
}
|
}
|
||||||
button = g_object_get_data (G_OBJECT (dialog), "trash");
|
button = g_object_get_data (G_OBJECT (dialog), "trash");
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
|
@ -3494,7 +3516,11 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
||||||
katze_array_clear (browser->trash);
|
katze_array_clear (browser->trash);
|
||||||
_midori_browser_update_actions (browser);
|
_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)
|
if (response_id != GTK_RESPONSE_DELETE_EVENT)
|
||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
|
@ -3520,6 +3546,9 @@ _action_clear_private_data_activate (GtkAction* action,
|
||||||
GtkWidget* label;
|
GtkWidget* label;
|
||||||
GtkWidget* button;
|
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"),
|
dialog = gtk_dialog_new_with_buttons (_("Clear Private Data"),
|
||||||
GTK_WINDOW (browser), GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_WINDOW (browser), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
@ -3545,19 +3574,29 @@ _action_clear_private_data_activate (GtkAction* action,
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
|
||||||
vbox = gtk_vbox_new (TRUE, 4);
|
vbox = gtk_vbox_new (TRUE, 4);
|
||||||
button = gtk_check_button_new_with_mnemonic (_("History"));
|
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);
|
g_object_set_data (G_OBJECT (dialog), "history", button);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||||
button = gtk_check_button_new_with_mnemonic (_("Cookies"));
|
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);
|
g_object_set_data (G_OBJECT (dialog), "cookies", button);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||||
button = gtk_check_button_new_with_mnemonic (_("'Flash' Cookies"));
|
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);
|
g_object_set_data (G_OBJECT (dialog), "flash-cookies", button);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||||
button = gtk_check_button_new_with_mnemonic (_("Website icons"));
|
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);
|
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 (vbox), button, TRUE, TRUE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, 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"));
|
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);
|
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 (vbox), button, TRUE, TRUE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 8);
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 8);
|
||||||
|
|
|
@ -84,6 +84,8 @@ struct _MidoriWebSettings
|
||||||
MidoriIdentity identify_as;
|
MidoriIdentity identify_as;
|
||||||
gchar* ident_string;
|
gchar* ident_string;
|
||||||
gint cache_size;
|
gint cache_size;
|
||||||
|
|
||||||
|
gint clear_private_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MidoriWebSettingsClass
|
struct _MidoriWebSettingsClass
|
||||||
|
@ -156,7 +158,9 @@ enum
|
||||||
PROP_AUTO_DETECT_PROXY,
|
PROP_AUTO_DETECT_PROXY,
|
||||||
PROP_IDENTIFY_AS,
|
PROP_IDENTIFY_AS,
|
||||||
PROP_IDENT_STRING,
|
PROP_IDENT_STRING,
|
||||||
PROP_CACHE_SIZE
|
PROP_CACHE_SIZE,
|
||||||
|
|
||||||
|
PROP_CLEAR_PRIVATE_DATA
|
||||||
};
|
};
|
||||||
|
|
||||||
GType
|
GType
|
||||||
|
@ -947,6 +951,23 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
||||||
_("The allowed size of the cache"),
|
_("The allowed size of the cache"),
|
||||||
0, G_MAXINT, 100,
|
0, G_MAXINT, 100,
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
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
|
static void
|
||||||
|
@ -1280,6 +1301,9 @@ midori_web_settings_set_property (GObject* object,
|
||||||
case PROP_CACHE_SIZE:
|
case PROP_CACHE_SIZE:
|
||||||
web_settings->cache_size = g_value_get_int (value);
|
web_settings->cache_size = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_CLEAR_PRIVATE_DATA:
|
||||||
|
web_settings->clear_private_data = g_value_get_int (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -1467,6 +1491,9 @@ midori_web_settings_get_property (GObject* object,
|
||||||
case PROP_CACHE_SIZE:
|
case PROP_CACHE_SIZE:
|
||||||
g_value_set_int (value, web_settings->cache_size);
|
g_value_set_int (value, web_settings->cache_size);
|
||||||
break;
|
break;
|
||||||
|
case PROP_CLEAR_PRIVATE_DATA:
|
||||||
|
g_value_set_int (value, web_settings->clear_private_data);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue