Hey everyone El dom, 21-03-2010 a las 20:07 +0000, Allan Day escribió: > Hi all, > > I've turned my previous design page [1] into a design specification. The > page (which still needs some work) describes some of the key usability > and design problems with browser interfaces. It is intended to provide > the basis for Epiphany redesign work that may take place in the future. > Please feel free to contribute! >
I thought the search-in-favicon idea was interesting and played with it a bit. Attached is a patch that sort of does it, but it's just a small for fun test. I think we can get some input from the usability guys about all this. Certainly I like some ideas like the queue. Thanks for your work on this Allan.
>From 1c580b0456720df28cd821f39a7a8642baabdbc9 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo <[email protected]> Date: Tue, 23 Mar 2010 18:22:27 -0500 Subject: [PATCH] Testing an idea by Allan Day --- src/ephy-location-action.c | 114 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 114 insertions(+), 0 deletions(-) diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c index 38bcb1d..57ef73d 100644 --- a/src/ephy-location-action.c +++ b/src/ephy-location-action.c @@ -23,6 +23,7 @@ #include "ephy-embed-container.h" #include "ephy-embed-utils.h" +#include "ephy-favicon-cache.h" #include "ephy-location-action.h" #include "ephy-location-entry.h" #include "ephy-shell.h" @@ -371,6 +372,115 @@ remove_completion_actions (GtkAction *gaction, } static void +activate_item_cb (GtkMenuItem *item, EphyLocationAction *action) +{ + GtkWidget *entry; + EphyLocationEntry *lentry; + char *content; + + lentry = EPHY_LOCATION_ENTRY (action->priv->proxy); + entry = ephy_location_entry_get_entry (lentry); + content = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + + if (content) + { + EphyNode *node; + const char *smart_url; + char *url; + + node = g_object_get_data (G_OBJECT (item), "bmk"); + + smart_url = ephy_node_get_property_string + (node, EPHY_NODE_BMK_PROP_LOCATION); + g_return_if_fail (smart_url != NULL); + + url = ephy_bookmarks_resolve_address + (action->priv->bookmarks, smart_url, content); + g_free (content); + if (url == NULL) return; + + ephy_link_open (EPHY_LINK (action), url, NULL, + ephy_link_flags_from_current_event ()); + + GtkWidget *image; + image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM + (item)); + + ephy_location_entry_set_favicon (lentry, + gtk_image_get_pixbuf (image)); + + g_free (url); + } +} + +static GtkWidget* +build_search_engine_menu (EphyLocationAction *action) +{ + GtkWidget *menu; + GList *l = NULL; + + menu = gtk_menu_new (); + + for (l = action->priv->actions; l != NULL; l = l->next) + { + EphyNode *bmk = l->data; + const char *title; + const char *icon; + GtkWidget *item; + + title = ephy_node_get_property_string + (bmk, EPHY_NODE_BMK_PROP_TITLE); + + icon = ephy_node_get_property_string (bmk, + EPHY_NODE_BMK_PROP_ICON); + + LOG ("title: %s, icon: %s", title, icon); + + item = gtk_image_menu_item_new_with_label (title); + g_object_set_data (G_OBJECT (item), "bmk", bmk); + + if (icon) + { + GdkPixbuf *pixbuf; + GtkWidget *image; + EphyFaviconCache *fic; + + fic = EPHY_FAVICON_CACHE + (ephy_embed_shell_get_favicon_cache + EPHY_EMBED_SHELL (ephy_shell)); + + pixbuf = ephy_favicon_cache_get (fic, icon); + image = gtk_image_new_from_pixbuf (pixbuf); + + gtk_image_menu_item_set_image + (GTK_IMAGE_MENU_ITEM (item), image); + } + + g_signal_connect (item, "activate", + G_CALLBACK (activate_item_cb), action); + + gtk_widget_show_all (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + } + + return menu; +} + +static void +icon_press_cb (GtkWidget *entry, + GtkEntryIconPosition pos, + GdkEvent *event, + GtkAction *action) +{ + GtkWidget *menu; + + menu = build_search_engine_menu (EPHY_LOCATION_ACTION (action)); + + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + event->button.button, gtk_get_current_event_time ()); +} + +static void add_completion_actions (GtkAction *gaction, GtkWidget *proxy) { @@ -532,6 +642,9 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) G_CALLBACK (focus_in_event_cb), proxy, 0); g_signal_connect_object (entry, "focus-out-event", G_CALLBACK (focus_out_event_cb), proxy, 0); + + g_signal_connect_object (entry, "icon-press", + G_CALLBACK (icon_press_cb), action, 0); } GTK_ACTION_CLASS (ephy_location_action_parent_class)->connect_proxy (action, proxy); @@ -905,6 +1018,7 @@ ephy_location_action_init (EphyLocationAction *action) priv->sync_address_is_blocked = FALSE; init_actions_list (action); + ephy_node_signal_connect_object (priv->smart_bmks, EPHY_NODE_CHILD_ADDED, -- 1.7.0.2
_______________________________________________ epiphany-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/epiphany-list
