diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-06-04 23:27:13 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-04 23:27:13 +0800 |
commit | 96b34afe3a6bffb9cb7a6671403de31644688cce (patch) | |
tree | 19394a0f2cbac65bfb8d8da8544199f3604fcec8 | |
parent | 29bbfe00469fe536bbf0f1025cde834cec3bec0b (diff) | |
download | gsoc2013-epiphany-96b34afe3a6bffb9cb7a6671403de31644688cce.tar.gz gsoc2013-epiphany-96b34afe3a6bffb9cb7a6671403de31644688cce.tar.zst gsoc2013-epiphany-96b34afe3a6bffb9cb7a6671403de31644688cce.zip |
Make sure to rebuild on add bookmark and on topic removal. Update on idle,
2003-06-04 Marco Pesenti Gritti <marco@it.gnome.org>
* src/bookmarks/ephy-bookmarks-menu.c:
(ephy_bookmarks_menu_rebuild), (do_updates),
(bookmarks_tree_changed_cb), (ephy_bookmarks_menu_init):
* src/bookmarks/ephy-bookmarks.c: (bookmarks_changed_cb),
(topics_removed_cb), (ephy_bookmarks_add):
Make sure to rebuild on add bookmark and on topic removal.
Update on idle, so things like importing bookmarks doesnt
take two days.
* src/ephy-notebook.c: (notebook_drag_data_received_cb):
* src/ephy-shell.c: (ephy_init_services), (load_homepage),
(ephy_shell_new_tab):
* src/ephy-shell.h:
* src/ephy-window.c: (setup_window):
* src/session.c: (parse_embed):
Drop NOT_JUMP_TO flag, we dont have a pref anymore.
On new page instead of really clone the page, just clone
the url (put it in the address entry). So if the user need it
it's easy to load, but there are not the inacceptable slow
downs of real cloning. Let's see how this works ...
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-menu.c | 22 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 4 | ||||
-rw-r--r-- | src/ephy-notebook.c | 3 | ||||
-rw-r--r-- | src/ephy-shell.c | 95 | ||||
-rw-r--r-- | src/ephy-shell.h | 5 | ||||
-rw-r--r-- | src/ephy-window.c | 2 | ||||
-rw-r--r-- | src/session.c | 1 |
8 files changed, 77 insertions, 81 deletions
@@ -1,5 +1,31 @@ 2003-06-04 Marco Pesenti Gritti <marco@it.gnome.org> + * src/bookmarks/ephy-bookmarks-menu.c: + (ephy_bookmarks_menu_rebuild), (do_updates), + (bookmarks_tree_changed_cb), (ephy_bookmarks_menu_init): + * src/bookmarks/ephy-bookmarks.c: (bookmarks_changed_cb), + (topics_removed_cb), (ephy_bookmarks_add): + + Make sure to rebuild on add bookmark and on topic removal. + Update on idle, so things like importing bookmarks doesnt + take two days. + + * src/ephy-notebook.c: (notebook_drag_data_received_cb): + * src/ephy-shell.c: (ephy_init_services), (load_homepage), + (ephy_shell_new_tab): + * src/ephy-shell.h: + * src/ephy-window.c: (setup_window): + * src/session.c: (parse_embed): + + Drop NOT_JUMP_TO flag, we dont have a pref anymore. + + On new page instead of really clone the page, just clone + the url (put it in the address entry). So if the user need it + it's easy to load, but there are not the inacceptable slow + downs of real cloning. Let's see how this works ... + +2003-06-04 Marco Pesenti Gritti <marco@it.gnome.org> + * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmark-action.c: (connect_proxy): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_class_init), diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c index 89348a5e8..4182f125e 100644 --- a/src/bookmarks/ephy-bookmarks-menu.c +++ b/src/bookmarks/ephy-bookmarks-menu.c @@ -42,6 +42,7 @@ struct _EphyBookmarksMenuPrivate EphyBookmarks *bookmarks; EggActionGroup *action_group; guint ui_id; + guint update_tag; }; /** @@ -322,7 +323,10 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu) g_free (verb); } - add_bookmarks_menu (menu, not_categorized, xml); + if (ephy_node_get_n_children (not_categorized) > 0) + { + add_bookmarks_menu (menu, not_categorized, xml); + } g_string_append (xml, "</placeholder></submenu></menu></Root>"); @@ -392,10 +396,23 @@ ephy_bookmarks_menu_class_init (EphyBookmarksMenuClass *klass) G_PARAM_READWRITE)); } +static gboolean +do_updates (EphyBookmarksMenu *menu) +{ + ephy_bookmarks_menu_rebuild (menu); + + menu->priv->update_tag = 0; + + return FALSE; +} + static void bookmarks_tree_changed_cb (EphyBookmarks *bookmarks, EphyBookmarksMenu *menu) { - ephy_bookmarks_menu_rebuild (menu); + if (menu->priv->update_tag == 0) + { + menu->priv->update_tag = g_idle_add((GSourceFunc)do_updates, menu); + } } static void @@ -412,6 +429,7 @@ ephy_bookmarks_menu_init (EphyBookmarksMenu *menu) menu->priv->ui_id = -1; menu->priv->action_group = NULL; + menu->priv->update_tag = 0; } static void diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 86a10d457..801aadc87 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -532,7 +532,6 @@ bookmarks_changed_cb (EphyNode *node, EphyBookmarks *eb) { ephy_bookmarks_emit_data_changed (eb); - g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0); } static void @@ -624,6 +623,8 @@ topics_removed_cb (EphyNode *node, g_free (list); } ephy_node_thaw (child); + + g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0); } static void @@ -795,6 +796,7 @@ ephy_bookmarks_add (EphyBookmarks *eb, ephy_node_add_child (eb->priv->notcategorized, bm); ephy_bookmarks_emit_data_changed (eb); + g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0); return bm; } diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c index 4bee3f8e4..e360b8bd9 100644 --- a/src/ephy-notebook.c +++ b/src/ephy-notebook.c @@ -677,8 +677,7 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context, tab, url, EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_EXISTING_WINDOW | - EPHY_NEW_TAB_APPEND_LAST | - EPHY_NEW_TAB_DONT_JUMP_TO); + EPHY_NEW_TAB_APPEND_LAST); } g_free (url); diff --git a/src/ephy-shell.c b/src/ephy-shell.c index fa566acad..a2c374cfa 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -63,12 +63,6 @@ struct EphyShellPrivate GtkWidget *history_window; }; -enum -{ - STARTPAGE_HOME, - STARTPAGE_LAST -}; - static void ephy_shell_class_init (EphyShellClass *klass); static void @@ -360,7 +354,6 @@ ephy_init_services (EphyShell *gs) /* preload the prefs */ /* it also enables notifiers support */ eel_gconf_monitor_add ("/apps/epiphany"); - eel_gconf_monitor_add ("/apps/nautilus/preferences"); eel_gconf_monitor_add ("/system/proxy"); #ifdef ENABLE_NAUTILUS_VIEW @@ -371,58 +364,21 @@ ephy_init_services (EphyShell *gs) } -static char * -build_homepage_url (EphyShell *gs, - EphyEmbed *previous_embed) +static void +load_homepage (EphyEmbed *embed) { - const gchar *last_page_url; - gchar *home_page_url; - gint page_type; - EphyHistory *gh; - char *result = NULL; + char *home; - if (previous_embed == NULL) - { - page_type = STARTPAGE_HOME; - } - else - { - page_type = STARTPAGE_LAST; - } + home = eel_gconf_get_string(CONF_GENERAL_HOMEPAGE); - /* return the appropriate page */ - if (page_type == STARTPAGE_HOME) - { - /* get location of home page */ - home_page_url = eel_gconf_get_string(CONF_GENERAL_HOMEPAGE); - result = home_page_url; - } - else if (page_type == STARTPAGE_LAST) + if (home == NULL) { - if (previous_embed != NULL) - { - ephy_embed_get_location (previous_embed, - TRUE, - &result); - } - - if (result == NULL) - { - /* get location of last page */ - gh = ephy_embed_shell_get_global_history - (EPHY_EMBED_SHELL (gs)); - last_page_url = ephy_history_get_last_page (gh); - result = g_strdup (last_page_url); - } + home = g_strdup ("about:blank"); } - if (result == NULL) - { - /* even in case of error, it's a good default */ - result = g_strdup ("about:blank"); - } + ephy_embed_load_url (embed, home); - return result; + g_free (home); } /** @@ -478,14 +434,14 @@ ephy_shell_new_tab (EphyShell *shell, EphyEmbed *previous_embed = NULL; GtkWidget *nb; gint position; + Toolbar *toolbar; in_new_window = !eel_gconf_get_boolean (CONF_TABS_TABBED); if (flags & EPHY_NEW_TAB_IN_NEW_WINDOW) in_new_window = TRUE; if (flags & EPHY_NEW_TAB_IN_EXISTING_WINDOW) in_new_window = FALSE; - if (flags & EPHY_NEW_TAB_JUMP) jump_to = TRUE; - if (flags & EPHY_NEW_TAB_DONT_JUMP_TO) jump_to = FALSE; + jump_to = (flags & EPHY_NEW_TAB_JUMP); if (!in_new_window && parent_window != NULL) { @@ -496,6 +452,8 @@ ephy_shell_new_tab (EphyShell *shell, window = ephy_window_new (); } + toolbar = ephy_window_get_toolbar (window); + if (previous_tab) { previous_embed = ephy_tab_get_embed (previous_tab); @@ -523,30 +481,23 @@ ephy_shell_new_tab (EphyShell *shell, jump_to); gtk_widget_show (GTK_WIDGET(window)); - if (flags & EPHY_NEW_TAB_HOME_PAGE || - flags & EPHY_NEW_TAB_NEW_PAGE) - { - Toolbar *toolbar; - - toolbar = ephy_window_get_toolbar (window); - toolbar_edit_location (toolbar); - } - if (flags & EPHY_NEW_TAB_HOME_PAGE) { - char *homepage; - - homepage = build_homepage_url (shell, previous_embed); - g_assert (homepage != NULL); - - ephy_embed_load_url (embed, homepage); + toolbar_edit_location (toolbar); - g_free (homepage); + load_homepage (embed); } else if (flags & EPHY_NEW_TAB_NEW_PAGE) { - ephy_embed_load_url (embed, "about:blank"); - ephy_embed_copy_page (embed, previous_embed, DISPLAY_NORMAL); + char *previous_address = NULL; + + g_return_val_if_fail (previous_embed != NULL, NULL); + ephy_embed_get_location (previous_embed, TRUE, + &previous_address); + toolbar_set_location (toolbar, previous_address); + toolbar_edit_location (toolbar); + + load_homepage (embed); } else if (flags & EPHY_NEW_TAB_OPEN_PAGE) { diff --git a/src/ephy-shell.h b/src/ephy-shell.h index e45be6dd8..81518cd7c 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -66,9 +66,8 @@ typedef enum EPHY_NEW_TAB_APPEND_LAST = 1 << 7, EPHY_NEW_TAB_APPEND_AFTER = 1 << 8, EPHY_NEW_TAB_JUMP = 1 << 9, - EPHY_NEW_TAB_DONT_JUMP_TO = 1 << 10, - EPHY_NEW_TAB_IN_NEW_WINDOW = 1 << 11, - EPHY_NEW_TAB_IN_EXISTING_WINDOW = 1 << 12 + EPHY_NEW_TAB_IN_NEW_WINDOW = 1 << 10, + EPHY_NEW_TAB_IN_EXISTING_WINDOW = 1 << 11 } EphyNewTabFlags; struct EphyShell diff --git a/src/ephy-window.c b/src/ephy-window.c index f73606b50..a828b9fc9 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -478,6 +478,8 @@ setup_window (EphyWindow *window) g_object_set (action, "short_label", _("Print"), NULL); action = egg_action_group_get_action (action_group, "FileBookmarkPage"); g_object_set (action, "short_label", _("Bookmark"), NULL); + action = egg_action_group_get_action (action_group, "GoBookmarks"); + g_object_set (action, "short_label", _("Bookmarks"), NULL); action_group = egg_action_group_new ("PopupsActions"); egg_action_group_add_actions (action_group, ephy_popups_entries, diff --git a/src/session.c b/src/session.c index 0216ab50f..b6a332d3d 100644 --- a/src/session.c +++ b/src/session.c @@ -563,7 +563,6 @@ parse_embed (xmlNodePtr child, EphyWindow *window) ephy_shell_new_tab (ephy_shell, window, NULL, url, EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_OPEN_PAGE | - EPHY_NEW_TAB_DONT_JUMP_TO | EPHY_NEW_TAB_APPEND_LAST); xmlFree (url); |