Grab focus on the browser when explicitly opening an uri
This commit is contained in:
parent
19715991ec
commit
5a26d51d20
@ -121,6 +121,7 @@ class Toolbar(gtk.Toolbar):
|
||||
|
||||
def _entry_activate_cb(self, entry):
|
||||
self._embed.load_url(entry.get_text())
|
||||
self._embed.grab_focus()
|
||||
|
||||
def _go_back_cb(self, button):
|
||||
self._embed.go_back()
|
||||
|
@ -59,6 +59,12 @@
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-method grab_focus
|
||||
(of-object "SugarBrowser")
|
||||
(c-name "sugar_browser_grab_focus")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-method create_window
|
||||
(of-object "SugarBrowser")
|
||||
(c-name "sugar_browser_create_window")
|
||||
|
@ -305,3 +305,17 @@ sugar_browser_scroll_pixels(SugarBrowser *browser,
|
||||
|
||||
DOMWindow->ScrollBy (dx, dy);
|
||||
}
|
||||
|
||||
void
|
||||
sugar_browser_grab_focus(SugarBrowser *browser)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_bin_get_child(GTK_BIN(browser));
|
||||
|
||||
if (child != NULL) {
|
||||
gtk_widget_grab_focus (child);
|
||||
} else {
|
||||
g_warning ("Need to realize the embed before grabbing focus!\n");
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ SugarBrowser *sugar_browser_create_window (SugarBrowser *browser);
|
||||
void sugar_browser_scroll_pixels (SugarBrowser *browser,
|
||||
int dx,
|
||||
int dy);
|
||||
void sugar_browser_grab_focus (SugarBrowser *browser);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user