aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-30 03:08:25 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-30 03:08:25 +0800
commitb4df6c7d7c84610ecb9808103f7e411d75dfbae2 (patch)
treed3b4707e9e730034e26429a314c6916281a39e9a
parentdb1b85b940e4ea707c0fadda76ba79ddec8f697b (diff)
downloadgsoc2013-epiphany-b4df6c7d7c84610ecb9808103f7e411d75dfbae2.tar
gsoc2013-epiphany-b4df6c7d7c84610ecb9808103f7e411d75dfbae2.tar.gz
gsoc2013-epiphany-b4df6c7d7c84610ecb9808103f7e411d75dfbae2.tar.bz2
gsoc2013-epiphany-b4df6c7d7c84610ecb9808103f7e411d75dfbae2.tar.lz
gsoc2013-epiphany-b4df6c7d7c84610ecb9808103f7e411d75dfbae2.tar.xz
gsoc2013-epiphany-b4df6c7d7c84610ecb9808103f7e411d75dfbae2.tar.zst
gsoc2013-epiphany-b4df6c7d7c84610ecb9808103f7e411d75dfbae2.zip
We dont need a _remove api, unrefing the node will work better. Try to
2003-04-29 Marco Pesenti Gritti <marco@it.gnome.org> * embed/ephy-history.c: (remove_obsolete_pages), (pages_removed_cb), (ephy_history_get_last_page): * embed/ephy-history.h: We dont need a _remove api, unrefing the node will work better. Try to remove the host when it's empty. It still doesnt work properly, prolly EphyNode bug. * src/bookmarks/ephy-bookmark-properties.c: (ephy_bookmark_properties_get_node): * src/bookmarks/ephy-bookmark-properties.h: * src/bookmarks/ephy-bookmarks-editor.c: (prop_dialog_destroy_cb), (show_properties_dialog), (cmd_bookmark_properties), (ephy_bookmarks_editor_finalize), (ephy_bookmarks_editor_init): Do not open more than one dialog per node, just present it. Picky picky Dave. * src/ephy-automation.c: (impl_ephy_automation_loadurl): * src/ephy-shell.c: (ephy_shell_new_tab): Ever present the window when opening windows through automation.
-rw-r--r--ChangeLog26
-rw-r--r--embed/ephy-history.c48
-rw-r--r--embed/ephy-history.h3
-rw-r--r--src/bookmarks/ephy-bookmark-properties.c7
-rw-r--r--src/bookmarks/ephy-bookmark-properties.h2
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c37
-rw-r--r--src/ephy-automation.c6
-rw-r--r--src/ephy-shell.c12
8 files changed, 99 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 2598e1220..9b3ee785a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2003-04-29 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/ephy-history.c: (remove_obsolete_pages),
+ (pages_removed_cb), (ephy_history_get_last_page):
+ * embed/ephy-history.h:
+
+ We dont need a _remove api, unrefing the node will work
+ better.
+ Try to remove the host when it's empty. It still doesnt work
+ properly, prolly EphyNode bug.
+
+ * src/bookmarks/ephy-bookmark-properties.c:
+ (ephy_bookmark_properties_get_node):
+ * src/bookmarks/ephy-bookmark-properties.h:
+ * src/bookmarks/ephy-bookmarks-editor.c: (prop_dialog_destroy_cb),
+ (show_properties_dialog), (cmd_bookmark_properties),
+ (ephy_bookmarks_editor_finalize), (ephy_bookmarks_editor_init):
+
+ Do not open more than one dialog per node, just present it.
+ Picky picky Dave.
+
+ * src/ephy-automation.c: (impl_ephy_automation_loadurl):
+ * src/ephy-shell.c: (ephy_shell_new_tab):
+
+ Ever present the window when opening windows through automation.
+
2003-04-29 Christian Persch <chpe+gnomebugz@stud.uni-saarland.de>
* lib/ephy-dnd.c: (ephy_dnd_drag_data_get),
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 51dd68936..4c5cf6cbe 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -258,7 +258,7 @@ remove_obsolete_pages (EphyHistory *eb)
if (page_is_obsolete (kid, &current_date))
{
- ephy_history_remove (eb, kid);
+ ephy_node_unref (kid);
}
}
}
@@ -354,12 +354,27 @@ pages_removed_cb (EphyNode *node,
EphyNode *child,
EphyHistory *eb)
{
+ EphyNode *host;
+ int host_id;
+ int children;
+
g_static_rw_lock_writer_lock (eb->priv->pages_hash_lock);
g_hash_table_remove (eb->priv->pages_hash,
ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION));
g_static_rw_lock_writer_unlock (eb->priv->pages_hash_lock);
+
+ host_id = ephy_node_get_property_int (child, EPHY_NODE_PAGE_PROP_HOST_ID);
+ host = ephy_node_get_from_id (host_id);
+ children = ephy_node_get_n_children (host);
+
+ LOG ("Check host children: %d", children)
+
+ if (children == 0)
+ {
+ ephy_node_unref (host);
+ }
}
static gboolean
@@ -835,34 +850,3 @@ ephy_history_get_last_page (EphyHistory *gh)
return ephy_node_get_property_string
(gh->priv->last_page, EPHY_NODE_PAGE_PROP_LOCATION);
}
-
-void
-ephy_history_remove (EphyHistory *gh, EphyNode *node)
-{
- EphyNode *host;
- int host_id;
-
- LOG ("Remove history item")
-
- host_id = ephy_node_get_property_int (node, EPHY_NODE_PAGE_PROP_HOST_ID);
- if (host_id < 0)
- {
- EphyNode *tmp;
- while ((tmp = ephy_node_get_nth_child (node, 0)) != NULL)
- {
- ephy_node_unref (tmp);
- }
- ephy_node_unref (node);
- return;
- }
-
- host = ephy_node_get_from_id (host_id);
- if (ephy_node_get_n_children (host) == 1)
- {
- ephy_node_unref (host);
- }
- else
- {
- ephy_node_unref (node);
- }
-}
diff --git a/embed/ephy-history.h b/embed/ephy-history.h
index 4308e7adc..7d1d66ee4 100644
--- a/embed/ephy-history.h
+++ b/embed/ephy-history.h
@@ -91,9 +91,6 @@ void ephy_history_set_icon (EphyHistory *gh,
const char *url,
const char *icon);
-void ephy_history_remove (EphyHistory *gh,
- EphyNode *node);
-
void ephy_history_clear (EphyHistory *gh);
G_END_DECLS
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c
index a82a5e727..38bcbe96f 100644
--- a/src/bookmarks/ephy-bookmark-properties.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -458,3 +458,10 @@ ephy_bookmark_properties_new (EphyBookmarks *bookmarks,
}
return GTK_WIDGET (editor);
}
+
+EphyNode *
+ephy_bookmark_properties_get_node (EphyBookmarkProperties *properties)
+{
+ return properties->priv->bookmark;
+}
+
diff --git a/src/bookmarks/ephy-bookmark-properties.h b/src/bookmarks/ephy-bookmark-properties.h
index cd7c23a2f..fad54df5b 100644
--- a/src/bookmarks/ephy-bookmark-properties.h
+++ b/src/bookmarks/ephy-bookmark-properties.h
@@ -54,6 +54,8 @@ GtkWidget *ephy_bookmark_properties_new (EphyBookmarks *bookmark
EphyNode *bookmark,
GtkWindow *parent_window);
+EphyNode *ephy_bookmark_properties_get_node (EphyBookmarkProperties *properties);
+
G_END_DECLS
#endif /* EPHY_BOOKMARK_PROPERTIES_H */
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index d314ab660..8747bdcfe 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -126,6 +126,7 @@ struct EphyBookmarksEditorPrivate
EggActionGroup *action_group;
int priority_col;
EphyToolbarsModel *tb_model;
+ GHashTable *props_dialogs;
};
enum
@@ -407,10 +408,37 @@ cmd_delete (EggAction *action,
}
static void
+prop_dialog_destroy_cb (GtkWidget *dialog, EphyBookmarksEditor *editor)
+{
+ EphyNode *node;
+
+ node = ephy_bookmark_properties_get_node (EPHY_BOOKMARK_PROPERTIES (dialog));
+ g_hash_table_remove (editor->priv->props_dialogs, node);
+}
+
+static void
+show_properties_dialog (EphyBookmarksEditor *editor, EphyNode *node)
+{
+ GtkWidget *dialog;
+
+ dialog = g_hash_table_lookup (editor->priv->props_dialogs, node);
+
+ if (!dialog)
+ {
+ dialog = ephy_bookmark_properties_new
+ (editor->priv->bookmarks, node, GTK_WINDOW (editor));
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (prop_dialog_destroy_cb), editor);
+ g_hash_table_insert (editor->priv->props_dialogs, node, dialog);
+ }
+
+ gtk_window_present (GTK_WINDOW (dialog));
+}
+
+static void
cmd_bookmark_properties (EggAction *action,
EphyBookmarksEditor *editor)
{
- GtkWidget *dialog;
GList *selection;
GList *l;
@@ -419,8 +447,7 @@ cmd_bookmark_properties (EggAction *action,
for (l = selection; l; l = l->next)
{
EphyNode *node = EPHY_NODE (l->data);
- dialog = ephy_bookmark_properties_new (editor->priv->bookmarks, node, GTK_WINDOW (editor));
- gtk_widget_show (GTK_WIDGET (dialog));
+ show_properties_dialog (editor, node);
}
g_list_free (selection);
@@ -582,6 +609,8 @@ ephy_bookmarks_editor_finalize (GObject *object)
(gpointer *)&editor->priv->window);
}
+ g_hash_table_destroy (editor->priv->props_dialogs);
+
g_free (editor->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -1348,6 +1377,8 @@ ephy_bookmarks_editor_init (EphyBookmarksEditor *editor)
{
editor->priv = g_new0 (EphyBookmarksEditorPrivate, 1);
+ editor->priv->props_dialogs = g_hash_table_new (g_direct_hash,
+ g_direct_equal);
editor->priv->tb_model = ephy_shell_get_toolbars_model (ephy_shell);
g_signal_connect (editor->priv->tb_model, "item_added",
diff --git a/src/ephy-automation.c b/src/ephy-automation.c
index 166ca245d..93573e924 100644
--- a/src/ephy-automation.c
+++ b/src/ephy-automation.c
@@ -90,7 +90,7 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant,
const CORBA_boolean raise,
CORBA_Environment * ev)
{
- EphyNewTabFlags flags = 0;
+ EphyNewTabFlags flags;
const char *load_page = NULL;
EphyWindow *window;
Session *session;
@@ -115,9 +115,11 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant,
return;
}
+ flags = EPHY_NEW_TAB_RAISE_WINDOW;
+
if (*url == '\0')
{
- flags = EPHY_NEW_TAB_HOMEPAGE;
+ flags |= EPHY_NEW_TAB_HOMEPAGE;
}
else
{
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 04ac7eb6e..51b53c7d6 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -521,14 +521,22 @@ ephy_shell_new_tab (EphyShell *shell,
{
grouped = TRUE;
}
-
+
tab = ephy_tab_new ();
embed = ephy_tab_get_embed (tab);
gtk_widget_show (GTK_WIDGET(embed));
ephy_window_add_tab (window, tab,
grouped,
jump_to);
- gtk_widget_show (GTK_WIDGET(window));
+
+ if (flags & EPHY_NEW_TAB_RAISE_WINDOW)
+ {
+ gtk_window_present (GTK_WINDOW(window));
+ }
+ else
+ {
+ gtk_widget_show (GTK_WIDGET(window));
+ }
if (flags & EPHY_NEW_TAB_HOMEPAGE)
{