From 7886eb1ad39eea7a0ea75e82dd112ec423f0b608 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sat, 14 Oct 2023 22:12:32 +0200 Subject: replace deprecated gtk_image_menu_item --- .build.yml | 35 +++++++++++++++++++++++++++++++++++ configure.ac | 4 ++++ src/Makefile.am | 3 +++ src/gpm-tray-icon.c | 13 +++++++------ 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/.build.yml b/.build.yml index da7c66c..78a3c97 100644 --- a/.build.yml +++ b/.build.yml @@ -22,6 +22,10 @@ requires: - upower - which - yelp-tools + # mate-desktop dependencies + - iso-codes + - gobject-introspection + - dconf debian: # Useful URL: https://github.com/mate-desktop/debian-packages @@ -52,6 +56,11 @@ requires: - pkg-config - xmlto - yelp-tools + # mate-desktop dependencies + - iso-codes + - gobject-introspection + - libgirepository1.0-dev + - libdconf-dev fedora: # Useful URL: https://src.fedoraproject.org/cgit/rpms/mate-power-manager.git @@ -78,6 +87,10 @@ requires: - popt-devel - redhat-rpm-config - upower-devel + # mate-desktop dependencies + - iso-codes-devel + - gobject-introspection-devel + - dconf-devel ubuntu: - autoconf-archive @@ -105,6 +118,11 @@ requires: - pkg-config - xmlto - yelp-tools + # mate-desktop dependencies + - iso-codes + - gobject-introspection + - libgirepository1.0-dev + - libdconf-dev variables: - 'CHECKERS=" @@ -123,8 +141,25 @@ variables: -enable-checker alpha.unix.cstring.OutOfBounds -enable-checker alpha.core.FixedAddr -enable-checker security.insecureAPI.strcpy"' + - MATE_DESKTOP_VERSION=1.27.1 before_scripts: + - cd ${START_DIR} + - if [ ! -f mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz ];then + - curl -Ls -o mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz https://github.com/mate-desktop/mate-desktop/releases/download/v${MATE_DESKTOP_VERSION}/mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz + - fi + - tar xf mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz + - cd mate-desktop-${MATE_DESKTOP_VERSION} + - if [ ${DISTRO_NAME} == "debian" -o ${DISTRO_NAME} == "ubuntu" ];then + - ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu + - else + - ./autogen.sh --prefix=/usr + - fi + - if [ ${TRAVIS} == "false" ]; then + - make clean + - fi + - make + - make install build_scripts: - if [ ${DISTRO_NAME} == "debian" ];then diff --git a/configure.ac b/configure.ac index 0e2b005..a018ce1 100644 --- a/configure.ac +++ b/configure.ac @@ -75,6 +75,7 @@ DBUS_REQUIRED=1.0 DBUS_GLIB_REQUIRED=0.70 LIBNOTIFY_REQUIRED=0.7.0 CAIRO_REQUIRED=1.0.0 +MATE_DESKTOP_REQUIRED=1.27.1 LIBPANEL_REQUIRED=1.17.0 XRANDR_REQUIRED=1.3.0 XPROTO_REQUIRED=7.0.15 @@ -101,6 +102,9 @@ PKG_CHECK_MODULES(GDK, [ gdk-3.0 >= $GDK_REQUIRED gdk-x11-3.0 >= $GDK_REQUIRED]) +PKG_CHECK_MODULES(MATE_DESKTOP, [ + mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED]) + PKG_CHECK_MODULES(X11, [ xrandr >= $XRANDR_REQUIRED x11 xext xproto >= $XPROTO_REQUIRED]) diff --git a/src/Makefile.am b/src/Makefile.am index 47815c5..da49dab 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,6 +15,7 @@ AM_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(CAIRO_CFLAGS) \ $(LIBSECRET_CFLAGS) \ + $(MATE_DESKTOP_CFLAGS) \ $(KEYRING_CFLAGS) \ $(X11_CFLAGS) \ $(LIBNOTIFY_CFLAGS) \ @@ -198,6 +199,7 @@ mate_power_manager_LDADD = \ $(X11_LIBS) \ $(GSTREAMER_LIBS) \ $(CAIRO_LIBS) \ + $(MATE_DESKTOP_LIBS) \ $(LIBSECRET_LIBS) \ $(KEYRING_LIBS) \ $(DBUS_LIBS) \ @@ -261,6 +263,7 @@ mate_power_self_test_LDADD = \ $(GLIB_LIBS) \ $(X11_LIBS) \ $(CAIRO_LIBS) \ + $(MATE_DESKTOP_LIBS) \ $(LIBSECRET_LIBS) \ $(KEYRING_LIBS) \ $(GSTREAMER_LIBS) \ diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index 9f5fe38..e8e84bb 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -41,6 +41,8 @@ #include #include +#include + #include "gpm-upower.h" #include "gpm-engine.h" #include "gpm-common.h" @@ -275,13 +277,12 @@ gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *arr else { label = g_strdup_printf ("%s (%.1f%%)", gpm_device_kind_to_localised_string (kind, 1), percentage); } - item = gtk_image_menu_item_new_with_label (label); + item = mate_image_menu_item_new_with_label (label); /* generate the image */ icon_name = gpm_upower_get_device_icon (device); image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); - gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE); + mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item), image); /* set callback and add the menu */ g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (gpm_tray_icon_show_info_cb), icon); @@ -317,7 +318,7 @@ gpm_tray_icon_add_primary_device (GpmTrayIcon *icon, GtkMenu *menu, UpDevice *de /* TRANSLATORS: % is a timestring, e.g. "6 hours 10 minutes" */ string = g_strdup_printf (_("%s remaining"), time_str); - item = gtk_image_menu_item_new_with_label (string); + item = mate_image_menu_item_new_with_label (string); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); g_free (time_str); g_free (string); @@ -371,9 +372,9 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon) } /* preferences */ - item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences")); + item = mate_image_menu_item_new_with_mnemonic (_("_Preferences")); image = gtk_image_new_from_icon_name ("preferences-system", GTK_ICON_SIZE_MENU); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); + mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item), image); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (gpm_tray_icon_show_preferences_cb), icon); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); -- cgit v1.2.1