Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Simon McVittie 2007-05-21 11:30:38 +01:00
commit 66c5e882f3
11 changed files with 49 additions and 39 deletions

View File

@ -690,8 +690,9 @@ sugar_browser_init(SugarBrowser *browser)
G_CALLBACK(title_cb), NULL);
g_signal_connect(G_OBJECT(browser), "location",
G_CALLBACK(location_cb), NULL);
g_signal_connect(G_OBJECT(browser), "dom-mouse-click",
/* g_signal_connect(G_OBJECT(browser), "dom-mouse-click",
G_CALLBACK(dom_mouse_click_cb), NULL);
*/
}
int

View File

@ -1,6 +1,6 @@
VERSION=0.63
DATE=`date +%Y%m%d`
RELEASE=2.82
RELEASE=2.87
TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2
rm sugar-$VERSION.tar.bz2

View File

@ -57,22 +57,6 @@ AC_SUBST(MOZILLA_INCLUDE_DIR)
AC_SUBST(XPIDL)
AC_SUBST(MOZILLA_IDL_DIR)
PKG_CHECK_MODULES(NSPR, [nspr],
[have_nspr=true],
[
PKG_CHECK_MODULES(NSPR, [mozilla-nspr],
[have_nspr=true],
[
PKG_CHECK_MODULES(NSPR, [xulrunner-nspr],
[have_nspr=true],
have_nspr=false)
])
])
if test "x$have_nspr" = xfalse; then
AC_MSG_ERROR([Could not find nspr])
fi
else
AC_MSG_ERROR([Must specify the xulrunner sdk dir (--with-libxul-sdk)])

View File

@ -450,7 +450,14 @@ class Buddy(ExportedGObject):
# to avoid leaking a PropertyChanged signal before the buddy is
# actually valid the first time after creation
if self._valid:
self.PropertyChanged(changed_props)
dbus_changed = {}
for key, value in changed_props.items():
if value:
dbus_changed[key] = value
else:
dbus_changed[key] = ""
self.PropertyChanged(dbus_changed)
self.emit('property-changed', changed_props)
self._update_validity()
@ -514,6 +521,11 @@ class GenericOwner(Buddy):
self._registered = kwargs["registered"]
del kwargs["registered"]
self._ip4_addr_monitor = psutils.IP4AddressMonitor.get_instance()
self._ip4_addr_monitor.connect("address-changed", self._ip4_address_changed_cb)
if self._ip4_addr_monitor.props.address:
kwargs["ip4-address"] = self._ip4_addr_monitor.props.address
Buddy.__init__(self, bus_name, object_id, **kwargs)
self._owner = True
@ -522,9 +534,6 @@ class GenericOwner(Buddy):
signal_name="NameOwnerChanged",
dbus_interface="org.freedesktop.DBus")
self._ip4_addr_monitor = psutils.IP4AddressMonitor.get_instance()
self._ip4_addr_monitor.connect("address-changed", self._ip4_address_changed_cb)
def _ip4_address_changed_cb(self, monitor, address):
"""Handle IPv4 address change, set property to generate event"""
props = {_PROP_IP4_ADDRESS: address}

View File

@ -106,16 +106,6 @@ class ClipboardIcon(CanvasIcon):
else:
self.props.xo_color = XoColor("#000000,#FFFFFF")
if activity and percent == 100:
# FIXME: restrict based on file type rather than activity once
# we have a better type registry
# restrict auto-open to a specific set of activities
allowed = ["org.laptop.AbiWordActivity",
"org.laptop.sugar.Xbook",
"org.vpri.EtoysActivity"]
if activity in allowed:
self._open_file()
def _open_file(self):
if self._percent < 100:
return

View File

@ -28,6 +28,7 @@ import gtk, gobject
from sugar.presence import presenceservice
from sugar.activity.activityservice import ActivityService
from sugar.activity import bundleregistry
from sugar.graphics.window import Window
from sugar.graphics.toolbox import Toolbox
from sugar.graphics.toolbutton import ToolButton
@ -200,13 +201,15 @@ class Activity(Window, gtk.Container):
if handle.object_id:
self.jobject = datastore.get(handle.object_id)
self.jobject.object_id = ''
del self.jobject['ctime']
del self.jobject['mtime']
elif create_jobject:
logging.debug('Creating a jobject.')
self.jobject = datastore.create()
self.jobject['title'] = '%s %s' % (get_bundle_name(), 'Activity')
self.jobject['activity'] = self.get_service_name()
self.jobject['date'] = str(time.time())
self.jobject['icon'] = ''
self.jobject['icon'] = self._get_icon()
self.jobject['keep'] = '0'
self.jobject['buddies'] = ''
self.jobject['preview'] = ''
@ -329,6 +332,10 @@ class Activity(Window, gtk.Container):
raise
self.destroy()
def _get_icon(self):
registry = bundleregistry.get_registry()
return registry.get_bundle(self.get_service_name()).get_icon()
def get_bundle_name():
"""Return the bundle name for the current process' bundle
"""

View File

@ -78,10 +78,14 @@ class Bundle:
if cp.has_option(section, 'class'):
self._class = cp.get(section, 'class')
self._exec = '%s --bundle-path="%s"' % (
env.get_bin_path(_PYTHON_FACTORY), self.get_path())
env.get_bin_path(_PYTHON_FACTORY), self._path)
elif cp.has_option(section, 'exec'):
self._class = None
self._exec = cp.get(section, 'exec')
cmdline = cp.get(section, 'exec')
cmdline = os.path.join(self._path, cmdline)
cmdline = cmdline.replace('$SUGAR_BUNDLE_PATH', self._path)
cmdline = os.path.expandvars(cmdline)
self._exec = cmdline
else:
self._exec = None
self._valid = False

View File

@ -39,6 +39,9 @@ class DSObject(gobject.GObject):
self.metadata[key] = value
self.emit('updated')
def __delitem__(self, key):
del self.metadata[key]
def get_metadata(self):
return self._metadata

View File

@ -40,7 +40,7 @@ def create(properties, filename):
return object_id
def update(uid, properties, filename, reply_handler=None, error_handler=None):
logging.debug('dbus_helpers.update')
logging.debug('dbus_helpers.update: %s, %s' % (uid, filename))
if reply_handler and error_handler:
_data_store.update(uid, dbus.Dictionary(properties), filename,
reply_handler=reply_handler,

View File

@ -123,7 +123,7 @@ class _IconCache:
del self._icons[evict_key]
def get_handle(self, name, fill_color, stroke_color):
if name == None:
if not name:
return None
if name[0:6] == "theme:":

View File

@ -35,6 +35,16 @@ class Toolbox(gtk.VBox):
self.pack_start(self._notebook)
self._notebook.show()
def _toolbar_box_expose_cb(self, widget, event):
widget.style.paint_flat_box(widget.window,
gtk.STATE_NORMAL, gtk.SHADOW_NONE,
event.area, widget, 'toolbox',
widget.allocation.x,
widget.allocation.y,
widget.allocation.width,
widget.allocation.height)
return False
def add_toolbar(self, name, toolbar):
label = gtk.Label(name)
label.set_size_request(gtk.gdk.screen_width() / _N_TABS, -1)
@ -42,6 +52,8 @@ class Toolbox(gtk.VBox):
toolbar_box = gtk.HBox()
toolbar_box.pack_start(toolbar, True, True, units.grid_to_pixels(1))
toolbar_box.set_size_request(-1, units.grid_to_pixels(1))
toolbar_box.connect('expose-event', self._toolbar_box_expose_cb)
self._notebook.append_page(toolbar_box, label)
toolbar_box.show()