Set glib program name and application name.
Better way of importing ltihooks. Several cleanups.
This commit is contained in:
parent
a609da166b
commit
1d4112a882
@ -145,6 +145,7 @@ class Shell(gobject.GObject):
|
|||||||
home_model.notify_activity_launch(activity_id, bundle_id)
|
home_model.notify_activity_launch(activity_id, bundle_id)
|
||||||
|
|
||||||
def notify_launch_failure(self, activity_id):
|
def notify_launch_failure(self, activity_id):
|
||||||
|
home_model = self._model.get_home()
|
||||||
home_model.notify_activity_launch_failed(activity_id)
|
home_model.notify_activity_launch_failed(activity_id)
|
||||||
|
|
||||||
def start_activity(self, activity_type):
|
def start_activity(self, activity_type):
|
||||||
|
@ -30,6 +30,7 @@ import gtk
|
|||||||
import gobject
|
import gobject
|
||||||
|
|
||||||
from sugar import env
|
from sugar import env
|
||||||
|
from sugar import ltihooks
|
||||||
|
|
||||||
def _get_display_number():
|
def _get_display_number():
|
||||||
"""Find a free display number trying to connect to 6000+ ports"""
|
"""Find a free display number trying to connect to 6000+ ports"""
|
||||||
|
@ -17,7 +17,15 @@
|
|||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from sugar import ltihooks
|
||||||
|
|
||||||
ZOOM_MESH = 0
|
ZOOM_MESH = 0
|
||||||
ZOOM_FRIENDS = 1
|
ZOOM_FRIENDS = 1
|
||||||
ZOOM_HOME = 2
|
ZOOM_HOME = 2
|
||||||
ZOOM_ACTIVITY = 3
|
ZOOM_ACTIVITY = 3
|
||||||
|
|
||||||
|
print os.path.join(os.path.dirname(__file__), 'Makefile.am')
|
||||||
|
if os.path.isfile(os.path.join(os.path.dirname(__file__), 'Makefile.am')):
|
||||||
|
ltihooks.install()
|
||||||
|
@ -102,3 +102,27 @@
|
|||||||
'("const-char*" "property")
|
'("const-char*" "property")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(define-function get_prgname
|
||||||
|
(c-name "g_get_prgname")
|
||||||
|
(return-type "const-char*")
|
||||||
|
)
|
||||||
|
|
||||||
|
(define-function get_application_name
|
||||||
|
(c-name "g_get_application_name")
|
||||||
|
(return-type "const-char*")
|
||||||
|
)
|
||||||
|
|
||||||
|
(define-function set_prgname
|
||||||
|
(c-name "g_set_prgname")
|
||||||
|
(parameters
|
||||||
|
'("const-char*" "name")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(define-function set_application_name
|
||||||
|
(c-name "g_set_application_name")
|
||||||
|
(parameters
|
||||||
|
'("const-char*" "name")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ -39,6 +39,7 @@ from sugar.graphics.toolbutton import ToolButton
|
|||||||
from sugar.datastore import datastore
|
from sugar.datastore import datastore
|
||||||
from sugar import wm
|
from sugar import wm
|
||||||
from sugar import profile
|
from sugar import profile
|
||||||
|
from sugar import _sugarext
|
||||||
|
|
||||||
class ActivityToolbar(gtk.Toolbar):
|
class ActivityToolbar(gtk.Toolbar):
|
||||||
def __init__(self, activity):
|
def __init__(self, activity):
|
||||||
@ -272,7 +273,7 @@ class Activity(Window, gtk.Container):
|
|||||||
return self._activity_id
|
return self._activity_id
|
||||||
|
|
||||||
def get_service_name(self):
|
def get_service_name(self):
|
||||||
return os.environ['SUGAR_BUNDLE_SERVICE_NAME']
|
return _sugarext.get_prgname()
|
||||||
|
|
||||||
def set_canvas(self, canvas):
|
def set_canvas(self, canvas):
|
||||||
Window.set_canvas(self, canvas)
|
Window.set_canvas(self, canvas)
|
||||||
@ -416,7 +417,7 @@ class Activity(Window, gtk.Container):
|
|||||||
def get_bundle_name():
|
def get_bundle_name():
|
||||||
"""Return the bundle name for the current process' bundle
|
"""Return the bundle name for the current process' bundle
|
||||||
"""
|
"""
|
||||||
return os.environ['SUGAR_BUNDLE_NAME']
|
return _sugarext.get_application_name()
|
||||||
|
|
||||||
def get_bundle_path():
|
def get_bundle_path():
|
||||||
"""Return the bundle path for the current process' bundle
|
"""Return the bundle path for the current process' bundle
|
||||||
|
@ -129,9 +129,8 @@ class ActivityCreationHandler(gobject.GObject):
|
|||||||
logging.debug("Couldn't create activity %s (%s): %s" %
|
logging.debug("Couldn't create activity %s (%s): %s" %
|
||||||
(self._activity_handle.activity_id, self._service_name, err))
|
(self._activity_handle.activity_id, self._service_name, err))
|
||||||
self._shell.NotifyLaunchFailure(
|
self._shell.NotifyLaunchFailure(
|
||||||
service_name, self.get_activity_id(),
|
self.get_activity_id(), reply_handler=self._no_reply_handler,
|
||||||
reply_handler=self._no_reply_handler,
|
error_handler=self._notify_launch_failure_error_handler)
|
||||||
error_handler=self._notify_launch_failure_error_handler)
|
|
||||||
|
|
||||||
def create(service_name, activity_handle=None):
|
def create(service_name, activity_handle=None):
|
||||||
"""Create a new activity from its name."""
|
"""Create a new activity from its name."""
|
||||||
|
@ -29,6 +29,7 @@ import dbus.glib
|
|||||||
from sugar.activity.bundle import Bundle
|
from sugar.activity.bundle import Bundle
|
||||||
from sugar.activity import activityhandle
|
from sugar.activity import activityhandle
|
||||||
from sugar import logger
|
from sugar import logger
|
||||||
|
from sugar import _sugarext
|
||||||
|
|
||||||
# Work around for dbus mutex locking issue
|
# Work around for dbus mutex locking issue
|
||||||
gobject.threads_init()
|
gobject.threads_init()
|
||||||
@ -155,8 +156,9 @@ def run(bundle_path):
|
|||||||
gtk.icon_theme_get_default().append_search_path(bundle.get_icons_path())
|
gtk.icon_theme_get_default().append_search_path(bundle.get_icons_path())
|
||||||
|
|
||||||
os.environ['SUGAR_BUNDLE_PATH'] = bundle_path
|
os.environ['SUGAR_BUNDLE_PATH'] = bundle_path
|
||||||
os.environ['SUGAR_BUNDLE_SERVICE_NAME'] = bundle.get_service_name()
|
|
||||||
os.environ['SUGAR_BUNDLE_NAME'] = bundle.get_name()
|
_sugarext.set_prgname(bundle.get_service_name())
|
||||||
|
_sugarext.set_application_name(bundle.get_name())
|
||||||
|
|
||||||
factory = ActivityFactoryService(bundle.get_service_name(),
|
factory = ActivityFactoryService(bundle.get_service_name(),
|
||||||
bundle.get_class())
|
bundle.get_class())
|
||||||
|
@ -17,9 +17,4 @@
|
|||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
try:
|
from sugar._sugarext import AddressEntry
|
||||||
from sugar._sugarext import AddressEntry
|
|
||||||
except ImportError:
|
|
||||||
from sugar import ltihooks
|
|
||||||
from sugar._sugarext import AddressEntry
|
|
||||||
|
|
||||||
|
@ -68,5 +68,3 @@ def install():
|
|||||||
importer.install()
|
importer.install()
|
||||||
def uninstall():
|
def uninstall():
|
||||||
importer.uninstall()
|
importer.uninstall()
|
||||||
|
|
||||||
install()
|
|
||||||
|
@ -15,11 +15,7 @@
|
|||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
try:
|
from sugar import _sugarext
|
||||||
from sugar import _sugarext
|
|
||||||
except ImportError:
|
|
||||||
from sugar import ltihooks
|
|
||||||
from sugar import _sugarext
|
|
||||||
|
|
||||||
def get_for_file(file_name):
|
def get_for_file(file_name):
|
||||||
return _sugarext.get_mime_type_for_file(file_name)
|
return _sugarext.get_mime_type_for_file(file_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user