From 65a6c367e28e338dc74931dece1af9e53338276f Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Tue, 31 Jan 2023 01:25:20 -0500 Subject: Prefer building against Ayatana AppIndicator, but also support legacy Ubuntu Appindicator --- src/Makefile.am | 6 ++++-- src/main.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index a534d1e..5f7ead8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,7 +35,8 @@ polkit_mate_authentication_agent_1_CFLAGS = \ $(GLIB_CFLAGS) \ $(POLKIT_AGENT_CFLAGS) \ $(POLKIT_GOBJECT_CFLAGS) \ - $(APPINDICATOR_CFLAGS) \ + $(AYATANA_APPINDICATOR_CFLAGS) \ + $(UBUNTU_APPINDICATOR_CFLAGS) \ $(WARN_CFLAGS) \ $(AM_CFLAGS) @@ -47,7 +48,8 @@ polkit_mate_authentication_agent_1_LDADD = \ $(GLIB_LIBS) \ $(POLKIT_AGENT_LIBS) \ $(POLKIT_GOBJECT_LIBS) \ - $(APPINDICATOR_LIBS) + $(AYATANA_APPINDICATOR_LIBS) \ + $(UBUNTU_APPINDICATOR_LIBS) EXTRA_DIST = \ polkit-mate-authentication-agent-1.desktop.in \ diff --git a/src/main.c b/src/main.c index 8c5f437..d60cd8f 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,5 @@ /* * Copyright (C) 2009 Red Hat, Inc. - * Copyright (C) 2012-2021 MATE Developers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,8 +29,10 @@ #include #include -#ifdef HAVE_APPINDICATOR -#include +#if defined(HAVE_AYATANA_APPINDICATOR) +# include +#elif defined(HAVE_UBUNTU_APPINDICATOR) +# include #endif #include "polkitmatelistener.h" @@ -51,7 +52,7 @@ static PolkitSubject *session = NULL; /* the current set of temporary authorizations */ static GList *current_temporary_authorizations = NULL; -#ifdef HAVE_APPINDICATOR +#if defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_UBUNTU_APPINDICATOR) static AppIndicator *app_indicator = NULL; #else static GtkStatusIcon *status_icon = NULL; @@ -90,7 +91,7 @@ revoke_tmp_authz (void) NULL); } -#ifdef HAVE_APPINDICATOR +#if defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_UBUNTU_APPINDICATOR) static void on_menu_item_activate (GtkMenuItem *menu_item, gpointer user_data) @@ -151,7 +152,7 @@ update_temporary_authorization_icon_real (void) if (current_temporary_authorizations != NULL) { /* show icon */ -#ifdef HAVE_APPINDICATOR +#if defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_UBUNTU_APPINDICATOR) if (app_indicator == NULL) { GtkWidget *item, *menu; @@ -199,7 +200,7 @@ update_temporary_authorization_icon_real (void) else { /* hide icon */ -#ifdef HAVE_APPINDICATOR +#if defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_UBUNTU_APPINDICATOR) if (app_indicator != NULL) { /* keep the app_indicator, hide the icon or it won't come back*/ -- cgit v1.2.1