From 853e7df8135a9a57071e3b0122e4dbf29e447dc9 Mon Sep 17 00:00:00 2001 From: James Willcox Date: Fri, 14 Feb 2003 18:52:57 +0000 Subject: Add tab load notification (a little spinning icon), and a context menu for 2003-02-14 James Willcox * data/art/Makefile.am: * data/ui/Makefile.am: * lib/widgets/ephy-notebook.c: (ephy_notebook_init), (ephy_notebook_set_page_status), (tab_build_label): * src/bookmarks/ephy-bookmarks-editor.c: (popup_cmd_open_bookmarks_in_tabs), (popup_cmd_open_bookmarks_in_browser), (popup_cmd_remove_bookmarks), (ephy_bookmarks_editor_finalize), (ephy_bookmarks_editor_show_popup_cb), (ephy_bookmarks_editor_construct): Add tab load notification (a little spinning icon), and a context menu for the bookmarks editor. --- lib/widgets/ephy-notebook.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'lib/widgets/ephy-notebook.c') diff --git a/lib/widgets/ephy-notebook.c b/lib/widgets/ephy-notebook.c index 45dc54958..9a0a1278b 100644 --- a/lib/widgets/ephy-notebook.c +++ b/lib/widgets/ephy-notebook.c @@ -20,6 +20,7 @@ #include "eel-gconf-extensions.h" #include "ephy-prefs.h" #include "ephy-marshal.h" +#include "ephy-file-helpers.h" #include #include @@ -35,6 +36,8 @@ struct EphyNotebookPrivate GList *focused_pages; GList *opened_tabs; + EphyNotebookPageLoadStatus current_status; + /* Used during tab drag'n'drop */ gulong motion_notify_handler_id; gint x_start, y_start; @@ -587,6 +590,8 @@ ephy_notebook_init (EphyNotebook *notebook) { notebook->priv = g_new (EphyNotebookPrivate, 1); + notebook->priv->current_status = EPHY_NOTEBOOK_TAB_LOAD_NORMAL; + notebook->priv->drag_in_progress = FALSE; notebook->priv->motion_notify_handler_id = 0; notebook->priv->src_notebook = NULL; @@ -629,6 +634,36 @@ ephy_notebook_set_page_status (EphyNotebook *nb, GtkWidget *child, EphyNotebookPageLoadStatus status) { + GtkWidget *tab, *image; + + g_return_if_fail (nb != NULL); + + if (status == nb->priv->current_status) + { + return; + } + + tab = gtk_notebook_get_tab_label (GTK_NOTEBOOK (nb), child); + + g_return_if_fail (tab != NULL); + + image = g_object_get_data (G_OBJECT (tab), "loading-image"); + + g_return_if_fail (image != NULL); + + switch (status) + { + case EPHY_NOTEBOOK_TAB_LOAD_LOADING: + gtk_widget_show (image); + break; + + case EPHY_NOTEBOOK_TAB_LOAD_COMPLETED: + case EPHY_NOTEBOOK_TAB_LOAD_NORMAL: + gtk_widget_hide (image); + break; + } + + nb->priv->current_status = status; } static void @@ -648,6 +683,8 @@ tab_build_label (EphyNotebook *nb, GtkWidget *child) int h, w; GClosure *closure; GtkWidget *window; + GtkWidget *loading_image; + GdkPixbufAnimation *loading_pixbuf; window = gtk_widget_get_toplevel (GTK_WIDGET (nb)); @@ -667,6 +704,12 @@ tab_build_label (EphyNotebook *nb, GtkWidget *child) gtk_container_add (GTK_CONTAINER (close_button), image); + /* setup load feedback image */ + loading_pixbuf = gdk_pixbuf_animation_new_from_file (ephy_file ("epiphany-tab-loading.gif"), NULL); + loading_image = gtk_image_new_from_animation (loading_pixbuf); + g_object_unref (loading_pixbuf); + gtk_box_pack_start (GTK_BOX (hbox), loading_image, FALSE, FALSE, 0); + /* setup label */ label = gtk_label_new (_("Untitled")); gtk_misc_set_alignment (GTK_MISC (label), 0.00, 0.5); @@ -698,6 +741,7 @@ tab_build_label (EphyNotebook *nb, GtkWidget *child) gtk_widget_show (close_button); g_object_set_data (G_OBJECT (hbox), "label", label); + g_object_set_data (G_OBJECT (hbox), "loading-image", loading_image); return hbox; } -- cgit v1.2.3