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/notification_area/main.c | 30 --------- .../status-notifier/sn-dbus-menu.c | 4 +- .../notification_area/status-notifier/sn-item-v0.c | 2 - .../notification_area/status-notifier/sn-item.c | 77 ---------------------- applets/notification_area/system-tray/fixedtip.c | 4 -- applets/notification_area/testtray.c | 9 +-- 6 files changed, 3 insertions(+), 123 deletions(-) (limited to 'applets/notification_area') diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index 259573c4..069a74b3 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -111,11 +111,7 @@ static void help_cb(GtkAction* action, NaTrayApplet* applet) #define NA_HELP_DOC "mate-user-guide" uri = g_strdup_printf("help:%s/%s", NA_HELP_DOC, "panels-notification-area"); -#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(GTK_WIDGET(applet)), uri, gtk_get_current_event_time(), &error); -#endif g_free(uri); if (error && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -300,26 +296,6 @@ na_tray_applet_focus (GtkWidget *widget, return GTK_WIDGET_CLASS (na_tray_applet_parent_class)->focus (widget, direction); } -#if !GTK_CHECK_VERSION (3, 20, 0) -static inline void -force_no_focus_padding (GtkWidget *widget) -{ - GtkCssProvider *provider; - - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, - "NaTrayApplet {\n" - " -GtkWidget-focus-line-width: 0px;\n" - " -GtkWidget-focus-padding: 0px;\n" - "}", - -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); -} -#endif - static void na_tray_applet_class_init (NaTrayAppletClass *class) { @@ -361,9 +337,7 @@ na_tray_applet_class_init (NaTrayAppletClass *class) g_type_class_add_private (class, sizeof (NaTrayAppletPrivate)); -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "na-tray-applet"); -#endif } static void @@ -390,10 +364,6 @@ 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, 20, 0) - force_no_focus_padding (GTK_WIDGET (applet)); -#endif } static gboolean diff --git a/applets/notification_area/status-notifier/sn-dbus-menu.c b/applets/notification_area/status-notifier/sn-dbus-menu.c index 28633990..5b73db00 100644 --- a/applets/notification_area/status-notifier/sn-dbus-menu.c +++ b/applets/notification_area/status-notifier/sn-dbus-menu.c @@ -187,11 +187,11 @@ get_layout_cb (GObject *source_object, g_hash_table_remove_all (menu->items); layout_parse (menu, layout, GTK_MENU (menu)); -#if GTK_CHECK_VERSION (3, 22, 0) + /* Reposition menu to accomodate any size changes */ /* Menu size never changes with GTK 3.20 or earlier */ gtk_menu_reposition(GTK_MENU(menu)); -#endif + g_variant_unref (layout); } diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c index dec9bdf1..46a4c064 100644 --- a/applets/notification_area/status-notifier/sn-item-v0.c +++ b/applets/notification_area/status-notifier/sn-item-v0.c @@ -1372,9 +1372,7 @@ sn_item_v0_class_init (SnItemV0Class *v0_class) widget_class->size_allocate = sn_item_v0_size_allocate; -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "sn-item"); -#endif install_properties (object_class); } diff --git a/applets/notification_area/status-notifier/sn-item.c b/applets/notification_area/status-notifier/sn-item.c index d2d86ec0..a7fa6fea 100644 --- a/applets/notification_area/status-notifier/sn-item.c +++ b/applets/notification_area/status-notifier/sn-item.c @@ -182,49 +182,6 @@ sn_item_get_action_coordinates (SnItem *item, *x += width; } -#if ! GTK_CHECK_VERSION (3, 22, 0) -static void -sn_item_popup_menu_position_func (GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer widget) -{ - GtkAllocation widget_alloc; - GtkRequisition menu_req; - GdkWindow *window; - GdkScreen *screen; - gint monitor_num; - GdkRectangle monitor; - - gtk_widget_get_allocation (widget, &widget_alloc); - gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL); - - window = gtk_widget_get_window (widget); - gdk_window_get_origin (window, x, y); - - *x += widget_alloc.x; - *y += widget_alloc.y; - - screen = gtk_widget_get_screen (widget); - monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - - /* put the menu on the left if we can't put it on the right */ - if (*x + menu_req.width > monitor.x + monitor.width) - *x -= menu_req.width - widget_alloc.width; - /* and push it back in if all else failed */ - if (*x < monitor.x) - *x = monitor.x; - - /* put the menu above if we can't put it below */ - if (*y + widget_alloc.height + menu_req.height > monitor.y + monitor.height) - *y -= menu_req.height; - else - *y += widget_alloc.height; -} -#endif - static gboolean sn_item_button_press_event (GtkWidget *widget, GdkEventButton *event) @@ -244,39 +201,23 @@ sn_item_button_press_event (GtkWidget *widget, if (event->button == 2) { -#if GTK_CHECK_VERSION (3, 20, 0) gdk_seat_ungrab (gdk_device_get_seat (event->device)); -#else - gdk_device_ungrab (event->device, GDK_CURRENT_TIME); -#endif SN_ITEM_GET_CLASS (item)->secondary_activate (item, x, y); } else if (event->button == 3) { if (priv->menu != NULL) { -#if GTK_CHECK_VERSION (3, 22, 0) gtk_menu_popup_at_widget (priv->menu, widget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *) event); /*Fix positioning if size changed since last shown*/ gtk_menu_reposition(priv->menu); -#else - gtk_menu_popup (priv->menu, NULL, NULL, - sn_item_popup_menu_position_func, widget, - event->button, event->time); - /*Fix positioning if size changed since last shown*/ - gtk_menu_reposition(priv->menu); -#endif } else { -#if GTK_CHECK_VERSION (3, 20, 0) gdk_seat_ungrab (gdk_device_get_seat (event->device)); -#else - gdk_device_ungrab (event->device, GDK_CURRENT_TIME); -#endif SN_ITEM_GET_CLASS (item)->context_menu (item, x, y); } } @@ -299,30 +240,12 @@ sn_item_popup_menu (GtkWidget *widget) if (priv->menu != NULL) { -#if GTK_CHECK_VERSION (3, 22, 0) gtk_menu_popup_at_widget (priv->menu, widget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL); /*Fix positioning if size changed since last shown*/ gtk_menu_reposition(priv->menu); -#else - guint button = 0; - guint32 active_time = GDK_CURRENT_TIME; - GdkEvent *event = gtk_get_current_event (); - - if (event) - { - gdk_event_get_button (event, &button); - active_time = gdk_event_get_time (event); - } - - gtk_menu_popup (priv->menu, NULL, NULL, - sn_item_popup_menu_position_func, widget, - button, active_time); - /*Fix positioning if size changed since last shown*/ - gtk_menu_reposition(priv->menu); -#endif } else { diff --git a/applets/notification_area/system-tray/fixedtip.c b/applets/notification_area/system-tray/fixedtip.c index d233424e..2278e9ca 100644 --- a/applets/notification_area/system-tray/fixedtip.c +++ b/applets/notification_area/system-tray/fixedtip.c @@ -117,12 +117,8 @@ na_fixed_tip_init (NaFixedTip *fixedtip) label = gtk_label_new (NULL); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.5); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); -#endif gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (fixedtip), label); fixedtip->priv->label = label; diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c index cc36c02f..80f8fba0 100644 --- a/applets/notification_area/testtray.c +++ b/applets/notification_area/testtray.c @@ -164,13 +164,10 @@ create_tray_on_screen (GdkScreen *screen, hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); 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) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Vertical"); @@ -180,12 +177,8 @@ create_tray_on_screen (GdkScreen *screen, label = gtk_label_new (NULL); data->count_label = GTK_LABEL (label); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); data->traybox = na_box_new (GTK_ORIENTATION_HORIZONTAL); -- cgit v1.2.1