Round the progress bar angles.

Keep location entry updated.
This commit is contained in:
Marco Pesenti Gritti 2006-10-12 16:05:53 +02:00
parent fce6d1482c
commit 3a3fe02b61
3 changed files with 13 additions and 1 deletions

View File

@ -26,3 +26,6 @@ class AddressItem(gtk.ToolItem):
def set_progress(self, progress):
self._entry.set_property('progress', progress)
def set_address(self, address):
self._entry.set_text(address)

View File

@ -65,6 +65,7 @@ class NavigationToolbar(gtk.Toolbar):
self._embed.go_forward()
def __location_changed(self, embed):
self._address_item.set_address(embed.get_location())
self._update_sensitivity()
def __open_address_cb(self, item, address):

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <math.h>
#include <gtk/gtkentry.h>
#include "sugar-address-entry.h"
@ -454,10 +455,17 @@ sugar_address_entry_expose(GtkWidget *widget,
if (address_entry->progress != 0.0 && address_entry->progress != 1.0) {
int bar_width = area_width * address_entry->progress;
float radius = 5.0;
cr = gdk_cairo_create(entry->text_area);
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_rectangle(cr, 0, 0, bar_width, area_height);
cairo_move_to (cr, radius, 0);
cairo_arc (cr, bar_width - radius, radius, radius, M_PI * 1.5, M_PI * 2);
cairo_arc (cr, bar_width - radius, area_height - radius, radius, 0, M_PI * 0.5);
cairo_arc (cr, radius, area_height - radius, radius, M_PI * 0.5, M_PI);
cairo_arc (cr, radius, radius, radius, M_PI, M_PI * 1.5);
cairo_fill(cr);
cairo_destroy (cr);
}