diff options
author | monsta <[email protected]> | 2016-01-13 16:26:08 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-01-13 16:26:08 +0300 |
commit | 46119b43fd581a58657afd36979f6d52baa16ecf (patch) | |
tree | 03a3346b541c97ed523c9b3b93f279d66e1a7b13 | |
parent | f21f8e9197d414d069754b06ef2f2aad5270ed10 (diff) | |
download | mate-control-center-46119b43fd581a58657afd36979f6d52baa16ecf.tar.bz2 mate-control-center-46119b43fd581a58657afd36979f6d52baa16ecf.tar.xz |
libslab: less #if's
-rw-r--r-- | libslab/search-entry.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/libslab/search-entry.c b/libslab/search-entry.c index bdab60f6..2953bda0 100644 --- a/libslab/search-entry.c +++ b/libslab/search-entry.c @@ -129,56 +129,60 @@ nld_search_entry_realize (GtkWidget * widget) rsvg_handle_free (rsvg); } -static gboolean #if GTK_CHECK_VERSION (3, 0, 0) +static gboolean nld_search_entry_draw (GtkWidget * widget, cairo_t * cr) -#else -nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event) -#endif { NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget); -#if GTK_CHECK_VERSION (3, 0, 0) GdkRectangle text_area; gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); + GTK_WIDGET_CLASS (nld_search_entry_parent_class)->draw (widget, cr); + + int width, x; + + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) + { + width = text_area.width; + x = width - priv->width - 1; + } + else + x = 1; + + gdk_cairo_set_source_pixbuf (cr, priv->watermark, x, 1); + cairo_paint (cr); + + return FALSE; +} #else +static gboolean +nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event) +{ + NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget); + GTK_WIDGET_CLASS (nld_search_entry_parent_class)->expose_event (widget, event); -#endif -#if !GTK_CHECK_VERSION (3, 0, 0) if (event->window == GTK_ENTRY (widget)->text_area) { -#endif int width, height, x; if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) { -#if GTK_CHECK_VERSION(3, 0, 0) - width = text_area.width; - height = text_area.height; -#else gdk_drawable_get_size(event->window, &width, &height); -#endif x = width - priv->width - 1; } else x = 1; -#if GTK_CHECK_VERSION (3, 0, 0) - gdk_cairo_set_source_pixbuf (cr, priv->watermark, x, 1); - cairo_paint (cr); -#else + gdk_draw_pixbuf (event->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], priv->watermark, 0, 0, x, 1, priv->width, priv->height, GDK_RGB_DITHER_NORMAL, 0, 0); -#endif - -#if !GTK_CHECK_VERSION (3, 0, 0) } -#endif return FALSE; } +#endif GtkWidget * nld_search_entry_new (void) |