From d72579711c5a0104e3d6e29ea79dd52738aad57a Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 13 Oct 2008 18:29:46 +0200 Subject: [PATCH] Implement the Remeber last visited pages preference --- midori/midori-browser.c | 16 ++++++++++++---- midori/midori-locationaction.c | 5 ++--- midori/midori-locationaction.h | 19 ++++++++++++------- midori/midori-preferences.c | 12 ++++++------ midori/midori-websettings.c | 2 +- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 29c5adaf..c19afc5a 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -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); diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index 75feb5ac..b5294388 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -13,10 +13,8 @@ #include "gtkiconentry.h" -#include #include #include -#include 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); diff --git a/midori/midori-locationaction.h b/midori/midori-locationaction.h index c6d1e2cd..837527d7 100644 --- a/midori/midori-locationaction.h +++ b/midori/midori-locationaction.h @@ -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); diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index 702962e7..c0a84f9c 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -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), diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index eca36ff8..0c91990c 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -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, -- 2.39.5