aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r--src/ephy-shell.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 4fc7e26f3..1fa250e66 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -31,6 +31,7 @@
#include "ephy-file-helpers.h"
#include "ephy-thread-helpers.h"
#include "ephy-bookmarks-import.h"
+#include "ephy-bookmarks-editor.h"
#include "ephy-debug.h"
#include "toolbar.h"
@@ -56,6 +57,7 @@ struct EphyShellPrivate
Session *session;
EphyAutocompletion *autocompletion;
EphyBookmarks *bookmarks;
+ GtkWidget *bme;
};
enum
@@ -257,6 +259,7 @@ ephy_shell_init (EphyShell *gs)
gs->priv = g_new0 (EphyShellPrivate, 1);
gs->priv->session = NULL;
gs->priv->bookmarks = NULL;
+ gs->priv->bme = NULL;
ephy_shell = gs;
g_object_add_weak_pointer (G_OBJECT(ephy_shell),
@@ -315,6 +318,12 @@ ephy_shell_finalize (GObject *object)
g_object_unref (gs->priv->autocompletion);
}
+ LOG ("Unref Bookmarks Editor");
+ if (gs->priv->bme)
+ {
+ gtk_widget_destroy (GTK_WIDGET (gs->priv->bme));
+ }
+
LOG ("Unref bookmarks")
if (gs->priv->bookmarks)
{
@@ -614,3 +623,34 @@ ephy_shell_get_bookmarks (EphyShell *gs)
return gs->priv->bookmarks;
}
+
+static void
+bookmarks_hide_cb (GtkWidget *widget, gpointer data)
+{
+ LOG ("Unref shell for bookmarks editor")
+ g_object_unref (ephy_shell);
+}
+
+void
+ephy_shell_show_bookmarks_editor (EphyShell *gs)
+{
+ EphyBookmarks *bookmarks;
+
+ if (gs->priv->bme == NULL)
+ {
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ g_assert (bookmarks != NULL);
+ gs->priv->bme = ephy_bookmarks_editor_new (bookmarks);
+ g_signal_connect (gs->priv->bme, "hide",
+ G_CALLBACK (bookmarks_hide_cb), NULL);
+ }
+
+ if (!GTK_WIDGET_VISIBLE (gs->priv->bme))
+ {
+ LOG ("Ref shell for bookmarks editor")
+ g_object_ref (ephy_shell);
+ }
+
+ gtk_window_present (GTK_WINDOW (gs->priv->bme));
+}
+