aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog26
-rw-r--r--lib/widgets/ephy-location-entry.c149
-rw-r--r--lib/widgets/ephy-location-entry.h12
-rw-r--r--src/ephy-fullscreen-popup.c2
-rw-r--r--src/ephy-location-action.c110
-rwxr-xr-xsrc/ephy-toolbar.c23
-rw-r--r--src/ephy-toolbar.h3
-rw-r--r--src/ephy-window.c2
8 files changed, 300 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ee12a421..10e8cf296 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2005-01-14 Christian Persch <chpe@cvs.gnome.org>
+
+ * lib/widgets/ephy-location-entry.c:
+ (ephy_location_entry_set_tooltip), (ephy_location_entry_finalize),
+ (ephy_location_entry_class_init), (modify_background),
+ (entry_style_set_cb), (entry_realize_cb),
+ (ephy_location_entry_construct_contents),
+ (ephy_location_entry_init), (ephy_location_entry_set_favicon),
+ (ephy_location_entry_set_show_lock),
+ (ephy_location_entry_set_lock_stock),
+ (ephy_location_entry_set_lock_tooltip):
+ * lib/widgets/ephy-location-entry.h:
+ * src/ephy-fullscreen-popup.c: (ephy_fullscreen_popup_constructor):
+ * src/ephy-location-action.c: (sync_icon), (sync_lock_stock_id),
+ (sync_lock_tooltip), (sync_show_lock), (connect_proxy),
+ (ephy_location_action_set_property),
+ (ephy_location_action_get_property),
+ (ephy_location_action_class_init), (ephy_location_action_finalize):
+ * src/ephy-toolbar.c: (ephy_toolbar_set_security_state),
+ (ephy_toolbar_set_lock_visibility), (ephy_toolbar_constructor):
+ * src/ephy-toolbar.h:
+ * src/ephy-window.c: (sync_chromes_visibility):
+
+ Add favicon and lock icon to the entry. Fixes bug #116482 and bug #149506.
+ Change "Exit Fullscreen" to "Leave Fullscreen" as per HIG, part of bug #153270.
+
2005-01-12 Christian Persch <chpe@cvs.gnome.org>
* embed/Makefile.am:
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index be5394692..bd131f27a 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -43,8 +43,11 @@
#include <gtk/gtkeventbox.h>
#include <gtk/gtkbox.h>
#include <gtk/gtkhbox.h>
+#include <gtk/gtkvbox.h>
#include <gtk/gtkimagemenuitem.h>
#include <gtk/gtkseparatormenuitem.h>
+#include <gtk/gtkframe.h>
+#include <gtk/gtkalignment.h>
#include <string.h>
@@ -52,9 +55,14 @@
struct _EphyLocationEntryPrivate
{
+ GtkTooltips *tips;
+ GtkWidget *ebox;
GtkWidget *entry;
GtkWidget *icon_ebox;
GtkWidget *icon;
+ GtkWidget *lock_ebox;
+ GtkWidget *lock;
+
char *before_completion;
gboolean user_changed;
@@ -149,15 +157,25 @@ ephy_location_entry_set_tooltip (GtkToolItem *tool_item,
const char *tip_private)
{
EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (tool_item);
+ EphyLocationEntryPrivate *priv = entry->priv;
- gtk_tooltips_set_tip (tooltips, entry->priv->entry, tip_text, tip_private);
- gtk_tooltips_set_tip (tooltips, entry->priv->icon_ebox,
- _("Drag and drop this icon to create a link to this page"), NULL);
+ gtk_tooltips_set_tip (tooltips, priv->entry, tip_text, tip_private);
return TRUE;
}
static void
+ephy_location_entry_finalize (GObject *object)
+{
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (object);
+ EphyLocationEntryPrivate *priv = entry->priv;
+
+ g_object_unref (priv->tips);
+
+ parent_class->finalize (object);
+}
+
+static void
ephy_location_entry_class_init (EphyLocationEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -165,6 +183,8 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
parent_class = g_type_class_peek_parent (klass);
+ object_class->finalize = ephy_location_entry_finalize;
+
tool_item_class->set_tooltip = ephy_location_entry_set_tooltip;
signals[USER_CHANGED] = g_signal_new (
@@ -453,31 +473,95 @@ favicon_drag_data_get_cb (GtkWidget *widget,
}
static void
+modify_background (EphyLocationEntry *entry)
+{
+ EphyLocationEntryPrivate *priv = entry->priv;
+
+ if (priv->entry->style == NULL || !GTK_WIDGET_REALIZED (priv->ebox)) return;
+
+ gtk_widget_modify_bg (priv->ebox, GTK_STATE_NORMAL,
+ &priv->entry->style->base[GTK_STATE_NORMAL]);
+}
+
+static void
+entry_style_set_cb (GtkWidget *widget,
+ GtkStyle *previous_style,
+ EphyLocationEntry *entry)
+{
+ LOG ("entry_style_set_cb")
+
+ modify_background (entry);
+}
+
+static void
+entry_realize_cb (GtkWidget *widget,
+ EphyLocationEntry *entry)
+{
+ LOG ("entry_realize_cb")
+
+ modify_background (entry);
+}
+
+static void
ephy_location_entry_construct_contents (EphyLocationEntry *entry)
{
EphyLocationEntryPrivate *priv = entry->priv;
- GtkWidget *hbox;
+ GtkWidget *alignment, *frame, *hbox;
LOG ("EphyLocationEntry constructing contents %p", entry)
- hbox = gtk_hbox_new (FALSE, 3); /* FIXME themeable spacing? */
- gtk_container_add (GTK_CONTAINER (entry), hbox);
+ alignment = gtk_alignment_new (0.0, 0.5, 1.0, 0.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 1, 1);
+ gtk_container_add (GTK_CONTAINER (entry), alignment);
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (alignment), frame);
+
+ priv->ebox = gtk_event_box_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (priv->ebox), 0);
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->ebox), TRUE);
+ gtk_container_add (GTK_CONTAINER (frame), priv->ebox);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (priv->ebox), hbox);
priv->icon_ebox = gtk_event_box_new ();
gtk_container_set_border_width (GTK_CONTAINER (priv->icon_ebox), 2);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->icon_ebox), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), priv->icon_ebox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->icon_ebox, FALSE, FALSE, 2);
gtk_drag_source_set (priv->icon_ebox, GDK_BUTTON1_MASK,
url_drag_types, n_url_drag_types,
GDK_ACTION_COPY);
+ gtk_tooltips_set_tip (priv->tips, priv->icon_ebox,
+ _("Drag and drop this icon to create a link to this page"), NULL);
priv->icon = gtk_image_new ();
gtk_container_add (GTK_CONTAINER (priv->icon_ebox), priv->icon);
priv->entry = gtk_entry_new ();
+ gtk_entry_set_has_frame (GTK_ENTRY (priv->entry), FALSE);
gtk_box_pack_start (GTK_BOX (hbox), priv->entry, TRUE, TRUE, 0);
- gtk_widget_show_all (hbox);
+ priv->lock_ebox = gtk_event_box_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (priv->lock_ebox), 2);
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->lock_ebox), FALSE);
+ gtk_box_pack_end (GTK_BOX (hbox), priv->lock_ebox, FALSE, FALSE, 2);
+ gtk_drag_source_set (priv->lock_ebox, GDK_BUTTON1_MASK,
+ url_drag_types, n_url_drag_types,
+ GDK_ACTION_COPY);
+
+ //priv->lock = gtk_image_new ();
+ priv->lock = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (priv->lock_ebox), priv->lock);
+
+ gtk_widget_show_all (alignment);
+
+ /* monitor entry style so we can set the background behind the icons */
+ g_signal_connect_after (priv->entry, "style-set",
+ G_CALLBACK (entry_style_set_cb), entry);
+ g_signal_connect_after (priv->entry, "realize",
+ G_CALLBACK (entry_realize_cb), entry);
g_signal_connect (priv->icon_ebox, "drag_data_get",
G_CALLBACK (favicon_drag_data_get_cb), entry);
@@ -505,6 +589,10 @@ ephy_location_entry_init (EphyLocationEntry *le)
p->user_changed = TRUE;
+ p->tips = gtk_tooltips_new ();
+ g_object_ref (p->tips);
+ gtk_object_sink (GTK_OBJECT (p->tips));
+
ephy_location_entry_construct_contents (le);
gtk_tool_item_set_expand (GTK_TOOL_ITEM (le), TRUE);
@@ -613,8 +701,47 @@ ephy_location_entry_get_entry (EphyLocationEntry *entry)
return entry->priv->entry;
}
-GtkWidget *
-ephy_location_entry_get_image (EphyLocationEntry *entry)
+void
+ephy_location_entry_set_favicon (EphyLocationEntry *entry,
+ GdkPixbuf *pixbuf)
{
- return entry->priv->icon;
+ GtkImage *image = GTK_IMAGE (entry->priv->icon);
+
+ if (pixbuf != NULL)
+ {
+ gtk_image_set_from_pixbuf (image, pixbuf);
+ }
+ else
+ {
+ gtk_image_set_from_stock (image,
+ GTK_STOCK_NEW,
+ GTK_ICON_SIZE_MENU);
+ }
+}
+
+void
+ephy_location_entry_set_show_lock (EphyLocationEntry *entry,
+ gboolean show_lock)
+{
+ g_object_set (entry->priv->lock_ebox, "visible", show_lock, NULL);
+}
+
+void
+ephy_location_entry_set_lock_stock (EphyLocationEntry *entry,
+ const char *stock_id)
+
+{
+ EphyLocationEntryPrivate *priv = entry->priv;
+
+ gtk_image_set_from_stock (GTK_IMAGE (priv->lock), stock_id,
+ GTK_ICON_SIZE_MENU);
+}
+
+void
+ephy_location_entry_set_lock_tooltip (EphyLocationEntry *entry,
+ const char *tooltip)
+{
+ EphyLocationEntryPrivate *priv = entry->priv;
+
+ gtk_tooltips_set_tip (priv->tips, priv->lock_ebox, tooltip, NULL);
}
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index f8c8dfad0..5718a0b57 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -81,7 +81,17 @@ void ephy_location_entry_activate (EphyLocationEntry *le);
GtkWidget *ephy_location_entry_get_entry (EphyLocationEntry *entry);
-GtkWidget *ephy_location_entry_get_image (EphyLocationEntry *entry);
+void ephy_location_entry_set_favicon (EphyLocationEntry *entry,
+ GdkPixbuf *pixbuf);
+
+void ephy_location_entry_set_show_lock (EphyLocationEntry *entry,
+ gboolean show_lock);
+
+void ephy_location_entry_set_lock_stock (EphyLocationEntry *entry,
+ const char *stock_id);
+
+void ephy_location_entry_set_lock_tooltip (EphyLocationEntry *entry,
+ const char *tooltip);
G_END_DECLS
diff --git a/src/ephy-fullscreen-popup.c b/src/ephy-fullscreen-popup.c
index ece03ba71..850f13908 100644
--- a/src/ephy-fullscreen-popup.c
+++ b/src/ephy-fullscreen-popup.c
@@ -279,7 +279,7 @@ ephy_fullscreen_popup_constructor (GType type,
gtk_box_pack_start (GTK_BOX (button_hbox), icon, FALSE, FALSE, 0);
gtk_widget_show (icon);
- label = gtk_label_new (_("Exit Fullscreen"));
+ label = gtk_label_new (_("Leave Fullscreen"));
gtk_box_pack_start (GTK_BOX (button_hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 5cfa8714c..a111559ea 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -46,6 +46,9 @@ struct _EphyLocationActionPrivate
EphyBookmarks *bookmarks;
char *icon;
EphyFaviconCache *cache;
+ char *lock_stock_id;
+ char *lock_tooltip;
+ gboolean show_lock;
};
static void ephy_location_action_init (EphyLocationAction *action);
@@ -63,6 +66,9 @@ enum
PROP_ADDRESS,
PROP_EDITABLE,
PROP_ICON,
+ PROP_LOCK_STOCK,
+ PROP_LOCK_TOOLTIP,
+ PROP_SHOW_LOCK,
PROP_WINDOW
};
@@ -191,23 +197,52 @@ sync_icon (GtkAction *gaction,
EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
EphyLocationActionPrivate *priv = action->priv;
EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
- GtkWidget *image;
GdkPixbuf *pixbuf;
- image = ephy_location_entry_get_image (entry);
pixbuf = ephy_favicon_cache_get (priv->cache, priv->icon);
+ ephy_location_entry_set_favicon (entry, pixbuf);
+
if (pixbuf != NULL)
{
- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
g_object_unref (pixbuf);
}
- else
- {
- gtk_image_set_from_stock (GTK_IMAGE (image),
- GTK_STOCK_NEW,
- GTK_ICON_SIZE_MENU);
- }
+}
+
+static void
+sync_lock_stock_id (GtkAction *gaction,
+ GParamSpec *pspec,
+ GtkWidget *proxy)
+{
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
+ EphyLocationActionPrivate *priv = action->priv;
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
+
+ ephy_location_entry_set_lock_stock (entry, priv->lock_stock_id);
+}
+
+static void
+sync_lock_tooltip (GtkAction *gaction,
+ GParamSpec *pspec,
+ GtkWidget *proxy)
+{
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
+ EphyLocationActionPrivate *priv = action->priv;
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
+
+ ephy_location_entry_set_lock_tooltip (entry, priv->lock_tooltip);
+}
+
+static void
+sync_show_lock (GtkAction *gaction,
+ GParamSpec *pspec,
+ GtkWidget *proxy)
+{
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
+ EphyLocationActionPrivate *priv = action->priv;
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
+
+ ephy_location_entry_set_show_lock (entry, priv->show_lock);
}
static char *
@@ -311,6 +346,15 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
sync_icon (action, NULL, proxy);
g_signal_connect_object (action, "notify::icon",
G_CALLBACK (sync_icon), proxy, 0);
+ sync_lock_stock_id (action, NULL, proxy);
+ g_signal_connect_object (action, "notify::lock-stock-id",
+ G_CALLBACK (sync_lock_stock_id), proxy, 0);
+ sync_lock_tooltip (action, NULL, proxy);
+ g_signal_connect_object (action, "notify::lock-tooltip",
+ G_CALLBACK (sync_lock_tooltip), proxy, 0);
+ sync_show_lock (action, NULL, proxy);
+ g_signal_connect_object (action, "notify::show-lock",
+ G_CALLBACK (sync_show_lock), proxy, 0);
entry = ephy_location_entry_get_entry (lentry);
g_signal_connect_object (entry, "activate",
@@ -368,6 +412,17 @@ ephy_location_action_set_property (GObject *object,
g_free (action->priv->icon);
action->priv->icon = g_value_dup_string (value);
break;
+ case PROP_LOCK_STOCK:
+ g_free (action->priv->lock_stock_id);
+ action->priv->lock_stock_id = g_value_dup_string (value);
+ break;
+ case PROP_LOCK_TOOLTIP:
+ g_free (action->priv->lock_tooltip);
+ action->priv->lock_tooltip = g_value_dup_string (value);
+ break;
+ case PROP_SHOW_LOCK:
+ action->priv->show_lock = g_value_get_boolean (value);
+ break;
case PROP_WINDOW:
action->priv->window = EPHY_WINDOW (g_value_get_object (value));
break;
@@ -393,6 +448,15 @@ ephy_location_action_get_property (GObject *object,
case PROP_ICON:
g_value_set_string (value, action->priv->icon);
break;
+ case PROP_LOCK_STOCK:
+ g_value_set_string (value, action->priv->lock_stock_id);
+ break;
+ case PROP_LOCK_TOOLTIP:
+ g_value_set_string (value, action->priv->lock_tooltip);
+ break;
+ case PROP_SHOW_LOCK:
+ g_value_set_boolean (value, action->priv->show_lock);
+ break;
case PROP_WINDOW:
/* not readable */
break;
@@ -439,6 +503,30 @@ ephy_location_action_class_init (EphyLocationActionClass *class)
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
+ PROP_LOCK_STOCK,
+ g_param_spec_string ("lock-stock-id",
+ "Lock Stock ID",
+ "Lock Stock ID",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_LOCK_TOOLTIP,
+ g_param_spec_string ("lock-tooltip",
+ "Lock Tooltip",
+ "The icon",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_SHOW_LOCK,
+ g_param_spec_boolean ("show-lock",
+ "Show Lock",
+ "Show Lock",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
PROP_WINDOW,
g_param_spec_object ("window",
"Window",
@@ -593,7 +681,9 @@ ephy_location_action_finalize (GObject *object)
g_list_free (priv->actions);
g_free (priv->address);
- g_free (action->priv->icon);
+ g_free (priv->icon);
+ g_free (priv->lock_stock_id);
+ g_free (priv->lock_tooltip);
g_object_unref (priv->cache);
G_OBJECT_CLASS (parent_class)->finalize (object);
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index e375a4edd..729322109 100755
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -73,6 +73,8 @@ struct _EphyToolbarPrivate
GtkToolItem *exit_button;
guint disable_arbitrary_url_notifier_id;
gulong set_focus_handler;
+ gboolean show_lock;
+ gboolean lock_visible;
gboolean fullscreen;
gboolean spinning;
};
@@ -498,18 +500,31 @@ ephy_toolbar_set_security_state (EphyToolbar *toolbar,
const char *stock_id,
const char *tooltip)
{
-#if 0
EphyToolbarPrivate *priv = toolbar->priv;
+ priv->show_lock = show_lock;
+
g_object_set (priv->actions[LOCATION_ACTION],
- "lock-show", show_lock,
"lock-stock-id", stock_id,
"lock-tooltip", tooltip,
+ "show-lock", priv->lock_visible && priv->show_lock,
NULL);
-#endif
}
void
+ephy_toolbar_set_lock_visibility (EphyToolbar *toolbar,
+ gboolean visible)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ priv->lock_visible = visible;
+
+ g_object_set (priv->actions[LOCATION_ACTION],
+ "show-lock", priv->lock_visible && priv->show_lock,
+ NULL);
+}
+
+void
ephy_toolbar_set_spinning (EphyToolbar *toolbar,
gboolean spinning)
{
@@ -637,7 +652,7 @@ ephy_toolbar_constructor (GType type,
gtk_toolbar_insert (gtoolbar, priv->sep_item, -1);
priv->exit_button = gtk_tool_button_new_from_stock (GTK_STOCK_QUIT);
- gtk_tool_button_set_label (GTK_TOOL_BUTTON (priv->exit_button), _("Exit Fullscreen"));
+ gtk_tool_button_set_label (GTK_TOOL_BUTTON (priv->exit_button), _("Leave Fullscreen"));
gtk_tool_item_set_is_important (priv->exit_button, TRUE);
g_signal_connect (priv->exit_button, "clicked",
G_CALLBACK (exit_button_clicked_cb), toolbar);
diff --git a/src/ephy-toolbar.h b/src/ephy-toolbar.h
index 26338dbfd..a1dbd205f 100644
--- a/src/ephy-toolbar.h
+++ b/src/ephy-toolbar.h
@@ -88,6 +88,9 @@ void ephy_toolbar_set_security_state (EphyToolbar *toolbar,
const char *stock_id,
const char *tooltip);
+void ephy_toolbar_set_lock_visibility (EphyToolbar *toolbar,
+ gboolean visible);
+
void ephy_toolbar_set_spinning (EphyToolbar *toolbar,
gboolean spinning);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 79be6fba2..0588b27a1 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -548,6 +548,8 @@ sync_chromes_visibility (EphyWindow *window)
g_object_set (priv->bookmarksbar, "visible", show_bookmarksbar, NULL);
g_object_set (priv->statusbar, "visible", show_statusbar, NULL);
+ ephy_toolbar_set_lock_visibility (priv->toolbar, !show_statusbar);
+
if (priv->fullscreen_popup != NULL)
{
g_object_set (priv->fullscreen_popup, "visible", !show_toolbar, NULL);