Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show tab popover relative to urlbar with no opacity changes #164

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions core/browser.vala
Expand Up @@ -521,6 +521,7 @@ namespace Midori {
}

public new void add (Tab tab) {
tab.popover.relative_to = navigationbar.urlbar;
tab.create.connect ((action) => {
var new_tab = new Tab (tab, web_context);
new_tab.hide ();
Expand Down
29 changes: 23 additions & 6 deletions core/tab.vala
Expand Up @@ -31,7 +31,7 @@ namespace Midori {
public string link_uri { get; protected set; }

[GtkChild]
Gtk.Popover popover;
internal Gtk.Popover popover;
[GtkChild]
Gtk.Label message;
[GtkChild]
Expand Down Expand Up @@ -296,17 +296,14 @@ namespace Midori {

public override bool script_dialog (WebKit.ScriptDialog dialog) {
message.label = dialog.get_message ();
// Render inactive without setting sensitive which affects the popover
opacity = 0.3;
popover.closed.connect (() => {
opacity = 1.0;
});

switch (dialog.get_dialog_type ()) {
case WebKit.ScriptDialogType.ALERT:
confirm.hide ();
break;
case WebKit.ScriptDialogType.CONFIRM:
case WebKit.ScriptDialogType.BEFORE_UNLOAD_CONFIRM:
confirm.label = _("_Confirm");
confirm.visible = true;
popover.closed.connect (() => {
dialog.confirm_set_confirmed (false);
Expand All @@ -318,6 +315,7 @@ namespace Midori {
case WebKit.ScriptDialogType.PROMPT:
entry.placeholder_text = dialog.prompt_get_default_text ();
entry.visible = true;
confirm.label = _("_Confirm");
confirm.visible = true;
popover.closed.connect (() => {
dialog.prompt_set_text ("");
Expand All @@ -331,6 +329,25 @@ namespace Midori {
return true;
}

public override bool permission_request (WebKit.PermissionRequest permission) {
if (permission is WebKit.GeolocationPermissionRequest) {
string hostname = new Soup.URI (uri).host;
message.label = _("%s wants to know your location.").printf (hostname);
} else {
message.label = permission.get_type ().name ();
}
confirm.label = _("_Allow");
confirm.show ();
confirm.clicked.connect (() => {
permission.allow ();
});
popover.closed.connect (() => {
permission.deny ();
});
popover.show ();
return true;
}

public override bool decide_policy (WebKit.PolicyDecision decision, WebKit.PolicyDecisionType type) {
switch (type) {
case WebKit.PolicyDecisionType.NAVIGATION_ACTION:
Expand Down
1 change: 1 addition & 0 deletions ui/tab.ui
Expand Up @@ -2,6 +2,7 @@
<object class="GtkPopover" id="popover">
<property name="modal">yes</property>
<property name="position">bottom</property>
<property name="relative-to">MidoriTab</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
Expand Down