Skip to content

Commit

Permalink
replace deprecated gtk-image-menu-item*
Browse files Browse the repository at this point in the history
  • Loading branch information
raveit65 authored and lukefromdc committed Oct 9, 2023
1 parent a6ea51b commit ebb3a79
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 23 deletions.
33 changes: 33 additions & 0 deletions .build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ requires:
- meson
- which
- yelp-tools
# mate-desktop dependencies
- iso-codes
- gobject-introspection

debian:
# Useful URL: https://github.com/mate-desktop/debian-packages
Expand Down Expand Up @@ -57,6 +60,10 @@ requires:
- mate-common
- meson
- yelp-tools
# mate-desktop dependencies
- iso-codes
- gobject-introspection
- libgirepository1.0-dev

fedora:
# Useful URL: https://src.fedoraproject.org/cgit/rpms/mate-panel.git
Expand All @@ -80,6 +87,9 @@ requires:
- meson
- redhat-rpm-config
- yelp-tools
# mate-desktop dependencies
- iso-codes-devel
- gobject-introspection-devel

ubuntu:
- autoconf-archive
Expand Down Expand Up @@ -112,6 +122,10 @@ requires:
- mate-common
- meson
- yelp-tools
# mate-desktop dependencies
- iso-codes
- gobject-introspection
- libgirepository1.0-dev

variables:
- 'CHECKERS="
Expand All @@ -130,10 +144,29 @@ 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:

build_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

- cd ${START_DIR}
- if [ ${DISTRO_NAME} == "debian" ];then
- export CFLAGS+=" -Wsign-compare"
- cppcheck --enable=warning,style,performance,portability,information,missingInclude -i'gtk-layer-shell-build' .
Expand Down
18 changes: 9 additions & 9 deletions applets/notification_area/status-notifier/sn-dbus-menu-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include <config.h>
#include <libmate-desktop/mate-image-menu-item.h>

#include "sn-dbus-menu-item.h"

Expand Down Expand Up @@ -203,9 +204,8 @@ sn_dbus_menu_item_new (GVariant *props)
cairo_surface_destroy (surface);
}

item->item = gtk_image_menu_item_new ();
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item->item), TRUE);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item),
item->item = mate_image_menu_item_new ();
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item),
image);
}

Expand Down Expand Up @@ -326,7 +326,7 @@ sn_dbus_menu_item_update_props (SnDBusMenuItem *item,
image = NULL;
}

gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item),
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item),
image);
}
else if (g_strcmp0 (prop, "icon-data") == 0)
Expand All @@ -348,7 +348,7 @@ sn_dbus_menu_item_update_props (SnDBusMenuItem *item,
image = NULL;
}

gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item),
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item),
image);
}
else if (g_strcmp0 (prop, "label") == 0)
Expand Down Expand Up @@ -438,18 +438,18 @@ sn_dbus_menu_item_remove_props (SnDBusMenuItem *item,
else if (g_strcmp0 (prop, "icon-name") == 0)
{
g_clear_pointer (&item->icon_name, g_free);
if (GTK_IS_IMAGE_MENU_ITEM (item->item))
if (MATE_IS_IMAGE_MENU_ITEM (item->item))
{
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item),
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item),
NULL);
}
}
else if (g_strcmp0 (prop, "icon-data") == 0)
{
g_clear_object (&item->icon_data);
if (GTK_IS_IMAGE_MENU_ITEM (item->item))
if (MATE_IS_IMAGE_MENU_ITEM (item->item))
{
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item),
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item),
NULL);
}
}
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fi

LT_LIB_M

LIBMATE_DESKTOP_REQUIRED=1.17.0
LIBMATE_DESKTOP_REQUIRED=1.27.1
GDK_PIXBUF_REQUIRED=2.26.0
PANGO_REQUIRED=1.15.4
GLIB_REQUIRED=2.50.0
Expand Down
9 changes: 4 additions & 5 deletions mate-panel/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <libmate-desktop/mate-gsettings.h>
#include <libmate-desktop/mate-image-menu-item.h>
#include <matemenu-tree.h>

#include <libpanel-util/panel-keyfile.h>
Expand Down Expand Up @@ -768,7 +769,7 @@ setup_menuitem (GtkWidget *menuitem,

gtk_icon_size_lookup (icon_size, NULL, &icon_height);
gtk_widget_show (image);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (menuitem),
image);
gtk_image_set_pixel_size (GTK_IMAGE(image), icon_height);
}
Expand Down Expand Up @@ -964,9 +965,7 @@ panel_image_menu_item_new (void)
{
GtkWidget *menuitem;

menuitem = gtk_image_menu_item_new ();
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem),
TRUE);
menuitem = mate_image_menu_item_new ();
return menuitem;
}

Expand All @@ -983,7 +982,7 @@ create_submenu_entry (GtkWidget *menu,
if (force_categories_icon)
menuitem = panel_image_menu_item_new ();
else
menuitem = gtk_image_menu_item_new ();
menuitem = mate_image_menu_item_new ();

setup_menuitem_with_icon (menuitem,
panel_menu_icon_get_size (),
Expand Down
6 changes: 4 additions & 2 deletions mate-panel/panel-menu-bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include <string.h>
#include <glib/gi18n.h>

#include <libmate-desktop/mate-image-menu-item.h>

#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-launch.h>
#include <libpanel-util/panel-show.h>
Expand Down Expand Up @@ -135,12 +137,12 @@ panel_menu_bar_update_visibility (GSettings *settings,
image = gtk_image_new_from_icon_name(str, icon_size);
else
image = gtk_image_new_from_icon_name(PANEL_ICON_MAIN_MENU, icon_size);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menubar->priv->applications_item), image);
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (menubar->priv->applications_item), image);
gtk_image_set_pixel_size (GTK_IMAGE (image), icon_height);
g_free (str);
}
else
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menubar->priv->applications_item), NULL);
mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (menubar->priv->applications_item), NULL);
}

static void panel_menu_bar_init(PanelMenuBar* menubar)
Expand Down
9 changes: 5 additions & 4 deletions mate-panel/panel-menu-items.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <libmate-desktop/mate-gsettings.h>
#include <libmate-desktop/mate-image-menu-item.h>

#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-glib.h>
Expand Down Expand Up @@ -231,7 +232,7 @@ panel_menu_items_append_from_desktop (GtkWidget *menu,
if (use_icon) {
item = panel_image_menu_item_new ();
} else {
item = gtk_image_menu_item_new ();
item = mate_image_menu_item_new ();
}

setup_menuitem_with_icon (item, panel_menu_icon_get_size (),
Expand Down Expand Up @@ -312,7 +313,7 @@ panel_menu_items_create_action_item_full (PanelActionButtonType action_type,
if (panel_action_get_is_disabled (action_type))
return NULL;

item = gtk_image_menu_item_new ();
item = mate_image_menu_item_new ();
setup_menuitem_with_icon (item,
panel_menu_icon_get_size (),
NULL,
Expand Down Expand Up @@ -458,7 +459,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu, guint max_items_or_
} else {
GtkWidget *item;

item = gtk_image_menu_item_new ();
item = mate_image_menu_item_new ();
setup_menuitem_with_icon (item, panel_menu_icon_get_size (),
NULL, PANEL_ICON_BOOKMARKS,
_("Bookmarks"));
Expand Down Expand Up @@ -905,7 +906,7 @@ panel_place_menu_item_append_local_gio (PanelPlaceMenuItem *place_item,
} else {
GtkWidget *menu_item;

menu_item = gtk_image_menu_item_new ();
menu_item = mate_image_menu_item_new ();
setup_menuitem_with_icon (menu_item, panel_menu_icon_get_size (),
NULL,
PANEL_ICON_REMOVABLE_MEDIA,
Expand Down
6 changes: 4 additions & 2 deletions mate-panel/panel-recent.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <glib/gi18n.h>
#include <gio/gio.h>

#include <libmate-desktop/mate-image-menu-item.h>

#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-show.h>
#include <libpanel-util/panel-gtk.h>
Expand Down Expand Up @@ -192,7 +194,7 @@ panel_recent_append_documents_menu (GtkWidget *top_menu,
GtkWidget *menu_item;
int size;

menu_item = gtk_image_menu_item_new ();
menu_item = mate_image_menu_item_new ();
setup_menuitem_with_icon (menu_item,
panel_menu_icon_get_size (),
NULL,
Expand Down Expand Up @@ -234,7 +236,7 @@ panel_recent_append_documents_menu (GtkWidget *top_menu,

add_menu_separator (recent_menu);

menu_item = gtk_image_menu_item_new ();
menu_item = mate_image_menu_item_new ();
setup_menuitem_with_icon (menu_item,
panel_menu_icon_get_size (),
NULL,
Expand Down

0 comments on commit ebb3a79

Please sign in to comment.