diff options
-rw-r--r-- | ChangeLog | 44 | ||||
-rw-r--r-- | data/art/Makefile.am | 1 | ||||
-rw-r--r-- | data/art/epiphany-popup-hidden.png | bin | 0 -> 1365 bytes | |||
-rw-r--r-- | data/art/epiphany-popup-hidden.svg | 218 | ||||
-rw-r--r-- | data/ui/epiphany-ui.xml | 1 | ||||
-rw-r--r-- | doc/reference/Makefile.am | 1 | ||||
-rw-r--r-- | doc/reference/epiphany-sections.txt | 1 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-embed-single.sgml | 11 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-embed.sgml | 46 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-permission-manager.sgml | 2 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-shell.sgml | 1 | ||||
-rw-r--r-- | doc/reference/tmpl/ephy-tab.sgml | 10 | ||||
-rw-r--r-- | doc/reference/tmpl/epiphany-unused.sgml | 18 | ||||
-rw-r--r-- | lib/ephy-stock-icons.c | 1 | ||||
-rw-r--r-- | lib/ephy-stock-icons.h | 1 | ||||
-rwxr-xr-x | src/ephy-statusbar.c | 62 | ||||
-rw-r--r-- | src/ephy-statusbar.h | 5 | ||||
-rw-r--r-- | src/ephy-tab.c | 324 | ||||
-rw-r--r-- | src/ephy-window.c | 137 |
19 files changed, 861 insertions, 23 deletions
@@ -1,3 +1,47 @@ +2004-06-30 Adam Hooper <adamh@cvs.gnome.org> + + * data/art/Makefile.am: + * data/art/epiphany-popup-hidden.png: + * data/art/epiphany-popup-hidden.svg: + * data/ui/epiphany-ui.xml: + * lib/ephy-stock-icons.c: (ephy_stock_icons_init): + * lib/ephy-stock-icons.h: + * src/ephy-statusbar.c: (create_statusbar_popups_manager_icon), + (ephy_statusbar_init), (ephy_statusbar_set_security_state), + (ephy_statusbar_set_popups_state): + * src/ephy-statusbar.h: + * src/ephy-tab.c: (ephy_tab_set_property), (ephy_tab_get_property), + (ephy_tab_class_init), (popups_manager_free_info), + (popups_manager_add), (popups_manager_remove_window), + (disconnect_popup), (popups_manager_add_window), + (ephy_tab_get_popups_displayed), (popups_manager_show), + (popups_manager_show_all), (popups_manager_new_window_info), + (popups_manager_hide), (popups_manager_hide_all), + (ephy_tab_set_popups_displayed), (popup_blocker_n_hidden), + (popups_manager_reset), (ephy_tab_finalize), (ephy_tab_address_cb), + (ephy_tab_new_window_cb), (ephy_tab_popup_blocked_cb), + (ephy_tab_init): + * src/ephy-window.c: (sync_tab_popup_windows), + (sync_tab_popups_allowed), (ephy_window_set_active_tab), + (ephy_window_get_property), (allow_popups_notifier), + (ephy_window_init), (ephy_window_finalize), (ephy_window_load_url), + (ephy_window_view_bookmarksbar_cb), + (ephy_window_view_popup_windows_cb): + + Popup blocking support. View -> Popup Windows. + + * doc/reference/Makefile.am: + * doc/reference/epiphany-sections.txt: + * doc/reference/tmpl/ephy-embed-single.sgml: + * doc/reference/tmpl/ephy-embed.sgml: + * doc/reference/tmpl/ephy-permission-manager.sgml: + * doc/reference/tmpl/ephy-shell.sgml: + * doc/reference/tmpl/ephy-tab.sgml: + * doc/reference/tmpl/epiphany-unused.sgml: + + Added a couple of docs, but mostly this is stuff that I imagine + nobody ever commits because it's all auto-generated. + 2004-06-30 Marco Pesenti Gritti <marco@gnome.org> * src/bookmarks/ephy-bookmarksbar.c: (open_in_tabs_cb): diff --git a/data/art/Makefile.am b/data/art/Makefile.am index a884cb18f..4960dae23 100644 --- a/data/art/Makefile.am +++ b/data/art/Makefile.am @@ -4,6 +4,7 @@ art_DATA = \ epiphany-entry.png \ epiphany-download.png \ epiphany-history.png \ + epiphany-popup-hidden.png \ epiphany-bookmarks.png \ epiphany-tab-loading.gif \ hand-open.png diff --git a/data/art/epiphany-popup-hidden.png b/data/art/epiphany-popup-hidden.png Binary files differnew file mode 100644 index 000000000..b990f90da --- /dev/null +++ b/data/art/epiphany-popup-hidden.png diff --git a/data/art/epiphany-popup-hidden.svg b/data/art/epiphany-popup-hidden.svg new file mode 100644 index 000000000..8e89f653b --- /dev/null +++ b/data/art/epiphany-popup-hidden.svg @@ -0,0 +1,218 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" +"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<!-- Created with Sodipodi ("http://www.sodipodi.com/") --> +<svg + version="1.0" + x="0" + y="0" + width="528.2800pt" + height="490.8900pt" + id="svg602" + xml:space="preserve" + sodipodi:version="0.33" + sodipodi:docname="popup-blocker.svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xml="http://www.w3.org/XML/1998/namespace" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <sodipodi:namedview + id="base" /> + <defs + id="defs604"> + <linearGradient + id="linearGradient715"> + <stop + style="stop-color:#990000;stop-opacity:1;" + offset="0" + id="stop716" /> + <stop + style="stop-color:#df421e;stop-opacity:1;" + offset="1" + id="stop717" /> + </linearGradient> + <linearGradient + id="linearGradient705"> + <stop + style="stop-color:#00003a;stop-opacity:1;" + offset="0" + id="stop706" /> + <stop + style="stop-color:#00008f;stop-opacity:1;" + offset="1" + id="stop707" /> + </linearGradient> + <linearGradient + id="linearGradient702"> + <stop + style="stop-color:#1782c2;stop-opacity:1;" + offset="0" + id="stop703" /> + <stop + style="stop-color:#454fb7;stop-opacity:1;" + offset="1" + id="stop704" /> + </linearGradient> + <linearGradient + id="linearGradient699"> + <stop + style="stop-color:#4b6983;stop-opacity:1;" + offset="0" + id="stop700" /> + <stop + style="stop-color:#7590ae;stop-opacity:1;" + offset="1" + id="stop701" /> + </linearGradient> + <linearGradient + id="linearGradient695"> + <stop + style="stop-color:#174d87;stop-opacity:1;" + offset="0" + id="stop696" /> + <stop + style="stop-color:#454f8a;stop-opacity:1;" + offset="1" + id="stop697" /> + </linearGradient> + <linearGradient + id="linearGradient685"> + <stop + style="stop-color:#cccccc;stop-opacity:1;" + offset="0" + id="stop686" /> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="1" + id="stop687" /> + </linearGradient> + <linearGradient + id="linearGradient611"> + <stop + style="stop-color:#b8b7b5;stop-opacity:1;" + offset="0" + id="stop612" /> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="1" + id="stop613" /> + </linearGradient> + <linearGradient + id="linearGradient607"> + <stop + style="stop-color:#8f8f8f;stop-opacity:1;" + offset="0" + id="stop608" /> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="1" + id="stop609" /> + </linearGradient> + <linearGradient + x1="1.11229956" + y1="0.03124872" + x2="-0.18181817" + y2="0.69531250" + id="linearGradient610" + xlink:href="#linearGradient611" /> + <linearGradient + x1="1.00444412" + y1="5.80643155e-2" + x2="2.7020219e-8" + y2="1.08387113" + id="linearGradient614" + xlink:href="#linearGradient705" /> + <linearGradient + x1="-0.10190773" + y1="0.89680094" + x2="1.14012647" + y2="-0.21290262" + id="linearGradient684" + xlink:href="#linearGradient611" /> + <radialGradient + id="radialGradient688" + xlink:href="#linearGradient715" /> + <radialGradient + cx="1.22481334" + cy="0.05469547" + r="1.98268783" + fx="1.22481334" + fy="0.05469547" + id="radialGradient690" + xlink:href="#linearGradient611" /> + <linearGradient + x1="0.99999976" + y1="0.21093579" + x2="0.99999988" + y2="0.22656254" + id="linearGradient698" + xlink:href="#linearGradient699" + spreadMethod="reflect" /> + <linearGradient + x1="0.48942447" + y1="-0.09708764" + x2="0.06760809" + y2="1.80522752" + id="linearGradient714" + xlink:href="#linearGradient715" /> + </defs> + <rect + width="550.7690" + height="452.4174" + x="14.21332" + y="15.14543" + style="font-size:12;fill:url(#linearGradient698);fill-rule:evenodd;stroke:#314e6c;stroke-width:10.625;stroke-opacity:1;" + id="rect605" /> + <rect + width="488.4797" + height="337.6739" + x="43.71883" + y="100.3835" + style="font-size:12;fill:url(#linearGradient610);fill-rule:evenodd;stroke:#314e6c;stroke-width:5.1125;stroke-opacity:1;" + id="rect606" /> + <rect + width="49.49750" + height="49.49746" + x="485.3400" + y="32.88261" + style="font-size:12;fill:url(#radialGradient690);fill-rule:evenodd;stroke:url(#linearGradient684);stroke-width:3.71875;" + id="rect691" /> + <rect + width="49.49750" + height="49.49746" + x="421.7003" + y="32.88258" + style="font-size:12;fill:url(#radialGradient690);fill-rule:evenodd;stroke:url(#linearGradient684);stroke-width:3.71875;" + id="rect692" /> + <rect + width="49.49750" + height="49.49746" + x="358.0607" + y="32.88255" + style="font-size:12;fill:url(#radialGradient690);fill-rule:evenodd;stroke:url(#linearGradient684);stroke-width:3.71875;" + id="rect693" /> + <rect + width="49.49750" + height="49.49746" + x="46.93361" + y="32.88252" + style="font-size:12;fill:url(#radialGradient690);fill-rule:evenodd;stroke:url(#linearGradient684);stroke-width:3.71875;" + id="rect694" /> + <path + d="M 584.5339 539.1726 C 493.7369 629.9696 346.5259 629.9696 255.7288 539.1725 C 164.9318 448.3755 164.9317 301.1644 255.7288 210.3674 C 346.5258 119.5703 493.7369 119.5703 584.5339 210.3674 C 675.3310 301.1644 675.3310 448.3755 584.5339 539.1726 z " + style="font-size:12.000;fill:url(#linearGradient714);fill-rule:evenodd;stroke:#000000;stroke-width:9.637834;" + id="path648" /> + <g + transform="matrix(1.047217,0,0,1.047217,-1127.623,-286.0443)" + style="font-size:12;stroke:#df421e;stroke-opacity:1;" + id="g711"> + <path + d="M 1348.416 714.203 C 1300.301 666.0883 1307.851 580.5294 1365.278 523.1027 C 1422.705 465.6754 1508.264 458.1261 1556.378 506.2408 L 1348.416 714.203 z " + style="fill:#ffffff;fill-rule:evenodd;stroke-width:5.57963;stroke:#df421e;stroke-opacity:1;" + id="path647" /> + <path + d="M 1394.786 760.5729 C 1442.901 808.6876 1528.46 801.138 1585.886 743.7113 C 1643.314 686.2841 1650.863 600.7254 1602.748 552.6107 L 1394.786 760.5729 z " + style="fill:#ffffff;fill-rule:evenodd;stroke-width:5.57963;stroke:#df421e;stroke-opacity:1;" + id="path679" /> + </g> +</svg> diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml index 73a740796..6a5cfbbfb 100644 --- a/data/ui/epiphany-ui.xml +++ b/data/ui/epiphany-ui.xml @@ -49,6 +49,7 @@ <placeholder name="ViewEncodingPlaceholder"/> </menu> <menuitem name="ViewPageSourceMenu" action="ViewPageSource"/> + <menuitem name="ViewPopupsMenu" action="ViewPopupWindows"/> <separator name="ViewSep3"/> <menuitem name="ViewStopMenu" action="ViewStop"/> <menuitem name="ViewReloadMenu" action="ViewReload"/> diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am index 33da0122c..0915791a3 100644 --- a/doc/reference/Makefile.am +++ b/doc/reference/Makefile.am @@ -159,6 +159,7 @@ GTKDOC_CFLAGS = -I$(top_srcdir)/src \ -I$(top_srcdir)/embed \ -I$(top_srcdir)/embed/mozilla \ -I$(top_srcdir)/src/bookmarks \ + -I$(top_srcdir)/lib/egg \ $(EPIPHANY_DEPENDENCY_CFLAGS) GTKDOC_LIBS = \ diff --git a/doc/reference/epiphany-sections.txt b/doc/reference/epiphany-sections.txt index 8d5750e4b..94f6edfa3 100644 --- a/doc/reference/epiphany-sections.txt +++ b/doc/reference/epiphany-sections.txt @@ -140,6 +140,7 @@ ephy_embed_single_clear_auth_cache ephy_embed_single_set_offline_mode ephy_embed_single_load_proxy_autoconf ephy_embed_single_get_font_list +ephy_embed_single_open_window <SUBSECTION Standard> EPHY_EMBED_SINGLE EPHY_IS_EMBED_SINGLE diff --git a/doc/reference/tmpl/ephy-embed-single.sgml b/doc/reference/tmpl/ephy-embed-single.sgml index 3368ee788..ed0f624b1 100644 --- a/doc/reference/tmpl/ephy-embed-single.sgml +++ b/doc/reference/tmpl/ephy-embed-single.sgml @@ -90,3 +90,14 @@ is used to perform browser-related actions which do not refer to an individual @langGroup: +<!-- ##### FUNCTION ephy_embed_single_open_window ##### --> +<para> + +</para> + +@single: +@parent: +@address: +@features: + + diff --git a/doc/reference/tmpl/ephy-embed.sgml b/doc/reference/tmpl/ephy-embed.sgml index 92c329f48..618b13006 100644 --- a/doc/reference/tmpl/ephy-embed.sgml +++ b/doc/reference/tmpl/ephy-embed.sgml @@ -42,6 +42,14 @@ be done by casting). </para> +<!-- ##### SIGNAL EphyEmbed::ge-content-change ##### --> +<para> + +</para> + +@ephyembed: the object which received the signal. +@arg1: + <!-- ##### SIGNAL EphyEmbed::ge-context-menu ##### --> <para> @@ -103,6 +111,21 @@ be done by casting). @arg1: @arg2: +<!-- ##### SIGNAL EphyEmbed::ge-popup-blocked ##### --> +<para> + +</para> + +@ephyembed: the object which received the signal. +@: +@: +@: +@: +@: +@: +@: +@: + <!-- ##### SIGNAL EphyEmbed::ge-security-change ##### --> <para> @@ -135,6 +158,7 @@ be done by casting). @popup_blocked: @security_change: @zoom_change: +@content_change: @load_url: @stop_load: @reload: @@ -162,7 +186,7 @@ be done by casting). @has_automatic_encoding: @set_encoding: @print: -@print_preview_close: +@set_print_preview_mode: @print_preview_n_pages: @print_preview_navigate: @activate: @@ -199,14 +223,6 @@ windows opened with JavaScript often use a nonstandard chrome. to display its statusbar. @EPHY_EMBED_CHROME_BOOKMARKSBAR: -<!-- ##### ENUM EmbedReloadFlags ##### --> -<para> - -</para> - -@EMBED_RELOAD_NORMAL: -@EMBED_RELOAD_FORCE: Bypass cache and proxy while reloading a web page - <!-- ##### ENUM EmbedPrintPreviewNavType ##### --> <para> Specifies the action to perform in ephy_embed_print_preview_navigate(). @@ -254,6 +270,8 @@ invalid SSL certificate will have an #EmbedSecurityLevel of %STATE_IS_BROKEN. </para> @embed: +@force: +<!-- # Unused Parameters # --> @flags: @@ -410,6 +428,7 @@ invalid SSL certificate will have an #EmbedSecurityLevel of %STATE_IS_BROKEN. @embed: @zoom: +<!-- # Unused Parameters # --> @reflow: @@ -458,17 +477,10 @@ invalid SSL certificate will have an #EmbedSecurityLevel of %STATE_IS_BROKEN. </para> @embed: +<!-- # Unused Parameters # --> @info: -<!-- ##### FUNCTION ephy_embed_print_preview_close ##### --> -<para> - -</para> - -@embed: - - <!-- ##### FUNCTION ephy_embed_print_preview_n_pages ##### --> <para> diff --git a/doc/reference/tmpl/ephy-permission-manager.sgml b/doc/reference/tmpl/ephy-permission-manager.sgml index 93abf486c..c03dc1efa 100644 --- a/doc/reference/tmpl/ephy-permission-manager.sgml +++ b/doc/reference/tmpl/ephy-permission-manager.sgml @@ -49,7 +49,7 @@ Details a specific permission of a specific website. </para> @host: The hostname of the website to which this permission applies. -@type: An #EphyPermissionType. +@qtype: @permission: An #EphyPermission (either allow or deny). <!-- ##### ENUM EphyPermission ##### --> diff --git a/doc/reference/tmpl/ephy-shell.sgml b/doc/reference/tmpl/ephy-shell.sgml index aa85f4812..6c9e8b68d 100644 --- a/doc/reference/tmpl/ephy-shell.sgml +++ b/doc/reference/tmpl/ephy-shell.sgml @@ -59,7 +59,6 @@ ephy-shell @EPHY_NEW_TAB_NEW_PAGE: @EPHY_NEW_TAB_OPEN_PAGE: @EPHY_NEW_TAB_FULLSCREEN_MODE: -@EPHY_NEW_TAB_APPEND_GROUPED: @EPHY_NEW_TAB_APPEND_LAST: @EPHY_NEW_TAB_APPEND_AFTER: @EPHY_NEW_TAB_JUMP: diff --git a/doc/reference/tmpl/ephy-tab.sgml b/doc/reference/tmpl/ephy-tab.sgml index aa6599bfa..2ef0a5ade 100644 --- a/doc/reference/tmpl/ephy-tab.sgml +++ b/doc/reference/tmpl/ephy-tab.sgml @@ -29,6 +29,11 @@ To retrieve an #EphyTab's parent #EphyWindow, use gtk_widget_get_toplevel(). </para> +<!-- ##### ARG EphyTab:hidden-popup-count ##### --> +<para> + +</para> + <!-- ##### ARG EphyTab:icon ##### --> <para> @@ -54,6 +59,11 @@ To retrieve an #EphyTab's parent #EphyWindow, use gtk_widget_get_toplevel(). </para> +<!-- ##### ARG EphyTab:popups-allowed ##### --> +<para> + +</para> + <!-- ##### ARG EphyTab:security-level ##### --> <para> diff --git a/doc/reference/tmpl/epiphany-unused.sgml b/doc/reference/tmpl/epiphany-unused.sgml index 548bd69cf..142307092 100644 --- a/doc/reference/tmpl/epiphany-unused.sgml +++ b/doc/reference/tmpl/epiphany-unused.sgml @@ -38,12 +38,13 @@ mozilla-embed-event </para> -<!-- ##### SIGNAL EphyEmbed::ge-popup-blocked ##### --> +<!-- ##### ENUM EmbedReloadFlags ##### --> <para> </para> -@ephyembed: the object which received the signal. +@EMBED_RELOAD_NORMAL: +@EMBED_RELOAD_FORCE: Bypass cache and proxy while reloading a web page <!-- ##### SIGNAL EphyEmbedPersist::cancelled ##### --> <para> @@ -107,6 +108,12 @@ mozilla-embed-event </para> +<!-- ##### ARG EphyTab:blocked-popup-count ##### --> +<para> + +</para> + + <!-- ##### FUNCTION ephy_embed_get_encoding_info ##### --> <para> @@ -122,6 +129,13 @@ mozilla-embed-event @Returns: +<!-- ##### FUNCTION ephy_embed_print_preview_close ##### --> +<para> + +</para> + +@embed: + <!-- ##### FUNCTION ephy_shell_delete_on_exit ##### --> <para> diff --git a/lib/ephy-stock-icons.c b/lib/ephy-stock-icons.c index 8bbd77383..6134dce4e 100644 --- a/lib/ephy-stock-icons.c +++ b/lib/ephy-stock-icons.c @@ -53,6 +53,7 @@ ephy_stock_icons_init (void) { { EPHY_STOCK_SECURE, N_("Secure"), 0, 0, NULL }, { EPHY_STOCK_UNSECURE, N_("Insecure"), 0, 0, NULL }, + { EPHY_STOCK_POPUPS, N_("Popup Windows"), 0, 0, NULL }, { EPHY_STOCK_HISTORY, N_("History"), 0, 0, NULL }, { EPHY_STOCK_BOOKMARKS, N_("Bookmarks"), 0, 0, NULL }, { EPHY_STOCK_ENTRY, N_("Address Entry"), 0, 0, NULL }, diff --git a/lib/ephy-stock-icons.h b/lib/ephy-stock-icons.h index ab809215f..4984c2d13 100644 --- a/lib/ephy-stock-icons.h +++ b/lib/ephy-stock-icons.h @@ -25,6 +25,7 @@ G_BEGIN_DECLS #define EPHY_STOCK_SECURE "epiphany-secure" #define EPHY_STOCK_UNSECURE "epiphany-unsecure" +#define EPHY_STOCK_POPUPS "epiphany-popup-hidden" #define EPHY_STOCK_HISTORY "epiphany-history" #define EPHY_STOCK_BOOKMARKS "epiphany-bookmarks" #define EPHY_STOCK_ENTRY "epiphany-entry" diff --git a/src/ephy-statusbar.c b/src/ephy-statusbar.c index 1e8d22259..8e2e8c475 100755 --- a/src/ephy-statusbar.c +++ b/src/ephy-statusbar.c @@ -50,6 +50,8 @@ struct EphyStatusbarPrivate GtkWidget *security_icon; GtkWidget *progressbar; GtkWidget *security_evbox; + GtkWidget *popups_manager_icon; + GtkWidget *popups_manager_evbox; }; GType @@ -118,6 +120,36 @@ create_statusbar_security_icon (EphyStatusbar *s) } static void +create_statusbar_popups_manager_icon (EphyStatusbar *s) +{ + s->popups_manager_frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (s->popups_manager_frame), + GTK_SHADOW_IN); + + s->priv->popups_manager_icon = gtk_image_new_from_stock + (EPHY_STOCK_POPUPS, GTK_ICON_SIZE_MENU); + + s->priv->popups_manager_evbox = gtk_event_box_new (); + + gtk_event_box_set_visible_window + (GTK_EVENT_BOX (s->priv->popups_manager_evbox), FALSE); + + gtk_container_add (GTK_CONTAINER (s->popups_manager_frame), + GTK_WIDGET (s->priv->popups_manager_evbox)); + gtk_container_add (GTK_CONTAINER (s->priv->popups_manager_evbox), + GTK_WIDGET (s->priv->popups_manager_icon)); + + gtk_widget_show (s->priv->popups_manager_evbox); + gtk_widget_show (s->priv->popups_manager_icon); + + /* note lack of gtk_widget_show (s->popups_manager_frame); */ + + gtk_box_pack_start (GTK_BOX (s->priv->icon_container), + GTK_WIDGET (s->popups_manager_frame), + FALSE, TRUE, 0); +} + +static void create_statusbar_progress (EphyStatusbar *s) { s->priv->progressbar = gtk_progress_bar_new (); @@ -170,6 +202,7 @@ ephy_statusbar_init (EphyStatusbar *t) create_statusbar_progress (t); create_statusbar_security_icon (t); + create_statusbar_popups_manager_icon (t); /* FIXME: is this the right way ? */ sync_shadow_type (t, NULL, NULL); @@ -202,7 +235,7 @@ ephy_statusbar_new (void) /** * ephy_statusbar_set_security_state: - * @statusbar: a #EphyStatusbar + * @statusbar: an #EphyStatusbar * @secure: whether to set the icon to show secure or insecure * @tooltip: a string detailing the security state * @@ -225,6 +258,33 @@ ephy_statusbar_set_security_state (EphyStatusbar *statusbar, } /** + * ephy_statusbar_set_popups_state: + * @statusbar: an #EphyStatusbar + * @hidden: %TRUE if popups have been hidden + * @tooltip: a string to display as tooltip, or %NULL + * + * Sets the statusbar's popup-blocker icon's tooltip and visibility. + **/ +void +ephy_statusbar_set_popups_state (EphyStatusbar *statusbar, + gboolean hidden, + const char *tooltip) +{ + if (hidden) + { + gtk_widget_hide (statusbar->popups_manager_frame); + } + else + { + gtk_tooltips_set_tip (statusbar->tooltips, + statusbar->priv->popups_manager_evbox, + tooltip, NULL); + + gtk_widget_show (statusbar->popups_manager_frame); + } +} + +/** * ephy_statusbar_set_progress: * @statusbar: a #EphyStatusbar * @progress: the progress as an integer between 0 and 100 per cent. diff --git a/src/ephy-statusbar.h b/src/ephy-statusbar.h index ed6c44844..8ca1b5af4 100644 --- a/src/ephy-statusbar.h +++ b/src/ephy-statusbar.h @@ -46,6 +46,7 @@ struct EphyStatusbar /*< public >*/ GtkTooltips *tooltips; GtkWidget *security_frame; + GtkWidget *popups_manager_frame; /*< private >*/ EphyStatusbarPrivate *priv; @@ -64,6 +65,10 @@ void ephy_statusbar_set_security_state (EphyStatusbar *statusbar, gboolean secure, const char *tooltip); +void ephy_statusbar_set_popups_state (EphyStatusbar *statusbar, + gboolean hidden, + const char *tooltip); + void ephy_statusbar_set_progress (EphyStatusbar *statusbar, int progress); diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 33fd8ea01..a55759d89 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -2,6 +2,7 @@ * Copyright (C) 2000-2003 Marco Pesenti Gritti * Copyright (C) 2003, 2004 Christian Persch * Copyright (C) 2004 Crispin Flowerday + * Copyright (C) 2004 Adam Hooper * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +39,9 @@ #include "ephy-embed-persist.h" #include "ephy-history.h" #include "ephy-embed-shell.h" +#include "ephy-embed-single.h" #include "ephy-shell.h" +#include "ephy-permission-manager.h" #include <glib/gi18n.h> #include <libgnomevfs/gnome-vfs-uri.h> @@ -81,6 +84,8 @@ struct EphyTabPrivate float zoom; gboolean setting_zoom; EmbedSecurityLevel security_level; + GSList *hidden_popups; + GSList *shown_popups; TabNavigationFlags nav_flags; }; @@ -98,11 +103,19 @@ enum PROP_MESSAGE, PROP_NAVIGATION, PROP_SECURITY, + PROP_HIDDEN_POPUP_COUNT, + PROP_DISPLAY_POPUPS, PROP_TITLE, PROP_VISIBLE, PROP_ZOOM }; +typedef struct +{ + char *url; + char *features; +} PopupInfo; + static GObjectClass *parent_class = NULL; static gulong tab_id = 0; @@ -125,6 +138,10 @@ static void ephy_tab_set_title (EphyTab *tab, const char *new_title); static void ephy_tab_set_zoom (EphyTab *tab, float zoom); +static guint popup_blocker_n_hidden (EphyTab *tab); +static gboolean ephy_tab_get_popups_displayed (EphyTab *tab); +static void ephy_tab_set_popups_displayed (EphyTab *tab, + gboolean allowed); /* Class functions */ @@ -171,12 +188,17 @@ ephy_tab_set_property (GObject *object, ephy_tab_set_location (tab, g_value_get_string (value), TAB_ADDRESS_EXPIRE_NOW); break; + case PROP_DISPLAY_POPUPS: + ephy_tab_set_popups_displayed + (tab, g_value_get_boolean (value)); + break; case PROP_ICON: case PROP_LOAD_PROGRESS: case PROP_LOAD_STATUS: case PROP_MESSAGE: case PROP_NAVIGATION: case PROP_SECURITY: + case PROP_HIDDEN_POPUP_COUNT: case PROP_TITLE: case PROP_VISIBLE: case PROP_ZOOM: @@ -216,6 +238,13 @@ ephy_tab_get_property (GObject *object, case PROP_SECURITY: g_value_set_int (value, tab->priv->security_level); break; + case PROP_HIDDEN_POPUP_COUNT: + g_value_set_int (value, popup_blocker_n_hidden (tab)); + break; + case PROP_DISPLAY_POPUPS: + g_value_set_boolean + (value, ephy_tab_get_popups_displayed (tab)); + break; case PROP_TITLE: g_value_set_string (value, tab->priv->title); break; @@ -351,6 +380,24 @@ ephy_tab_class_init (EphyTabClass *class) G_PARAM_READABLE)); g_object_class_install_property (object_class, + PROP_HIDDEN_POPUP_COUNT, + g_param_spec_int ("hidden-popup-count", + "Number of Blocked Popups", + "The tab's number of blocked popup windows", + 0, + G_MAXINT, + 0, + G_PARAM_READABLE)); + + g_object_class_install_property (object_class, + PROP_DISPLAY_POPUPS, + g_param_spec_boolean ("popups-allowed", + "Popups Allowed", + "Whether popup windows are to be displayed", + FALSE, + G_PARAM_READABLE | G_PARAM_WRITABLE)); + + g_object_class_install_property (object_class, PROP_TITLE, g_param_spec_string ("title", "Title", @@ -380,6 +427,266 @@ ephy_tab_class_init (EphyTabClass *class) } static void +popups_manager_free_info (PopupInfo *popup) +{ + g_free (popup->url); + g_free (popup->features); + g_free (popup); +} + +static void +popups_manager_add (EphyTab *tab, + const char *url, + const char *features) +{ + PopupInfo *popup; + + LOG ("popups_manager_add: tab %p, url %s, features %s", + tab, url, features) + + g_return_if_fail (EPHY_IS_TAB (tab)); + + popup = g_new0 (PopupInfo, 1); + + popup->url = g_strdup (url); + popup->features = g_strdup (features); + + tab->priv->hidden_popups = g_slist_prepend + (tab->priv->hidden_popups, popup); + + g_object_notify (G_OBJECT (tab), "hidden-popup-count"); +} + +static gboolean +popups_manager_remove_window (EphyTab *tab, + EphyWindow *window) +{ + tab->priv->shown_popups = g_slist_remove (tab->priv->shown_popups, + window); + + return FALSE; +} + +static void +disconnect_popup (EphyWindow *window, + EphyTab *tab) +{ + g_signal_handlers_disconnect_by_func + (window, G_CALLBACK (popups_manager_remove_window), tab); +} + +static void +popups_manager_add_window (EphyTab *tab, + EphyWindow *window) +{ + LOG ("popups_manager_add_window: tab %p, window %p", tab, window) + + g_return_if_fail (EPHY_IS_TAB (tab)); + g_return_if_fail (EPHY_IS_WINDOW (window)); + + tab->priv->shown_popups = g_slist_prepend + (tab->priv->shown_popups, window); + + g_signal_connect_swapped (window, "destroy", + G_CALLBACK (popups_manager_remove_window), + tab); +} + +static gboolean +ephy_tab_get_popups_displayed (EphyTab *tab) +{ + EphyPermissionManager *permission_manager; + EphyPermission response; + EphyEmbed *embed; + char *location; + gboolean allow; + + g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE); + + permission_manager = EPHY_PERMISSION_MANAGER + (ephy_embed_shell_get_embed_single (embed_shell)); + g_return_val_if_fail (EPHY_IS_PERMISSION_MANAGER (permission_manager), + FALSE); + + embed = ephy_tab_get_embed (tab); + g_return_val_if_fail (EPHY_IS_EMBED (embed), FALSE); + + location = ephy_embed_get_location (embed, TRUE); + if (location == NULL) return FALSE; /* FALSE, TRUE... same thing */ + + response = ephy_permission_manager_test + (permission_manager, location, EPT_POPUP); + + switch (response) + { + case EPHY_PERMISSION_ALLOWED: + allow = TRUE; + break; + case EPHY_PERMISSION_DENIED: + allow = FALSE; + break; + case EPHY_PERMISSION_DEFAULT: + default: + allow = eel_gconf_get_boolean + (CONF_SECURITY_ALLOW_POPUPS); + break; + } + + g_free (location); + + LOG ("ephy_tab_get_popups_displayed: tab %p, allowed: %d", tab, allow) + + return allow; +} + +static void +popups_manager_show (PopupInfo *popup, + EphyTab *tab) +{ + EphyEmbed *embed; + EphyEmbedSingle *single; + + embed = ephy_tab_get_embed (tab); + + single = EPHY_EMBED_SINGLE + (ephy_embed_shell_get_embed_single (embed_shell)); + + ephy_embed_single_open_window (single, embed, popup->url, + popup->features); + + popups_manager_free_info (popup); +} + +static void +popups_manager_show_all (EphyTab *tab) +{ + LOG ("popup_blocker_show_all: tab %p", tab) + + g_slist_foreach (tab->priv->hidden_popups, + (GFunc) popups_manager_show, tab); + g_slist_free (tab->priv->hidden_popups); + tab->priv->hidden_popups = NULL; + + g_object_notify (G_OBJECT (tab), "hidden-popup-count"); +} + +static char * +popups_manager_new_window_info (EphyWindow *window) +{ + EphyEmbedChrome chrome; + char *features; + int w, h; + + g_object_get (window, "chrome", &chrome, NULL); + gtk_window_get_size (GTK_WINDOW (window), &w, &h); + + features = g_strdup_printf + ("width=%d,height=%d,menubar=%d,status=%d,toolbar=%d", + w, h, + (chrome & EPHY_EMBED_CHROME_MENUBAR) > 0, + (chrome & EPHY_EMBED_CHROME_STATUSBAR) > 0, + (chrome & EPHY_EMBED_CHROME_TOOLBAR) > 0); + + return features; +} + +static void +popups_manager_hide (EphyWindow *window, + EphyTab *parent_tab) +{ + EphyEmbed *embed; + char *location; + char *features; + + embed = ephy_window_get_active_embed (window); + g_return_if_fail (EPHY_IS_EMBED (embed)); + + location = ephy_embed_get_location (embed, TRUE); + if (location == NULL) return; + + features = popups_manager_new_window_info (window); + + popups_manager_add (parent_tab, location, features); + + gtk_widget_destroy (GTK_WIDGET (window)); + + g_free (location); + g_free (features); +} + +static void +popups_manager_hide_all (EphyTab *tab) +{ + LOG ("popup_blocker_hide_all: tab %p", tab) + + g_slist_foreach (tab->priv->shown_popups, + (GFunc) popups_manager_hide, tab); + g_slist_free (tab->priv->shown_popups); + tab->priv->shown_popups = NULL; +} + +static void +ephy_tab_set_popups_displayed (EphyTab *tab, + gboolean allowed) +{ + char *location; + EphyEmbed *embed; + EphyPermissionManager *manager; + EphyPermission permission; + + g_return_if_fail (EPHY_IS_TAB (tab)); + + embed = ephy_tab_get_embed (tab); + + location = ephy_embed_get_location (embed, TRUE); + g_return_if_fail (location != NULL); + + manager = EPHY_PERMISSION_MANAGER + (ephy_embed_shell_get_embed_single (embed_shell)); + g_return_if_fail (EPHY_IS_PERMISSION_MANAGER (manager)); + + permission = allowed ? EPHY_PERMISSION_ALLOWED + : EPHY_PERMISSION_DENIED; + + ephy_permission_manager_add (manager, location, EPT_POPUP, permission); + + if (allowed) + { + popups_manager_show_all (tab); + } + else + { + popups_manager_hide_all (tab); + } + + g_free (location); +} + +static guint +popup_blocker_n_hidden (EphyTab *tab) +{ + return g_slist_length (tab->priv->hidden_popups); +} + +static void +popups_manager_reset (EphyTab *tab) +{ + g_return_if_fail (EPHY_IS_TAB (tab)); + + g_slist_foreach (tab->priv->hidden_popups, + (GFunc) popups_manager_free_info, NULL); + g_slist_free (tab->priv->hidden_popups); + tab->priv->hidden_popups = NULL; + + g_slist_foreach (tab->priv->shown_popups, + (GFunc) disconnect_popup, tab); + g_slist_free (tab->priv->shown_popups); + tab->priv->shown_popups = NULL; + + g_object_notify (G_OBJECT (tab), "hidden-popup-count"); +} + +static void ephy_tab_finalize (GObject *object) { EphyTab *tab = EPHY_TAB (object); @@ -396,6 +703,7 @@ ephy_tab_finalize (GObject *object) g_free (tab->priv->icon_address); g_free (tab->priv->link_message); g_free (tab->priv->status_message); + popups_manager_reset (tab); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -676,6 +984,8 @@ ephy_tab_address_cb (EphyEmbed *embed, const char *address, EphyTab *tab) ephy_tab_set_link_message (tab, NULL); ephy_tab_set_icon_address (tab, NULL); ephy_tab_update_navigation_flags (tab, embed); + popups_manager_reset (tab); + g_object_notify (G_OBJECT (tab), "popups-allowed"); } static void @@ -954,6 +1264,15 @@ ephy_tab_new_window_cb (EphyEmbed *embed, EphyEmbed **new_embed, ephy_window_add_tab (window, new_tab, EPHY_NOTEBOOK_ADD_LAST, FALSE); *new_embed = ephy_tab_get_embed (new_tab); + + popups_manager_add_window (tab, window); +} + +static void +ephy_tab_popup_blocked_cb (EphyEmbed *embed, const char *url, + const char *features, EphyTab *tab) +{ + popups_manager_add (tab, url, features); } static gboolean @@ -1230,6 +1549,8 @@ ephy_tab_init (EphyTab *tab) tab->priv->load_status = FALSE; tab->priv->link_message = NULL; tab->priv->security_level = STATE_IS_UNKNOWN; + tab->priv->hidden_popups = NULL; + tab->priv->shown_popups = NULL; tab->priv->zoom = 1.0; tab->priv->setting_zoom = FALSE; tab->priv->address_expire = TAB_ADDRESS_EXPIRE_NOW; @@ -1270,6 +1591,9 @@ ephy_tab_init (EphyTab *tab) g_signal_connect_object (embed, "ge_new_window", G_CALLBACK (ephy_tab_new_window_cb), tab, 0); + g_signal_connect_object (embed, "ge_popup_blocked", + G_CALLBACK (ephy_tab_popup_blocked_cb), + tab, 0); g_signal_connect_object (embed, "visibility", G_CALLBACK (ephy_tab_visibility_cb), tab, 0); diff --git a/src/ephy-window.c b/src/ephy-window.c index f003a1961..b365c4f47 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -81,6 +81,8 @@ static void ephy_window_view_toolbar_cb (GtkAction *action, EphyWindow *window); static void ephy_window_view_bookmarksbar_cb (GtkAction *action, EphyWindow *window); +static void ephy_window_view_popup_windows_cb (GtkAction *action, + EphyWindow *window); static GtkActionEntry ephy_menu_entries [] = { @@ -263,6 +265,9 @@ static GtkToggleActionEntry ephy_menu_toggle_entries [] = { "ViewFullscreen", STOCK_FULLSCREEN, N_("_Fullscreen"), "F11", N_("Browse at full screen"), G_CALLBACK (window_cmd_view_fullscreen), FALSE }, + { "ViewPopupWindows", EPHY_STOCK_POPUPS, N_("Popup _Windows"), NULL, + N_("Show or hide unrequested popup windows from this site"), + G_CALLBACK (ephy_window_view_popup_windows_cb), FALSE }, { "BrowseWithCaret", NULL, N_("Selection Caret"), "F7", "", G_CALLBACK (window_cmd_browse_with_caret), FALSE } @@ -359,6 +364,7 @@ struct EphyWindowPrivate guint disable_save_to_disk_notifier_id; guint disable_command_line_notifier_id; guint browse_with_caret_notifier_id; + guint allow_popups_notifier_id; }; enum @@ -1268,6 +1274,64 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) } static void +sync_tab_popup_windows (EphyTab *tab, + GParamSpec *pspec, + EphyWindow *window) +{ + guint num_popups = 0; + char *tooltip = NULL; + + g_object_get (G_OBJECT (tab), + "hidden-popup-count", &num_popups, + NULL); + + if (num_popups > 0) + { + tooltip = g_strdup_printf (ngettext ("%d hidden popup window", + "%d hidden popup windows", + num_popups), + num_popups); + } + + ephy_statusbar_set_popups_state + (EPHY_STATUSBAR (window->priv->statusbar), + tooltip == NULL, + tooltip); + + g_free (tooltip); +} + +static void +sync_tab_popups_allowed (EphyTab *tab, + GParamSpec *pspec, + EphyWindow *window) +{ + GtkAction *action; + gboolean allow; + + g_return_if_fail (EPHY_IS_TAB (tab)); + g_return_if_fail (EPHY_IS_WINDOW (window)); + + action = gtk_action_group_get_action (window->priv->action_group, + "ViewPopupWindows"); + g_return_if_fail (GTK_IS_ACTION (action)); + + g_object_get (G_OBJECT (tab), "popups-allowed", &allow, NULL); + + g_signal_handlers_block_by_func + (G_OBJECT (action), + G_CALLBACK (ephy_window_view_popup_windows_cb), + window); + + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), allow); + + g_signal_handlers_unblock_by_func + (G_OBJECT (action), + G_CALLBACK (ephy_window_view_popup_windows_cb), + window); +} + +static void sync_tab_load_status (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) { GtkAction *action; @@ -1555,6 +1619,12 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) G_CALLBACK (sync_tab_security), window); g_signal_handlers_disconnect_by_func (G_OBJECT (old_tab), + G_CALLBACK (sync_tab_popup_windows), + window); + g_signal_handlers_disconnect_by_func (G_OBJECT (old_tab), + G_CALLBACK (sync_tab_popups_allowed), + window); + g_signal_handlers_disconnect_by_func (G_OBJECT (old_tab), G_CALLBACK (sync_tab_title), window); g_signal_handlers_disconnect_by_func (G_OBJECT (old_tab), @@ -1581,6 +1651,8 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) sync_tab_message (new_tab, NULL, window); sync_tab_navigation (new_tab, NULL, window); sync_tab_security (new_tab, NULL, window); + sync_tab_popup_windows (new_tab, NULL, window); + sync_tab_popups_allowed (new_tab, NULL, window); sync_tab_title (new_tab, NULL, window); sync_tab_zoom (new_tab, NULL, window); @@ -1613,6 +1685,14 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) G_CALLBACK (sync_tab_security), window, 0); g_signal_connect_object (G_OBJECT (new_tab), + "notify::hidden-popup-count", + G_CALLBACK (sync_tab_popup_windows), + window, 0); + g_signal_connect_object (G_OBJECT (new_tab), + "notify::popups-allowed", + G_CALLBACK (sync_tab_popups_allowed), + window, 0); + g_signal_connect_object (G_OBJECT (new_tab), "notify::title", G_CALLBACK (sync_tab_title), window, 0); @@ -1829,6 +1909,9 @@ ephy_window_get_property (GObject *object, case PROP_ACTIVE_TAB: g_value_set_object (value, window->priv->active_tab); break; + case PROP_CHROME: + g_value_set_flags (value, window->priv->chrome); + break; } } @@ -1947,6 +2030,28 @@ browse_with_caret_notifier (GConfClient *client, } static void +allow_popups_notifier (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + EphyWindow *window) +{ + GList *tabs; + EphyTab *tab; + + g_return_if_fail (EPHY_IS_WINDOW (window)); + + tabs = ephy_window_get_tabs (window); + + for (; tabs; tabs = g_list_next (tabs)) + { + tab = EPHY_TAB (tabs->data); + g_return_if_fail (EPHY_IS_TAB (tab)); + + g_object_notify (G_OBJECT (tab), "popups-allowed"); + } +} + +static void action_request_forward_cb (GObject *toolbar, const char *name, GObject *bookmarksbar) @@ -1970,6 +2075,7 @@ ephy_window_init (EphyWindow *window) window->priv->exit_fullscreen_popup = NULL; window->priv->num_tabs = 0; window->priv->has_size = FALSE; + window->priv->chrome = EPHY_EMBED_CHROME_ALL; window->priv->should_save_chrome = FALSE; window->priv->mode = EPHY_WINDOW_MODE_NORMAL; @@ -2081,6 +2187,10 @@ ephy_window_init (EphyWindow *window) (CONF_BROWSE_WITH_CARET, (GConfClientNotifyFunc)browse_with_caret_notifier, window); + window->priv->allow_popups_notifier_id = eel_gconf_notification_add + (CONF_SECURITY_ALLOW_POPUPS, + (GConfClientNotifyFunc)allow_popups_notifier, window); + /* network status */ single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); network_status_changed (single, @@ -2114,6 +2224,7 @@ ephy_window_finalize (GObject *object) eel_gconf_notification_remove (window->priv->disable_save_to_disk_notifier_id); eel_gconf_notification_remove (window->priv->disable_command_line_notifier_id); eel_gconf_notification_remove (window->priv->browse_with_caret_notifier_id); + eel_gconf_notification_remove (window->priv->allow_popups_notifier_id); if (window->priv->find_dialog) { @@ -2380,7 +2491,7 @@ ephy_window_remove_tab (EphyWindow *window, **/ void ephy_window_load_url (EphyWindow *window, - const char *url) + const char *url) { EphyEmbed *embed; @@ -2697,3 +2808,27 @@ ephy_window_view_bookmarksbar_cb (GtkAction *action, sync_chrome_with_view_toggle (action, window, EPHY_EMBED_CHROME_BOOKMARKSBAR); } + +static void +ephy_window_view_popup_windows_cb (GtkAction *action, + EphyWindow *window) +{ + EphyTab *tab; + gboolean allow; + + g_return_if_fail (EPHY_IS_WINDOW (window)); + + tab = ephy_window_get_active_tab (window); + g_return_if_fail (EPHY_IS_TAB (tab)); + + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) + { + allow = TRUE; + } + else + { + allow = FALSE; + } + + g_object_set (G_OBJECT (tab), "popups-allowed", allow, NULL); +} |