diff options
Diffstat (limited to 'applets')
-rw-r--r-- | applets/clock/calendar-window.c | 25 | ||||
-rw-r--r-- | applets/clock/clock-face.c | 113 | ||||
-rw-r--r-- | applets/clock/clock-location-tile.c | 53 | ||||
-rw-r--r-- | applets/clock/clock-location-tile.h | 8 | ||||
-rw-r--r-- | applets/clock/clock-map.c | 80 | ||||
-rw-r--r-- | applets/clock/clock-utils.c | 167 | ||||
-rw-r--r-- | applets/clock/clock.c | 99 | ||||
-rw-r--r-- | applets/fish/fish.c | 99 | ||||
-rw-r--r-- | applets/notification_area/fixedtip.c | 29 | ||||
-rw-r--r-- | applets/notification_area/main.c | 46 | ||||
-rw-r--r-- | applets/notification_area/na-tray-child.c | 116 | ||||
-rw-r--r-- | applets/notification_area/na-tray-child.h | 3 | ||||
-rw-r--r-- | applets/notification_area/na-tray-manager.c | 130 | ||||
-rw-r--r-- | applets/notification_area/na-tray-manager.h | 17 | ||||
-rw-r--r-- | applets/notification_area/na-tray.c | 94 | ||||
-rw-r--r-- | applets/notification_area/na-tray.h | 7 | ||||
-rw-r--r-- | applets/notification_area/testtray.c | 21 | ||||
-rw-r--r-- | applets/wncklet/showdesktop.c | 36 | ||||
-rw-r--r-- | applets/wncklet/window-list.c | 20 | ||||
-rw-r--r-- | applets/wncklet/window-menu.c | 57 | ||||
-rw-r--r-- | applets/wncklet/workspace-switcher.c | 175 |
21 files changed, 3 insertions, 1392 deletions
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c index 17333015..4f82f67a 100644 --- a/applets/clock/calendar-window.c +++ b/applets/clock/calendar-window.c @@ -123,9 +123,7 @@ calendar_window_create_calendar (CalendarWindow *calwin) struct tm tm1; calendar = gtk_calendar_new (); - #if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_size_request(GTK_WIDGET(calendar), 260, 100); - #endif options = gtk_calendar_get_display_options (GTK_CALENDAR (calendar)); if (calwin->priv->show_weeks) options |= GTK_CALENDAR_SHOW_WEEK_NUMBERS; @@ -185,9 +183,6 @@ create_hig_frame (CalendarWindow *calwin, GCallback callback) { GtkWidget *vbox; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *alignment; -#endif GtkWidget *label; GtkWidget *hbox; GtkWidget *button; @@ -195,22 +190,14 @@ create_hig_frame (CalendarWindow *calwin, char *text; GtkWidget *expander; -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - vbox = gtk_vbox_new (FALSE, 6); -#endif bold_title = g_strdup_printf ("<b>%s</b>", title); expander = gtk_expander_new (bold_title); g_free (bold_title); gtk_expander_set_use_markup (GTK_EXPANDER (expander), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), expander, FALSE, FALSE, 0); @@ -235,17 +222,9 @@ create_hig_frame (CalendarWindow *calwin, gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_container_add (GTK_CONTAINER (button), label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_show_all (button); gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0); -#else - alignment = gtk_alignment_new (1, 0, 0, 0); - gtk_container_add (GTK_CONTAINER (alignment), button); - gtk_widget_show_all (alignment); - - gtk_container_add (GTK_CONTAINER (hbox), alignment); -#endif g_signal_connect_swapped (button, "clicked", callback, calwin); } @@ -290,11 +269,7 @@ calendar_window_fill (CalendarWindow *calwin) gtk_container_add (GTK_CONTAINER (calwin), frame); gtk_widget_show (frame); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (frame), vbox); diff --git a/applets/clock/clock-face.c b/applets/clock/clock-face.c index 77c5de4b..dd63a2b6 100644 --- a/applets/clock/clock-face.c +++ b/applets/clock/clock-face.c @@ -26,7 +26,6 @@ static GHashTable *pixbuf_cache = NULL; G_DEFINE_TYPE (ClockFace, clock_face, GTK_TYPE_WIDGET) static void clock_face_finalize (GObject *); -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean clock_face_draw (GtkWidget *clock, cairo_t *cr); static void clock_face_get_preferred_width (GtkWidget *this, @@ -35,11 +34,6 @@ static void clock_face_get_preferred_width (GtkWidget *this, static void clock_face_get_preferred_height (GtkWidget *this, gint *minimal_height, gint *natural_height); -#else -static gboolean clock_face_expose (GtkWidget *clock, GdkEventExpose *event); -static void clock_face_size_request (GtkWidget *clock, - GtkRequisition *requisition); -#endif static void clock_face_size_allocate (GtkWidget *clock, GtkAllocation *allocation); @@ -80,14 +74,9 @@ clock_face_class_init (ClockFaceClass *class) widget_class = GTK_WIDGET_CLASS (class); /* GtkWidget signals */ -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = clock_face_draw; widget_class->get_preferred_width = clock_face_get_preferred_width; widget_class->get_preferred_height = clock_face_get_preferred_height; -#else - widget_class->size_request = clock_face_size_request; - widget_class->expose_event = clock_face_expose; -#endif widget_class->size_allocate = clock_face_size_allocate; /* GObject signals */ @@ -109,20 +98,11 @@ clock_face_init (ClockFace *this) gtk_widget_set_has_window (GTK_WIDGET (this), FALSE); } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean clock_face_draw (GtkWidget *this, cairo_t *cr) -#else -static void -draw (GtkWidget *this, cairo_t *cr) -#endif { ClockFacePrivate *priv; -#if GTK_CHECK_VERSION (3, 0, 0) int width, height; -#else - GtkAllocation allocation; -#endif double x, y; double radius; int hours, minutes, seconds; @@ -132,10 +112,8 @@ draw (GtkWidget *this, cairo_t *cr) priv = CLOCK_FACE_GET_PRIVATE (this); -#if GTK_CHECK_VERSION (3, 0, 0) if (GTK_WIDGET_CLASS (clock_face_parent_class)->draw) GTK_WIDGET_CLASS (clock_face_parent_class)->draw (this, cr); -#endif if (priv->size == CLOCK_FACE_LARGE) { hour_length = 0.45; @@ -147,7 +125,6 @@ draw (GtkWidget *this, cairo_t *cr) sec_length = 0.8; /* not drawn currently */ } -#if GTK_CHECK_VERSION (3, 0, 0) width = gtk_widget_get_allocated_width (this); height = gtk_widget_get_allocated_width (this); x = width / 2; @@ -161,33 +138,6 @@ draw (GtkWidget *this, cairo_t *cr) cairo_paint (cr); cairo_restore (cr); } -#else - gtk_widget_get_allocation (this, &allocation); - - x = allocation.x + allocation.width / 2; - y = allocation.y + allocation.height / 2; - radius = MIN (allocation.width / 2, - allocation.height / 2) - 5; - - cairo_save (cr); - cairo_translate (cr, allocation.x, allocation.y); - - /* clock back */ - if (priv->face_pixbuf) { - GdkWindow *window = gtk_widget_get_window (this); - gdk_draw_pixbuf (GDK_DRAWABLE (window), - NULL, - priv->face_pixbuf, - 0, 0, - allocation.x, - allocation.y, - allocation.width, - allocation.height, - GDK_RGB_DITHER_NONE, 0, 0); - } - - cairo_restore (cr); -#endif /* clock hands */ hours = priv->time.tm_hour; @@ -228,32 +178,9 @@ draw (GtkWidget *this, cairo_t *cr) cairo_stroke (cr); cairo_restore (cr); } -#if GTK_CHECK_VERSION (3, 0, 0) - return FALSE; -#endif -} - -#if !GTK_CHECK_VERSION (3, 0, 0) -static gboolean -clock_face_expose (GtkWidget *this, GdkEventExpose *event) -{ - cairo_t *cr; - - /* get a cairo_t */ - cr = gdk_cairo_create (gtk_widget_get_window (this)); - - cairo_rectangle (cr, - event->area.x, event->area.y, - event->area.width, event->area.height); - cairo_clip (cr); - - draw (this, cr); - - cairo_destroy (cr); return FALSE; } -#endif static void clock_face_redraw_canvas (ClockFace *this) @@ -261,7 +188,6 @@ clock_face_redraw_canvas (ClockFace *this) gtk_widget_queue_draw (GTK_WIDGET (this)); } -#if GTK_CHECK_VERSION (3, 0, 0) static void clock_face_get_preferred_width (GtkWidget *this, gint *minimal_width, @@ -327,45 +253,6 @@ clock_face_get_preferred_height (GtkWidget *this, *minimal_height = *natural_height = 36; } } -#else -static void -clock_face_size_request (GtkWidget *this, - GtkRequisition *requisition) -{ - ClockFacePrivate *priv = CLOCK_FACE_GET_PRIVATE (this); - - if (priv->size_widget != NULL) { - GtkRequisition req; - - /* Tie our size to the height of the size_widget */ - gtk_widget_size_request (GTK_WIDGET (priv->size_widget), &req); - - /* Pad out our height by a little bit - this improves - the balance */ - requisition->width = req.height + req.height / 8; - requisition->height = req.height + req.height / 8; - } else if (priv->face_pixbuf != NULL) { - int w, h; - - /* Use the size of the current pixbuf */ - w = gdk_pixbuf_get_width (GDK_PIXBUF (priv->face_pixbuf)); - h = gdk_pixbuf_get_height (GDK_PIXBUF (priv->face_pixbuf)); - - requisition->width = w; - requisition->height = h; - } else { - /* we don't know anything, so use known dimensions for the svg - * files */ - if (priv->size == CLOCK_FACE_LARGE) { - requisition->width = 50; - requisition->height = 50; - } else { - requisition->width = 36; - requisition->height = 36; - } - } -} -#endif static void clock_face_size_allocate (GtkWidget *this, diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c index ab860101..fd1ea82c 100644 --- a/applets/clock/clock-location-tile.c +++ b/applets/clock/clock-location-tile.c @@ -17,12 +17,7 @@ #include "clock-marshallers.h" #include "set-timezone.h" - -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE (ClockLocationTile, clock_location_tile, GTK_TYPE_BIN) -#else -G_DEFINE_TYPE (ClockLocationTile, clock_location_tile, GTK_TYPE_ALIGNMENT) -#endif enum { TILE_PRESSED, @@ -260,14 +255,8 @@ static void clock_location_tile_fill (ClockLocationTile *this) { ClockLocationTilePrivate *priv = PRIVATE (this); -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *align; -#endif GtkWidget *strut; GtkWidget *box; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *alignment; -#endif GtkWidget *tile; GtkWidget *head_section; @@ -281,21 +270,13 @@ clock_location_tile_fill (ClockLocationTile *this) g_signal_connect (priv->box, "leave-notify-event", G_CALLBACK (enter_or_leave_tile), this); -#if GTK_CHECK_VERSION (3, 0, 0) tile = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_set_margin_top (tile, 3); gtk_widget_set_margin_bottom (tile, 3); gtk_widget_set_margin_start (tile, 3); -#else - tile = gtk_hbox_new (FALSE, 6); - alignment = gtk_alignment_new (0, 0, 1, 0); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 3, 3, 3, 0); -#endif priv->city_label = gtk_label_new (NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_margin_end (priv->city_label, 3); -#endif #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (priv->city_label), 0.0); gtk_label_set_yalign (GTK_LABEL (priv->city_label), 0.0); @@ -303,21 +284,11 @@ clock_location_tile_fill (ClockLocationTile *this) gtk_misc_set_alignment (GTK_MISC (priv->city_label), 0, 0); #endif -#if GTK_CHECK_VERSION (3, 0, 0) head_section = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (head_section), priv->city_label, FALSE, FALSE, 0); -#else - head_section = gtk_vbox_new (FALSE, 0); - align = gtk_alignment_new (0, 0, 0, 0); - gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 0, 3); - gtk_container_add (GTK_CONTAINER (align), priv->city_label); - gtk_box_pack_start (GTK_BOX (head_section), align, FALSE, FALSE, 0); -#endif priv->time_label = gtk_label_new (NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_margin_end (priv->time_label, 3); -#endif #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (priv->time_label), 0.0); gtk_label_set_yalign (GTK_LABEL (priv->time_label), 0.0); @@ -326,22 +297,11 @@ clock_location_tile_fill (ClockLocationTile *this) #endif priv->weather_icon = gtk_image_new (); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_valign (priv->weather_icon, GTK_ALIGN_START); -#else - align = gtk_alignment_new (0, 0, 0, 0); - gtk_container_add (GTK_CONTAINER (align), priv->weather_icon); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (head_section), box, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box), priv->weather_icon, FALSE, FALSE, 0); -#else - box = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (head_section), box, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (box), align, FALSE, FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (box), priv->time_label, FALSE, FALSE, 0); priv->current_button = gtk_button_new (); @@ -354,12 +314,8 @@ clock_location_tile_fill (ClockLocationTile *this) _("Set location as current location and use its timezone for this computer")); priv->current_marker = gtk_image_new_from_icon_name ("go-home", GTK_ICON_SIZE_BUTTON); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (priv->current_marker, GTK_ALIGN_END); gtk_widget_set_valign (priv->current_marker, GTK_ALIGN_CENTER); -#else - gtk_misc_set_alignment (GTK_MISC (priv->current_marker), 1.0, 0.5); -#endif gtk_widget_set_no_show_all (priv->current_marker, TRUE); priv->current_spacer = gtk_event_box_new (); @@ -403,12 +359,7 @@ clock_location_tile_fill (ClockLocationTile *this) gtk_box_pack_start (GTK_BOX (tile), priv->clock_face, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (tile), head_section, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (priv->box), tile); -#else - gtk_container_add (GTK_CONTAINER (alignment), tile); - gtk_container_add (GTK_CONTAINER (priv->box), alignment); -#endif gtk_container_add (GTK_CONTAINER (this), priv->box); } @@ -753,11 +704,7 @@ update_weather_icon (ClockLocation *loc, WeatherInfo *info, gpointer data) if (pixbuf) { gtk_image_set_from_pixbuf (GTK_IMAGE (priv->weather_icon), pixbuf); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_margin_end (priv->weather_icon, 6); -#else - gtk_alignment_set_padding (GTK_ALIGNMENT (gtk_widget_get_parent (priv->weather_icon)), 0, 0, 0, 6); -#endif } } diff --git a/applets/clock/clock-location-tile.h b/applets/clock/clock-location-tile.h index 0b1aa8e9..a4f75a15 100644 --- a/applets/clock/clock-location-tile.h +++ b/applets/clock/clock-location-tile.h @@ -21,20 +21,12 @@ extern "C" { typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBin parent; -#else - GtkAlignment parent; -#endif } ClockLocationTile; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBinClass parent_class; -#else - GtkAlignmentClass parent_class; -#endif void (* tile_pressed) (ClockLocationTile *tile); int (* need_clock_format) (ClockLocationTile *tile); diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c index 704835ea..a8e0c2b0 100644 --- a/applets/clock/clock-map.c +++ b/applets/clock/clock-map.c @@ -58,7 +58,6 @@ typedef struct { static void clock_map_finalize (GObject *); static void clock_map_size_allocate (GtkWidget *this, GtkAllocation *allocation); -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean clock_map_draw (GtkWidget *this, cairo_t *cr); static void clock_map_get_preferred_width (GtkWidget *widget, @@ -67,12 +66,6 @@ static void clock_map_get_preferred_width (GtkWidget *widget, static void clock_map_get_preferred_height (GtkWidget *widget, gint *minimum_height, gint *natural_height); -#else -static gboolean clock_map_expose (GtkWidget *this, - GdkEventExpose *expose); -static void clock_map_size_request (GtkWidget *this, - GtkRequisition *requisition); -#endif static void clock_map_place_locations (ClockMap *this); static void clock_map_render_shadow (ClockMap *this); static void clock_map_display (ClockMap *this); @@ -100,14 +93,9 @@ clock_map_class_init (ClockMapClass *this_class) /* GtkWidget signals */ widget_class->size_allocate = clock_map_size_allocate; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = clock_map_draw; widget_class->get_preferred_width = clock_map_get_preferred_width; widget_class->get_preferred_height = clock_map_get_preferred_height; -#else - widget_class->expose_event = clock_map_expose; - widget_class->size_request = clock_map_size_request; -#endif g_type_class_add_private (this_class, sizeof (ClockMapPrivate)); @@ -234,98 +222,38 @@ clock_map_refresh (ClockMap *this) } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) clock_map_draw (GtkWidget *this, cairo_t *cr) -#else -clock_map_expose (GtkWidget *this, GdkEventExpose *event) -#endif { ClockMapPrivate *priv = PRIVATE (this); -#if GTK_CHECK_VERSION (3, 0, 0) int width, height; GtkStyleContext *context; GdkRGBA color; context = gtk_widget_get_style_context (this); gtk_style_context_get_color (context, GTK_STATE_FLAG_ACTIVE, &color); -#else - GtkStyle *style; - GdkWindow *window; - GtkAllocation allocation; - GdkRectangle region; - cairo_t *cr; - - style = gtk_widget_get_style (this); -#endif - -#if !GTK_CHECK_VERSION (3, 0, 0) - window = gtk_widget_get_window (this); - gtk_widget_get_allocation (this, &allocation); -#endif if (!priv->shadow_map_pixbuf) { g_warning ("Needed to refresh the map in expose event."); clock_map_refresh (CLOCK_MAP (this)); } -#if GTK_CHECK_VERSION (3, 0, 0) width = gdk_pixbuf_get_width (priv->shadow_map_pixbuf); height = gdk_pixbuf_get_height (priv->shadow_map_pixbuf); gdk_cairo_set_source_pixbuf (cr, priv->shadow_map_pixbuf, 0, 0); cairo_rectangle (cr, 0, 0, width, height); cairo_paint (cr); -#else - cr = gdk_cairo_create (window); - - region.x = allocation.x; - region.y = allocation.y; - region.width = gdk_pixbuf_get_width (priv->shadow_map_pixbuf); - region.height = gdk_pixbuf_get_height (priv->shadow_map_pixbuf); - - gdk_rectangle_intersect (®ion, &(event->area), ®ion); - gdk_draw_pixbuf (window, - style->black_gc, - priv->shadow_map_pixbuf, - region.x - allocation.x, - region.y - allocation.y, - region.x, - region.y, - region.width, - region.height, - GDK_RGB_DITHER_NORMAL, - 0, 0); -#endif /* draw a simple outline */ -#if GTK_CHECK_VERSION (3, 0, 0) cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1); gdk_cairo_set_source_rgba (cr, &color); -#else - cairo_rectangle ( - cr, - allocation.x + 0.5, allocation.y + 0.5, - gdk_pixbuf_get_width (priv->shadow_map_pixbuf) - 1, - gdk_pixbuf_get_height (priv->shadow_map_pixbuf) - 1); - - cairo_set_source_rgb ( - cr, - style->mid [GTK_STATE_ACTIVE].red / 65535.0, - style->mid [GTK_STATE_ACTIVE].green / 65535.0, - style->mid [GTK_STATE_ACTIVE].blue / 65535.0); -#endif cairo_set_line_width (cr, 1.0); cairo_stroke (cr); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif - return FALSE; } -#if GTK_CHECK_VERSION (3, 0, 0) static void clock_map_get_preferred_width (GtkWidget *this, gint *minimum_width, @@ -341,14 +269,6 @@ clock_map_get_preferred_height (GtkWidget *this, { *minimum_height = *natural_height = 125; } -#else -static void -clock_map_size_request (GtkWidget *this, GtkRequisition *requisition) -{ - requisition->width = 250; - requisition->height = 125; -} -#endif static void clock_map_size_allocate (GtkWidget *this, GtkAllocation *allocation) diff --git a/applets/clock/clock-utils.c b/applets/clock/clock-utils.c index 088f5231..14cf06df 100644 --- a/applets/clock/clock-utils.c +++ b/applets/clock/clock-utils.c @@ -128,173 +128,6 @@ clock_utils_display_help (GtkWidget *widget, } } -#if !GTK_CHECK_VERSION (3, 0, 0) -/* code copied from GTK3 gdkpixbuf-drawable.c */ -static cairo_format_t -gdk_cairo_format_for_content (cairo_content_t content) -{ - switch (content) - { - case CAIRO_CONTENT_COLOR: - return CAIRO_FORMAT_RGB24; - case CAIRO_CONTENT_ALPHA: - return CAIRO_FORMAT_A8; - case CAIRO_CONTENT_COLOR_ALPHA: - default: - return CAIRO_FORMAT_ARGB32; - } -} - -static cairo_surface_t * -gdk_cairo_surface_coerce_to_image (cairo_surface_t *surface, - cairo_content_t content, - int src_x, - int src_y, - int width, - int height) -{ - cairo_surface_t *copy; - cairo_t *cr; - - copy = cairo_image_surface_create (gdk_cairo_format_for_content (content), - width, - height); - - cr = cairo_create (copy); - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); - cairo_set_source_surface (cr, surface, -src_x, -src_y); - cairo_paint (cr); - cairo_destroy (cr); - - return copy; -} - -static void -convert_alpha (guchar *dest_data, - int dest_stride, - guchar *src_data, - int src_stride, - int src_x, - int src_y, - int width, - int height) -{ - int x, y; - - src_data += src_stride * src_y + src_x * 4; - - for (y = 0; y < height; y++) { - guint32 *src = (guint32 *) src_data; - - for (x = 0; x < width; x++) { - guint alpha = src[x] >> 24; - - if (alpha == 0) - { - dest_data[x * 4 + 0] = 0; - dest_data[x * 4 + 1] = 0; - dest_data[x * 4 + 2] = 0; - } - else - { - dest_data[x * 4 + 0] = (((src[x] & 0xff0000) >> 16) * 255 + alpha / 2) / alpha; - dest_data[x * 4 + 1] = (((src[x] & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha; - dest_data[x * 4 + 2] = (((src[x] & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha; - } - dest_data[x * 4 + 3] = alpha; - } - - src_data += src_stride; - dest_data += dest_stride; - } -} - -static void -convert_no_alpha (guchar *dest_data, - int dest_stride, - guchar *src_data, - int src_stride, - int src_x, - int src_y, - int width, - int height) -{ - int x, y; - - src_data += src_stride * src_y + src_x * 4; - - for (y = 0; y < height; y++) { - guint32 *src = (guint32 *) src_data; - - for (x = 0; x < width; x++) { - dest_data[x * 3 + 0] = src[x] >> 16; - dest_data[x * 3 + 1] = src[x] >> 8; - dest_data[x * 3 + 2] = src[x]; - } - - src_data += src_stride; - dest_data += dest_stride; - } -} - -static GdkPixbuf * -gdk_pixbuf_get_from_surface (cairo_surface_t *surface, - gint src_x, - gint src_y, - gint width, - gint height) -{ - cairo_content_t content; - GdkPixbuf *dest; - - /* General sanity checks */ - g_return_val_if_fail (surface != NULL, NULL); - g_return_val_if_fail (width > 0 && height > 0, NULL); - - content = cairo_surface_get_content (surface) | CAIRO_CONTENT_COLOR; - dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, - !!(content & CAIRO_CONTENT_ALPHA), - 8, - width, height); - - if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE && - cairo_image_surface_get_format (surface) == gdk_cairo_format_for_content (content)) - surface = cairo_surface_reference (surface); - else - { - surface = gdk_cairo_surface_coerce_to_image (surface, content, - src_x, src_y, - width, height); - src_x = 0; - src_y = 0; - } - cairo_surface_flush (surface); - if (cairo_surface_status (surface) || dest == NULL) - { - cairo_surface_destroy (surface); - return NULL; - } - - if (gdk_pixbuf_get_has_alpha (dest)) - convert_alpha (gdk_pixbuf_get_pixels (dest), - gdk_pixbuf_get_rowstride (dest), - cairo_image_surface_get_data (surface), - cairo_image_surface_get_stride (surface), - src_x, src_y, - width, height); - else - convert_no_alpha (gdk_pixbuf_get_pixels (dest), - gdk_pixbuf_get_rowstride (dest), - cairo_image_surface_get_data (surface), - cairo_image_surface_get_stride (surface), - src_x, src_y, - width, height); - - cairo_surface_destroy (surface); - return dest; -} -#endif - GdkPixbuf * clock_utils_pixbuf_from_svg_file_at_size (const char *name, int width, int height) { diff --git a/applets/clock/clock.c b/applets/clock/clock.c index 78c901b0..7685ff86 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -133,9 +133,6 @@ struct _ClockData { GtkListStore *cities_store; GtkWidget *cities_section; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *map_section; -#endif GtkWidget *map_widget; /* Window to set the time */ @@ -265,11 +262,9 @@ calculate_minimum_width (GtkWidget *widget, int focus_width = 0; int focus_pad = 0; #endif -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *style_context; GtkStateFlags state; GtkBorder padding; -#endif pango_context = gtk_widget_get_pango_context (widget); @@ -280,12 +275,10 @@ calculate_minimum_width (GtkWidget *widget, g_object_unref (G_OBJECT (layout)); layout = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) state = gtk_widget_get_state_flags (widget); style_context = gtk_widget_get_style_context (widget); gtk_style_context_get_padding (style_context, state, &padding); #if GTK_CHECK_VERSION (3, 20, 0) - width += padding.left + padding.right; #else gtk_style_context_get_style (style_context, @@ -295,15 +288,6 @@ calculate_minimum_width (GtkWidget *widget, width += 2 * (focus_width + focus_pad) + padding.left + padding.right; #endif -#else - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - width += 2 * (focus_width + focus_pad + gtk_widget_get_style (widget)->xthickness); -#endif - return width; } @@ -394,14 +378,10 @@ static int calculate_minimum_height (GtkWidget *widget, MatePanelAppletOrient orientation) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStateFlags state; GtkStyleContext *style_context; const PangoFontDescription *font_desc; GtkBorder padding; -#else - GtkStyle *style; -#endif PangoContext *pango_context; PangoFontMetrics *metrics; int focus_width = 0; @@ -410,7 +390,6 @@ calculate_minimum_height (GtkWidget *widget, int descent; int thickness; -#if GTK_CHECK_VERSION (3, 0, 0) state = gtk_widget_get_state_flags (widget); style_context = gtk_widget_get_style_context (widget); @@ -419,45 +398,23 @@ calculate_minimum_height (GtkWidget *widget, metrics = pango_context_get_metrics (pango_context, font_desc, pango_context_get_language (pango_context)); -#else - style = gtk_widget_get_style (widget); - pango_context = gtk_widget_get_pango_context (widget); - metrics = pango_context_get_metrics (pango_context, - style->font_desc, - pango_context_get_language (pango_context)); -#endif ascent = pango_font_metrics_get_ascent (metrics); descent = pango_font_metrics_get_descent (metrics); pango_font_metrics_unref (metrics); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_get_padding (style_context, state, &padding); gtk_style_context_get_style (style_context, "focus-line-width", &focus_width, "focus-padding", &focus_pad, NULL); -#else - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); -#endif if (orientation == MATE_PANEL_APPLET_ORIENT_UP || orientation == MATE_PANEL_APPLET_ORIENT_DOWN) { -#if GTK_CHECK_VERSION (3, 0, 0) thickness = padding.top + padding.bottom; -#else - thickness = style->ythickness; -#endif } else { -#if GTK_CHECK_VERSION (3, 0, 0) thickness = padding.left + padding.right; -#else - thickness = style->xthickness; -#endif } return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad) + thickness; @@ -885,7 +842,6 @@ create_calendar (ClockData *cd) g_signal_connect (window, "key_press_event", G_CALLBACK (close_on_escape), cd->panel_button); -#if GTK_CHECK_VERSION (3, 0, 0) /*Name this window so the default theme can be overridden in panel theme, otherwise default GtkWindow bg will be pulled in and override transparency */ gtk_widget_set_name(window, "MatePanelPopupWindow"); @@ -894,7 +850,6 @@ create_calendar (ClockData *cd) GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(window)); GdkVisual *visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(window), visual); -#endif return window; } @@ -918,11 +873,7 @@ position_calendar_popup (ClockData *cd) &x, &y); gtk_window_get_size (GTK_WINDOW (cd->calendar_popup), &w, &h); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (cd->calendar_popup, &req, NULL); -#else - gtk_widget_size_request (cd->calendar_popup, &req); -#endif w = req.width; h = req.height; @@ -1017,11 +968,7 @@ create_clock_window (ClockData *cd) locations_box = calendar_window_get_locations_box (CALENDAR_WINDOW (cd->calendar_popup)); gtk_widget_show (locations_box); -#if GTK_CHECK_VERSION (3, 0, 0) cd->clock_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - cd->clock_vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_container_add (GTK_CONTAINER (locations_box), cd->clock_vbox); cd->clock_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); @@ -1170,11 +1117,7 @@ create_cities_section (ClockData *cd) g_list_free (cd->location_tiles); cd->location_tiles = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) cd->cities_section = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - cd->cities_section = gtk_vbox_new (FALSE, 6); -#endif gtk_container_set_border_width (GTK_CONTAINER (cd->cities_section), 0); cities = cd->locations; @@ -1232,11 +1175,7 @@ create_map_section (ClockData *cd) ClockMap *map; if (cd->map_widget) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_destroy (cd->map_widget); -#else - gtk_widget_destroy (GTK_WIDGET (cd->map_section)); -#endif cd->map_widget = NULL; } @@ -1244,12 +1183,8 @@ create_map_section (ClockData *cd) g_signal_connect (map, "need-locations", G_CALLBACK (map_need_locations_cb), cd); -#if !GTK_CHECK_VERSION (3, 0, 0) - cd->map_section = gtk_alignment_new (0, 0, 1, 1); -#endif cd->map_widget = GTK_WIDGET (map); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_margin_top (cd->map_widget, 1); gtk_widget_set_margin_bottom (cd->map_widget, 1); gtk_widget_set_margin_start (cd->map_widget, 1); @@ -1257,15 +1192,6 @@ create_map_section (ClockData *cd) gtk_box_pack_start (GTK_BOX (cd->clock_vbox), cd->map_widget, TRUE, TRUE, 0); gtk_widget_show (cd->map_widget); -#else - gtk_container_add (GTK_CONTAINER (cd->map_section), cd->map_widget); - - gtk_alignment_set_padding (GTK_ALIGNMENT (cd->map_section), 1, 1, 1, 1); - - gtk_box_pack_start (GTK_BOX (cd->clock_vbox), cd->map_section, FALSE, FALSE, 0); - gtk_widget_show (cd->map_widget); - gtk_widget_show (cd->map_section); -#endif } static void @@ -1276,9 +1202,6 @@ update_calendar_popup (ClockData *cd) gtk_widget_destroy (cd->calendar_popup); cd->calendar_popup = NULL; cd->cities_section = NULL; -#if !GTK_CHECK_VERSION (3, 0, 0) - cd->map_section = NULL; -#endif cd->map_widget = NULL; cd->clock_vbox = NULL; @@ -1357,7 +1280,6 @@ clock_update_text_gravity (GtkWidget *label) pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO); } -#if GTK_CHECK_VERSION (3, 0, 0) #if !GTK_CHECK_VERSION (3, 20, 0) static inline void force_no_focus_padding (GtkWidget *widget) @@ -1382,27 +1304,6 @@ force_no_focus_padding (GtkWidget *widget) gtk_widget_set_name (widget, "clock-applet-button"); } #endif -#else -static inline void -force_no_focus_padding (GtkWidget *widget) -{ - static gboolean first_time = TRUE; - if (first_time) { - gtk_rc_parse_string ("\n" - " style \"clock-applet-button-style\"\n" - " {\n" - " GtkWidget::focus-line-width=0\n" - " GtkWidget::focus-padding=0\n" - " }\n" - "\n" - " widget \"*.clock-applet-button\" style \"clock-applet-button-style\"\n" - "\n"); - first_time = FALSE; - } - - gtk_widget_set_name (widget, "clock-applet-button"); -} -#endif static GtkWidget * create_main_clock_button (void) diff --git a/applets/fish/fish.c b/applets/fish/fish.c index 7605eece..77f26e66 100644 --- a/applets/fish/fish.c +++ b/applets/fish/fish.c @@ -80,11 +80,7 @@ typedef struct { GtkWidget *drawing_area; GtkRequisition requisition; GdkRectangle prev_allocation; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_t *surface; -#else - GdkPixmap *pixmap; -#endif guint timeout; int current_frame; gboolean in_applet; @@ -797,7 +793,6 @@ static gboolean fish_read_output(GIOChannel* source, GIOCondition condition, gpo return (status != G_IO_STATUS_EOF); } -#if GTK_CHECK_VERSION (3, 0, 0) /* * Set the DISPLAY variable, to be use by g_spawn_async. */ @@ -806,7 +801,6 @@ set_environment (gpointer display) { g_setenv ("DISPLAY", display, TRUE); } -#endif static void display_fortune_dialog(FishApplet* fish) { @@ -816,10 +810,8 @@ static void display_fortune_dialog(FishApplet* fish) const char *charset; int argc; char **argv; -#if GTK_CHECK_VERSION (3, 0, 0) GdkScreen *screen; char *display; -#endif /* if there is still a pipe, close it */ if (fish->source_id) @@ -942,7 +934,6 @@ static void display_fortune_dialog(FishApplet* fish) clear_fortune_text (fish); -#if GTK_CHECK_VERSION (3, 0, 0) screen = gtk_widget_get_screen (GTK_WIDGET (fish)); display = gdk_screen_make_display_name (screen); g_spawn_async_with_pipes (NULL, /* working directory */ @@ -957,13 +948,6 @@ static void display_fortune_dialog(FishApplet* fish) NULL, /* stderr */ &error); g_free (display); -#else - gdk_spawn_on_screen_with_pipes (gtk_widget_get_screen (GTK_WIDGET (fish)), - NULL, argv, NULL, - G_SPAWN_SEARCH_PATH|G_SPAWN_STDERR_TO_DEV_NULL, - NULL, NULL, NULL, NULL, &output, NULL, - &error); -#endif if (error) { char *message; @@ -1407,28 +1391,17 @@ static void update_pixmap(FishApplet* fish) if (width == 0 || height == 0) return; -#if GTK_CHECK_VERSION (3, 0, 0) if (fish->surface) cairo_surface_destroy (fish->surface); fish->surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget), CAIRO_CONTENT_COLOR_ALPHA, width, height); -#else - if (fish->pixmap) - g_object_unref (fish->pixmap); - fish->pixmap = gdk_pixmap_new (gtk_widget_get_window (widget), - width, height, -1); -#endif gtk_widget_queue_resize (widget); g_assert (pixbuf_width != -1 && pixbuf_height != -1); -#if GTK_CHECK_VERSION (3, 0, 0) cr = cairo_create (fish->surface); -#else - cr = gdk_cairo_create (fish->pixmap); -#endif cairo_set_source_rgb (cr, 1, 1, 1); cairo_paint (cr); @@ -1475,44 +1448,19 @@ static void update_pixmap(FishApplet* fish) cairo_destroy (cr); } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean fish_applet_draw(GtkWidget* widget, cairo_t *cr, FishApplet* fish) -#else -static gboolean fish_applet_expose_event(GtkWidget* widget, GdkEventExpose* event, FishApplet* fish) -#endif { -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkWindow *window; - GtkStyle *style; - GtkStateType state; -#endif int width, height; int src_x, src_y; -#if GTK_CHECK_VERSION (3, 0, 0) g_return_val_if_fail (fish->surface != NULL, FALSE); -#else - g_return_val_if_fail (fish->pixmap != NULL, FALSE); -#endif g_assert (fish->n_frames > 0); -#if !GTK_CHECK_VERSION (3, 0, 0) - window = gtk_widget_get_window (widget); - style = gtk_widget_get_style (widget); - state = gtk_widget_get_state (widget); -#endif - -#if GTK_CHECK_VERSION(3, 0, 0) width = cairo_xlib_surface_get_width (fish->surface); height = cairo_xlib_surface_get_height (fish->surface); src_x = 0; src_y = 0; -#else - gdk_drawable_get_size(fish->pixmap, &width, &height); - src_x = event->area.x; - src_y = event->area.y; -#endif if (fish->rotate) { if (fish->orientation == MATE_PANEL_APPLET_ORIENT_RIGHT) @@ -1524,30 +1472,14 @@ static gboolean fish_applet_expose_event(GtkWidget* widget, GdkEventExpose* even } else src_x += ((width * fish->current_frame) / fish->n_frames); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_save (cr); cairo_set_source_surface (cr, fish->surface, -src_x, -src_y); cairo_paint (cr); cairo_restore (cr); -#else - gdk_draw_drawable (window, - style->fg_gc [state], - fish->pixmap, - src_x, src_y, - event->area.x, event->area.y, - event->area.width, event->area.height); -#endif return FALSE; } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void fish_applet_size_request(GtkWidget* widget, GtkRequisition* requisition, FishApplet* fish) -{ - *requisition = fish->requisition; -} -#endif - static void fish_applet_size_allocate(GtkWidget* widget, GtkAllocation* allocation, FishApplet* fish) { GtkAllocation widget_allocation; @@ -1563,25 +1495,15 @@ static void fish_applet_size_allocate(GtkWidget* widget, GtkAllocation* allocati static void fish_applet_realize(GtkWidget* widget, FishApplet* fish) { -#if GTK_CHECK_VERSION (3, 0, 0) if (!fish->surface) -#else - if (!fish->pixmap) -#endif update_pixmap (fish); } static void fish_applet_unrealize(GtkWidget* widget, FishApplet* fish) { -#if GTK_CHECK_VERSION (3, 0, 0) if (fish->surface) cairo_surface_destroy (fish->surface); fish->surface = NULL; -#else - if (fish->pixmap) - g_object_unref (fish->pixmap); - fish->pixmap = NULL; -#endif } static void fish_applet_change_orient(MatePanelApplet* applet, MatePanelAppletOrient orientation) @@ -1593,11 +1515,7 @@ static void fish_applet_change_orient(MatePanelApplet* applet, MatePanelAppletOr fish->orientation = orientation; -#if GTK_CHECK_VERSION (3, 0, 0) if (fish->surface) -#else - if (fish->pixmap) -#endif update_pixmap (fish); } @@ -1718,15 +1636,8 @@ static void setup_fish_widget(FishApplet* fish) G_CALLBACK (fish_applet_unrealize), fish); g_signal_connect (fish->drawing_area, "size-allocate", G_CALLBACK (fish_applet_size_allocate), fish); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (fish->drawing_area, "draw", G_CALLBACK (fish_applet_draw), fish); -#else - g_signal_connect (fish->drawing_area, "expose-event", - G_CALLBACK (fish_applet_expose_event), fish); - g_signal_connect (fish->drawing_area, "size-request", - G_CALLBACK (fish_applet_size_request), fish); -#endif gtk_widget_add_events (widget, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | @@ -1873,15 +1784,9 @@ static void fish_applet_dispose (GObject *object) g_free (fish->command); fish->command = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) if (fish->surface) cairo_surface_destroy (fish->surface); fish->surface = NULL; -#else - if (fish->pixmap) - g_object_unref (fish->pixmap); - fish->pixmap = NULL; -#endif if (fish->pixbuf) g_object_unref (fish->pixbuf); @@ -1917,11 +1822,7 @@ static void fish_applet_instance_init(FishApplet* fish, FishAppletClass* klass) fish->frame = NULL; fish->drawing_area = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) fish->surface = NULL; -#else - fish->pixmap = NULL; -#endif fish->timeout = 0; fish->current_frame = 0; fish->in_applet = FALSE; diff --git a/applets/notification_area/fixedtip.c b/applets/notification_area/fixedtip.c index ce4852c9..6356de9b 100644 --- a/applets/notification_area/fixedtip.c +++ b/applets/notification_area/fixedtip.c @@ -51,7 +51,6 @@ button_press_handler (GtkWidget *fixedtip, return FALSE; } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr) { @@ -79,31 +78,12 @@ na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr) return FALSE; } -#else -static gboolean -expose_handler (GtkWidget *fixedtip) -{ - GtkRequisition req; - - gtk_widget_size_request (fixedtip, &req); - - gtk_paint_flat_box (gtk_widget_get_style (fixedtip), - gtk_widget_get_window (fixedtip), - GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, fixedtip, "tooltip", - 0, 0, req.width, req.height); - - return FALSE; -} -#endif static void na_fixed_tip_class_init (NaFixedTipClass *class) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); widget_class->draw = na_fixed_tip_draw; -#endif fixedtip_signals[CLICKED] = g_signal_new ("clicked", @@ -146,11 +126,6 @@ na_fixed_tip_init (NaFixedTip *fixedtip) gtk_container_add (GTK_CONTAINER (fixedtip), label); fixedtip->priv->label = label; -#if !GTK_CHECK_VERSION (3, 0, 0) - g_signal_connect (fixedtip, "expose_event", - G_CALLBACK (expose_handler), NULL); -#endif - gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK); g_signal_connect (fixedtip, "button_press_event", @@ -177,11 +152,7 @@ na_fixed_tip_position (NaFixedTip *fixedtip) gtk_window_set_screen (GTK_WINDOW (fixedtip), screen); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (fixedtip), &req, NULL); -#else - gtk_widget_size_request (GTK_WIDGET (fixedtip), &req); -#endif gdk_window_get_origin (parent_window, &root_x, &root_y); parent_width = gdk_window_get_width(parent_window); diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index e431a699..54080a20 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -45,16 +45,11 @@ G_DEFINE_TYPE (NaTrayApplet, na_tray_applet, PANEL_TYPE_APPLET) static void (*parent_class_realize) (GtkWidget *widget); static void (*parent_class_unrealize) (GtkWidget *widget); -#if GTK_CHECK_VERSION (3, 0, 0) static void (*parent_class_style_updated) (GtkWidget *widget); static void (*parent_class_change_background)(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t* pattern); -#else -static void (*parent_class_change_background)(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap); -#endif static void (*parent_class_change_orient)(MatePanelApplet *panel_applet, MatePanelAppletOrient orient); - static GtkOrientation get_gtk_orientation_from_applet_orient (MatePanelAppletOrient orient) { @@ -201,7 +196,6 @@ na_tray_applet_unrealize (GtkWidget *widget) parent_class_unrealize (widget); } -#if GTK_CHECK_VERSION (3, 0, 0) static void na_tray_applet_style_updated (GtkWidget *widget) { @@ -244,24 +238,14 @@ na_tray_applet_style_updated (GtkWidget *widget) gtk_widget_style_get (widget, "icon-size", &icon_size, NULL); na_tray_set_icon_size (applet->priv->tray, icon_size); } -#endif -#if GTK_CHECK_VERSION (3, 0, 0) static void na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t* pattern) -#else -static void -na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap) -#endif { NaTrayApplet *applet = NA_TRAY_APPLET (panel_applet); if (parent_class_change_background) { -#if GTK_CHECK_VERSION (3, 0, 0) parent_class_change_background (panel_applet, type, color, pattern); -#else - parent_class_change_background (panel_applet, type, color, pixmap); -#endif } if (!applet->priv->tray) @@ -286,10 +270,7 @@ na_tray_applet_change_orient (MatePanelApplet *panel_applet, get_gtk_orientation_from_applet_orient (orient)); } -#if GTK_CHECK_VERSION (3, 0, 0) -#if GTK_CHECK_VERSION (3, 20, 0) -/* deprecated with gtk+-3.19.0 */ -#else +#if !GTK_CHECK_VERSION (3, 20, 0) static inline void force_no_focus_padding (GtkWidget *widget) { @@ -308,21 +289,6 @@ force_no_focus_padding (GtkWidget *widget) g_object_unref (provider); } #endif -#else -static inline void -force_no_focus_padding (GtkWidget *widget) -{ - gtk_rc_parse_string ("\n" - " style \"na-tray-style\"\n" - " {\n" - " GtkWidget::focus-line-width=0\n" - " GtkWidget::focus-padding=0\n" - " }\n" - "\n" - " class \"NaTrayApplet\" style \"na-tray-style\"\n" - "\n"); -} -#endif static void na_tray_applet_class_init (NaTrayAppletClass *class) @@ -335,10 +301,8 @@ na_tray_applet_class_init (NaTrayAppletClass *class) parent_class_unrealize = widget_class->unrealize; widget_class->unrealize = na_tray_applet_unrealize; -#if GTK_CHECK_VERSION (3, 0, 0) parent_class_style_updated = widget_class->style_updated; widget_class->style_updated = na_tray_applet_style_updated; -#endif parent_class_change_background = applet_class->change_background; applet_class->change_background = na_tray_applet_change_background; @@ -386,13 +350,7 @@ na_tray_applet_init (NaTrayApplet *applet) mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_HAS_HANDLE|MATE_PANEL_APPLET_EXPAND_MINOR); -#if !GTK_CHECK_VERSION (3, 0, 0) - mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (applet), - GTK_WIDGET (applet)); -#endif -#if GTK_CHECK_VERSION (3, 20, 0) -/* deprecated with gtk+-3.19.0 */ -#else +#if !GTK_CHECK_VERSION (3, 20, 0) force_no_focus_padding (GTK_WIDGET (applet)); #endif } diff --git a/applets/notification_area/na-tray-child.c b/applets/notification_area/na-tray-child.c index 3b5c04db..64824a74 100644 --- a/applets/notification_area/na-tray-child.c +++ b/applets/notification_area/na-tray-child.c @@ -55,33 +55,18 @@ na_tray_child_realize (GtkWidget *widget) * extension. */ /* Set a transparent background */ -#if GTK_CHECK_VERSION (3, 0, 0) cairo_pattern_t *transparent = cairo_pattern_create_rgba (0, 0, 0, 0); gdk_window_set_background_pattern (window, transparent); -#else - GdkColor transparent = { 0, 0, 0, 0 }; /* only pixel=0 matters */ - gdk_window_set_background (window, &transparent); -#endif gdk_window_set_composited (window, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_pattern_destroy (transparent); -#endif child->parent_relative_bg = FALSE; } -#if GTK_CHECK_VERSION(3, 0, 0) else if (visual == gdk_window_get_visual(gdk_window_get_parent(window))) -#else - else if (visual == gdk_drawable_get_visual(GDK_DRAWABLE(gdk_window_get_parent(window)))) -#endif { /* Otherwise, if the visual matches the visual of the parent window, we * can use a parent-relative background and fake transparency. */ -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background_pattern (window, NULL); -#else - gdk_window_set_back_pixmap (window, NULL, TRUE); -#endif child->parent_relative_bg = TRUE; } @@ -114,7 +99,6 @@ na_tray_child_style_set (GtkWidget *widget, */ } -#if GTK_CHECK_VERSION (3, 0, 0) static void na_tray_child_get_preferred_width (GtkWidget *widget, gint *minimal_width, @@ -146,36 +130,6 @@ na_tray_child_get_preferred_height (GtkWidget *widget, if (*natural_height < 16) *natural_height = 16; } -#else -#if 0 -/* This is adapted from code that was commented out in na-tray-manager.c; the - * code in na-tray-manager.c wouldn't have worked reliably, this will. So maybe - * it can be reenabled. On other hand, things seem to be working fine without - * it. - * - * If reenabling, you need to hook it up in na_tray_child_class_init(). - */ -static void -na_tray_child_size_request (GtkWidget *widget, - GtkRequisition *request) -{ - GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_request (widget, request); - - /* - * Make sure the icons have a meaningful size .. - */ - if ((request->width < 16) || (request->height < 16)) - { - gint nw = MAX (24, request->width); - gint nh = MAX (24, request->height); - g_warning ("Tray icon has requested a size of (%ix%i), resizing to (%ix%i)", - req.width, req.height, nw, nh); - request->width = nw; - request->height = nh; - } -} -#endif -#endif static void na_tray_child_size_allocate (GtkWidget *widget, @@ -227,39 +181,21 @@ na_tray_child_size_allocate (GtkWidget *widget, * expose handler draws with real or fake transparency. */ static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) na_tray_child_draw (GtkWidget *widget, cairo_t *cr) -#else -na_tray_child_expose_event (GtkWidget *widget, - GdkEventExpose *event) -#endif { NaTrayChild *child = NA_TRAY_CHILD (widget); -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkWindow *window = gtk_widget_get_window (widget); -#endif if (na_tray_child_has_alpha (child)) { /* Clear to transparent */ -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr = gdk_cairo_create (window); -#endif cairo_set_source_rgba (cr, 0, 0, 0, 0); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); -#if GTK_CHECK_VERSION (3, 0, 0) - cairo_paint (cr); -#else - gdk_cairo_region (cr, event->region); cairo_paint (cr); - cairo_destroy (cr); -#endif } else if (child->parent_relative_bg) { /* Clear to parent-relative pixmap */ -#if GTK_CHECK_VERSION (3, 0, 0) GdkWindow *window; cairo_surface_t *target; GdkRectangle clip_rect; @@ -282,11 +218,6 @@ na_tray_child_expose_event (GtkWidget *widget, cairo_surface_mark_dirty_rectangle (target, clip_rect.x, clip_rect.y, clip_rect.width, clip_rect.height); -#else - gdk_window_clear_area (window, - event->area.x, event->area.y, - event->area.width, event->area.height); -#endif } return FALSE; @@ -309,16 +240,10 @@ na_tray_child_class_init (NaTrayChildClass *klass) gobject_class->finalize = na_tray_child_finalize; widget_class->style_set = na_tray_child_style_set; widget_class->realize = na_tray_child_realize; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = na_tray_child_get_preferred_width; widget_class->get_preferred_height = na_tray_child_get_preferred_height; -#endif widget_class->size_allocate = na_tray_child_size_allocate; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = na_tray_child_draw; -#else - widget_class->expose_event = na_tray_child_expose_event; -#endif } GtkWidget * @@ -330,10 +255,6 @@ na_tray_child_new (GdkScreen *screen, NaTrayChild *child; GdkVisual *visual; gboolean visual_has_alpha; -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkColormap *colormap; - gboolean new_colormap; -#endif int red_prec, green_prec, blue_prec, depth; int result; @@ -349,11 +270,7 @@ na_tray_child_new (GdkScreen *screen, gdk_error_trap_push (); result = XGetWindowAttributes (xdisplay, icon_window, &window_attributes); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif if (!result) /* Window already gone */ return NULL; @@ -363,30 +280,10 @@ na_tray_child_new (GdkScreen *screen, if (!visual) /* Icon window is on another screen? */ return NULL; -#if !GTK_CHECK_VERSION (3, 0, 0) - new_colormap = FALSE; - - if (visual == gdk_screen_get_rgb_visual (screen)) - colormap = gdk_screen_get_rgb_colormap (screen); - else if (visual == gdk_screen_get_rgba_visual (screen)) - colormap = gdk_screen_get_rgba_colormap (screen); - else if (visual == gdk_screen_get_system_visual (screen)) - colormap = gdk_screen_get_system_colormap (screen); - else - { - colormap = gdk_colormap_new (visual, FALSE); - new_colormap = TRUE; - } -#endif - child = g_object_new (NA_TYPE_TRAY_CHILD, NULL); child->icon_window = icon_window; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_visual (GTK_WIDGET (child), visual); -#else - gtk_widget_set_colormap (GTK_WIDGET (child), colormap); -#endif /* We have alpha if the visual has something other than red, green, * and blue */ @@ -401,11 +298,6 @@ na_tray_child_new (GdkScreen *screen, child->composited = child->has_alpha; -#if !GTK_CHECK_VERSION (3, 0, 0) - if (new_colormap) - g_object_unref (colormap); -#endif - return GTK_WIDGET (child); } @@ -549,12 +441,8 @@ na_tray_child_force_redraw (NaTrayChild *child) * since that is asynchronous. */ XSync (xdisplay, False); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); #else - gdk_error_trap_pop (); -#endif -#else /* Hiding and showing is the safe way to do it, but can result in more * flickering. */ @@ -597,11 +485,7 @@ _get_wmclass (Display *xdisplay, gdk_error_trap_push (); XGetClassHint (xdisplay, xwindow, &ch); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif if (res_class) *res_class = NULL; diff --git a/applets/notification_area/na-tray-child.h b/applets/notification_area/na-tray-child.h index 9427d74b..2ddfed9e 100644 --- a/applets/notification_area/na-tray-child.h +++ b/applets/notification_area/na-tray-child.h @@ -25,10 +25,7 @@ #include <gtk/gtk.h> #include <gdk/gdkx.h> - -#if GTK_CHECK_VERSION (3, 0, 0) #include <gtk/gtkx.h> -#endif #ifdef __cplusplus extern "C" { diff --git a/applets/notification_area/na-tray-manager.c b/applets/notification_area/na-tray-manager.c index aaea0908..94d3003d 100644 --- a/applets/notification_area/na-tray-manager.c +++ b/applets/notification_area/na-tray-manager.c @@ -97,7 +97,6 @@ na_tray_manager_init (NaTrayManager *manager) manager->padding = 0; manager->icon_size = 0; -#if GTK_CHECK_VERSION (3, 0, 0) manager->fg.red = 0.0; manager->fg.green = 0.0; manager->fg.blue = 0.0; @@ -117,23 +116,6 @@ na_tray_manager_init (NaTrayManager *manager) manager->success.green = 1.0; manager->success.blue = 0.0; manager->success.alpha = 1.0; -#else - manager->fg.red = 0; - manager->fg.green = 0; - manager->fg.blue = 0; - - manager->error.red = 0xffff; - manager->error.green = 0; - manager->error.blue = 0; - - manager->warning.red = 0xffff; - manager->warning.green = 0xffff; - manager->warning.blue = 0; - - manager->success.red = 0; - manager->success.green = 0xffff; - manager->success.blue = 0; -#endif } static void @@ -344,29 +326,13 @@ pending_message_free (PendingMessage *message) g_free (message); } -#if GTK_CHECK_VERSION (3, 0, 0) static void na_tray_manager_handle_message_data (NaTrayManager *manager, XClientMessageEvent *xevent) -#else -static GdkFilterReturn -na_tray_manager_handle_client_message_message_data (GdkXEvent *xev, - GdkEvent *event, - gpointer data) -#endif { -#if !GTK_CHECK_VERSION (3, 0, 0) - XClientMessageEvent *xevent; - NaTrayManager *manager; -#endif GList *p; int len; -#if !GTK_CHECK_VERSION (3, 0, 0) - xevent = (XClientMessageEvent *) xev; - manager = data; -#endif - /* Try to see if we can find the pending message in the list */ for (p = manager->messages; p; p = p->next) { @@ -400,10 +366,6 @@ na_tray_manager_handle_client_message_message_data (GdkXEvent *xev, break; } } - -#if !GTK_CHECK_VERSION (3, 0, 0) - return GDK_FILTER_REMOVE; -#endif } static void @@ -498,41 +460,6 @@ na_tray_manager_handle_cancel_message (NaTrayManager *manager, } } -#if !GTK_CHECK_VERSION (3, 0, 0) -static GdkFilterReturn -na_tray_manager_handle_client_message_opcode (GdkXEvent *xev, - GdkEvent *event, - gpointer data) -{ - XClientMessageEvent *xevent; - NaTrayManager *manager; - - xevent = (XClientMessageEvent *) xev; - manager = data; - - switch (xevent->data.l[1]) - { - case SYSTEM_TRAY_REQUEST_DOCK: - /* Ignore this one since we don't know on which window this was received - * and so we can't know for which screen this is. It will be handled - * in na_tray_manager_window_filter() since we also receive it there */ - break; - - case SYSTEM_TRAY_BEGIN_MESSAGE: - na_tray_manager_handle_begin_message (manager, xevent); - return GDK_FILTER_REMOVE; - - case SYSTEM_TRAY_CANCEL_MESSAGE: - na_tray_manager_handle_cancel_message (manager, xevent); - return GDK_FILTER_REMOVE; - default: - break; - } - - return GDK_FILTER_CONTINUE; -} -#endif - static GdkFilterReturn na_tray_manager_window_filter (GdkXEvent *xev, GdkEvent *event, @@ -552,7 +479,6 @@ na_tray_manager_window_filter (GdkXEvent *xev, (XClientMessageEvent *) xevent); return GDK_FILTER_REMOVE; } -#if GTK_CHECK_VERSION (3, 0, 0) /* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_BEGIN_MESSAGE */ else if (xevent->xclient.message_type == manager->opcode_atom && xevent->xclient.data.l[1] == SYSTEM_TRAY_BEGIN_MESSAGE) @@ -576,7 +502,6 @@ na_tray_manager_window_filter (GdkXEvent *xev, (XClientMessageEvent *) event); return GDK_FILTER_REMOVE; } -#endif } else if (xevent->type == SelectionClear) { @@ -634,12 +559,6 @@ na_tray_manager_unmanage (NaTrayManager *manager) TRUE); } -/* fixed in GTK3 */ -#if !GTK_CHECK_VERSION (3, 0, 0) - //FIXME: we should also use gdk_remove_client_message_filter when it's - //available - // See bug #351254 -#endif gdk_window_remove_filter (window, na_tray_manager_window_filter, manager); @@ -716,14 +635,7 @@ na_tray_manager_set_visual_property (NaTrayManager *manager) * be embedded. In almost all cases, this will be the same as the visual * of the screen. */ -#if GTK_CHECK_VERSION (3, 0, 0) xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (manager->screen)); -#else - GdkColormap *colormap; - - colormap = gdk_screen_get_default_colormap (manager->screen); - xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap)); -#endif } data[0] = XVisualIDFromVisual (xvisual); @@ -810,7 +722,6 @@ na_tray_manager_set_colors_property (NaTrayManager *manager) atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_SYSTEM_TRAY_COLORS"); -#if GTK_CHECK_VERSION (3, 0, 0) data[0] = manager->fg.red * 65535; data[1] = manager->fg.green * 65535; data[2] = manager->fg.blue * 65535; @@ -823,20 +734,6 @@ na_tray_manager_set_colors_property (NaTrayManager *manager) data[9] = manager->success.red * 65535; data[10] = manager->success.green * 65535; data[11] = manager->success.blue * 65535; -#else - data[0] = manager->fg.red; - data[1] = manager->fg.green; - data[2] = manager->fg.blue; - data[3] = manager->error.red; - data[4] = manager->error.green; - data[5] = manager->error.blue; - data[6] = manager->warning.red; - data[7] = manager->warning.green; - data[8] = manager->warning.blue; - data[9] = manager->success.red; - data[10] = manager->success.green; - data[11] = manager->success.blue; -#endif XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), @@ -935,11 +832,8 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager, message_data_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA", FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) manager->message_data_atom = gdk_x11_atom_to_xatom_for_display (display, message_data_atom); -#endif - /* Add a window filter */ #if 0 @@ -951,16 +845,6 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager, /* This is for SYSTEM_TRAY_REQUEST_DOCK and SelectionClear */ gdk_window_add_filter (window, na_tray_manager_window_filter, manager); -#if !GTK_CHECK_VERSION (3, 0, 0) - /* This is for SYSTEM_TRAY_BEGIN_MESSAGE and SYSTEM_TRAY_CANCEL_MESSAGE */ - gdk_display_add_client_message_filter (display, opcode_atom, - na_tray_manager_handle_client_message_opcode, - manager); - /* This is for _NET_SYSTEM_TRAY_MESSAGE_DATA */ - gdk_display_add_client_message_filter (display, message_data_atom, - na_tray_manager_handle_client_message_message_data, - manager); -#endif return TRUE; } else @@ -1074,7 +958,6 @@ na_tray_manager_set_icon_size (NaTrayManager *manager, void na_tray_manager_set_colors (NaTrayManager *manager, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *fg, GdkRGBA *error, GdkRGBA *warning, @@ -1086,19 +969,6 @@ na_tray_manager_set_colors (NaTrayManager *manager, !gdk_rgba_equal (&manager->error, error) || !gdk_rgba_equal (&manager->warning, warning) || !gdk_rgba_equal (&manager->success, success)) -#else - GdkColor *fg, - GdkColor *error, - GdkColor *warning, - GdkColor *success) -{ - g_return_if_fail (NA_IS_TRAY_MANAGER (manager)); - - if (!gdk_color_equal (&manager->fg, fg) || - !gdk_color_equal (&manager->error, error) || - !gdk_color_equal (&manager->warning, warning) || - !gdk_color_equal (&manager->success, success)) -#endif { manager->fg = *fg; manager->error = *error; diff --git a/applets/notification_area/na-tray-manager.h b/applets/notification_area/na-tray-manager.h index d1d585fe..811791be 100644 --- a/applets/notification_area/na-tray-manager.h +++ b/applets/notification_area/na-tray-manager.h @@ -50,27 +50,18 @@ struct _NaTrayManager #ifdef GDK_WINDOWING_X11 GdkAtom selection_atom; Atom opcode_atom; -#if GTK_CHECK_VERSION (3, 0, 0) Atom message_data_atom; #endif -#endif GtkWidget *invisible; GdkScreen *screen; GtkOrientation orientation; gint padding; gint icon_size; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA fg; GdkRGBA error; GdkRGBA warning; GdkRGBA success; -#else - GdkColor fg; - GdkColor error; - GdkColor warning; - GdkColor success; -#endif GList *messages; GHashTable *socket_table; @@ -112,18 +103,10 @@ void na_tray_manager_set_padding (NaTrayManager *manager, void na_tray_manager_set_icon_size (NaTrayManager *manager, gint padding); void na_tray_manager_set_colors (NaTrayManager *manager, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *fg, GdkRGBA *error, GdkRGBA *warning, GdkRGBA *success); -#else - GdkColor *fg, - GdkColor *error, - GdkColor *warning, - GdkColor *success); -#endif - G_END_DECLS diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c index b07376c2..34fb435e 100644 --- a/applets/notification_area/na-tray.c +++ b/applets/notification_area/na-tray.c @@ -48,9 +48,6 @@ struct _NaTrayPrivate TraysScreen *trays_screen; GtkWidget *box; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *frame; -#endif guint idle_redraw_id; @@ -86,27 +83,6 @@ static TraysScreen *trays_screens = NULL; static void icon_tip_show_next (IconTip *icontip); -#if !GTK_CHECK_VERSION (3, 0, 0) -/* NaBox, an instantiable GtkBox */ - -typedef GtkBox NaBox; -typedef GtkBoxClass NaBoxClass; - -static GType na_box_get_type (void); - -G_DEFINE_TYPE (NaBox, na_box, GTK_TYPE_BOX) - -static void -na_box_init (NaBox *box) -{ -} - -static void -na_box_class_init (NaBoxClass *klass) -{ -} -#endif - /* NaTray */ G_DEFINE_TYPE (NaTray, na_tray, GTK_TYPE_BIN) @@ -536,11 +512,7 @@ update_size_and_orientation (NaTray *tray) * gdk_window_set_composited(). We need to paint these children ourselves. */ static void -#if GTK_CHECK_VERSION (3, 0, 0) na_tray_draw_icon (GtkWidget *widget, -#else -na_tray_expose_icon (GtkWidget *widget, -#endif gpointer data) { cairo_t *cr = (cairo_t *) data; @@ -551,7 +523,6 @@ na_tray_expose_icon (GtkWidget *widget, gtk_widget_get_allocation (widget, &allocation); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_save (cr); gdk_cairo_set_source_window (cr, gtk_widget_get_window (widget), @@ -559,40 +530,16 @@ na_tray_expose_icon (GtkWidget *widget, allocation.y); cairo_rectangle (cr, allocation.x, allocation.y, allocation.width, allocation.height); cairo_clip (cr); -#else - gdk_cairo_set_source_pixmap (cr, - gtk_widget_get_window (widget), - allocation.x, - allocation.y); -#endif cairo_paint (cr); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_restore (cr); -#endif } } static void -#if GTK_CHECK_VERSION (3, 0, 0) na_tray_draw_box (GtkWidget *box, cairo_t *cr) -#else -na_tray_expose_box (GtkWidget *box, - GdkEventExpose *event) -#endif { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_foreach (GTK_CONTAINER (box), na_tray_draw_icon, cr); -#else - cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (box)); - - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - - gtk_container_foreach (GTK_CONTAINER (box), na_tray_expose_icon, cr); - - cairo_destroy (cr); -#endif } static void @@ -605,22 +552,10 @@ na_tray_init (NaTray *tray) priv->screen = NULL; priv->orientation = GTK_ORIENTATION_HORIZONTAL; -#if GTK_CHECK_VERSION (3, 0, 0) priv->box = gtk_box_new (priv->orientation, ICON_SPACING); g_signal_connect (priv->box, "draw", G_CALLBACK (na_tray_draw_box), NULL); gtk_container_add (GTK_CONTAINER (tray), priv->box); -#else - priv->frame = gtk_alignment_new (0.5, 0.5, 1.0, 1.0); - gtk_container_add (GTK_CONTAINER (tray), priv->frame); - gtk_widget_show (priv->frame); - - priv->box = g_object_new (na_box_get_type (), NULL); - g_signal_connect (priv->box, "expose-event", - G_CALLBACK (na_tray_expose_box), tray); - gtk_box_set_spacing (GTK_BOX (priv->box), ICON_SPACING); - gtk_container_add (GTK_CONTAINER (priv->frame), priv->box); -#endif gtk_widget_show (priv->box); } @@ -644,16 +579,7 @@ na_tray_constructor (GType type, if (!initialized) { -#if GTK_CHECK_VERSION (3, 0, 0) trays_screens = g_new0 (TraysScreen, 1); -#else - GdkDisplay *display; - int n_screens; - - display = gdk_display_get_default (); - n_screens = gdk_display_get_n_screens (display); - trays_screens = g_new0 (TraysScreen, n_screens); -#endif initialized = TRUE; } @@ -775,7 +701,6 @@ na_tray_set_property (GObject *object, } } -#if GTK_CHECK_VERSION (3, 0, 0) static void na_tray_get_preferred_width (GtkWidget *widget, gint *minimal_width, @@ -795,14 +720,6 @@ na_tray_get_preferred_height (GtkWidget *widget, minimal_height, natural_height); } -#else -static void -na_tray_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - gtk_widget_size_request (gtk_bin_get_child (GTK_BIN (widget)), requisition); -} -#endif static void na_tray_size_allocate (GtkWidget *widget, @@ -822,12 +739,8 @@ na_tray_class_init (NaTrayClass *klass) gobject_class->set_property = na_tray_set_property; gobject_class->dispose = na_tray_dispose; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = na_tray_get_preferred_width; widget_class->get_preferred_height = na_tray_get_preferred_height; -#else - widget_class->size_request = na_tray_size_request; -#endif widget_class->size_allocate = na_tray_size_allocate; g_object_class_install_property @@ -920,17 +833,10 @@ na_tray_set_icon_size (NaTray *tray, void na_tray_set_colors (NaTray *tray, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *fg, GdkRGBA *error, GdkRGBA *warning, GdkRGBA *success) -#else - GdkColor *fg, - GdkColor *error, - GdkColor *warning, - GdkColor *success) -#endif { NaTrayPrivate *priv = tray->priv; diff --git a/applets/notification_area/na-tray.h b/applets/notification_area/na-tray.h index c3d3415e..8ecac1cb 100644 --- a/applets/notification_area/na-tray.h +++ b/applets/notification_area/na-tray.h @@ -65,17 +65,10 @@ void na_tray_set_padding (NaTray *tray, void na_tray_set_icon_size (NaTray *tray, gint icon_size); void na_tray_set_colors (NaTray *tray, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *fg, GdkRGBA *error, GdkRGBA *warning, GdkRGBA *success); -#else - GdkColor *fg, - GdkColor *error, - GdkColor *warning, - GdkColor *success); -#endif void na_tray_force_redraw (NaTray *tray); G_END_DECLS diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c index 0cb38e92..f3724025 100644 --- a/applets/notification_area/testtray.c +++ b/applets/notification_area/testtray.c @@ -150,22 +150,14 @@ create_tray_on_screen (GdkScreen *screen, data->window = window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_object_weak_ref (G_OBJECT (window), (GWeakNotify) maybe_quit, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_container_add (GTK_CONTAINER (window), vbox); button = gtk_button_new_with_mnemonic ("_Add another tray"); g_signal_connect (button, "clicked", G_CALLBACK (add_tray_cb), data); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); -#else - hbox = gtk_hbox_new (FALSE, 12); -#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic ("_Orientation:"); #if GTK_CHECK_VERSION (3, 16, 0) @@ -218,28 +210,15 @@ main (int argc, char *argv[]) { GdkDisplay *display; GdkScreen *screen; -#if !GTK_CHECK_VERSION (3, 0, 0) - int n_screens, i; -#endif gtk_init (&argc, &argv); gtk_window_set_default_icon_name (NOTIFICATION_AREA_ICON); display = gdk_display_get_default (); -#if GTK_CHECK_VERSION (3, 0, 0) screen = gdk_display_get_default_screen (display); create_tray_on_screen (screen, FALSE); -#else - n_screens = gdk_display_get_n_screens (display); - for (i = 0; i < n_screens; ++i) { - screen = gdk_display_get_screen (display, i); - create_tray_on_screen (screen, FALSE); - - create_tray_on_screen (screen, FALSE); - } -#endif gtk_main (); diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c index a205d9b0..e23ea361 100644 --- a/applets/wncklet/showdesktop.c +++ b/applets/wncklet/showdesktop.c @@ -130,13 +130,9 @@ static void button_size_allocated(GtkWidget* button, GtkAllocation* allocation, static void update_icon(ShowDesktopData* sdd) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkStateFlags state; GtkBorder padding; -#else - GtkStyle* style; -#endif int width, height; GdkPixbuf* icon; GdkPixbuf* scaled; @@ -151,7 +147,6 @@ static void update_icon(ShowDesktopData* sdd) if (!sdd->icon_theme) return; -#if GTK_CHECK_VERSION (3, 0, 0) state = gtk_widget_get_state_flags (sdd->button); context = gtk_widget_get_style_context (sdd->button); gtk_style_context_get_padding (context, state, &padding); @@ -175,23 +170,6 @@ static void update_icon(ShowDesktopData* sdd) #else icon_size = sdd->size - 2 * (focus_width + focus_pad) - thickness; #endif -#else - gtk_widget_style_get (sdd->button, "focus-line-width", &focus_width, "focus-padding", &focus_pad, NULL); - - style = gtk_widget_get_style(sdd->button); - - switch (sdd->orient) - { - case GTK_ORIENTATION_HORIZONTAL: - thickness = style->ythickness; - break; - case GTK_ORIENTATION_VERTICAL: - thickness = style->xthickness; - break; - } - - icon_size = sdd->size - 2 * (focus_width + focus_pad) - thickness; -#endif if (icon_size < 22) icon_size = 16; @@ -409,11 +387,9 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet) GtkActionGroup* action_group; gchar* ui_path; AtkObject* atk_obj; -#if GTK_CHECK_VERSION (3, 0, 0) #if !GTK_CHECK_VERSION (3, 20, 0) GtkCssProvider *provider; #endif -#endif mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); @@ -443,7 +419,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet) sdd->button = gtk_toggle_button_new (); gtk_widget_set_name (sdd->button, "showdesktop-button"); -#if GTK_CHECK_VERSION (3, 0, 0) #if !GTK_CHECK_VERSION (3, 20, 0) provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, @@ -457,17 +432,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); #endif -#else - gtk_rc_parse_string ("\n" - " style \"showdesktop-button-style\"\n" - " {\n" - " GtkWidget::focus-line-width=0\n" - " GtkWidget::focus-padding=0\n" - " }\n" - "\n" - " widget \"*.showdesktop-button\" style \"showdesktop-button-style\"\n" - "\n"); -#endif atk_obj = gtk_widget_get_accessible(sdd->button); atk_object_set_name (atk_obj, _("Show Desktop Button")); diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c index b9db7e3c..2b7e2974 100644 --- a/applets/wncklet/window-list.c +++ b/applets/wncklet/window-list.c @@ -119,27 +119,17 @@ static void applet_change_orient(MatePanelApplet* applet, MatePanelAppletOrient tasklist->orientation = new_orient; -#ifdef WNCK_CHECK_VERSION #if WNCK_CHECK_VERSION (3, 4, 6) wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), new_orient); #endif -#endif tasklist_update(tasklist); } -#if GTK_CHECK_VERSION (3, 0, 0) static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, cairo_pattern_t* pattern, TasklistData* tasklist) -#else -static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap, TasklistData* tasklist) -#endif { switch (type) { case PANEL_NO_BACKGROUND: -#if !GTK_CHECK_VERSION (3, 0 ,0) - wnck_tasklist_set_button_relief(WNCK_TASKLIST(tasklist->tasklist), GTK_RELIEF_NORMAL); - break; -#endif case PANEL_COLOR_BACKGROUND: case PANEL_PIXMAP_BACKGROUND: wnck_tasklist_set_button_relief(WNCK_TASKLIST(tasklist->tasklist), GTK_RELIEF_NONE); @@ -424,22 +414,12 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) break; } -#ifdef WNCK_CHECK_VERSION -#if WNCK_CHECK_VERSION (3, 0, 0) tasklist->tasklist = wnck_tasklist_new(); -#else - tasklist->tasklist = wnck_tasklist_new(NULL); -#endif -#else - tasklist->tasklist = wnck_tasklist_new(NULL); -#endif -#ifdef WNCK_CHECK_VERSION #if WNCK_CHECK_VERSION (3, 4, 6) wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), tasklist->orientation); wnck_tasklist_set_middle_click_close (WNCK_TASKLIST (tasklist->tasklist), TRUE); #endif -#endif wnck_tasklist_set_icon_loader(WNCK_TASKLIST(tasklist->tasklist), icon_loader_func, tasklist, NULL); diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c index 7f40caac..cbc867d1 100644 --- a/applets/wncklet/window-menu.c +++ b/applets/wncklet/window-menu.c @@ -117,7 +117,6 @@ static void window_menu_destroy(GtkWidget* widget, WindowMenu* window_menu) g_free(window_menu); } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean window_menu_on_draw (GtkWidget* widget, cairo_t* cr, gpointer data) @@ -145,28 +144,7 @@ static gboolean window_menu_on_draw (GtkWidget* widget, return FALSE; } -#else -static gboolean window_menu_on_expose (GtkWidget* widget, - GdkEventExpose* event, - gpointer data) -{ - WindowMenu* window_menu = data; - - if (gtk_widget_has_focus(window_menu->applet)) - gtk_paint_focus(gtk_widget_get_style(widget), - gtk_widget_get_window(widget), - gtk_widget_get_state(widget), - NULL, - widget, - "menu-applet", - 0, 0, - -1, -1); - - return FALSE; -} -#endif -#if GTK_CHECK_VERSION (3, 0, 0) #if !GTK_CHECK_VERSION (3, 20, 0) static inline void force_no_focus_padding(GtkWidget* widget) { @@ -187,28 +165,6 @@ static inline void force_no_focus_padding(GtkWidget* widget) gtk_widget_set_name(widget, "PanelApplet-window-menu-applet-button"); } #endif -#else -static inline void force_no_focus_padding(GtkWidget* widget) -{ - gboolean first_time = TRUE; - - if (first_time) - { - gtk_rc_parse_string("\n" - " style \"window-menu-applet-button-style\"\n" - " {\n" - " GtkWidget::focus-line-width=0\n" - " GtkWidget::focus-padding=0\n" - " }\n" - "\n" - " widget \"*.PanelApplet-window-menu-applet-button\" style \"window-menu-applet-button-style\"\n" - "\n"); - first_time = FALSE; - } - - gtk_widget_set_name(widget, "PanelApplet-window-menu-applet-button"); -} -#endif static void window_menu_size_allocate(MatePanelApplet* applet, GtkAllocation* allocation, WindowMenu* window_menu) { @@ -265,15 +221,6 @@ static gboolean window_menu_key_press_event(GtkWidget* widget, GdkEventKey* even */ menu_shell = GTK_MENU_SHELL(selector); -#if !GTK_CHECK_VERSION (3, 0, 0) - if (!menu_shell->active) - { - gtk_grab_add(GTK_WIDGET(menu_shell)); - menu_shell->have_grab = TRUE; - menu_shell->active = TRUE; - } -#endif - gtk_menu_shell_select_first(menu_shell, FALSE); return TRUE; default: @@ -331,11 +278,7 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet) g_signal_connect_after(G_OBJECT(window_menu->applet), "focus-in-event", G_CALLBACK(gtk_widget_queue_draw), window_menu); g_signal_connect_after(G_OBJECT(window_menu->applet), "focus-out-event", G_CALLBACK(gtk_widget_queue_draw), window_menu); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect_after(G_OBJECT(window_menu->selector), "draw", G_CALLBACK(window_menu_on_draw), window_menu); -#else - g_signal_connect_after(G_OBJECT(window_menu->selector), "expose-event", G_CALLBACK(window_menu_on_expose), window_menu); -#endif g_signal_connect(G_OBJECT(window_menu->selector), "button_press_event", G_CALLBACK(filter_button_press), window_menu); diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c index f61ba4cc..e88839dd 100644 --- a/applets/wncklet/workspace-switcher.c +++ b/applets/wncklet/workspace-switcher.c @@ -131,16 +131,11 @@ static void update_properties_for_wm(PagerData* pager) g_assert_not_reached(); } -#if GTK_CHECK_VERSION (3, 0, 0) if (pager->properties_dialog) { gtk_widget_hide (pager->properties_dialog); gtk_widget_unrealize (pager->properties_dialog); gtk_widget_show (pager->properties_dialog); } -#else - if (pager->properties_dialog) - gtk_window_reshow_with_initial_size(GTK_WINDOW(pager->properties_dialog)); -#endif } static void window_manager_changed(WnckScreen* screen, PagerData* pager) @@ -203,7 +198,6 @@ static void applet_change_orient(MatePanelApplet* applet, MatePanelAppletOrient gtk_label_set_text(GTK_LABEL(pager->label_row_col), pager->orientation == GTK_ORIENTATION_HORIZONTAL ? _("rows") : _("columns")); } -#if GTK_CHECK_VERSION (3, 0, 0) static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, cairo_pattern_t *pattern, PagerData* pager) { GtkStyleContext *new_context; @@ -214,147 +208,8 @@ static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBac wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager), type == PANEL_NO_BACKGROUND ? GTK_SHADOW_NONE : GTK_SHADOW_IN); -#else -static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap, PagerData* pager) -{ - /* taken from the TrashApplet */ - GtkRcStyle *rc_style; - GtkStyle *style; - - /* reset style */ - gtk_widget_set_style (GTK_WIDGET (pager->pager), NULL); - rc_style = gtk_rc_style_new (); - gtk_widget_modify_style (GTK_WIDGET (pager->pager), rc_style); - g_object_unref (rc_style); - - switch (type) - { - case PANEL_COLOR_BACKGROUND: - gtk_widget_modify_bg (GTK_WIDGET (pager->pager), GTK_STATE_NORMAL, color); - break; - - case PANEL_PIXMAP_BACKGROUND: - style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (pager->pager))); - if (style->bg_pixmap[GTK_STATE_NORMAL]) - g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]); - style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref(pixmap); - gtk_widget_set_style (GTK_WIDGET (pager->pager), style); - g_object_unref (style); - break; - - case PANEL_NO_BACKGROUND: - default: - break; - } -#endif } -#if !GTK_CHECK_VERSION (3, 0, 0) -static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, PagerData* pager) -{ - GdkScrollDirection absolute_direction; - int index; - int n_workspaces; - int n_columns; - int in_last_row; - - if (event->type != GDK_SCROLL) - return FALSE; - - index = wnck_workspace_get_number(wnck_screen_get_active_workspace(pager->screen)); - n_workspaces = wnck_screen_get_workspace_count(pager->screen); - n_columns = n_workspaces / pager->n_rows; - - if (n_workspaces % pager->n_rows != 0) - n_columns++; - - in_last_row = n_workspaces % n_columns; - - absolute_direction = event->direction; - - if (gtk_widget_get_direction(GTK_WIDGET(applet)) == GTK_TEXT_DIR_RTL) - { - switch (event->direction) - { - case GDK_SCROLL_DOWN: - case GDK_SCROLL_UP: - break; - case GDK_SCROLL_RIGHT: - absolute_direction = GDK_SCROLL_LEFT; - break; - case GDK_SCROLL_LEFT: - absolute_direction = GDK_SCROLL_RIGHT; - break; - } - } - - switch (absolute_direction) - { - case GDK_SCROLL_DOWN: - if (index + n_columns < n_workspaces) - { - index += n_columns; - } - else if (pager->wrap_workspaces && index == n_workspaces - 1) - { - index = 0; - } - else if ((index < n_workspaces - 1 && index + in_last_row != n_workspaces - 1) || (index == n_workspaces - 1 && in_last_row != 0)) - { - index = (index % n_columns) + 1; - } - break; - - case GDK_SCROLL_RIGHT: - if (index < n_workspaces - 1) - { - index++; - } - else if (pager->wrap_workspaces) - { - index = 0; - } - break; - - case GDK_SCROLL_UP: - if (index - n_columns >= 0) - { - index -= n_columns; - } - else if (index > 0) - { - index = ((pager->n_rows - 1) * n_columns) + (index % n_columns) - 1; - } - else if (pager->wrap_workspaces) - { - index = n_workspaces - 1; - } - - if (index >= n_workspaces) - index -= n_columns; - break; - - case GDK_SCROLL_LEFT: - if (index > 0) - { - index--; - } - else if (pager->wrap_workspaces) - { - index = n_workspaces - 1; - } - break; - default: - g_assert_not_reached(); - break; - } - - wnck_workspace_activate(wnck_screen_get_workspace(pager->screen, index), event->time); - - return TRUE; -} -#endif - static void destroy_pager(GtkWidget* widget, PagerData* pager) { g_object_unref (pager->settings); @@ -502,9 +357,7 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) GtkActionGroup* action_group; gchar* ui_path; gboolean display_names; -#if GTK_CHECK_VERSION (3, 0, 0) GtkCssProvider *provider; -#endif pager = g_new0(PagerData, 1); @@ -546,20 +399,11 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) break; } -#ifdef WNCK_CHECK_VERSION -#if WNCK_CHECK_VERSION (3, 0, 0) pager->pager = wnck_pager_new(); -#else - pager->pager = wnck_pager_new(NULL); -#endif -#else - pager->pager = wnck_pager_new(NULL); -#endif pager->screen = NULL; pager->wm = PAGER_WM_UNKNOWN; wnck_pager_set_shadow_type(WNCK_PAGER(pager->pager), GTK_SHADOW_IN); -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (applet)); gtk_style_context_add_class (context, "wnck-applet"); @@ -575,7 +419,7 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); g_object_unref (provider); -#endif + g_signal_connect(G_OBJECT(pager->pager), "destroy", G_CALLBACK(destroy_pager), pager); gtk_container_add(GTK_CONTAINER(pager->applet), pager->pager); @@ -584,9 +428,6 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) g_signal_connect(G_OBJECT(pager->applet), "realize", G_CALLBACK(applet_realized), pager); g_signal_connect(G_OBJECT(pager->applet), "unrealize", G_CALLBACK(applet_unrealized), pager); g_signal_connect(G_OBJECT(pager->applet), "change_orient", G_CALLBACK(applet_change_orient), pager); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_signal_connect(G_OBJECT(pager->applet), "scroll-event", G_CALLBACK(applet_scroll), pager); -#endif g_signal_connect(G_OBJECT(pager->applet), "change_background", G_CALLBACK(applet_change_background), pager); gtk_widget_show(pager->applet); @@ -726,13 +567,6 @@ static void workspace_destroyed(WnckScreen* screen, WnckWorkspace* space, PagerD static void num_workspaces_value_changed(GtkSpinButton* button, PagerData* pager) { -#if !GTK_CHECK_VERSION (3, 0, 0) - /* Slow down a bit after the first change, since it's moving really to - * fast. See bug #336731 for background. - * FIXME: remove this if bug 410520 gets fixed. */ - button->timer_step = 0.2; -#endif - wnck_screen_change_workspace_count(pager->screen, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pager->num_workspaces_spin))); } @@ -806,10 +640,8 @@ static void close_dialog(GtkWidget* button, gpointer data) { PagerData* pager = data; GtkTreeViewColumn* col; -#if GTK_CHECK_VERSION (3, 0, 0) GtkCellArea *area; GtkCellEditable *edit_widget; -#endif /* This is a hack. The "editable" signal for GtkCellRenderer is emitted only on button press or focus cycle. Hence when the user changes the @@ -820,15 +652,10 @@ static void close_dialog(GtkWidget* button, gpointer data) col = gtk_tree_view_get_column(GTK_TREE_VIEW(pager->workspaces_tree), 0); -#if GTK_CHECK_VERSION (3, 0, 0) area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col)); edit_widget = gtk_cell_area_get_edit_widget (area); if (edit_widget) gtk_cell_editable_editing_done (edit_widget); -#else - if (col->editable_widget != NULL && GTK_IS_CELL_EDITABLE(col->editable_widget)) - gtk_cell_editable_editing_done(col->editable_widget); -#endif gtk_widget_destroy(pager->properties_dialog); } |