Merge branch 'master' of ssh+git://dev.laptop.org/git/sugar-toolkit
This commit is contained in:
commit
783ec6734c
@ -200,7 +200,7 @@
|
||||
(c-name "sugar_preview_take_screenshot")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GdkDrawable" "drawable")
|
||||
'("GtkWidget" "widget")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -22,11 +22,11 @@ headers
|
||||
modulename sugar._sugarext
|
||||
%%
|
||||
import gobject.GObject as PyGObject_Type
|
||||
import gtk.Widget as PyGtkWidget_Type
|
||||
import gtk.Entry as PyGtkEntry_Type
|
||||
import gtk.Menu as PyGtkMenu_Type
|
||||
import gtk.Container as PyGtkContainer_Type
|
||||
import gtk.gdk.Window as PyGdkWindow_Type
|
||||
import gtk.gdk.Drawable as PyGdkDrawable_Type
|
||||
import gtk.Image as PyGtkImage_Type
|
||||
%%
|
||||
ignore-glob
|
||||
|
@ -754,8 +754,8 @@ class Activity(Window, gtk.Container):
|
||||
return {}
|
||||
|
||||
def take_screenshot(self):
|
||||
if self.canvas and self.canvas.window:
|
||||
self._preview.take_screenshot(self.canvas.window)
|
||||
if self.canvas:
|
||||
self._preview.take_screenshot(self.canvas)
|
||||
|
||||
def save(self):
|
||||
"""Request that the activity is saved to the Journal.
|
||||
|
@ -396,11 +396,12 @@ class ActivityBundle(Bundle):
|
||||
if mime_types is not None:
|
||||
installed_icons_dir = os.path.join(xdg_data_home,
|
||||
'icons/sugar/scalable/mimetypes')
|
||||
for f in os.listdir(installed_icons_dir):
|
||||
path = os.path.join(installed_icons_dir, f)
|
||||
if os.path.islink(path) and \
|
||||
os.readlink(path).startswith(install_path):
|
||||
os.remove(path)
|
||||
if os.path.isdir(installed_icons_dir):
|
||||
for f in os.listdir(installed_icons_dir):
|
||||
path = os.path.join(installed_icons_dir, f)
|
||||
if os.path.islink(path) and \
|
||||
os.readlink(path).startswith(install_path):
|
||||
os.remove(path)
|
||||
|
||||
self._uninstall(install_path)
|
||||
|
||||
|
@ -69,16 +69,38 @@ sugar_preview_clear(SugarPreview *preview)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sugar_preview_take_screenshot(SugarPreview *preview, GdkDrawable *drawable)
|
||||
static gboolean
|
||||
widget_is_off_screen(GtkWidget *widget)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
gint x, y, width, height;
|
||||
|
||||
screen = gtk_widget_get_screen(widget);
|
||||
|
||||
gdk_window_get_geometry(widget->window, &x, &y, &width, &height, NULL);
|
||||
|
||||
return (x < 0 || y < 0 ||
|
||||
x + width > gdk_screen_get_width(screen) ||
|
||||
y + height > gdk_screen_get_height(screen));
|
||||
}
|
||||
|
||||
void
|
||||
sugar_preview_take_screenshot(SugarPreview *preview, GtkWidget *widget)
|
||||
{
|
||||
GdkDrawable *drawable;
|
||||
GdkScreen *screen;
|
||||
GdkVisual *visual;
|
||||
GdkColormap *colormap;
|
||||
gint width, height;
|
||||
|
||||
if (widget->window == NULL || widget_is_off_screen(widget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sugar_preview_clear(preview);
|
||||
|
||||
drawable = GDK_DRAWABLE(widget->window);
|
||||
|
||||
gdk_drawable_get_size(drawable, &width, &height);
|
||||
|
||||
screen = gdk_drawable_get_screen(drawable);
|
||||
|
@ -50,7 +50,7 @@ struct _SugarPreviewClass {
|
||||
|
||||
GType sugar_preview_get_type (void);
|
||||
void sugar_preview_take_screenshot (SugarPreview *preview,
|
||||
GdkDrawable *drawable);
|
||||
GtkWidget *widget);
|
||||
void sugar_preview_set_size (SugarPreview *preview,
|
||||
int width,
|
||||
int height);
|
||||
|
Loading…
Reference in New Issue
Block a user