From ab7987701bcea97e4326fecd161c3137080f6077 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 31 Jan 2018 09:46:08 +0300 Subject: require GTK+ 3.22 and GLib 2.50 --- applets/clock/clock-location-tile.c | 8 ----- applets/clock/clock-utils.c | 6 +--- applets/clock/clock.c | 65 ------------------------------------- 3 files changed, 1 insertion(+), 78 deletions(-) (limited to 'applets/clock') diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c index fc331e1d..a4546f71 100644 --- a/applets/clock/clock-location-tile.c +++ b/applets/clock/clock-location-tile.c @@ -277,12 +277,8 @@ clock_location_tile_fill (ClockLocationTile *this) priv->city_label = gtk_label_new (NULL); gtk_widget_set_margin_end (priv->city_label, 3); -#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); -#else - gtk_misc_set_alignment (GTK_MISC (priv->city_label), 0, 0); -#endif head_section = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (head_section), priv->city_label, FALSE, FALSE, 0); @@ -290,12 +286,8 @@ clock_location_tile_fill (ClockLocationTile *this) priv->time_label = gtk_label_new (NULL); gtk_label_set_width_chars (GTK_LABEL (priv->time_label), 20); gtk_widget_set_margin_end (priv->time_label, 3); -#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); -#else - gtk_misc_set_alignment (GTK_MISC (priv->time_label), 0, 0); -#endif priv->weather_icon = gtk_image_new (); gtk_widget_set_valign (priv->weather_icon, GTK_ALIGN_START); diff --git a/applets/clock/clock-utils.c b/applets/clock/clock-utils.c index 83b08fc6..5b15fe5f 100644 --- a/applets/clock/clock-utils.c +++ b/applets/clock/clock-utils.c @@ -72,13 +72,9 @@ clock_utils_display_help (GtkWidget *widget, uri = g_strdup_printf ("help:%s/%s", doc_id, link_id); else uri = g_strdup_printf ("help:%s", doc_id); -#if GTK_CHECK_VERSION (3, 22, 0) + gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error); -#else - gtk_show_uri (gtk_widget_get_screen (widget), uri, - gtk_get_current_event_time (), &error); -#endif g_free (uri); if (error && diff --git a/applets/clock/clock.c b/applets/clock/clock.c index 110e39ee..a17d642e 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -258,10 +258,6 @@ calculate_minimum_width (GtkWidget *widget, PangoContext *pango_context; PangoLayout *layout; int width, height; -#if !GTK_CHECK_VERSION (3, 20, 0) - int focus_width = 0; - int focus_pad = 0; -#endif GtkStyleContext *style_context; GtkStateFlags state; GtkBorder padding; @@ -278,16 +274,8 @@ calculate_minimum_width (GtkWidget *widget, 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, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - width += 2 * (focus_width + focus_pad) + padding.left + padding.right; -#endif return width; } @@ -384,10 +372,6 @@ calculate_minimum_height (GtkWidget *widget, GtkBorder padding; PangoContext *pango_context; PangoFontMetrics *metrics; -#if !GTK_CHECK_VERSION (3, 20, 0) - int focus_width = 0; - int focus_pad = 0; -#endif int ascent; int descent; int thickness; @@ -407,12 +391,6 @@ calculate_minimum_height (GtkWidget *widget, pango_font_metrics_unref (metrics); gtk_style_context_get_padding (style_context, state, &padding); -#if !GTK_CHECK_VERSION (3, 20, 0) - gtk_style_context_get_style (style_context, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); -#endif if (orientation == MATE_PANEL_APPLET_ORIENT_UP || orientation == MATE_PANEL_APPLET_ORIENT_DOWN) { @@ -421,11 +399,7 @@ calculate_minimum_height (GtkWidget *widget, thickness = padding.left + padding.right; } -#if GTK_CHECK_VERSION (3, 20, 0) return PANGO_PIXELS (ascent + descent) + thickness; -#else - return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad) + thickness; -#endif } static gboolean @@ -874,9 +848,7 @@ position_calendar_popup (ClockData *cd) { GtkRequisition req; GtkAllocation allocation; -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; -#endif GdkScreen *screen; GdkRectangle monitor; GdkGravity gravity = GDK_GRAVITY_NORTH_WEST; @@ -900,19 +872,11 @@ position_calendar_popup (ClockData *cd) button_h = allocation.height; screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup)); -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); n = gdk_display_get_n_monitors (display); -#else - n = gdk_screen_get_n_monitors (screen); -#endif for (i = 0; i < n; i++) { -#if GTK_CHECK_VERSION (3, 22, 0) gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &monitor); -#else - gdk_screen_get_monitor_geometry (screen, i, &monitor); -#endif if (x >= monitor.x && x <= monitor.x + monitor.width && y >= monitor.y && y <= monitor.y + monitor.height) { found_monitor = TRUE; @@ -1308,7 +1272,6 @@ clock_update_text_gravity (GtkWidget *label) pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO); } -#if GTK_CHECK_VERSION (3, 20, 0) static inline void force_no_button_padding (GtkWidget *widget) { @@ -1328,30 +1291,6 @@ force_no_button_padding (GtkWidget *widget) gtk_widget_set_name (widget, "clock-applet-button"); } -#else -static inline void -force_no_focus_padding (GtkWidget *widget) -{ - static gboolean first_time = TRUE; - GtkCssProvider *provider; - - if (first_time) { - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, - "#clock-applet-button {\n" - " -GtkWidget-focus-line-width: 0px;\n" - " -GtkWidget-focus-padding: 0px; }", - -1, NULL); - gtk_style_context_add_provider (gtk_widget_get_style_context (widget), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (provider); - first_time = FALSE; - } - - gtk_widget_set_name (widget, "clock-applet-button"); -} -#endif static GtkWidget * create_main_clock_button (void) @@ -1361,11 +1300,7 @@ create_main_clock_button (void) button = gtk_toggle_button_new (); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); -#if GTK_CHECK_VERSION (3, 20, 0) force_no_button_padding (button); -#else - force_no_focus_padding (button); -#endif return button; } -- cgit v1.2.1