[gucharmap] Remove gtk version checks
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gucharmap] Remove gtk version checks
- Date: Sat, 10 Dec 2011 19:49:31 +0000 (UTC)
commit e9108025c6001ed9b5f92100543b2ac1ff740b9a
Author: Christian Persch <chpe gnome org>
Date: Sat Dec 10 20:36:36 2011 +0100
Remove gtk version checks
gucharmap/gucharmap-charmap.c | 129 +---------
gucharmap/gucharmap-chartable-accessible.c | 64 -----
gucharmap/gucharmap-chartable.c | 377 +++------------------------
gucharmap/gucharmap-private.h | 2 -
gucharmap/gucharmap-search-dialog.c | 15 --
gucharmap/gucharmap-settings.c | 4 -
gucharmap/gucharmap-window.c | 58 +----
7 files changed, 48 insertions(+), 601 deletions(-)
---
diff --git a/gucharmap/gucharmap-charmap.c b/gucharmap/gucharmap-charmap.c
index 4e7b897..6aa7a06 100644
--- a/gucharmap/gucharmap-charmap.c
+++ b/gucharmap/gucharmap-charmap.c
@@ -24,24 +24,12 @@
#include <stdlib.h>
#include <string.h>
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
#include "gucharmap-charmap.h"
#include "gucharmap-unicode-info.h"
#include "gucharmap-marshal.h"
#include "gucharmap-private.h"
struct _GucharmapCharmapPrivate {
-#if !GTK_CHECK_VERSION (2, 15, 0)
- GtkOrientation orientation;
- GtkWidgetClass *paned_class;
-#endif
-
GtkWidget *notebook;
GucharmapChaptersView *chapters_view;
GucharmapChartable *chartable;
@@ -69,9 +57,6 @@ enum
enum {
PROP_0,
-#if !GTK_CHECK_VERSION (2, 15, 0)
- PROP_ORIENTATION,
-#endif
PROP_CHAPTERS_MODEL,
PROP_ACTIVE_CHAPTER,
PROP_ACTIVE_CHARACTER,
@@ -101,10 +86,6 @@ gucharmap_charmap_finalize (GObject *object)
if (priv->font_desc)
pango_font_description_free (priv->font_desc);
-#if !GTK_CHECK_VERSION (2, 15, 0)
- g_type_class_unref (priv->paned_class);
-#endif
-
G_OBJECT_CLASS (gucharmap_charmap_parent_class)->finalize (object);
}
@@ -118,11 +99,6 @@ gucharmap_charmap_get_property (GObject *object,
GucharmapCharmapPrivate *priv = charmap->priv;
switch (prop_id) {
-#if !GTK_CHECK_VERSION (2, 15, 0)
- case PROP_ORIENTATION:
- g_value_set_enum (value, gucharmap_charmap_get_orientation (charmap));
- break;
-#endif
case PROP_CHAPTERS_MODEL:
g_value_set_object (value, gucharmap_charmap_get_chapters_model (charmap));
break;
@@ -163,11 +139,6 @@ gucharmap_charmap_set_property (GObject *object,
GucharmapCharmapPrivate *priv = charmap->priv;
switch (prop_id) {
-#if !GTK_CHECK_VERSION (2, 15, 0)
- case PROP_ORIENTATION:
- gucharmap_charmap_set_orientation (charmap, g_value_get_enum (value));
- break;
-#endif
case PROP_CHAPTERS_MODEL:
gucharmap_charmap_set_chapters_model (charmap, g_value_get_object (value));
break;
@@ -197,37 +168,10 @@ gucharmap_charmap_set_property (GObject *object,
}
}
-#if !GTK_CHECK_VERSION (2, 15, 0)
-
-static void
-gucharmap_charmap_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GucharmapCharmap *charmap = GUCHARMAP_CHARMAP (widget);
- GucharmapCharmapPrivate *priv = charmap->priv;
-
- priv->paned_class->size_request (widget, requisition);
-}
-
-static void
-gucharmap_charmap_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GucharmapCharmap *charmap = GUCHARMAP_CHARMAP (widget);
- GucharmapCharmapPrivate *priv = charmap->priv;
-
- priv->paned_class->size_allocate (widget, allocation);
-}
-
-#endif /* GTK < 2.15.0 */
-
static void
gucharmap_charmap_class_init (GucharmapCharmapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-#if !GTK_CHECK_VERSION (2, 15, 0)
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-#endif
_gucharmap_intl_ensure_initialized ();
@@ -235,11 +179,6 @@ gucharmap_charmap_class_init (GucharmapCharmapClass *klass)
object_class->set_property = gucharmap_charmap_set_property;
object_class->finalize = gucharmap_charmap_finalize;
-#if !GTK_CHECK_VERSION (2, 15, 0)
- widget_class->size_request = gucharmap_charmap_size_request;
- widget_class->size_allocate = gucharmap_charmap_size_allocate;
-#endif
-
gucharmap_charmap_signals[STATUS_MESSAGE] =
g_signal_new (I_("status-message"), gucharmap_charmap_get_type (),
G_SIGNAL_RUN_FIRST,
@@ -254,20 +193,6 @@ gucharmap_charmap_class_init (GucharmapCharmapClass *klass)
NULL, NULL, _gucharmap_marshal_VOID__UINT_UINT, G_TYPE_NONE,
2, G_TYPE_UINT, G_TYPE_UINT);
-#if !GTK_CHECK_VERSION (2, 15, 0)
- g_object_class_install_property
- (object_class,
- PROP_ORIENTATION,
- g_param_spec_enum ("orientation", NULL, NULL,
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
-#endif
-
g_object_class_install_property
(object_class,
PROP_CHAPTERS_MODEL,
@@ -964,9 +889,9 @@ details_key_press_event (GtkWidget *text_view,
switch (event->keyval)
{
- case GDK_KEY (Return):
- case GDK_KEY (ISO_Enter):
- case GDK_KEY (KP_Enter):
+ case GDK_KEY_Return:
+ case GDK_KEY_ISO_Enter:
+ case GDK_KEY_KP_Enter:
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_get_iter_at_mark (buffer, &iter,
gtk_text_buffer_get_insert (buffer));
@@ -1100,11 +1025,7 @@ details_visibility_notify_event (GtkWidget *text_view,
static void
notebook_switch_page (GtkNotebook *notebook,
-#if GTK_CHECK_VERSION (2, 90, 6)
GtkWidget *page,
-#else
- gpointer page /* useless */,
-#endif
guint page_num,
GucharmapCharmap *charmap)
{
@@ -1281,43 +1202,13 @@ gucharmap_charmap_new (void)
* @charmap:
* @orientation:
*
- * Deprecated: 2.25.0
+ * Deprecated: 2.26
*/
void
gucharmap_charmap_set_orientation (GucharmapCharmap *charmap,
GtkOrientation orientation)
{
-#if GTK_CHECK_VERSION (2, 15, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (charmap), orientation);
-#else
- GucharmapCharmapPrivate *priv;
- GtkPaned *paned = GTK_PANED (charmap);
-
- g_return_if_fail (GUCHARMAP_IS_CHARMAP (charmap));
- priv = charmap->priv;
-
- priv->orientation = orientation;
-
- if (priv->paned_class)
- g_type_class_unref (priv->paned_class);
-
- switch (orientation) {
- case GTK_ORIENTATION_HORIZONTAL:
- priv->paned_class = g_type_class_ref (GTK_TYPE_HPANED);
-
- paned->cursor_type = GDK_SB_H_DOUBLE_ARROW;
- paned->orientation = GTK_ORIENTATION_VERTICAL;
- break;
- case GTK_ORIENTATION_VERTICAL:
- priv->paned_class = g_type_class_ref (GTK_TYPE_VPANED);
-
- paned->cursor_type = GDK_SB_V_DOUBLE_ARROW;
- paned->orientation = GTK_ORIENTATION_HORIZONTAL;
- break;
- }
-
- g_object_notify (G_OBJECT (charmap), "orientation");
-#endif
}
/**
@@ -1331,11 +1222,7 @@ gucharmap_charmap_get_orientation (GucharmapCharmap *charmap)
{
g_return_val_if_fail (GUCHARMAP_IS_CHARMAP (charmap), GTK_ORIENTATION_HORIZONTAL);
-#if GTK_CHECK_VERSION (2, 15, 0)
return gtk_orientable_get_orientation (GTK_ORIENTABLE (charmap));
-#else
- return charmap->priv->orientation;
-#endif
}
#endif /* !GUCHARMAP_DISABLE_DEPRECATED_SOURCE */
@@ -1579,11 +1466,7 @@ gucharmap_charmap_get_chapters_visible (GucharmapCharmap *charmap)
{
GucharmapCharmapPrivate *priv = charmap->priv;
-#if GTK_CHECK_VERSION (2,18,0)
return gtk_widget_get_visible (GTK_WIDGET (priv->chapters_view));
-#else
- return GTK_WIDGET_VISIBLE (priv->chapters_view);
-#endif
}
void
@@ -1612,11 +1495,7 @@ gucharmap_charmap_get_page_visible (GucharmapCharmap *charmap,
if (!page_widget)
return FALSE;
-#if GTK_CHECK_VERSION (2,18,0)
return gtk_widget_get_visible (page_widget);
-#else
- return GTK_WIDGET_VISIBLE (page_widget);
-#endif
}
void
diff --git a/gucharmap/gucharmap-chartable-accessible.c b/gucharmap/gucharmap-chartable-accessible.c
index 845646e..97f0a65 100644
--- a/gucharmap/gucharmap-chartable-accessible.c
+++ b/gucharmap/gucharmap-chartable-accessible.c
@@ -105,11 +105,7 @@ gucharmap_chartable_accessible_ref_child (AtkObject *obj,
GPtrArray *cells;
guint n_cells, n;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
-#else
- widget = GTK_ACCESSIBLE (obj)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return NULL;
@@ -163,11 +159,7 @@ gucharmap_chartable_accessible_ref_at (AtkTable *table,
AtkObject *child;
gint index;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return NULL;
@@ -194,11 +186,7 @@ gucharmap_chartable_accessible_ref_accessible_at_point (AtkComponent *component,
gint x_pos, y_pos;
gint row, col;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
-#else
- widget = GTK_ACCESSIBLE (component)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return NULL;
@@ -256,11 +244,7 @@ gucharmap_chartable_accessible_ref_state_set (AtkObject *obj)
GtkWidget *widget;
state_set = ATK_OBJECT_CLASS (gucharmap_chartable_accessible_parent_class)->ref_state_set (obj);
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
-#else
- widget = GTK_ACCESSIBLE (obj)->widget;
-#endif
if (widget != NULL)
atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS);
@@ -275,11 +259,7 @@ gucharmap_chartable_accessible_get_n_children (AtkObject *obj)
{
GtkWidget *widget;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
-#else
- widget = GTK_ACCESSIBLE (obj)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return 0;
@@ -333,11 +313,7 @@ gucharmap_chartable_accessible_update_all_cells (AtkObject *obj)
GPtrArray *cells;
guint n_cells, n;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
-#else
- widget = GTK_ACCESSIBLE (obj)->widget;
-#endif
if (!widget)
/* Widget is being deleted */
return;
@@ -493,16 +469,10 @@ gucharmap_chartable_accessible_initialize (AtkObject *obj,
G_CALLBACK (adjustment_changed), obj);
}
-#if GTK_CHECK_VERSION (2, 91, 2)
g_signal_connect_after (chartable, "notify::hadjustment",
G_CALLBACK (sync_adjustment), obj);
g_signal_connect_after (chartable, "notify::vadjustment",
G_CALLBACK (sync_adjustment), obj);
-#else
- g_signal_connect_after (chartable, "set-scroll-adjustments",
- G_CALLBACK (gucharmap_chartable_accessible_set_scroll_adjustments),
- obj);
-#endif /* GTK3 */
g_signal_connect (widget, "size-allocate",
G_CALLBACK (size_allocated), obj);
g_signal_connect (chartable, "notify::active-character",
@@ -552,15 +522,9 @@ gucharmap_chartable_accessible_destroyed (GtkWidget *widget,
static void
gucharmap_chartable_accessible_connect_widget_destroyed (GtkAccessible *accessible)
{
-#if GTK_CHECK_VERSION (2, 21, 0)
if (gtk_accessible_get_widget (accessible))
{
g_signal_connect_after (gtk_accessible_get_widget (accessible),
-#else
- if (accessible->widget)
- {
- g_signal_connect_after (accessible->widget,
-#endif
"destroy",
G_CALLBACK (gucharmap_chartable_accessible_destroyed),
accessible);
@@ -597,11 +561,7 @@ gucharmap_chartable_accessible_get_n_columns (AtkTable *table)
GucharmapChartable *chartable;
GucharmapChartablePrivate *chartable_priv;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return 0;
@@ -620,11 +580,7 @@ gucharmap_chartable_accessible_get_column_extent_at (AtkTable *table,
{
GtkWidget *widget;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return 0;
@@ -641,11 +597,7 @@ gucharmap_chartable_accessible_get_n_rows (AtkTable *table)
GucharmapChartablePrivate *chartable_priv;
gint n_rows;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return 0;
@@ -666,11 +618,7 @@ gucharmap_chartable_accessible_get_row_extent_at (AtkTable *table,
{
GtkWidget *widget;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return 0;
@@ -688,11 +636,7 @@ gucharmap_chartable_accessible_get_index_at (AtkTable *table,
GucharmapChartable *chartable;
GucharmapChartablePrivate *chartable_priv;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return -1;
@@ -712,11 +656,7 @@ gucharmap_chartable_accessible_get_column_at_index (AtkTable *table,
GucharmapChartable *chartable;
GucharmapChartablePrivate *chartable_priv;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return -1;
@@ -736,11 +676,7 @@ gucharmap_chartable_accessible_get_row_at_index (AtkTable *table,
GucharmapChartable *chartable;
GucharmapChartablePrivate *chartable_priv;
-#if GTK_CHECK_VERSION (2, 21, 0)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
-#else
- widget = GTK_ACCESSIBLE (table)->widget;
-#endif
if (widget == NULL)
/* State is defunct */
return -1;
diff --git a/gucharmap/gucharmap-chartable.c b/gucharmap/gucharmap-chartable.c
index 6c97a20..be25fec 100644
--- a/gucharmap/gucharmap-chartable.c
+++ b/gucharmap/gucharmap-chartable.c
@@ -25,13 +25,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
#include "gucharmap-marshal.h"
#include "gucharmap-chartable.h"
#include "gucharmap-unicode-info.h"
@@ -43,14 +36,6 @@
#include "gucharmap-chartable-accessible.h"
#endif
-#if !GTK_CHECK_VERSION (2, 18, 0)
-#define gtk_widget_has_focus(w) GTK_WIDGET_HAS_FOCUS(w)
-#endif
-
-#if !GTK_CHECK_VERSION (2, 20, 0)
-#define gtk_widget_get_realized(w) GTK_WIDGET_REALIZED (w)
-#endif
-
enum
{
ACTIVATE,
@@ -64,12 +49,10 @@ enum
enum
{
PROP_0,
-#if GTK_CHECK_VERSION (2, 91, 2)
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
PROP_HSCROLL_POLICY,
PROP_VSCROLL_POLICY,
-#endif
PROP_ACTIVE_CHAR,
PROP_CODEPOINT_LIST,
PROP_FONT_DESC,
@@ -144,12 +127,8 @@ G_DEFINE_TYPE (GucharmapChartableAccessibleFactory, gucharmap_chartable_accessib
/* Type definition */
-#if GTK_CHECK_VERSION (2, 91, 2)
G_DEFINE_TYPE_WITH_CODE (GucharmapChartable, gucharmap_chartable, GTK_TYPE_DRAWING_AREA,
G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL))
-#else
-G_DEFINE_TYPE (GucharmapChartable, gucharmap_chartable, GTK_TYPE_DRAWING_AREA)
-#endif
/* utility functions */
@@ -566,8 +545,6 @@ layout_scaled_glyph (GucharmapChartable *chartable,
return layout;
}
-#if GTK_CHECK_VERSION (2, 90, 8)
-
static cairo_surface_t *
create_glyph_surface (GucharmapChartable *chartable,
gunichar wc,
@@ -681,13 +658,7 @@ create_glyph_pixbuf (GucharmapChartable *chartable,
surface = create_glyph_surface (chartable, wc, font_factor, draw_font_family,
&width, &height);
-#if GTK_CHECK_VERSION (2, 91, 0)
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
-#else
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
- gdk_pixbuf_get_from_surface (pixbuf, surface, 0, 0, 0, 0, width, height);
-#endif
-
cairo_surface_destroy (surface);
if (zoom_surface_width)
@@ -698,109 +669,6 @@ create_glyph_pixbuf (GucharmapChartable *chartable,
return pixbuf;
}
-#else
-
-static GdkPixmap *
-create_glyph_pixmap (GucharmapChartable *chartable,
- gunichar wc,
- double font_factor,
- gboolean draw_font_family,
- int *width,
- int *height)
-{
- GtkWidget *widget = GTK_WIDGET (chartable);
- enum { PADDING = 8 };
-
- PangoLayout *pango_layout, *pango_layout2 = NULL;
- PangoRectangle char_rect, family_rect;
- gint pixmap_width, pixmap_height;
- GtkStyle *style;
- GdkPixmap *pixmap;
- char *family;
- cairo_t *cr;
-
- /* Apply the scaling. Unfortunately not all fonts seem to be scalable.
- * We could fall back to GdkPixbuf scaling, but that looks butt ugly :-/
- */
- pango_layout = layout_scaled_glyph (chartable, wc,
- font_factor, &family);
- pango_layout_get_pixel_extents (pango_layout, &char_rect, NULL);
-
- if (draw_font_family)
- {
- if (family == NULL)
- family = g_strdup (_("[not a printable character]"));
-
- pango_layout2 = gtk_widget_create_pango_layout (GTK_WIDGET (chartable), family);
- pango_layout_get_pixel_extents (pango_layout2, NULL, &family_rect);
-
- /* Make the GdkPixmap large enough to account for possible offsets in the
- * ink extents of the glyph. */
- pixmap_width = MAX (char_rect.width, family_rect.width) + 2 * PADDING;
- pixmap_height = family_rect.height + char_rect.height + 4 * PADDING;
- }
- else
- {
- pixmap_width = char_rect.width + 2 * PADDING;
- pixmap_height = char_rect.height + 2 * PADDING;
- }
-
- style = gtk_widget_get_style (widget);
-
- pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
- pixmap_width, pixmap_height, -1);
-
- cr = gdk_cairo_create (pixmap);
-
- gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
- cairo_rectangle (cr, 0, 0, pixmap_width, pixmap_height);
- cairo_fill (cr);
-
- gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_INSENSITIVE]);
- cairo_set_line_width (cr, 1);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
- cairo_rectangle (cr, 1.5, 1.5, pixmap_width - 3, pixmap_height - 3);
- cairo_stroke (cr);
-
- /* Now draw the glyph. The coordinates are adapted
- * in order to compensate negative char_rect offsets.
- */
- gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
- cairo_move_to (cr, -char_rect.x + PADDING, -char_rect.y + PADDING);
- pango_cairo_show_layout (cr, pango_layout);
- g_object_unref (pango_layout);
-
- if (draw_font_family)
- {
- cairo_set_line_width (cr, 1);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
- gdk_cairo_set_source_color (cr, &style->dark[GTK_STATE_NORMAL]);
- cairo_move_to (cr, 6 + 1 + .5, char_rect.height + 2 * PADDING + .5);
- cairo_line_to (cr, pixmap_width - 3 - 6 - .5, char_rect.height + 2 * PADDING + .5);
- cairo_stroke (cr);
-
- gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
- cairo_move_to (cr, PADDING, pixmap_height - PADDING - family_rect.height);
- /* FIXME: clip here? */
- pango_cairo_show_layout (cr, pango_layout2);
-
- g_object_unref (pango_layout2);
- }
-
- g_free (family);
-
- cairo_destroy (cr);
-
- if (width)
- *width = pixmap_width;
- if (height)
- *height = pixmap_height;
-
- return pixmap;
-}
-
-#endif /* GTK 2.90 */
-
/* places the zoom window toward the inside of the coordinates */
static void
place_zoom_window (GucharmapChartable *chartable, gint x_root, gint y_root)
@@ -873,6 +741,7 @@ update_zoom_window (GucharmapChartable *chartable)
GtkWidget *widget = GTK_WIDGET (chartable);
double scale;
int font_size_px, screen_height;
+ GdkPixbuf *pixbuf;
if (priv->zoom_window == NULL)
return;
@@ -883,10 +752,6 @@ update_zoom_window (GucharmapChartable *chartable)
scale = (0.3 * screen_height) / (FACTOR_WIDTH * font_size_px);
scale = CLAMP (scale, 1.0, 12.0);
-#if GTK_CHECK_VERSION (2, 90, 8)
-{
- GdkPixbuf *pixbuf;
-
pixbuf = create_glyph_pixbuf (chartable,
gucharmap_chartable_get_active_character (chartable),
scale,
@@ -896,21 +761,6 @@ update_zoom_window (GucharmapChartable *chartable)
gtk_image_set_from_pixbuf (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (priv->zoom_window))),
pixbuf);
g_object_unref (pixbuf);
-}
-#else
-{
- GdkPixmap *pixmap;
- pixmap = create_glyph_pixmap (chartable,
- gucharmap_chartable_get_active_character (chartable),
- scale,
- TRUE,
- &priv->zoom_image_width,
- &priv->zoom_image_height);
- gtk_image_set_from_pixmap (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (priv->zoom_window))),
- pixmap, NULL);
- g_object_unref (pixmap);
-}
-#endif
gtk_window_resize (GTK_WINDOW (priv->zoom_window),
priv->zoom_image_width, priv->zoom_image_height);
@@ -1009,11 +859,7 @@ get_cell_at_xy (GucharmapChartable *chartable,
static void
draw_character (GucharmapChartable *chartable,
cairo_t *cr,
-#if GTK_CHECK_VERSION (2, 90, 5)
cairo_rectangle_int_t *rect,
-#else
- GdkRectangle *rect,
-#endif
gint row,
gint col)
{
@@ -1099,11 +945,7 @@ expose_cell (GucharmapChartable *chartable,
static void
draw_square_bg (GucharmapChartable *chartable,
cairo_t *cr,
-#if GTK_CHECK_VERSION (2, 90, 5)
cairo_rectangle_int_t *rect,
-#else
- GdkRectangle *rect,
-#endif
gint row,
gint col)
{
@@ -1153,14 +995,10 @@ draw_borders (GucharmapChartable *chartable,
GtkAllocation *allocation;
GtkStyle *style;
gint x, y, col, row;
-#if GTK_CHECK_VERSION (2, 18, 0)
GtkAllocation widget_allocation;
gtk_widget_get_allocation (widget, &widget_allocation);
allocation = &widget_allocation;
-#else
- allocation = &widget->allocation;
-#endif
cairo_save (cr);
@@ -1387,11 +1225,7 @@ gucharmap_chartable_drag_begin (GtkWidget *widget,
GucharmapChartable *chartable = GUCHARMAP_CHARTABLE (widget);
double scale;
int font_size_px, screen_height;
-#if GTK_CHECK_VERSION (2, 90, 8)
cairo_surface_t *drag_surface;
-#else
- GdkPixmap *drag_icon;
-#endif
font_size_px = get_font_size_px (chartable);
screen_height = gdk_screen_get_height (gtk_widget_get_screen (widget));
@@ -1399,22 +1233,12 @@ gucharmap_chartable_drag_begin (GtkWidget *widget,
scale = (0.3 * screen_height) / (FACTOR_WIDTH * font_size_px);
scale = CLAMP (scale, 1.0, 5.0);
-#if GTK_CHECK_VERSION (2, 90, 8)
drag_surface = create_glyph_surface (chartable,
gucharmap_chartable_get_active_character (chartable),
scale,
FALSE, NULL, NULL);
gtk_drag_set_icon_surface (context, drag_surface);
cairo_surface_destroy (drag_surface);
-#else
- drag_icon = create_glyph_pixmap (chartable,
- gucharmap_chartable_get_active_character (chartable),
- scale,
- FALSE, NULL, NULL);
- gtk_drag_set_icon_pixmap (context, gtk_widget_get_colormap (widget),
- drag_icon, NULL, -8, -8);
- g_object_unref (drag_icon);
-#endif
/* no need to chain up */
}
@@ -1478,34 +1302,17 @@ gucharmap_chartable_drag_data_received (GtkWidget *widget,
/* no need to chain up */
}
-#if GTK_CHECK_VERSION (2, 90, 8)
static gboolean
gucharmap_chartable_draw (GtkWidget *widget,
cairo_t *cr)
-#else
-static gboolean
-gucharmap_chartable_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-#endif
{
GucharmapChartable *chartable = GUCHARMAP_CHARTABLE (widget);
GucharmapChartablePrivate *priv = chartable->priv;
GtkStyle *style;
int row, col;
-#if GTK_CHECK_VERSION (2, 90, 8)
cairo_rectangle_int_t clip_rect;
cairo_region_t *region;
-#else
- GdkRegion *region = event->region;
- cairo_t *cr;
-#endif
-
-#if !GTK_CHECK_VERSION (2, 90, 8)
- if (event->window != gtk_widget_get_window (widget))
- return FALSE;
-#endif
-#if GTK_CHECK_VERSION (2, 90, 8)
if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect))
return FALSE;
@@ -1515,10 +1322,6 @@ gucharmap_chartable_expose_event (GtkWidget *widget,
cairo_region_destroy (region);
return FALSE;
}
-#else
- if (gdk_region_empty (region))
- return FALSE;
-#endif
#if 0
{
@@ -1535,12 +1338,6 @@ gucharmap_chartable_expose_event (GtkWidget *widget,
}
#endif
-#if !GTK_CHECK_VERSION (2, 90, 8)
- cr = gdk_cairo_create (event->window);
- gdk_cairo_region (cr, region);
- cairo_clip (cr);
-#endif
-
style = gtk_widget_get_style (widget);
gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
gdk_cairo_region (cr, region);
@@ -1555,24 +1352,15 @@ gucharmap_chartable_expose_event (GtkWidget *widget,
{
for (col = priv->cols - 1; col >= 0; --col)
{
-#if GTK_CHECK_VERSION (2, 90, 5)
cairo_rectangle_int_t rect;
-#else
- GdkRectangle rect;
-#endif
rect.x = _gucharmap_chartable_x_offset (chartable, col);
rect.y = _gucharmap_chartable_y_offset (chartable, row);
rect.width = _gucharmap_chartable_column_width (chartable, col);
rect.height = _gucharmap_chartable_row_height (chartable, row);
-#if GTK_CHECK_VERSION (2, 90, 8)
if (cairo_region_contains_rectangle (region, &rect) == CAIRO_REGION_OVERLAP_OUT)
continue;
-#else
- if (gdk_region_rect_in (region, &rect) == GDK_OVERLAP_RECTANGLE_OUT)
- continue;
-#endif
draw_square_bg (chartable, cr, &rect, row, col);
draw_character (chartable, cr, &rect, row, col);
@@ -1583,11 +1371,7 @@ gucharmap_chartable_expose_event (GtkWidget *widget,
expose_done:
-#if GTK_CHECK_VERSION (2, 90, 8)
cairo_region_destroy (region);
-#else
- cairo_destroy (cr);
-#endif
/* no need to chain up */
return FALSE;
@@ -1632,7 +1416,7 @@ gucharmap_chartable_key_press_event (GtkWidget *widget,
switch (event->keyval)
{
- case GDK_KEY (Shift_L): case GDK_KEY (Shift_R):
+ case GDK_KEY_Shift_L: case GDK_KEY_Shift_R:
gucharmap_chartable_show_zoom (chartable);
break;
@@ -1655,10 +1439,10 @@ gucharmap_chartable_key_release_event (GtkWidget *widget,
/* XXX: If the group(shift_toggle) Xkb option is set, then releasing
* the shift key gives either ISO_Next_Group or ISO_Prev_Group. Is
* there a better way to handle this case? */
- case GDK_KEY (Shift_L):
- case GDK_KEY (Shift_R):
- case GDK_KEY (ISO_Next_Group):
- case GDK_KEY (ISO_Prev_Group):
+ case GDK_KEY_Shift_L:
+ case GDK_KEY_Shift_R:
+ case GDK_KEY_ISO_Next_Group:
+ case GDK_KEY_ISO_Prev_Group:
gucharmap_chartable_hide_zoom (chartable);
break;
}
@@ -1720,18 +1504,12 @@ gucharmap_chartable_size_allocate (GtkWidget *widget,
int new_first_cell;
int bare_minimal_column_width, bare_minimal_row_height;
int font_size_px;
-#if GTK_CHECK_VERSION (2, 18, 0)
GtkAllocation widget_allocation;
-#endif
GTK_WIDGET_CLASS (gucharmap_chartable_parent_class)->size_allocate (widget, allocation);
-#if GTK_CHECK_VERSION (2, 18, 0)
gtk_widget_get_allocation (widget, &widget_allocation);
allocation = &widget_allocation;
-#else
- allocation = &widget->allocation;
-#endif
old_rows = priv->rows;
old_cols = priv->cols;
@@ -1783,8 +1561,6 @@ gucharmap_chartable_size_allocate (GtkWidget *widget,
update_scrollbar_adjustment (chartable);
}
-#if GTK_CHECK_VERSION (2, 91, 0)
-
static void
gucharmap_chartable_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -1811,23 +1587,6 @@ gucharmap_chartable_get_preferred_height (GtkWidget *widget,
*minimum = *natural = FACTOR_HEIGHT * font_size_px;
}
-#else
-
-static void
-gucharmap_chartable_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GucharmapChartable *chartable = GUCHARMAP_CHARTABLE (widget);
- int font_size_px;
-
- font_size_px = get_font_size_px (chartable);
-
- requisition->width = FACTOR_WIDTH * font_size_px;
- requisition->height = FACTOR_HEIGHT * font_size_px;
-}
-
-#endif /* GTK 3.0 */
-
static void
gucharmap_chartable_style_set (GtkWidget *widget,
GtkStyle *previous_style)
@@ -1902,7 +1661,6 @@ gucharmap_chartable_get_accessible (GtkWidget *widget)
/* GucharmapChartable class methods */
-#if GTK_CHECK_VERSION (2, 91, 2)
static void
gucharmap_chartable_set_hadjustment (GucharmapChartable *chartable,
GtkAdjustment *hadjustment)
@@ -1917,7 +1675,6 @@ gucharmap_chartable_set_hadjustment (GucharmapChartable *chartable,
priv->hadjustment = hadjustment ? g_object_ref_sink (hadjustment) : NULL;
}
-#endif
static void
gucharmap_chartable_set_vadjustment (GucharmapChartable *chartable,
@@ -1951,16 +1708,6 @@ gucharmap_chartable_set_vadjustment (GucharmapChartable *chartable,
update_scrollbar_adjustment (chartable);
}
-#if !GTK_CHECK_VERSION (2, 91, 2)
-static void
-gucharmap_chartable_set_adjustments (GucharmapChartable *chartable,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment)
-{
- gucharmap_chartable_set_vadjustment (chartable, vadjustment);
-}
-#endif
-
static void
gucharmap_chartable_add_move_binding (GtkBindingSet *binding_set,
guint keyval,
@@ -2161,11 +1908,9 @@ gucharmap_chartable_init (GucharmapChartable *chartable)
priv->font_fallback = TRUE;
priv->vadjustment = NULL;
-#if GTK_CHECK_VERSION (2, 91, 2)
priv->hadjustment = NULL;
priv->hscroll_policy = GTK_SCROLL_NATURAL;
priv->vscroll_policy = GTK_SCROLL_NATURAL;
-#endif
/* This didn't fix the slow expose events either: */
/* gtk_widget_set_double_buffered (widget, FALSE); */
@@ -2184,11 +1929,7 @@ gucharmap_chartable_init (GucharmapChartable *chartable)
gtk_drag_dest_add_text_targets (widget);
/* this is required to get key_press events */
-#if GTK_CHECK_VERSION (2, 18, 0)
gtk_widget_set_can_focus (widget, TRUE);
-#else
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
-#endif
gucharmap_chartable_set_codepoint_list (chartable, NULL);
@@ -2226,7 +1967,6 @@ gucharmap_chartable_set_property (GObject *object,
GucharmapChartablePrivate *priv = chartable->priv;
switch (prop_id) {
-#if GTK_CHECK_VERSION (2, 91, 2)
case PROP_HADJUSTMENT:
gucharmap_chartable_set_hadjustment (chartable, g_value_get_object (value));
break;
@@ -2241,7 +1981,6 @@ gucharmap_chartable_set_property (GObject *object,
priv->vscroll_policy = g_value_get_enum (value);
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (chartable));
break;
-#endif
case PROP_ACTIVE_CHAR:
gucharmap_chartable_set_active_character (chartable, g_value_get_uint (value));
break;
@@ -2279,7 +2018,6 @@ gucharmap_chartable_get_property (GObject *object,
GucharmapChartablePrivate *priv = chartable->priv;
switch (prop_id) {
-#if GTK_CHECK_VERSION (2, 91, 2)
case PROP_HADJUSTMENT:
g_value_set_object (value, NULL);
break;
@@ -2292,7 +2030,6 @@ gucharmap_chartable_get_property (GObject *object,
case PROP_VSCROLL_POLICY:
g_value_set_enum (value, priv->vscroll_policy);
break;
-#endif
case PROP_ACTIVE_CHAR:
g_value_set_uint (value, gucharmap_chartable_get_active_character (chartable));
break;
@@ -2338,14 +2075,9 @@ gucharmap_chartable_class_init (GucharmapChartableClass *klass)
widget_class->drag_data_received = gucharmap_chartable_drag_data_received;
widget_class->button_press_event = gucharmap_chartable_button_press;
widget_class->button_release_event = gucharmap_chartable_button_release;
-#if GTK_CHECK_VERSION (2, 91, 0)
widget_class->get_preferred_width = gucharmap_chartable_get_preferred_width;
widget_class->get_preferred_height = gucharmap_chartable_get_preferred_height;
widget_class->draw = gucharmap_chartable_draw;
-#else
- widget_class->size_request = gucharmap_chartable_size_request;
- widget_class->expose_event = gucharmap_chartable_expose_event;
-#endif
widget_class->focus_in_event = gucharmap_chartable_focus_in_event;
widget_class->focus_out_event = gucharmap_chartable_focus_out_event;
widget_class->key_press_event = gucharmap_chartable_key_press_event;
@@ -2373,37 +2105,12 @@ gucharmap_chartable_class_init (GucharmapChartableClass *klass)
G_TYPE_NONE,
0);
-#if GTK_CHECK_VERSION (2, 91, 2)
/* GtkScrollable interface properties */
g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
-#else
-
- klass->set_scroll_adjustments = gucharmap_chartable_set_adjustments;
-
- /**
- * GucharmapChartable::set-scroll-adjustments
- * @horizontal: the horizontal #GtkAdjustment
- * @vertical: the vertical #GtkAdjustment
- *
- * Set the scroll adjustments for the text view. Usually scrolled containers
- * like #GtkScrolledWindow will emit this signal to connect two instances
- * of #GtkScrollbar to the scroll directions of the #GucharmapChartable.
- */
- widget_class->set_scroll_adjustments_signal =
- g_signal_new (I_("set-scroll-adjustments"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GucharmapChartableClass, set_scroll_adjustments),
- NULL, NULL,
- _gucharmap_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-#endif /* GTK 3.0 */
-
signals[STATUS_MESSAGE] =
g_signal_new (I_("status-message"), gucharmap_chartable_get_type (), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GucharmapChartableClass, status_message),
@@ -2522,97 +2229,97 @@ gucharmap_chartable_class_init (GucharmapChartableClass *klass)
binding_set = gtk_binding_set_by_class (klass);
/* Cursor movement */
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (Up), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_Up), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (Down), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_Down), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (p), GDK_CONTROL_MASK,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_p, GDK_CONTROL_MASK,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (n), GDK_CONTROL_MASK,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_n, GDK_CONTROL_MASK,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (Home), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_Home), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (End), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_End), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (Page_Up), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_Page_Up), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (Page_Down), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_Page_Down), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (Left), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_Left, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_Left), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_Left, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (Right), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_Right, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (KP_Right), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_KP_Right, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
/* Activate */
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (Return), 0,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Return, 0,
"activate", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (ISO_Enter), 0,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_ISO_Enter, 0,
"activate", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (KP_Enter), 0,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Enter, 0,
"activate", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (space), 0,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, 0,
"activate", 0);
/* Clipboard actions */
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (c), GDK_CONTROL_MASK,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_c, GDK_CONTROL_MASK,
"copy-clipboard", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (Insert), GDK_CONTROL_MASK,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Insert, GDK_CONTROL_MASK,
"copy-clipboard", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (v), GDK_CONTROL_MASK,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_v, GDK_CONTROL_MASK,
"paste-clipboard", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY (Insert), GDK_SHIFT_MASK,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Insert, GDK_SHIFT_MASK,
"paste-clipboard", 0);
#if 0
/* VI keybindings */
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (k), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_k, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (K), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_K, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (j), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_j, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (J), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_J, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (b), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_b, 0,
GTK_MOVEMENT_PAGES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (B), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_B, 0,
GTK_MOVEMENT_PAGES, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (h), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_h, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (H), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_H, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (l), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_l, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
- gucharmap_chartable_add_move_binding (binding_set, GDK_KEY (L), 0,
+ gucharmap_chartable_add_move_binding (binding_set, GDK_KEY_L, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
#endif
}
diff --git a/gucharmap/gucharmap-private.h b/gucharmap/gucharmap-private.h
index b52ee37..cdb72ec 100644
--- a/gucharmap/gucharmap-private.h
+++ b/gucharmap/gucharmap-private.h
@@ -37,12 +37,10 @@ struct _GucharmapChartablePrivate {
/* scrollable implementation */
GtkAdjustment *vadjustment;
gulong vadjustment_changed_handler_id;
-#if GTK_CHECK_VERSION (2, 91, 2)
/* GtkScrollable impl */
GtkAdjustment *hadjustment; /* unused */
guint hscroll_policy : 1; /* unused */
guint vscroll_policy : 1;
-#endif
/* Font */
PangoFontDescription *font_desc;
diff --git a/gucharmap/gucharmap-search-dialog.c b/gucharmap/gucharmap-search-dialog.c
index e6cb349..e71070c 100644
--- a/gucharmap/gucharmap-search-dialog.c
+++ b/gucharmap/gucharmap-search-dialog.c
@@ -555,11 +555,7 @@ information_dialog (GucharmapSearchDialog *search_dialog,
GucharmapSearchDialogPrivate *priv = GUCHARMAP_SEARCH_DIALOG_GET_PRIVATE (search_dialog);
GtkWidget *dialog;
-#if GTK_CHECK_VERSION (2,18,0)
dialog = gtk_message_dialog_new (gtk_widget_get_visible (GTK_WIDGET (search_dialog)) ?
-#else
- dialog = gtk_message_dialog_new (GTK_WIDGET_VISIBLE (search_dialog) ?
-#endif
GTK_WINDOW (search_dialog) :
GTK_WINDOW (priv->guw),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -735,9 +731,6 @@ gucharmap_search_dialog_init (GucharmapSearchDialog *search_dialog)
/* follow hig guidelines */
gtk_window_set_title (GTK_WINDOW (search_dialog), _("Find"));
gtk_container_set_border_width (GTK_CONTAINER (search_dialog), 6);
-#if !GTK_CHECK_VERSION (2, 90, 7)
- gtk_dialog_set_has_separator (GTK_DIALOG (search_dialog), FALSE);
-#endif
gtk_window_set_destroy_with_parent (GTK_WINDOW (search_dialog), TRUE);
gtk_box_set_spacing (GTK_BOX (content_area), 12);
gtk_window_set_resizable (GTK_WINDOW (search_dialog), FALSE);
@@ -748,21 +741,13 @@ gucharmap_search_dialog_init (GucharmapSearchDialog *search_dialog)
gtk_dialog_add_button (GTK_DIALOG (search_dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
priv->prev_button = gtk_button_new ();
-#if GTK_CHECK_VERSION (2,18,0)
gtk_widget_set_can_default (priv->prev_button, TRUE);
-#else
- GTK_WIDGET_SET_FLAGS (priv->prev_button, GTK_CAN_DEFAULT);
-#endif
set_button_stock_image_and_label (GTK_BUTTON (priv->prev_button), GTK_STOCK_GO_BACK, _("_Previous"));
gtk_dialog_add_action_widget (GTK_DIALOG (search_dialog), priv->prev_button, GUCHARMAP_RESPONSE_PREVIOUS);
gtk_widget_show (priv->prev_button);
priv->next_button = gtk_button_new ();
-#if GTK_CHECK_VERSION (2,18,0)
gtk_widget_set_can_default (priv->next_button, TRUE);
-#else
- GTK_WIDGET_SET_FLAGS (priv->next_button, GTK_CAN_DEFAULT);
-#endif
gtk_widget_show (priv->next_button);
set_button_stock_image_and_label (GTK_BUTTON (priv->next_button), GTK_STOCK_GO_FORWARD, _("_Next"));
gtk_dialog_add_action_widget (GTK_DIALOG (search_dialog), priv->next_button, GUCHARMAP_RESPONSE_NEXT);
diff --git a/gucharmap/gucharmap-settings.c b/gucharmap/gucharmap-settings.c
index 8f2b7fe..0140501 100644
--- a/gucharmap/gucharmap-settings.c
+++ b/gucharmap/gucharmap-settings.c
@@ -377,11 +377,7 @@ gucharmap_settings_add_window (GtkWindow *window)
gboolean maximised, fullscreen;
g_return_if_fail (GTK_IS_WINDOW (window));
-#if GTK_CHECK_VERSION (2,20,0)
g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
-#else
- g_return_if_fail (!GTK_WIDGET_REALIZED (window));
-#endif
state = g_slice_new0 (WindowState);
g_object_set_data_full (G_OBJECT (window), "GamesConf::WindowState",
diff --git a/gucharmap/gucharmap-window.c b/gucharmap/gucharmap-window.c
index eec4fb9..07743e6 100644
--- a/gucharmap/gucharmap-window.c
+++ b/gucharmap/gucharmap-window.c
@@ -25,13 +25,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
#include "gucharmap-print-operation.h"
#include "gucharmap-search-dialog.h"
#include "gucharmap-settings.h"
@@ -408,31 +401,6 @@ help_contents (GtkAction *action,
g_free (url);
}
-#if !GTK_CHECK_VERSION (2, 90, 8)
-static void
-about_open_url (GtkAboutDialog *about,
- const char *link,
- gpointer data)
-{
- open_url (GTK_WINDOW (about), link, gtk_get_current_event_time ());
-}
-
-static void
-about_email_hook (GtkAboutDialog *about,
- const char *email_address,
- gpointer user_data)
-{
- char *escaped, *uri;
-
- escaped = g_uri_escape_string (email_address, NULL, FALSE);
- uri = g_strdup_printf ("mailto:%s", escaped);
- g_free (escaped);
-
- open_url (GTK_WINDOW (about), uri, gtk_get_current_event_time ());
- g_free (uri);
-}
-#endif
-
static void
help_about (GtkAction *action,
GucharmapWindow *guw)
@@ -478,11 +446,6 @@ help_about (GtkAction *action,
_(license[2]), "\n\n", _(license[3]), "\n\n",
_(license[4]), "\n\n", NULL);
-#if !GTK_CHECK_VERSION (2, 90, 8)
- gtk_about_dialog_set_url_hook (about_open_url, NULL, NULL);
- gtk_about_dialog_set_email_hook (about_email_hook, NULL, NULL);
-#endif
-
gtk_show_about_dialog (GTK_WINDOW (guw),
"program-name", _("GNOME Character Map"),
"version", VERSION,
@@ -515,9 +478,9 @@ next_or_prev_character (GtkAction *action,
name = gtk_action_get_name (action);
if (strcmp (name, "NextCharacter") == 0) {
- keyval = GDK_KEY (Right);
+ keyval = GDK_KEY_Right;
} else if (strcmp (name, "PreviousCharacter") == 0) {
- keyval = GDK_KEY (Left);
+ keyval = GDK_KEY_Left;
}
chartable = gucharmap_charmap_get_chartable (guw->charmap);
@@ -526,11 +489,7 @@ next_or_prev_character (GtkAction *action,
gtk_binding_set_activate (gtk_binding_set_by_class (klass),
keyval,
0,
-#if GTK_CHECK_VERSION (2, 91, 0)
G_OBJECT (chartable));
-#else
- GTK_OBJECT (chartable));
-#endif
}
static void
@@ -730,14 +689,10 @@ status_realize (GtkWidget *status,
GucharmapWindow *guw)
{
GtkAllocation *allocation;
-#if GTK_CHECK_VERSION (2, 18, 0)
GtkAllocation widget_allocation;
gtk_widget_get_allocation (guw->status, &widget_allocation);
allocation = &widget_allocation;
-#else
- allocation = &guw->status->allocation;
-#endif
/* FIXMEchpe ewww... */
/* increase the height a bit so it doesn't resize itself */
@@ -986,9 +941,6 @@ gucharmap_window_init (GucharmapWindow *guw)
gtk_box_pack_start (GTK_BOX (big_vbox), hbox, FALSE, FALSE, 0);
guw->status = gtk_statusbar_new ();
-#if !GTK_CHECK_VERSION (2, 91, 1)
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (guw->status), FALSE);
-#endif
gtk_box_pack_start (GTK_BOX (hbox), guw->status, TRUE, TRUE, 0);
gtk_widget_show (guw->status);
g_signal_connect (guw->status, "realize", G_CALLBACK (status_realize), guw);
@@ -1018,9 +970,7 @@ gucharmap_window_init (GucharmapWindow *guw)
gtk_widget_grab_focus (GTK_WIDGET (gucharmap_charmap_get_chartable (guw->charmap)));
-#if GTK_CHECK_VERSION (2, 91, 1)
gtk_window_set_has_resize_grip (GTK_WINDOW (guw), TRUE);
-#endif
}
static void
@@ -1064,11 +1014,7 @@ gucharmap_window_set_font (GucharmapWindow *guw,
g_return_if_fail (GUCHARMAP_IS_WINDOW (guw));
-#if GTK_CHECK_VERSION (2,20,0)
g_assert (!gtk_widget_get_realized (GTK_WIDGET (guw)));
-#else
- g_assert (!GTK_WIDGET_REALIZED (guw));
-#endif
if (!font)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]