aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-03-23 07:59:04 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-03-23 07:59:04 +0800
commit1cbf7f5f14b162826d5c016d836d8c2243986f58 (patch)
tree8342dd600cf3714ce92d0f1115914bfd23576955
parent63135332334125311908d415423cd15602cd6535 (diff)
downloadgsoc2013-epiphany-1cbf7f5f14b162826d5c016d836d8c2243986f58.tar
gsoc2013-epiphany-1cbf7f5f14b162826d5c016d836d8c2243986f58.tar.gz
gsoc2013-epiphany-1cbf7f5f14b162826d5c016d836d8c2243986f58.tar.bz2
gsoc2013-epiphany-1cbf7f5f14b162826d5c016d836d8c2243986f58.tar.lz
gsoc2013-epiphany-1cbf7f5f14b162826d5c016d836d8c2243986f58.tar.xz
gsoc2013-epiphany-1cbf7f5f14b162826d5c016d836d8c2243986f58.tar.zst
gsoc2013-epiphany-1cbf7f5f14b162826d5c016d836d8c2243986f58.zip
Never destroy but hide the bme. Present the window on activate. Allow to
2003-03-23 Marco Pesenti Gritti <marco@it.gnome.org> * src/bookmarks/ephy-bookmarks-editor.c: (get_target_window), (cmd_open_bookmarks_in_tabs), (cmd_open_bookmarks_in_browser), (ephy_bookmarks_editor_finalize), (ephy_bookmarks_editor_node_activated_cb), (delete_event_cb), (ephy_bookmarks_editor_construct), (ephy_bookmarks_editor_set_parent), (ephy_bookmarks_editor_new): * src/bookmarks/ephy-bookmarks-editor.h: * src/window-commands.c: (window_cmd_go_bookmarks): Never destroy but hide the bme. Present the window on activate. Allow to put the editor in the background. Smarter way to choose the window where to load the bookmark.
-rw-r--r--ChangeLog16
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c66
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.h6
-rw-r--r--src/window-commands.c16
4 files changed, 87 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c2e1c2ed..6ca5af846 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-03-23 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c: (get_target_window),
+ (cmd_open_bookmarks_in_tabs), (cmd_open_bookmarks_in_browser),
+ (ephy_bookmarks_editor_finalize),
+ (ephy_bookmarks_editor_node_activated_cb), (delete_event_cb),
+ (ephy_bookmarks_editor_construct),
+ (ephy_bookmarks_editor_set_parent), (ephy_bookmarks_editor_new):
+ * src/bookmarks/ephy-bookmarks-editor.h:
+ * src/window-commands.c: (window_cmd_go_bookmarks):
+
+ Never destroy but hide the bme.
+ Present the window on activate.
+ Allow to put the editor in the background.
+ Smarter way to choose the window where to load the bookmark.
+
2003-03-22 Marco Pesenti Gritti <marco@it.gnome.org>
* data/ui/epiphany-bookmark-editor-ui.xml.in:
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index bb27fa619..7383b2477 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -76,6 +76,7 @@ struct EphyBookmarksEditorPrivate
EphyNodeFilter *bookmarks_filter;
GtkWidget *search_entry;
GtkWidget *menu_dock;
+ GtkWidget *window;
EggMenuMerge *ui_merge;
EggActionGroup *action_group;
};
@@ -140,6 +141,19 @@ cmd_rename_bookmark (EggAction *action,
{
}
+static GtkWidget *
+get_target_window (EphyBookmarksEditor *editor)
+{
+ if (editor->priv->window)
+ {
+ return editor->priv->window;
+ }
+ else
+ {
+ return GTK_WIDGET (ephy_shell_get_active_window (ephy_shell));
+ }
+}
+
static void
cmd_open_bookmarks_in_tabs (EggAction *action,
EphyBookmarksEditor *editor)
@@ -148,7 +162,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action,
GList *selection;
GList *l;
- window = EPHY_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (editor)));
+ window = EPHY_WINDOW (get_target_window (editor));
selection = ephy_node_view_get_selection (editor->priv->bm_view);
for (l = selection; l; l = l->next)
@@ -177,7 +191,7 @@ cmd_open_bookmarks_in_browser (EggAction *action,
GList *selection;
GList *l;
- window = EPHY_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (editor)));
+ window = EPHY_WINDOW (get_target_window (editor));
selection = ephy_node_view_get_selection (editor->priv->bm_view);
for (l = selection; l; l = l->next)
@@ -339,6 +353,13 @@ ephy_bookmarks_editor_finalize (GObject *object)
editor->priv->action_group);
g_object_unref (editor->priv->ui_merge);
+ if (editor->priv->window)
+ {
+ g_object_remove_weak_pointer
+ (G_OBJECT(editor->priv->window),
+ (gpointer *)&editor->priv->window);
+ }
+
g_free (editor->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -384,9 +405,10 @@ ephy_bookmarks_editor_node_activated_cb (GtkWidget *view,
(node, EPHY_NODE_BMK_PROP_LOCATION);
g_return_if_fail (location != NULL);
- window = gtk_window_get_transient_for (GTK_WINDOW (editor));
+ window = GTK_WINDOW (get_target_window (editor));
g_return_if_fail (IS_EPHY_WINDOW (window));
ephy_window_load_url (EPHY_WINDOW (window), location);
+ gtk_window_present (GTK_WINDOW (window));
}
static void
@@ -485,6 +507,14 @@ add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyBookmarksEditor *editor)
gtk_widget_show (widget);
}
+static gboolean
+delete_event_cb (EphyBookmarksEditor *editor)
+{
+ gtk_widget_hide (GTK_WIDGET (editor));
+
+ return TRUE;
+}
+
static void
ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
{
@@ -498,6 +528,9 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
EggActionGroup *action_group;
int i;
+ g_signal_connect (editor, "delete_event",
+ G_CALLBACK (delete_event_cb), NULL);
+
for (i = 0; i < ephy_bookmark_popup_n_entries; i++)
{
ephy_bookmark_popup_entries[i].user_data = editor;
@@ -600,9 +633,27 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
g_free (selected_id_str);
}
+void
+ephy_bookmarks_editor_set_parent (EphyBookmarksEditor *ebe,
+ GtkWidget *window)
+{
+ if (ebe->priv->window)
+ {
+ g_object_remove_weak_pointer
+ (G_OBJECT(ebe->priv->window),
+ (gpointer *)&ebe->priv->window);
+ }
+
+ ebe->priv->window = window;
+
+ g_object_add_weak_pointer
+ (G_OBJECT(ebe->priv->window),
+ (gpointer *)&ebe->priv->window);
+
+}
+
GtkWidget *
-ephy_bookmarks_editor_new (EphyBookmarks *bookmarks,
- GtkWindow *parent)
+ephy_bookmarks_editor_new (EphyBookmarks *bookmarks)
{
EphyBookmarksEditor *editor;
@@ -613,11 +664,6 @@ ephy_bookmarks_editor_new (EphyBookmarks *bookmarks,
"bookmarks", bookmarks,
NULL));
- if (parent)
- {
- gtk_window_set_transient_for (GTK_WINDOW (editor), parent);
- }
-
ephy_bookmarks_editor_construct (editor);
return GTK_WIDGET (editor);
diff --git a/src/bookmarks/ephy-bookmarks-editor.h b/src/bookmarks/ephy-bookmarks-editor.h
index cb2eeea59..69b671874 100644
--- a/src/bookmarks/ephy-bookmarks-editor.h
+++ b/src/bookmarks/ephy-bookmarks-editor.h
@@ -51,8 +51,10 @@ typedef struct
GType ephy_bookmarks_editor_get_type (void);
-GtkWidget *ephy_bookmarks_editor_new (EphyBookmarks *bookmarks,
- GtkWindow *parent);
+GtkWidget *ephy_bookmarks_editor_new (EphyBookmarks *bookmarks);
+
+void ephy_bookmarks_editor_set_parent (EphyBookmarksEditor *ebe,
+ GtkWidget *window);
G_END_DECLS
diff --git a/src/window-commands.c b/src/window-commands.c
index bc793234d..c64761092 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -236,13 +236,19 @@ void
window_cmd_go_bookmarks (EggAction *action,
EphyWindow *window)
{
- GtkWidget *dialog;
+ static GtkWidget *dialog = NULL;
EphyBookmarks *bookmarks;
- bookmarks = ephy_shell_get_bookmarks (ephy_shell);
- g_assert (bookmarks != NULL);
- dialog = ephy_bookmarks_editor_new (bookmarks, GTK_WINDOW (window));
- gtk_widget_show (dialog);
+ if (dialog == NULL)
+ {
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ g_assert (bookmarks != NULL);
+ dialog = ephy_bookmarks_editor_new (bookmarks);
+ }
+
+ ephy_bookmarks_editor_set_parent (EPHY_BOOKMARKS_EDITOR (dialog),
+ GTK_WIDGET (window));
+ gtk_window_present (GTK_WINDOW (dialog));
}
void