Implement the Remeber last visited pages preference

This commit is contained in:
Christian Dywan 2008-10-13 18:29:46 +02:00
parent 68cf3388f6
commit d72579711c
5 changed files with 33 additions and 21 deletions

View file

@ -361,7 +361,8 @@ midori_view_notify_icon_cb (MidoriView* view,
uri = midori_view_get_display_uri (MIDORI_VIEW (view));
action = _action_by_name (browser, "Location");
midori_location_action_set_icon_for_uri (
if (sokoke_object_get_boolean (browser->settings, "remember-last-visited-pages"))
midori_location_action_set_icon_for_uri (
MIDORI_LOCATION_ACTION (action), midori_view_get_icon (view), uri);
}
@ -378,8 +379,11 @@ midori_view_notify_load_status_cb (GtkWidget* view,
if (midori_view_get_load_status (MIDORI_VIEW (view))
== MIDORI_LOAD_COMMITTED)
midori_location_action_add_uri (
MIDORI_LOCATION_ACTION (action), uri);
{
if (sokoke_object_get_boolean (browser->settings,
"remember-last-visited-pages"))
midori_location_action_add_uri (MIDORI_LOCATION_ACTION (action), uri);
}
else if (midori_view_get_load_status (MIDORI_VIEW (view))
== MIDORI_LOAD_FINISHED)
{
@ -441,7 +445,8 @@ midori_view_notify_title_cb (GtkWidget* view,
uri = midori_view_get_display_uri (MIDORI_VIEW (view));
title = midori_view_get_display_title (MIDORI_VIEW (view));
action = _action_by_name (browser, "Location");
midori_location_action_set_title_for_uri (
if (sokoke_object_get_boolean (browser->settings, "remember-last-visited-pages"))
midori_location_action_set_title_for_uri (
MIDORI_LOCATION_ACTION (action), title, uri);
if (midori_view_get_load_status (MIDORI_VIEW (view)) == MIDORI_LOAD_COMMITTED)
{
@ -4053,6 +4058,9 @@ midori_browser_new_history_item (MidoriBrowser* browser,
gchar *today;
gsize len;
if (!sokoke_object_get_boolean (browser->settings, "remember-last-visited-pages"))
return;
treeview = GTK_TREE_VIEW (browser->panel_history);
treemodel = gtk_tree_view_get_model (treeview);

View file

@ -13,10 +13,8 @@
#include "gtkiconentry.h"
#include <katze/katze.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
struct _MidoriLocationAction
{
@ -289,7 +287,7 @@ midori_location_action_create_tool_item (GtkAction* action)
gtk_container_add (GTK_CONTAINER (toolitem), alignment);
gtk_widget_show (alignment);
return GTK_WIDGET (toolitem);
return toolitem;
}
static void
@ -387,6 +385,7 @@ static void
midori_location_action_disconnect_proxy (GtkAction* action,
GtkWidget* proxy)
{
/* FIXME: This is wrong */
g_signal_handlers_disconnect_by_func (proxy,
G_CALLBACK (gtk_action_activate), action);

View file

@ -18,16 +18,21 @@
G_BEGIN_DECLS
#define MIDORI_TYPE_LOCATION_ACTION (midori_location_action_get_type ())
#define MIDORI_LOCATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_LOCATION_ACTION, MidoriLocationAction))
#define MIDORI_LOCATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_LOCATION_ACTION, MidoriLocationActionClass))
#define MIDORI_IS_LOCATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_LOCATION_ACTION))
#define MIDORI_IS_LOCATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_LOCATION_ACTION))
#define MIDORI_LOCATION_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_LOCATION_ACTION, MidoriLocationActionClass))
#define MIDORI_TYPE_LOCATION_ACTION \
(midori_location_action_get_type ())
#define MIDORI_LOCATION_ACTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_LOCATION_ACTION, MidoriLocationAction))
#define MIDORI_LOCATION_ACTION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_LOCATION_ACTION, MidoriLocationActionClass))
#define MIDORI_IS_LOCATION_ACTION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_LOCATION_ACTION))
#define MIDORI_IS_LOCATION_ACTION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_LOCATION_ACTION))
#define MIDORI_LOCATION_ACTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_LOCATION_ACTION, MidoriLocationActionClass))
typedef struct _MidoriLocationAction MidoriLocationAction;
typedef struct _MidoriLocationActionClass MidoriLocationActionClass;
typedef struct _MidoriLocationActionItem MidoriLocationActionItem;
GType
midori_location_action_get_type (void);

View file

@ -366,7 +366,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
WIDGET_ADD (button, 1, 2, 2, 3);
/* Page "Network" */
PAGE_NEW (_("Network"));
/*PAGE_NEW (_("Network"));
FRAME_NEW (_("Network"));
TABLE_NEW (2, 2);
label = katze_property_label (settings, "http-proxy");
@ -380,11 +380,11 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("MB")),
FALSE, FALSE, 0);
FILLED_ADD (hbox, 1, 2, 1, 2);
FILLED_ADD (hbox, 1, 2, 1, 2);*/
/* Page "Privacy" */
/* PAGE_NEW (_("Privacy"));
FRAME_NEW (_("Web Cookies"));
PAGE_NEW (_("Privacy"));
/*FRAME_NEW (_("Web Cookies"));
TABLE_NEW (3, 2);
label = katze_property_label (settings, "accept-cookies");
INDENTED_ADD (label, 0, 1, 0, 1);
@ -399,7 +399,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("days")),
FALSE, FALSE, 0);
FILLED_ADD (hbox, 1, 2, 2, 3);
FILLED_ADD (hbox, 1, 2, 2, 3);*/
FRAME_NEW (_("History"));
TABLE_NEW (3, 2);
button = katze_property_proxy (settings, "remember-last-visited-pages", NULL);
@ -413,7 +413,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
button = katze_property_proxy (settings, "remember-last-form-inputs", NULL);
SPANNED_ADD (button, 0, 2, 1, 2);
button = katze_property_proxy (settings, "remember-last-downloaded-files", NULL);
SPANNED_ADD (button, 0, 2, 2, 3); */
SPANNED_ADD (button, 0, 2, 2, 3);
g_object_unref (sizegroup);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (preferences)->vbox),

View file

@ -566,7 +566,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Remember last visited pages"),
_("Whether the last visited pages are saved"),
TRUE,
G_PARAM_READABLE));
flags));
g_object_class_install_property (gobject_class,
PROP_MAXIMUM_HISTORY_AGE,