Ticket #3499: 0001-Button-to-clear-the-url-entry-SL-3499.patch
File 0001-Button-to-clear-the-url-entry-SL-3499.patch, 3.6 KB (added by humitos, 11 years ago) |
---|
-
new file icons/browse-clear-url.svg
From 44e421d7e963d8c9e916671ca49e8ae2e5cfd3a1 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann <humitos@gmail.com> Date: Fri, 21 Sep 2012 20:24:15 -0300 Subject: [PATCH Browse] Button to clear the url entry SL #3499 Added an 'X' to clear the url entry easily. This button is shown when the url entry has focus. When the focus is left the icon changes again to the correct one (reload or stop loading) Signed-off-by: Manuel Kaufmann <humitos@gmail.com> --- icons/browse-clear-url.svg | 18 ++++++++++++++++++ webtoolbar.py | 21 ++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 icons/browse-clear-url.svg diff --git a/icons/browse-clear-url.svg b/icons/browse-clear-url.svg new file mode 100644 index 0000000..f7b3746
- + 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ 3 <!ENTITY fill_color "#FFFFFF"> 4 <!ENTITY stroke_color "#010101"> 5 ]> 6 <svg 7 xmlns="http://www.w3.org/2000/svg" 8 version="1.1" 9 width="22.16" 10 height="22.16" 11 viewBox="0 0 22.16 22.16" 12 id="browse-dialog-cancel" 13 xml:space="preserve"> 14 <path 15 d="m 0,0 0,22.15625 22.15625,0 L 22.15625,0 0,0 z m 16.15625,4.1875 a 1.750175,1.750175 0 0 1 1.25,3.03125 l -3.84375,3.84375 3.84375,3.84375 a 1.7567532,1.7567532 0 1 1 -2.5,2.46875 L 11.09375,13.53125 7.25,17.375 A 1.750175,1.750175 0 1 1 4.78125,14.90625 L 8.625,11.0625 4.78125,7.21875 a 1.750175,1.750175 0 0 1 1.03125,-3 A 1.750175,1.750175 0 0 1 7.25,4.75 L 11.09375,8.59375 14.90625,4.75 A 1.750175,1.750175 0 0 1 15.9375,4.21875 1.750175,1.750175 0 0 1 16.15625,4.1875 z" 16 id="rect3074" 17 style="color:&stroke_color;;fill:&stroke_color;;stroke:none;stroke-width:1.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> 18 </svg> -
webtoolbar.py
diff --git a/webtoolbar.py b/webtoolbar.py index 28bc015..c5db18a 100644
a b class PrimaryToolbar(ToolbarBase): 258 258 'browse-dialog-cancel') 259 259 self.entry.connect('icon-press', self._stop_and_reload_cb) 260 260 self.entry.connect('activate', self._entry_activate_cb) 261 self.entry.connect('focus-in-event', self.__focus_in_event_cb) 262 self.entry.connect('focus-out-event', self.__focus_out_event_cb) 261 263 262 264 entry_item = Gtk.ToolItem() 263 265 entry_item.set_expand(True) … … class PrimaryToolbar(ToolbarBase): 387 389 self.entry.props.title = title 388 390 self._title = title 389 391 392 def __focus_in_event_cb(self, entry, event): 393 self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY, 394 'browse-clear-url') 395 396 def __focus_out_event_cb(self, entry, event): 397 if self._loading: 398 self._show_stop_icon() 399 else: 400 self._show_reload_icon() 401 390 402 def _show_stop_icon(self): 391 403 self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY, 392 404 'browse-dialog-cancel') … … class PrimaryToolbar(ToolbarBase): 432 444 filepicker.cleanup_temp_files() 433 445 434 446 def _stop_and_reload_cb(self, entry, icon_pos, button): 435 if self._loading:436 self._browser.stop_loading()447 if entry.has_focus(): 448 entry.set_text('') 437 449 else: 438 self._browser.reload() 450 if self._loading: 451 self._browser.stop_loading() 452 else: 453 self._browser.reload() 439 454 440 455 def _set_loading(self, loading): 441 456 self._loading = loading