594 Commits (master)

Author SHA1 Message Date
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
Simon Schampijer b5de7ef332 Remove support for the old deprecated toolbar
- removed deprecated imports from the activity module, use the
  widgets module instead
- removed the ActivityToolbox class
- removed the Stop button from the ActivityToolbar
- removed set_toolbar/get_toolbar API from the window module

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer ec7b363a70 Datastore: remove deprecated API
This API is not in use anywhere in the shell and has
been deprecated for quite some time.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer 417006e463 ObjectChooser: remove deprecated parameters
The objectchooser had the 'title', 'flags' and 'buttons' parameters
deprecated for a long time, remove them now completely. The
only parameters allowed are now the 'parent' and the 'what_filter'.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer aae6082b14 Bundlebuilder: remove deprecated bundle_name argument
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer 70cee44717 Activity: remove deprecated _shared_activity member
Use the get_shared_activity method instead

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer ae85dd62d4 ActivityBundle: clean from deprecated code
- removed deprecated mime type 'application/vnd.olpc-x-sugar'
- activity.info file: removed deprecated field 'service_name' use 'bundle_id' instead
- activity.info file: removed deprecated field 'class' use 'exec' instead

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer a8342ecf8c Finally remove the keep button completely
see 0082e10f8e for
the complete reasoning.

e022aa8e4a already made the button
invisible, keeping it only for backwards compatibility.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-By: Sascha Silbe <silbe@activitycentral.com>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Gonzalo Odiard 24af358275 Set the sugar theme name in gsettings according the scale
We need set the theme in gsettings according the scale in
the SUGAR_SCLING environment variable.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 48ad255a78 Reimplement Palettes for GTK3
Moving from GTK2 to GTK3 has presented various challenges regarding
palettes.

In GTK2, we were able to access some internal API of the GtkMenu class
and use it to embed a GtkMenu in a regular window. As of GTK3, that API
has become private and we can no longer access it.

We still want to use GtkMenu for the advanced functionality it provides
(multiple-level menus, keyboard navigation, etc), but we are now limited
to popping it up with its own (internal) window, rather than being able
to pack it into one of our own.

Our palettes can historically be used either as a menu, or as a general
area where widgets can be added, or both. The new restrictions upon
GtkMenu force some changes here, but we work hard to stick to the old
API as far as possible.

A Palette instance now acts as a controller of either a "window widget"
(where any type of widget can be displayed as usual) or a "menu widget"
which just pops up a GtkMenu. A Palette defaults to the window mode, but
dynamically switches to menu mode if/when the user attempts to access
the menu element.

As a result of this, palettes can now pack either a user-defined collection
of widgets, or a menu, but types can no longer be mixed. This should
only affect a handful of palettes which will need to pick a single
approach and convert to it.

Some further challenges are presented by the fact that GtkMenu performs a
grab on the whole screen, meaning that all input events are delivered to
the GtkMenu widget. Through some careful event filtering and examination
of the mouse cursor position we are still able to determine when the mouse
has entered or left the invoker or menu areas.

This work is authored by Benjamin Berg, Marco Pesenti Gritti, Simon
Schampijer and Daniel Drake.
13 years ago
Daniel Drake 8126575461 SugarExt: make SugarGrid introspectable
This will be used by a future GTK3 port of the shell.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 15946211cf Trivial GTK3 porting fixes
Fix some trivial issues missed earlier: various missing imports,
some minor API changes to adapt to, do_size_request simple porting,
etc.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 827ab7218a Add EventIcon/CursorInvoker similar to CanvasIcon/CanvasInvoker
CanvasIcon and CanvasInvoker were removed in a previous GTK3-porting commit
as they were based on hippocanvas.

However, this leaves the toolkit with some missing functionality:
there is no longer a trivial way to show an icon which can receive mouse
events and pop up a palette. Such functionality is used in various
places throughout the shell and activities.

Reimplement this functionality as EventIcon and CursorInvoker.
Instead of reimplementing much of the Icon class (like CanvasIcon did),
EventIcon opts for a more simplistic encapsulation of an Icon object.
This means trivial API changes for CanvasIcon users who must now
use the 'icon' property with the Icon API.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 5ad2fc7d6b SugarExt: drop pygobject2 initialisation
Now that we avoid linking with pygtk2/pygobject2, we need to remove
this initialisation call so that the module can be loaded at runtime.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 3962517a58 activity.py: Apply sugar GTK3 theme and icon theme
In GTK2, theme name and icon theme name properties could be set in the
GTK2 RC file, at runtime, or by the X settings daemon.

For GTK3, the RC file configuration route for these settings has been
removed. As we do not currently have a settings daemon implementation,
apply these important settings at runtime, early in the Activity
class.

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

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

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

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

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

Port our code to the new API.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago