[gnome-utils] screenshot: Port to "draw" vfunc
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] screenshot: Port to "draw" vfunc
- Date: Wed, 20 Oct 2010 16:53:31 +0000 (UTC)
commit 0a4b9f89f3f7721d9782c936fbfafe52c6d5b315
Author: Javier Jardón <jjardon gnome org>
Date: Wed Oct 6 04:24:22 2010 +0200
screenshot: Port to "draw" vfunc
https://bugzilla.gnome.org/show_bug.cgi?id=631486
configure.ac | 2 +-
gnome-screenshot/Makefile.am | 4 ++--
gnome-screenshot/gnome-screenshot.ui | 2 +-
gnome-screenshot/screenshot-dialog.c | 15 ++++-----------
4 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a94e2d7..8c09863 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,7 @@ GTK_REQUIRED=2.91.1
GIO_UNIX_REQUIRED=2.18.0
LIBPANEL_APPLET_REQUIRED=2.13.4
LIBGTOP_REQUIRED=2.12.0
-LIBCANBERRA_GTK_REQUIRED=0.4
+LIBCANBERRA_GTK_REQUIRED=0.26
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
diff --git a/gnome-screenshot/Makefile.am b/gnome-screenshot/Makefile.am
index 6f1b8fa..5272abb 100644
--- a/gnome-screenshot/Makefile.am
+++ b/gnome-screenshot/Makefile.am
@@ -30,7 +30,7 @@ gnome_screenshot_CFLAGS = \
$(GIO_CFLAGS) \
$(LIBCANBERRA_GTK_CFLAGS) \
$(GTHREAD_CFLAGS) \
- $(GTK2_CFLAGS) \
+ $(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(NULL)
@@ -42,7 +42,7 @@ gnome_screenshot_LDADD = \
$(GIO_LIBS) \
$(LIBCANBERRA_GTK_LIBS) \
$(GTHREAD_LIBS) \
- $(GTK2_LIBS) \
+ $(GTK_LIBS) \
$(GCONF_LIBS) \
-lm \
$(NULL)
diff --git a/gnome-screenshot/gnome-screenshot.ui b/gnome-screenshot/gnome-screenshot.ui
index fbad450..d0ccbaa 100644
--- a/gnome-screenshot/gnome-screenshot.ui
+++ b/gnome-screenshot/gnome-screenshot.ui
@@ -114,7 +114,7 @@
<child>
<object class="GtkDrawingArea" id="preview_darea">
<property name="visible">True</property>
- <signal handler="on_preview_expose_event" name="expose_event"/>
+ <signal handler="on_preview_draw" name="draw"/>
<signal handler="on_preview_configure_event" name="configure_event"/>
</object>
</child>
diff --git a/gnome-screenshot/screenshot-dialog.c b/gnome-screenshot/screenshot-dialog.c
index 5ac8e1d..1327914 100644
--- a/gnome-screenshot/screenshot-dialog.c
+++ b/gnome-screenshot/screenshot-dialog.c
@@ -65,14 +65,13 @@ on_toplevel_key_press_event (GtkWidget *widget,
}
static void
-on_preview_expose_event (GtkWidget *drawing_area,
- GdkEventExpose *event,
- gpointer data)
+on_preview_draw (GtkWidget *drawing_area,
+ cairo_t *cr,
+ gpointer data)
{
ScreenshotDialog *dialog = data;
GdkPixbuf *pixbuf = NULL;
gboolean free_pixbuf = FALSE;
- cairo_t *cr;
/* Stolen from GtkImage. I really should just make the drawing area an
* image some day */
@@ -99,16 +98,10 @@ on_preview_expose_event (GtkWidget *drawing_area,
{
pixbuf = g_object_ref (dialog->preview_image);
}
-
- cr = gdk_cairo_create (drawing_area->window);
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
cairo_paint (cr);
- cairo_destroy (cr);
-
g_object_unref (pixbuf);
}
@@ -268,7 +261,7 @@ screenshot_dialog_new (GdkPixbuf *screenshot,
(gfloat) gdk_pixbuf_get_height (screenshot),
FALSE);
g_signal_connect (toplevel, "key_press_event", G_CALLBACK (on_toplevel_key_press_event), dialog);
- g_signal_connect (preview_darea, "expose_event", G_CALLBACK (on_preview_expose_event), dialog);
+ g_signal_connect (preview_darea, "draw", G_CALLBACK (on_preview_draw), dialog);
g_signal_connect (preview_darea, "button_press_event", G_CALLBACK (on_preview_button_press_event), dialog);
g_signal_connect (preview_darea, "button_release_event", G_CALLBACK (on_preview_button_release_event), dialog);
g_signal_connect (preview_darea, "configure_event", G_CALLBACK (on_preview_configure_event), dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]