aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Willcox <jwillcox@gnome.org>2003-02-15 02:52:57 +0800
committerJames Willcox <jwillcox@src.gnome.org>2003-02-15 02:52:57 +0800
commit853e7df8135a9a57071e3b0122e4dbf29e447dc9 (patch)
tree9effc11254540fcf63944ace4c1870a0039f4b97
parent49db412621481e87b3b5d882320e533a290eaa62 (diff)
downloadgsoc2013-epiphany-853e7df8135a9a57071e3b0122e4dbf29e447dc9.tar
gsoc2013-epiphany-853e7df8135a9a57071e3b0122e4dbf29e447dc9.tar.gz
gsoc2013-epiphany-853e7df8135a9a57071e3b0122e4dbf29e447dc9.tar.bz2
gsoc2013-epiphany-853e7df8135a9a57071e3b0122e4dbf29e447dc9.tar.lz
gsoc2013-epiphany-853e7df8135a9a57071e3b0122e4dbf29e447dc9.tar.xz
gsoc2013-epiphany-853e7df8135a9a57071e3b0122e4dbf29e447dc9.tar.zst
gsoc2013-epiphany-853e7df8135a9a57071e3b0122e4dbf29e447dc9.zip
Add tab load notification (a little spinning icon), and a context menu for
2003-02-14 James Willcox <jwillcox@gnome.org> * 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.
-rw-r--r--ChangeLog16
-rw-r--r--data/art/Makefile.am3
-rw-r--r--data/art/epiphany-tab-loading.gifbin0 -> 288 bytes
-rw-r--r--data/ui/Makefile.am1
-rw-r--r--data/ui/epiphany-bookmark-editor-ui.xml.in13
-rw-r--r--lib/widgets/ephy-notebook.c44
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c137
7 files changed, 213 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 16c7f512c..f4f6e6917 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-02-14 James Willcox <jwillcox@gnome.org>
+
+ * 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.
+
2003-02-14 Dave Bordoley <bordoley@msu.edu>
* data/ui/epiphany-toolbar.xml.in
diff --git a/data/art/Makefile.am b/data/art/Makefile.am
index b92119de8..0cdf57535 100644
--- a/data/art/Makefile.am
+++ b/data/art/Makefile.am
@@ -7,7 +7,8 @@ art_DATA = \
epiphany-history.png \
epiphany-new-tab.png \
epiphany-viewsource.png \
- epiphany-send-link.png
+ epiphany-send-link.png \
+ epiphany-tab-loading.gif
appicon_DATA = epiphany.png
appicondir = $(datadir)/pixmaps
diff --git a/data/art/epiphany-tab-loading.gif b/data/art/epiphany-tab-loading.gif
new file mode 100644
index 000000000..c91e58e98
--- /dev/null
+++ b/data/art/epiphany-tab-loading.gif
Binary files differ
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index c56bceda3..189a6e938 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -1,5 +1,6 @@
uixmldir = $(pkgdatadir)
uixml_in_files = epiphany-ui.xml.in \
+ epiphany-bookmark-editor-ui.xml.in \
nautilus-epiphany-view.xml.in \
epiphany-toolbar.xml.in
diff --git a/data/ui/epiphany-bookmark-editor-ui.xml.in b/data/ui/epiphany-bookmark-editor-ui.xml.in
new file mode 100644
index 000000000..d3a0180c8
--- /dev/null
+++ b/data/ui/epiphany-bookmark-editor-ui.xml.in
@@ -0,0 +1,13 @@
+
+<Root>
+<popups>
+
+<popup name="EphyBookmarkEditorPopup" verb="FakeToplevel">
+ <menuitem name="OpenInTabBMK" verb="OpenInTab"/>
+ <menuitem name="OpenInWindowBMK" verb="OpenInWindow"/>
+ <separator name="BookmarksPopupSep1"/>
+ <menuitem name="RemoveBMK" verb="Remove"/>
+</popup>
+
+</popups>
+</Root>
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 <gtk/gtk.h>
#include <glib-object.h>
@@ -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;
}
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 9de611d7b..1e898c098 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -32,7 +32,12 @@
#include "ephy-keywords-entry.h"
#include "ephy-dnd.h"
#include "ephy-prefs.h"
+#include "ephy-shell.h"
#include "eel-gconf-extensions.h"
+#include "ephy-file-helpers.h"
+#include "egg-action-group.h"
+#include "egg-menu-merge.h"
+#include "popup-commands.h"
static void ephy_bookmarks_editor_class_init (EphyBookmarksEditorClass *klass);
static void ephy_bookmarks_editor_init (EphyBookmarksEditor *editor);
@@ -47,6 +52,13 @@ static void ephy_bookmarks_editor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
+static void popup_cmd_open_bookmarks_in_tabs (EggAction *action,
+ EphyBookmarksEditor *editor);
+static void popup_cmd_open_bookmarks_in_browser (EggAction *action,
+ EphyBookmarksEditor *editor);
+static void popup_cmd_remove_bookmarks (EggAction *action,
+ EphyBookmarksEditor *editor);
+
struct EphyBookmarksEditorPrivate
{
EphyBookmarks *bookmarks;
@@ -58,6 +70,8 @@ struct EphyBookmarksEditorPrivate
GtkWidget *keywords_entry;
GtkWidget *search_entry;
GtkWidget *go_button;
+ EggMenuMerge *ui_merge;
+ EggActionGroup *action_group;
};
enum
@@ -74,6 +88,87 @@ enum
static GObjectClass *parent_class = NULL;
+static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
+ /* Toplevel */
+ { "FakeToplevel", (""), NULL, NULL, NULL, NULL, NULL },
+
+ { "OpenInTab", N_("Open In New Tab..."), GTK_STOCK_JUMP_TO, NULL,
+ NULL, G_CALLBACK (popup_cmd_open_bookmarks_in_tabs), NULL },
+
+ { "OpenInWindow", N_("Open In New Browser..."), GTK_STOCK_JUMP_TO, NULL,
+ NULL, G_CALLBACK (popup_cmd_open_bookmarks_in_browser), NULL },
+
+ { "Remove", N_("Remove..."), GTK_STOCK_REMOVE, NULL,
+ NULL, G_CALLBACK (popup_cmd_remove_bookmarks), NULL },
+};
+static guint ephy_bookmark_popup_n_entries = G_N_ELEMENTS (ephy_bookmark_popup_entries);
+
+
+static void
+popup_cmd_open_bookmarks_in_tabs (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ EphyWindow *window;
+ GList *selection;
+ GList *l;
+
+ window = EPHY_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (editor)));
+ selection = ephy_node_view_get_selection (editor->priv->bm_view);
+
+ for (l = selection; l; l = l->next)
+ {
+ EphyNode *node = EPHY_NODE (l->data);
+ const char *location;
+
+ location = ephy_node_get_property_string (node,
+ EPHY_NODE_BMK_PROP_LOCATION);
+
+ ephy_shell_new_tab (ephy_shell, window, NULL, location,
+ EPHY_NEW_TAB_APPEND|EPHY_NEW_TAB_IN_EXISTING_WINDOW);
+ }
+
+ if (selection)
+ {
+ g_list_free (selection);
+ }
+}
+
+static void
+popup_cmd_open_bookmarks_in_browser (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ EphyWindow *window;
+ GList *selection;
+ GList *l;
+
+ window = EPHY_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (editor)));
+ selection = ephy_node_view_get_selection (editor->priv->bm_view);
+
+ for (l = selection; l; l = l->next)
+ {
+ EphyNode *node = EPHY_NODE (l->data);
+ const char *location;
+
+ location = ephy_node_get_property_string (node,
+ EPHY_NODE_BMK_PROP_LOCATION);
+
+ ephy_shell_new_tab (ephy_shell, window, NULL, location,
+ EPHY_NEW_TAB_IN_NEW_WINDOW);
+ }
+
+ if (selection)
+ {
+ g_list_free (selection);
+ }
+}
+
+static void
+popup_cmd_remove_bookmarks (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ ephy_node_view_remove (editor->priv->bm_view);
+}
+
GType
ephy_bookmarks_editor_get_type (void)
{
@@ -180,6 +275,11 @@ ephy_bookmarks_editor_finalize (GObject *object)
g_object_unref (G_OBJECT (editor->priv->bookmarks_filter));
+ g_object_unref (editor->priv->action_group);
+ egg_menu_merge_remove_action_group (editor->priv->ui_merge,
+ editor->priv->action_group);
+ g_object_unref (editor->priv->ui_merge);
+
g_free (editor->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -228,6 +328,18 @@ ephy_bookmarks_editor_node_selected_cb (GtkWidget *view,
}
static void
+ephy_bookmarks_editor_show_popup_cb (GtkWidget *view,
+ EphyBookmarksEditor *editor)
+{
+ GtkWidget *widget;
+
+ widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+ "/popups/EphyBookmarkEditorPopup");
+ gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
+ gtk_get_current_event_time ());
+}
+
+static void
ephy_bookmarks_editor_node_activated_cb (GtkWidget *view,
EphyNode *node,
EphyBookmarksEditor *editor)
@@ -514,6 +626,27 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
long selected_id;
EphyNode *selected_node;
char *selected_id_str;
+ EggMenuMerge *ui_merge;
+ EggActionGroup *action_group;
+ int i;
+
+ for (i = 0; i < ephy_bookmark_popup_n_entries; i++)
+ {
+ ephy_bookmark_popup_entries[i].user_data = editor;
+ }
+
+ ui_merge = egg_menu_merge_new ();
+ action_group = egg_action_group_new ("PopupActions");
+ egg_action_group_add_actions (action_group, ephy_bookmark_popup_entries,
+ ephy_bookmark_popup_n_entries);
+ egg_menu_merge_insert_action_group (ui_merge,
+ action_group, 0);
+ egg_menu_merge_add_ui_from_file (ui_merge,
+ ephy_file ("epiphany-bookmark-editor-ui.xml"),
+ NULL);
+ editor->priv->ui_merge = ui_merge;
+ editor->priv->action_group = action_group;
+
gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks"));
@@ -574,6 +707,10 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
"node_selected",
G_CALLBACK (ephy_bookmarks_editor_node_selected_cb),
editor);
+ g_signal_connect (G_OBJECT (bm_view),
+ "show_popup",
+ G_CALLBACK (ephy_bookmarks_editor_show_popup_cb),
+ editor);
gtk_box_pack_start (GTK_BOX (vbox),
build_editing_table (editor),