1169 Commits (master)

Author SHA1 Message Date
Gonzalo Odiard a8e75af790 Check release mouse postion in CursorInvoker
This affect when a palette will be opened, by example in the BuddyIcon
in the Sugar home.
9 years ago
Gonzalo Odiard a19cf9ed27 Do not trigger events on EventIcons when button release is outside - #4863
The industry convention for mouse driven menu options is for them
to be activated when two conditions are met:
* a button down event occurs with the pointer inside the option, and;
* a button up event occurs with the pointer inside the option.

This issue was already solved on the PaletteMenuItem,
but the EventIcon have the same problem. This change add a 'activate' event,
that control that the two conditions are meet.
The code in Sugar need use this event instead of button-release-event.
9 years ago
Sam Parkinson 9fc5b49329 Only activate menu items if the mouse releases in them - fixes #4863
Ticket URL <http://bugs.sugarlabs.org/ticket/4863>
9 years ago
Gonzalo Odiard 7a3d23e2b6 Don't add a label on RadioToolButton when set icon_widget - Fixes #4875
When we use set_icon_widget(), GtkToolButton set a private property
contents_invalid = TRUE [1], and gtk_tool_button_construct_content [2]
is called. Then if the label widget not exist, a GtkLabel is added.
This is a problem for us, by example in the Clipboard buttons in the frame.
By adding a empty Gtk.Box instead of a label, we avoid the label creation.

But as this is a internal implementation of Gtk, can change in the future,
in fact the issue is not visible with Gtk < 3.16

This patch is based in a pr sent by Sam Parkinson

[1] https://github.com/GNOME/gtk/blob/master/gtk/gtktoolbutton.c#L1415
[2] https://github.com/GNOME/gtk/blob/master/gtk/gtktoolbutton.c#L357
9 years ago
Gonzalo Odiard 04d8f596bc Add get_bundle method to activity.py
When a programmer need open one activity from other [1]
usually need display in the user interface information about the activity
to open, like the name or the icon.
This method allow get this information, previously only available on jarabe.

[1] http://wiki.sugarlabs.org/go/Features/Start_activity_from_another_activity
9 years ago
Gonzalo Odiard a873cfc04e Remove _HeaderSeparator
The palette using a Gtk.Menu, had a separator displayed using a custom widget,
but that was not well displayed (the line didn't had the palette width
due to margin on the palette) and was broken on Gtk >= 3.16
Instead of use that widget to draw the separator line between at the bottom
of _HeaderItem, as we do with the toolbar buttons when the palette is displayed.
9 years ago
Gonzalo Odiard 8af97e3e17 Replace use of deprecated icon_size by pixel_size
It's a trivial change, but the warning message was filling the logs.
9 years ago
Sam Parkinson 78dcd5a7e4 Fix GtkMenu palette positioning in Gtk 3.16 9 years ago
Gonzalo Odiard 9087eab839 Properly fix wrap mode on secondary text for toolbars
This patch solves a bug introduced on:
034706a482

Pep8 fix by Martin Abente Lahaye (reviewer).

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
9 years ago
Gonzalo Odiard 034706a482 Secondary text on palettes should respect the max width - Fixes #4862
When a activity have a title very long without spaces,
the text can't be wraped with the default wrap mode (WORD)
Use WRAP_CHAR to solve this issue.
9 years ago
Martin Abente Lahaye e8553c13a1 Add skip-install-mime option to bundlebuilder
Historically, distro packagers have been using bunblebuilder, via
"setup.py install", to populate packages directories and files.

The install procedure uses ActivityBundle.install_mime_type to install
custom mime types, by creating symlinks and updating the system mime
types database via the update-mime-database tool.

When ActivityBundle.install_mime_type is executed during packages
creation, the symlinks end-up broken in the final package and the use
of update-mime-database populates the final packages with a new copy
of the database files which could clash with the system copy.

This patch adds a new option, called --skip-install-mime to "setup.py
install" to skip the execution of ActivityBundle.install_mime_type and
avoid the issues mentioned above.

Activity packagers should use this new option. The creation of symlinks
and the execution of update-mime-database should be done in post install
packaging steps.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
9 years ago
Gonzalo Odiard fc4d629b50 TTS in the toolkit need initialize gstreamer - Fixes #4851
If is not initialized, the check for the espeak plugin will fail.
This patch also check for the espeak plugin at the beginnig
avoiding check every time the function enabled() is called.
9 years ago
James Cameron 4c22ba5b35 Add escape key to palette windows
Popdown a palette window in response to escape key.
9 years ago
Gonzalo Odiard 8224fefc50 Pep8 and pyflakes fixes 9 years ago
Gonzalo Odiard 2186c53aeb Palettes based in GtkMenu do not have present() method
There are two different palette widgets in Sugar.
_PaletteMenuWidget is a Gtk.Menu and  _PaletteWindowWidget is a Gtk.Window.
Only the palettes where the widget is a Gtk.Window can do present()
9 years ago
Gonzalo Odiard 5818721818 Merge branch 'treeview_perf2-try2' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-treeview_perf2-try2 9 years ago
Gonzalo Odiard bbdebce0d4 Simplify routine used to get the list of files from git
This change remove duplicated code
9 years ago
Gonzalo Odiard 34b0e17e95 Add screenshots to ignored dirs in bundlebuilder
After add the directory to the IGNORE_DIRS array,
we need make the standard procedure to get the list off files
for the bundle, get_files_in_git honor the configured ignored
files and dirs. That was not a problem until now,
because that files was already not added to git,
but in the case of the screenshots, are included in git,
but we don't want include them in our bundles.
9 years ago
Gonzalo Odiard 7a9510a187 Remove CellRendererInvoker
This invoker is not used anymore, now is replaced by TreeViewInvoker.
9 years ago
Gonzalo Odiard 49365e132c New invoker, TreeViewInvoker
This new invoker is able to handle all the palettes on a treeview,
removing the need of one invoker per cell renderer (CellRendererInvoker).
This simplifies the code and makes it more efficient.
Also removes the logic from the CellRendererIcon, which
should only care about drawing itself. [1]

Is important to note than in Gtk3 a CellRenderer is not a GtkWidget
then can't know when the mouse is over it or have the usual events
used by other invokers, making the implementation CellRendererInvoker
very complicate.

This commit also removes the invoker of CellRendererIcon.

The ScrollingDetector logic is simplified too,
because now there are only one invoker instead of one by renderer
and the example code updated.

[1] https://developer.gnome.org/gtk3/stable/GtkCellRenderer.html
9 years ago
Gonzalo Odiard 5626a6c182 Detect scrolling in treviews and optimize drawing
Detecting if the treeview is scrolling we can improve the performance of
the CellRendererIcon by avoiding unneeded calculations.

The example scrollingdetector.py shows how this can be used.  The
changes are backward compatible.

Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
9 years ago
Gonzalo Odiard 862176de38 Merge branch 'cell_renderer_icon_optimizations' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-cell_renderer_icon_optimizations 9 years ago
James Cameron f1fc9886cc power: avoid filesystem access if powerd absent
On commodity hardware without olpc-powerd, there is unnecessary
filesystem access.

On XO laptop hardware there are unnecessary errors in log for every
object delete:

	ERROR root: Inhibit Suspend: Could not delete file
	/var/run/powerd-inhibit-suspend/1773

	Exception AttributeError: "'NoneType' object has no attribute
	'endswith'" in <bound method PowerManager.__del__ of
	<sugar3.power.PowerManager instance at 0xa15962c>> ignored

The Clock activity in speaking mode is a good reproducer.

Following changes are made:

- move the directory check to __init__, and set self._path to None if
  olpc-powerd is not present,

- on inhibit_suspend, use self._path, which avoids a check of the
  directory,

- on restore_suspend or __del__, avoid a call to os.unlink if
  olpc-powerd is not present.
9 years ago
James Cameron 2ddd64bace power: suppress failure to remove file
It does not matter if the file cannot be removed, so do not report it.
9 years ago
James Cameron 561271bad1 power: set path to file once 9 years ago
Gonzalo Odiard d9e6fa6813 CellRendererIcon: cache offsets
Instead of calculating them on each render.  The cache is removed when
the size is changed.

Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
9 years ago
Gonzalo Odiard f08757d75f CellRendererIcon: remove unused frame
The white frame is not visible over the white background.

Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
9 years ago
Gonzalo Odiard 3a6427cdc6 CellRendererIcon: improve calculation in do_render
Use a more efficient method to check if the pointer is inside the cell,
because we have the cell_area in the do_render method.

Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
9 years ago
Sam Parkinson a56282991f Add ability to launch a bundle
This commit adds the `launch_bundle` function in `sugar3.activity.
activity` which accesses the same function in the shell is over dbus.
This is means the shell process launches the bundle.  Activities
should not launch child processes as per the Rainbow security model
[1].

[1]  http://wiki.laptop.org/go/Rainbow
9 years ago
Gonzalo Odiard 026146a081 Pep8 fixes 9 years ago
Gonzalo Odiard 954be953ca Remove new line chars when create linfo files
If a translator add a '\n' char in the summary translation
ConfigParser can't parse the linfo file.
Remove them when the file is created and show a message to warning
to the developer.
9 years ago
Martin Abente Lahaye 06c3f01998 Revert "Add ability to launch a bundle"
This reverts commit 8fcb0b48d3.
9 years ago
Manuel Quiñones 8fcb0b48d3 Add ability to launch a bundle
FIXME, to be written.
9 years ago
Gonzalo Odiard f7966382b8 Read icon attach points when is not possible get the info from gtk
Gtk has deprecated gtk-icon-get-attach-points on version 3.14
We need that information to place pur badges,
this fix read the information from the .icon file

[1] https://developer.gnome.org/gtk3/stable/GtkIconTheme.html#gtk-icon-info-get-attach-points
9 years ago
Gonzalo Odiard a43b972d1b Don't break activity startup if .info have 'class' instead of 'exec'
When we ported sugar to Gtk3 we removed the support of the fields
exec and service_name due they were deprecated for a long time [1].
But this is still a problem in deployments, and we already added
compatibility for the service_name field.
Here [3] there is a long thred were we discussed this issue.

[1] ae85dd62d4
[2] 32f97b48c3
[3] http://lists.sugarlabs.org/archive/sugar-devel/2013-October/045404.html
9 years ago
Ignacio Rodríguez ee564948bc Raise the palette window when its mapped
This patch raise the palette window when its mapped
Its use: Gtk.Window.present [1] the user will
be able to saw the palette now when your apply the
test case of #4463

[1] https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-present
Fixes #4463
9 years ago
Martin Abente Lahaye 7739336fb6 Provide access to Gtk.Clipboard.set_with_data
As described in SL#4307 Gtk.Clipboard.set_with_data is not
introspectable, therefore it can't be accessed though python
Gtk bindings.

Therefore, as a workaround for this issue, we provide acesss
to this method though a custom SugarExt binding.

This solution uses Carlos Garnacho annotations as described in
https://bugzilla.gnome.org/show_bug.cgi?id=656312#c18

Fixes SL#4307.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
9 years ago
Ignacio Rodríguez 47692f56f0 Log error when the espeak plugin is not installed.
Now when the espeak plugin is not installed there will be an
error (logging.error) in the log. Instead of the ugly message
of Gst
Also, if Gst isnt installed it debug a error too.

Fixes #3345
9 years ago
Goutam b5cae5fb56 Ellipses defaulted to end of long activity titles;fixes 1429 9 years ago
Ignacio Rodríguez cef1ad7590 Get markup text as default
Now sugar-toolkit get markup (glib.markup_escape_text) and
set it.

This fixes SL#4456
10 years ago
Gonzalo Odiard 3c4ac98baf Fix import of exception from ConfigParser
In the commit f0927c364c
the ParsingError is not properly imported.
10 years ago
Gonzalo Odiard f0927c364c Don't break if translation can't be parsed
If the .linfo file can't be parsed, use the untranslated name/summary,
but don't  break activity load.
10 years ago
Sam Parkinson 712682a3b0 BundleBuilder: Don't crash on malformed translation files
The BundleBuilder currently crashes on a malformed translation file.  This is
good for humans (makes them fix their issues) but crashes bots who need it
compiled and don't care about that single translation file.

This patch adds a --no-fail option which stops the builder from crashing
10 years ago
Gonzalo Odiard b78989b755 Add parameters to configure tts
Activities can set pitch, rate or voice used to play text to speech
10 years ago
Gonzalo Odiard 7b82eb6ae8 Add a structure to store the translated voice names 10 years ago
Gonzalo Odiard 44f9201e79 Initialize Gst before use speech
In sugar gst was initialized at startup, now we need initialize Gst
in the speech code.
10 years ago
Gonzalo Odiard 31d8de55a7 TTS: Cache the voices list 10 years ago
Gonzalo Odiard 57bd0890f5 Add a list of language names to translate
To display a list of translated language names in the UI,
we add a list of the available languages, because the espeak
language names are not translated.
10 years ago
Gonzalo Odiard d7c9645b60 Move SpeechManager from sugar to sugar-toolkit-gtk3
This is done to be able to use this implementation of the feature
in the activities. A complementary patch is needed in sugar module.
10 years ago
Gonzalo Odiard 952b8275a1 Add a testing method to open a activity with a uri
This can be used in the test to check if the activity can manage
different file formats.
10 years ago
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' 10 years ago
Ignacio Rodriguez 463101b19d Add menu width chars to sugar3 10 years ago
Daniel Narvaez 71b42a2da0 Fix chaining up to the parent 10 years ago
Daniel Narvaez acff63467d Fix pyflakes errors 10 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.
10 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
10 years ago
Emil Dudev d918e7afff Remove GConf completely
Removes sugar-gconf from SugarExt
Removes gconf-2 dependency
10 years ago
Emil Dudev db2ba3e579 GConf to GSettings port 10 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>
10 years ago
akskumarnot 81b388c554 Use proper formatting syntax, fixes #2170 10 years ago
Sam f43d5f8d24 Fixes #4634, issue where spaces in bundle ids crashed sugar 10 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>
11 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>
11 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