aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-editor.c
diff options
context:
space:
mode:
authorJames Willcox <jwillcox@gnome.org>2003-02-07 06:32:01 +0800
committerJames Willcox <jwillcox@src.gnome.org>2003-02-07 06:32:01 +0800
commit1d8988f4d183bc8481a1ed6d10ca8d0d976266bd (patch)
treee4850771f04f625d7f9f973bb1e2186c60277609 /src/bookmarks/ephy-bookmarks-editor.c
parentcf749bea95aaede12db0475b9205f79fdc227765 (diff)
downloadgsoc2013-epiphany-1d8988f4d183bc8481a1ed6d10ca8d0d976266bd.tar
gsoc2013-epiphany-1d8988f4d183bc8481a1ed6d10ca8d0d976266bd.tar.gz
gsoc2013-epiphany-1d8988f4d183bc8481a1ed6d10ca8d0d976266bd.tar.bz2
gsoc2013-epiphany-1d8988f4d183bc8481a1ed6d10ca8d0d976266bd.tar.lz
gsoc2013-epiphany-1d8988f4d183bc8481a1ed6d10ca8d0d976266bd.tar.xz
gsoc2013-epiphany-1d8988f4d183bc8481a1ed6d10ca8d0d976266bd.tar.zst
gsoc2013-epiphany-1d8988f4d183bc8481a1ed6d10ca8d0d976266bd.zip
Make the bookmarks editor remember the last selected keyword, and make
2003-02-06 James Willcox <jwillcox@gnome.org> * data/epiphany.schemas.in: * lib/ephy-prefs.h: * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_class_init), (ephy_bookmarks_editor_dispose), (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-node-view.c: (ephy_node_view_select_node): * src/ephy-main.c: (ephy_main_start): Make the bookmarks editor remember the last selected keyword, and make startup-notification not hang when using the existing instance.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 9cfe42dea..22d6452a4 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -31,10 +31,13 @@
#include "ephy-window.h"
#include "ephy-keywords-entry.h"
#include "ephy-dnd.h"
+#include "ephy-prefs.h"
+#include "eel-gconf-extensions.h"
static void ephy_bookmarks_editor_class_init (EphyBookmarksEditorClass *klass);
static void ephy_bookmarks_editor_init (EphyBookmarksEditor *editor);
static void ephy_bookmarks_editor_finalize (GObject *object);
+static void ephy_bookmarks_editor_dispose (GObject *object);
static void ephy_bookmarks_editor_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -104,6 +107,7 @@ ephy_bookmarks_editor_class_init (EphyBookmarksEditorClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = ephy_bookmarks_editor_finalize;
+ object_class->dispose = ephy_bookmarks_editor_dispose;
object_class->set_property = ephy_bookmarks_editor_set_property;
object_class->get_property = ephy_bookmarks_editor_get_property;
@@ -118,6 +122,41 @@ ephy_bookmarks_editor_class_init (EphyBookmarksEditorClass *klass)
}
static void
+ephy_bookmarks_editor_dispose (GObject *object)
+{
+ EphyBookmarksEditor *editor;
+ long selected_id;
+ char *selected_id_str;
+ GList *selection;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (EPHY_IS_BOOKMARKS_EDITOR (object));
+
+ editor = EPHY_BOOKMARKS_EDITOR (object);
+
+ g_return_if_fail (editor->priv != NULL);
+
+ if (editor->priv->key_view != NULL)
+ {
+ selection = ephy_node_view_get_selection (editor->priv->key_view);
+ selected_id = ephy_node_get_id (EPHY_NODE (selection->data));
+ if (selected_id > 0)
+ {
+ selected_id_str = g_strdup_printf ("%ld", selected_id);
+ eel_gconf_set_string (CONF_BOOKMARKS_SELECTED_NODE,
+ selected_id_str);
+ g_free (selected_id_str);
+ }
+
+ g_list_free (selection);
+
+ editor->priv->key_view = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
ephy_bookmarks_editor_finalize (GObject *object)
{
EphyBookmarksEditor *editor;
@@ -398,6 +437,9 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
GtkWidget *hbox, *vbox;
EphyNodeView *bm_view, *key_view;
EphyNode *node;
+ long selected_id;
+ EphyNode *selected_node;
+ char *selected_id_str;
gtk_dialog_set_has_separator (GTK_DIALOG (editor), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (editor), 6);
@@ -472,6 +514,22 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_dialog_set_default_response (GTK_DIALOG (editor), GTK_RESPONSE_CLOSE);
gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks"));
+
+ selected_id_str = eel_gconf_get_string (CONF_BOOKMARKS_SELECTED_NODE);
+ selected_id = g_ascii_strtoull (selected_id_str, NULL, 10);
+ if (selected_id <= 0)
+ {
+ g_free (selected_id_str);
+ return;
+ }
+
+ selected_node = ephy_node_get_from_id (selected_id);
+ if (selected_node != NULL)
+ {
+ ephy_node_view_select_node (key_view, selected_node);
+ }
+
+ g_free (selected_id_str);
}
GtkWidget *