594 Commits (master)

Author SHA1 Message Date
Sam Parkinson f48c3247f6 Merge branch 'godiard-bundlebuilder_gitls' 10 years ago
Gonzalo Odiard e50a90c243 Bundlebuilder check if activity files are in git
git version 1.9.3, in a activity directory created inside sugar-build/activities
return a empty string when the command "git ls-files" is executed,
and no repository is configured.
We need verify that condition, and process a file list from the filesystem.
10 years ago
Martin Abente Lahaye 98a29ae12c Save spent time on activities
Use set_active and save events to keep track of the time,
in seconds, that the activity is on the main screen. The
time is calculated and stored each time an activity is
open/resumed and closed. Therefore, each activity entry
will have an array of seconds for each time it was used.

This makes a 1 to 1 relationship between the spent and
lauch times. In orders words, we can reflect not only the
"when", but also the " for how long".

Even though this time does not necessarily represents the
real time the user "used" the activity, it is a low-cost
approach for reflecting time.

This is a long requested featured from deployments that have
been using statistics tools on journal metadata, and this
patch is already being used by OLPC-AU.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Martin Abente Lahaye 85b173eb25 Remove Palette logic out of PaletteWindow
PaletteWindow is the parent class of two different subclases,
Palette and _ToolBarPalette. Palette uses state changes intensively
in order to display secondary content, but _ToolBarPalette does not.

Because of this, Palette overwrites PaletteWindow's popup and popdown
methods adding one extra param called "state". This param is not required
either in PaletteWindow and specially not in _ToolBarPalette.

Therefore, any piece of code inside PaletteWindow which is meant for
Palette subclassing, should be moved out of PaletteWindow and placed
in the Palette class, where it corresponds.

This patch fixes the cases where _ToolBarPalette breaks because of this
mismatch.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Martin Abente Lahaye 2f19a41432 Fix black palettes
Push the palette widget opening process to the latest
in order to avoid the race condition where the animation
takes of the place of the real palette.

Fixes #2184

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Gonzalo Odiard 2456465d79 Enable collaboration by default on activities
When we implemented read max_participants from activity.info [1]
we changed the default value of max_participants, from 0 to 1.
Before, was responsability of the activities set max_participants == 1,
when the activity not implemented collaboration.
This change make the default backwards compatible.

[1] d0cca91fe8
10 years ago
Sam Parkinson 6e81c67622 Remove a double / in webkit1 activity's request's filenames 10 years ago
Gonzalo Odiard c70e5c678d Fix regression introduced by b9d6b628a9
When calculated the palette height based in the size of children,
forgoten add the border size. That moved the palette in the device icons
4 pixels to the bottom, then the gap was miscalcuated and the border
button border was not draw.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard dfeba6184e Fix drawing of gap on palettes attached to widget - Fixes #4776
In Gtk 3.10, Gtk.Window is drawing a gray border around the palette.
This patch draw a black rectangle defore we draw Gtk.render_frame_gap
to draw the border but with a gap to connect to the attached widget.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Martin Abente Lahaye 45e7ba5ed6 Fix and clean Palette secondary label
Removes unnecessary code ie., changing label color.

Refactor label settings, to put all in the same place.

Fix changes to label_alignment that does not honor
original vertical padding settings.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Gonzalo Odiard b9d6b628a9 Show palettes at the screen bottom with the right size - Fixes #4673
On Gtk 3.10, Gtk.Menu at the bottom of the screen are resized
to avoid fall out of the screen, then report a wrong height.
We need calculate the size of the children and move the Menu up.

This problem is visible on the Clipboard icon palettes,
and in journal objects palettes at the bottom of the screen.

This patch also rename a variable 'rect' to 'req', because is
a Requisition (width, height) and not a Rectangle (x, y, width, height).

Finally, to avoid a error with the secondary text on the palette,
when copy text from the terminal, reove the '¬r' character.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 4a565dacac Add a method to get all the extensions associated to a mime type
This is needed to solve problems with mismanaged extensions in the journal.
10 years ago
Gonzalo Odiard 568e0254d7 Pep8 fix 10 years ago
Walter Bender d0cca91fe8 Assign max_participants in activity.info
As part of an effort to "honor" max_participants, this patch supports setting
max_participants in activity.info, thus making it available in the bundle.

By default, if it is not set in the bundle, the previous behavior persists.

In support of this change, a cache of Activity bundles is
maintained. The goal is to eliminate unnecessary calls to the file
system.
10 years ago
Martin Abente Lahaye 72994bd73c Add Icon.get_badge_size
Add get_badge_size method to Icon class, so it can be accessed
by other Icon sub-classes.

ie., jarabe.frame.notification.NotificationPulsingIcon.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Gonzalo Odiard e47feb3b0f Make webactivity and webkit1 implementations independient
We can't import webkit and Webkit2 in the same process
and that was introduced in 4ea52b3173

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Prasoon Shukla 9e253b5965 Add description in journal object palette - Fixes #4686 10 years ago
edudev 7f1061acbd Add capture device support
Extend acme-volume-alsa.c so it be used to handle not
only the speaker but also the microphone.
10 years ago
Sam Parkinson 4ea52b3173 Now show sugar object choosers as file pickers in web activities 10 years ago
Daniel Narvaez 01ed63ee4b Fixes for pep8 1.5 10 years ago
Sam Parkinson cbf325d994 Extend API for activities notifications
Add a new method, called notify_user, to the base
Activity class.

This method can be used by activity developers to
send notifications to the new notification front
end. ie.,

    self.notify_user('New High Score!',
                     'Your score is over 8999')
10 years ago
Daniel Narvaez f92f0efe06 Fix pep8 10 years ago
Sebastian Silva 2a7d4da38a Implementation of pixbufs for use with X11 window icons. 10 years ago
James Michael DuPont a082cf1cca better debugging 10 years ago
gauravp94 cf45a7a732 Add verbosity to the activity tests 10 years ago
gauravp94 d4b2e87276 port optparse to argparse in bundlebuilder.py 10 years ago
Gonzalo Odiard 7678540056 Remove c implementation of mime methods
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard b02ade879a Implement mime.get_mime_parents using python
This is the only method pending implemented in c,
then we can remove seven files previously used.

Add a test for a corner case untested previously

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard faa0d42084 Use Gio.content_type_guess to identify mime type - Fixes #4715
Replace the use of a custom implentation in SugarExt

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard e762fa938c Add accelerator to PaletteMenuItem - Fixes #4716
With the port to Gtk3, we lost the display of the keybord shortcut
available in MenuItem.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 53a148f88c Restore suspend catch the wrong exception
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 62b60fa1e1 Inhibit suspend while a activity is shared
In some network environments, suspend/reume can make loose
messages and break collaboration. This patch inhibit suspend
when collaboration start. The implementation can be used by activities
or Sugar to inhibit suspend/resume when needed.

More information in http://dev.laptop.org/ticket/10363

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
10 years ago
Gonzalo Odiard cf7a5905fd Remove unused code
Fixes pyflakes error

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 30b67cc3d1 Webkit1 compatibility: send 404 error if the file don't exists
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Sam Parkinson 8c8c913cb2 Fixes #1929, update toolbar examples in activity doc strings 10 years ago
Martin Abente Lahaye 6c64a7d020 Revert "Keep updated CellRendererInvoker self.path updated - Fixes #4717"
This reverts commit 353e05a086.
10 years ago
Gonzalo Odiard 353e05a086 Keep updated CellRendererInvoker self.path updated - Fixes #4717
Since CellRendererInvoker can set the path at None if a mouse event
is out of the area of the renderer, can break the use of touch,
if happen after the mouse movement. This patch set the path,
in the point_in_cell_renderer test, for the positive case,
solving the issue.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Manuel Quiñones 5802d67ee1 Icon: deprecate icon_size
pixel_size should be always used now.

Change SMALL_ICON_SIZE to cover the other sizes at settings.ini.

Adds a transformation to keep backwards compatibility for some
time. This will be removed in the future.
10 years ago
Ignacio Rodriguez 1ced93e14b pep8 fixes for 'Add menu width chars' 11 years ago
Ignacio Rodriguez 463101b19d Add menu width chars to sugar3 11 years ago
Daniel Narvaez 71b42a2da0 Fix chaining up to the parent 11 years ago
Daniel Narvaez acff63467d Fix pyflakes errors 11 years ago
Sai Vineet 29738c9087 Add Activity Testing API and check command to setup.py
./setup.py check now invokes tests in tests/ directory. tests directory should
have integration(UI tests) and unit(unit tests) sub directories, but it isn't
necessary to have any dir. of the above.
11 years ago
Emil Dudev c0319389e8 Touch UI: esc fullscreen
This patch moves sugar3.graphics.Window key-press-event handling.
It will now be after any other event handling from deived classes.
Fixes #475
11 years ago
Emil Dudev d918e7afff Remove GConf completely
Removes sugar-gconf from SugarExt
Removes gconf-2 dependency
11 years ago
Emil Dudev db2ba3e579 GConf to GSettings port 11 years ago
Gonzalo Odiard 93437ddedf Add get_show_launcher() in bundles other than activitybundle
This is needed now by Sugar, after (sugar commit)
f4638b5f481478e96195d55aa38c90fd33db9aee

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
akskumarnot 81b388c554 Use proper formatting syntax, fixes #2170 11 years ago
Sam f43d5f8d24 Fixes #4634, issue where spaces in bundle ids crashed sugar 11 years ago
Gonzalo Odiard dee29c0e75 Be able to click in a tooltip - Fixes #991
This issue was reported many times, when new users see a tooltip
try to click, and are confused when there are no action.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard f52b4e1a96 Make webactivity compatible with webkit1
If a env variable SUGAR_USE_WEBKIT1 exists,
uses a different module to start the activity using a local webserver,
borrowed from wikipedia activity.
When use webkit1 the web inspector is not enabled, because do not work.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard c47b842fb9 Fix mistake in the last commit
Error detected by the tests.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard b8074549f6 Fix cloning activity in sugar - SL #4608
Probably this code was not included in the initial port from gtk2 to
gtk3, because is only used by Sugar, but now we need it.

I changed the way the parameter dist_name is used,
then a complementary patch in sugar is needed

Fixes #4608

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Walter Bender cd5292881e Add single_instance field to activity bundle
This field can be used by activities that need to be restricted to a
single open instance. Usage is:

single_instance = yes

jarabe/model/shell.py has been modified look for this field in a
separate patch to Sugar.

Together these two patches constitute the implementation of Sugar
feature Launch Limits [1]

[1] http://wiki.sugarlabs.org/go/Features/Launch_Limits
11 years ago
Manuel Quiñones 1baebb2051 Merge branch 'gir' of https://github.com/dnarvaez/sugar-toolkit-gtk3 into dnarvaez-gir 11 years ago
Diego Naula ddd566c847 Fixes #3665: add is_fullscreen() method to Window class
Signed-off-by: Diego Naula <dnaula1997@gmail.com>
11 years ago
Ezequiel Pereira f13a14a2b3 Add journal filter for .xo bundles
Fix #1712
11 years ago
Daniel Narvaez 28423249f6 Make gir files depend on their library
Otherwise with parallel builds we might try to build gir files
before the library causing an error. This happened once in the
buildbot.

Fix #4606
11 years ago
Gonzalo Odiard 32f97b48c3 Workaround to enable start of activities still using service_name
While we deprecated service_name a long time ago, still there are activities
using it, and is a source of frequent problems.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Narvaez cf392735a0 Ensure logs path exists when initializing logs
Otherwise, for example, if we start datastore alone
like we do in the tests, we try to create logs without
the directory and traceback.
11 years ago
Daniel Narvaez 6d6469ee12 Remove now unused method 11 years ago
Daniel Narvaez fd831931ad Remove duplicated code
And deprecate duplicated function.
11 years ago
Daniel Narvaez a1b6b129aa Make the debug script profile aware 11 years ago
Daniel Narvaez fe192be798 Add a SUGAR_HOME environment variable
We should really use XDG directories but that will be a bit
more complicated and require migration scripts. This is a
short time solution to "expose" the dot sugar directory in
sugar-build.
11 years ago
Daniel Narvaez e908aeb8ca Remove unused imports 11 years ago
Daniel Narvaez d12a1d5131 Fix translations domains to point to new toolkit 11 years ago
Daniel Narvaez b83ddaefaf Revert "Fix translations domains to point to new toolkit"
This reverts commit abe0de3ef8.
11 years ago
Daniel Narvaez abe0de3ef8 Fix translations domains to point to new toolkit 11 years ago
Daniel Narvaez 9717e5954b Fix translations in non standard prefix
This drops a lot of code at the same time. The code in
__init__ was:

* Using a SUGAR_PREFIX environment variable that is not
defined anywhere
* Hardcoding prefix to /usr
* Setting up the sugar-base domain which doesn't exist anymore

The i18n module code was overcomplex because it was thought
for language packs which we don't support anymore, it was
not handling correctly locales with a country prefix, it
was hard coding the python prefix and it was not sorting
the directories as it intended too anyway.

The logic is very simple now. Use the locale directory in
the same prefix sugar-toolkit-gtk3 was installed, unless
SUGAR_LOCALEDIR is defined (for self contained bundles).
11 years ago
Walter Bender ec5f064c10 Ensure entity value is type str
There are times when the entity value passed in for substitution
is of type unicode. This causes Rsvg to fail when processing the
SVG. This patch checks for unicode and converts it to utf-8.

Fixes #4621
11 years ago
Daniel Drake e01837f8be Drop use of deprecated dbus.glib
When writing Python apps that will use asynchronous DBus calls and
signals, python-dbus must be initialised with the appropriate main
loop.

sugar currently does this by importing the datastore module from
sugar-toolkit-gtk3, and the datastore module uses the deprecated
and confusing dbus.glib module (which automatically and non-obviously
sets the default GLib main context as the DBus mainloop).

Eliminate the dbus.glib usage from sugar-toolkit-gtk3 as part
of the effort to make sugar initialised the DBus mainloop in a
more explicit and non-deprecated fashion.
11 years ago
Manuel Quiñones fa7a765f4e Drop session.py
SessionManager has been moved to shell, and the other class has
nothing inside.
11 years ago
Manuel Quiñones d45560e3c7 Web activity: quit the GTK main loop when activity is destroyed
Fixes #4603 .

In GTK activities, this is done by _ActivitySession when the activity
unregisters itself, in _complete_close method.

Making the web activity aware of session logout will be handled in
another patch for the shell, see http://bugs.sugarlabs.org/ticket/4611
11 years ago
Manuel Quiñones c8fa6bd694 Web activity: set activity name as the title of the window - SL #4605
At least View Source uses it.
11 years ago
Martin Abente Lahaye ba8c435e50 Include string.h to sugar-fatattr
According to dsd's wisdom, without being
included, strerror is undeclared.

Fixes #4600 sugar crashing when copying
journal entries to documents folder.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
11 years ago
Walter Bender 7d931c845e Fix annotation for xdg_mime_list_parents
There is a fatal crash in Sugar when retrieving mimetypes for some Journal
entries when contructing the icon palette (for both the Journal list view
and detail view). We isolated the problem to xdgmime.c, the call to
xdg_get_mime_parents. Dnarvaez observed that the annotation for the
return argument was missing and that the annotation for the return for
mime_list_parents was wrong. This patch fixes these annotations.

Fixes #4530
11 years ago
Daniel Drake 147d80aa78 ActivityFactory: don't run which to check for rainbow
One less thing to do in the common activity startup path.
Also, which might not be available.
11 years ago
Manuel Quiñones 0b47dd37b1 Merge branch 'objectchooser_preview-try2' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-objectchooser_preview-try2 11 years ago
Gonzalo Odiard 3e6507af6e Add a option to the objectchooser to show the object preview
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard 8e975bd5c9 Add a method to create a Pixbuf with the preview in the metadata
This code was moved from sugar expandedentry.py to be available to use
in other places. Some activities like Portfolio or JournalShare
have this code copied.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Drake 670fc44b1a Icon: handle image loading errors
If the icon can't be found, fall back on showing a generic icon.

Useful when activity/content bundles specify a bad icon, which is
unfortunately true for most content bundles in current existance
(because the icon field was previously unused).
11 years ago
Daniel Drake f46ac7ba6a ContentBundle cleanups
Share get_installation_time() between all bundle types so that it works
with content bundles.

Add get_tags() stub, this is called by Sugar.

Remove unused fields: l10n, category, subcategory, etc.

We remove support for running OLPC's content bundle indexer.
This is assumed to go away now that Sugar will support content bundles
as first-class objects.

Some minor behavioural fixes and cleanups.

This now implements http://wiki.sugarlabs.org/go/Content_bundles
and when care is taken to include all the fields required by old
Sugar versions, there is no change in compatibility of existing or
new content bundles.

Required for http://wiki.sugarlabs.org/go/Features/Content_support
11 years ago
Daniel Narvaez 363eef5293 Fix pep8 11 years ago
surajgillespie 8c736d3870 Pass activity name to the webactivity 11 years ago
Manuel Quiñones 2643a0b25c Merge branch 'at' of https://github.com/dnarvaez/sugar-toolkit-gtk3 into dnarvaez-at 11 years ago
Daniel Drake efaf9f9b2f Avoid use of uuid module
Upon import of uuid, that module uses ctypes.util to find libuuid/libc,
which involves forking a shell process which then forks and runs ldconfig.

ldconfig performs a whole bunch of disk accesses. This is a slowdown.

uuid.getnode() is also documented to be slow. Lets avoid using it in
the activity launch path; we don't need such a high degree of
randomness.

This makes activities launch 1-2 seconds faster on XO-1.
11 years ago
Daniel Narvaez 6d2b97daec Fix pep8 errors
pep8 1.6.4 detects more issues
11 years ago
Daniel Drake 778b10f8d4 Allow override of user library path
This allows for override of ~/Library the same way that can be done
for ~/Activities. Useful for automated testing.
11 years ago
Daniel Drake be91f84a4b Avoid auto-import of bundle helpers (#4527)
The new bundle helpers were being auto-loaded with sugar3.bundle due
to their placement in __init__.py. This was causing Gi to be imported,
breaking GTK2 activity launches.

Move the helpers to a dedicated module.
11 years ago
Daniel Narvaez 8fff409046 Add missing headers
Fixes distcheck
11 years ago
Daniel Narvaez 9778f1d35f Don't set AT_SPI_CLIENT
This is not necessary anymore with latest at-spi2-atk
(See commit 683739dea15d7c02c217a404d8c5d9d7af076a57)
11 years ago
Daniel Drake 12476caa12 Improve bundle API for bundleregistry changes
The bundle API is a bit confusing and inconsistent. Fix up the
ActivityBundle and ContentBundle classes to be more consistent and to
work with the ongoing improvements being made in bundleregistry.
11 years ago
Daniel Drake f4c1bd152a Add bundle instantiation helpers
Add some helper functions for use by upcoming changes in the Sugar shell.
11 years ago
Gonzalo Odiard ad3c163023 Fix ObjectChooser backwards compatibility
The last change brak compatibility with the use in activities
without set the filter_type parameter, because None is not
a allowed value in the dbus call.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Narvaez f54229efd2 Move setting AT_SPI_CLIENT to discover
It needs to be called as early as possible before unit tests
has a chance to import gtk.

Hopefully will fix random test failures we are seeing in buildbot.
11 years ago
Daniel Narvaez 6d319619f0 Factor out the discover logic to the test module
This avoids duplication in sugar and sugar-toolkit-gtk3
makefiles.
11 years ago
Gonzalo Odiard da3786d2fb Add filter_type optative parameter to objectchooser
Constants are defined to select the different filter_type
values. A comment was added to document the use.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Narvaez 19bc2268d4 Log the UI tree on error
The dump method doesn't actually print anything, just
returns the tree as a string.
11 years ago
Daniel Narvaez 5bef5a82d2 Set the AT_SPI_CLIENT variable in the tests
This ensures the test itself is not recognized as a client
by the registry. I'm not sure how that happens since we are
not loading gtk, but it does. Not being a real gtk client with
a mainloop we wasn't answering dbus calls and causing the registry
to hang and fail.
11 years ago
Daniel Narvaez 4dc7b9e4a4 Don't set atspi timeout
Looking at the code I'm unconvinced this behaves as expected,
in certain cases at least. So reverting it for now to avoid
confusion.
11 years ago
Daniel Narvaez 521778636e Add a UIUnitTest class
To make it easier to write UI unit tests.
11 years ago
Daniel Narvaez c86c582e19 Resync with the sugar-build implementation of tree.py
Development continued there for a while. Now I will remove it
and used the toolkit implementation instead.

Changes:

* Retry faster
* Handle GLib errors
* Don't always dump the tree
* Support master atspi api
11 years ago
William Orr c736ffefcd pep8'd sugar3 11 years ago
William Orr 1252d95671 pep8'd sugar3.test 11 years ago
William Orr 69a7aa8f68 pep8'd sugar3.presence 11 years ago
William Orr edbc8f53b3 pep8'd sugar3.graphics 11 years ago
William Orr 51f07bba81 pep8'd sugar3.dispatch 11 years ago
William Orr 220c9b68ef pep8'd sugar3.datastore 11 years ago
William Orr 9e4454a2ed pep8'd sugar3.bundle 11 years ago
William Orr 8a6c935dd0 pep8'd sugar3.activity 11 years ago
Walter Bender 3e5c37f3f8 Adding SugarExt for setting hidden attribute on FAT files
This extension is used by Sugar to set the HIDDEN attribute for
.Sugar-Metadata. By creating an extension, we avoid the need to add an
additional dependency (fatattr) to Sugar. The code is modeled after
fatattr, using an IOCTL call get and set FAT file attributes.

There is a corresponding patch for model.py in sugar/src/jarabe/journal
11 years ago
Daniel Narvaez 9396b09ee4 Send bundleId and objectId to javascript
Also use the json module to generate the environemnt
dictionary string. This takes care of a None objectId
cleanly.
11 years ago
Gonzalo Odiard 58bab9cf6a Do not use the translated summary to get the value from gettext in the bundle builder
This patch is a rebased push from pull request #31

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Narvaez 1f5e39f3a8 Cleanup environment initialization
We are not setting up a single sugar.window.environment object.
11 years ago
Daniel Narvaez a1b73ff527 Rename HTML to web 11 years ago
Daniel Narvaez 8e381f9e2f Make the inspector toggle work reliably 11 years ago
Daniel Narvaez 28fe9b757f Use a relative path in the activities url
It's just a bit cleaner.
11 years ago
Daniel Narvaez a30af509c2 Rework HTMLActivity to not inherit from Activity
This will make the activity use less memory and start faster.
11 years ago
Daniel Narvaez 3aadcbcbf0 Move the websocket service to the shell
It's a first step to make html activities much lighter. It also
just makes a lot more sense to have them interact directly with
the system rather than proxying through the python activity.
11 years ago
Daniel Narvaez b276f61da1 Use javascript to setup websocket port and key 11 years ago
Daniel Narvaez 3f908ef999 Deprecate and ignore the SUGAR_EMULATOR variable 11 years ago
Daniel Narvaez 2fcac13791 Toggle the inspector on and off with ctrl-shift-i 11 years ago
Daniel Narvaez 0abae0e7d0 Use a custom scheme for app content
To get the origin right.
11 years ago
William Orr e649070aa2 Replaced deprecated GObject methods with GLib methods 11 years ago
William Orr 3a8760c9e4 Fixed crash in journal when mousing over activity icons 11 years ago
Simon Schampijer ba1abd4a33 Palettes: remove comment about deprecated API
We make use of this API in the shell and in the toolkit itself
and never removed those deprecated calls. Let's leave it like
this for now and remove the comment.
11 years ago
Daniel Narvaez 55a072470f Silence pyflake 11 years ago
Daniel Narvaez 9f71aa864f Remove various unused bits 11 years ago
Daniel Narvaez 6c4a9b34a1 Add a get_xo_color API 11 years ago
Daniel Narvaez 671ad1ae3e Require authentication before making API calls
Otherwise anything might access the bus.

Note: This will not work if the user moves to another html page.  They
will not have a port/key passed in the query string of the URL, so
they won't be able to connect.
11 years ago
Daniel Narvaez ff5612caee Add API to close an html activity
We are exposing it using a websocket server. The port of the server
is passed in the search string of the file:// url.
11 years ago
Daniel Narvaez 6cbc3d1a48 Improve XOColor fallback logic
We was failing if the value in gconf was None. Also parsing
the string once just to see if it's valid was pretty dumb.
11 years ago
Daniel Narvaez 680c501ad6 Add a binding for gconf_client_set_list (using strings) 11 years ago
Daniel Narvaez d4019684a3 Add exec script to build pure html activities
An hello world activity using the script
http://git.sugarlabs.org/hello-world/mainline/trees/html
11 years ago
Manuel Quiñones 7156e67aa2 Color Palette: get back horizontal padding - SL #4325
The PaletteWindow lost the horizontal padding when it started to be
used as replacement of palette menus.  So now each implementation has
to add the padding.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
11 years ago
Walter Bender b4c0b2258f Use gettext algorithm to determine locale for activity.linfo
When activity bundles are loaded, the activity name and summary are
pulled from an activity.linfo file that is associated with
locale. However, sometimes locale, which uses $LANG has been
superceded by $LANGUAGE as set in
extensions/cpsection/languages/model.py. This patch uses the same
algorithm as gettext.py to find activity.linfo

This problem is seen on the .AU systems which use en_AU for locale and
en_GB for LANGUAGE.
11 years ago
Daniel Narvaez 7cb4a1d72d Handle invalid /desktop/sugar/user/color
This is currently breaking the activity list unit test where
the profile has not been initialized. But, more in general,
it seems like we should not be crashing if our settings has
unexpected values.
11 years ago
Daniel Narvaez 6202d4d5cc Bind xdgmime in SugarExt
And use it in the sugar3.mime modules. This allows
to get rid of the pygtk generated sugarbase module,
along with the wrapping code.

Also add more cases to test_time to make sure
everything is still working.
11 years ago
Daniel Narvaez e6397cf2db Some initial infrastructure for UI tests
The uitree module exposes the at-spi tree. We can use it to do
functional tests of the UI, by checking if the expected
widgets exists, clicking them etc.

A simple example of how this can be used is in the test, which
runs a window and check that it has the expected button.
11 years ago
Daniel Narvaez 65560b0b94 Add a SUGAR_ACTIVITIES_PATH environment variable
Useful for tests but perhaps for other stuff too.
11 years ago
Daniel Narvaez c5f30a9fbe Support out of source directory builds
It works similarly to automake. The current working directory
is used as build directory.
11 years ago
Daniel Narvaez 07d593fe52 Rework the install to use git files
Instead of installing everything except a few ignored files. This
is consistent with the other packagers.
11 years ago
Daniel Narvaez 9db81af598 Remove a few unused keywords 11 years ago
Daniel Narvaez db448c4eea Remove a lot of unused imports
Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com>
11 years ago
Manuel Quiñones a3cda7c49f Revert "icon.py: move all imports to the top"
We have circular imports if we do this.

This reverts commit 355ca09a8c.
11 years ago
Manuel Quiñones 355ca09a8c icon.py: move all imports to the top
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
11 years ago
Simon Schampijer b3048112d6 Palette: handle the case where setting the transient window does fail, SL #4221
The expected parent window did likely change, for example
this can happen when we switch the Home Views while a Palette
of a canvas icon is popping up (SL #4221). In that case
send the 'popdown' signal so that for example the hovering
state feedback can be cleared.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
11 years ago
Simon Schampijer dcbdcd77fe i18n get_locale_path: handle the case when the default locale is not set, SL #4450
If the default locale is not set (see SL #4450 for a use case), get_locale_path
does now return None so that the sugar-activity script can handle that case
cleanly.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Daniel Drake <dsd@laptop.org>
11 years ago
Simon Schampijer 63b8e87b1a ToggleToolbutton: do hide the tooltip when clicked or touched
This is the same behaviour as for the RadioToolButton and the
ToolButton. See 5a1b380dd6 where
we did the same for the RadioToolbutton.

Updated the toolbuttons.py test to be able to test that code
path.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
11 years ago
Manuel Quiñones a7e0e5ae57 Make the size of the preview image a public constant
Instead of hardcoding it.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
11 years ago
Daniel Narvaez 7ba72c4c61 Remove duplicated library flags
They are already provided by the pc files.
11 years ago
Manuel Quiñones d32523655c Fix subtoolbars height - SL #4019
Remove the vertical padding from the box that contain the toolbar, and
change the order of drawings in the container widget so that the
outline looks right.  This has been tested with screenshots, see the
gif animation attached to the ticket.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
11 years ago
Simon Schampijer 4199c0596b Notebook: fix type in doc string 11 years ago
Simon Schampijer 56da4d8e0c Animation: Remove non-descriptive doc string 11 years ago
Simon Schampijer d77c6f563d Remove halfish done incomplete docstring 11 years ago
Daniel Narvaez 2bbeba2446 Logger: add cleanup function
Factored out from the sugar shell code

Acked-by: Simon Schampijer <simon@laptop.org>
11 years ago
Manuel Quiñones ee0e15b95d Fixup for previous commit, 693eaab9 - SL #4384
Forgot this change from my reviewers.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
11 years ago
Manuel Quiñones 693eaab975 New ProgressIcon widget - SL #4384
A new icon widget useful to display progress.  It is compatible with
sugar3.graphics.icon.Icon .  The progress is represented filling the
icon.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
11 years ago
Carlos Garnacho 3596e8c6cb palettemenuwidget: Ensure the widget is realized before popping it up, SL #4388
Otherwise the internal state is messed up, GTK+ grabs may be held on
unrealized widgets.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
11 years ago
Manuel Quiñones e36513f925 Adapt to icon changes - SL #3569
- In IconEntry: dialog-cancel -> entry-cancel

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Kaufmann b729680568 Truncate labels on Palettes SL #4164
This was lost when PaletteMenuItem was added in
2d0ac2a952 of sugar source code.

That class does not handle the text_maxlen argument (default to 60). I
used this argument to set the Gtk.Label's size:
label.set_max_width_chars and use MIDDLE for its EllipSizeMode as
sugar3.graphics.palette.Palette does for its title and subtitle.

With these settings, the title of the palette and its items share the
same behaviour and are rendered with the same width.

Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 3859ff0022 WidgetInvoker: do not handle the clicked signal when there is no user interaction, part of SL #4307
There are cases where there is no user interaction but we do
receive a clicked signal: in the clipboard we do have
GtkRadioToolButton which are derived from the GtkToggleToolButton [1].

The 'clicked' signal is emitted when the 'active' property
changes [2]. We use the 'active' property to indicate the
current active clipping. In the Invoker we do check now
if the event originated a user interaction or if it was
generated due to a for example a property change.

[1] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html
[2] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html#GtkToggleToolButton--active

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 1dd2aec650 get_mime_description, use Gio from dynamic bindings - SL #4323 #4307
'import gio' was importing static gobject, and mixing static and
dynamic bindings provoked a crash.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Kaufmann 0788e546f6 TrayViewport: handle the case of the widget not yet allocated in the size-allocate callback - SL #4279
In the callback, the allocation can be 1x1 if it is yet unknown [1].
This is the case of trays that start hidden by default, like the one
in Browse activity.

[1] http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-size-allocate

Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones b6152b023a ActivityBundle: don't wrap the temporal icon path in a TempFilePath - SL #4276
In the Journal, CellRendererActivityIcon is calling its do_render
method after the temporal file is removed.  This is because we wrap
the icon path in a TempFilePath to control its deletion, but as we
don't maintain any reference to it, its __del__ method deletes the
temporal file.

Note that returning the path directly has one disadventage: the
temporal file is left in /tmp .

As a comment in the get_icon method of ActivityBundle say, ideally we
should return the icon data.  But that implies a major change in the
Journal model and views, and in the CellRendererIcon class.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones 0231969bba PaletteWindowWidget: set border width to make outer space in the container - SL #4295
In the palette reimplamentation, commit 48ad255a, set_border_width was
removed.  Add it again to the corresponding widget, and get the value
from the theme.  Previously the value was given by:
self.get_style().xthickness .  Now we can use the widget border.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho a22d4ee50d keygrabber: Handle XI2 key events, part of SL #3895
XInput2 events are coerced by active grabs on the alt-tab handling
code in sugar shell, even if the keygrabber itself does core events.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones 8a9d10cda7 ColorToolButton, ToggleToolButton: do the drawing in the correct order - SL #4303
1. if the palette is up, draw the black background
2. draw the button itself
3. if the palette is up, draw the grey outline

Exactly as the ToolButton does.  Otherwise the outline is not visible.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer f5fee8a144 Popdown the palette if an item in the content box gets activated, SL #4191 and SL #4253
The Palette is popped down when an item is activated. We can
listen on the 'button-release-event' on that widget. We make
sure the widget is of type PaletteMenuItem. This is similar
to what the GtkMenu is doing, see gtk_menu_shell_button_release [1].

[1] http://git.gnome.org/browse/gtk+/tree/gtk/gtkmenushell.c#n915

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer e49f621110 TrayIcon: get the black background and outline for palette popup - SL #4089
Do the same as in ToolButton, update do_draw method to do the drawing
in the code.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 2a6ad05bc9 RadioToolButton: draw the outline properly - SL #3936
Now the do_draw method is exactly the same as the one for ToolButton.
This considers the border that the radio button can have, which is
needed for the changes made in the theme to get back the original
style.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones e456cf1c9e Fixup for previous commit - SL #4224
The palette can be None.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Kaufmann 1497ebc006 CanvasIcon: do not keep it ACTIVE when right-click twice SL #4224
When a CanvasIcon is right-clicked __button_press_event_cb and
__palette_popup_cb are called but not __button_release_event_cb. So,
ACTIVE flag is set but immediately removed by __palette_popup_cb and
PRELIGHT is set.

Now, if the user right-click it again while the palette is popped up,
__button_press_event_cb is called and it sets ACTIVE flag but
__palette_popup_cb is not called again because the palette is already
shown and that makes the icon to keep in ACTIVE state.

This patch checks if the palette is popped up when
__button_press_event_cb is called and if the palette is not popped up
the ACTIVE flag is set.

Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones d418d1cbdd Tray: wrap them in EventBoxes in order to make them themeable - SL #3565
We have to convert the boxes to EventBoxes because otherwise the
background is not themeable [1]

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

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 06fab044e2 RadioToolButton: make sure _hide_tooltip_on_click is initialized in time
If we pass the active property to the constructor do_clicked seem
to get called. Before chaining up to the Gtk.RadioToolButton
constructor we need to initialize the variable.

This is a followup of 5a1b380dd6

Signed-off-by: Simon Schampijer <simon@laptop.org>
Tested-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Kaufmann 7b8fa5e406 Activity title entry: auto-select text when tap/click in the entry, SL #4036
When the user taps/clicks in the activity title entry, the text
is selected automatically to change the whole title of the activity
easily.

Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 297cd72757 window: Avoid odd scrolling on OSK presence
Now it suffices to have the widget and osk rectangles intersect,
to have "clear-request-area" emitted, so cater for the situations
where the focus rect lies outside the osk area.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 5a1b380dd6 RadioToolButton: hide tooltip on click, SL #4268
This is the same behaviour as with the ToolButton.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 97869472ff Fixup of 4234ca684e 12 years ago
Daniel Drake 4234ca684e Restore use of XSMP client
In the GTK3 port we mistakenly moved from using the EggSMClientXSMP
class to the (stub-like) EggSMClient base class for Sugar's XSMPClient
class, instantiated for every activity.

This meant that the GTK3 activities weren't registering with the
session manager, meaning that they won't automatically save their work
when the user shuts down, and they can't inhibit shutdown, etc.

Restore this functionality by adding the appropriate header so that
EggSMClientXSMP is introspectable, and then use it from the Python code.

Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 6a01d9228d Follow up fixes for the lockable Palette support
- do not call set_expanded when the parent does not
  have that attribute, this is the case in the custom
  abacus Palette in the Abacus activity

- add the same code in the button release event callback
  that we have as well in the click event callback

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 9c230ea498 Alert: fix for traceback in the draw - SL #4251
The Gtk.StyleContext get_background_color method needs a
Gtk.StateFlags as a parameter.  Feeding it with a GtkStateType doesn't
work anymore in recent gtk+.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 6064fb30cc Add support for locking Palettes, SL #4008
This adds a property that indicates that a Palette should
behave in a locking manner. The behaviour is the same
as with the secondary Toolbars: when you hover over the invoking
widget the Palette will popdown and react to mouse movements,
leaving the invoker area or the Palette itself will popdown
the Palette again. When you click the invoking widget
the Palette will be locked. You have to unlock it again
to pop it down.

This patch makes the DescriptionButton and the Colorbutton
work.

If the DescriptionButton or the Colorbutton are placed in
the primary toolbar they will share the locked state with
the secondary toolbars. Only one can be locked at a time.

When a secondary toolbar is unlocked we do force that the
open Palettes are closed. Having a locking Palette in
a subtoolbar will also work (Activity Toolbar case or
ColorButton case in a few examples). There is no state
sharing implemented here at the moment, but so far we
do only have cases with one lockable Palette in a
subtoolbar.

This will also fix the case where we want to use the
OSK to edit the description of the activity SL #3887.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Daniel Narvaez f3f72a7b16 Dispatcher: use the gtk3 toolkit
Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones ac3b0a3a14 Update style of Description palette - SL #4167
We can now use the PaletteMenuBox.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer c64d5590b0 CellRendererInvoker: no need to reset the controller manually anymore
This got fixed properly in b2df135844
12 years ago
Carlos Garnacho b2df135844 Reset event controllers on GdkEventGrabBroken
This event means that the widget being listened won't receive
further input events as something else grabbed devices, reset
event controllers in this case.

This helps with SL #4128 where we did reset the long press
controller manually.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones 5505eb30bf Set correct padding and size for the palette, window implementation - SL #4144
A new API is provided: PaletteMenuBox is a container to be used in
Palette.set_content().  This is to hide the implementation details and
set the corresponding paddings and sizes.

Usage:

  box = PaletteMenuBox()
  palette.set_content(box)

Then we can append items to it, like:

  item = PaletteMenuItem(text_label, icon, xo_color=xo_color)
  box.append_child(item)

  separator = PaletteMenuItemSeparator()
  box.append_child(item)

We can also append any widget, and the box will handle the paddings:

  box.append_child(widget)

style.DEFAULT_PADDING for horizontal and vertical padding is the
default.  But can be overriden:

  box.append_child(widget, horizontal_padding=0, vertical_padding=0)

Details:

- move palettemenuitem.py to palettemenu.py

- Width of palette: make it a minimun size of 3 Sugar grid cells.

- Padding of content, secondary box: we need top and bottom padding,
  which can be set when packing the items container inside the
  secondary box.

- Padding of menu items: needs to be just for left and right, so move
  the padding to a new horizontal box.

- Padding of separators: unlike GtkSeparatorMenuItem, GtkSeparator
  doesn't support padding.  But we can wrap it in a GtkEventBox and
  force the height of the widget there.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 811676ef4e CellRendererInvoker: always reset the long-press controller
Follow up of: ad9b0e9866
12 years ago
Simon Schampijer ad9b0e9866 CellRendererInvoker: add support for long-press events
This one is tricky because where the CellRendererInvoker is
used (Home View activity list and Journal list view) we do
use Palettes based on a GtkMenu. In the Journal list view
this Palette has submenus so it can not be easily replaced
with our custom Palette. That is why I am trying to make this
case work with a GtkMenu.

When the Palette does pop up it grabs the focus. This means that
the invoker does not see a TOUCH_END event. Same is the longpress
controller that is why we have to reset the controller when
the long-press is detected, otherwise it is not usable a second
time.

The default behavior of a GtkMenu is that it does pop down
on a long press/release event. So when doing a long press
on the icon the Palette was popping down directly. We can
stop this by listening on the button-release event in the
Menu and return True when the event happens in the invoker
coordinates.

Finally there are several issues with motion events: in the
invoker we listen to motion events on the treeview in order to
be able to popup/popdown the Palette on hovering over the
icon. This event is triggered as well when the icon is
tapped. We do check the origin of the event and do not trigger
the enter/leave when originated from a touchscreen. We do setup
the path for the CellRenderer however.

The second case where the motion events are triggered is
when you tap somewhere in the Palette when it is up. For
example you want to get to one of the submenues. Since the
Palette tracks motion events to work for the hover case [2]
we do get a leave event when the Palette is tapped and the
Palette does pop down. Same here, we check if the event
originated from a touchscreen and do discard it in that
case.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 2834344b98 DescriptionButton, ShareButton: set the toggle_palette option to True
Setting this option will popup the Palette on left click or tap
and popdown the Palette if it is up. This functionality has been
added with c4165967d5e05607db8b3e0969b516da87855431.

The ShareButton, which derrives from the RadioMenuButton, had the
desired behavior already overriding the on_clicked method, we
do this now in the invoker.

The DescriptionButton did only handle the popup part so far, with
this change the Palette will also popdown when the button is clicked
and the Palette is up.

Since both are Toolbuttons we have to set the hide_tooltip_on_click
property to False otherwise the popdown part would not function, see
1a8f89226b for more info.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones f0fe248e30 Palette Menu Item: set/unset INSENSITIVE state flag - SL #4144
The theme will display the insensitive items grayed out.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 8f4474f3f5 SugarLongPressController: default the trigger_delay property to 600ms
Discussed and compared options with Gary.
12 years ago
Simon Schampijer a515976dff WidgetInvoker: add support for long-press events, part of #4127
The WidgetInvoker will decide if a long press has been made
or not. We watch out for TOUCH_END events and when a long-press
event has been seen before we stop further propagation of the
event, hence there won't be any button-release or clicked
events available to the user of the widget.

There are several widgets using the WidgetInvoker, and those
handle differently touch events. The GtkButton does have a widget
implementation to handle touch events, it does stop further
propagation and emits the pressed/released signal for further
consumption [1]. We will not get a button-press/button-release
event for a touch event in this case.

The default behaviour for widgets e.g. a TreeView is to transform
the touch events into pointer events [2], for those widgets we do get
a button-press/button-release event for a touch events.

[1] http://git.gnome.org/browse/gtk+/tree/gtk/gtkbutton.c#n1809
[2] http://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c#n5876

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer de7c5b90bd TrayIcon: set the touch mask on the event box, part of SL #4127
We do need to add the mask if we want to receive
the 'touch-event' signal. The Gtk.EventBox does
set the touch event mask by default.

[1] http://developer.gnome.org/gtk3/3.4/GtkWidget.html#GtkWidget-touch-event
[2] http://git.gnome.org/browse/gtk+/tree/gtk/gtkeventbox.c#n411

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 25497c7677 Set correct background for subtoolbars - SL #3987
- remove set_app_paintable from _Box to fix the bad coloring of
  subtoolbars.  The documentation say we can't rely on it to paint the
  themed background when this is set [1].

- don't call Gtk.EventBox.do_draw in the _Box do_draw because that
  will not paint the child toolbar.  Call the child do_draw instead.

- revert 7fc29c9d which was a workaround for the most frequent usage

[1] http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-app-paintable

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 8af0d49591 GtkMenu: use point_in_cell_renderer for CellRendereInvoker to check if a point is in, part of SL #3921
We use get_rect to check if the mouse is still over the invoker
in order to know when to popdown the Palette. The CellRendererInvoker
did return the allocation of the TreeView so far.

We already have a point_in_cell_renderer method in the
CellRendererInvoker so we can use this to check if the mouse pointer
is over the cell or not. The method point_in_cell_renderer is made
public to make it clearer that it can be used from the outside.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 2a76b10ce0 CellRendererIcon: add active state - SL #3989
For press feedback.  Do this connecting to the treeview press and
release signals, as the palette invoker does.  After this, the active
state can be styled in the artwork.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones f5b96e1fbd CellRendererIcon: add prelight state and render background - SL #3989
This is to provide feedback on mouse over.  The styling needs to be
done in the artwork component.

Because cell renderers don't inherit GtkWidget anymore, the styling
can't be done using the __gtype_name__ .  Instead, it has to be done
adding a css class [1] to the style context, and rendering the background
in the reimplementation of the do_render method.

For reference, see how GtkCellRendererToggle implements render [2] and
how Baobab app does it [3].

[1] http://developer.gnome.org/gtk3/3.2/GtkStyleContext.html#gtk-style-context-add-class
[2] http://git.gnome.org/browse/gtk+/tree/gtk/gtkcellrenderertoggle.c#n338
[3] http://git.gnome.org/browse/baobab/tree/src/baobab-cellrenderers.vala#n125

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer a36ada99fd CursurInvoker: add long-press gesture to raise Palette
This adds long-press gesture detection to the CursorInvoker
used in the EventIcon. This will make this gesture available
for the View icons for example.

We need to keep a boolean around to detect when a lon-press
event has happened and ignore the button-release event in
that case.

We add as well checks in the CursorInvoker and WidgetInvoker
for the enter events if they are of type Gdk.CrossingMode.NORMAL,
otherwise the Gdk.CrossingMode.TOUCH_BEGIN enter events that are detected
when a touch starts are handled and interfere.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 590785f7d1 EventIcon: make sure we are able to dismiss the Palette
Without this patch when tapping on an EventIcon
we do get a GDK_CROSSING_UNGRAB leave event when
the Palette is raised. Because of this the Invoker
does not know how to popdown the Palette when
you tap outside or when clicking on actions in the
Palette itself.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
olpc user 080f25e73b EventController: make detach function available
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Carlos Garnacho <carlos@lanedo.com>
12 years ago
Simon Schampijer 1d9965c972 SugarLongPress gesture controller: remove animation
We found out that the animation does not solve the issue
of visually indicating the long-press gesture to our
satisfaction. This is because you do not know upfront
which icon does have a primary action and more options
that can be revealed with the long-press gesture and
the animation itself. We would need to theme the gesture
better first as well. That the animation is a separate
window does raise several side effects as well which we
would need to solve first.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Carlos Garnacho <carlos@lanedo.com>
12 years ago
Simon Schampijer 20ef297526 Window: show unfullscreen button on button and touch events
We did track mouse motion events so far to show the unfullscreen
button. This adds the tracking of button events (left, middle, right
click) and touch tap.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 1224ab1451 Palettes: move PRIMARY and SECONDARY constant to the base class
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 063e40d77d ActivityButton: set the toggle_palette option to True
Setting this option will popup the Palette on left click or tap
and popdown the Palette if it is up. This functionality has been
added with c4165967d5e05607db8b3e0969b516da87855431.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 1a8f89226b Add toggle_palette property for Palette invoker, SL #4065
The property does specify whether the invoker will popup/popdown
the Palette on button left click/touch tap. It defaults to False.

In the toolbutton we add a property if the tooltip should be popped
down on a click, this is set to true to have the same behavior as
before.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Carlos Garnacho 5ce0273900 gestures: Fix silly typo on get_center() implementation
Don't mix up coordinates when calculating the bounding box center

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
Tested-by: Manuel Kaufmann <humitos@gmail.com>
12 years ago
Carlos Garnacho 4682e49823 Prevent crash if the controller didn't handle TOUCH_BEGIN
Fixes http://bugs.sugarlabs.org/ticket/4024

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones e4e1881662 CanvasIcon: use set_state_flags and unset_state_flags instead of deprecated set_state - SL #3989
set_state is deprecated [1] and using flags improves the code and
makes it less error prone, because there is no need to handle the
prelight state in a variable _in_prelight_state .

[1] http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-state

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones e591d9aa80 CanvasIcon: check if we have a palette in the button release callback
The buddy icon in the home view has the mouse pointer inside at boot,
moving the pointer outside provokes an error because the icon doesn't
have a palette attached yet.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer f91cfbfc8a Cursor tracker: only display the cursor in mouse/trackpad mode
Listen on RawEvents: listen for raw events on the root
window and decide whether the cursor is shown or not. A
touch begin event will hide the cursor a motion or button
press event will show it.

There is no API in XFixes to know whether a cursor is shown
or not so we keep track of the current state. Furthermore
we trap X errors if any bad access should happen.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 845371f2bc Icon: add new class CanvasIcon - SL #3989
Move code from shell ActivityIcon to new class CanvasIcon, that will
allow to reuse it in other icons.  This class inherits EventIcon and
adds state and drawing handling.  The right-click callback for the
palette invoker is not needed.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer f569e7ef98 Cleanup: remove unused variable 12 years ago
Carlos Garnacho c546aaaf7c gestures: Add remove() call to SugarGestureGrabber
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho fe0022cd8f swipe: Allow setting allowed directions as a set of flags
The allowed swipe directions can be specified now at construct time,
so the swipe-ended signal is only emitted for those directions.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Gonzalo Odiard 2a15fbc0f2 Add in the metadata info about every startup time
Signed-off-by: Walter Bender <walter.bender@gmail.com>
Tested-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 78ae2459e3 LongPressController: add 'pressed' signal with x and y coordinates
The 'pressed' signal does emit the x and y coordinates
of the position where the event occurred. This can be used
for example in the Browser where we need to know at which
exact position the long-press event occurred.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho b79a391902 Put an error trap around XIAllowTouchEvents()
These calls are occasionally failing with BadAccess on seemingly
still valid (not yet notified upon) touch sequences. Workaround
this Xorg bug with error traps at the moment, those would catch
no error when this is working properly.

Fixing this bug will be tracked at SL #3981

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 81ee0632c9 gesture-grabber: Ignore events not meant for the root window
The passive touch grab is set on the root window, so if touch
events get to a different window it's best to leave those for
GTK+ to handle.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer d16afa8f16 Build fixup of c635ee5dd7 12 years ago
Carlos Garnacho c635ee5dd7 Include SugarGestureGrabber in .gir generation
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 470d14a749 swipe: enter into "recognized" state when there is a motion directionality
This allows for checking the controller state as events are fed into it
without connecting to begin/end signals

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho c5fe8a26f6 Add API to allow for tracking global gestures
The new API is added to SugarExt. Similar to the
KeyGrabber we listen on the root window for the
events. We then filter for gestures recognized by
an event controller.

You can add any event controller of the ones recently
added to the toolkit to be tracked and can pass a
specific area where the starting point of the gesture
should be, it's then allowed to go out of bounds as
it moves.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones 76da9331a4 Alert: use GtkStyleContext instead of deprecated GtkStyle - SL #3907
Using the deprecated GtkStyle is giving an error [1] in the sugar
alert.

[1] http://bugs.sugarlabs.org/ticket/3907#comment:3

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Gonzalo Odiard 3a30d3f84e Add management of summary property to the activity.info file
This summary is translatable as the Activity name and will be displayed
in the Activity list in the Home View.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Gonzalo Odiard 7eec45f031 Fix radiopalette due to api change in toolbotton
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer b44a235d9f OSK support: canvas auto panning based on input focus
Listen to the 'request-clear-area' and 'unset-clear-area'
of the widget and adjust allocation accordingly.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 2bedec55ed RadioToolButton, ToolButton, ToggleToolButton: add back the getter for the icon_name property
Follow up of fe11a3aa23
12 years ago
Simon Schampijer c411190178 RadioToolButton: remove incomplete and not as descriptive documentation 12 years ago
Gonzalo Odiard fe11a3aa23 Make icon_name api consistent between the different toolbuttons
As discused in the mailing list [1] the api to set the icon in sugar
ToolButton, RadioToolButton and ToggleToolButton is inconsistent,
and with the port to GTK+ 3 the differences are visible (SL #3849).

This patch changes the API of ToolButton, RadioToolButton and
ToggleToolButton to override the icon-name property and add an
Icon instance with the set_icon_widget method.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>

[1] http://lists.sugarlabs.org/archive/sugar-devel/2012-September/039624.html
12 years ago
Carlos Garnacho fe4667f0f5 event-controller: For the long-press notification animation check on the screen being actually composited
Fixes the notification being a black rectangle on screens with an alpha colormap,
but with no compositing manager.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer d4934d73a7 IconEntry, set_icon_from_name: handle case when icon can not be found cleanly
Sugar crashes if the sugar theme has not been set (in sugar-session)
in the set_icon_from_name method since some if the requested icons
can not be found. Handle that case cleanly.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 39226e69c5 event-controller: Don't install headers 12 years ago
Simon Schampijer ad950f4d06 event-controller: Put event-controller in alphabetical order in the Makefile 12 years ago
Carlos Garnacho 282ccc7734 event-controller: Rename gir to SugarGestures
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 495a9f43d1 event-controller: Document SugarTouchController
Also set up introspection annotations wherever it's needed

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 1a0ddf4d54 event-controller: Use "scale" to refer to the current value in the zoom-controller
This changed both the emitted signal and the getter

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho aa652b8754 event-controller: Implement zoom-controller on top of SugarTouchController
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 1fe3d4234d event-controller: Implement rotate-controller on top of SugarTouchController
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 1ba68fa120 event-controller: Add SugarTouchController
This is a base class for gesture recognizers using possibly more
than a single touch.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 1ecc0f5e1d event-controller: Rename emitted progress signals
started/finished was renamed to began/ended, and "updated" signal
has been added too to complete the semantics

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 64a759e2dc event-controller: Improve rendering/themeability of the UI notification for the long-press controller
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 73c0688689 event-controller: in the long-press controller rename "timeout" property to "trigger-delay"
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho ec42f63630 event-controller: rename notification signal "swipe" to "swipe-ended"
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho a2b77a2166 event-controler: Add UI feedback for long-press
style and colors of the progress feedback are subject to change

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 63ff76b95f event-controller: Add widget property to SugarEventController
controllers were already intrinsically related to a widget, so
set a property so controllers have a back reference to the widget
they attach to

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 7d0a6e25af event-controller: Add documentation/g-i annotations
This makes the .gir correct

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho 239ecdfbcd event-controller: Enable introspection
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho ade02f958b event-controller: Add separate library for event controllers
SugarEventController is an abstract object that attaches to a widget
and interprets an arbitrary set of events. Implementations of that
object get to define the sequence of events that trigger these.

The basic touch gestures (long press, rotate, swipe, zoom) have
been implemented on top of that object.

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 2d0ac2a952 Add new PaletteMenuItem widget for usage in mixed content Palettes
As Palettes can either include a Gtk.Menu or a Gtk.Window we
have to use a "false" menu when we want to have both
functionality in a Palette. This is a new class PaletteMenuItem
for those use cases.

Code highly based on the work from Gonzalo Odiard. The API is
based on the one from GtkImageMenuItem [1].

[1] http://developer.gnome.org/gtk3/3.4/GtkImageMenuItem.html

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones dbe32ec7cf Style the palette menu header - SL #3879 #3836
Make the first item of the menu a custom class, to make the children
widget allocate using all the available space.  And so it can be
styled in the theme.

Remove the set_sensitive(False) from the header item, because the icon
was greyed out.  This was to make it an informational, unclickeable
item.  I am making it look like an informational item in the theme
instead.  This has the problem that its still navigateable with
keyboard and clickeable, so it has to be fixed later.

Add a separator below the header.  Is a custom class so it can be
styled in the theme.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 5cb4a48c5b Subtoolbar Palettes do not display at correct position, SL #3891
GTK_WIDGET_NO_WINDOW has been deprecated but we can use
gtk_widget_get_has_window() instead [1]. This brings back the
old code.

Follow up of: 5ab2b80546

[1] http://developer.gnome.org/gtk/stable/GtkWidget.html#GTK-WIDGET-NO-WINDOW:CAPS

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 7fc29c9d58 Set an initial background color for the subtoolbar container - SL #3890
The styling of this toolbar elements should be ported to the theme at
one point.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 5ab2b80546 Frame Device icons: Palette is not drawn at the correct position
We are adding the x value twice (from the allocation and from the origin)
in get_rect of the WidgetInvoker which we derive from in the FrameInvoker.
In the toolkit-gtk2 code [1] we did add the allocation.x value when
the widget does not provide its own gtk.gdk.Window (gtk.NO_WINDOW) [2]. This
is the same check we do above if the widget has a window and we set x and y
to 0 there which sounds sane enough to me.

[1] d1f68419e7/src/sugar/graphics/palettewindow.py (line716)
[2] http://www.pygtk.org/docs/pygtk/class-gtkobject.html#method-gtkobject--flags

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 9b391fa3cf CellRendererInvoker: various fixups
- the GtkCellRenderer (which our CellRenderer derives from) is not a
  GtkWidget and therefor the 'get_display' method does not exist, we
  fallback to the default display in that case [1]
- the get_rect method should return a Gdk.Rectangle now, see other
  invokers
- check if event.mode is Gdk.CrossingMode.NORMAL to trigger a mouse
  leave see 289787e8c6 for a similar
  case
- todo: the Palette does not go away when the mouse leaves the
  widget

[1] http://developer.gnome.org/gtk3/3.4/GtkCellRenderer.html

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer c6c2220f0d CellRendererIcon: clipping rectangle not applied, SL #3872
We do not apply the clipping rectangle in do_render, we
need to call clip on the cairo_t as well. This solves the
issue in the Journal and in the Activity List View where
the icons do only appear on hovering over them.

See gtk_cell_renderer_render [1] for background information.

[1] http://git.gnome.org/browse/gtk+/tree/gtk/gtkcellrenderer.c#n731

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones c0756f48d4 Fix the badge position at the icon attach point - SL #3835
The convert script pygi-convert.sh commented out the call to
info.get_attach_points() in commit 820efa56

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 289787e8c6 CursorInvoker: check if event.mode is Gdk.CrossingMode.NORMAL to trigger a mouse leave
Like in the WidgetInvoker we check now first if the leave
event has the mode Gdk.CrossingMode.NORMAL, only then we trigger
a mouse leave to popdown the Palette. This stops the Palette
to appear/disappear in a loop.

Signed-off-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 447cfc2df1 CellRendererInvoker: in Gtk.TreeViewColumn get_cell_renderers is now get_cells
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 1ed4eb8ad5 Icon: Gdk.CairoContext does not exist
First of all 'Gdk.CairoContext' does not exist, this has been
made up by the conversion script in 820efa56b9

We do not need the previous gtk.gdk.CairoContext here anymore, we
do only want to set the background of the context here. See the
toolkit-gtk2 commit where this has been simplified [1].

[1] 6ce463585c

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Daniel Narvaez 4cc6967c8d Reimplement the wm module in C
The wm module in sugar-toolkit-gtk3 has been reimplemented
in C and made available through introspection. The same was
hard to achieve directly using the Gdk API.

We can drop wm.py and the wrapper around gdk_property_change.

Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones a14574c666 Finish the port of the CellRendererIcon
In pygtk custom cellrenderers were done inheriting
gtk.GenericCellRenderer, and overriding the on_* methods.  Now we
inherit Gtk.CellRenderer and the methods to override changed to do_* .

The destroy signal was moved to Gtk.Widget [1] so the Gtk.CellRenderer
doesn't have it anymore.  Now we do the cleanup in the python
destructor method.  A testcase tests/graphics/customdestroy.py shows
how is done.

tests/graphics/cellrenderericon.py tests the usage.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>

[1] http://developer.gnome.org/gtk3/stable/ch24s02.html#id1459754
12 years ago
Gonzalo Odiard 40a3b2ece1 Take list of supported image formats mime types from GdkPixbuf - SL #3845
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Kaufmann 478e208582 Generic mime types: add video mime types that are supported by Jukebox
Extending the generic list will make those mime-types available in the
filter list (ObjectChooser, Journal). We have been extending the generic
list similarly before [1][2].

For the longer term fix see [3] to add support for custom mime types in
the ObjectChooser.

[1] http://bugs.sugarlabs.org/ticket/1319
[2] http://bugs.sugarlabs.org/ticket/1340
[3] http://bugs.sugarlabs.org/ticket/834

Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones 305384be3c Fix the drawing of ColorToolButton, RadioToolButton and ToggleToolButton
Draw a black background in the buttons when the palette is up, as
commit 01a06943 did with the ToolButton.  As the comment for that
commit states, we can change the prelight background color in the
theme, but not when the mouse moves over the Palette.

Also add testcase to test the three toolbuttons.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones cd590b552b Fix the Handle Rsvg get_width() -> props.width, get_height() -> props.height
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones 00761f3d01 Revert "Fix the drawing of ColorToolButton, RadioToolButton and ToggleToolButton"
This reverts commit 1e6cba8474.
12 years ago
Simon Schampijer 030ab202c8 Bundlebuilder: don't fail to package if git is not installed, OLPC #11341
When git is installed, it will return non-zero if it gets asked to list
the files in a non-git-repository. The subprocess.Popen instantiation is
successful in this case and the returncode attribute will contain the
error code from git. The current code handles this fine and does fall
back to our own source file listing facility.

If git isn't installed, however, trying to instantiate subprocess.Popen
will fail with OSError. We need to catch this and fall back to our own
source file listing facility like we do for the non-repository case.

Signed-off-by: Simon Schampijer <simon at laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Manuel Quiñones 1e6cba8474 Fix the drawing of ColorToolButton, RadioToolButton and ToggleToolButton
gtk_paint_box is deprecated [1] and now we can use the CSS to change
the style of the button's prelight state.

To test the buttons, I provide a patch for HelloWorld activity [2].
They are added in the main toolbar.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>

[1] http://developer.gnome.org/gtk3/stable/GtkStyle.html#gtk-paint-box
[2] http://dev.laptop.org/~manuq/shell-port/test_gtk3_buttons.patch
12 years ago
Manuel Quiñones e2ddd70c13 Fix the drawing method of _IconWidget, used by IconTray
Invoker draw_rectangle() now receives a Cairo context, as can be seen in [1]

The testcase is also fixed by this commit.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>

[1] http://git.sugarlabs.org/sugar-toolkit-gtk3/sugar-toolkit-gtk3/blobs/master/src/sugar3/graphics/palettewindow.py#line1018
12 years ago
Simon Schampijer 09e9373612 Key grabber: make grab_keys introspectable
To the grab_keys function we pass a list of strings the key
grabber should listen for. In order to make this
introspectable we need to annotate the function correctly. I
followed the instructions for passing arrays [1] and have
chosen the type of the array data looking at [2].

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Daniel Narvaez <dwnarvaez@gmail.com>
Tested-by: Manuel Quiñones <manuq@laptop.org>

[1] https://live.gnome.org/PyGObject/IntrospectionPorting#Passing_arrays
[2] https://live.gnome.org/GObjectIntrospection/Annotations#Default_Basic_Types
12 years ago
Gonzalo Odiard 6532b2d4dd Replace signal used in UnfullscreenButton to enable use with touch - SL #3798
Use clicked instead of button-pressed-event, because button-pressed-event
and the button-release-event are not emitted on a touchscreen device by
a touch in GTK+ 3.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones f70075323c Solve errors in ColorToolButton to enable activities to use it
This patch solves the following problems:

* API changed in the drag and drop code in Gtk.
  Drag and drop is not working yet (SL #3796)
  but the code needed to enable drag and drop is ported.
* Changes in the way to get color information from the theme
  this is because Gtk.Style was deprecated by Gtk.StyleContext.
* The internal button was not visible.

Signed-of-by: Gonzalo Odiard <gonzalo@laptop.org>

-----
v2: Fixed comment based on manuq feedback, and add a note
    about the non working drag and drop.
12 years ago
Simon Schampijer 6438c89dea EventIcon: update to the latest implementation used in the shell port
The icon consists of an GtkEventBox and an IconBuffer. The
GtkEventBox is a subclass of GtkBin which has its own window and
therefor is used to catch events for our IconBuffer which does
not have it's own window. The window of the EventBox is
made invisible.

The EventIcon does not emit the 'activated' signal when clicked
anymore, you can listen to 'button-release-event' to know
when the icon has been clicked. The EventIcon uses the
CursorInvoker to invoke a palette the same way as the
CanvasIcon did.

We keep the same API as with the CanvasIcon, only the 'size'
property is changed to be called 'pixel_size' in order to
make clearer which values it expects to be passed. We don't
expect a GtkIconSize to be passed here.

Another option would have been to put a SugarIcon inside a
a GtkEventBox and make the properties available through an
icon property but the API would have not been as nice and
logically it seems to make more sense to have the IconBuffer
being the base for both the SugarIcon and the SugarEventIcon.

This patch has ben developed based on the one that is
used in the shell port.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewd-by: Benjamin Berg <benzea@sugarlabs.org>
12 years ago
Daniel Francis 428d648fe3 Add accelerator functionality to the ToggleToolButton, SL #3774
This code is copying the code from the ToolButton.

Signed-off-by: Daniel Francis <francis@sugarlabs.org>
12 years ago
Daniel Drake 3bbc4ef1c6 presence: use RoomConfig1 to configure channel properties (#3629)
This code was still using regular Telepathy properties to
set important configuration such as Anonymous=False.

However, as of Telepathy specification 0.24.0, these properties have
gone away.

    http://telepathy.freedesktop.org/spec/Channel_Type_Text.html
    Changed in 0.24.0. This interface used to have a bunch of clunky
    Telepathy.Properties. They have been removed in favour of D-Bus
    properties on the Room2, Subject2 and RoomConfig1 interfaces.

Switch to using RoomConfig1 (where available) to set this
configuration. The invite-restricted flag is no longer available and
actually seems to have been removed a long while back.

Fixes sharing of activities over gabble on new platforms such
as Fedora 17.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
12 years ago
Simon Schampijer ea1389cbbb Icon: remove documentation that has not much of a value 12 years ago
Simon Schampijer 61d54cf7e2 EventIcon: Have a default create_palette method
The create_palette mechanism allows to create
palettes on demand and not for each icon upfront
whether it will be needed or not.

If you hover over an EventIcon and there is no
palette already associated with the Invoker, the Invoker
will call create_palette to see if it can be created
on demand. With this patch the EventIcon will return None
here (see as well CellRendererIcon or ToggleToolButton which
are having the same default behavior).
When subclassing EventIcon the create_palette method can
be overwritten and a Palette returned (see for example
the ActivityIcon in the HomeView).

Without this patch you can see tracebacks when hovering
over the EventIcon because the Invoker tries to call
create_palette.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Benjamin Berg <benzea@sugarlabs.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 020917ac02 EventIcon: all the events go directly to the event box
Position the event box window above the windows of its child, that way
all events inside the event box will go to the event box. If the window is
below, events in windows of child widgets will first go to that widget,
and then to its parents [1].

[1] http://developer.gnome.org/gtk3/3.4/GtkEventBox.html#gtk-event-box-set-above-child

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Benjamin Berg <benzea@sugarlabs.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer eccef5b092 EventIcon: Make the child window of the event box invisible
We do use the EventBox only to receive events, hence the
window that the even box creates should be a GDK_INPUT_ONLY
window, which means that it is invisible and only serves to
receive events [1].

[1] http://developer.gnome.org/gtk3/3.4/GtkEventBox.html#gtk-event-box-set-visible-window

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Benjamin Berg <benzea@sugarlabs.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer d57212a040 Make sure we have a widget before attaching an invoker, SL #3460
The _ToolbarPalette does get passed the invoker on
initialisation. But we do create the PaletteWindowWidget
later. We do attach the invoker to the widget when calling
_setup_widget that is why it was still working without that
patch.

This patch prevents the traceback that we had because of not
having a widget at this point.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Tested-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer af320f91f8 Replacing set_data/get_data with a python attribute
set_data/get_data not available anymore is not available anymore [1]. The
recommended approach is using a python attribute, which we do.

Changing to use the attribute in the activity class slipped by mistake
into 6330204e91.

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

Signed-off-by: Simon Schampijer <simon@laptop.org>
Tested-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 6330204e91 Move the translation initialisation to an earlier stage, SL #3654
Must be done early, some activities set translations globally. Remove
the support for the langpackdir.

Signed-off-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 433c6391ec Activity Toolbar Description input field wrap text, SL #3586
Signed-off-by: Gary C. Martin <garycmartin@googlemail.com
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Manuel Quiñones 1beb8757c1 ToolButton: add 'icon_name' as a GObject property SL #3658
Sugar ToolButton inherits from Gtk.ToolButton but is not overwriting
'icon_name' property.  So 'icon_name' can be passed to the constructor
of Sugar ToolButton but the result is different than setting it via
ToolButton.props.icon_name.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer ab643a1076 Display spinner cursor when saving after closing the activity, OLPC #11691
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Daniel Drake <dsd@laptop.org>
Tested-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Daniel Drake fd7b599710 Object Chooser: update for GDK3 get_xid()
In GDK3 the 'xid' attribute is gone and is replaced with
gdk_x11_window_get_xid(), or the get_xid() method in Python.

Needed to be able to open the object chooser from Browse without hassle.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Carlos Garnacho f36fc4ae85 Tray: set a minimum size in the viewport so that it allows scrolling
The minimum height/width requested by the GtkViewport still tries to cater
for all contained children, which makes the [VH]Tray widgets to grow as
new items are added. Instead, request a minimum width/height of 0 to avoid
the Tray from growing, and having scrolling kick in instead.

Also, fixed what seemed to be a typo in do_get_preferred_height(), where
the viewport width was requested instead.

http://bugs.sugarlabs.org/ticket/3522

Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 7a07bb1001 Draw accelerator in Palette SL #3459
The accelerator in the primary information in the Palette
has not been drawn because there was not enough space
reserved for it. The preferred size we get back for the
Palette window does not include the accelerator of the
Gtk.AccelLabel. We need to include that in our calculation for
the Palette size.

In order to make that information available which is part
of the Palette class we need to pass the instance to the
PaletteWindowWidget instance.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer 16040b2f30 Draw border for palette all the time SL #3383
gtk_render_frame_gap [1] does expect an initial and an end
coordinate for the gap. paint_box_gap [2] which we used
before expected a starting position of the gap and the width
of the gap as parameter.

The patch does calculate the end coordinate parameter for
the gap from the initial coordinate and the width of the
gap.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>

[1] http://developer.gnome.org/gtk3/3.0/GtkStyleContext.html#gtk-render-frame-gap
[2] http://developer.gnome.org/gtk/2.24/GtkStyle.html#gtk-paint-box-gap
12 years ago
Simon Schampijer 3c39375d9b Use json as included in Python SL #3142
We use json as included in Python. This will make Sugar dependent on
Python 2.6 and Python 2.7 to have the highest JSON performance.

Signed-off-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer 425e9becfc Remove the workaround for missing gobject-introspection bindings of Rsvg
gobject introspection bindings for librsvg have been pushed to librsvg
master [1] in 2.35.0, which solved [2]. We only have slight adopts to
make in our usage, for example we can not pass the data property
to the default constructor anymore and get_width and get_height is not
available anymore for the handle, but we can use the properties
instead.

The sugar-toolkit-gtk3 and therefore Activities that have been ported
to it do need a version of librsvg >= 2.35.0 to be able to work,
which ships for example with Fedora 17.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>

[1] http://git.gnome.org/browse/librsvg/
[2] https://bugzilla.gnome.org/show_bug.cgi?id=663049
[3] http://developer.gnome.org/rsvg/stable/RsvgHandle.html
12 years ago
Simon Schampijer 01a06943a2 Mimic the behaviour and style of the Sugar GTK+ 2 toolbutton palettes in GTK+ 3
First we needed to port the Palette code to use a minimum size. The default size
is two times the GRID_CELL_SIZE. Since the request-phase of the traditional GTK+
geometry management has been replaced by a height-for-width system [1] we have
to compensate for that. Furthermore we need to pass the invoker from the
PaletteWindow to the _PaletteWindowWidget for the gap calculation code for
drawing the border around the Palette.

We do the drawing of the border for the toolbutton in the base class, moved
this from the ToolbarButton and made sure we are drawing in the right order.
In the ToolButton we draw as well a black background for the ToolButton when
the Palette is up. While the mouse is over the button we can do that in the
theme, but not when the mouse moves over the Palette.

[1] http://developer.gnome.org/gtk3/3.0/ch25s02.html#id1525688

Signed-off-by: Simon Schampijer <simon@laptop.org>
12 years ago
Gonzalo Odiard e04043dc0b Mimic the behaviour and style of the sugar GTK+ 2 sub-toolbars in GTK+ 3
This draws the grey line around the toolbutton icon with a gap at the
bottom and a grey line at the top of the subtoolbar. Furthermore it
gets the highlightning of the button correct, in the pressed and hover
state. This patch depends on the sugar-artwork patch with the id
7464b808eb12b1df650952e3c8214acff1d1360f.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer afcb2fcea9 Port get_preview method to cairo
Previously we were using a GdkPixmap [1] created with the get_snapshot [2]
method of the Gtk.Widget. GTK 3 encourages to use cairo surfaces
now instead.

The ported mothod does create a cairo surface similar to that of the canvas'
window and draws on that. Then we create a cairo image surface with
the desired preview size and scale the canvas surface on that.

Several people have been involved in this work: Gonzalo Odiard,
Manuel Quiñones and Benjamin Berg.

[1] http://developer.gnome.org/gdk/stable/gdk-Bitmaps-and-Pixmaps.html#GdkPixmap
[2] http://developer.gnome.org/gtk/stable/GtkWidget.html#gtk-widget-get-snapshot
12 years ago
Simon Schampijer ef2c624b5a s/Descriptions/Description fixup of d9e1a72fcd
Spotted by Chris Leonard: we use Description in all the other
places.
12 years ago
Simon Schampijer afbf0ff326 Window: fixup of wrong conversion introduced by pygi-convert.sh
With 820efa56b9
gtk.gdk.x11_get_server_time(window) wasn't correctly converted
to GdkX11.x11_get_server_time(window). Found when tesing
collaboration. Opened 669264 for the upstream fix of
pygi-convert.sh.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer bb02ef0ead Remove the Naming Alert
With the new 'Write to Journal anytime' feature it is possible
to write a description within an activity. Hopefully this leads
to more usage of the Journal for reflection by the learner. The
hinting nature ('you have not named your session yet') of the
Naming Alert has not been replaced, though.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Reviewed-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer d9e1a72fcd Add DescriptionEntry to the activity sub-toolbar
This is the implementation of the 'Write to Journal anytime'
feature [1].

The patch itself adds a DescriptionItem to the activity
sub-toolbar to make editing a Journal entry description
from within the activity possible. The code has the same
error handling as the TitleEntry.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Signed-off-by: Walter Bender <walter.bender@gmail.com>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Reviewed-by: Manuel Quiñones <manuq@laptop.org>

[1] http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime
12 years ago