[Epiphany] mega-patch
- From: James Willcox <jwillcox cs indiana edu>
- To: Marco Pesenti Gritti <mpgritti oltrelinux com>
- Cc: epiphany mozdev org
- Subject: [Epiphany] mega-patch
- Date: 13 Feb 2003 23:42:57 -0500
Hi Marco,
Here's a patch that does 2 things: adds load feedback to tabs, and adds
a context menu to the bookmark editor.
http://www.cs.indiana.edu/~jwillcox/epiphany-loading-and-menu.png
It really should be 2 separate patches, but I am lame and didn't want to
separate it. Of course, if you want one and not the other I will go
ahead and do it. :)
Thanks,
James
? data/art/epiphany-tab-loading.gif
? data/ui/epiphany-bookmark-editor-ui.xml.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/epiphany/ChangeLog,v
retrieving revision 1.102
diff -u -r1.102 ChangeLog
--- ChangeLog 13 Feb 2003 17:16:11 -0000 1.102
+++ ChangeLog 14 Feb 2003 04:31:17 -0000
@@ -1,3 +1,25 @@
+2003-02-13 James Willcox <jwillcox@gnome.org>
+
+ * data/ui/Makefile.am:
+ * data/ui/epiphany-ui.xml.in:
+ * lib/widgets/ephy-notebook.c: (ephy_notebook_init),
+ (ephy_notebook_set_page_status), (tab_build_label):
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_finalize),
+ (ephy_bookmarks_editor_show_popup_cb),
+ (ephy_bookmarks_editor_construct), (ephy_bookmarks_editor_new),
+ (ephy_bookmarks_editor_get_selected_bookmarks),
+ (ephy_bookmarks_editor_remove_selected):
+ * src/bookmarks/ephy-bookmarks-editor.h:
+ * src/ephy-tab.c: (ephy_tab_set_location):
+ * src/ephy-tab.h:
+ * src/popup-commands.c: (popup_cmd_open_bookmarks_in_tabs),
+ (popup_cmd_open_bookmarks_in_window), (popup_cmd_remove_bookmarks):
+ * src/popup-commands.h:
+
+ Add a context menu to the bookmark editor, and make tabs display
+ load activity.
+
2003-02-13 Xan Lopez <xan@masilla.org>
* src/bookmarks/ephy-bookmarks-editor.c:
Index: data/art/Makefile.am
===================================================================
RCS file: /cvs/gnome/epiphany/data/art/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- data/art/Makefile.am 3 Feb 2003 13:23:20 -0000 1.5
+++ data/art/Makefile.am 14 Feb 2003 04:31:17 -0000
@@ -7,7 +7,8 @@
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
Index: data/ui/Makefile.am
===================================================================
RCS file: /cvs/gnome/epiphany/data/ui/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- data/ui/Makefile.am 20 Jan 2003 18:57:15 -0000 1.2
+++ data/ui/Makefile.am 14 Feb 2003 04:31:17 -0000
@@ -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
Index: lib/widgets/ephy-notebook.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/widgets/ephy-notebook.c,v
retrieving revision 1.2
diff -u -r1.2 ephy-notebook.c
--- lib/widgets/ephy-notebook.c 4 Jan 2003 20:08:24 -0000 1.2
+++ lib/widgets/ephy-notebook.c 14 Feb 2003 04:31:17 -0000
@@ -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 @@
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 @@
{
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,39 @@
GtkWidget *child,
EphyNotebookPageLoadStatus status)
{
+ GtkWidget *tab, *label, *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);
+
+ label = g_object_get_data (G_OBJECT (tab), "label");
+ image = g_object_get_data (G_OBJECT (tab), "loading-image");
+
+ g_return_if_fail (label != NULL);
+ g_return_if_fail (image != NULL);
+
+ switch (status)
+ {
+ case EPHY_NOTEBOOK_TAB_LOAD_NORMAL:
+ gtk_widget_hide (image);
+ break;
+
+ case EPHY_NOTEBOOK_TAB_LOAD_LOADING:
+ gtk_widget_show (image);
+ break;
+
+ case EPHY_NOTEBOOK_TAB_LOAD_COMPLETED:
+ gtk_widget_hide (image);
+ break;
+ }
+
+ nb->priv->current_status = status;
}
static void
@@ -648,6 +686,8 @@
int h, w;
GClosure *closure;
GtkWidget *window;
+ GtkWidget *loading_image;
+ GdkPixbufAnimation *loading_pixbuf;
window = gtk_widget_get_toplevel (GTK_WIDGET (nb));
@@ -667,6 +707,12 @@
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 +744,7 @@
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;
}
Index: src/popup-commands.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/popup-commands.c,v
retrieving revision 1.5
diff -u -r1.5 popup-commands.c
--- src/popup-commands.c 30 Jan 2003 13:53:38 -0000 1.5
+++ src/popup-commands.c 14 Feb 2003 04:31:17 -0000
@@ -465,3 +465,63 @@
ephy_embed_load_url (embed, location);
}
+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_bookmarks_editor_get_selected_bookmarks (editor);
+
+ 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);
+}
+
+void
+popup_cmd_open_bookmarks_in_window (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ EphyWindow *window;
+ GList *selection;
+ GList *l;
+
+ window = EPHY_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (editor)));
+ selection = ephy_bookmarks_editor_get_selected_bookmarks (editor);
+
+ 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);
+}
+
+void
+popup_cmd_remove_bookmarks (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ ephy_bookmarks_editor_remove_selected (editor);
+}
Index: src/popup-commands.h
===================================================================
RCS file: /cvs/gnome/epiphany/src/popup-commands.h,v
retrieving revision 1.2
diff -u -r1.2 popup-commands.h
--- src/popup-commands.h 20 Jan 2003 18:57:20 -0000 1.2
+++ src/popup-commands.h 14 Feb 2003 04:31:17 -0000
@@ -18,6 +18,7 @@
#include "egg-action.h"
#include "ephy-window.h"
+#include "ephy-bookmarks-editor.h"
void popup_cmd_link_in_new_window (EggAction *action,
EphyWindow *window);
@@ -82,3 +83,9 @@
void popup_cmd_save_image_as (EggAction *action,
EphyWindow *window);
+void popup_cmd_open_bookmarks_in_tabs (EggAction *action,
+ EphyBookmarksEditor *editor);
+void popup_cmd_open_bookmarks_in_window (EggAction *action,
+ EphyBookmarksEditor *editor);
+void popup_cmd_remove_bookmarks (EggAction *action,
+ EphyBookmarksEditor *editor);
Index: src/bookmarks/ephy-bookmarks-editor.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-bookmarks-editor.c,v
retrieving revision 1.13
diff -u -r1.13 ephy-bookmarks-editor.c
--- src/bookmarks/ephy-bookmarks-editor.c 13 Feb 2003 17:16:12 -0000 1.13
+++ src/bookmarks/ephy-bookmarks-editor.c 14 Feb 2003 04:31:17 -0000
@@ -33,6 +33,10 @@
#include "ephy-dnd.h"
#include "ephy-prefs.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);
@@ -58,6 +62,8 @@
GtkWidget *keywords_entry;
GtkWidget *search_entry;
GtkWidget *go_button;
+ EggMenuMerge *ui_merge;
+ EggActionGroup *action_group;
};
enum
@@ -74,6 +80,23 @@
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 Window..."), GTK_STOCK_JUMP_TO, NULL,
+ NULL, G_CALLBACK (popup_cmd_open_bookmarks_in_window), 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);
+
+
+
GType
ephy_bookmarks_editor_get_type (void)
{
@@ -180,6 +203,11 @@
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 +256,18 @@
}
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 +554,27 @@
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 +635,10 @@
"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),
@@ -631,6 +696,18 @@
ephy_bookmarks_editor_construct (editor);
return GTK_WIDGET (editor);
+}
+
+GList *
+ephy_bookmarks_editor_get_selected_bookmarks (EphyBookmarksEditor *editor)
+{
+ return ephy_node_view_get_selection (editor->priv->bm_view);
+}
+
+void
+ephy_bookmarks_editor_remove_selected (EphyBookmarksEditor *editor)
+{
+ ephy_node_view_remove (editor->priv->bm_view);
}
static void
Index: src/bookmarks/ephy-bookmarks-editor.h
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-bookmarks-editor.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ephy-bookmarks-editor.h
--- src/bookmarks/ephy-bookmarks-editor.h 30 Dec 2002 19:29:21 -0000 1.1.1.1
+++ src/bookmarks/ephy-bookmarks-editor.h 14 Feb 2003 04:31:17 -0000
@@ -54,6 +54,10 @@
GtkWidget *ephy_bookmarks_editor_new (EphyBookmarks *bookmarks,
GtkWindow *parent);
+GList *ephy_bookmarks_editor_get_selected_bookmarks (EphyBookmarksEditor *editor);
+
+void ephy_bookmarks_editor_remove_selected (EphyBookmarksEditor *editor);
+
G_END_DECLS
#endif /* EPHY_BOOKMARKS_EDITOR_H */
<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>
epiphany-tab-loading.gif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]