605 Commits (b51d5c9dc7263917afa2535befb02ad7517a7514)

Author SHA1 Message Date
Daniel Drake 64cceeada9 SugarExt: fix compile without pygtk
We no longer compile this against pygtk, so remove the include.
Add the now-required Python.h include in its place.
13 years ago
Daniel Drake 4e137f6e4f sugar-activity: import and make independent of sugar-toolkit GTK versions
As we move to adding support for a second UI toolkit (GTK+ 3.x),
the sugar-activity binary used by all activities must become
backend-toolkit-independent. It would be wasteful to have two backend
toolkits loaded in memory, and in the GTK2/GTK3 case, it is impossible
(importing both results in an instant crash).

To achieve this, we split the existing sugar-toolkit activity/main.py:main()
functionality into two parts, moving it into the sugar-activity binary and
the Activity class as follows:
 1. All toolkit-specific stuff is moved into the Activity class (i.e.
   everything that interacts with GTK)
 2. Everything that can be reasonably/easily moved into the Activity class
   is also moved.
 3. What remains is the stuff that is inherently involved with the
   construction of the Activity object, not related to UI toolkits. This
   is moved into the sugar-activity binary.

main.py is then removed from sugar-toolkit, and sugar-activity is moved
from sugar to sugar-toolkit-gtk3 in order to keep toolkit-related code
with the toolkit itself.

With this work done, the one remaining question is how to invoke the main
loop. An optional run_main_loop() method is added to the activity class,
for GTK2 this will run the GTK2 main loop, for GTK3 the GTK3 main loop will
be run, etc.

Signed-off-by: Daniel Drake <dsd@laptop.org>
13 years ago
Raul Gutierrez Segales 2bfb38ef82 Port key handling code to GTK3
GTK3 removed some previously-deprecated API that we still use. This
includes GDK_DISPLAY(), gdk_x11_drawable_get_xdisplay(), and some
key constants.

Port our code to the new API.

[split patch into several parts, added minimal description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Daniel Drake e2c07af748 Import sugar-base into sugar-toolkit
Probably needs cleaning up a bit. And we use pygtk-codegen, ugh...

This is the commit id when we imported sugar-base:
b9406e5c9c9df5404c5b0d995178b5edb4d93628

Signed-off-by: Daniel Drake <dsd@laptop.org>
[squashed two patches into one]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Raul Gutierrez Segales 82fcf0a0f0 Use rsvg wrapper while rsvg gains introspection support
Signed-off-by: Raul Gutierrez Segales <rgs@collabora.co.uk>
13 years ago
Raul Gutierrez Segales 3372317922 Add wrapper for rsvg
Signed-off-by: Raul Gutierrez Segales <rgs@collabora.co.uk>
[split patch into several parts]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Raul Gutierrez Segales 1005c67ad2 Add GdkWrapper to access non-introspectable Gdk API
See https://bugzilla.gnome.org/show_bug.cgi?id=663261

Signed-off-by: Raul Gutierrez Segales <rgs@collabora.co.uk>
13 years ago
Simon Schampijer 09b3740768 _TimeoutIcon: use markup instead of Pango for bold text
In Pango 'Pango.attr_weight_new' is not yet introspectable [1].

[1] https://bugzilla.gnome.org/show_bug.cgi?id=646788

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[changed description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 1b9af6f6d5 Replace "expose-event" signal by a new "draw" signal
GtkWidget "expose-event" signal has been replaced by
a new "draw" signal [1]. The context is already
clipped [2], so do not base it on the values returned by
get_allocation like before.

[1] http://developer.gnome.org/gtk3/3.0/ch25s02.html#id1467092
[2] http://developer.gnome.org/gtk3/3.0/GtkWidget.html#GtkWidget-draw

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[squashed with a patch by Benjamin Berg <benjamin@sipsolutions.net>;
 removed useless additions]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Daniel Drake 157124af5b Tray: replace deprecated get_child_requisition() invocation
Widget.get_child_requisition() has been replaced by
Widget.get_preferred_size() in GTK 3 [1].

[1] http://developer.gnome.org/gtk3/3.0/GtkWidget.html#gtk-widget-get-child-requisition

Signed-off-by: Daniel Drake <dsd@laptop.org>
[changed description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Raul Gutierrez Segales 7464997663 Replace deprecated gdk_set_sm_client_id() invocation
gdk_set_sm_client_id() has been replaced by
gdk_x11_set_sm_client_id() [1] since GDK 2.24.

[1] http://developer.gnome.org/gdk/stable/gdk-General.html#gdk-set-sm-client-id

Signed-off-by: Raul Gutierrez Segales <rgs@collabora.co.uk>
[changed description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 20319cb3c4 Use GObject constructor for Gtk.Alignment
With PyGTK, all parameters of the Alignment constructor had defaults [1].
With GTK3+pygi, when using the explicit constructor (Alignment.new() resp.
gtk_alignment_new() [2]), all values would need to be passed. However when
using the GObject constructor, named properties can be passed in instead and
we only need to pass those that different from the default.

[1] http://developer.gnome.org/pygtk/stable/class-gtkalignment.html#constructor-gtkalignment
[2] http://developer.gnome.org/gtk/stable/GtkAlignment.html#gtk-alignment-new

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[assembled from several patches; replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Sascha Silbe c82a775267 Use accessor functions for data fields
The following data fields that were provided by PyGTK are not accessible
directly in GTK3+pygi and need to be replaced by accessor calls:

Adjustment.lower
Adjustment.page_size
Adjustment.upper
Adjustment.value
Bin.child
Widget.parent
Widget.style
Widget.window

Based on patches by Daniel Drake <dsd@laptop.org>.

Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Daniel Drake 4aacaaf56e icon: fix set_source_pixbuf() invocations
The previous set_source_pixbuf() invocation (on a Cairo context) involves
Gdk data types, so in the new introspection world we need to call a Gdk
function rather than operating on the Cairo object (even if Cairo had already
been converted to introspection).

Signed-off-by: Daniel Drake <dsd@laptop.org>
[added description; split out from another patch]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Benjamin Berg e05f84bc4f Icon: port to new Height-for-width Geometry Management
GTK3 has replaced [1] the GTK2 geometry management with Height-for-width
Geometry Management [2]. This means we need to replace size_request() methods
with get_preferred_{width,height}().

[1] http://developer.gnome.org/gtk3/3.0/ch25s02.html#id1525688
[2] http://developer.gnome.org/gtk3/3.0/GtkWidget.html#geometry-management

Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
[assembled from several patches; fixed up left-over plus sign; added
description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Sascha Silbe 327ca88ca8 Adapt to Widget.get_child_requisition() API changes
In PyGTK Widget.get_child_requisition() returned a tuple [1]. In GTK3+pygi
a Requisition object is returned instead.

Based on a patch by Benjamin Berg <benjamin@sipsolutions.net>.

[1] http://developer.gnome.org/pygtk/stable/class-gtkwidget.html#method-gtkwidget--get-child-requisition
[2] http://developer.gnome.org/gtk/stable/GtkWidget.html#gtk-widget-get-child-requisition

Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 0d827e7e66 Adapt to Gtk.icon_size_lookup*() API changes
In PyGTK, icon_size_lookup*() returned just the icon size as a 2-tuple [1].
In GTK3+pygi, an additional boolean value indicating whether the passed-in
value was valid is returned. [3,4]

[1] http://developer.gnome.org/pygtk/stable/class-gtkiconsource.html#function-gtk--icon-size-lookup
[2] http://developer.gnome.org/pygtk/stable/class-gtkiconsource.html#function-gtk--icon-size-lookup-for-settings
[3] http://developer.gnome.org/gtk/stable/gtk-Themeable-Stock-Images.html#gtk-icon-size-lookup
[4] http://developer.gnome.org/gtk/stable/gtk-Themeable-Stock-Images.html#gtk-icon-size-lookup-for-settings

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[marked unused local variables, fixed overlong line]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 8efb7c3f93 Adapt to changed Gtk.Window.set_geometry_hints() API
Unlike PyGTK [1], GTK3+pygi [2] wants GDK Geometry and WindowHints objects,
rather than individual values.

[1] http://developer.gnome.org/pygtk/stable/class-gtkwindow.html#method-gtkwindow--set-geometry-hints
[2] http://developer.gnome.org/gtk3/3.0/GtkWindow.html#gtk-window-set-geometry-hints

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[replaced description, included fix-up commit]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 10d7f7d3f9 Switch sugarext to be an introspectable library
This makes sugarext accessible through introspection. It is used
from the shell (key grabber, sound volume management) and the
shell session management.

Making the sugarext introspectable was done following the
descriptions at: http://live.gnome.org/GObjectIntrospection#Using_GI

Signed-off-by: Simon Schampijer <simon@schampijer.de>
13 years ago
Sascha Silbe 820efa56b9 Run pygi-convert.sh for automatic conversion from GTK2 to GTK3 + pygi.
This is only on a best-effort basis; the code will be in a broken state after
this patch and need to be fixed manually.

The purpose of committing the intermediate, non-working output is to make it
reproducible. It's impractical to manually review the changes.

The exact version used was 4f637212f13b197a95c824967a58496b9e3b877c from the
main pygobject repository [1] plus a custom patch [2] that hasn't been sent
upstream yet.

[1] git://git.gnome.org/pygobject
[2] https://sascha.silbe.org/patches/pygobject-convert-sugar-20111122.patch

Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Sascha Silbe aed295ec4e Import GDK in preparation for GTK3 conversion
Some parts of GTK moved to GDK, so we need to import the latter for things to
work after the conversion script runs.

Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 9cb18cdcf3 Remove Canvas* widgets and other hippo-canvas using parts
hippo-canvas isn't available in the GTK3 world, so we need to remove
anything that depends on it. Activities that still use it will need replace
hippo-canvas based widgets with native GTK ones before they can be ported to
GTK3.

[replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 1edc6ca1b1 Don't use hippo-canvas for rendering pixbufs
hippo-canvas isn't available in the GTK3 world and we can do fine without it
for rendering pixbufs.

[split out from another patch; added description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer af4bde1e83 Notebook: fix passing can-close-tabs
Make sure can_close_tabs can be passed in as a keyword parameter (to be set
by the GObject constructor).

[split out from another patch]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 9e4a3688fe Pass all parameters to GtkTextBuffer.get_text()
With PyGTK the include_hidden_chars parameter to GtkTextBuffer.get_text() had
a default value [1]. With GTK3+pygi the value must be explicitly passed [2].

[1] http://developer.gnome.org/pygtk/stable/class-gtktextbuffer.html#method-gtktextbuffer--get-text
[2] http://developer.gnome.org/gtk3/3.0/GtkTextBuffer.html#gtk-text-buffer-get-text

[changed description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 056bc29559 Pass all parameters to ComboBox.set_row_separator_func()
With PyGTK, the func and data parameters to ComboBox.set_row_separator_func()
had defaults [1]. With GTK3+pygi both values must be passed [2].

[1] http://developer.gnome.org/pygtk/stable/class-gtkcombobox.html#method-gtkcombobox--set-row-separator-func
[2] http://developer.gnome.org/gtk/stable/GtkComboBox.html#gtk-combo-box-set-row-separator-func

[replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Daniel Drake 2f7f95f9af Pass all parameters to Box.pack_start() and ...pack_end()
With PyGTK, several Box.pack_{start,end}() parameters had defaults [1,2].
With GTK3+pygi all values must be passed [3,4].

[1] http://developer.gnome.org/pygtk/stable/class-gtkbox.html#method-gtkbox--pack-start
[2] http://developer.gnome.org/pygtk/stable/class-gtkbox.html#method-gtkbox--pack-end
[3] http://developer.gnome.org/gtk/stable/GtkBox.html#gtk-box-pack-start
[4] http://developer.gnome.org/gtk/stable/GtkBox.html#gtk-box-pack-end

[assembled from several patches; replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 89ef6304a1 Fix broken imports
8f1a821d68 only changed imports starting with
"import", but not those using "from ... import ...".

[replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 8f1a821d68 Rename imports from sugar to sugar3
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 000ed75cbe Rename the module to sugar3
The old gtk-2 based module will be present in
the 0.94 branch in the sugar-toolkit.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 37568a0a7e bundlebuilder: refactor get_files_git to Packager to avoid code duplication
Follow up patch for b582736375

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Daniel Drake <dsd@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 29a700b34a bundlebuilder: add back build_locale functionality to XOPackager SL #3116
Due to the removal of the manifest support we lost as well
the part of the code that does build the locale. This patch
adds that functionality back.

Signed-off-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 720b33ab30 Remove hippo from naming alert
Reimplement the favorite icon as a ToggleButton, and use standard
boxes, entrys and textviews for the other aspects.
13 years ago
Simon Schampijer d39a813969 Don't put event box in toplevel window
Remove an unnecessary toplevel widget.

This event box was originally added by Marco "to make it easier
to take screenshot of the canvas area only" (7f731457c2) but we're
unsure why this is, and it doesn't seem to be needed for our current
screenshot-taking mechanism. Screenshots continue to work fine after
removing this.
13 years ago
Simon Schampijer 1609340503 Joining shared activity: set title for activity palette in frame, SL #3109
We need to set the title when we join a shared session AND when
we run a private session.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Tested-By: Gonzalo Odiard <gonzalo@laptop.org>
Reviewed-By: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer b582736375 XO_Packager: package files that are in git and the locale folder, OLPC #11217
There had been reports about Activities that had unexpected files in
the xo bundle (e.g. patches). There have been a recent change that the support
for the MANIFEST has been removed from the bundle builder. The MANIFEST
'controlled' which files were bundled. The code did include all the
files present in the folder (which includes patches etc).

The patch does use git-ls to get a list of files to include (like the
tarball packager). Furthermore the locale folder is included which has been
generated. Due to the API freeze we made '_get_files_in_git' a private method
which adds a bit of duplication to the 'get_files' method in the tarball
packager. A patch for master which will implement Builder.get_files_git(),
that can be used by XOPackager and SourcePackager.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-By: Daniel Drake <dsd@laptop.org>
13 years ago
Simon Schampijer a16eedff46 Some activities segfault when closing, OLPC #11201
TurtleArt and Abacus are two known candidates

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
13 years ago
Simon Schampijer c1f9d716ab Correct title in the activity frame SL #3042
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Tested-by: Gonzalo Odiard <gonzalo@laptop.org>
13 years ago
Simon Schampijer e022aa8e4a Do not remove the Keep button completely, keep around for backward compatibility
In order to allow activities keeping their backward compatibility
we keep the Keep button around but do not add it to the toolbar. This
fixes activities that either remove or hide the Keep button or
alter it in any other way. The Keep button is deprecated and we
discourage the usage.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
13 years ago
Gonzalo Odiard 507dfecc09 Add alpha and scale functionality to the icon, can be used in the launcher to do the animation - v2
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
        Acked-By: Simon Schampijer <simon@laptop.org>
13 years ago
Simon Schampijer 0082e10f8e Remove the Keep button from the activity toolbar
The keep button has led to a false assumption: learners
confused it with a traditional save button and not recognising
it as what it is, an option to duplicate an entry.

Eben suggested to remove the button [1] and others have since
then. The functionality of duplicating an entry will be moved
to the entry palette in the Journal and the entry detail view [2].

We will print a warning when the KeepButton is used and remove
it after another cycle.

[1] http://lists.sugarlabs.org/archive/sugar-devel/2010-April/023439.html
[2] http://lists.sugarlabs.org/archive/sugar-devel/2011-May/031316.html

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-By: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 3f0822ab1a Toolbox: replace the hippo based separator with a gtk.HSeparator
This makes the old-style Toolbar hippo free.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Benjamin Berg <benzea@sugarlabs.org>
13 years ago
Simon Schampijer 17ec110798 Replace the hippo-based TimeoutIcon with one based on a gtk.Label and gtk.Alignment
This patch depends on the addition of the SugarTimeoutIcon
to the artwork where we set the font and background color.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Benjamin Berg <benzea@sugarlabs.org>
13 years ago
Simon Schampijer 4018265f6c Replace our custom entry widget with one based on gtk.Entry
Our custom entry widget, which was based on sexyicon, did
support placing an icon in the entry (e.g. the magnifier icon
for the search entry) and displaying progress in the case of
the url entry in Browse. Both is supported since GTK+ 2.16 in the
gtk.Entry.

The patch does keep the old API, that is why we can land it in
0.94 no change in the shell needed only a small change in Browse,
in a second step I would like to use the upstream API e.g.
's/set_icon_from_name/set_icon_from_icon_name'.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Benjamin Berg <benzea@sugarlabs.org>
13 years ago
Simon Schampijer d0a493e532 Initialize window title with bundle name, OLPC #11037
I had to modify the patch slightly because of
0269f819761cfd803cf4d694298c8ab6a753e242, changes
reviewed by Sascha.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-By: Simon Schampijer <simon@laptop.org>
Reviewed-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 9d21fd7511 Update window title when the activity title changes - OLPC #10978
The patch updates the window title when the user changes
the title in the toolbar or in the Journal.

Signed-of-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-By: Simon Schampijer <simon@laptop.org>
13 years ago
Bernie Innocenti e7430faac9 Remove incomplete MANIFEST support
This incomplete feature contributes to confuse new activity authors and
slightly complicates our bundle installation logic.

The day someone finds something useful to do with the MANIFEST
specification, we can revert this patch in no time.

Signed-off-by: Bernie Innocenti <bernie@codewiz.org>
Tested-by: Bernie Innocenti <bernie@codewiz.org>
Tested-by: James Cameron <quozl@laptop.org>
Tested-by: Sascha Silbe <silbe@activitycentral.com>
Reviewed-by: Sascha Silbe <silbe@activitycentral.com>
[rebased on git master, minor style fix]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 6b675ed45f Make sure the datastore entry is created in time OLPC #10755
To avoid that we try to access the datastore entry before
it has been created we need to move the creation code up,
before we do get the possible information from a shared
session. If we have a shared session we do then get the
title and icon-color information from it and adjust
accordingly.

Tested that no other operation like for example resuming
has issues with that change.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-By: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Gonzalo Odiard 880e60bdda Sugar-toolkit: Pack page in ToolbarButton when is connected to the window - OLPC #10930
To add the accelerator to the ToolButton the activity must have set
the 'sugar-accel-group' before. The patch does make the ToolbarButton
listen to the 'hierarchy-changed' signal and repack itself accordingly.
Since the ToolButtons of the subtoolbar do listen to 'hierarchy-changed'
as well to set the accelerator they will set it accordingly.

This fixes the accelerators for new-style-toolbar activities
like Terminal, TurtleArt and Paint, more info in #10930.

Signed-by-off: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 10580fc2a7 GlibTCPServer: defer shutdown_request to avoid closing the socket too early OLPC #10906
In Python 2.7, shutdown_request was added to the BaseServer class and
TCPServer was adopted to use it instead of close_request in the
_handle_request_noblock() path.

GlibTCPServer must be adapted to account for this, so that
shutdown_request is not allowed to prematurely allowed to close the socket,
in the same way that close_request is ignored.

Fixes collaboration in activities that rely on this mechanism for
sharing (including ImageViewer and Read)

Signed-off-by: Daniel Drake <daniel@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Tested-by: Gonzalo Odiard <gonzalo@laptop.org>
Tested-by: Simon Schampijer <simon@laptop.org>
13 years ago