Index: ephy-topic-action.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-topic-action.c,v
retrieving revision 1.3
diff -u -w -u -r1.3 ephy-topic-action.c
--- ephy-topic-action.c	8 Apr 2003 20:55:36 -0000	1.3
+++ ephy-topic-action.c	8 Apr 2003 23:46:07 -0000
@@ -22,6 +22,8 @@
 #include "eggtoolitem.h"
 #include "ephy-debug.h"
 #include "ephy-gui.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-prefs.h"
 
 static void ephy_topic_action_init       (EphyTopicAction *action);
 static void ephy_topic_action_class_init (EphyTopicActionClass *class);
@@ -126,6 +128,91 @@
 }
 
 static void
+menu_open_all_cb (GtkWidget *item, EphyNode *node)
+{
+        gboolean open_in_tabs;
+        EphyWindow *current_window;
+        EmbedChromeMask chromemask;
+        GList *current_tabs;
+        int number_of_tabs;
+        GPtrArray *children;
+        int i;
+
+        open_in_tabs = eel_gconf_get_boolean (CONF_TABS_TABBED);
+
+        current_window = ephy_shell_get_active_window (ephy_shell);
+        chromemask = ephy_window_get_chrome (current_window);
+
+        current_tabs = ephy_window_get_tabs (current_window);
+        if (current_tabs)
+                number_of_tabs = g_list_length (current_tabs);
+        else
+                number_of_tabs = 0;
+
+        children = ephy_node_get_children (node);
+
+        if (!open_in_tabs && children->len > 2) {
+                GtkWidget *dialog;
+                gchar *str;
+
+                str = g_strdup_printf("This will open %d new windows",
+                                children->len);
+                dialog = gtk_message_dialog_new (GTK_WINDOW (current_window),
+                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                 GTK_MESSAGE_INFO,
+                                                 GTK_BUTTONS_OK_CANCEL,
+                                                 str);
+                g_free(str);
+
+                if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) {
+                        gtk_widget_destroy (dialog);
+                        return;
+                }
+                gtk_widget_destroy (dialog);
+        }
+
+        for (i = 0; i < children->len; i++)
+        {
+                EphyNode *child;
+                const char *location;
+                EphyWindow *window = NULL;
+                EphyTab *tab = NULL;
+                EphyEmbed *embed;
+                gboolean open_in_current = number_of_tabs > i;
+
+                child = g_ptr_array_index (children, i);
+
+                location = ephy_node_get_property_string
+                        (child, EPHY_NODE_BMK_PROP_LOCATION);
+
+                /* Open in an open tab */
+                if (open_in_tabs) {
+                        if (open_in_current) {
+                                tab = g_list_nth_data (current_tabs, i);
+                                g_assert (tab != NULL);
+                        }
+                        window = current_window;
+                } else {
+                        window = ephy_window_new ();
+                        gtk_widget_show (GTK_WIDGET(window));
+                        ephy_window_set_chrome (window, chromemask);
+                }
+		
+                /* Only create a new tab if it's not going to be opened in
+                 * the current tab
+                 */
+                if (!open_in_current || !open_in_tabs) {
+                        tab = ephy_tab_new ();
+                        ephy_window_add_tab (window, tab, FALSE);
+                }
+
+                embed = ephy_tab_get_embed (tab);
+                gtk_widget_show (GTK_WIDGET (embed));
+                ephy_embed_load_url (embed, location);
+        }
+}
+
+static void
 ephy_topic_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
 {
 	GtkLabel *label;
@@ -175,13 +262,14 @@
                        GdkPixbuf *icon;
                        GtkWidget *image;
                        icon = ephy_favicon_cache_get (cache, icon_location);
-                       g_assert (icon != NULL);
+                       if (icon) {
                        image = gtk_image_new_from_pixbuf (icon);
                        gtk_widget_show (image);
                        gtk_image_menu_item_set_image
                                (GTK_IMAGE_MENU_ITEM (item), image);
                        g_object_unref (icon);
                }
+               }
 
 		g_object_set_data (G_OBJECT (item), "node", kid);
 		g_signal_connect (item, "activate",
@@ -189,6 +277,23 @@
 		gtk_widget_show (item);
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 	}
+
+        if (children->len > 2) {
+                GtkWidget *separator;
+
+                /* Separator */
+                separator = gtk_separator_menu_item_new ();
+                gtk_widget_show (separator);
+                gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator);
+
+                /* Open all menu item */
+                item = gtk_menu_item_new_with_label (_("Open all"));
+                g_signal_connect (item, "activate",
+                                  G_CALLBACK (menu_open_all_cb), node);
+                gtk_widget_show (item);
+                gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+        }
+
 	ephy_node_thaw (node);
 
 	return menu;
