After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668105 - Many page menu items are available on a blank page
Many page menu items are available on a blank page
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks: 668111
 
 
Reported: 2012-01-17 15:50 UTC by William Jon McCann
Modified: 2012-01-23 17:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ephy-window: sync page actions with is-blank property (7.33 KB, patch)
2012-01-23 00:10 UTC, Diego Escalante Urrelo (not reading bugmail)
reviewed Details | Review
ephy-action-helper: document flags API (1.23 KB, patch)
2012-01-23 15:06 UTC, Diego Escalante Urrelo (not reading bugmail)
rejected Details | Review
ephy-web-view: remove uneeded is_blank call (1.05 KB, patch)
2012-01-23 15:30 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review
ephy-web-view: remove uneeded is_blank calls (1.42 KB, patch)
2012-01-23 15:35 UTC, Diego Escalante Urrelo (not reading bugmail)
committed Details | Review
Updated with your comments. Now using an internal _ephy_web_view_set_is_blank (8.25 KB, patch)
2012-01-23 15:36 UTC, Diego Escalante Urrelo (not reading bugmail)
committed Details | Review

Description William Jon McCann 2012-01-17 15:50:13 UTC
When we start Web we show a blank page. On this page there are a lot of items in the page menu that are still available and that make no sense. For example:

 * Save As*
 * Page Setup
 * Print*
 * Send*
 * Find*
 * Add Bookmark
 * Encoding
 * Page Source
Comment 1 Diego Escalante Urrelo (not reading bugmail) 2012-01-20 01:11:39 UTC
Could we turn EphyWebView ephy_web_view_is_blank into a property and listen to notify::is_blank? Sounds reasonable?
Comment 2 Xan Lopez 2012-01-20 09:46:13 UTC
(In reply to comment #1)
> Could we turn EphyWebView ephy_web_view_is_blank into a property and listen to
> notify::is_blank? Sounds reasonable?

Sounds reasonable to me.
Comment 3 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 00:10:31 UTC
Created attachment 205842 [details] [review]
ephy-window: sync page actions with is-blank property

Add ::is-blank property to EphyWebView and update EphyWindow to sync
some of the page menu actions with it. There's no point in enabling
save/reload/bookmark/etc on about:blank.
Comment 4 Xan Lopez 2012-01-23 10:30:51 UTC
Review of attachment 205842 [details] [review]:

I think it needs a few changes, but it's a great change, thanks!

::: embed/ephy-web-view.c
@@ +1310,3 @@
+ *
+ * %TRUE if the EphyWebView is blank. Usually meaning that it has
+ * about:blank loaded, as new tabs and windows do.

I think I prefer something like "Whether the view is showing the blank address." and leave it at that. Soon enough new tabs/windows will show the overview, so better not to mention that.

@@ +2521,3 @@
   priv->is_blank = address == NULL ||
                    strcmp (address, "about:blank") == 0;
+  g_object_notify (object, "is-blank");

I know in theory it's ok to notify if the value has not changed, but I think I'd rather write this so it only happens when the value changes. So, from blank->non blank and viceversa.

@@ +2569,3 @@
       title = g_strdup (EMPTY_PAGE);
       priv->is_blank = TRUE;
+      g_object_notify (G_OBJECT (view), "is-blank");

Hrm, two notifies! Probably we should have an internal ephy_web_view_set_is_blank where we centralize this and anything else that needs to happen when we set or unset the blank page.

::: src/ephy-window.c
@@ +1788,3 @@
+					      "ViewCombinedStopReload");
+	ephy_action_change_sensitivity_flags (action,
+					      SENS_FLAG_IS_BLANK, is_blank);

Boy, the ephy_action_change_sensitivity_flags API is super confusing. So basically the actions won't be sensitive unless none of the flags are set? Is that what you want? Or am I reading the code wrong.

@@ +2659,3 @@
 					 G_CALLBACK (sync_tab_navigation),
 					 window, 0);
+		g_signal_connect_object (view, "notify::is-blank",

Forgot to disconnect the handler?
Comment 5 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 15:06:48 UTC
Created attachment 205888 [details] [review]
ephy-action-helper: document flags API

I also lost a few minutes trying to remember how this thing worked, and actually remembered that last time I didn't document it when I figured out how it worked.
So here's a docstring for it.
Comment 6 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 15:30:19 UTC
Created attachment 205891 [details] [review]
ephy-web-view: remove uneeded is_blank call

A trivial thing I found while working on this.
Comment 7 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 15:31:50 UTC
(In reply to comment #6)
> Created an attachment (id=205891) [details] [review]
> ephy-web-view: remove uneeded is_blank call
> 
> A trivial thing I found while working on this.

Just noticed I have a similar one in the main patch. Should I merge this into the main patch, or the other way around?
Comment 8 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 15:35:16 UTC
Created attachment 205892 [details] [review]
ephy-web-view: remove uneeded is_blank calls

Updated, with the other is_blank clean up from the main patch.
Comment 9 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 15:36:03 UTC
Created attachment 205893 [details] [review]
Updated with your comments. Now using an internal _ephy_web_view_set_is_blank

ephy-window: sync page actions with is-blank property

Add ::is-blank property to EphyWebView and update EphyWindow to sync
some of the page menu actions with it. There's no point in enabling
save/reload/bookmark/etc on about:blank.
Comment 10 Xan Lopez 2012-01-23 15:44:22 UTC
(In reply to comment #5)
> Created an attachment (id=205888) [details] [review]
> ephy-action-helper: document flags API
> 
> I also lost a few minutes trying to remember how this thing worked, and
> actually remembered that last time I didn't document it when I figured out how
> it worked.
> So here's a docstring for it.

So, I understood what the function does correctly. My question stands: are you sure we want to use it the way we are using it?
Comment 11 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 16:25:45 UTC
Review of attachment 205888 [details] [review]:

Done in bug #668510
Comment 12 Xan Lopez 2012-01-23 16:28:15 UTC
Review of attachment 205892 [details] [review]:

OK.
Comment 13 Xan Lopez 2012-01-23 16:31:24 UTC
Review of attachment 205893 [details] [review]:

::: embed/ephy-web-view.c
@@ +2514,3 @@
+
+  if (priv->is_blank != is_blank)
+  {

Brace in the previous line.

::: src/ephy-window.c
@@ +1788,3 @@
+					      "ViewCombinedStopReload");
+	ephy_action_change_sensitivity_flags (action,
+					      SENS_FLAG_IS_BLANK, is_blank);

Most of the code is all the same. I'm going to say OK for now, but we should do some cleanup and just have an array with the action names to be disabled on blank. Then write this as a for loop. Really.
Comment 14 Diego Escalante Urrelo (not reading bugmail) 2012-01-23 17:14:45 UTC
Done! Woohoo.

Attachment 205892 [details] pushed as d626c6f - ephy-web-view: remove uneeded is_blank calls