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>
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>
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>
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>
'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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>