diff options
86 files changed, 114 insertions, 5227 deletions
diff --git a/Makefile.am b/Makefile.am index 50f1eb17..38cc7f9f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,8 +13,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ - --disable-introspection \ - --with-gtk=$(GTK_API_VERSION) + --disable-introspection EXTRA_DIST = \ autogen.sh \ @@ -1,3 +1,5 @@ +1.17.0 + 1.16.0 * Use GtkAboutDialog instead of MateAboutDialog * GTK+3: use GtkColorButton/GtkColorChooser in properties dialog 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); } diff --git a/configure.ac b/configure.ac index 5beb67b9..6b426ee2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([mate-panel], [1.16.0], [https://github.com/mate-desktop/mate-panel/issues], +AC_INIT([mate-panel], [1.17.0], [https://github.com/mate-desktop/mate-panel/issues], [mate-panel], [http://www.mate-desktop.org]) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz tar-ustar -Wno-portability check-news]) @@ -56,7 +56,7 @@ if test "x$enable_deprecation_flags" = "xyes"; then AC_SUBST(DISABLE_DEPRECATED_CFLAGS) fi -LIBMATE_DESKTOP_REQUIRED=1.9.3 +LIBMATE_DESKTOP_REQUIRED=1.17.0 GDK_PIXBUF_REQUIRED=2.7.1 PANGO_REQUIRED=1.15.4 GLIB_REQUIRED=2.36 @@ -65,61 +65,34 @@ CAIRO_REQUIRED=1.0.0 DBUS_GLIB_REQUIRED=0.80 DCONF_REQUIRED=0.13.4 LIBRSVG_REQUIRED=2.36.2 +GTK_REQUIRED=3.14.0 +LIBWNCK_REQUIRED=3.0.0 WEATHER_REQUIRED=1.16.0 -# GTK library - -AC_MSG_CHECKING([which gtk+ version to compile against]) -AC_ARG_WITH([gtk], - [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])], - [case "$with_gtk" in - 2.0|3.0) ;; - *) AC_MSG_ERROR([invalid gtk version specified]) ;; - esac], - [with_gtk=2.0]) -AC_MSG_RESULT([$with_gtk]) - -case "$with_gtk" in - 2.0) GTK_API_VERSION=2.0 - GTK_REQUIRED=2.19.7 - LIBWNCK_API_VERSION=1.0 - LIBWNCK_REQUIRED=2.30.0 - LIBCANBERRA_API_VERSION= - ;; - 3.0) GTK_API_VERSION=3.0 - GTK_REQUIRED=3.0.0 - LIBCANBERRA_API_VERSION=3 - LIBWNCK_API_VERSION=3.0 - LIBWNCK_REQUIRED=3.0.0 - ;; -esac - -AC_SUBST(GTK_API_VERSION) - dnl pkg-config dependency checks -PKG_CHECK_MODULES(EGG_SMCLIENT, ice sm gtk+-$GTK_API_VERSION) +PKG_CHECK_MODULES(EGG_SMCLIENT, ice sm gtk+-3.0) PKG_CHECK_MODULES(GMODULE, gmodule-2.0,[GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""]) -PKG_CHECK_MODULES(PANEL, $GMODULE_ADD gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED gio-2.0 >= $GLIB_REQUIRED libmate-menu >= $LIBMATE_MENU_REQUIRED libcanberra-gtk$LIBCANBERRA_API_VERSION dbus-glib-1 >= $DBUS_GLIB_REQUIRED) +PKG_CHECK_MODULES(PANEL, $GMODULE_ADD gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED gio-2.0 >= $GLIB_REQUIRED libmate-menu >= $LIBMATE_MENU_REQUIRED libcanberra-gtk3 dbus-glib-1 >= $DBUS_GLIB_REQUIRED) AC_SUBST(PANEL_CFLAGS) AC_SUBST(PANEL_LIBS) PKG_CHECK_MODULES(DCONF, dconf >= $DCONF_REQUIRED) -PKG_CHECK_MODULES(LIBMATE_PANEL_APPLET, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED) +PKG_CHECK_MODULES(LIBMATE_PANEL_APPLET, gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED) AC_SUBST(LIBMATE_PANEL_APPLET_CFLAGS) AC_SUBST(LIBMATE_PANEL_APPLET_LIBS) -PKG_CHECK_MODULES(FISH, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED cairo >= $CAIRO_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) +PKG_CHECK_MODULES(FISH, gtk+-3.0 >= $GTK_REQUIRED cairo >= $CAIRO_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) AC_SUBST(FISH_CFLAGS) AC_SUBST(FISH_LIBS) -PKG_CHECK_MODULES(NOTIFICATION_AREA, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) +PKG_CHECK_MODULES(NOTIFICATION_AREA, gtk+-3.0 >= $GTK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) AC_SUBST(NOTIFICATION_AREA_CFLAGS) AC_SUBST(NOTIFICATION_AREA_LIBS) -PKG_CHECK_MODULES(WNCKLET, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED libwnck-$LIBWNCK_API_VERSION >= $LIBWNCK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) +PKG_CHECK_MODULES(WNCKLET, gtk+-3.0 >= $GTK_REQUIRED libwnck-3.0 >= $LIBWNCK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) AC_SUBST(WNCKLET_CFLAGS) AC_SUBST(WNCKLET_LIBS) @@ -130,7 +103,7 @@ PKG_CHECK_MODULES(TZ, gio-2.0 >= $GLIB_REQUIRED) AC_SUBST(TZ_CFLAGS) AC_SUBST(TZ_LIBS) -PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED librsvg-2.0 >= $LIBRSVG_REQUIRED dbus-glib-1 mateweather >= $WEATHER_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) +PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED librsvg-2.0 >= $LIBRSVG_REQUIRED dbus-glib-1 mateweather >= $WEATHER_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) AC_SUBST(CLOCK_CFLAGS) AC_SUBST(CLOCK_LIBS) @@ -353,7 +326,6 @@ echo " cflags: ${CFLAGS} Maintainer mode: ${USE_MAINTAINER_MODE} Use *_DISABLE_DEPRECATED: ${enable_deprecation_flags} - Gtk+ version: ${GTK_API_VERSION} Applets to build in-process: ${PANEL_INPROCESS_APPLETS} XRandr support: ${have_randr} Build introspection support: ${found_introspection} diff --git a/libmate-panel-applet/Makefile.am b/libmate-panel-applet/Makefile.am index 2d181c97..a89c8f92 100644 --- a/libmate-panel-applet/Makefile.am +++ b/libmate-panel-applet/Makefile.am @@ -119,7 +119,7 @@ built_introspection_sources = \ mate-panel-applet-enums.h MatePanelApplet-4.0.gir: libmate-panel-applet-4.la -MatePanelApplet_4_0_gir_INCLUDES = GObject-2.0 Gtk-$(GTK_API_VERSION) Gio-2.0 +MatePanelApplet_4_0_gir_INCLUDES = GObject-2.0 Gtk-3.0 Gio-2.0 MatePanelApplet_4_0_gir_CFLAGS = $(AM_CPPFLAGS) -I$(srcdir) MatePanelApplet_4_0_gir_LIBS = libmate-panel-applet-4.la MatePanelApplet_4_0_gir_FILES = $(addprefix $(srcdir)/,$(introspection_sources)) $(addprefix $(builddir)/,$(built_introspection_sources)) diff --git a/libmate-panel-applet/libmatepanelapplet-4.0-uninstalled.pc.in b/libmate-panel-applet/libmatepanelapplet-4.0-uninstalled.pc.in index 0cdeb5f4..4f1a966f 100644 --- a/libmate-panel-applet/libmatepanelapplet-4.0-uninstalled.pc.in +++ b/libmate-panel-applet/libmatepanelapplet-4.0-uninstalled.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: libmate-panel-applet-4 Description: libmate-panel-applet-4 -Requires: glib-2.0 gio-2.0 gtk+-@GTK_API_VERSION@ +Requires: glib-2.0 gio-2.0 gtk+-3.0 Version: @VERSION@ Libs: ${pc_top_builddir}/${pcfiledir}/libmate-panel-applet-4.la Cflags: -I${pc_top_builddir}/${pcfiledir} diff --git a/libmate-panel-applet/libmatepanelapplet-4.0.pc.in b/libmate-panel-applet/libmatepanelapplet-4.0.pc.in index c9147398..28f5f167 100644 --- a/libmate-panel-applet/libmatepanelapplet-4.0.pc.in +++ b/libmate-panel-applet/libmatepanelapplet-4.0.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: libmate-panel-applet-4 Description: libmate-panel-applet-4 -Requires: glib-2.0 gio-2.0 gtk+-@GTK_API_VERSION@ +Requires: glib-2.0 gio-2.0 gtk+-3.0 Version: @VERSION@ Libs: -L${libdir} -lmate-panel-applet-4 Cflags: -I${includedir}/mate-panel-4.0/libmate-panel-applet diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index a619c9e9..9ec18493 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -38,9 +38,7 @@ #include <gdk/gdkx.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gtk/gtkx.h> -#endif #include <X11/Xatom.h> #include "mate-panel-applet.h" @@ -123,9 +121,7 @@ static void mate_panel_applet_menu_cmd_move (GtkAction *acti static void mate_panel_applet_menu_cmd_lock (GtkAction *action, MatePanelApplet *applet); static void mate_panel_applet_register_object (MatePanelApplet *applet); -#if GTK_CHECK_VERSION (3, 0, 0) void _mate_panel_applet_apply_css (GtkWidget* widget, MatePanelAppletBackgroundType type); -#endif static const gchar panel_menu_ui[] = "<ui>\n" @@ -790,9 +786,7 @@ mate_panel_applet_position_menu (GtkMenu *menu, MatePanelApplet *applet; GtkAllocation allocation; GtkRequisition requisition; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDevice *device; -#endif GdkScreen *screen; int menu_x = 0; int menu_y = 0; @@ -803,28 +797,18 @@ mate_panel_applet_position_menu (GtkMenu *menu, applet = MATE_PANEL_APPLET (widget); -#if GTK_CHECK_VERSION (3, 0, 0) screen = gtk_widget_get_screen (widget); -#else - screen = gtk_window_get_screen (GTK_WINDOW (applet->priv->plug)); -#endif gtk_menu_set_screen (menu, screen); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL); -#else - gtk_widget_size_request (GTK_WIDGET (menu), &requisition); -#endif gdk_window_get_origin (gtk_widget_get_window (widget), &menu_x, &menu_y); #if GTK_CHECK_VERSION (3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (widget))); gdk_window_get_device_position (gtk_widget_get_window (widget), device, &pointer_x, &pointer_y, NULL); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (widget))); gdk_window_get_device_position (gtk_widget_get_window (widget), device, &pointer_x, &pointer_y, NULL); -#else - gtk_widget_get_pointer (widget, &pointer_x, &pointer_y); #endif gtk_widget_get_allocation (widget, &allocation); @@ -867,11 +851,7 @@ mate_panel_applet_position_menu (GtkMenu *menu, *x = menu_x; *y = menu_y; -#if GTK_CHECK_VERSION (3, 0, 0) *push_in = FALSE; -#else - *push_in = TRUE; -#endif } static void @@ -885,7 +865,6 @@ mate_panel_applet_menu_popup (MatePanelApplet *applet, "/MatePanelAppletPopup"); /* Set up theme and transparency support */ -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *toplevel = gtk_widget_get_toplevel (menu); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); @@ -896,7 +875,6 @@ mate_panel_applet_menu_popup (MatePanelApplet *applet, context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); -#endif gtk_menu_popup (GTK_MENU (menu), NULL, NULL, (GtkMenuPositionFunc) mate_panel_applet_position_menu, @@ -936,7 +914,6 @@ mate_panel_applet_button_event (GtkWidget *widget, socket_window = gtk_plug_get_socket_window (GTK_PLUG (widget)); if (event->type == GDK_BUTTON_PRESS) { -#if GTK_CHECK_VERSION (3, 0, 0) #if GTK_CHECK_VERSION (3, 20, 0) GdkDisplay *display; GdkSeat *seat; @@ -962,18 +939,6 @@ mate_panel_applet_button_event (GtkWidget *widget, */ gdk_device_ungrab (event->device, GDK_CURRENT_TIME); #endif -#else - xevent.xbutton.type = ButtonPress; - - /* X does an automatic pointer grab on button press - * if we have both button press and release events - * selected. - * We don't want to hog the pointer on our parent. - */ - gdk_display_pointer_ungrab - (gtk_widget_get_display (widget), - GDK_CURRENT_TIME); -#endif } else { xevent.xbutton.type = ButtonRelease; } @@ -1001,11 +966,7 @@ mate_panel_applet_button_event (GtkWidget *widget, False, NoEventMask, &xevent); gdk_flush (); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif return TRUE; } @@ -1049,7 +1010,6 @@ mate_panel_applet_popup_menu (GtkWidget *widget) return TRUE; } -#if GTK_CHECK_VERSION (3, 0, 0) #if !GTK_CHECK_VERSION (3, 18, 0) static void mate_panel_applet_get_preferred_width (GtkWidget *widget, @@ -1113,30 +1073,6 @@ mate_panel_applet_get_request_mode (GtkWidget *widget) return GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT; } -#else -static void -mate_panel_applet_size_request (GtkWidget *widget, GtkRequisition *requisition) -{ - int focus_width = 0; - - GTK_WIDGET_CLASS (mate_panel_applet_parent_class)->size_request (widget, - requisition); - - if (!mate_panel_applet_can_focus (widget)) - return; - - /* - * We are deliberately ignoring focus-padding here to - * save valuable panel real estate. - */ - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - NULL); - - requisition->width += 2 * focus_width; - requisition->height += 2 * focus_width; -} -#endif static void mate_panel_applet_size_allocate (GtkWidget *widget, @@ -1208,47 +1144,22 @@ mate_panel_applet_size_allocate (GtkWidget *widget, } } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean mate_panel_applet_draw(GtkWidget* widget, cairo_t* cr) -#else -static gboolean mate_panel_applet_expose(GtkWidget* widget, GdkEventExpose* event) -#endif { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; -#else - GtkAllocation allocation; -#endif int border_width; #if !GTK_CHECK_VERSION (3, 18, 0) int focus_width = 0; #endif -#if GTK_CHECK_VERSION (3, 0, 0) gdouble x, y, width, height; -#else - int x, y, width, height; -#endif - -#if !GTK_CHECK_VERSION (3, 0, 0) - g_return_val_if_fail (PANEL_IS_APPLET (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (mate_panel_applet_parent_class)->draw(widget, cr); -#else - GTK_WIDGET_CLASS (mate_panel_applet_parent_class)->expose_event(widget, event); -#endif if (!gtk_widget_has_focus (widget)) return FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); -#else - gtk_widget_get_allocation(widget, &allocation); -#endif #if !GTK_CHECK_VERSION (3, 18, 0) /* @@ -1262,7 +1173,6 @@ static gboolean mate_panel_applet_expose(GtkWidget* widget, GdkEventExpose* even border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); -#if GTK_CHECK_VERSION (3, 0, 0) x = 0; y = 0; @@ -1277,20 +1187,6 @@ static gboolean mate_panel_applet_expose(GtkWidget* widget, GdkEventExpose* even cairo_restore (cr); gtk_style_context_restore (context); -#else - x = allocation.x; - y = allocation.y; - - width = allocation.width - 2 * border_width; - height = allocation.height - 2 * border_width; - - gtk_paint_focus (gtk_widget_get_style (widget), - gtk_widget_get_window (widget), - gtk_widget_get_state (widget), - &event->area, - widget, "mate_panel_applet", - x, y, width, height); -#endif return FALSE; } @@ -1345,39 +1241,16 @@ mate_panel_applet_focus (GtkWidget *widget, static gboolean mate_panel_applet_parse_color (const gchar *color_str, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *color) -#else - GdkColor *color) -#endif { -#if !GTK_CHECK_VERSION (3, 0, 0) - int r, g, b; -#endif - g_assert (color_str && color); -#if GTK_CHECK_VERSION (3, 0, 0) return gdk_rgba_parse (color, color_str); -#else - if (sscanf (color_str, "%4x%4x%4x", &r, &g, &b) != 3) - return FALSE; - - color->red = r; - color->green = g; - color->blue = b; - - return TRUE; -#endif } static gboolean mate_panel_applet_parse_pixmap_str (const char *str, -#if GTK_CHECK_VERSION (3, 0, 0) Window *xid, -#else - GdkNativeWindow *xid, -#endif int *x, int *y) { @@ -1419,7 +1292,6 @@ ERROR_AND_FREE: return FALSE; } -#if GTK_CHECK_VERSION (3, 0, 0) static cairo_surface_t * mate_panel_applet_create_foreign_surface_for_display (GdkDisplay *display, GdkVisual *visual, @@ -1445,27 +1317,12 @@ mate_panel_applet_create_foreign_surface_for_display (GdkDisplay *display, static cairo_pattern_t * mate_panel_applet_get_pattern_from_pixmap (MatePanelApplet *applet, -#else -static GdkPixmap * -mate_panel_applet_get_pixmap (MatePanelApplet *applet, -#endif -#if GTK_CHECK_VERSION (3, 0, 0) Window xid, -#else - GdkNativeWindow xid, -#endif int x, int y) { -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_t *background; cairo_surface_t *surface; -#else - gboolean display_grabbed; - GdkPixmap *pixmap; - GdkDisplay *display; - GdkPixmap *retval; -#endif GdkWindow *window; int width; int height; @@ -1477,14 +1334,8 @@ mate_panel_applet_get_pixmap (MatePanelApplet *applet, if (!gtk_widget_get_realized (GTK_WIDGET (applet))) return NULL; -#if !GTK_CHECK_VERSION (3, 0, 0) - display = gdk_display_get_default (); - display_grabbed = FALSE; -#endif - window = gtk_widget_get_window (GTK_WIDGET (applet)); -#if GTK_CHECK_VERSION (3, 0, 0) background = mate_panel_applet_create_foreign_surface_for_display (gdk_window_get_display (window), gdk_window_get_visual (window), xid); @@ -1496,52 +1347,21 @@ mate_panel_applet_get_pixmap (MatePanelApplet *applet, cairo_surface_destroy (background); return NULL; } -#else - pixmap = gdk_pixmap_lookup_for_display (display, xid); - if (pixmap) - g_object_ref (pixmap); - else { - display_grabbed = TRUE; - gdk_x11_display_grab (display); - pixmap = gdk_pixmap_foreign_new_for_display (display, xid); - } - - /* This can happen if the user changes the background very fast. - * We'll get the next update, so it's not a big deal. */ - if (pixmap == NULL) { - if (display_grabbed) - gdk_x11_display_ungrab (display); - return NULL; - } -#endif width = gdk_window_get_width(window); height = gdk_window_get_height(window); -#if GTK_CHECK_VERSION(3, 0, 0) surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_push (); cr = cairo_create (surface); cairo_set_source_surface (cr, background, -x, -y); cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); gdk_error_trap_pop_ignored (); -#else - retval = gdk_pixmap_new (window, width, height, -1); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_destroy (background); pattern = NULL; -#else - /* the pixmap has no colormap, and we need one */ - gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), - gdk_drawable_get_colormap (window)); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) if (cairo_status (cr) == CAIRO_STATUS_SUCCESS) { pattern = cairo_pattern_create_for_surface (surface); } @@ -1550,35 +1370,12 @@ mate_panel_applet_get_pixmap (MatePanelApplet *applet, cairo_surface_destroy (surface); return pattern; -#else - cr = gdk_cairo_create (GDK_DRAWABLE (retval)); - gdk_cairo_set_source_pixmap (cr, pixmap, -x, -y); - pattern = cairo_get_source (cr); - cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); - - cairo_rectangle (cr, 0, 0, width, height); - cairo_fill (cr); - - cairo_destroy (cr); - - g_object_unref (pixmap); - - if (display_grabbed) - gdk_x11_display_ungrab (display); - - return retval; -#endif } static MatePanelAppletBackgroundType mate_panel_applet_handle_background_string (MatePanelApplet *applet, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *color, cairo_pattern_t **pattern) -#else - GdkColor *color, - GdkPixmap **pixmap) -#endif { MatePanelAppletBackgroundType retval; char **elements; @@ -1606,18 +1403,10 @@ mate_panel_applet_handle_background_string (MatePanelApplet *applet, retval = PANEL_COLOR_BACKGROUND; } else if (elements [0] && !strcmp (elements [0], "pixmap")) { -#if GTK_CHECK_VERSION (3, 0, 0) Window pixmap_id; -#else - GdkNativeWindow pixmap_id; -#endif int x, y; -#if GTK_CHECK_VERSION (3, 0, 0) g_return_val_if_fail (pattern != NULL, PANEL_NO_BACKGROUND); -#else - g_return_val_if_fail (pixmap != NULL, PANEL_NO_BACKGROUND); -#endif if (!mate_panel_applet_parse_pixmap_str (elements [1], &pixmap_id, &x, &y)) { g_warning ("Incomplete '%s' background type received: %s", @@ -1627,21 +1416,12 @@ mate_panel_applet_handle_background_string (MatePanelApplet *applet, return PANEL_NO_BACKGROUND; } -#if GTK_CHECK_VERSION (3, 0, 0) *pattern = mate_panel_applet_get_pattern_from_pixmap (applet, pixmap_id, x, y); if (!*pattern) { g_warning ("Failed to get pattern %s", elements [1]); g_strfreev (elements); return PANEL_NO_BACKGROUND; } -#else - *pixmap = mate_panel_applet_get_pixmap (applet, pixmap_id, x, y); - if (!*pixmap) { - g_warning ("Failed to get pixmap %s", elements [1]); - g_strfreev (elements); - return PANEL_NO_BACKGROUND; - } -#endif retval = PANEL_PIXMAP_BACKGROUND; } else @@ -1654,36 +1434,18 @@ mate_panel_applet_handle_background_string (MatePanelApplet *applet, MatePanelAppletBackgroundType mate_panel_applet_get_background (MatePanelApplet *applet, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *color, cairo_pattern_t **pattern) -#else - GdkColor *color, - GdkPixmap **pixmap) -#endif { g_return_val_if_fail (PANEL_IS_APPLET (applet), PANEL_NO_BACKGROUND); /* initial sanity */ -#if GTK_CHECK_VERSION (3, 0, 0) if (pattern != NULL) *pattern = NULL; -#else - if (pixmap != NULL) - *pixmap = NULL; -#endif if (color != NULL) -#if GTK_CHECK_VERSION (3, 0, 0) memset (color, 0, sizeof (GdkRGBA)); -#else - memset (color, 0, sizeof (GdkColor)); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) return mate_panel_applet_handle_background_string (applet, color, pattern); -#else - return mate_panel_applet_handle_background_string (applet, color, pixmap); -#endif } static void @@ -1704,44 +1466,6 @@ mate_panel_applet_set_background_string (MatePanelApplet *applet, g_object_notify (G_OBJECT (applet), "background"); } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -mate_panel_applet_update_background_for_widget (GtkWidget *widget, - MatePanelAppletBackgroundType type, - GdkColor *color, - GdkPixmap *pixmap) -{ - GtkRcStyle *rc_style; - GtkStyle *style; - - /* reset style */ - gtk_widget_set_style (widget, NULL); - rc_style = gtk_rc_style_new (); - gtk_widget_modify_style (widget, rc_style); - g_object_unref (rc_style); - - switch (type) { - case PANEL_NO_BACKGROUND: - break; - case PANEL_COLOR_BACKGROUND: - gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color); - break; - case PANEL_PIXMAP_BACKGROUND: - style = gtk_style_copy (gtk_widget_get_style (widget)); - 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 (widget, style); - g_object_unref (style); - break; - default: - g_assert_not_reached (); - break; - } -} -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) static void mate_panel_applet_handle_background (MatePanelApplet *applet) { @@ -1778,48 +1502,6 @@ mate_panel_applet_handle_background (MatePanelApplet *applet) break; } } -#else -static void -mate_panel_applet_handle_background (MatePanelApplet *applet) -{ - MatePanelAppletBackgroundType type; - - GdkColor color; - GdkPixmap *pixmap; - - type = mate_panel_applet_get_background (applet, &color, &pixmap); - - if (applet->priv->background_widget) - mate_panel_applet_update_background_for_widget (applet->priv->background_widget, - type, &color, pixmap); - - switch (type) { - case PANEL_NO_BACKGROUND: - g_signal_emit (G_OBJECT (applet), - mate_panel_applet_signals [CHANGE_BACKGROUND], - 0, PANEL_NO_BACKGROUND, NULL, NULL); - break; - case PANEL_COLOR_BACKGROUND: - g_signal_emit (G_OBJECT (applet), - mate_panel_applet_signals [CHANGE_BACKGROUND], - 0, PANEL_COLOR_BACKGROUND, &color, NULL); - break; - case PANEL_PIXMAP_BACKGROUND: - g_signal_emit (G_OBJECT (applet), - mate_panel_applet_signals [CHANGE_BACKGROUND], - - 0, PANEL_PIXMAP_BACKGROUND, NULL, pixmap); - - g_object_unref (pixmap); - - break; - default: - g_assert_not_reached (); - break; - } -} - -#endif static void mate_panel_applet_realize (GtkWidget *widget) @@ -1871,9 +1553,7 @@ mate_panel_applet_change_background(MatePanelApplet *applet, break; } } - -#elif GTK_CHECK_VERSION (3, 0, 0) - +#else static void mate_panel_applet_change_background(MatePanelApplet *applet, MatePanelAppletBackgroundType type, @@ -1898,7 +1578,6 @@ mate_panel_applet_change_background(MatePanelApplet *applet, break; } } - #endif static void @@ -2071,7 +1750,6 @@ mate_panel_applet_setup (MatePanelApplet *applet) } } -#if GTK_CHECK_VERSION (3, 0, 0) void _mate_panel_applet_apply_css(GtkWidget* widget, MatePanelAppletBackgroundType type) { GtkStyleContext* context; @@ -2108,7 +1786,6 @@ static void _mate_panel_applet_prepare_css (GtkStyleContext *context) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); } -#endif static void mate_panel_applet_init (MatePanelApplet *applet) @@ -2140,7 +1817,6 @@ mate_panel_applet_init (MatePanelApplet *applet) applet->priv->plug = gtk_plug_new (0); -#if GTK_CHECK_VERSION (3, 0, 0) GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(applet->priv->plug)); GdkVisual *visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(applet->priv->plug), visual); @@ -2150,7 +1826,7 @@ mate_panel_applet_init (MatePanelApplet *applet) gtk_style_context_add_class(context,"mate-panel-menu-bar"); gtk_widget_set_name(GTK_WIDGET(applet->priv->plug), "PanelPlug"); _mate_panel_applet_prepare_css(context); -#endif + g_signal_connect_swapped (G_OBJECT (applet->priv->plug), "embedded", G_CALLBACK (mate_panel_applet_setup), applet); @@ -2186,22 +1862,15 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass) gobject_class->set_property = mate_panel_applet_set_property; gobject_class->constructed = mate_panel_applet_constructed; klass->move_focus_out_of_applet = mate_panel_applet_move_focus_out_of_applet; -#if GTK_CHECK_VERSION (3, 0, 0) klass->change_background = mate_panel_applet_change_background; -#endif widget_class->button_press_event = mate_panel_applet_button_press; widget_class->button_release_event = mate_panel_applet_button_release; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_request_mode = mate_panel_applet_get_request_mode; #if !GTK_CHECK_VERSION (3, 18, 0) widget_class->get_preferred_width = mate_panel_applet_get_preferred_width; widget_class->get_preferred_height = mate_panel_applet_get_preferred_height; #endif widget_class->draw = mate_panel_applet_draw; -#else - widget_class->size_request = mate_panel_applet_size_request; - widget_class->expose_event = mate_panel_applet_expose; -#endif widget_class->size_allocate = mate_panel_applet_size_allocate; widget_class->focus = mate_panel_applet_focus; widget_class->realize = mate_panel_applet_realize; @@ -2330,13 +1999,8 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass) G_TYPE_NONE, 3, PANEL_TYPE_MATE_PANEL_APPLET_BACKGROUND_TYPE, -#if GTK_CHECK_VERSION (3, 0, 0) GDK_TYPE_RGBA, CAIRO_GOBJECT_TYPE_PATTERN); -#else - GDK_TYPE_COLOR, - GDK_TYPE_PIXMAP); -#endif mate_panel_applet_signals [MOVE_FOCUS_OUT_OF_APPLET] = g_signal_new ("move_focus_out_of_applet", @@ -2640,16 +2304,13 @@ int mate_panel_applet_factory_main(const gchar* factory_id, gboolean out_process * Deprecated: 3.20: Do not use this API. Since 3.20 this function does nothing. **/ - #if GTK_CHECK_VERSION (3, 18, 0) - void mate_panel_applet_set_background_widget (MatePanelApplet *applet, GtkWidget *widget) { } - -#elif GTK_CHECK_VERSION (3, 0, 0) +#else void mate_panel_applet_set_background_widget (MatePanelApplet *applet, GtkWidget *widget) @@ -2667,30 +2328,6 @@ mate_panel_applet_set_background_widget (MatePanelApplet *applet, cairo_pattern_destroy (pattern); } } - -#else -void -mate_panel_applet_set_background_widget (MatePanelApplet *applet, - GtkWidget *widget) -{ - applet->priv->background_widget = widget; - - - if (widget) { - - MatePanelAppletBackgroundType type; - - GdkColor color; - GdkPixmap *pixmap; - type = mate_panel_applet_get_background (applet, &color, &pixmap); - mate_panel_applet_update_background_for_widget (widget, type, - &color, pixmap); - if (type == PANEL_PIXMAP_BACKGROUND) - g_object_unref (pixmap); - - } -} - #endif guint32 diff --git a/libmate-panel-applet/mate-panel-applet.h b/libmate-panel-applet/mate-panel-applet.h index 1eb84a14..1d6f15ee 100644 --- a/libmate-panel-applet/mate-panel-applet.h +++ b/libmate-panel-applet/mate-panel-applet.h @@ -27,11 +27,9 @@ #include <glib.h> #include <gtk/gtk.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gdk/gdk.h> #include <cairo.h> #include <cairo-gobject.h> -#endif #ifdef __cplusplus extern "C" { @@ -86,11 +84,8 @@ struct _MatePanelAppletClass { void (*change_size) (MatePanelApplet* applet, guint size); -#if GTK_CHECK_VERSION (3, 0, 0) void (*change_background) (MatePanelApplet *applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t *pattern); -#else - void (*change_background) (MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap); -#endif + void (*move_focus_out_of_applet) (MatePanelApplet* frame, GtkDirectionType direction); }; @@ -100,11 +95,7 @@ GtkWidget* mate_panel_applet_new(void); MatePanelAppletOrient mate_panel_applet_get_orient(MatePanelApplet* applet); guint mate_panel_applet_get_size(MatePanelApplet* applet); -#if GTK_CHECK_VERSION (3, 0, 0) MatePanelAppletBackgroundType mate_panel_applet_get_background (MatePanelApplet *applet, /* return values */ GdkRGBA* color, cairo_pattern_t** pattern); -#else -MatePanelAppletBackgroundType mate_panel_applet_get_background(MatePanelApplet* applet, /* return values */ GdkColor* color, GdkPixmap** pixmap); -#endif void mate_panel_applet_set_background_widget(MatePanelApplet* applet, GtkWidget* widget); gchar* mate_panel_applet_get_preferences_path(MatePanelApplet* applet); diff --git a/libmate-panel-applet/panel-plug-private.h b/libmate-panel-applet/panel-plug-private.h index 4a69184e..030540fd 100644 --- a/libmate-panel-applet/panel-plug-private.h +++ b/libmate-panel-applet/panel-plug-private.h @@ -19,8 +19,8 @@ #define PANEL_PLUG_PRIVATE_H #include <gtk/gtk.h> -#if GTK_CHECK_VERSION (3, 18, 0) +#if GTK_CHECK_VERSION (3, 18, 0) #include <gtk/gtkx.h> G_BEGIN_DECLS diff --git a/libmate-panel-applet/panel-plug.c b/libmate-panel-applet/panel-plug.c index 781271aa..d10fdb18 100644 --- a/libmate-panel-applet/panel-plug.c +++ b/libmate-panel-applet/panel-plug.c @@ -16,9 +16,9 @@ */ #include <gtk/gtk.h> + #if GTK_CHECK_VERSION (3, 18, 0) #include "config.h" - #include "panel-plug-private.h" struct _PanelPlug diff --git a/libmate-panel-applet/test-dbus-applet.c b/libmate-panel-applet/test-dbus-applet.c index f2033057..bfd00e5e 100644 --- a/libmate-panel-applet/test-dbus-applet.c +++ b/libmate-panel-applet/test-dbus-applet.c @@ -113,11 +113,7 @@ static void test_applet_handle_background_change (TestApplet *applet, MatePanelAppletBackgroundType type, GdkColor *color, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_pattern_t *pattern, -#else - GdkPixmap *pixmap, -#endif gpointer dummy) { GdkWindow *window = gtk_widget_get_window (applet->label); @@ -125,29 +121,16 @@ test_applet_handle_background_change (TestApplet *applet, switch (type) { case PANEL_NO_BACKGROUND: g_message ("Setting background to default"); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background_pattern (window, NULL); -#else - gdk_window_set_back_pixmap (window, NULL, FALSE); -#endif break; case PANEL_COLOR_BACKGROUND: g_message ("Setting background to #%2x%2x%2x", color->red, color->green, color->blue); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background_pattern (window, NULL); -#else - gdk_window_set_back_pixmap (window, NULL, FALSE); -#endif break; case PANEL_PIXMAP_BACKGROUND: -#if GTK_CHECK_VERSION (3, 0, 0) g_message ("Setting background to '%p'", pattern); gdk_window_set_background_pattern (window, pattern); -#else - g_message ("Setting background to '%p'", pixmap); - gdk_window_set_back_pixmap (window, pixmap, FALSE); -#endif break; default: g_assert_not_reached (); diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am index 61240e1b..ec94421f 100644 --- a/mate-panel/Makefile.am +++ b/mate-panel/Makefile.am @@ -224,7 +224,6 @@ BUILT_SOURCES = \ uidir = $(datadir)/mate-panel/ui ui_DATA = \ - panel-properties-dialog.ui \ panel-properties-dialog-gtk3.ui \ panel-run-dialog.ui \ panel-test-applets.ui diff --git a/mate-panel/applet.c b/mate-panel/applet.c index c8b1c95b..51f64086 100644 --- a/mate-panel/applet.c +++ b/mate-panel/applet.c @@ -565,7 +565,6 @@ mate_panel_applet_create_menu (AppletInfo *info) } /* Set up theme and transparency support */ -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *toplevel = gtk_widget_get_toplevel (menu); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); @@ -576,7 +575,7 @@ mate_panel_applet_create_menu (AppletInfo *info) context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); -#endif + return menu; } @@ -612,9 +611,7 @@ mate_panel_applet_position_menu (GtkMenu *menu, { GtkAllocation allocation; GtkRequisition requisition; -#if GTK_CHECK_VERSION(3, 0, 0) GdkDevice *device; -#endif GdkScreen *screen; GtkWidget *parent; int menu_x = 0; @@ -628,21 +625,15 @@ mate_panel_applet_position_menu (GtkMenu *menu, screen = gtk_widget_get_screen (applet); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL); -#else - gtk_widget_size_request (GTK_WIDGET (menu), &requisition); -#endif gdk_window_get_origin (gtk_widget_get_window (applet), &menu_x, &menu_y); #if GTK_CHECK_VERSION(3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (applet))); gdk_window_get_device_position (gtk_widget_get_window (applet), device, &pointer_x, &pointer_y, NULL); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (applet))); gdk_window_get_device_position (gtk_widget_get_window (applet), device, &pointer_x, &pointer_y, NULL); -#else - gtk_widget_get_pointer (applet, &pointer_x, &pointer_y); #endif gtk_widget_get_allocation (applet, &allocation); @@ -685,11 +676,7 @@ mate_panel_applet_position_menu (GtkMenu *menu, *x = menu_x; *y = menu_y; -#if GTK_CHECK_VERSION (3, 0, 0) *push_in = FALSE; -#else - *push_in = TRUE; -#endif } static void diff --git a/mate-panel/button-widget.c b/mate-panel/button-widget.c index a04fac6a..d65e22fd 100644 --- a/mate-panel/button-widget.c +++ b/mate-panel/button-widget.c @@ -115,62 +115,17 @@ make_hc_pixbuf (GdkPixbuf *pb) static void button_widget_realize(GtkWidget *widget) { -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkAllocation allocation; - GdkWindowAttr attributes; - gint attributes_mask; - GtkButton *button; - - g_return_if_fail (widget != NULL); - g_return_if_fail (BUTTON_IS_WIDGET (widget)); - - button = GTK_BUTTON (widget); - - gtk_widget_set_realized (widget, TRUE); - - gtk_widget_get_allocation (widget, &allocation); - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = allocation.x; - attributes.y = allocation.y; - attributes.width = allocation.width; - attributes.height = allocation.height; - attributes.wclass = GDK_INPUT_ONLY; - attributes.event_mask = (GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_KEY_PRESS_MASK | - GDK_ENTER_NOTIFY_MASK | - GDK_LEAVE_NOTIFY_MASK); - attributes_mask = GDK_WA_X | GDK_WA_Y; - - gtk_widget_set_window (widget, gtk_widget_get_parent_window (widget)); - g_object_ref (gtk_widget_get_window (widget)); - - button->event_window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, - attributes_mask); - gdk_window_set_user_data (button->event_window, widget); - - widget->style = gtk_style_attach (widget->style, gtk_widget_get_window (widget)); -#else gtk_widget_add_events (widget, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_KEY_PRESS_MASK); GTK_WIDGET_CLASS (button_widget_parent_class)->realize (widget); -#endif BUTTON_WIDGET (widget)->priv->icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget)); g_signal_connect_object (BUTTON_WIDGET (widget)->priv->icon_theme, "changed", G_CALLBACK (button_widget_icon_theme_changed), -#if GTK_CHECK_VERSION (3, 0, 0) widget, -#else - button, -#endif G_CONNECT_SWAPPED); button_widget_reload_pixbuf (BUTTON_WIDGET (widget)); @@ -179,24 +134,9 @@ button_widget_realize(GtkWidget *widget) static void button_widget_unrealize (GtkWidget *widget) { -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_handlers_disconnect_by_func (BUTTON_WIDGET (widget)->priv->icon_theme, G_CALLBACK (button_widget_icon_theme_changed), widget); -#else - GtkButton *button; - - g_return_if_fail (widget != NULL); - g_return_if_fail (BUTTON_IS_WIDGET (widget)); - - button = GTK_BUTTON (widget); - - if (button->event_window != NULL) { - gdk_window_set_user_data (button->event_window, NULL); - gdk_window_destroy (button->event_window); - button->event_window = NULL; - } -#endif GTK_WIDGET_CLASS (button_widget_parent_class)->unrealize (widget); } @@ -243,17 +183,6 @@ button_widget_reload_pixbuf (ButtonWidget *button) g_free (error); } -#if !GTK_CHECK_VERSION (3, 0, 0) - /* We need to add a child to the button to get the right allocation of the pixbuf. - * When the button is created without a pixbuf, get_preferred_width/height are - * called the first time when the widget is allocated and 0x0 size is cached by - * gtksizerequest. Since the widget doesn't change its size when a pixbuf is set, - * gtk_widget_queue_resize() always uses the cached values instead of calling - * get_preferred_width_height() again. So the actual size, based on pixbuf size, - * is never used. We are overriding the draw() method, so having a child doesn't - * affect the widget rendering anyway. - */ -#endif gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_pixbuf (button->priv->pixbuf)); } @@ -362,58 +291,40 @@ calc_arrow (PanelOrientation orientation, int button_height, int *x, int *y, -#if GTK_CHECK_VERSION (3, 0, 0) gdouble *angle, gdouble *size) -#else - int *width, - int *height) -#endif { GtkArrowType retval = GTK_ARROW_UP; double scale; scale = (orientation & PANEL_HORIZONTAL_MASK ? button_height : button_width) / 48.0; -#if GTK_CHECK_VERSION (3, 0, 0) *size = 12 * scale; *angle = 0; -#else - *width = 12 * scale; - *height = 12 * scale; -#endif switch (orientation) { case PANEL_ORIENTATION_TOP: *x = scale * 3; *y = scale * (48 - 13); -#if GTK_CHECK_VERSION (3, 0, 0) *angle = G_PI; -#endif retval = GTK_ARROW_DOWN; break; case PANEL_ORIENTATION_BOTTOM: *x = scale * (48 - 13); *y = scale * 1; -#if GTK_CHECK_VERSION (3, 0, 0) *angle = 0; -#endif retval = GTK_ARROW_UP; break; case PANEL_ORIENTATION_LEFT: *x = scale * (48 - 13); *y = scale * 3; -#if GTK_CHECK_VERSION (3, 0, 0) *angle = G_PI / 2; -#endif retval = GTK_ARROW_RIGHT; break; case PANEL_ORIENTATION_RIGHT: *x = scale * 1; *y = scale * 3; -#if GTK_CHECK_VERSION (3, 0, 0) *angle = 3 * (G_PI / 2); -#endif retval = GTK_ARROW_LEFT; break; } @@ -422,63 +333,33 @@ calc_arrow (PanelOrientation orientation, } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) button_widget_draw (GtkWidget *widget, cairo_t *cr) -#else -button_widget_expose (GtkWidget *widget, - GdkEventExpose *event) -#endif { ButtonWidget *button_widget; int width; int height; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkStateFlags state_flags; -#else - GtkButton *button; - GdkWindow *window; - GtkAllocation allocation; - GtkStyle *style; - GdkRectangle area, image_bound; -#endif int off; int x, y, w, h; GdkPixbuf *pb = NULL; g_return_val_if_fail (BUTTON_IS_WIDGET (widget), FALSE); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_return_val_if_fail (event != NULL, FALSE); - - if (!gtk_widget_get_visible (widget) || !gtk_widget_get_mapped (widget)) - return FALSE; -#endif button_widget = BUTTON_WIDGET (widget); if (!button_widget->priv->pixbuf_hc && !button_widget->priv->pixbuf) return FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) state_flags = gtk_widget_get_state_flags (widget); width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); -#else - gtk_widget_get_allocation (widget, &allocation); - button = GTK_BUTTON (widget); - window = gtk_widget_get_window (widget); -#endif /* offset for pressed buttons */ off = (button_widget->priv->activatable && -#if GTK_CHECK_VERSION (3, 0, 0) (state_flags & GTK_STATE_FLAG_PRELIGHT) && (state_flags & GTK_STATE_FLAG_ACTIVE)) ? BUTTON_WIDGET_DISPLACEMENT * height / 48.0 : 0; -#else - button->in_button && button->button_down) ? - BUTTON_WIDGET_DISPLACEMENT * allocation.height / 48.0 : 0; -#endif if (!button_widget->priv->activatable) { pb = gdk_pixbuf_copy (button_widget->priv->pixbuf); @@ -487,11 +368,7 @@ button_widget_expose (GtkWidget *widget, 0.8, TRUE); } else if (panel_global_config_get_highlight_when_over () && -#if GTK_CHECK_VERSION (3, 0, 0) (state_flags & GTK_STATE_FLAG_PRELIGHT || gtk_widget_has_focus (widget))) -#else - (button->in_button || gtk_widget_has_focus (widget))) -#endif pb = g_object_ref (button_widget->priv->pixbuf_hc); else pb = g_object_ref (button_widget->priv->pixbuf); @@ -500,40 +377,16 @@ button_widget_expose (GtkWidget *widget, w = gdk_pixbuf_get_width (pb); h = gdk_pixbuf_get_height (pb); -#if GTK_CHECK_VERSION (3, 0, 0) x = off + (width - w)/2; y = off + (height - h)/2; -#else - x = allocation.x + off + (allocation.width - w)/2; - y = allocation.y + off + (allocation.height - h)/2; - - image_bound.x = x; - image_bound.y = y; - image_bound.width = w; - image_bound.height = h; - - area = event->area; -#endif -#if GTK_CHECK_VERSION (3, 0, 0) cairo_save (cr); gdk_cairo_set_source_pixbuf (cr, pb, x, y); cairo_paint (cr); cairo_restore (cr); -#else - if (gdk_rectangle_intersect (&area, &allocation, &area) && - gdk_rectangle_intersect (&image_bound, &area, &image_bound)) - gdk_draw_pixbuf (window, NULL, pb, - image_bound.x - x, image_bound.y - y, - image_bound.x, image_bound.y, - image_bound.width, image_bound.height, - GDK_RGB_DITHER_NORMAL, - 0, 0); -#endif g_object_unref (pb); -#if GTK_CHECK_VERSION (3, 0, 0) context = gtk_widget_get_style_context (widget); if (button_widget->priv->arrow) { @@ -591,66 +444,10 @@ button_widget_expose (GtkWidget *widget, gtk_style_context_restore (context); } -#else - style = gtk_widget_get_style (widget); - - if (button_widget->priv->arrow) { - GtkArrowType arrow_type; - - arrow_type = calc_arrow (button_widget->priv->orientation, - allocation.width, - allocation.height, - &x, - &y, - &width, - &height); - - gtk_paint_arrow (style, - window, - GTK_STATE_NORMAL, - GTK_SHADOW_NONE, - NULL, - widget, - "panel-button", - arrow_type, - TRUE, - allocation.x + x, - allocation.y + y, - width, - height); - } - - if (button_widget->priv->dnd_highlight) { - gdk_draw_rectangle(window, style->black_gc, FALSE, - allocation.x, allocation.y, - allocation.width - 1, - allocation.height - 1); - } - - if (gtk_widget_has_focus (widget)) { - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-padding", &focus_pad, - NULL); - - x = allocation.x + focus_pad; - y = allocation.y + focus_pad; - width = allocation.width - 2 * focus_pad; - height = allocation.height - 2 * focus_pad; - - gtk_paint_focus (style, - window, - GTK_STATE_NORMAL, - &event->area, widget, "button", - x, y, width, height); - } -#endif return FALSE; } -#if GTK_CHECK_VERSION (3, 0, 0) static void button_widget_get_preferred_width (GtkWidget *widget, gint *minimal_width, @@ -688,19 +485,6 @@ button_widget_get_preferred_height (GtkWidget *widget, *minimal_height = *natural_height = size; } -#else -static void -button_widget_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - ButtonWidget *button_widget = BUTTON_WIDGET (widget); - - if (button_widget->priv->pixbuf) { - requisition->width = gdk_pixbuf_get_width (button_widget->priv->pixbuf); - requisition->height = gdk_pixbuf_get_height (button_widget->priv->pixbuf); - } -} -#endif static void button_widget_size_allocate (GtkWidget *widget, @@ -709,9 +493,7 @@ button_widget_size_allocate (GtkWidget *widget, ButtonWidget *button_widget = BUTTON_WIDGET (widget); int size; -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (button_widget_parent_class)->size_allocate (widget, allocation); -#endif if (button_widget->priv->orientation & PANEL_HORIZONTAL_MASK) size = allocation->height; @@ -734,19 +516,6 @@ button_widget_size_allocate (GtkWidget *widget, button_widget_reload_pixbuf (button_widget); } - -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_allocation (widget, allocation); - GtkButton *button = GTK_BUTTON (widget); - - if (gtk_widget_get_realized (widget)) { - gdk_window_move_resize (button->event_window, - allocation->x, - allocation->y, - allocation->width, - allocation->height); - } -#endif } static void @@ -783,21 +552,13 @@ button_widget_enter_notify (GtkWidget *widget, GdkEventCrossing *event) g_return_val_if_fail (BUTTON_IS_WIDGET (widget), FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) GtkStateFlags state_flags = gtk_widget_get_state_flags (widget); in_button = state_flags & GTK_STATE_FLAG_PRELIGHT; -#else - in_button = GTK_BUTTON (widget)->in_button; -#endif GTK_WIDGET_CLASS (button_widget_parent_class)->enter_notify_event (widget, event); -#if GTK_CHECK_VERSION (3, 0, 0) state_flags = gtk_widget_get_state_flags (widget); if (in_button != (state_flags & GTK_STATE_FLAG_PRELIGHT) && -#else - if (in_button != GTK_BUTTON (widget)->in_button && -#endif panel_global_config_get_highlight_when_over ()) gtk_widget_queue_draw (widget); @@ -811,21 +572,13 @@ button_widget_leave_notify (GtkWidget *widget, GdkEventCrossing *event) g_return_val_if_fail (BUTTON_IS_WIDGET (widget), FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) GtkStateFlags state_flags = gtk_widget_get_state_flags (widget); in_button = state_flags & GTK_STATE_FLAG_PRELIGHT; -#else - in_button = GTK_BUTTON (widget)->in_button; -#endif GTK_WIDGET_CLASS (button_widget_parent_class)->leave_notify_event (widget, event); -#if GTK_CHECK_VERSION (3, 0, 0) state_flags = gtk_widget_get_state_flags (widget); if (in_button != (state_flags & GTK_STATE_FLAG_PRELIGHT) && -#else - if (in_button != GTK_BUTTON (widget)->in_button && -#endif panel_global_config_get_highlight_when_over ()) gtk_widget_queue_draw (widget); @@ -869,14 +622,9 @@ button_widget_class_init (ButtonWidgetClass *klass) widget_class->realize = button_widget_realize; widget_class->unrealize = button_widget_unrealize; widget_class->size_allocate = button_widget_size_allocate; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = button_widget_get_preferred_width; widget_class->get_preferred_height = button_widget_get_preferred_height; widget_class->draw = button_widget_draw; -#else - widget_class->size_request = button_widget_size_request; - widget_class->expose_event = button_widget_expose; -#endif widget_class->button_press_event = button_widget_button_press; widget_class->enter_notify_event = button_widget_enter_notify; widget_class->leave_notify_event = button_widget_leave_notify; diff --git a/mate-panel/libegg/eggsmclient-private.h b/mate-panel/libegg/eggsmclient-private.h index c97b5f2f..f7f0e83f 100644 --- a/mate-panel/libegg/eggsmclient-private.h +++ b/mate-panel/libegg/eggsmclient-private.h @@ -21,9 +21,6 @@ #define __EGG_SM_CLIENT_PRIVATE_H__ #include <gtk/gtk.h> -#if !GTK_CHECK_VERSION (3, 0, 0) -#include <gdkconfig.h> -#endif #include "eggsmclient.h" #ifdef __cplusplus diff --git a/mate-panel/libegg/eggsmclient-xsmp.c b/mate-panel/libegg/eggsmclient-xsmp.c index 726c13da..2b707a76 100644 --- a/mate-panel/libegg/eggsmclient-xsmp.c +++ b/mate-panel/libegg/eggsmclient-xsmp.c @@ -368,13 +368,7 @@ sm_client_xsmp_startup (EggSMClient *client, xsmp->client_id = g_strdup (ret_client_id); free (ret_client_id); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif gdk_x11_set_sm_client_id (xsmp->client_id); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif g_debug ("Got client ID \"%s\"", xsmp->client_id); } @@ -542,10 +536,6 @@ idle_do_pending_events (gpointer data) EggSMClientXSMP *xsmp = data; EggSMClient *client = data; -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif - xsmp->idle = 0; if (xsmp->waiting_to_emit_quit) @@ -569,9 +559,6 @@ idle_do_pending_events (gpointer data) } out: -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif return FALSE; } @@ -1293,13 +1280,7 @@ process_ice_messages (IceConn ice_conn) { IceProcessMessagesStatus status; -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif status = IceProcessMessages (ice_conn, NULL, NULL); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif switch (status) { diff --git a/mate-panel/libmate-panel-applet-private/panel-applet-container.c b/mate-panel/libmate-panel-applet-private/panel-applet-container.c index 7aa34d6a..95fca64b 100644 --- a/mate-panel/libmate-panel-applet-private/panel-applet-container.c +++ b/mate-panel/libmate-panel-applet-private/panel-applet-container.c @@ -22,9 +22,7 @@ #include <string.h> #include <gtk/gtk.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gtk/gtkx.h> -#endif #include "panel-applet-container.h" #include "panel-marshal.h" diff --git a/mate-panel/libpanel-util/panel-color.c b/mate-panel/libpanel-util/panel-color.c index 9ac198a8..864d68d8 100644 --- a/mate-panel/libpanel-util/panel-color.c +++ b/mate-panel/libpanel-util/panel-color.c @@ -1,6 +1,5 @@ #include "panel-color.h" -#if GTK_CHECK_VERSION (3, 0, 0) /** * rgb_to_hls: * @r: on input, red; on output, hue @@ -197,7 +196,3 @@ gtk_style_shade (GdkRGBA *a, GdkRGBA *b, gdouble k) b->green = green; b->blue = blue; } -#else - -#endif - diff --git a/mate-panel/libpanel-util/panel-color.h b/mate-panel/libpanel-util/panel-color.h index 753c28ff..327235db 100644 --- a/mate-panel/libpanel-util/panel-color.h +++ b/mate-panel/libpanel-util/panel-color.h @@ -1,13 +1,11 @@ #ifndef PANEL_COLOR_H #define PANEL_COLOR_H -#include <gtk/gtk.h> +#include <gdk/gdk.h> G_BEGIN_DECLS -#if GTK_CHECK_VERSION (3, 0, 0) void gtk_style_shade (GdkRGBA *a, GdkRGBA *b, gdouble k); -#endif G_END_DECLS diff --git a/mate-panel/libpanel-util/panel-icon-chooser.c b/mate-panel/libpanel-util/panel-icon-chooser.c index 91cbdc59..98dcef8e 100644 --- a/mate-panel/libpanel-util/panel-icon-chooser.c +++ b/mate-panel/libpanel-util/panel-icon-chooser.c @@ -421,11 +421,7 @@ _panel_icon_chooser_clicked (GtkButton *button) if (info) { path = g_strdup (gtk_icon_info_get_filename (info)); -#if GTK_CHECK_VERSION (3, 8, 0) g_object_unref (info); -#else - gtk_icon_info_free (info); -#endif } } diff --git a/mate-panel/libpanel-util/panel-launch.c b/mate-panel/libpanel-util/panel-launch.c index 66502b6d..59ca900a 100644 --- a/mate-panel/libpanel-util/panel-launch.c +++ b/mate-panel/libpanel-util/panel-launch.c @@ -109,12 +109,8 @@ panel_app_info_launch_uris (GAppInfo *appinfo, g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); -#if GTK_CHECK_VERSION(3, 0, 0) GdkDisplay *display = gdk_display_get_default (); context = gdk_display_get_app_launch_context (display); -#else - context = gdk_app_launch_context_new (); -#endif gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, timestamp); diff --git a/mate-panel/libpanel-util/panel-show.h b/mate-panel/libpanel-util/panel-show.h index 60969c06..ec3e9baa 100644 --- a/mate-panel/libpanel-util/panel-show.h +++ b/mate-panel/libpanel-util/panel-show.h @@ -25,7 +25,7 @@ #ifndef PANEL_SHOW_H #define PANEL_SHOW_H -#include <gtk/gtk.h> +#include <gdk/gdk.h> #ifdef __cplusplus extern "C" { diff --git a/mate-panel/libpanel-util/panel-xdg.c b/mate-panel/libpanel-util/panel-xdg.c index 501a783c..bcdbb5fa 100644 --- a/mate-panel/libpanel-util/panel-xdg.c +++ b/mate-panel/libpanel-util/panel-xdg.c @@ -26,6 +26,7 @@ #include <glib.h> #include <gio/gio.h> +#include <gtk/gtk.h> #include "panel-xdg.h" diff --git a/mate-panel/libpanel-util/panel-xdg.h b/mate-panel/libpanel-util/panel-xdg.h index 91aa2185..359c91b2 100644 --- a/mate-panel/libpanel-util/panel-xdg.h +++ b/mate-panel/libpanel-util/panel-xdg.h @@ -25,7 +25,7 @@ #ifndef PANEL_XDG_H #define PANEL_XDG_H -#include <gtk/gtk.h> +#include <gdk/gdk.h> #ifdef __cplusplus extern "C" { diff --git a/mate-panel/menu.c b/mate-panel/menu.c index 053c077b..fd2cccbd 100644 --- a/mate-panel/menu.c +++ b/mate-panel/menu.c @@ -31,7 +31,7 @@ #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> #include <libmate-desktop/mate-gsettings.h> - +#include <matemenu-tree.h> #include <libpanel-util/panel-keyfile.h> #include <libpanel-util/panel-xdg.h> @@ -445,16 +445,12 @@ restore_grabs(GtkWidget *w, gpointer data) if (viewable) xgrab_shell = parent; -#if GTK_CHECK_VERSION (3, 0, 0) parent = gtk_menu_shell_get_parent_shell (GTK_MENU_SHELL (parent)); -#else - parent = GTK_MENU_SHELL (parent)->parent_menu_shell; -#endif } /*only grab if this HAD a grab before*/ /* FIXME fix for GTK3 */ -#if !GTK_CHECK_VERSION (3, 0, 0) +#if 0 if (xgrab_shell && (GTK_MENU_SHELL (xgrab_shell)->have_xgrab)) { GdkWindow *window = gtk_widget_get_window (xgrab_shell); @@ -667,20 +663,11 @@ drag_end_menu_cb (GtkWidget *widget, GdkDragContext *context) if (viewable) xgrab_shell = parent; -#if GTK_CHECK_VERSION (3, 0, 0) parent = gtk_menu_shell_get_parent_shell (GTK_MENU_SHELL (parent)); -#else - parent = GTK_MENU_SHELL (parent)->parent_menu_shell; -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) if (xgrab_shell) -#else - if (xgrab_shell && !gtk_menu_get_tearoff_state (GTK_MENU(xgrab_shell))) -#endif { -#if GTK_CHECK_VERSION (3, 0, 0) gboolean status; GdkDisplay *display; GdkDevice *pointer; @@ -690,12 +677,10 @@ drag_end_menu_cb (GtkWidget *widget, GdkDragContext *context) #else GdkDeviceManager *device_manager; #endif -#endif GdkWindow *window = gtk_widget_get_window (xgrab_shell); GdkCursor *cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_ARROW); -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_window_get_display (window); #if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); @@ -725,37 +710,18 @@ drag_end_menu_cb (GtkWidget *widget, GdkDragContext *context) GDK_KEY_PRESS | GDK_KEY_RELEASE, NULL, GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS) { -#else - if ((gdk_pointer_grab (window, TRUE, - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | - GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | - GDK_POINTER_MOTION_MASK, - NULL, cursor, GDK_CURRENT_TIME) == 0)) - { - if (gdk_keyboard_grab (window, TRUE, - GDK_CURRENT_TIME) == 0) - { -#endif /* FIXME fix for GTK3 */ -#if !GTK_CHECK_VERSION (3, 0, 0) +#if 0 GTK_MENU_SHELL (xgrab_shell)->have_xgrab = TRUE; #endif } else { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_device_ungrab (pointer, GDK_CURRENT_TIME); } } g_object_unref (cursor); -#else - gdk_pointer_ungrab (GDK_CURRENT_TIME); - } - } - - gdk_cursor_unref (cursor); -#endif } } @@ -1061,12 +1027,11 @@ create_fake_menu (MateMenuTreeDirectory *directory) /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *toplevel = gtk_widget_get_toplevel (menu); GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); GdkVisual *visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(toplevel), visual); -#endif + return menu; } GtkWidget * @@ -1273,16 +1238,11 @@ handle_matemenu_tree_changed (MateMenuTree *tree, { guint idle_id; -#if GTK_CHECK_VERSION (3, 0, 0) GList *list, *l; list = gtk_container_get_children (GTK_CONTAINER (menu)); for (l = list; l; l = l->next) gtk_widget_destroy (l->data); g_list_free (list); -#else - while (GTK_MENU_SHELL (menu)->children) - gtk_widget_destroy (GTK_MENU_SHELL (menu)->children->data); -#endif g_object_set_data_full (G_OBJECT (menu), "panel-menu-tree-directory", @@ -1368,12 +1328,11 @@ create_applications_menu (const char *menu_file, matemenu_tree_unref (tree); /*HACK Fix any failures of compiz/other wm's to communicate with gtk for transparency */ -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *toplevel = gtk_widget_get_toplevel (menu); GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); GdkVisual *visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(toplevel), visual); -#endif + return menu; } @@ -1490,31 +1449,20 @@ panel_menu_key_press_handler (GtkWidget *widget, GdkEventKey *event) { gboolean retval = FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *active_menu_item = NULL; -#endif if ((event->keyval == GDK_KEY_Menu) || (event->keyval == GDK_KEY_F10 && (event->state & gtk_accelerator_get_default_mod_mask ()) == GDK_SHIFT_MASK)) { GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget); -#if GTK_CHECK_VERSION (3, 0, 0) active_menu_item = gtk_menu_shell_get_selected_item (menu_shell); if (active_menu_item && gtk_menu_item_get_submenu (GTK_MENU_ITEM (active_menu_item)) == NULL) { -#else - if (menu_shell->active_menu_item && - GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL) { -#endif GdkEventButton bevent; bevent.button = 3; bevent.time = GDK_CURRENT_TIME; -#if GTK_CHECK_VERSION (3, 0, 0) retval = show_item_menu (active_menu_item, &bevent); -#else - retval = show_item_menu (menu_shell->active_menu_item, &bevent); -#endif } } diff --git a/mate-panel/menu.h b/mate-panel/menu.h index 0c6d3495..bd2398de 100644 --- a/mate-panel/menu.h +++ b/mate-panel/menu.h @@ -25,7 +25,6 @@ #include "panel-widget.h" #include "applet.h" -#include <matemenu-tree.h> #include <gio/gio.h> #ifdef __cplusplus diff --git a/mate-panel/nothing.cP b/mate-panel/nothing.cP index e3f2b51e..ae06ed7e 100644 --- a/mate-panel/nothing.cP +++ b/mate-panel/nothing.cP @@ -17,7 +17,8 @@ #include "panel-util.h" #include "nothing.h" -#if !GTK_CHECK_VERSION (3, 0, 0) +/* FIXME fix for GTK+3 */ +#if 0 static void pixbuf_reverse (GdkPixbuf *gp) { @@ -1394,11 +1395,7 @@ start_geginv (void) gtk_widget_set_double_buffered (GTK_WIDGET (geginv_canvas), FALSE); gtk_widget_set_size_request (geginv_canvas, inv_width, inv_height); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_container_add (GTK_CONTAINER (geginv), vbox); gtk_box_pack_start (GTK_BOX (vbox), geginv_canvas, TRUE, TRUE, 0); diff --git a/mate-panel/nothing.h b/mate-panel/nothing.h index 2c8d8f79..f615ba7a 100644 --- a/mate-panel/nothing.h +++ b/mate-panel/nothing.h @@ -7,7 +7,8 @@ extern "C" { #endif -#if !GTK_CHECK_VERSION (3, 0, 0) +/* FIXME fix for GTK+3 */ +#if 0 void start_screen_check (void); void start_geginv (void); gboolean panel_dialog_window_event (GtkWidget *window, diff --git a/mate-panel/panel-action-button.c b/mate-panel/panel-action-button.c index 67be0f78..27f1c7bf 100644 --- a/mate-panel/panel-action-button.c +++ b/mate-panel/panel-action-button.c @@ -694,11 +694,7 @@ panel_action_button_connect_to_gsettings (PanelActionButton *button) } static void -#if GTK_CHECK_VERSION (3, 0, 0) panel_action_button_style_updated (PanelActionButton *button) -#else -panel_action_button_style_set (PanelActionButton *button) -#endif { if (actions [button->priv->type].icon_name != NULL) button_widget_set_icon_name (BUTTON_WIDGET (button), actions [button->priv->type].icon_name); @@ -742,13 +738,8 @@ panel_action_button_load (PanelActionButtonType type, panel_action_button_connect_to_gsettings (button); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (button, "style-updated", G_CALLBACK (panel_action_button_style_updated), NULL); -#else - g_signal_connect (button, "style-set", - G_CALLBACK (panel_action_button_style_set), NULL); -#endif } void diff --git a/mate-panel/panel-action-protocol.c b/mate-panel/panel-action-protocol.c index ca5b7b5b..e57c8e35 100644 --- a/mate-panel/panel-action-protocol.c +++ b/mate-panel/panel-action-protocol.c @@ -101,9 +101,7 @@ panel_action_protocol_filter (GdkXEvent *gdk_xevent, { GdkWindow *window; GdkScreen *screen; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; -#endif XEvent *xevent = (XEvent *) gdk_xevent; if (xevent->type != ClientMessage) @@ -113,21 +111,14 @@ panel_action_protocol_filter (GdkXEvent *gdk_xevent, (xevent->xclient.message_type != atom_gnome_panel_action)) return GDK_FILTER_CONTINUE; -#if GTK_CHECK_VERSION (3, 0, 0) screen = gdk_event_get_screen (event); display = gdk_screen_get_display (screen); window = gdk_x11_window_lookup_for_display (display, xevent->xclient.window); -#else - window = gdk_window_lookup (xevent->xclient.window); - screen = gdk_drawable_get_screen (window); -#endif if (!window) return GDK_FILTER_CONTINUE; -#if GTK_CHECK_VERSION (3, 0, 0) if (window != gdk_screen_get_root_window (screen)) return GDK_FILTER_CONTINUE; -#endif if (xevent->xclient.data.l [0] == atom_mate_panel_action_main_menu) panel_action_protocol_main_menu (screen, xevent->xclient.data.l [1]); diff --git a/mate-panel/panel-addto.c b/mate-panel/panel-addto.c index bd1f47c6..7f9a3f6e 100644 --- a/mate-panel/panel-addto.c +++ b/mate-panel/panel-addto.c @@ -1248,18 +1248,10 @@ panel_addto_dialog_new (PanelWidget *panel_widget) g_signal_connect (dialog->addto_dialog, "destroy", G_CALLBACK (panel_addto_dialog_destroy), dialog); -#if GTK_CHECK_VERSION (3, 0, 0) inner_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - inner_vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (dialog_vbox), inner_vbox, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) find_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - find_hbox = gtk_hbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (inner_vbox), find_hbox, FALSE, FALSE, 0); dialog->label = gtk_label_new_with_mnemonic (""); diff --git a/mate-panel/panel-addto.h b/mate-panel/panel-addto.h index 5e092d0f..f1defdc5 100644 --- a/mate-panel/panel-addto.h +++ b/mate-panel/panel-addto.h @@ -25,6 +25,9 @@ #ifndef __PANEL_ADDTO_H__ #define __PANEL_ADDTO_H__ +#include <gtk/gtk.h> +#include "panel-widget.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/mate-panel/panel-applet-frame.c b/mate-panel/panel-applet-frame.c index 922e449d..dea79339 100644 --- a/mate-panel/panel-applet-frame.c +++ b/mate-panel/panel-applet-frame.c @@ -94,7 +94,6 @@ struct _MatePanelAppletFramePrivate { guint has_handle : 1; }; -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean mate_panel_applet_frame_draw (GtkWidget *widget, cairo_t *cr) @@ -160,60 +159,6 @@ mate_panel_applet_frame_draw (GtkWidget *widget, return FALSE; } -#else -static void -mate_panel_applet_frame_paint (GtkWidget *widget, - GdkRectangle *area) -{ - MatePanelAppletFrame *frame; - - frame = MATE_PANEL_APPLET_FRAME (widget); - - if (!frame->priv->has_handle) - return; - - if (gtk_widget_is_drawable (widget)) { - GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL; - - switch (frame->priv->orientation) { - case PANEL_ORIENTATION_TOP: - case PANEL_ORIENTATION_BOTTOM: - orientation = GTK_ORIENTATION_VERTICAL; - break; - case PANEL_ORIENTATION_LEFT: - case PANEL_ORIENTATION_RIGHT: - orientation = GTK_ORIENTATION_HORIZONTAL; - break; - default: - g_assert_not_reached (); - break; - } - - gtk_paint_handle ( - gtk_widget_get_style (widget), gtk_widget_get_window (widget), - gtk_widget_get_state (widget), - GTK_SHADOW_OUT, - area, widget, "handlebox", - frame->priv->handle_rect.x, - frame->priv->handle_rect.y, - frame->priv->handle_rect.width, - frame->priv->handle_rect.height, - orientation); - } -} - -static gboolean mate_panel_applet_frame_expose(GtkWidget* widget, GdkEventExpose* event) -{ - if (gtk_widget_is_drawable (widget)) - { - GTK_WIDGET_CLASS (mate_panel_applet_frame_parent_class)->expose_event (widget, event); - - mate_panel_applet_frame_paint (widget, &event->area); - } - - return FALSE; -} -#endif static void mate_panel_applet_frame_update_background_size (MatePanelAppletFrame *frame, @@ -239,7 +184,6 @@ mate_panel_applet_frame_update_background_size (MatePanelAppletFrame *frame, mate_panel_applet_frame_change_background (frame, background->type); } -#if GTK_CHECK_VERSION (3, 0, 0) static void mate_panel_applet_frame_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width) { @@ -317,52 +261,6 @@ mate_panel_applet_frame_get_preferred_height(GtkWidget *widget, gint *minimal_he break; } } -#else -static void -mate_panel_applet_frame_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - MatePanelAppletFrame *frame; - GtkBin *bin; - GtkWidget *child; - GtkRequisition child_requisition; - guint border_width; - - frame = MATE_PANEL_APPLET_FRAME (widget); - bin = GTK_BIN (widget); - - if (!frame->priv->has_handle) { - GTK_WIDGET_CLASS (mate_panel_applet_frame_parent_class)->size_request (widget, requisition); - return; - } - - child = gtk_bin_get_child (bin); - if (child && gtk_widget_get_visible (child)) { - gtk_widget_size_request (child, &child_requisition); - - requisition->width = child_requisition.width; - requisition->height = child_requisition.height; - } - - border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - requisition->width += border_width; - requisition->height += border_width; - - switch (frame->priv->orientation) { - case PANEL_ORIENTATION_TOP: - case PANEL_ORIENTATION_BOTTOM: - requisition->width += HANDLE_SIZE; - break; - case PANEL_ORIENTATION_LEFT: - case PANEL_ORIENTATION_RIGHT: - requisition->height += HANDLE_SIZE; - break; - default: - g_assert_not_reached (); - break; - } -} -#endif static void mate_panel_applet_frame_size_allocate (GtkWidget *widget, @@ -486,7 +384,6 @@ mate_panel_applet_frame_button_changed (GtkWidget *widget, { MatePanelAppletFrame *frame; gboolean handled = FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; #if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; @@ -494,7 +391,6 @@ mate_panel_applet_frame_button_changed (GtkWidget *widget, GdkDevice *pointer; GdkDeviceManager *device_manager; #endif -#endif frame = MATE_PANEL_APPLET_FRAME (widget); @@ -527,13 +423,11 @@ mate_panel_applet_frame_button_changed (GtkWidget *widget, display = gtk_widget_get_display (widget); seat = gdk_display_get_default_seat (display); gdk_seat_ungrab (seat); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else display = gtk_widget_get_display (widget); device_manager = gdk_display_get_device_manager (display); pointer = gdk_device_manager_get_client_pointer (device_manager); gdk_device_ungrab (pointer, GDK_CURRENT_TIME); -#else - gdk_pointer_ungrab (GDK_CURRENT_TIME); #endif MATE_PANEL_APPLET_FRAME_GET_CLASS (frame)->popup_menu (frame, @@ -575,14 +469,9 @@ mate_panel_applet_frame_class_init (MatePanelAppletFrameClass *klass) gobject_class->finalize = mate_panel_applet_frame_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = mate_panel_applet_frame_draw; widget_class->get_preferred_width = mate_panel_applet_frame_get_preferred_width; widget_class->get_preferred_height = mate_panel_applet_frame_get_preferred_height; -#else - widget_class->expose_event = mate_panel_applet_frame_expose; - widget_class->size_request = mate_panel_applet_frame_size_request; -#endif widget_class->size_allocate = mate_panel_applet_frame_size_allocate; widget_class->button_press_event = mate_panel_applet_frame_button_changed; widget_class->button_release_event = mate_panel_applet_frame_button_changed; @@ -666,12 +555,7 @@ mate_panel_applet_frame_change_background (MatePanelAppletFrame *frame, #else background = &PANEL_WIDGET (parent)->background; #endif -#if GTK_CHECK_VERSION (3, 0, 0) panel_background_apply_css (background, GTK_WIDGET (frame)); -#else - panel_background_change_background_on_widget (background, - GTK_WIDGET (frame)); -#endif } MATE_PANEL_APPLET_FRAME_GET_CLASS (frame)->change_background (frame, type); diff --git a/mate-panel/panel-background-monitor.c b/mate-panel/panel-background-monitor.c index a660ca1e..c2cd431d 100644 --- a/mate-panel/panel-background-monitor.c +++ b/mate-panel/panel-background-monitor.c @@ -65,11 +65,7 @@ struct _PanelBackgroundMonitor { Atom xatom; GdkAtom gdkatom; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_t *surface; -#else - GdkPixmap *gdkpixmap; -#endif GdkPixbuf *gdkpixbuf; int width; @@ -80,20 +76,14 @@ struct _PanelBackgroundMonitor { G_DEFINE_TYPE (PanelBackgroundMonitor, panel_background_monitor, G_TYPE_OBJECT) -#if GTK_CHECK_VERSION (3, 0, 0) static PanelBackgroundMonitor *global_background_monitor = NULL; -#else -static PanelBackgroundMonitor **global_background_monitors = NULL; -#endif static guint signals [LAST_SIGNAL] = { 0 }; -#if GTK_CHECK_VERSION(3, 0, 0) gboolean gdk_window_check_composited_wm(GdkWindow* window) { return gdk_screen_is_composited(gdk_window_get_screen(window)); } -#endif static void panel_background_monitor_finalize (GObject *object) @@ -107,15 +97,9 @@ panel_background_monitor_finalize (GObject *object) g_signal_handlers_disconnect_by_func (monitor->screen, panel_background_monitor_changed, monitor); -#if GTK_CHECK_VERSION (3, 0, 0) if (monitor->surface) cairo_surface_destroy (monitor->surface); monitor->surface= NULL; -#else - if (monitor->gdkpixmap) - g_object_unref (monitor->gdkpixmap); - monitor->gdkpixmap = NULL; -#endif if (monitor->gdkpixbuf) g_object_unref (monitor->gdkpixbuf); @@ -152,11 +136,7 @@ panel_background_monitor_init (PanelBackgroundMonitor *monitor) monitor->gdkatom = gdk_atom_intern_static_string ("_XROOTPMAP_ID"); monitor->xatom = gdk_x11_atom_to_xatom (monitor->gdkatom); -#if GTK_CHECK_VERSION (3, 0, 0) monitor->surface = NULL; -#else - monitor->gdkpixmap = NULL; -#endif monitor->gdkpixbuf = NULL; monitor->display_grabbed = FALSE; @@ -202,7 +182,6 @@ panel_background_monitor_new (GdkScreen *screen) PanelBackgroundMonitor * panel_background_monitor_get_for_screen (GdkScreen *screen) { -#if GTK_CHECK_VERSION (3, 0, 0) if (!global_background_monitor) { global_background_monitor = panel_background_monitor_new (screen); @@ -213,46 +192,14 @@ panel_background_monitor_get_for_screen (GdkScreen *screen) } return g_object_ref (global_background_monitor); -#else - int screen_number; - - screen_number = gdk_screen_get_number (screen); - - if (!global_background_monitors) { - int n_screens; - - n_screens = gdk_display_get_n_screens (gdk_display_get_default ()); - - global_background_monitors = g_new0 (PanelBackgroundMonitor *, n_screens); - } - - if (!global_background_monitors [screen_number]) { - global_background_monitors [screen_number] = - panel_background_monitor_new (screen); - - g_object_add_weak_pointer ( - G_OBJECT (global_background_monitors [screen_number]), - (void **) &global_background_monitors [screen_number]); - - return global_background_monitors [screen_number]; - } - - return g_object_ref (global_background_monitors [screen_number]); -#endif } static void panel_background_monitor_changed (PanelBackgroundMonitor *monitor) { -#if GTK_CHECK_VERSION (3, 0, 0) if (monitor->surface) cairo_surface_destroy (monitor->surface); monitor->surface = NULL; -#else - if (monitor->gdkpixmap) - g_object_unref (monitor->gdkpixmap); - monitor->gdkpixmap = NULL; -#endif if (monitor->gdkpixbuf) g_object_unref (monitor->gdkpixbuf); @@ -282,39 +229,6 @@ panel_background_monitor_xevent_filter (GdkXEvent *xevent, return GDK_FILTER_CONTINUE; } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -panel_background_monitor_setup_pixmap (PanelBackgroundMonitor *monitor) -{ - Pixmap *prop_data = NULL; - GdkAtom prop_type; - - g_assert (monitor->display_grabbed); - - if (!gdk_property_get ( - monitor->gdkwindow, monitor->gdkatom, - gdk_x11_xatom_to_atom (XA_PIXMAP), 0, 10, - FALSE, &prop_type, NULL, NULL, (gpointer) &prop_data)) - return; - - if ((prop_type == GDK_TARGET_PIXMAP) && prop_data && prop_data [0]) { - GdkDisplay *display; - - g_assert (monitor->gdkpixmap == NULL); - - display = gdk_screen_get_display (monitor->screen); - - monitor->gdkpixmap = gdk_pixmap_foreign_new_for_display (display, - prop_data [0]); - - if (!monitor->gdkpixmap) - g_warning ("couldn't get background pixmap\n"); - } - - g_free (prop_data); -} -#endif - static GdkPixbuf * panel_background_monitor_tile_background (PanelBackgroundMonitor *monitor, int width, @@ -383,9 +297,6 @@ panel_background_monitor_tile_background (PanelBackgroundMonitor *monitor, static void panel_background_monitor_setup_pixbuf (PanelBackgroundMonitor *monitor) { -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkColormap *colormap = NULL; -#endif GdkDisplay *display; int rwidth, rheight; int pwidth, pheight; @@ -395,19 +306,10 @@ panel_background_monitor_setup_pixbuf (PanelBackgroundMonitor *monitor) gdk_x11_display_grab (display); monitor->display_grabbed = TRUE; -#if GTK_CHECK_VERSION (3, 0, 0) if (!monitor->surface) monitor->surface = mate_bg_get_surface_from_root (monitor->screen); -#else - if (!monitor->gdkpixmap) - panel_background_monitor_setup_pixmap (monitor); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) if (!monitor->surface) -#else - if (!monitor->gdkpixmap) -#endif { g_warning ("couldn't get background pixmap\n"); gdk_x11_display_ungrab (display); @@ -415,38 +317,19 @@ panel_background_monitor_setup_pixbuf (PanelBackgroundMonitor *monitor) return; } -#if GTK_CHECK_VERSION (3, 0, 0) pwidth = cairo_xlib_surface_get_width (monitor->surface); pheight = cairo_xlib_surface_get_height (monitor->surface); -#else - gdk_drawable_get_size(GDK_DRAWABLE(monitor->gdkpixmap), &pwidth, &pheight); -#endif gdk_window_get_geometry (monitor->gdkwindow, -#if GTK_CHECK_VERSION (3, 0, 0) NULL, NULL, &rwidth, &rheight); -#else - NULL, NULL, &rwidth, &rheight, NULL); -#endif monitor->width = MIN (pwidth, rwidth); monitor->height = MIN (pheight, rheight); -#if !GTK_CHECK_VERSION (3, 0, 0) - colormap = gdk_drawable_get_colormap (monitor->gdkwindow); -#endif - g_assert (monitor->gdkpixbuf == NULL); -#if GTK_CHECK_VERSION (3, 0, 0) monitor->gdkpixbuf = gdk_pixbuf_get_from_surface (monitor->surface, 0, 0, monitor->width, monitor->height); -#else - monitor->gdkpixbuf = gdk_pixbuf_get_from_drawable ( - NULL, monitor->gdkpixmap, colormap, - 0, 0, 0, 0, - monitor->width, monitor->height); -#endif gdk_x11_display_ungrab (display); monitor->display_grabbed = FALSE; diff --git a/mate-panel/panel-background-monitor.h b/mate-panel/panel-background-monitor.h index 379e3313..29cafd66 100644 --- a/mate-panel/panel-background-monitor.h +++ b/mate-panel/panel-background-monitor.h @@ -29,7 +29,7 @@ #include <glib.h> #include <glib-object.h> -#include <gtk/gtk.h> +#include <gdk/gdk.h> #define PANEL_TYPE_BACKGROUND_MONITOR (panel_background_monitor_get_type ()) #define PANEL_BACKGROUND_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \ @@ -49,9 +49,8 @@ typedef struct _PanelBackgroundMonitorClass PanelBackgroundMonitorClass; typedef struct _PanelBackgroundMonitor PanelBackgroundMonitor; -#if GTK_CHECK_VERSION(3, 0, 0) gboolean gdk_window_check_composited_wm (GdkWindow* window); -#endif + GType panel_background_monitor_get_type (void); PanelBackgroundMonitor *panel_background_monitor_get_for_screen (GdkScreen *screen); GdkPixbuf *panel_background_monitor_get_region (PanelBackgroundMonitor *monitor, diff --git a/mate-panel/panel-background.c b/mate-panel/panel-background.c index 3af6e13d..11812faa 100644 --- a/mate-panel/panel-background.c +++ b/mate-panel/panel-background.c @@ -31,9 +31,7 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> #include <cairo.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <cairo-xlib.h> -#endif #include "panel-background-monitor.h" #include "panel-util.h" @@ -44,58 +42,13 @@ static void load_background_file (PanelBackground *background); static void -free_prepared_resources (PanelBackground *background) -{ -#if !GTK_CHECK_VERSION (3, 0, 0) - switch (background->type) { - case PANEL_BACK_NONE: - break; - case PANEL_BACK_COLOR: - if (background->has_alpha) { - if (background->pixmap) - g_object_unref (background->pixmap); - background->pixmap = NULL; - } else { - if (background->colormap && background->color.gdk.pixel) - gdk_colormap_free_colors ( - background->colormap, - &background->color.gdk, 1); - background->color.gdk.pixel = 0; - } - break; - case PANEL_BACK_IMAGE: - if (background->pixmap) - g_object_unref (background->pixmap); - background->pixmap = NULL; - break; - default: - g_assert_not_reached (); - break; - } -#endif -} - -static void set_pixbuf_background (PanelBackground *background) { -#if GTK_CHECK_VERSION (3, 0, 0) g_assert (background->composited_pattern != NULL); gdk_window_set_background_pattern (background->window, background->composited_pattern); -#else - g_assert (background->composited_image != NULL); - - gdk_pixbuf_render_pixmap_and_mask_for_colormap ( - background->composited_image, - background->colormap, - &background->pixmap, NULL, 128); - - gdk_window_set_back_pixmap ( - background->window, background->pixmap, FALSE); -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) void panel_background_apply_css (PanelBackground *background, GtkWidget *widget) { GtkStyleContext *context; @@ -135,7 +88,6 @@ panel_background_prepare_css () GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); } -#endif static gboolean panel_background_prepare (PanelBackground *background) @@ -143,19 +95,12 @@ panel_background_prepare (PanelBackground *background) PanelBackgroundType effective_type; GtkWidget *widget = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) if (!background->transformed) -#else - if (!background->colormap || !background->transformed) -#endif return FALSE; - free_prepared_resources (background); - effective_type = panel_background_effective_type (background); switch (effective_type) { -#if GTK_CHECK_VERSION (3, 0, 0) case PANEL_BACK_NONE: if (background->default_pattern) { /* the theme background-image pattern must be scaled by @@ -187,36 +132,6 @@ panel_background_prepare (PanelBackground *background) &background->color); } break; -#else - case PANEL_BACK_NONE: - if (background->default_pixmap) { - if (background->default_pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE) - gdk_window_set_back_pixmap (background->window, - background->default_pixmap, - FALSE); - else - gdk_window_set_back_pixmap (background->window, - NULL, - TRUE); - } else - gdk_window_set_background ( - background->window, &background->default_color); - break; - - case PANEL_BACK_COLOR: - if (background->has_alpha && - background->composited_image) - set_pixbuf_background (background); - else { - gdk_colormap_alloc_color ( - background->colormap, - &background->color.gdk, - FALSE, TRUE); - gdk_window_set_background ( - background->window, &background->color.gdk); - } - break; -#endif case PANEL_BACK_IMAGE: set_pixbuf_background (background); @@ -231,19 +146,13 @@ panel_background_prepare (PanelBackground *background) * decide how to draw themselves. Therefore, we need to * make sure that all drawing has been completed before * the applet looks at the pixmap. */ -#if GTK_CHECK_VERSION (3, 0, 0) gdk_display_sync (gdk_window_get_display (background->window)); -#else - gdk_display_sync (gdk_drawable_get_display (background->window)); -#endif gdk_window_get_user_data (GDK_WINDOW (background->window), (gpointer) &widget); if (GTK_IS_WIDGET (widget)) { -#if GTK_CHECK_VERSION (3, 0, 0) panel_background_apply_css (background, gtk_widget_get_toplevel(widget)); -#endif gtk_widget_set_app_paintable(widget,TRUE); gtk_widget_queue_draw (widget); } @@ -256,27 +165,17 @@ panel_background_prepare (PanelBackground *background) static void free_composited_resources (PanelBackground *background) { - free_prepared_resources (background); - background->composited = FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) if (background->composited_pattern) cairo_pattern_destroy (background->composited_pattern); background->composited_pattern = NULL; -#else - if (background->composited_image) - g_object_unref (background->composited_image); - background->composited_image = NULL; -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) static void _panel_background_transparency(GdkScreen* screen,PanelBackground* background) { panel_background_composite(background); } -#endif static void background_changed (PanelBackgroundMonitor *monitor, @@ -307,22 +206,17 @@ get_desktop_pixbuf (PanelBackground *background) if (!background->monitor) { background->monitor = panel_background_monitor_get_for_screen ( -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_screen (background->window)); -#else - gdk_drawable_get_screen (background->window)); -#endif background->monitor_signal = g_signal_connect ( background->monitor, "changed", G_CALLBACK (background_changed), background); } -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect(gdk_window_get_screen(background->window), "composited-changed", G_CALLBACK(_panel_background_transparency), background); -#endif + desktop = panel_background_monitor_get_region ( background->monitor, background->region.x, @@ -333,17 +227,9 @@ get_desktop_pixbuf (PanelBackground *background) return desktop; } -#if GTK_CHECK_VERSION (3, 0, 0) static cairo_pattern_t * -#else -static GdkPixbuf * -#endif composite_image_onto_desktop (PanelBackground *background) { -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkPixbuf *retval; - unsigned char *data; -#endif int width, height; cairo_t *cr; cairo_surface_t *surface; @@ -358,7 +244,6 @@ composite_image_onto_desktop (PanelBackground *background) width = gdk_pixbuf_get_width (background->desktop); height = gdk_pixbuf_get_height (background->desktop); -#if GTK_CHECK_VERSION (3, 0, 0) surface = gdk_window_create_similar_surface (background->window, CAIRO_CONTENT_COLOR_ALPHA, width, height); @@ -366,30 +251,16 @@ composite_image_onto_desktop (PanelBackground *background) cairo_surface_destroy (surface); return NULL; } -#else - data = g_malloc (width * height * 4); - if (!data) - return NULL; - - surface = cairo_image_surface_create_for_data (data, - CAIRO_FORMAT_RGB24, - width, height, - width * 4); -#endif cr = cairo_create (surface); -#if GTK_CHECK_VERSION (3, 0, 0) if(!gdk_window_check_composited_wm(background->window)){ -#endif - cairo_set_source_rgb (cr, 1, 1, 1); - cairo_paint (cr); + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_paint (cr); - gdk_cairo_set_source_pixbuf (cr, background->desktop, 0, 0); - cairo_rectangle (cr, 0, 0, width, height); - cairo_fill (cr); -#if GTK_CHECK_VERSION (3, 0, 0) + gdk_cairo_set_source_pixbuf (cr, background->desktop, 0, 0); + cairo_rectangle (cr, 0, 0, width, height); + cairo_fill (cr); } -#endif gdk_cairo_set_source_pixbuf (cr, background->transformed_image, 0, 0); pattern = cairo_get_source (cr); @@ -400,19 +271,11 @@ composite_image_onto_desktop (PanelBackground *background) cairo_destroy (cr); -#if GTK_CHECK_VERSION (3, 0, 0) pattern = cairo_pattern_create_for_surface (surface); cairo_surface_destroy (surface); return pattern; -#else - cairo_surface_destroy (surface); - retval = panel_util_cairo_rgbdata_to_pixbuf (data, width, height); - g_free (data); - return retval; -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) static cairo_pattern_t * composite_color_onto_desktop (PanelBackground *background) { @@ -452,45 +315,11 @@ composite_color_onto_desktop (PanelBackground *background) return pattern; } -#else -static GdkPixbuf * -composite_color_onto_desktop (PanelBackground *background) -{ - guint32 color; - - if (!background->desktop) - background->desktop = get_desktop_pixbuf (background); - if (!background->desktop) - return NULL; - - color = ((background->color.gdk.red & 0xff00) << 8) + - (background->color.gdk.green & 0xff00) + - (background->color.gdk.blue >> 8); - - return gdk_pixbuf_composite_color_simple ( - background->desktop, - gdk_pixbuf_get_width (background->desktop), - gdk_pixbuf_get_height (background->desktop), - GDK_INTERP_NEAREST, - (255 - (background->color.alpha >> 8)), - 255, color, color); -} -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) static cairo_pattern_t * get_composited_pattern (PanelBackground *background) -#else -static GdkPixbuf * -get_composited_pixbuf (PanelBackground *background) -#endif { -#if GTK_CHECK_VERSION (3, 0, 0) cairo_pattern_t *retval = NULL; -#else - GdkPixbuf *retval = NULL; -#endif switch (background->type) { case PANEL_BACK_NONE: @@ -500,10 +329,6 @@ get_composited_pixbuf (PanelBackground *background) break; case PANEL_BACK_IMAGE: retval = composite_image_onto_desktop (background); -#if !GTK_CHECK_VERSION (3, 0, 0) - if (!retval) - retval = g_object_ref (background->transformed_image); -#endif break; default: g_assert_not_reached (); @@ -526,27 +351,13 @@ panel_background_composite (PanelBackground *background) break; case PANEL_BACK_COLOR: if (background->has_alpha) -#if GTK_CHECK_VERSION (3, 0, 0) background->composited_pattern = get_composited_pattern (background); -#else - background->composited_image = - get_composited_pixbuf (background); -#endif break; case PANEL_BACK_IMAGE: if (background->transformed_image) { -#if GTK_CHECK_VERSION (3, 0, 0) background->composited_pattern = get_composited_pattern (background); -#else - if (background->has_alpha) - background->composited_image = - get_composited_pixbuf (background); - else - background->composited_image = - g_object_ref (background->transformed_image); -#endif } break; default: @@ -741,11 +552,7 @@ panel_background_update_has_alpha (PanelBackground *background) gboolean has_alpha = FALSE; if (background->type == PANEL_BACK_COLOR) -#if GTK_CHECK_VERSION (3, 0, 0) has_alpha = (background->color.alpha < 1.); -#else - has_alpha = (background->color.alpha != 0xffff); -#endif else if (background->type == PANEL_BACK_IMAGE && background->loaded_image) @@ -795,45 +602,11 @@ panel_background_set_type (PanelBackground *background, panel_background_transform (background); } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -panel_background_set_gdk_color_no_update (PanelBackground *background, - GdkColor *gdk_color) -{ - g_return_if_fail (gdk_color != NULL); - - background->color.gdk.red = gdk_color->red; - background->color.gdk.green = gdk_color->green; - background->color.gdk.blue = gdk_color->blue; -} - -void -panel_background_set_gdk_color (PanelBackground *background, - GdkColor *gdk_color) -{ - g_return_if_fail (gdk_color != NULL); - g_return_if_fail (background != NULL); - - if (background->color.gdk.red == gdk_color->red && - background->color.gdk.green == gdk_color->green && - background->color.gdk.blue == gdk_color->blue) - return; - - free_transformed_resources (background); - panel_background_set_gdk_color_no_update (background, gdk_color); - panel_background_transform (background); -} -#endif - static void panel_background_set_opacity_no_update (PanelBackground *background, guint16 opacity) { -#if GTK_CHECK_VERSION (3, 0, 0) background->color.alpha = opacity / 65535.0; -#else - background->color.alpha = opacity; -#endif panel_background_update_has_alpha (background); } @@ -841,11 +614,7 @@ void panel_background_set_opacity (PanelBackground *background, guint16 opacity) { -#if GTK_CHECK_VERSION (3, 0, 0) if (background->color.alpha == (opacity / 65535.0)) -#else - if (background->color.alpha == opacity) -#endif return; free_transformed_resources (background); @@ -855,42 +624,24 @@ panel_background_set_opacity (PanelBackground *background, static void panel_background_set_color_no_update (PanelBackground *background, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRGBA *color) -#else - PanelColor *color) -#endif { g_return_if_fail (color != NULL); -#if GTK_CHECK_VERSION (3, 0, 0) if (gdk_rgba_equal (color, &background->color)) return; background->color = *color; panel_background_update_has_alpha (background); -#else - panel_background_set_gdk_color_no_update (background, &(color->gdk)); - panel_background_set_opacity_no_update (background, color->alpha); -#endif } void panel_background_set_color (PanelBackground *background, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRGBA *color) -#else - PanelColor *color) -#endif { g_return_if_fail (color != NULL); -#if GTK_CHECK_VERSION (3, 0, 0) if (gdk_rgba_equal (color, &background->color)) -#else - if (gdk_color_equal (&color->gdk, &background->color.gdk) && - color->alpha == background->color.alpha) -#endif return; free_transformed_resources (background); @@ -997,11 +748,7 @@ panel_background_set_rotate (PanelBackground *background, void panel_background_set (PanelBackground *background, PanelBackgroundType type, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRGBA *color, -#else - PanelColor *color, -#endif const char *image, gboolean fit_image, gboolean stretch_image, @@ -1017,19 +764,13 @@ panel_background_set (PanelBackground *background, void panel_background_set_default_style (PanelBackground *background, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *color, cairo_pattern_t *pattern) -#else - GdkColor *color, - GdkPixmap *pixmap) -#endif { g_return_if_fail (color != NULL); background->default_color = *color; -#if GTK_CHECK_VERSION (3, 0, 0) if (pattern) cairo_pattern_reference (pattern); @@ -1037,16 +778,6 @@ panel_background_set_default_style (PanelBackground *background, cairo_pattern_destroy (background->default_pattern); background->default_pattern = pattern; -#else - if (pixmap && pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE) - g_object_ref (pixmap); - - if (background->default_pixmap - && background->default_pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE) - g_object_unref (background->default_pixmap); - - background->default_pixmap = pixmap; -#endif if (background->type == PANEL_BACK_NONE) panel_background_prepare (background); } @@ -1058,27 +789,12 @@ panel_background_realized (PanelBackground *background, { g_return_if_fail (window != NULL); -#if GTK_CHECK_VERSION (3, 0, 0) if (background->window) return; background->window = g_object_ref (window); panel_background_prepare_css (); -#else - if (background->window && background->colormap && background->gc) - return; - - if (!background->window) - background->window = g_object_ref (window); - - if (!background->colormap) - background->colormap = - g_object_ref (gdk_drawable_get_colormap (window)); - - if (!background->gc) - background->gc = gdk_gc_new (window); -#endif panel_background_prepare (background); } @@ -1086,21 +802,9 @@ panel_background_realized (PanelBackground *background, void panel_background_unrealized (PanelBackground *background) { - free_prepared_resources (background); - if (background->window) g_object_unref (background->window); background->window = NULL; - -#if !GTK_CHECK_VERSION (3, 0, 0) - if (background->colormap) - g_object_unref (background->colormap); - background->colormap = NULL; - - if (background->gc) - g_object_unref (background->gc); - background->gc = NULL; -#endif } void @@ -1180,18 +884,10 @@ panel_background_init (PanelBackground *background, background->notify_changed = notify_changed; background->user_data = user_data; -#if GTK_CHECK_VERSION (3, 0, 0) background->color.red = 0.; background->color.blue = 0.; background->color.green = 0.; background->color.alpha = 1.; -#else - background->color.gdk.red = 0; - background->color.gdk.blue = 0; - background->color.gdk.green = 0; - background->color.gdk.pixel = 0; - background->color.alpha = 0xffff; -#endif background->image = NULL; background->loaded_image = NULL; @@ -1202,40 +898,20 @@ panel_background_init (PanelBackground *background, background->region.width = -1; background->region.height = -1; background->transformed_image = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) background->composited_pattern = NULL; -#else - background->composited_image = NULL; -#endif background->monitor = NULL; background->desktop = NULL; background->monitor_signal = -1; background->window = NULL; -#if !GTK_CHECK_VERSION (3, 0, 0) - background->pixmap = NULL; - background->colormap = NULL; - background->gc = NULL; -#endif -#if GTK_CHECK_VERSION (3, 0, 0) background->default_pattern = NULL; -#else - background->default_pixmap = NULL; -#endif -#if GTK_CHECK_VERSION (3, 0, 0) background->default_color.red = 0.; background->default_color.green = 0.; background->default_color.blue = 0.; background->default_color.alpha = 1.; -#else - background->default_color.red = 0; - background->default_color.green = 0; - background->default_color.blue = 0; - background->default_color.pixel = 0; -#endif background->fit_image = FALSE; background->stretch_image = FALSE; @@ -1270,24 +946,9 @@ panel_background_free (PanelBackground *background) g_object_unref (background->window); background->window = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) if (background->default_pattern) cairo_pattern_destroy (background->default_pattern); background->default_pattern = NULL; -#else - if (background->colormap) - g_object_unref (background->colormap); - background->colormap = NULL; - - if (background->gc) - g_object_unref (background->gc); - background->gc = NULL; - - if (background->default_pixmap - && background->default_pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE) - g_object_unref (background->default_pixmap); - background->default_pixmap = NULL; -#endif } char * @@ -1302,7 +963,6 @@ panel_background_make_string (PanelBackground *background, effective_type = panel_background_effective_type (background); -#if GTK_CHECK_VERSION (3, 0, 0) if (effective_type == PANEL_BACK_IMAGE || (effective_type == PANEL_BACK_COLOR && background->has_alpha && (!gdk_window_check_composited_wm(background->window)))) { @@ -1326,26 +986,6 @@ panel_background_make_string (PanelBackground *background, g_free (rgba); } else retval = g_strdup ("none:"); -#else - if (effective_type == PANEL_BACK_IMAGE || - (effective_type == PANEL_BACK_COLOR && background->has_alpha)) { - GdkNativeWindow pixmap_xid; - - if (!background->pixmap) - return NULL; - - pixmap_xid = GDK_WINDOW_XID (GDK_DRAWABLE (background->pixmap)); - - retval = g_strdup_printf ("pixmap:%d,%d,%d", pixmap_xid, x, y); - } else if (effective_type == PANEL_BACK_COLOR) { - retval = g_strdup_printf ( - "color:%.4x%.4x%.4x", - background->color.gdk.red, - background->color.gdk.green, - background->color.gdk.blue); - } else - retval = g_strdup ("none:"); -#endif return retval; } @@ -1356,25 +996,12 @@ panel_background_get_type (PanelBackground *background) return background->type; } -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRGBA * -#else -const PanelColor * -#endif panel_background_get_color (PanelBackground *background) { return &(background->color); } -#if !GTK_CHECK_VERSION (3, 0, 0) -const GdkPixmap * -panel_background_get_pixmap (PanelBackground *background) -{ - return background->pixmap; -} -#endif - - /* What are we actually rendering - e.g. if we're supposed to * be rendering an image, but haven't got a valid image, then * we're rendering the default gtk background. @@ -1385,113 +1012,8 @@ panel_background_effective_type (PanelBackground *background) PanelBackgroundType retval; retval = background->type; -#if GTK_CHECK_VERSION (3, 0, 0) if (background->type == PANEL_BACK_IMAGE && !background->composited_pattern) -#else - if (background->type == PANEL_BACK_IMAGE && !background->composited_image) -#endif retval = PANEL_BACK_NONE; return retval; } - -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -panel_background_set_no_background_on_widget (PanelBackground *background, - GtkWidget *widget) -{ - GtkRcStyle *rc_style; - - gtk_widget_set_style (widget, NULL); - rc_style = gtk_rc_style_new (); - gtk_widget_modify_style (widget, rc_style); - g_object_unref (rc_style); -} - -static void -panel_background_set_image_background_on_widget (PanelBackground *background, - GtkWidget *widget) -{ - GtkAllocation allocation; - cairo_t *cr; - cairo_pattern_t *pattern; - const GdkPixmap *bg_pixmap; - GdkPixmap *pixmap; - GtkStyle *style; - - bg_pixmap = panel_background_get_pixmap (background); - if (!bg_pixmap) - return; - - gtk_widget_get_allocation (widget, &allocation); - pixmap = gdk_pixmap_new (gtk_widget_get_window (widget), - allocation.width, - allocation.height, - -1); - - cr = gdk_cairo_create (GDK_DRAWABLE (pixmap)); - gdk_cairo_set_source_pixmap (cr, (GdkPixmap *) bg_pixmap, - -allocation.x, - -allocation.y); - pattern = cairo_get_source (cr); - cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); - - cairo_rectangle (cr, 0, 0, - allocation.width, allocation.height); - cairo_fill (cr); - - cairo_destroy (cr); - - style = gtk_style_copy (gtk_widget_get_style (widget)); - 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 (widget, style); - g_object_unref (style); - - g_object_unref (pixmap); -} - -static void -panel_background_set_color_background_on_widget (PanelBackground *background, - GtkWidget *widget) -{ - const PanelColor *color; - - color = panel_background_get_color (background); - if (color->alpha != 0xffff) { - panel_background_set_image_background_on_widget (background, - widget); - return; - } - - gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &color->gdk); -} - -void -panel_background_change_background_on_widget (PanelBackground *background, - GtkWidget *widget) -{ - PanelBackgroundType type; - - panel_background_set_no_background_on_widget (background, widget); - - type = panel_background_get_type (background); - - switch (type) { - case PANEL_BACK_NONE: - break; - case PANEL_BACK_COLOR: - panel_background_set_color_background_on_widget (background, - widget); - break; - case PANEL_BACK_IMAGE: - panel_background_set_image_background_on_widget (background, - widget); - break; - default: - g_assert_not_reached (); - break; - } -} -#endif diff --git a/mate-panel/panel-background.h b/mate-panel/panel-background.h index 2ca1c451..aa0183ed 100644 --- a/mate-panel/panel-background.h +++ b/mate-panel/panel-background.h @@ -44,38 +44,23 @@ struct _PanelBackground { PanelBackgroundChangedNotify notify_changed; gpointer user_data; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - PanelColor color; -#endif + char *image; GdkPixbuf *loaded_image; GtkOrientation orientation; GdkRectangle region; GdkPixbuf *transformed_image; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_pattern_t *composited_pattern; -#else - GdkPixbuf *composited_image; -#endif PanelBackgroundMonitor *monitor; GdkPixbuf *desktop; gulong monitor_signal; GdkWindow *window; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_pattern_t *default_pattern; GdkRGBA default_color; -#else - GdkPixmap *pixmap; - GdkColormap *colormap; - GdkGC *gc; - GdkPixmap *default_pixmap; - GdkColor default_color; -#endif guint fit_image : 1; guint stretch_image : 1; @@ -94,29 +79,17 @@ void panel_background_init (PanelBackground *background, void panel_background_free (PanelBackground *background); void panel_background_set (PanelBackground *background, PanelBackgroundType type, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRGBA *color, -#else - PanelColor *color, -#endif const char *image, gboolean fit_image, gboolean stretch_image, gboolean rotate_image); void panel_background_set_type (PanelBackground *background, PanelBackgroundType type); -#if !GTK_CHECK_VERSION (3, 0, 0) -void panel_background_set_gdk_color (PanelBackground *background, - GdkColor *gdk_color); -#endif void panel_background_set_opacity (PanelBackground *background, guint16 opacity); void panel_background_set_color (PanelBackground *background, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRGBA *color); -#else - PanelColor *color); -#endif void panel_background_set_image (PanelBackground *background, const char *image); void panel_background_set_fit (PanelBackground *background, @@ -126,13 +99,8 @@ void panel_background_set_stretch (PanelBackground *background, void panel_background_set_rotate (PanelBackground *background, gboolean rotate_image); void panel_background_set_default_style (PanelBackground *background, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *color, cairo_pattern_t *pattern); -#else - GdkColor *color, - GdkPixmap *pixmap); -#endif void panel_background_realized (PanelBackground *background, GdkWindow *window); void panel_background_unrealized (PanelBackground *background); @@ -147,21 +115,11 @@ char *panel_background_make_string (PanelBackground *background, int y); PanelBackgroundType panel_background_get_type (PanelBackground *background); -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRGBA *panel_background_get_color (PanelBackground *background); -#else -const PanelColor *panel_background_get_color (PanelBackground *background); -const GdkPixmap *panel_background_get_pixmap (PanelBackground *background); -#endif PanelBackgroundType panel_background_effective_type (PanelBackground *background); -#if GTK_CHECK_VERSION (3, 0, 0) void panel_background_apply_css(PanelBackground *background, GtkWidget *widget); -#else -void panel_background_change_background_on_widget (PanelBackground *background, - GtkWidget *widget); -#endif #endif /* __PANEL_BACKGROUND_H__ */ diff --git a/mate-panel/panel-context-menu.c b/mate-panel/panel-context-menu.c index 85288ef5..e249ffb3 100644 --- a/mate-panel/panel-context-menu.c +++ b/mate-panel/panel-context-menu.c @@ -70,7 +70,7 @@ panel_context_menu_check_for_screen (GtkWidget *w, times++; if (times == 3) { times = 0; -#if !GTK_CHECK_VERSION (3, 0, 0) +#if 0 /* FIXME re-add once GTK3 support is fixed */ start_screen_check (); #endif @@ -310,7 +310,6 @@ panel_context_menu_create (PanelWidget *panel) g_object_set_data (G_OBJECT (retval), "menu_panel", panel); /* Set up theme and transparency support */ -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *toplevel = gtk_widget_get_toplevel (retval); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); @@ -321,7 +320,6 @@ panel_context_menu_create (PanelWidget *panel) context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); -#endif return retval; } diff --git a/mate-panel/panel-ditem-editor.c b/mate-panel/panel-ditem-editor.c index 3d83aa57..737925fd 100644 --- a/mate-panel/panel-ditem-editor.c +++ b/mate-panel/panel-ditem-editor.c @@ -62,11 +62,7 @@ struct _PanelDItemEditorPrivate PanelDitemSaveUri save_uri; gpointer save_uri_data; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *type_label; GtkWidget *type_combo; GtkWidget *name_label; @@ -520,7 +516,6 @@ label_new_with_mnemonic (const char *text) } static inline void -#if GTK_CHECK_VERSION (3, 0, 0) grid_attach_label (GtkGrid *grid, GtkWidget *label, int left, int top, int width, int height) { gtk_grid_attach (grid, label, left, top, width, height); @@ -532,32 +527,6 @@ grid_attach_entry (GtkGrid *grid, GtkWidget *entry, int left, int top, int width gtk_widget_set_hexpand (entry, TRUE); gtk_grid_attach (grid, entry, left, top, width, height); } -#else -table_attach_label (GtkTable *table, - GtkWidget *label, - int left, - int right, - int top, - int bottom) -{ - gtk_table_attach (table, label, left, right, top, bottom, - GTK_FILL, GTK_FILL, - 0, 0); -} - -static inline void -table_attach_entry (GtkTable *table, - GtkWidget *entry, - int left, - int right, - int top, - int bottom) -{ - gtk_table_attach (table, entry, left, right, top, bottom, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); -} -#endif static void setup_combo (GtkWidget *combo_box, @@ -630,22 +599,12 @@ panel_ditem_editor_make_ui (PanelDItemEditor *dialog) dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_box_set_spacing (GTK_BOX (dialog_vbox), 2); -#if GTK_CHECK_VERSION (3, 0, 0) priv->grid = gtk_grid_new (); gtk_container_set_border_width (GTK_CONTAINER (priv->grid), 5); gtk_grid_set_row_spacing (GTK_GRID (priv->grid), 6); gtk_grid_set_column_spacing (GTK_GRID (priv->grid), 12); gtk_box_pack_start (GTK_BOX (dialog_vbox), priv->grid, TRUE, TRUE, 0); gtk_widget_show (priv->grid); -#else - priv->table = gtk_table_new (4, 3, FALSE); - gtk_container_set_border_width (GTK_CONTAINER (priv->table), 5); - gtk_table_set_row_spacings (GTK_TABLE (priv->table), 6); - gtk_table_set_col_spacings (GTK_TABLE (priv->table), 12); - gtk_box_pack_start (GTK_BOX (dialog_vbox), - priv->table, TRUE, TRUE, 0); - gtk_widget_show (priv->table); -#endif /* Type */ priv->type_label = label_new_with_mnemonic (_("_Type:")); @@ -665,23 +624,13 @@ panel_ditem_editor_make_ui (PanelDItemEditor *dialog) priv->icon_chooser = panel_icon_chooser_new (NULL); panel_icon_chooser_set_fallback_icon_name (PANEL_ICON_CHOOSER (priv->icon_chooser), PANEL_ICON_LAUNCHER); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (priv->grid), priv->icon_chooser, 0, 0, 1, 2); -#else - gtk_table_attach (GTK_TABLE (priv->table), priv->icon_chooser, - 0, 1, 0, 2, - 0, 0, 0, 0); -#endif gtk_widget_show (priv->icon_chooser); /* Command */ priv->command_label = label_new_with_mnemonic (""); -#if GTK_CHECK_VERSION (3, 0, 0) priv->command_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); -#else - priv->command_hbox = gtk_hbox_new (FALSE, 12); -#endif gtk_widget_show (priv->command_hbox); priv->command_entry = gtk_entry_new (); @@ -772,7 +721,6 @@ panel_ditem_editor_setup_ui (PanelDItemEditor *dialog) GtkTreeModel *model; PanelDItemEditorType buf_type; -#if GTK_CHECK_VERSION (3, 0, 0) grid_attach_label (GTK_GRID (priv->grid), priv->type_label, 1, 0, 1, 1); grid_attach_entry (GTK_GRID (priv->grid), priv->type_combo, 2, 0, 1, 1); @@ -784,27 +732,6 @@ panel_ditem_editor_setup_ui (PanelDItemEditor *dialog) grid_attach_label (GTK_GRID (priv->grid), priv->comment_label, 1, 3, 1, 1); grid_attach_entry (GTK_GRID (priv->grid), priv->comment_entry, 2, 3, 1, 1); -#else - table_attach_label (GTK_TABLE (priv->table), priv->type_label, - 1, 2, 0, 1); - table_attach_entry (GTK_TABLE (priv->table), priv->type_combo, - 2, 3, 0, 1); - - table_attach_label (GTK_TABLE (priv->table), priv->name_label, - 1, 2, 1, 2); - table_attach_entry (GTK_TABLE (priv->table), priv->name_entry, - 2, 3, 1, 2); - - table_attach_label (GTK_TABLE (priv->table), priv->command_label, - 1, 2, 2, 3); - table_attach_entry (GTK_TABLE (priv->table), priv->command_hbox, - 2, 3, 2, 3); - - table_attach_label (GTK_TABLE (priv->table), priv->comment_label, - 1, 2, 3, 4); - table_attach_entry (GTK_TABLE (priv->table), priv->comment_entry, - 2, 3, 3, 4); -#endif /* FIXME: hack hack hack */ model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->type_combo)); @@ -820,7 +747,6 @@ panel_ditem_editor_setup_ui (PanelDItemEditor *dialog) } } while (gtk_tree_model_iter_next (model, &iter)); } else if (type == PANEL_DITEM_EDITOR_TYPE_DIRECTORY) { -#if GTK_CHECK_VERSION (3, 0, 0) grid_attach_label (GTK_GRID (priv->grid), priv->name_label, 1, 0, 1, 1); grid_attach_entry (GTK_GRID (priv->grid), priv->name_entry, 2, 0, 1, 1); @@ -835,32 +761,6 @@ panel_ditem_editor_setup_ui (PanelDItemEditor *dialog) grid_attach_label (GTK_GRID (priv->grid), priv->comment_label, 1, 2, 1, 1); grid_attach_entry (GTK_GRID (priv->grid), priv->comment_entry, 2, 2, 1, 1); -#else - table_attach_label (GTK_TABLE (priv->table), priv->name_label, - 1, 2, 0, 1); - table_attach_entry (GTK_TABLE (priv->table), priv->name_entry, - 2, 3, 0, 1); - - table_attach_label (GTK_TABLE (priv->table), priv->comment_label, - 1, 2, 1, 2); - table_attach_entry (GTK_TABLE (priv->table), priv->comment_entry, - 2, 3, 1, 2); - } else { - table_attach_label (GTK_TABLE (priv->table), priv->name_label, - 1, 2, 0, 1); - table_attach_entry (GTK_TABLE (priv->table), priv->name_entry, - 2, 3, 0, 1); - - table_attach_label (GTK_TABLE (priv->table), priv->command_label, - 1, 2, 1, 2); - table_attach_entry (GTK_TABLE (priv->table), priv->command_hbox, - 2, 3, 1, 2); - - table_attach_label (GTK_TABLE (priv->table), priv->comment_label, - 1, 2, 2, 3); - table_attach_entry (GTK_TABLE (priv->table), priv->comment_entry, - 2, 3, 2, 3); -#endif } type_combo_changed (dialog); @@ -874,12 +774,7 @@ panel_ditem_editor_setup_ui (PanelDItemEditor *dialog) focus_chain = g_list_prepend (focus_chain, priv->command_hbox); focus_chain = g_list_prepend (focus_chain, priv->comment_entry); focus_chain = g_list_reverse (focus_chain); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_set_focus_chain (GTK_CONTAINER (priv->grid), focus_chain); -#else - gtk_container_set_focus_chain (GTK_CONTAINER (priv->table), - focus_chain); -#endif g_list_free (focus_chain); gtk_widget_grab_focus (priv->name_entry); diff --git a/mate-panel/panel-force-quit.c b/mate-panel/panel-force-quit.c index bc4809fd..8f99d5f1 100644 --- a/mate-panel/panel-force-quit.c +++ b/mate-panel/panel-force-quit.c @@ -65,23 +65,15 @@ display_popup_window (GdkScreen *screen) gtk_container_add (GTK_CONTAINER (retval), frame); gtk_widget_show (frame); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); image = gtk_image_new_from_icon_name (PANEL_ICON_FORCE_QUIT, GTK_ICON_SIZE_DIALOG); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (image, GTK_ALIGN_CENTER); gtk_widget_set_valign (image, GTK_ALIGN_CENTER); -#else - gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5); -#endif gtk_box_pack_start (GTK_BOX (vbox), image, TRUE, TRUE, 4); gtk_widget_show (image); @@ -112,7 +104,6 @@ static void remove_popup (GtkWidget *popup) { GdkWindow *root; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; #if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; @@ -121,15 +112,12 @@ remove_popup (GtkWidget *popup) GdkDevice *keyboard; GdkDeviceManager *device_manager; #endif -#endif - root = gdk_screen_get_root_window ( gtk_window_get_screen (GTK_WINDOW (popup))); gdk_window_remove_filter (root, (GdkFilterFunc) popup_filter, popup); gtk_widget_destroy (popup); -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_window_get_display (root); #if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); @@ -143,10 +131,6 @@ remove_popup (GtkWidget *popup) gdk_device_ungrab (pointer, GDK_CURRENT_TIME); gdk_device_ungrab (keyboard, GDK_CURRENT_TIME); #endif -#else - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gdk_keyboard_ungrab (GDK_CURRENT_TIME); -#endif } static gboolean @@ -232,11 +216,7 @@ kill_window_response (GtkDialog *dialog, gdk_error_trap_push (); XKillClient (display, window); gdk_flush (); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif } gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -348,7 +328,6 @@ panel_force_quit (GdkScreen *screen, GdkCursor *cross; GtkWidget *popup; GdkWindow *root; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; GdkDevice *pointer; GdkDevice *keyboard; @@ -357,7 +336,6 @@ panel_force_quit (GdkScreen *screen, #else GdkDeviceManager *device_manager; #endif -#endif popup = display_popup_window (screen); @@ -366,7 +344,6 @@ panel_force_quit (GdkScreen *screen, gdk_window_add_filter (root, (GdkFilterFunc) popup_filter, popup); cross = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_CROSS); -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_window_get_display (root); #if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); @@ -394,24 +371,6 @@ panel_force_quit (GdkScreen *screen, remove_popup (popup); return; } -#else - status = gdk_pointer_grab (root, FALSE, GDK_BUTTON_PRESS_MASK, - NULL, cross, time); - - gdk_cursor_unref (cross); - - if (status != GDK_GRAB_SUCCESS) { - g_warning ("Pointer grab failed\n"); - remove_popup (popup); - return; - } - status = gdk_keyboard_grab (root, FALSE, time); - if (status != GDK_GRAB_SUCCESS) { - g_warning ("Keyboard grab failed\n"); - remove_popup (popup); - return; - } -#endif gdk_flush (); } diff --git a/mate-panel/panel-frame.c b/mate-panel/panel-frame.c index b0529f1d..ca395520 100644 --- a/mate-panel/panel-frame.c +++ b/mate-panel/panel-frame.c @@ -35,7 +35,6 @@ enum { PROP_EDGES }; -#if GTK_CHECK_VERSION (3, 0, 0) static void panel_frame_get_preferred_width (GtkWidget *widget, gint *minimal_width, @@ -109,53 +108,14 @@ panel_frame_get_preferred_height (GtkWidget *widget, } } -#else -static void -panel_frame_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - PanelFrame *frame = (PanelFrame *) widget; - GtkBin *bin = (GtkBin *) widget; - GtkStyle *style; - GtkWidget *child; - int border_width; - - style = gtk_widget_get_style (widget); - border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - - requisition->width = 1; - requisition->height = 1; - - child = gtk_bin_get_child (bin); - if (child && gtk_widget_get_visible (child)) - gtk_widget_size_request (child, requisition); - - requisition->width += border_width; - requisition->height += border_width; - - if (frame->edges & PANEL_EDGE_TOP) - requisition->height += style->xthickness; - if (frame->edges & PANEL_EDGE_BOTTOM) - requisition->height += style->xthickness; - if (frame->edges & PANEL_EDGE_LEFT) - requisition->width += style->ythickness; - if (frame->edges & PANEL_EDGE_RIGHT) - requisition->width += style->ythickness; -} -#endif - static void panel_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { PanelFrame *frame = (PanelFrame *) widget; GtkBin *bin = (GtkBin *) widget; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkBorder padding; -#else - GtkStyle *style; -#endif GtkAllocation child_allocation; GtkAllocation child_allocation_current; GtkWidget *child; @@ -163,12 +123,8 @@ panel_frame_size_allocate (GtkWidget *widget, gtk_widget_set_allocation (widget, allocation); -#if GTK_CHECK_VERSION (3, 0, 0) context = gtk_widget_get_style_context (widget); gtk_style_context_get_padding (context, gtk_widget_get_state_flags (widget), &padding); -#else - style = gtk_widget_get_style (widget); -#endif border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); child_allocation.x = allocation->x + border_width; @@ -177,38 +133,20 @@ panel_frame_size_allocate (GtkWidget *widget, child_allocation.height = allocation->height - 2 * border_width; if (frame->edges & PANEL_EDGE_LEFT) { -#if GTK_CHECK_VERSION (3, 0, 0) child_allocation.x += padding.left; child_allocation.width -= padding.left; -#else - child_allocation.x += style->xthickness; - child_allocation.width -= style->xthickness; -#endif } if (frame->edges & PANEL_EDGE_TOP) { -#if GTK_CHECK_VERSION (3, 0, 0) child_allocation.y += padding.top; child_allocation.height -= padding.top; -#else - child_allocation.y += style->ythickness; - child_allocation.height -= style->ythickness; -#endif } if (frame->edges & PANEL_EDGE_RIGHT) -#if GTK_CHECK_VERSION (3, 0, 0) child_allocation.width -= padding.left; -#else - child_allocation.width -= style->xthickness; -#endif if (frame->edges & PANEL_EDGE_BOTTOM) -#if GTK_CHECK_VERSION (3, 0, 0) child_allocation.height -= padding.top; -#else - child_allocation.height -= style->ythickness; -#endif child = gtk_bin_get_child (bin); gtk_widget_get_allocation (child, &child_allocation_current); @@ -226,33 +164,21 @@ panel_frame_size_allocate (GtkWidget *widget, void panel_frame_draw (GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr, -#endif PanelFrameEdge edges) { PanelFrame *frame = (PanelFrame *) widget; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkStateFlags state; GdkRGBA *bg; GdkRGBA dark, light; GtkBorder padding; -#else - GdkWindow *window; - GtkStyle *style; - GtkStateType state; - GtkAllocation allocation; - GdkGC *dark, *light, *black; - int xthickness, ythickness; -#endif int x, y, width, height; if (edges == PANEL_EDGE_NONE) return; -#if GTK_CHECK_VERSION (3, 0, 0) context = gtk_widget_get_style_context (widget); state = gtk_widget_get_state_flags (widget); @@ -267,29 +193,11 @@ panel_frame_draw (GtkWidget *widget, gtk_style_shade (bg, &light, 1.3); gtk_style_context_get_padding (context, state, &padding); -#else - window = gtk_widget_get_window (widget); - style = gtk_widget_get_style (widget); - state = gtk_widget_get_state (widget); - - gtk_widget_get_allocation (widget, &allocation); - x = allocation.x; - y = allocation.y; - width = allocation.width; - height = allocation.height; - - dark = style->dark_gc [state]; - light = style->light_gc [state]; - black = style->black_gc; - - xthickness = style->xthickness; - ythickness = style->ythickness; -#endif + /* Copied from gtk_default_draw_shadow() */ x = y = 0; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_set_line_width (cr, 1); if (frame->edges & PANEL_EDGE_BOTTOM && padding.bottom > 0) { @@ -357,63 +265,9 @@ panel_frame_draw (GtkWidget *widget, cairo_stroke (cr); } } -#else - if (frame->edges & PANEL_EDGE_BOTTOM && ythickness > 0) { - if (ythickness > 1) { - gdk_draw_line (window, dark, - x, y + height - 2, - x + width - 1, y + height - 2); - gdk_draw_line (window, black, - x, y + height - 1, - x + width - 1, y + height - 1); - } else - gdk_draw_line (window, dark, - x, y + height - 1, - x + width - 1, y + height - 1); - } - - if (frame->edges & PANEL_EDGE_RIGHT && xthickness > 0) { - if (xthickness > 1) { - gdk_draw_line (window, dark, - x + width - 2, y, - x + width - 2, y + height - 1); - - gdk_draw_line (window, black, - x + width - 1, y, - x + width - 1, y + height - 1); - } else - gdk_draw_line (window, dark, - x + width - 1, y, - x + width - 1, y + height - 1); - } - - if (frame->edges & PANEL_EDGE_TOP && ythickness > 0) { - gdk_draw_line (window, light, - x, y, x + width - 1, y); - - if (ythickness > 1) - gdk_draw_line (window, - style->bg_gc [state], - x, y + 1, x + width - 1, y + 1); - } - - if (frame->edges & PANEL_EDGE_LEFT && xthickness > 0) { - gdk_draw_line (window, light, - x, y, x, y + height - 1); - - if (xthickness > 1) - gdk_draw_line (window, - style->bg_gc [state], - x + 1, y, x + 1, y + height - 1); - } -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean panel_frame_expose(GtkWidget* widget, cairo_t* cr) -#else -static gboolean panel_frame_expose(GtkWidget* widget, GdkEventExpose* event) -#endif { PanelFrame *frame = (PanelFrame *) widget; gboolean retval = FALSE; @@ -421,19 +275,10 @@ static gboolean panel_frame_expose(GtkWidget* widget, GdkEventExpose* event) if (!gtk_widget_is_drawable (widget)) return retval; -#if GTK_CHECK_VERSION (3, 0, 0) if (GTK_WIDGET_CLASS (panel_frame_parent_class)->draw) retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->draw (widget, cr); -#else - if (GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event) - retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event (widget, event); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) panel_frame_draw (widget, cr, frame->edges); -#else - panel_frame_draw (widget, frame->edges); -#endif return retval; } @@ -492,14 +337,9 @@ panel_frame_class_init (PanelFrameClass *klass) gobject_class->get_property = panel_frame_get_property; widget_class->size_allocate = panel_frame_size_allocate; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = panel_frame_get_preferred_width; widget_class->get_preferred_height = panel_frame_get_preferred_height; widget_class->draw = panel_frame_expose; -#else - widget_class->size_request = panel_frame_size_request; - widget_class->expose_event = panel_frame_expose; -#endif #if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "PanelFrame"); #endif diff --git a/mate-panel/panel-frame.h b/mate-panel/panel-frame.h index e5988ddb..f73ebc15 100644 --- a/mate-panel/panel-frame.h +++ b/mate-panel/panel-frame.h @@ -60,9 +60,7 @@ void panel_frame_set_edges (PanelFrame *toplevel, PanelFrameEdge panel_frame_get_edges (PanelFrame *toplevel); void panel_frame_draw (GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr, -#endif PanelFrameEdge edges); #ifdef __cplusplus diff --git a/mate-panel/panel-menu-bar.c b/mate-panel/panel-menu-bar.c index c926e5a0..c95533d7 100644 --- a/mate-panel/panel-menu-bar.c +++ b/mate-panel/panel-menu-bar.c @@ -143,13 +143,10 @@ static void panel_menu_bar_update_visibility (GSettings* settings, gchar* key, P static void panel_menu_bar_init(PanelMenuBar* menubar) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkCssProvider *provider; -#endif menubar->priv = PANEL_MENU_BAR_GET_PRIVATE(menubar); -#if GTK_CHECK_VERSION (3, 0, 0) provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, "PanelMenuBar {\n" @@ -160,7 +157,6 @@ static void panel_menu_bar_init(PanelMenuBar* menubar) GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); -#endif menubar->priv->info = NULL; @@ -315,19 +311,8 @@ static void panel_menu_bar_class_init(PanelMenuBarClass* klass) g_type_class_add_private(klass, sizeof(PanelMenuBarPrivate)); g_object_class_install_property(gobject_class, PROP_ORIENTATION, g_param_spec_enum("orientation", "Orientation", "The PanelMenuBar orientation", PANEL_TYPE_ORIENTATION, PANEL_ORIENTATION_TOP, G_PARAM_READWRITE)); - -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_rc_parse_string ( - "style \"panel-menubar-style\"\n" - "{\n" - " GtkMenuBar::shadow-type = none\n" - " GtkMenuBar::internal-padding = 0\n" - "}\n" - "class \"PanelMenuBar\" style \"panel-menubar-style\""); -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean panel_menu_bar_on_draw (GtkWidget* widget, cairo_t* cr, gpointer data) { PanelMenuBar* menubar = data; @@ -351,28 +336,6 @@ static gboolean panel_menu_bar_on_draw (GtkWidget* widget, cairo_t* cr, gpointer return FALSE; } -#else -static gboolean panel_menu_bar_on_expose (GtkWidget* widget, GdkEventExpose* event, gpointer data) -{ - PanelMenuBar* menubar = data; - - if (gtk_widget_has_focus(GTK_WIDGET(menubar))) - { - gtk_paint_focus(gtk_widget_get_style(widget), - gtk_widget_get_window(widget), - gtk_widget_get_state(GTK_WIDGET(menubar)), - NULL, - widget, - "menubar-applet", - 0, - 0, - -1, - -1); - } - - return FALSE; -} -#endif static void panel_menu_bar_load(PanelWidget* panel, gboolean locked, int position, gboolean exactpos, const char* id) { PanelMenuBar* menubar; @@ -399,11 +362,7 @@ static void panel_menu_bar_load(PanelWidget* panel, gboolean locked, int positio g_signal_connect_after(menubar, "focus-in-event", G_CALLBACK(gtk_widget_queue_draw), menubar); g_signal_connect_after(menubar, "focus-out-event", G_CALLBACK(gtk_widget_queue_draw), menubar); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect_after(menubar, "draw", G_CALLBACK(panel_menu_bar_on_draw), menubar); -#else - g_signal_connect_after(menubar, "expose-event", G_CALLBACK(panel_menu_bar_on_expose), menubar); -#endif gtk_widget_set_can_focus(GTK_WIDGET(menubar), TRUE); @@ -471,16 +430,6 @@ void panel_menu_bar_popup_menu(PanelMenuBar* menubar, guint32 activate_time) */ menu_shell = GTK_MENU_SHELL(menubar); -#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_item(menu_shell, gtk_menu_get_attach_widget(menu)); } @@ -488,10 +437,8 @@ void panel_menu_bar_change_background(PanelMenuBar* menubar) { #if GTK_CHECK_VERSION (3, 18, 0) panel_background_apply_css(&menubar->priv->panel->toplevel->background, GTK_WIDGET(menubar)); -#elif GTK_CHECK_VERSION (3, 0, 0) - panel_background_apply_css(&menubar->priv->panel->background, GTK_WIDGET(menubar)); #else - panel_background_change_background_on_widget(&menubar->priv->panel->background, GTK_WIDGET(menubar)); + panel_background_apply_css(&menubar->priv->panel->background, GTK_WIDGET(menubar)); #endif } diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c index 4fefee80..a35dba88 100644 --- a/mate-panel/panel-menu-button.c +++ b/mate-panel/panel-menu-button.c @@ -359,12 +359,8 @@ panel_menu_button_menu_deactivated (PanelMenuButton *button) { panel_toplevel_pop_autohide_disabler (button->priv->toplevel); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_unset_state_flags (GTK_WIDGET (button), GTK_STATE_FLAG_PRELIGHT); -#else - GTK_BUTTON (button)->in_button = FALSE; -#endif button_widget_set_ignore_leave (BUTTON_WIDGET (button), FALSE); } diff --git a/mate-panel/panel-menu-button.h b/mate-panel/panel-menu-button.h index 7bdd713f..829744b3 100644 --- a/mate-panel/panel-menu-button.h +++ b/mate-panel/panel-menu-button.h @@ -25,7 +25,6 @@ #ifndef __PANEL_MENU_BUTTON_H__ #define __PANEL_MENU_BUTTON_H__ -#include <gtk/gtk.h> #include "button-widget.h" #include "panel-widget.h" diff --git a/mate-panel/panel-menu-items.c b/mate-panel/panel-menu-items.c index e16e9edc..0e758254 100644 --- a/mate-panel/panel-menu-items.c +++ b/mate-panel/panel-menu-items.c @@ -1127,12 +1127,11 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item) panel_recent_append_documents_menu (places_menu, place_item->priv->recent_manager); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *toplevel = gtk_widget_get_toplevel (places_menu); GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); GdkVisual *visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(toplevel), visual); -#endif + return places_menu; } diff --git a/mate-panel/panel-multiscreen.c b/mate-panel/panel-multiscreen.c index 8f8554f0..64dda92e 100644 --- a/mate-panel/panel-multiscreen.c +++ b/mate-panel/panel-multiscreen.c @@ -410,11 +410,7 @@ panel_multiscreen_init (void) return; display = gdk_display_get_default (); -#if GTK_CHECK_VERSION (3, 0, 0) screens = 1; -#else - screens = gdk_display_get_n_screens (display); -#endif panel_multiscreen_init_randr (display); @@ -446,15 +442,8 @@ panel_multiscreen_init (void) void panel_multiscreen_reinit (void) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkScreen *screen; GList *toplevels, *l; -#else - GdkDisplay *display; - GList *toplevels, *l; - int new_screens; - int i; -#endif if (monitors) g_free (monitors); @@ -467,24 +456,8 @@ panel_multiscreen_reinit (void) g_free (geometries); } -#if GTK_CHECK_VERSION (3, 0, 0) screen = gdk_screen_get_default (); g_signal_handlers_disconnect_by_func (screen, panel_multiscreen_queue_reinit, NULL); -#else - display = gdk_display_get_default (); - /* Don't use the screens variable since in the future, we might - * want to call this function when a screen appears/disappears. */ - new_screens = gdk_display_get_n_screens (display); - - for (i = 0; i < new_screens; i++) { - GdkScreen *screen; - - screen = gdk_display_get_screen (display, i); - g_signal_handlers_disconnect_by_func (screen, - panel_multiscreen_queue_reinit, - NULL); - } -#endif initialized = FALSE; panel_multiscreen_init (); diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c index e63a0feb..2b7784d4 100644 --- a/mate-panel/panel-profile.c +++ b/mate-panel/panel-profile.c @@ -231,7 +231,6 @@ panel_profile_get_background_type (PanelToplevel *toplevel) return background_type; } -#if GTK_CHECK_VERSION (3, 0, 0) void panel_profile_set_background_color (PanelToplevel *toplevel, GdkRGBA *color) @@ -293,70 +292,6 @@ panel_profile_get_background_opacity (PanelToplevel *toplevel) panel_profile_get_background_color (toplevel, &color); return (guint16) round (color.alpha * 65535); } -#else -void -panel_profile_set_background_color (PanelToplevel *toplevel, - PanelColor *color) -{ - panel_profile_set_background_gdk_color (toplevel, &color->gdk); - panel_profile_set_background_opacity (toplevel, color->alpha); -} - -void -panel_profile_get_background_color (PanelToplevel *toplevel, - PanelColor *color) -{ - panel_profile_get_background_gdk_color (toplevel, &(color->gdk)); - color->alpha = panel_profile_get_background_opacity (toplevel); -} - -void -panel_profile_set_background_gdk_color (PanelToplevel *toplevel, - GdkColor *gdk_color) -{ - char *color_str; - - color_str = g_strdup_printf ("#%02x%02x%02x", - gdk_color->red / 256, - gdk_color->green / 256, - gdk_color->blue / 256); - - g_settings_set_string (toplevel->background_settings, "color", color_str); - - g_free (color_str); -} - -void -panel_profile_get_background_gdk_color (PanelToplevel *toplevel, - GdkColor *gdk_color) -{ - char *color_str; - - color_str = g_settings_get_string (toplevel->background_settings, "color"); - if (!color_str || !gdk_color_parse (color_str, gdk_color)) { - gdk_color->red = 0; - gdk_color->green = 0; - gdk_color->blue = 0; - } - - g_free (color_str); -} - -void -panel_profile_set_background_opacity (PanelToplevel *toplevel, - guint16 opacity) -{ - g_settings_set_int (toplevel->background_settings, "opacity", opacity); -} - -guint16 -panel_profile_get_background_opacity (PanelToplevel *toplevel) -{ - guint16 opacity; - opacity = g_settings_get_int (toplevel->background_settings, "opacity"); - return opacity; -} -#endif void panel_profile_set_background_image (PanelToplevel *toplevel, @@ -554,7 +489,6 @@ panel_profile_is_writable_attached_tooltip (PanelToplevel *toplevel) return is_writable; } -#if GTK_CHECK_VERSION (3, 0, 0) static void get_background_color (PanelToplevel *toplevel, GdkRGBA *color) @@ -570,24 +504,6 @@ get_background_color (PanelToplevel *toplevel, g_free (color_str); } -#else -static void -get_background_color (PanelToplevel *toplevel, - PanelColor *color) -{ - char *color_str; - color_str = g_settings_get_string (toplevel->background_settings, "color"); - if (!color_str || !gdk_color_parse (color_str, &(color->gdk))) { - color->gdk.red = 0; - color->gdk.green = 0; - color->gdk.blue = 0; - } - - g_free (color_str); - - color->alpha = g_settings_get_int (toplevel->background_settings, "opacity"); -} -#endif static char * get_background_image (PanelToplevel *toplevel, @@ -609,11 +525,7 @@ panel_profile_load_background (PanelToplevel *toplevel) PanelWidget *panel_widget; PanelBackground *background; PanelBackgroundType background_type; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - PanelColor color; -#endif char *image; gboolean fit; gboolean stretch; @@ -921,24 +833,12 @@ panel_profile_background_change_notify (GSettings *settings, panel_background_set_type (background, background_type); panel_toplevel_update_edges (toplevel); } else if (!strcmp (key, "color")) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; gchar *str; str = g_settings_get_string (settings, key); if (gdk_rgba_parse (&color, str)) panel_background_set_color (background, &color); g_free (str); -#else - GdkColor gdk_color; - gchar *str; - str = g_settings_get_string (settings, key); - if (gdk_color_parse (str, &gdk_color)) - panel_background_set_gdk_color (background, &gdk_color); - g_free (str); - } else if (!strcmp (key, "opacity")) { - panel_background_set_opacity (background, - g_settings_get_int (settings, key)); -#endif } else if (!strcmp (key, "image")) { gchar *value = g_settings_get_string (settings, key); panel_background_set_image (background, value); @@ -1151,33 +1051,6 @@ panel_profile_delete_toplevel (PanelToplevel *toplevel) panel_profile_remove_from_list (PANEL_GSETTINGS_TOPLEVELS, toplevel_id); } -#if !GTK_CHECK_VERSION (3, 0, 0) -static GdkScreen * -get_toplevel_screen (char *toplevel_path) -{ - GdkDisplay *display; - GSettings *settings; - int screen_n; - - settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA, toplevel_path); - screen_n = g_settings_get_int (settings, "screen"); - g_object_unref (settings); - - display = gdk_display_get_default (); - - if (screen_n < 0 || screen_n >= gdk_display_get_n_screens (display)) { -#if 0 - g_warning (_("Panel '%s' is set to be displayed on screen %d which " - "is not currently available. Not loading this panel."), - toplevel_dir, screen_n); -#endif - return NULL; - } - - return gdk_display_get_screen (display, screen_n); -} -#endif - PanelToplevel * panel_profile_load_toplevel (const char *toplevel_id) { @@ -1191,11 +1064,7 @@ panel_profile_load_toplevel (const char *toplevel_id) toplevel_path = g_strdup_printf ("%s%s/", PANEL_TOPLEVEL_PATH, toplevel_id); -#if GTK_CHECK_VERSION (3, 0, 0) screen = gdk_display_get_default_screen (gdk_display_get_default ()); -#else - screen = get_toplevel_screen (toplevel_path); -#endif if (screen == NULL) { g_free (toplevel_path); @@ -1713,15 +1582,11 @@ panel_profile_ensure_toplevel_per_screen () GSList *l; GdkDisplay *display; GdkScreen *screen; -#if !GTK_CHECK_VERSION (3, 0, 0) - int n_screens, i; -#endif toplevels = panel_toplevel_list_toplevels (); display = gdk_display_get_default (); -#if GTK_CHECK_VERSION (3, 0, 0) screen = gdk_display_get_default_screen (display); for (l = toplevels; l; l = l->next) @@ -1730,19 +1595,6 @@ panel_profile_ensure_toplevel_per_screen () if (!l) empty_screens = g_slist_prepend (empty_screens, screen); -#else - n_screens = gdk_display_get_n_screens (display); - for (i = 0; i < n_screens; i++) { - screen = gdk_display_get_screen (display, i); - - for (l = toplevels; l; l = l->next) - if (gtk_window_get_screen (l->data) == screen) - break; - - if (!l) - empty_screens = g_slist_prepend (empty_screens, screen); - } -#endif for (l = empty_screens; l; l = l->next) panel_layout_apply_default_from_gkeyfile (l->data); diff --git a/mate-panel/panel-profile.h b/mate-panel/panel-profile.h index ff690527..3648d82d 100644 --- a/mate-panel/panel-profile.h +++ b/mate-panel/panel-profile.h @@ -110,29 +110,14 @@ PanelBackgroundType panel_profile_get_background_type (PanelToplevel *toplevel); void panel_profile_set_background_color (PanelToplevel *toplevel, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *color); -#else - PanelColor *color); -#endif void panel_profile_get_background_color (PanelToplevel *toplevel, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *color); -#else - PanelColor *color); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) void panel_profile_set_background_gdk_rgba (PanelToplevel *toplevel, GdkRGBA *color); void panel_profile_get_background_gdk_rgba (PanelToplevel *toplevel, GdkRGBA *color); -#else -void panel_profile_set_background_gdk_color (PanelToplevel *toplevel, - GdkColor *gdk_color); -void panel_profile_get_background_gdk_color (PanelToplevel *toplevel, - GdkColor *gdk_color); -#endif void panel_profile_set_background_opacity (PanelToplevel *toplevel, guint16 opacity); diff --git a/mate-panel/panel-properties-dialog.c b/mate-panel/panel-properties-dialog.c index b45c0188..d2c5c8d0 100644 --- a/mate-panel/panel-properties-dialog.c +++ b/mate-panel/panel-properties-dialog.c @@ -36,10 +36,6 @@ #include <libpanel-util/panel-icon-chooser.h> #include <libpanel-util/panel-show.h> -#if !GTK_CHECK_VERSION (3, 0, 0) -#include <libmate-desktop/mate-colorbutton.h> -#endif - #include "nothing.h" #include "panel-profile.h" #include "panel-schemas.h" @@ -331,39 +327,22 @@ SETUP_TOGGLE_BUTTON ("arrows_toggle", arrows_toggle, enable_arrows, static void panel_properties_dialog_color_changed (PanelPropertiesDialog *dialog, -#if GTK_CHECK_VERSION (3, 0, 0) GtkColorChooser *color_button) -#else - MateColorButton *color_button) -#endif { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - GdkColor color; -#endif g_assert (dialog->color_button == GTK_WIDGET (color_button)); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_color_chooser_get_rgba (color_button, &color); panel_profile_set_background_gdk_rgba (dialog->toplevel, &color); panel_properties_dialog_opacity_changed (dialog); -#else - mate_color_button_get_color (color_button, &color); - panel_profile_set_background_gdk_color (dialog->toplevel, &color); -#endif } static void panel_properties_dialog_setup_color_button (PanelPropertiesDialog *dialog, GtkBuilder *gui) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - PanelColor color; -#endif dialog->color_button = PANEL_GTK_BUILDER_GET (gui, "color_button"); g_return_if_fail (dialog->color_button != NULL); @@ -372,13 +351,8 @@ panel_properties_dialog_setup_color_button (PanelPropertiesDialog *dialog, panel_profile_get_background_color (dialog->toplevel, &color); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog->color_button), &color); -#else - mate_color_button_set_color (MATE_COLOR_BUTTON (dialog->color_button), - &(color.gdk)); -#endif g_signal_connect_swapped (dialog->color_button, "color_set", G_CALLBACK (panel_properties_dialog_color_changed), @@ -722,7 +696,6 @@ static void panel_properties_dialog_update_background_color (PanelPropertiesDialog *dialog, gchar *str_color) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA new_color; GdkRGBA old_color; @@ -735,36 +708,8 @@ panel_properties_dialog_update_background_color (PanelPropertiesDialog *dialog, if (!gdk_rgba_equal (&old_color, &new_color)) gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog->color_button), &new_color); -#else - GdkColor new_color = { 0, }; - GdkColor old_color; - - if (!gdk_color_parse (str_color, &new_color)) - return; - - mate_color_button_get_color (MATE_COLOR_BUTTON (dialog->color_button), - &old_color); - - if (!gdk_color_equal (&old_color, &new_color)) - mate_color_button_set_color (MATE_COLOR_BUTTON (dialog->color_button), - &new_color); -#endif } -#if !GTK_CHECK_VERSION(3, 0, 0) -static void -panel_properties_dialog_update_background_opacity (PanelPropertiesDialog *dialog, - gint opacity) -{ - gdouble percentage; - - percentage = ((gdouble) (opacity * 100)) / 65535; - - if ((int) gtk_range_get_value (GTK_RANGE (dialog->opacity_scale)) != (int) percentage) - gtk_range_set_value (GTK_RANGE (dialog->opacity_scale), percentage); -} -#endif - static void panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog, gchar *text) @@ -800,13 +745,6 @@ panel_properties_dialog_background_notify (GSettings *settings, panel_properties_dialog_update_background_color (dialog, color); g_free (color); } -#if !GTK_CHECK_VERSION(3, 0, 0) - else if (!strcmp (key, "opacity")) - { - gint opacity = g_settings_get_int (settings, key); - panel_properties_dialog_update_background_opacity (dialog, opacity); - } -#endif else if (!strcmp (key, "image")) { char *image = g_settings_get_string (settings, key); @@ -819,11 +757,7 @@ static void panel_properties_dialog_remove_orientation_combo (PanelPropertiesDialog *dialog) { GtkContainer *container = GTK_CONTAINER (dialog->general_table); -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid = GTK_GRID (dialog->general_table); -#else - GtkTable *table = GTK_TABLE (dialog->general_table); -#endif g_object_ref (dialog->size_label); g_object_ref (dialog->size_widgets); @@ -837,17 +771,10 @@ panel_properties_dialog_remove_orientation_combo (PanelPropertiesDialog *dialog) gtk_container_remove (container, dialog->icon_label); gtk_container_remove (container, dialog->icon_align); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, dialog->size_label, 0, 1, 1, 1); gtk_grid_attach (grid, dialog->size_widgets, 1, 1, 1, 1); gtk_grid_attach (grid, dialog->icon_label, 0, 2, 1, 1); gtk_grid_attach (grid, dialog->icon_align, 1, 2, 1, 1); -#else - gtk_table_attach_defaults (table, dialog->size_label, 0, 1, 1, 2); - gtk_table_attach_defaults (table, dialog->size_widgets, 1, 2, 1, 2); - gtk_table_attach_defaults (table, dialog->icon_label, 0, 1, 2, 3); - gtk_table_attach_defaults (table, dialog->icon_align, 1, 2, 2, 3); -#endif dialog->orientation_label = NULL; dialog->orientation_combo = NULL; @@ -855,10 +782,6 @@ panel_properties_dialog_remove_orientation_combo (PanelPropertiesDialog *dialog) g_object_unref (dialog->size_widgets); g_object_unref (dialog->icon_label); g_object_unref (dialog->icon_align); - -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_table_resize (table, 3, 2); -#endif } static void @@ -872,10 +795,6 @@ panel_properties_dialog_remove_icon_chooser (PanelPropertiesDialog *dialog) dialog->icon_label = NULL; dialog->icon_align = NULL; dialog->icon_chooser = NULL; - -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_table_resize (GTK_TABLE (dialog->general_table), 3, 2); -#endif } static void @@ -983,7 +902,7 @@ panel_properties_dialog_new (PanelToplevel *toplevel, panel_widget_register_open_dialog (panel_toplevel_get_panel_widget (dialog->toplevel), dialog->properties_dialog); -#if !GTK_CHECK_VERSION (3, 0, 0) +#if 0 /* FIXME re-add once GTK3 support is fixed */ g_signal_connect (dialog->properties_dialog, "event", G_CALLBACK (config_event), @@ -1018,25 +937,15 @@ panel_properties_dialog_present (PanelToplevel *toplevel) gtk_builder_set_translation_domain (gui, GETTEXT_PACKAGE); error = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_builder_add_from_file (gui, BUILDERDIR "/panel-properties-dialog-gtk3.ui", &error); -#else - gtk_builder_add_from_file (gui, - BUILDERDIR "/panel-properties-dialog.ui", - &error); -#endif if (error) { char *secondary; secondary = g_strdup_printf (_("Unable to load file '%s': %s."), -#if GTK_CHECK_VERSION (3, 0, 0) BUILDERDIR"/panel-properties-dialog-gtk3.ui", -#else - BUILDERDIR"/panel-properties-dialog.ui", -#endif error->message); panel_error_dialog (GTK_WINDOW (toplevel), gtk_window_get_screen (GTK_WINDOW (toplevel)), diff --git a/mate-panel/panel-properties-dialog.ui b/mate-panel/panel-properties-dialog.ui deleted file mode 100644 index e57969d8..00000000 --- a/mate-panel/panel-properties-dialog.ui +++ /dev/null @@ -1,767 +0,0 @@ -<?xml version="1.0"?> -<interface> - <requires lib="gtk+" version="2.16"/> - <!-- interface-naming-policy toplevel-contextual --> - <object class="GtkDialog" id="panel_properties_dialog"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Panel Properties</property> - <property name="resizable">False</property> - <property name="window_position">center</property> - <property name="type_hint">dialog</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">2</property> - <child> - <object class="GtkNotebook" id="notebook"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="border_width">5</property> - <child> - <object class="GtkVBox" id="general_vbox"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkHBox" id="writability_warn_general"> - <child> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-dialog-warning</property> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label19"> - <property name="visible">True</property> - <property name="label" translatable="yes">Some of these properties are locked down</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkTable" id="general_table"> - <property name="visible">True</property> - <property name="n_rows">3</property> - <property name="n_columns">2</property> - <property name="column_spacing">12</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkAlignment" id="icon_align"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xscale">0</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="icon_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="label" translatable="yes">_Icon:</property> - <property name="use_markup">True</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkHBox" id="size_widgets"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkSpinButton" id="size_spin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> - <property name="climb_rate">1</property> - <property name="numeric">True</property> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="size_label_pixels"> - <property name="visible">True</property> - <property name="label" translatable="yes">pixels</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="size_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Size:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">size_spin</property> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="orientation_combo"> - <property name="visible">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="orientation_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Orientation:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">orientation_combo</property> - </object> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="expand_toggle"> - <property name="label" translatable="yes">E_xpand</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="autohide_toggle"> - <property name="label" translatable="yes">_Autohide</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox2"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkCheckButton" id="hidebuttons_toggle"> - <property name="label" translatable="yes">Show hide _buttons</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="no"> </property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="arrows_toggle"> - <property name="label" translatable="yes">Arro_ws on hide buttons</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> - <child type="tab"> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes">General</property> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox5"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkHBox" id="writability_warn_background"> - <child> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="stock">gtk-dialog-warning</property> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="label" translatable="yes">Some of these properties are locked down</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="default_radio"> - <property name="label" translatable="yes">_None (use system theme)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox4"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkRadioButton" id="color_radio"> - <property name="label" translatable="yes">Solid c_olor</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">default_radio</property> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="color_widgets"> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table3"> - <property name="visible">True</property> - <property name="n_rows">3</property> - <property name="n_columns">2</property> - <property name="column_spacing">12</property> - <property name="row_spacing">6</property> - <child> - <object class="MateColorButton" id="color_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="title" translatable="yes">Pick a color</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkLabel" id="opacity_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">S_tyle:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">opacity_scale</property> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkHScale" id="opacity_scale"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> - <property name="draw_value">False</property> - <accessibility> - <relation type="labelled-by" target="opacity_label"/> - </accessibility> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="color_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Co_lor:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">color_button</property> - </object> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkHBox" id="opacity_legend"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="xalign">1</property> - <property name="yalign">0</property> - <property name="label" translatable="yes"><small>Transparent</small></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="label" translatable="yes"><small>Opaque</small></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox6"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkRadioButton" id="image_radio"> - <property name="label" translatable="yes">Background _image:</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">default_radio</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="image_widgets"> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkFileChooserButton" id="image_chooser"> - <property name="visible">True</property> - <property name="title" translatable="yes">Select background</property> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="position">4</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child type="tab"> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="label" translatable="yes">Background</property> - </object> - <packing> - <property name="position">1</property> - <property name="tab_fill">False</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <child> - <object class="GtkButton" id="helpbutton1"> - <property name="label">gtk-help</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="closebutton1"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-11">helpbutton1</action-widget> - <action-widget response="-7">closebutton1</action-widget> - </action-widgets> - </object> - <object class="GtkDialog" id="image_details_dialog"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Image Background Details</property> - <property name="resizable">False</property> - <property name="type_hint">dialog</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox2"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkVBox" id="vbox3"> - <property name="visible">True</property> - <property name="border_width">5</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <placeholder/> - </child> - <child> - <object class="GtkVBox" id="vbox4"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkRadioButton" id="tile_radio"> - <property name="label" translatable="yes">_Tile</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="scale_radio"> - <property name="label" translatable="yes">_Scale</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">tile_radio</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="stretch_radio"> - <property name="label" translatable="yes">St_retch</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">tile_radio</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="rotate_toggle"> - <property name="label" translatable="yes">Rotate image when panel is _vertical</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area2"> - <property name="visible">True</property> - <child> - <object class="GtkButton" id="helpbutton2"> - <property name="label">gtk-help</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="closebutton2"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-11">helpbutton2</action-widget> - <action-widget response="-7">closebutton2</action-widget> - </action-widgets> - </object> - <object class="GtkAdjustment" id="adjustment1"> - <property name="value">33.75</property> - <property name="upper">100</property> - <property name="step_increment">5</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment2"> - <property name="value">12</property> - <property name="lower">12</property> - <property name="upper">120</property> - <property name="step_increment">1</property> - <property name="page_increment">12</property> - </object> -</interface> diff --git a/mate-panel/panel-reset.c b/mate-panel/panel-reset.c index 6670fc17..cdeba7ed 100644 --- a/mate-panel/panel-reset.c +++ b/mate-panel/panel-reset.c @@ -27,7 +27,7 @@ #define __PANEL_RESET_C__ #include <stdlib.h> -#include <glib.h> +#include <gio/gio.h> #include "panel-reset.h" #include "panel-schemas.h" diff --git a/mate-panel/panel-reset.h b/mate-panel/panel-reset.h index 125b6b3d..f9b6e33a 100644 --- a/mate-panel/panel-reset.h +++ b/mate-panel/panel-reset.h @@ -22,8 +22,6 @@ #ifndef __PANEL_RESET_H__ #define __PANEL_RESET_H__ -#include <gtk/gtk.h> - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/mate-panel/panel-run-dialog.c b/mate-panel/panel-run-dialog.c index 61361dc1..769c5377 100644 --- a/mate-panel/panel-run-dialog.c +++ b/mate-panel/panel-run-dialog.c @@ -271,12 +271,7 @@ panel_run_dialog_set_icon (PanelRunDialog *dialog, GtkIconTheme *icon_theme = gtk_icon_theme_get_default (); GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, size, 0); pixbuf = gtk_icon_info_load_icon (icon_info, NULL); -#if GTK_CHECK_VERSION (3, 8, 0) g_object_unref (icon_info); -#else - gtk_icon_info_free (icon_info); -#endif - } if (pixbuf) { @@ -291,11 +286,7 @@ panel_run_dialog_set_icon (PanelRunDialog *dialog, //(ditto for the drag icon?) gtk_window_set_icon (GTK_WINDOW (dialog->run_dialog), pixbuf); -#if GTK_CHECK_VERSION (3, 2, 0) gtk_drag_source_set_icon_gicon (dialog->run_dialog, dialog->icon); -#else - gtk_drag_source_set_icon_pixbuf (dialog->run_dialog, pixbuf); -#endif g_object_unref (pixbuf); } else { panel_run_dialog_set_default_icon (dialog, TRUE); @@ -436,8 +427,8 @@ panel_run_dialog_execute (PanelRunDialog *dialog) } /* evil eggies, do not translate! */ -#if !GTK_CHECK_VERSION (3, 0, 0) /* FIXME re-add once GTK3 support is fixed */ +#if 0 if (!strcmp (command, "free the fish")) { start_screen_check (); @@ -1833,14 +1824,8 @@ pixmap_drag_data_get (GtkWidget *run_dialog, } static void -#if GTK_CHECK_VERSION (3, 0, 0) panel_run_dialog_style_updated (GtkWidget *widget, PanelRunDialog *dialog) -#else -panel_run_dialog_style_set (GtkWidget *widget, - GtkStyle *prev_style, - PanelRunDialog *dialog) -#endif { if (dialog->icon) { GIcon *icon; @@ -1871,15 +1856,9 @@ panel_run_dialog_setup_pixmap (PanelRunDialog *dialog, { dialog->pixmap = PANEL_GTK_BUILDER_GET (gui, "icon_pixmap"); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (dialog->pixmap, "style-updated", G_CALLBACK (panel_run_dialog_style_updated), dialog); -#else - g_signal_connect (dialog->pixmap, "style-set", - G_CALLBACK (panel_run_dialog_style_set), - dialog); -#endif g_signal_connect (dialog->pixmap, "screen-changed", G_CALLBACK (panel_run_dialog_screen_changed), dialog); @@ -1940,15 +1919,9 @@ panel_run_dialog_new (GdkScreen *screen, static void panel_run_dialog_disconnect_pixmap (PanelRunDialog *dialog) { -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_handlers_disconnect_by_func (dialog->pixmap, G_CALLBACK (panel_run_dialog_style_updated), dialog); -#else - g_signal_handlers_disconnect_by_func (dialog->pixmap, - G_CALLBACK (panel_run_dialog_style_set), - dialog); -#endif g_signal_handlers_disconnect_by_func (dialog->pixmap, G_CALLBACK (panel_run_dialog_screen_changed), dialog); diff --git a/mate-panel/panel-run-dialog.h b/mate-panel/panel-run-dialog.h index 5e491d5a..49adc49c 100644 --- a/mate-panel/panel-run-dialog.h +++ b/mate-panel/panel-run-dialog.h @@ -25,7 +25,7 @@ #ifndef __PANEL_RUN_DIALOG_H__ #define __PANEL_RUN_DIALOG_H__ -#include <gtk/gtk.h> +#include <gdk/gdk.h> G_BEGIN_DECLS diff --git a/mate-panel/panel-separator.c b/mate-panel/panel-separator.c index 33a56768..5982196a 100644 --- a/mate-panel/panel-separator.c +++ b/mate-panel/panel-separator.c @@ -41,7 +41,6 @@ struct _PanelSeparatorPrivate { G_DEFINE_TYPE (PanelSeparator, panel_separator, GTK_TYPE_EVENT_BOX) -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean panel_separator_draw (GtkWidget *widget, cairo_t *cr) { @@ -97,50 +96,6 @@ panel_separator_draw (GtkWidget *widget, cairo_t *cr) return FALSE; } -#else - -static gboolean -panel_separator_expose_event (GtkWidget *widget, GdkEventExpose *event) -{ - PanelSeparator *separator; - GtkStyle *style; - GdkWindow *window; - GtkAllocation allocation; - - separator = PANEL_SEPARATOR (widget); - - if (!gtk_widget_is_drawable(widget)) - return FALSE; - - GTK_WIDGET_CLASS(panel_separator_parent_class)->expose_event(widget, event); - - style = gtk_widget_get_style (widget); - window = gtk_widget_get_window (widget); - gtk_widget_get_allocation (widget, &allocation); - - if (separator->priv->orientation == GTK_ORIENTATION_HORIZONTAL) { - gtk_paint_vline (style, - window, - gtk_widget_get_state (widget), - &event->area, widget, "separator", - style->xthickness, - allocation.height - style->xthickness, - (allocation.width - style->xthickness) / 2); - } else { - gtk_paint_hline (style, - window, - gtk_widget_get_state (widget), - &event->area, widget, "separator", - style->ythickness, - allocation.width - style->ythickness, - (allocation.height - style->ythickness) / 2); - } - - return FALSE; -} -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) static void panel_separator_get_preferred_width (GtkWidget *widget, gint *minimal_width, @@ -176,27 +131,6 @@ panel_separator_get_preferred_height (GtkWidget *widget, else *minimal_height = *natural_height = size; } -#else -static void -panel_separator_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - PanelSeparator *separator; - int size; - - separator = PANEL_SEPARATOR (widget); - - size = panel_toplevel_get_size (separator->priv->panel->toplevel); - - if (separator->priv->orientation == GTK_ORIENTATION_VERTICAL) { - requisition->width = size; - requisition->height = SEPARATOR_SIZE; - } else { - requisition->width = SEPARATOR_SIZE; - requisition->height = size; - } -} -#endif static void panel_separator_size_allocate (GtkWidget *widget, @@ -252,14 +186,9 @@ panel_separator_class_init (PanelSeparatorClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = panel_separator_draw; widget_class->get_preferred_width = panel_separator_get_preferred_width; widget_class->get_preferred_height = panel_separator_get_preferred_height; -#else - widget_class->expose_event = panel_separator_expose_event; - widget_class->size_request = panel_separator_size_request; -#endif widget_class->size_allocate = panel_separator_size_allocate; widget_class->parent_set = panel_separator_parent_set; @@ -352,9 +281,7 @@ panel_separator_change_background (PanelSeparator *separator) { #if GTK_CHECK_VERSION (3, 18, 0) panel_background_apply_css(&separator->priv->panel->toplevel->background, GTK_WIDGET(separator)); -#elif GTK_CHECK_VERSION (3, 0, 0) - panel_background_apply_css(&separator->priv->panel->background, GTK_WIDGET(separator)); #else - panel_background_change_background_on_widget(&separator->priv->panel->background, GTK_WIDGET(separator)); + panel_background_apply_css(&separator->priv->panel->background, GTK_WIDGET(separator)); #endif } diff --git a/mate-panel/panel-session.c b/mate-panel/panel-session.c index 6377c4ac..109500e1 100644 --- a/mate-panel/panel-session.c +++ b/mate-panel/panel-session.c @@ -23,17 +23,11 @@ */ #include <config.h> - #include <stdlib.h> - -#include <gtk/gtk.h> -#include <gdk/gdk.h> #include <gdk/gdkx.h> - #include <libegg/eggsmclient.h> #include "panel-shell.h" - #include "panel-session.h" static gboolean do_not_restart = FALSE; diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index b3a886a6..5fa785b3 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -146,11 +146,7 @@ struct _PanelToplevelPrivate { PanelWidget *panel_widget; PanelFrame *inner_frame; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *hide_button_top; GtkWidget *hide_button_bottom; GtkWidget *hide_button_left; @@ -442,7 +438,6 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp GdkWindow *window; GdkCursorType cursor_type; GdkCursor *cursor; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; #if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; @@ -452,7 +447,6 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp GdkDevice *keyboard; GdkDeviceManager *device_manager; #endif -#endif if (toplevel->priv->state != PANEL_STATE_NORMAL || toplevel->priv->grab_op != PANEL_GRAB_OP_NONE) @@ -508,7 +502,6 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp cursor = gdk_cursor_new_for_display (gdk_display_get_default (), cursor_type); -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_window_get_display (window); #if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); @@ -520,7 +513,6 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp NULL, NULL, NULL); g_object_unref (cursor); -} #else device_manager = gdk_display_get_device_manager (display); pointer = gdk_device_manager_get_client_pointer (device_manager); @@ -538,24 +530,12 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp GDK_OWNERSHIP_NONE, FALSE, GDK_KEY_PRESS | GDK_KEY_RELEASE, NULL, time_); -} #endif -#else - gdk_pointer_grab (window, FALSE, - GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - NULL, cursor, time_); - - gdk_cursor_unref (cursor); - - if (grab_keyboard) - gdk_keyboard_grab (window, FALSE, time_); } -#endif static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) { GtkWidget *widget; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; #if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; @@ -564,8 +544,6 @@ static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) GdkDevice *keyboard; GdkDeviceManager *device_manager; #endif -#endif - g_return_if_fail (toplevel->priv->grab_op != PANEL_GRAB_OP_NONE); widget = GTK_WIDGET (toplevel); @@ -575,7 +553,6 @@ static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) gtk_grab_remove (widget); -#if GTK_CHECK_VERSION (3, 0, 0) display = gtk_widget_get_display (widget); #if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); @@ -589,10 +566,6 @@ static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) gdk_device_ungrab (pointer, time_); gdk_device_ungrab (keyboard, time_); #endif -#else - gdk_pointer_ungrab (time_); - gdk_keyboard_ungrab (time_); -#endif } static void panel_toplevel_cancel_grab_op(PanelToplevel* toplevel, guint32 time_) @@ -891,9 +864,7 @@ static gboolean panel_toplevel_warp_pointer_increment(PanelToplevel* toplevel, i { GdkScreen *screen; GdkWindow *root_window; -#if GTK_CHECK_VERSION(3, 0, 0) GdkDevice *device; -#endif int new_x, new_y; screen = gtk_window_get_screen (GTK_WINDOW (toplevel)); @@ -901,11 +872,9 @@ static gboolean panel_toplevel_warp_pointer_increment(PanelToplevel* toplevel, i #if GTK_CHECK_VERSION(3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET(root_window)))); gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET (root_window)), device, &new_x, &new_y, NULL); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET(root_window)))); gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET (root_window)), device, &new_x, &new_y, NULL); -#else - gdk_window_get_pointer (root_window, &new_x, &new_y, NULL); #endif switch (keyval) { @@ -1211,7 +1180,6 @@ static void panel_toplevel_hide_button_clicked(PanelToplevel* toplevel, GtkButto panel_toplevel_unhide (toplevel); } -#if GTK_CHECK_VERSION(3, 14, 0) static void set_arrow_type (GtkImage *image, GtkArrowType arrow_type) @@ -1233,20 +1201,12 @@ set_arrow_type (GtkImage *image, break; } } -#endif static GtkWidget * panel_toplevel_add_hide_button (PanelToplevel *toplevel, GtkArrowType arrow_type, -#if GTK_CHECK_VERSION (3, 0, 0) int left, int top) -#else - int left_attach, - int right_attach, - int top_attach, - int bottom_attach) -#endif { GtkWidget *button; AtkObject *obj; @@ -1280,18 +1240,10 @@ panel_toplevel_add_hide_button (PanelToplevel *toplevel, break; } -#if GTK_CHECK_VERSION(3, 14, 0) arrow = gtk_image_new (); set_arrow_type (GTK_IMAGE (arrow), arrow_type); -#else - arrow = gtk_arrow_new (arrow_type, GTK_SHADOW_NONE); -#endif -#if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(GTK_WIDGET(arrow), 0); gtk_widget_set_margin_end(GTK_WIDGET(arrow), 0); -#else - gtk_misc_set_padding (GTK_MISC (arrow), 0, 0); -#endif gtk_container_add (GTK_CONTAINER (button), arrow); gtk_widget_show (arrow); @@ -1306,20 +1258,7 @@ panel_toplevel_add_hide_button (PanelToplevel *toplevel, g_signal_connect_swapped (button, "button_release_event", G_CALLBACK (panel_toplevel_hide_button_event), toplevel); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (toplevel->priv->grid), button, left, top, 1, 1); -#else - gtk_table_attach (GTK_TABLE (toplevel->priv->table), - button, - left_attach, - right_attach, - top_attach, - bottom_attach, - GTK_FILL, - GTK_FILL, - 0, - 0); -#endif return button; } @@ -1423,7 +1362,7 @@ static gboolean panel_toplevel_contains_pointer(PanelToplevel* toplevel) #if GTK_CHECK_VERSION(3, 20, 0) GdkSeat *seat; GdkDevice *pointer; -#elif GTK_CHECK_VERSION (3, 0, 0) +#else GdkDeviceManager *device_manager; GdkDevice *pointer; #endif @@ -1433,7 +1372,7 @@ static gboolean panel_toplevel_contains_pointer(PanelToplevel* toplevel) #if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); pointer = gdk_seat_get_pointer (seat); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else device_manager = gdk_display_get_device_manager (display); pointer = gdk_device_manager_get_client_pointer (device_manager); #endif @@ -1444,11 +1383,7 @@ static gboolean panel_toplevel_contains_pointer(PanelToplevel* toplevel) screen = NULL; x = y = -1; -#if GTK_CHECK_VERSION (3, 0, 0) gdk_device_get_position (pointer, &screen, &x, &y); -#else - gdk_display_get_pointer (display, &screen, &x, &y, NULL); -#endif if (screen != gtk_window_get_screen (GTK_WINDOW (toplevel))) return FALSE; @@ -1604,9 +1539,6 @@ void panel_toplevel_update_edges(PanelToplevel* toplevel) PanelFrameEdge edges; PanelFrameEdge inner_edges; PanelFrameEdge outer_edges; -#if !GTK_CHECK_VERSION (3, 0, 0) - PanelBackground *background; -#endif int monitor_width, monitor_height; int width, height; gboolean inner_frame = FALSE; @@ -1620,55 +1552,46 @@ void panel_toplevel_update_edges(PanelToplevel* toplevel) height = toplevel->priv->geometry.height; edges = PANEL_EDGE_NONE; -#if !GTK_CHECK_VERSION (3, 0, 0) - background = &toplevel->priv->panel_widget->background; -#endif /* We don't want any bevels with a color/image background */ -#if !GTK_CHECK_VERSION(3, 0, 0) - if (panel_background_effective_type (background) == PANEL_BACK_NONE) { -#endif - if (toplevel->priv->geometry.y > 0) - edges |= PANEL_EDGE_TOP; - - if (toplevel->priv->geometry.x > 0) - edges |= PANEL_EDGE_LEFT; - - if (toplevel->priv->geometry.y < (monitor_height - height)) - edges |= PANEL_EDGE_BOTTOM; - - if (toplevel->priv->geometry.x < (monitor_width - width)) - edges |= PANEL_EDGE_RIGHT; - - /* There is a conflict in the position algorithm when a - * non-expanded centered panel is nearly the size of the - * screen. This is similar to the one we have in - * panel_toplevel_update_position(). A simple solution is - * to keep the bevels in this case. */ - if (!toplevel->priv->expand && - toplevel->priv->orientation & PANEL_HORIZONTAL_MASK && - toplevel->priv->x_centered) - edges |= PANEL_EDGE_LEFT | PANEL_EDGE_RIGHT; - - if (!toplevel->priv->expand && - toplevel->priv->orientation & PANEL_VERTICAL_MASK && - toplevel->priv->y_centered) - edges |= PANEL_EDGE_TOP | PANEL_EDGE_BOTTOM; - - if (gtk_widget_get_visible (toplevel->priv->hide_button_left) || - gtk_widget_get_visible (toplevel->priv->hide_button_right)) { - inner_frame = TRUE; - edges |= PANEL_EDGE_LEFT | PANEL_EDGE_RIGHT; - } + if (toplevel->priv->geometry.y > 0) + edges |= PANEL_EDGE_TOP; - if (gtk_widget_get_visible (toplevel->priv->hide_button_top) || - gtk_widget_get_visible (toplevel->priv->hide_button_bottom)) { - inner_frame = TRUE; - edges |= PANEL_EDGE_TOP | PANEL_EDGE_BOTTOM; - } -#if !GTK_CHECK_VERSION(3, 0, 0) + if (toplevel->priv->geometry.x > 0) + edges |= PANEL_EDGE_LEFT; + + if (toplevel->priv->geometry.y < (monitor_height - height)) + edges |= PANEL_EDGE_BOTTOM; + + if (toplevel->priv->geometry.x < (monitor_width - width)) + edges |= PANEL_EDGE_RIGHT; + + /* There is a conflict in the position algorithm when a + * non-expanded centered panel is nearly the size of the + * screen. This is similar to the one we have in + * panel_toplevel_update_position(). A simple solution is + * to keep the bevels in this case. */ + if (!toplevel->priv->expand && + toplevel->priv->orientation & PANEL_HORIZONTAL_MASK && + toplevel->priv->x_centered) + edges |= PANEL_EDGE_LEFT | PANEL_EDGE_RIGHT; + + if (!toplevel->priv->expand && + toplevel->priv->orientation & PANEL_VERTICAL_MASK && + toplevel->priv->y_centered) + edges |= PANEL_EDGE_TOP | PANEL_EDGE_BOTTOM; + + if (gtk_widget_get_visible (toplevel->priv->hide_button_left) || + gtk_widget_get_visible (toplevel->priv->hide_button_right)) { + inner_frame = TRUE; + edges |= PANEL_EDGE_LEFT | PANEL_EDGE_RIGHT; + } + + if (gtk_widget_get_visible (toplevel->priv->hide_button_top) || + gtk_widget_get_visible (toplevel->priv->hide_button_bottom)) { + inner_frame = TRUE; + edges |= PANEL_EDGE_TOP | PANEL_EDGE_BOTTOM; } -#endif if (!inner_frame) { inner_edges = PANEL_EDGE_NONE; @@ -2360,7 +2283,6 @@ panel_toplevel_update_position (PanelToplevel *toplevel) #endif /* There's no bevels with a color/image background */ if (panel_background_effective_type (background) == PANEL_BACK_NONE) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkStateFlags state; GdkRectangle *geometry; @@ -2389,34 +2311,7 @@ panel_toplevel_update_position (PanelToplevel *toplevel) if (y + padding.top >= max_size && y < max_size && !toplevel->priv->y_centered) y = max_size; - } -#else - GtkStyle *style; - GdkRectangle *geometry; - int max_size; - - style = gtk_widget_get_style (GTK_WIDGET (toplevel->priv->inner_frame)); - geometry = &toplevel->priv->geometry; - - if (x <= style->xthickness && x > 0 && - !toplevel->priv->x_centered) - x = 0; - - if (y <= style->ythickness && y > 0 && - !toplevel->priv->y_centered) - y = 0; - - max_size = monitor_width - geometry->width - style->xthickness; - if (x + style->xthickness >= max_size && x < max_size && - !toplevel->priv->x_centered) - x = max_size; - - max_size = monitor_height - geometry->height - style->ythickness; - if (y + style->ythickness >= max_size && y < max_size && - !toplevel->priv->y_centered) - y = max_size; } -#endif x += panel_multiscreen_x (screen, toplevel->priv->monitor); y += panel_multiscreen_y (screen, toplevel->priv->monitor); @@ -2429,14 +2324,10 @@ static int calculate_minimum_height (GtkWidget *widget, PanelOrientation 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; #if !GTK_CHECK_VERSION (3, 20, 0) @@ -2447,7 +2338,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); gtk_style_context_get(style_context, state, GTK_STYLE_PROPERTY_FONT, &font_desc, NULL); @@ -2457,14 +2347,7 @@ calculate_minimum_height (GtkWidget *widget, font_desc, pango_context_get_language (pango_context)); gtk_style_context_get_padding (style_context, state, &padding); -#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); @@ -2477,7 +2360,6 @@ calculate_minimum_height (GtkWidget *widget, NULL); #endif -#if GTK_CHECK_VERSION (3, 0, 0) thickness = orientation & PANEL_HORIZONTAL_MASK ? padding.top + padding.bottom : padding.left + padding.right; @@ -2488,14 +2370,6 @@ calculate_minimum_height (GtkWidget *widget, return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad) + thickness; #endif } -#else - thickness = orientation & PANEL_HORIZONTAL_MASK ? - style->ythickness : - style->xthickness; - - return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad + thickness); -} -#endif static int panel_toplevel_update_size_from_hints (PanelToplevel *toplevel, @@ -2589,13 +2463,9 @@ panel_toplevel_update_size (PanelToplevel *toplevel, GtkRequisition *requisition) { GtkWidget *widget; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkStateFlags state; GtkBorder padding; -#else - GtkStyle *style; -#endif int monitor_width, monitor_height; int width, height; int minimum_height; @@ -2605,13 +2475,9 @@ panel_toplevel_update_size (PanelToplevel *toplevel, return; widget = GTK_WIDGET (toplevel); -#if GTK_CHECK_VERSION (3, 0, 0) context = gtk_widget_get_style_context (widget); state = gtk_widget_get_state_flags (widget); gtk_style_context_get_padding (context, state, &padding); -#else - style = gtk_widget_get_style (widget); -#endif panel_toplevel_get_monitor_geometry ( toplevel, NULL, NULL, &monitor_width, &monitor_height); @@ -2689,7 +2555,6 @@ panel_toplevel_update_size (PanelToplevel *toplevel, height = MAX (MINIMUM_WIDTH, height); } -#if GTK_CHECK_VERSION (3, 0, 0) if (toplevel->priv->edges & PANEL_EDGE_TOP) height += padding.top; if (toplevel->priv->edges & PANEL_EDGE_BOTTOM) @@ -2698,16 +2563,6 @@ panel_toplevel_update_size (PanelToplevel *toplevel, width += padding.left; if (toplevel->priv->edges & PANEL_EDGE_RIGHT) width += padding.right; -#else - if (toplevel->priv->edges & PANEL_EDGE_TOP) - height += style->ythickness; - if (toplevel->priv->edges & PANEL_EDGE_BOTTOM) - height += style->ythickness; - if (toplevel->priv->edges & PANEL_EDGE_LEFT) - width += style->ythickness; - if (toplevel->priv->edges & PANEL_EDGE_RIGHT) - width += style->ythickness; -#endif toplevel->priv->geometry.width = CLAMP (width, 0, monitor_width); toplevel->priv->geometry.height = CLAMP (height, 0, monitor_height); @@ -2856,11 +2711,7 @@ panel_toplevel_reverse_arrow (PanelToplevel *toplevel, g_object_set_data (G_OBJECT (button), "arrow-type", GINT_TO_POINTER (arrow_type)); -#if GTK_CHECK_VERSION(3, 14, 0) set_arrow_type (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))), arrow_type); -#else - gtk_arrow_set (GTK_ARROW (gtk_bin_get_child (GTK_BIN (button))), arrow_type, GTK_SHADOW_NONE); -#endif } static void @@ -3292,11 +3143,7 @@ panel_toplevel_check_resize (GtkContainer *container) requisition.width = -1; requisition.height = -1; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (widget, &requisition, NULL); -#else - gtk_widget_size_request (widget, &requisition); -#endif gtk_widget_get_allocation (widget, &allocation); allocation.width = requisition.width; @@ -3325,11 +3172,7 @@ panel_toplevel_size_request (GtkWidget *widget, child = gtk_bin_get_child (bin); if (child && gtk_widget_get_visible (child)) -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (child, requisition, NULL); -#else - gtk_widget_size_request (child, requisition); -#endif old_geometry = toplevel->priv->geometry; @@ -3352,7 +3195,6 @@ panel_toplevel_size_request (GtkWidget *widget, panel_toplevel_move_resize_window (toplevel, position_changed, size_changed); } -#if GTK_CHECK_VERSION (3, 0, 0) static void panel_toplevel_get_preferred_width (GtkWidget *widget, gint *minimum_width, @@ -3372,7 +3214,6 @@ panel_toplevel_get_preferred_height (GtkWidget *widget, panel_toplevel_size_request (widget, &req); *minimum_height = *natural_height = req.height; } -#endif #if GTK_CHECK_VERSION (3, 18, 0) static void @@ -3413,13 +3254,9 @@ panel_toplevel_size_allocate (GtkWidget *widget, { PanelToplevel *toplevel = (PanelToplevel *) widget; GtkBin *bin = (GtkBin *) widget; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkStateFlags state; GtkBorder padding; -#else - GtkStyle *style; -#endif GtkWidget *child; GtkAllocation challoc; GtkAllocation child_allocation; @@ -3444,7 +3281,6 @@ panel_toplevel_size_allocate (GtkWidget *widget, } } -#if GTK_CHECK_VERSION (3, 0, 0) state = gtk_widget_get_state_flags (widget); context = gtk_widget_get_style_context (widget); gtk_style_context_get_padding (context, state, &padding); @@ -3464,25 +3300,6 @@ panel_toplevel_size_allocate (GtkWidget *widget, if (toplevel->priv->edges & PANEL_EDGE_RIGHT) challoc.width -= padding.right; -#else - style = gtk_widget_get_style (widget); - - if (toplevel->priv->edges & PANEL_EDGE_TOP) { - challoc.y += style->ythickness; - challoc.height -= style->ythickness; - } - - if (toplevel->priv->edges & PANEL_EDGE_LEFT) { - challoc.x += style->xthickness; - challoc.width -= style->xthickness; - } - - if (toplevel->priv->edges & PANEL_EDGE_BOTTOM) - challoc.height -= style->ythickness; - - if (toplevel->priv->edges & PANEL_EDGE_RIGHT) - challoc.width -= style->xthickness; -#endif challoc.width = MAX (1, challoc.width); challoc.height = MAX (1, challoc.height); @@ -3509,52 +3326,31 @@ panel_toplevel_size_allocate (GtkWidget *widget, #endif } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean panel_toplevel_draw(GtkWidget* widget, cairo_t* cr) -#else -static gboolean panel_toplevel_expose(GtkWidget* widget, GdkEventExpose* event) -#endif { PanelToplevel* toplevel = (PanelToplevel*) widget; PanelFrameEdge edges; gboolean retval = FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) int awidth; int aheight; GtkStyleContext *context; GtkStateFlags state; GtkBorder padding; -#else - GdkWindow *window; - GtkStyle *style; - GtkStateType state; - GtkAllocation allocation; -#endif if (!gtk_widget_is_drawable (widget)) return retval; -#if GTK_CHECK_VERSION (3, 0, 0) if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->draw) retval = GTK_WIDGET_CLASS (panel_toplevel_parent_class)->draw (widget, cr); -#else - if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->expose_event) - retval = GTK_WIDGET_CLASS (panel_toplevel_parent_class)->expose_event (widget, event); -#endif edges = toplevel->priv->edges; -#if GTK_CHECK_VERSION (3, 0, 0) panel_frame_draw (widget, cr, edges); -#else - panel_frame_draw (widget, edges); -#endif if (toplevel->priv->expand || toplevel->priv->buttons_enabled || toplevel->priv->attached) return retval; -#if GTK_CHECK_VERSION (3, 0, 0) state = gtk_widget_get_state_flags (widget); awidth = gtk_widget_get_allocated_width (widget); aheight = gtk_widget_get_allocated_height (widget); @@ -3564,185 +3360,66 @@ static gboolean panel_toplevel_expose(GtkWidget* widget, GdkEventExpose* event) gtk_style_context_save (context); gtk_style_context_set_state (context, state); -#else - window = gtk_widget_get_window (widget); - style = gtk_widget_get_style (widget); - state = gtk_widget_get_state (widget); - gtk_widget_get_allocation (widget, &allocation); -#endif if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK) { int x, y, width, height; -#if GTK_CHECK_VERSION (3, 0, 0) x = 0; y = 0; height = aheight; -#else - int xthickness, ythickness; - x = allocation.x; - y = allocation.y; - height = allocation.height; -#endif width = HANDLE_SIZE; -#if !GTK_CHECK_VERSION(3, 0, 0) - xthickness = style->xthickness; - ythickness = style->ythickness; -#endif - if (edges & PANEL_EDGE_TOP) { -#if GTK_CHECK_VERSION (3, 0, 0) y += padding.top; height -= padding.top; -#else - y += ythickness; - height -= ythickness; -#endif } if (edges & PANEL_EDGE_BOTTOM) -#if GTK_CHECK_VERSION (3, 0, 0) height -= padding.bottom; -#else - height -= ythickness; -#endif if (edges & PANEL_EDGE_LEFT) -#if GTK_CHECK_VERSION (3, 0, 0) x += padding.left; -#else - x += xthickness; -#endif -#if GTK_CHECK_VERSION (3, 0, 0) cairo_save (cr); gtk_render_handle (context, cr, x, y, width, height); cairo_restore (cr); -#else - gtk_paint_handle (style, - window, - state, - GTK_SHADOW_OUT, - &event->area, - widget, "handlebox", - x, y, width, height, - GTK_ORIENTATION_VERTICAL); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) x = awidth - HANDLE_SIZE; -#else - x = allocation.width - HANDLE_SIZE; -#endif if (edges & PANEL_EDGE_RIGHT) -#if GTK_CHECK_VERSION (3, 0, 0) x -= padding.right; -#else - x -= xthickness; -#endif -#if GTK_CHECK_VERSION(3, 0, 0) cairo_save (cr); gtk_render_handle (context, cr, x, y, width, height); cairo_restore (cr); -#else - gtk_paint_handle (style, - window, - state, - GTK_SHADOW_OUT, - &event->area, - widget, "handlebox", - x, y, width, height, - GTK_ORIENTATION_VERTICAL); -#endif } else { int x, y, width, height; -#if GTK_CHECK_VERSION (3, 0, 0) x = 0; y = 0; width = awidth; -#else - int xthickness, ythickness; - - x = allocation.x; - y = allocation.y; - width = allocation.width; -#endif height = HANDLE_SIZE; -#if !GTK_CHECK_VERSION (3, 0, 0) - xthickness = style->xthickness; - ythickness = style->ythickness; -#endif - if (edges & PANEL_EDGE_LEFT) { -#if GTK_CHECK_VERSION (3, 0, 0) x += padding.left; width -= padding.left; -#else - x += xthickness; - width -= xthickness; -#endif } if (edges & PANEL_EDGE_RIGHT) -#if GTK_CHECK_VERSION (3, 0, 0) width -= padding.right; -#else - width -= xthickness; -#endif if (edges & PANEL_EDGE_TOP) -#if GTK_CHECK_VERSION (3, 0, 0) y += padding.top; -#else - y += ythickness; -#endif -#if GTK_CHECK_VERSION (3, 0, 0) cairo_save (cr); gtk_render_handle (context, cr, x, y, width, height); cairo_restore (cr); -#else - gtk_paint_handle (style, - window, - state, - GTK_SHADOW_OUT, - &event->area, - widget, "handlebox", - x, y, width, height, - GTK_ORIENTATION_HORIZONTAL); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) y = aheight - HANDLE_SIZE; -#else - y = allocation.height - HANDLE_SIZE; -#endif if (edges & PANEL_EDGE_BOTTOM) -#if GTK_CHECK_VERSION (3, 0, 0) y -= padding.bottom; -#else - y -= ythickness; -#endif -#if GTK_CHECK_VERSION (3, 0, 0) cairo_save (cr); gtk_render_handle (context, cr, x, y, width, height); cairo_restore (cr); -#else - gtk_paint_handle (style, - window, - state, - GTK_SHADOW_OUT, - &event->area, - widget, "handlebox", - x, y, width, height, - GTK_ORIENTATION_HORIZONTAL); -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_restore (context); -#endif return retval; } @@ -3998,11 +3675,7 @@ panel_toplevel_start_animation (PanelToplevel *toplevel) deltax = toplevel->priv->animation_end_x - cur_x; deltay = toplevel->priv->animation_end_y - cur_y; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (toplevel), &requisition, NULL); -#else - gtk_widget_get_requisition (GTK_WIDGET (toplevel), &requisition); -#endif if (toplevel->priv->animation_end_width != -1) deltaw = toplevel->priv->animation_end_width - requisition.width; @@ -4332,7 +4005,6 @@ panel_toplevel_focus_out_event (GtkWidget *widget, } static void -#if GTK_CHECK_VERSION (3, 0, 0) panel_toplevel_style_updated (GtkWidget *widget) { panel_toplevel_update_hide_buttons (PANEL_TOPLEVEL (widget)); @@ -4344,17 +4016,6 @@ panel_toplevel_style_updated (GtkWidget *widget) set_background_default_style (widget); #endif } -#else -panel_toplevel_style_set (GtkWidget *widget, - GtkStyle *previous_style) - -{ - panel_toplevel_update_hide_buttons (PANEL_TOPLEVEL (widget)); - - if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->style_set) - GTK_WIDGET_CLASS (panel_toplevel_parent_class)->style_set (widget, previous_style); -} -#endif static void panel_toplevel_drag_threshold_changed (PanelToplevel *toplevel) @@ -4586,12 +4247,10 @@ panel_toplevel_constructor (GType type, object = G_OBJECT_CLASS (panel_toplevel_parent_class)->constructor (type, n_construct_properties, construct_properties); -#if GTK_CHECK_VERSION (3, 0, 0) PanelToplevel *toplevel = PANEL_TOPLEVEL(object); GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); GdkVisual *visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(toplevel), visual); -#endif return object; } @@ -4672,23 +4331,16 @@ panel_toplevel_class_init (PanelToplevelClass *klass) #if GTK_CHECK_VERSION (3, 18, 0) widget_class->state_flags_changed = panel_toplevel_state_flags_changed; #endif -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = panel_toplevel_draw; widget_class->get_preferred_width = panel_toplevel_get_preferred_width; widget_class->get_preferred_height = panel_toplevel_get_preferred_height; widget_class->style_updated = panel_toplevel_style_updated; -#else - widget_class->expose_event = panel_toplevel_expose; - widget_class->size_request = panel_toplevel_size_request; - widget_class->style_set = panel_toplevel_style_set; -#endif widget_class->size_allocate = panel_toplevel_size_allocate; widget_class->button_press_event = panel_toplevel_button_press_event; widget_class->button_release_event = panel_toplevel_button_release_event; #if GTK_CHECK_VERSION (3, 18, 0) widget_class->configure_event = panel_toplevel_configure_event; #endif - widget_class->key_press_event = panel_toplevel_key_press_event; widget_class->motion_notify_event = panel_toplevel_motion_notify_event; widget_class->enter_notify_event = panel_toplevel_enter_notify_event; @@ -5057,24 +4709,12 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) { GtkWidget* container; -#if GTK_CHECK_VERSION (3, 0, 0) toplevel->priv->grid = gtk_grid_new (); toplevel->priv->hide_button_top = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_UP, 1, 0); toplevel->priv->hide_button_bottom = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_DOWN, 1, 2); toplevel->priv->hide_button_left = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_LEFT, 0, 1); toplevel->priv->hide_button_right = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_RIGHT, 2, 1); -#else - toplevel->priv->table = gtk_table_new(3, 3, FALSE); - - toplevel->priv->hide_button_top = panel_toplevel_add_hide_button(toplevel, GTK_ARROW_UP, 1, 2, 0, 1); - - toplevel->priv->hide_button_bottom = panel_toplevel_add_hide_button(toplevel, GTK_ARROW_DOWN, 1, 2, 2, 3); - - toplevel->priv->hide_button_left = panel_toplevel_add_hide_button(toplevel, GTK_ARROW_LEFT, 0, 1, 1, 2); - - toplevel->priv->hide_button_right = panel_toplevel_add_hide_button(toplevel, GTK_ARROW_RIGHT, 2, 3, 1, 2); -#endif if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK) { @@ -5089,20 +4729,10 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) toplevel->priv->inner_frame = g_object_new(PANEL_TYPE_FRAME, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (GTK_WIDGET (toplevel->priv->inner_frame), TRUE); gtk_widget_set_vexpand (GTK_WIDGET (toplevel->priv->inner_frame), TRUE); gtk_grid_attach (GTK_GRID (toplevel->priv->grid), GTK_WIDGET (toplevel->priv->inner_frame), 1, 1, 1, 1); -#else - gtk_table_attach (GTK_TABLE (toplevel->priv->table), - GTK_WIDGET (toplevel->priv->inner_frame), - 1, 2, - 1, 2, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - 0, 0); -#endif gtk_widget_show (GTK_WIDGET (toplevel->priv->inner_frame)); container = panel_widget_new (toplevel, @@ -5117,13 +4747,8 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) gtk_container_add(GTK_CONTAINER(toplevel->priv->inner_frame), container); gtk_widget_show(container); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (toplevel), toplevel->priv->grid); gtk_widget_show (toplevel->priv->grid); -#else - gtk_container_add(GTK_CONTAINER(toplevel), toplevel->priv->table); - gtk_widget_show(toplevel->priv->table); -#endif } #if GTK_CHECK_VERSION (3, 18, 0) @@ -5134,8 +4759,8 @@ background_changed (PanelBackground *background, panel_toplevel_update_edges (toplevel); panel_widget_emit_background_changed (toplevel->priv->panel_widget); } - #endif + static void panel_toplevel_init (PanelToplevel *toplevel) { @@ -5196,11 +4821,7 @@ panel_toplevel_init (PanelToplevel *toplevel) toplevel->priv->panel_widget = NULL; toplevel->priv->inner_frame = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) toplevel->priv->grid = NULL; -#else - toplevel->priv->table = NULL; -#endif toplevel->priv->hide_button_top = NULL; toplevel->priv->hide_button_bottom = NULL; toplevel->priv->hide_button_left = NULL; @@ -5257,14 +4878,12 @@ panel_toplevel_init (PanelToplevel *toplevel) (PanelBackgroundChangedNotify) background_changed, toplevel); #endif -#if GTK_CHECK_VERSION (3, 0, 0) /*ensure the panel BG can always be themed*/ /*Without this gtk3.19/20 cannot set the BG color and resetting the bg to system is not immediately applied*/ GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); -#endif } PanelWidget * @@ -5474,7 +5093,6 @@ panel_toplevel_set_orientation (PanelToplevel *toplevel, toplevel->priv->orientation = orientation; -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext* context = gtk_widget_get_style_context (GTK_WIDGET (toplevel)); if (orientation & PANEL_HORIZONTAL_MASK) { gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL); @@ -5484,7 +5102,6 @@ panel_toplevel_set_orientation (PanelToplevel *toplevel, gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL); } gtk_widget_reset_style (GTK_WIDGET (toplevel)); -#endif panel_toplevel_update_hide_buttons (toplevel); diff --git a/mate-panel/panel-types.h b/mate-panel/panel-types.h index 2d16942f..92862cbc 100644 --- a/mate-panel/panel-types.h +++ b/mate-panel/panel-types.h @@ -2,20 +2,10 @@ #ifndef PANEL_TYPES_H #define PANEL_TYPES_H -#include <gdk/gdk.h> -#include <gtk/gtk.h> - typedef enum { PANEL_SPEED_SLOW, PANEL_SPEED_MEDIUM, PANEL_SPEED_FAST } PanelSpeed; -#if !GTK_CHECK_VERSION (3, 0, 0) -typedef struct { - GdkColor gdk; - guint16 alpha; -} PanelColor; -#endif - #endif diff --git a/mate-panel/panel-util.c b/mate-panel/panel-util.c index 1567a73c..45b17b8d 100644 --- a/mate-panel/panel-util.c +++ b/mate-panel/panel-util.c @@ -116,11 +116,7 @@ panel_push_window_busy (GtkWidget *window) GDK_WATCH); gdk_window_set_cursor (win, cursor); -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (cursor); -#else - gdk_cursor_unref (cursor); -#endif gdk_flush (); } } @@ -325,11 +321,7 @@ panel_find_icon (GtkIconTheme *icon_theme, if (info) { retval = g_strdup (gtk_icon_info_get_filename (info)); -#if GTK_CHECK_VERSION (3, 8, 0) g_object_unref (info); -#else - gtk_icon_info_free (info); -#endif } else retval = NULL; diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c index 5bb4b6d3..2a2e1704 100644 --- a/mate-panel/panel-widget.c +++ b/mate-panel/panel-widget.c @@ -11,9 +11,7 @@ #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gtk/gtkx.h> /* for GTK_IS_SOCKET */ -#endif #include <libpanel-util/panel-list.h> @@ -62,7 +60,6 @@ static guint panel_widget_signals [LAST_SIGNAL] = {0}; static gboolean mate_panel_applet_in_drag = FALSE; static GtkWidget *saved_focus_widget = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) static void panel_widget_get_preferred_size (GtkWidget *widget, GtkRequisition *minimum_size, GtkRequisition *natural_size); @@ -72,10 +69,6 @@ static void panel_widget_get_preferred_width (GtkWidget *widget, static void panel_widget_get_preferred_height (GtkWidget *widget, gint *minimum_height, gint *natural_height); -#else -static void panel_widget_size_request (GtkWidget *widget, - GtkRequisition *requisition); -#endif static void panel_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void panel_widget_cadd (GtkContainer *container, @@ -85,23 +78,12 @@ static void panel_widget_cremove (GtkContainer *container, static void panel_widget_dispose (GObject *obj); static void panel_widget_finalize (GObject *obj); -#if GTK_CHECK_VERSION (3, 18, 0) -#elif GTK_CHECK_VERSION (3, 0, 0) +#if !GTK_CHECK_VERSION (3, 18, 0) static void panel_widget_realize (GtkWidget *widget); static void panel_widget_unrealize (GtkWidget *panel); static void panel_widget_state_flags_changed (GtkWidget *widget, GtkStateFlags previous_state); static void panel_widget_style_updated (GtkWidget *widget); -#else -static void panel_widget_realize (GtkWidget *widget); -static void panel_widget_unrealize (GtkWidget *panel); -static void panel_widget_state_changed (GtkWidget *widget, - GtkStateType previous_state); -static void panel_widget_style_set (GtkWidget *widget, - GtkStyle *previous_style); -#endif - -#if !GTK_CHECK_VERSION (3, 18, 0) static void panel_widget_background_changed (PanelBackground *background, PanelWidget *panel); #endif @@ -138,11 +120,9 @@ static void emit_applet_moved (PanelWidget *panel_widget, AppletData *applet) { -#if GTK_CHECK_VERSION (3, 0, 0) /* we always want to queue a draw after moving, so do it here instead * of after the signal emission in all callers */ gtk_widget_queue_draw (applet->applet); -#endif g_signal_emit (panel_widget, panel_widget_signals [APPLET_MOVE_SIGNAL], 0, applet->applet); @@ -441,27 +421,17 @@ panel_widget_class_init (PanelWidgetClass *class) object_class->dispose = panel_widget_dispose; object_class->finalize = panel_widget_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = panel_widget_get_preferred_width; widget_class->get_preferred_height = panel_widget_get_preferred_height; -#else - widget_class->size_request = panel_widget_size_request; -#endif widget_class->size_allocate = panel_widget_size_allocate; #if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "PanelWidget"); #endif -#if GTK_CHECK_VERSION (3, 18, 0) -#elif GTK_CHECK_VERSION (3, 0, 0) +#if !GTK_CHECK_VERSION (3, 18, 0) widget_class->realize = panel_widget_realize; widget_class->unrealize = panel_widget_unrealize; widget_class->state_flags_changed = panel_widget_state_flags_changed; widget_class->style_updated = panel_widget_style_updated; -#else - widget_class->realize = panel_widget_realize; - widget_class->unrealize = panel_widget_unrealize; - widget_class->state_changed = panel_widget_state_changed; - widget_class->style_set = panel_widget_style_set; #endif widget_class->focus = panel_widget_real_focus; @@ -1236,13 +1206,9 @@ panel_widget_right_stick(PanelWidget *panel,int old_size) } static void -#if GTK_CHECK_VERSION (3, 0, 0) panel_widget_get_preferred_size(GtkWidget *widget, GtkRequisition *minimum_size, GtkRequisition *natural_size) -#else -panel_widget_size_request(GtkWidget *widget, GtkRequisition *minimum_size) -#endif { PanelWidget *panel; GList *list; @@ -1261,34 +1227,26 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *minimum_size) minimum_size->height = 0; minimum_size->width = panel->sz; } -#if GTK_CHECK_VERSION (3, 0, 0) natural_size->width = minimum_size->width; natural_size->height = minimum_size->height; -#endif ad_with_hints = NULL; for (list = panel->applet_list; list!=NULL; list = g_list_next(list)) { AppletData *ad = list->data; GtkRequisition child_min_size; -#if GTK_CHECK_VERSION (3, 0, 0) GtkRequisition child_natural_size; gtk_widget_get_preferred_size(ad->applet, &child_min_size, &child_natural_size); -#else - gtk_widget_size_request(ad->applet, &child_min_size); -#endif if (panel->orient == GTK_ORIENTATION_HORIZONTAL) { if (minimum_size->height < child_min_size.height && !ad->size_constrained) minimum_size->height = child_min_size.height; -#if GTK_CHECK_VERSION (3, 0, 0) if (natural_size->height < child_natural_size.height && !ad->size_constrained) natural_size->height = child_natural_size.height; -#endif if (panel->packed && ad->expand_major && ad->size_hints) ad_with_hints = g_list_prepend (ad_with_hints, @@ -1297,19 +1255,15 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *minimum_size) else if (panel->packed) { minimum_size->width += child_min_size.width; -#if GTK_CHECK_VERSION (3, 0, 0) natural_size->width += child_natural_size.width; -#endif } } else { if (minimum_size->width < child_min_size.width && !ad->size_constrained) minimum_size->width = child_min_size.width; -#if GTK_CHECK_VERSION (3, 0, 0) if (natural_size->width < child_min_size.width && !ad->size_constrained) natural_size->width = child_min_size.width; -#endif if (panel->packed && ad->expand_major && ad->size_hints) ad_with_hints = g_list_prepend (ad_with_hints, @@ -1318,9 +1272,7 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *minimum_size) else if (panel->packed) { minimum_size->height += child_min_size.height; -#if GTK_CHECK_VERSION (3, 0, 0) natural_size->height += child_natural_size.height; -#endif } } } @@ -1336,14 +1288,10 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *minimum_size) if (!panel->packed) { if (panel->orient == GTK_ORIENTATION_HORIZONTAL) { minimum_size->width = panel->size; -#if GTK_CHECK_VERSION (3, 0, 0) natural_size->width = panel->size; -#endif } else { minimum_size->height = panel->size; -#if GTK_CHECK_VERSION (3, 0, 0) natural_size->height = panel->size; -#endif } } else { /* put the list in the correct order: this is important @@ -1377,27 +1325,22 @@ panel_widget_size_request(GtkWidget *widget, GtkRequisition *minimum_size) minimum_size->width = 12; if (minimum_size->height < 12) minimum_size->height = 12; -#if GTK_CHECK_VERSION (3, 0, 0) if (natural_size->width < 12 && !dont_fill) natural_size->width = 12; if (natural_size->height < 12) natural_size->height = 12; -#endif } else { if (minimum_size->width < 12) minimum_size->width = 12; if (minimum_size->height < 12 && !dont_fill) minimum_size->height = 12; -#if GTK_CHECK_VERSION (3, 0, 0) if (natural_size->width < 12) natural_size->width = 12; if (natural_size->height < 12 && !dont_fill) natural_size->height = 12; -#endif } } -#if GTK_CHECK_VERSION (3, 0, 0) static void panel_widget_get_preferred_width(GtkWidget *widget, gint *minimum_width, @@ -1419,7 +1362,6 @@ panel_widget_get_preferred_height(GtkWidget *widget, *minimum_height = req_min.height; *natural_height = req_natural.height; } -#endif static void queue_resize_on_all_applets(PanelWidget *panel) @@ -1499,11 +1441,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) AppletData *ad = list->data; GtkAllocation challoc; GtkRequisition chreq; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (ad->applet, &chreq, NULL); -#else - gtk_widget_get_child_requisition(ad->applet, &chreq); -#endif ad->constrained = i; @@ -1554,11 +1492,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) AppletData *ad = list->data; GtkRequisition chreq; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (ad->applet, &chreq, NULL); -#else - gtk_widget_get_child_requisition(ad->applet, &chreq); -#endif if (!ad->expand_major || !ad->size_hints) { if(panel->orient == GTK_ORIENTATION_HORIZONTAL) @@ -1628,11 +1562,8 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) AppletData *ad = list->data; GtkAllocation challoc; GtkRequisition chreq; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (ad->applet, &chreq, NULL); -#else - gtk_widget_get_child_requisition (ad->applet, &chreq); -#endif + challoc.width = chreq.width; challoc.height = chreq.height; if(panel->orient == GTK_ORIENTATION_HORIZONTAL) { @@ -1668,9 +1599,7 @@ panel_widget_is_cursor(PanelWidget *panel, int overlap) { GtkWidget *widget; GtkAllocation allocation; -#if GTK_CHECK_VERSION(3, 0, 0) GdkDevice *device; -#endif int x,y; int w,h; @@ -1686,11 +1615,9 @@ panel_widget_is_cursor(PanelWidget *panel, int overlap) #if GTK_CHECK_VERSION(3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (widget))); gdk_window_get_device_position(gtk_widget_get_window (widget), device, &x, &y, NULL); -#elif GTK_CHECK_VERSION(3, 0, 0) +#else device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (widget))); gdk_window_get_device_position(gtk_widget_get_window (widget), device, &x, &y, NULL); -#else - gtk_widget_get_pointer(widget, &x, &y); #endif gtk_widget_get_allocation (widget, &allocation); @@ -1705,8 +1632,7 @@ panel_widget_is_cursor(PanelWidget *panel, int overlap) return FALSE; } -#if GTK_CHECK_VERSION (3, 18, 0) -#elif GTK_CHECK_VERSION (3, 0, 0) +#if !GTK_CHECK_VERSION (3, 18, 0) static void panel_widget_set_background_default_style (GtkWidget *widget) { @@ -1750,43 +1676,6 @@ panel_widget_style_updated (GtkWidget *widget) GTK_WIDGET_CLASS (panel_widget_parent_class)->style_updated (widget); panel_widget_set_background_default_style (widget); } - -#else - -static void -panel_widget_state_changed (GtkWidget *widget, - GtkStateType previous_state) -{ - GtkStyle *style; - GtkStateType state; - - if (gtk_widget_get_realized (widget)) { - style = gtk_widget_get_style (widget); - state = gtk_widget_get_state (widget); - - panel_background_set_default_style ( - &PANEL_WIDGET (widget)->background, - &style->bg [state], - style->bg_pixmap [state]); - } -} - -static void -panel_widget_style_set (GtkWidget *widget, GtkStyle *previous_style) -{ - GtkStyle *style; - GtkStateType state; - - if (gtk_widget_get_realized (widget)) { - style = gtk_widget_get_style (widget); - state = gtk_widget_get_state (widget); - - panel_background_set_default_style ( - &PANEL_WIDGET (widget)->background, - &style->bg [state], - style->bg_pixmap [state]); - } -} #endif static gboolean @@ -1806,10 +1695,6 @@ panel_widget_realize (GtkWidget *widget) { PanelWidget *panel = (PanelWidget *) widget; GdkWindow *window; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkStyle *style; - GtkStateType state; -#endif g_signal_connect (panel->toplevel, "configure-event", G_CALLBACK (toplevel_configure_event), panel); @@ -1817,23 +1702,8 @@ panel_widget_realize (GtkWidget *widget) GTK_WIDGET_CLASS (panel_widget_parent_class)->realize (widget); window = gtk_widget_get_window (widget); -#if !GTK_CHECK_VERSION (3, 0, 0) - style = gtk_widget_get_style (widget); - state = gtk_widget_get_state (widget); - - /* For auto-hidden panels with a colored background, we need native - * windows to avoid some uglyness on unhide */ -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) panel_widget_set_background_default_style (widget); -#else - panel_background_set_default_style ( - &panel->background, - &style->bg [state], - style->bg_pixmap [state]); -#endif panel_background_realized (&panel->background, window); } @@ -1939,11 +1809,7 @@ panel_widget_init (PanelWidget *panel) panel->packed = FALSE; panel->orient = GTK_ORIENTATION_HORIZONTAL; -#if GTK_CHECK_VERSION (3, 0, 0) panel->size = 0; -#else - panel->size = G_MAXINT; -#endif panel->applet_list = NULL; panel->master_widget = NULL; panel->drop_widget = widget; @@ -1957,7 +1823,6 @@ panel_widget_init (PanelWidget *panel) (PanelBackgroundChangedNotify) panel_widget_background_changed, panel); #endif - panels = g_slist_append (panels, panel); } @@ -1978,14 +1843,7 @@ panel_widget_new (PanelToplevel *toplevel, panel->sz = sz; panel->packed = packed; -#if GTK_CHECK_VERSION (3, 0, 0) panel->size = 0; -#else - if (packed) - panel->size = 0; - else - panel->size = G_MAXINT; -#endif panel->toplevel = toplevel; panel->drop_widget = GTK_WIDGET (toplevel); @@ -2094,7 +1952,6 @@ panel_widget_applet_drag_start (PanelWidget *panel, if (window) { GdkGrabStatus status; GdkCursor *fleur_cursor; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; #if GTK_CHECK_VERSION(3, 20, 0) GdkSeat *seat; @@ -2102,12 +1959,9 @@ panel_widget_applet_drag_start (PanelWidget *panel, GdkDevice *pointer; GdkDeviceManager *device_manager; #endif -#endif - fleur_cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_FLEUR); -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_window_get_display (window); #if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); @@ -2124,12 +1978,6 @@ panel_widget_applet_drag_start (PanelWidget *panel, #endif g_object_unref (fleur_cursor); -#else - status = gdk_pointer_grab (window, FALSE, - APPLET_EVENT_MASK, NULL, - fleur_cursor, time_); - gdk_cursor_unref (fleur_cursor); -#endif gdk_flush (); if (status != GDK_GRAB_SUCCESS) { @@ -2146,7 +1994,7 @@ panel_widget_applet_drag_end (PanelWidget *panel) #if GTK_CHECK_VERSION(3, 20, 0) GdkDisplay *display; GdkSeat *seat; -#elif GTK_CHECK_VERSION (3, 0, 0) +#else GdkDisplay *display; GdkDevice *pointer; GdkDeviceManager *device_manager; @@ -2161,14 +2009,12 @@ panel_widget_applet_drag_end (PanelWidget *panel) seat = gdk_display_get_default_seat (display); gdk_seat_ungrab (seat); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else display = gtk_widget_get_display (GTK_WIDGET (panel)); device_manager = gdk_display_get_device_manager (display); pointer = gdk_device_manager_get_client_pointer (device_manager); gdk_device_ungrab (pointer, GDK_CURRENT_TIME); -#else - gdk_pointer_ungrab (GDK_CURRENT_TIME); #endif gtk_grab_remove (panel->currently_dragged_applet->applet); panel_widget_applet_drag_end_no_grab (panel); @@ -2180,9 +2026,7 @@ panel_widget_applet_drag_end (PanelWidget *panel) int panel_widget_get_cursorloc (PanelWidget *panel) { -#if GTK_CHECK_VERSION(3, 0, 0) GdkDevice *device; -#endif int x, y; gboolean rtl; @@ -2191,11 +2035,9 @@ panel_widget_get_cursorloc (PanelWidget *panel) #if GTK_CHECK_VERSION (3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET(panel)))); gdk_window_get_device_position(gtk_widget_get_window (GTK_WIDGET(panel)), device, &x, &y, NULL); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET(panel)))); gdk_window_get_device_position(gtk_widget_get_window (GTK_WIDGET(panel)), device, &x, &y, NULL); -#else - gtk_widget_get_pointer (GTK_WIDGET (panel), &x, &y); #endif rtl = gtk_widget_get_direction (GTK_WIDGET (panel)) == GTK_TEXT_DIR_RTL; @@ -2363,9 +2205,7 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel) int pos; int movement; GtkWidget *applet; -#if GTK_CHECK_VERSION(3, 0, 0) GdkDevice *device; -#endif GSList *forb; GdkModifierType mods; AppletData *ad; @@ -2424,12 +2264,9 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel) #if GTK_CHECK_VERSION (3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (panel)))); gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET(panel)), device, NULL, NULL, &mods); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (panel)))); gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET(panel)), device, NULL, NULL, &mods); -#else - gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET(panel)), - NULL, NULL, &mods); #endif movement = PANEL_SWITCH_MOVE; @@ -2464,9 +2301,7 @@ static int move_timeout_handler(gpointer data) { PanelWidget *panel = data; -#if GTK_CHECK_VERSION(3, 0, 0) GdkDevice *device; -#endif g_return_val_if_fail(PANEL_IS_WIDGET(data),FALSE); @@ -2489,11 +2324,9 @@ move_timeout_handler(gpointer data) #if GTK_CHECK_VERSION (3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (widget))); gdk_window_get_device_position (gtk_widget_get_window (widget), device, &x, &y, NULL); -#elif GTK_CHECK_VERSION (3, 0, 0) +#else device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (widget))); gdk_window_get_device_position(gtk_widget_get_window (widget), device, &x, &y, NULL); -#else - gtk_widget_get_pointer(widget, &x, &y); #endif gtk_widget_get_allocation (widget, &allocation); @@ -2629,11 +2462,7 @@ panel_widget_applet_key_press_event (GtkWidget *widget, if (!mate_panel_applet_in_drag) return FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) return gtk_bindings_activate (G_OBJECT (panel), -#else - return gtk_bindings_activate (GTK_OBJECT (panel), -#endif ((GdkEventKey *)event)->keyval, ((GdkEventKey *)event)->state); } @@ -3003,7 +2832,6 @@ panel_widget_emit_background_changed (PanelWidget *panel) { g_signal_emit (panel, panel_widget_signals [BACK_CHANGE_SIGNAL], 0); } - #else static void panel_widget_background_changed (PanelBackground *background, diff --git a/mate-panel/panel-xutils.c b/mate-panel/panel-xutils.c index 0abce77c..413bd40e 100644 --- a/mate-panel/panel-xutils.c +++ b/mate-panel/panel-xutils.c @@ -27,7 +27,6 @@ #include "panel-xutils.h" #include <glib.h> -#include <gtk/gtk.h> #include <gdk/gdk.h> #include <gdk/gdkx.h> #include <X11/Xlib.h> @@ -102,11 +101,7 @@ panel_xutils_set_strut (GdkWindow *gdk_window, XChangeProperty (display, window, net_wm_strut_partial, XA_CARDINAL, 32, PropModeReplace, (guchar *) &struts, 12); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif } void @@ -124,11 +119,7 @@ panel_warp_pointer (GdkWindow *gdk_window, gdk_error_trap_push (); XWarpPointer (display, None, window, 0, 0, 0, 0, x, y); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif } guint diff --git a/mate-panel/panel.c b/mate-panel/panel.c index 206b6c82..f3bf417b 100644 --- a/mate-panel/panel.c +++ b/mate-panel/panel.c @@ -19,9 +19,7 @@ #include <gio/gio.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gtk/gtkx.h> /* for GTK_IS_SOCKET */ -#endif #include <libpanel-util/panel-glib.h> @@ -404,11 +402,7 @@ panel_key_press_event (GtkWidget *widget, if (GTK_IS_SOCKET (gtk_window_get_focus (GTK_WINDOW (widget))) && event->keyval == GDK_KEY_F10 && (event->state & gtk_accelerator_get_default_mod_mask ()) == GDK_CONTROL_MASK) -#if GTK_CHECK_VERSION (3, 0, 0) return gtk_bindings_activate (G_OBJECT (widget), -#else - return gtk_bindings_activate (GTK_OBJECT (widget), -#endif event->keyval, event->state); @@ -440,11 +434,7 @@ static gboolean set_background_color (PanelToplevel *toplevel, guint16 *dropped) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - PanelColor color; -#endif if (!dropped) return FALSE; @@ -453,17 +443,10 @@ set_background_color (PanelToplevel *toplevel, ! panel_profile_background_key_is_writable (toplevel, "type")) return FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) color.red = dropped [0]; color.green = dropped [1]; color.blue = dropped [2]; color.alpha = 1.; -#else - color.gdk.red = dropped [0]; - color.gdk.green = dropped [1]; - color.gdk.blue = dropped [2]; - color.alpha = 65535; -#endif panel_profile_set_background_color (toplevel, &color); panel_profile_set_background_type (toplevel, PANEL_BACK_COLOR); diff --git a/mate-panel/xstuff.c b/mate-panel/xstuff.c index 42dc3b78..7753973e 100644 --- a/mate-panel/xstuff.c +++ b/mate-panel/xstuff.c @@ -217,11 +217,7 @@ xstuff_set_pos_size (GdkWindow *window, int x, int y, int w, int h) gdk_window_move_resize (window, x, y, w, h); gdk_flush (); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif g_object_set_data (G_OBJECT (window), "xstuff-cached-x", GINT_TO_POINTER (x)); g_object_set_data (G_OBJECT (window), "xstuff-cached-y", GINT_TO_POINTER (y)); @@ -318,13 +314,8 @@ idle_destroy (gpointer data) } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) zoom_draw (GtkWidget *widget, cairo_t *cr, -#else -zoom_expose (GtkWidget *widget, - GdkEventExpose *event, -#endif gpointer user_data) { CompositedZoomData *zoom; @@ -347,9 +338,6 @@ zoom_expose (GtkWidget *widget, GdkPixbuf *scaled; int width, height; int x = 0, y = 0; -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr; -#endif gtk_window_get_size (GTK_WINDOW (widget), &width, &height); @@ -382,9 +370,6 @@ zoom_expose (GtkWidget *widget, break; } -#if !GTK_CHECK_VERSION (3, 0, 0) - cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#endif cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_set_source_rgba (cr, 0, 0, 0, 0.0); cairo_rectangle (cr, 0, 0, width, height); @@ -394,9 +379,6 @@ zoom_expose (GtkWidget *widget, cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_paint_with_alpha (cr, MAX (zoom->opacity, 0)); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif g_object_unref (scaled); } @@ -431,11 +413,7 @@ draw_zoom_animation_composited (GdkScreen *gscreen, gtk_window_set_keep_above (GTK_WINDOW (win), TRUE); gtk_window_set_decorated (GTK_WINDOW (win), FALSE); gtk_widget_set_app_paintable(win, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_visual (win, gdk_screen_get_rgba_visual (gscreen)); -#else - gtk_widget_set_colormap (win, gdk_screen_get_rgba_colormap (gscreen)); -#endif gtk_window_set_gravity (GTK_WINDOW (win), GDK_GRAVITY_STATIC); gtk_window_set_default_size (GTK_WINDOW (win), @@ -465,21 +443,12 @@ draw_zoom_animation_composited (GdkScreen *gscreen, gtk_window_move (GTK_WINDOW (win), wx, wy); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (G_OBJECT (win), "draw", G_CALLBACK (zoom_draw), zoom); -#else - g_signal_connect (G_OBJECT (win), "expose-event", - G_CALLBACK (zoom_expose), zoom); -#endif /* see doc for gtk_widget_set_app_paintable() */ gtk_widget_realize (win); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background_pattern (gtk_widget_get_window (win), NULL); -#else - gdk_window_set_back_pixmap (gtk_widget_get_window (win), NULL, FALSE); -#endif gtk_widget_show (win); zoom->timeout_id = g_timeout_add (ZOOM_DELAY, @@ -509,17 +478,9 @@ draw_zoom_animation (GdkScreen *gscreen, dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (gscreen)); root_win = GDK_WINDOW_XID (gdk_screen_get_root_window (gscreen)); screen = gdk_screen_get_number (gscreen); -#if GTK_CHECK_VERSION (3, 0, 0) depth = DefaultDepth(dpy,screen); -#else - depth = gdk_drawable_get_depth (gdk_screen_get_root_window (gscreen)); -#endif /* frame GC */ -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_colormap_alloc_color ( - gdk_screen_get_system_colormap (gscreen), &color, FALSE, TRUE); -#endif gcv.function = GXxor; /* this will raise the probability of the XORed color being different * of the original color in PseudoColor when not all color cells are @@ -610,10 +571,6 @@ draw_zoom_animation (GdkScreen *gscreen, XUngrabServer(dpy); XFreeGC (dpy, frame_gc); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_colormap_free_colors (gdk_screen_get_system_colormap (gscreen), - &color, 1); -#endif } #undef FRAMES @@ -709,11 +666,7 @@ xstuff_grab_key_on_all_screens (int keycode, int i; display = gdk_display_get_default (); -#if GTK_CHECK_VERSION(3, 10, 0) n_screens = 1; /* gdk-3.10, The number of screens is always 1 */ -#else - n_screens = gdk_display_get_n_screens (display); -#endif for (i = 0; i < n_screens; i++) { GdkWindow *root; diff --git a/po/POTFILES.in b/po/POTFILES.in index 22ae7622..2461cf89 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -58,7 +58,6 @@ mate-panel/panel-menu-button.c mate-panel/panel-menu-items.c mate-panel/panel-profile.c mate-panel/panel-properties-dialog.c -[type: gettext/glade]mate-panel/panel-properties-dialog.ui [type: gettext/glade]mate-panel/panel-properties-dialog-gtk3.ui mate-panel/panel-recent.c mate-panel/panel-run-dialog.c |