Hello community,
here is the log from the commit of package libappindicator for
openSUSE:Leap:15.2 checked in at 2020-05-14 06:51:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/libappindicator (Old)
and /work/SRC/openSUSE:Leap:15.2/.libappindicator.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libappindicator"
Thu May 14 06:51:28 2020 rev:22 rq:805407 version:12.10.1+bzr20170215
Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/libappindicator/libappindicator.changes
2020-01-15 15:18:56.082359458 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.libappindicator.new.2738/libappindicator.changes
2020-05-14 06:51:39.563725920 +0200
@@ -1,0 +2,57 @@
+Tue Apr 14 10:01:22 UTC 2020 - Martin Liška <[email protected]>
+
+- Add -fcommon in order to fix boo#1164492.
+
+-------------------------------------------------------------------
+Thu Apr 9 22:02:52 UTC 2020 - Dominique Leuenberger <[email protected]>
+
+- Do not apply xappstatusicon.patch: pulls half of Mate into Ring1.
+
+-------------------------------------------------------------------
+Mon Mar 23 13:32:23 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Fix build on py2 less system
+
+-------------------------------------------------------------------
+Wed Feb 12 15:18:19 UTC 2020 - Maurizio Galli <[email protected]>
+
+- Added xappstatusicon.patch. It adds support for XAppStatus Icon by
+ Linux Mint.
+
+-------------------------------------------------------------------
+Sun Feb 2 11:49:09 UTC 2020 - Matthias Mailänder <[email protected]>
+
+- Use the vanilla nunit for compatibility with newer Mono
+
+-------------------------------------------------------------------
+Tue Oct 1 10:57:51 UTC 2019 - Stefan Brüns <[email protected]>
+
+- Make sure the OBS spec file parser does not apply the gtk3 psuffix
+ for the default ("") multibuild flavor.
+
+-------------------------------------------------------------------
+Wed Sep 18 19:07:04 UTC 2019 - Stefan Brüns <[email protected]>
+
+- Split gtk2 and gtk3 builds using _multibuild. Python2 and Mono
+ bindings are only available for GTK2, so the GTK3 version has
+ significantly less build dependencies,
+ add only_require_python_for_gtk2.patch
+- Drop dependency on deprecated gnome-common, see
+ https://wiki.gnome.org/Projects/GnomeCommon/Migration
+- Allow configure run to succeed even when gtk-doc is not installed,
+ add make_gtk_doc_optional.patch
+
+-------------------------------------------------------------------
+Wed May 15 14:40:16 UTC 2019 - Maurizio Galli <[email protected]>
+
+- Drop libappindicator-activate-support.patch as it's no longer needed and
+ breaks context menu / actions in fall-back mode (boo#1132659)
+
+-------------------------------------------------------------------
+Sun Jan 13 19:146:00 UTC 2019 - [email protected]
+
+- Changed the activate-support patch to signal an "activate-event"
+ so users can create callbacks themselves.
+ Original patch from Yichao Yu <[email protected]>.
+
+-------------------------------------------------------------------
Old:
----
libappindicator-activate-support.patch
New:
----
_multibuild
make_gtk_doc_optional.patch
only_require_python_for_gtk2.patch
xappstatusicon.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libappindicator.spec ++++++
--- /var/tmp/diff_new_pack.6rc64z/_old 2020-05-14 06:51:39.947726748 +0200
+++ /var/tmp/diff_new_pack.6rc64z/_new 2020-05-14 06:51:39.947726748 +0200
@@ -1,7 +1,7 @@
#
# spec file for package libappindicator
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,49 +12,73 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
-%define sover 1
-%define _version 12.10.1+17.04.20170215
-%if %{undefined with_mono}
+%global flavor @BUILD_FLAVOR@%{nil}
+%global sname libappindicator
+%if "%{flavor}" == ""
+ExclusiveArch: do-not-build
+%endif
+
+%if "%{flavor}" == "gtk2"
%bcond_without mono
+%bcond_without python
+%global gtkver 2
%endif
+%if "%{flavor}" == "gtk3"
%bcond_with mono
-Name: libappindicator
+%bcond_with python
+%global psuffix 3
+%global gtkver 3
+%endif
+
+%define sover 1
+%define _version 12.10.1+17.04.20170215
+Name: libappindicator%{?psuffix}
Version: 12.10.1+bzr20170215
Release: 0
Summary: Application indicators library
-License: LGPL-2.0 AND LGPL-3.0 AND GPL-3.0
+License: LGPL-2.0-only AND LGPL-3.0-only AND GPL-3.0-only
Group: System/Libraries
URL: https://launchpad.net/libappindicator
-Source:
https://launchpad.net/ubuntu/+archive/primary/+files/%{name}_%{_version}.orig.tar.gz
+Source:
https://launchpad.net/ubuntu/+archive/primary/+files/%{sname}_%{_version}.orig.tar.gz
# PATCH-FIX-UPSTREAM 0001_Fix_mono_dir.patch [email protected] -- Fix
location of .pc files.
Patch0: 0001_Fix_mono_dir.patch
-# PATCH-FIX-OPENSUSE libappindicator-activate-support.patch
[email protected] -- Open menu on the left-click action.
-Patch1: libappindicator-activate-support.patch
# PATCH-FIX=UPSTREAM libappindicator-no-Werror.patch [email protected] --
Don't add -Werror on build: the code is aging and does not keep up
Patch2: libappindicator-no-Werror.patch
+# PATCH-FIX-OPENSUSE only_require_python_for_gtk2.patch -- Only require Python
when building for GTK2
+Patch3: only_require_python_for_gtk2.patch
+# PATCH-FIX-OPENSUSE make_gtk_doc_optional.patch -- Do not require macros from
gtk-doc
+Patch4: make_gtk_doc_optional.patch
+# PATCH-FIX-UPSTREAM xappstatusicon.patch [email protected] -- Original
patch by Linux Mint. Include support for XAppStatusIcon by Linux Mint
+Patch5: xappstatusicon.patch
+BuildRequires: autoconf
+BuildRequires: automake
BuildRequires: fdupes
-BuildRequires: gnome-common
+BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: vala
-BuildRequires: pkgconfig(dbus-glib-1)
-BuildRequires: pkgconfig(dbusmenu-glib-0.4)
-BuildRequires: pkgconfig(dbusmenu-gtk-0.4)
-BuildRequires: pkgconfig(dbusmenu-gtk3-0.4)
BuildRequires: pkgconfig(gobject-introspection-1.0)
+#BuildRequires: pkgconfig(xapp) >= 1.5.0
+%if "%{flavor}" == "gtk2"
+BuildRequires: pkgconfig(dbusmenu-gtk-0.4)
BuildRequires: pkgconfig(gtk+-2.0)
-BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(indicator-0.4)
-BuildRequires: pkgconfig(indicator3-0.4)
+%if %{with python}
BuildRequires: pkgconfig(pygtk-2.0)
+%endif
%if %{with mono}
BuildRequires: pkgconfig(gapi-2.0)
BuildRequires: pkgconfig(gtk-sharp-2.0)
BuildRequires: pkgconfig(mono)
-BuildRequires: pkgconfig(mono-nunit)
+BuildRequires: pkgconfig(nunit)
+%endif
+%else
+BuildRequires: pkgconfig(dbusmenu-gtk3-0.4)
+BuildRequires: pkgconfig(gtk+-3.0)
+BuildRequires: pkgconfig(indicator3-0.4)
%endif
%description
@@ -93,10 +117,10 @@
%package devel
Summary: Development files for libappindicator
Group: Development/Libraries/C and C++
-Requires: libappindicator%{sover} = %{version}
+Requires: libappindicator%{?psuffix:%{psuffix}-}%{sover} = %{version}
%description devel
-This package contains the development files for the appindicator library.
+This package contains the development files for the appindicator%{?psuffix}
library.
%package -n libappindicator3-%{sover}
Summary: Application indicators library for GTK+3
@@ -117,14 +141,6 @@
This package contains the GObject Introspection bindings for the appindicator
library.
-%package -n libappindicator3-devel
-Summary: Development files for libappindicator3
-Group: Development/Libraries/C and C++
-Requires: libappindicator3-%{sover} = %{version}
-
-%description -n libappindicator3-devel
-This package contains the development files for the appindicator3 library.
-
%package doc
Summary: Documentation for libappindicator and libappindicator3
Group: Documentation/HTML
@@ -134,7 +150,6 @@
This package contains the documentation for the appindicator and appindicator3
libraries.
-%if %{with mono}
%package -n appindicator-sharp
Summary: Application indicators library for C#
Group: System/Libraries
@@ -152,38 +167,36 @@
%description -n appindicator-sharp-devel
This package contains the development files for the appindicator-sharp library.
-%endif
%prep
%setup -q -c
+cp ./src/app-indicator.c ./src/app-indicator-gtk2.c
%patch0 -p1
-%patch1 -p1
%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+#patch5 -p1
%build
-NOCONFIGURE=1 ./autogen.sh
+%global optflags %{optflags} -fcommon
+# Create dummy file, to avoid dependency on gtk-doc
+echo "EXTRA_DIST = " >> gtk-doc.make
+autoreconf -vfi
%if %{with mono}
export CSC=%{_bindir}/gmcs
%endif
-%global _configure ../configure
-for ver in 2 3; do
- mkdir build-gtk$ver
- pushd build-gtk$ver
- %configure \
- --disable-static \
- --disable-gtk-doc \
- --disable-mono-test \
- --with-gtk=$ver
- make -j1 V=1
- popd
-done
+%configure \
+--disable-static \
+--disable-gtk-doc \
+--disable-mono-test \
+--with-gtk=%{gtkver}
+make -j1 V=1
%install
-%make_install -C build-gtk2
-%make_install -C build-gtk3
+%make_install
find %{buildroot} -type f -name "*.la" -delete -print
-%fdupes %{buildroot}%{python_sitearch}
+%fdupes %{buildroot}%{python2_sitearch}
%post -n libappindicator%{sover} -p /sbin/ldconfig
@@ -193,32 +206,31 @@
%postun -n libappindicator3-%{sover} -p /sbin/ldconfig
+%if %{with python}
%files -n python2-appindicator
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
-%dir %{python_sitearch}/appindicator/
-%{python_sitearch}/appindicator/__init__.py*
-%{python_sitearch}/appindicator/_appindicator.so
+%dir %{python2_sitearch}/appindicator/
+%{python2_sitearch}/appindicator/__init__.py*
+%{python2_sitearch}/appindicator/_appindicator.so
%dir %{_datadir}/pygtk/
%dir %{_datadir}/pygtk/2.0/
%dir %{_datadir}/pygtk/2.0/defs/
%{_datadir}/pygtk/2.0/defs/appindicator.defs
+%endif
+%if "%{flavor}" == "gtk2"
%files -n libappindicator%{sover}
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/libappindicator.so.%{sover}*
%files -n typelib-1_0-AppIndicator-0_1
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/girepository-1.0/AppIndicator-0.1.typelib
%files devel
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%dir %{_includedir}/libappindicator-0.1/
@@ -230,20 +242,18 @@
%{_datadir}/vala/vapi/appindicator-0.1.vapi
%{_datadir}/vala/vapi/appindicator-0.1.deps
+%else
%files -n libappindicator3-%{sover}
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/libappindicator3.so.%{sover}*
%files -n typelib-1_0-AppIndicator3-0_1
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/girepository-1.0/AppIndicator3-0.1.typelib
%files -n libappindicator3-devel
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%dir %{_includedir}/libappindicator3-0.1/
@@ -254,10 +264,10 @@
%{_datadir}/gir-1.0/AppIndicator3-0.1.gir
%{_datadir}/vala/vapi/appindicator3-0.1.vapi
%{_datadir}/vala/vapi/appindicator3-0.1.deps
+%endif
%if %{with mono}
%files -n appindicator-sharp
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%dir %{_libdir}/appindicator-sharp-0.1/
@@ -280,7 +290,6 @@
%{_libexecdir}/mono/gac/policy.0.0.appindicator-sharp/*/policy.0.0.appindicator-sharp.dll
%files -n appindicator-sharp-devel
-%defattr(-,root,root)
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/pkgconfig/appindicator-sharp-0.1.pc
++++++ _multibuild ++++++
<multibuild>
<package>gtk2</package>
<package>gtk3</package>
</multibuild>
++++++ make_gtk_doc_optional.patch ++++++
--- a/configure.ac 2019-09-18 20:01:29.244433451 +0200
+++ b/configure.ac 2019-09-18 20:59:47.284282932 +0200
@@ -33,8 +33,12 @@
# GTK Doc
###########################
+# check for gtk-doc
+m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
-
+],[
+AM_CONDITIONAL([ENABLE_GTK_DOC], false)
+])
###########################
# Dependencies
++++++ only_require_python_for_gtk2.patch ++++++
--- a/configure.ac 2019-09-18 20:01:29.244433451 +0200
+++ b/configure.ac 2019-09-18 20:06:01.479617139 +0200
@@ -185,6 +185,8 @@
# Python
###########################
+AS_IF([test "x$with_gtk" = x2],
+ [
PYGTK_REQUIRED=2.14.0
PYGOBJECT_REQUIRED=0.22
@@ -207,6 +209,7 @@
PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir
pygtk-2.0`/codegen.py"
AC_SUBST(PYGTK_CODEGEN)
AC_MSG_RESULT($PYGTK_CODEGEN)
+])
#########################
# Check if build tests
++++++ xappstatusicon.patch ++++++
diff -rub a/configure.ac b/configure.ac
--- a/configure.ac 2017-02-15 22:15:21.000000000 +0800
+++ b/configure.ac 2020-02-13 00:42:12.928497295 +0800
@@ -58,7 +58,8 @@
glib-2.0 >= $GLIB_REQUIRED_VERSION
gio-2.0 >= $GIO_REQUIRED_VERSION
indicator3-0.4 >=
$INDICATOR_REQUIRED_VERSION
- dbusmenu-gtk3-0.4 >=
$DBUSMENUGTK_REQUIRED_VERSION)
+ dbusmenu-gtk3-0.4 >=
$DBUSMENUGTK_REQUIRED_VERSION
+ xapp >= 1.5.0)
AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available])
],
[test "x$with_gtk" = x2],
diff -rub a/src/appindicator3-0.1.pc.in b/src/appindicator3-0.1.pc.in
--- a/src/appindicator3-0.1.pc.in 2017-02-15 22:15:21.000000000 +0800
+++ b/src/appindicator3-0.1.pc.in 2020-02-12 23:39:49.768066612 +0800
@@ -5,7 +5,7 @@
includedir=@includedir@
Cflags: -I${includedir}/libappindicator3-0.1
-Requires: dbusmenu-glib-0.4 gtk+-3.0
+Requires: dbusmenu-glib-0.4 gtk+-3.0 xapp
Libs: -L${libdir} -lappindicator3
Name: appindicator3-0.1
diff -rub a/src/app-indicator.c b/src/app-indicator.c
--- a/src/app-indicator.c 2017-02-15 22:15:36.000000000 +0800
+++ b/src/app-indicator.c 2020-02-13 01:07:11.066450662 +0800
@@ -31,6 +31,8 @@
#include "config.h"
#endif
+#include <gdk/gdk.h>
+
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
#include <libdbusmenu-gtk/client.h>
@@ -52,6 +54,8 @@
#define PANEL_ICON_SUFFIX "panel"
+#define FALLBACK_ICON "image-missing"
+
/**
* AppIndicatorPrivate:
* All of the private data in an instance of an application indicator.
@@ -90,7 +94,7 @@
gchar * att_accessible_desc;
guint label_change_idle;
- GtkStatusIcon * status_icon;
+ XAppStatusIcon * status_icon;
gint fallback_timer;
/* Fun stuff */
@@ -186,14 +190,11 @@
static void register_service_cb (GObject * obj, GAsyncResult * res, gpointer
user_data);
static void start_fallback_timer (AppIndicator * self, gboolean
disable_timeout);
static gboolean fallback_timer_expire (gpointer data);
-static GtkStatusIcon * fallback (AppIndicator * self);
+static XAppStatusIcon * fallback (AppIndicator * self);
static void status_icon_status_wrapper (AppIndicator * self, const gchar *
status, gpointer data);
-static gboolean scroll_event_wrapper(GtkWidget *status_icon, GdkEventScroll
*event, gpointer user_data);
-static gboolean middle_click_wrapper(GtkWidget *status_icon, GdkEventButton
*event, gpointer user_data);
+// static gboolean scroll_event_wrapper(GtkWidget *status_icon, GdkEventScroll
*event, gpointer user_data);
static void status_icon_changes (AppIndicator * self, gpointer data);
-static void status_icon_activate (GtkStatusIcon * icon, gpointer data);
-static void status_icon_menu_activate (GtkStatusIcon *status_icon, guint
button, guint activate_time, gpointer user_data);
-static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon);
+static void unfallback (AppIndicator * self, XAppStatusIcon * status_icon);
static gchar * append_panel_icon_suffix (const gchar * icon_name);
static gchar * get_real_theme_path (AppIndicator * self);
static gchar * append_snap_prefix (const gchar * path);
@@ -952,6 +953,9 @@
if (g_strcmp0(oldlabel, priv->label) != 0) {
signal_label_change(APP_INDICATOR(object));
+ if (priv->status_icon != NULL) {
+ xapp_status_icon_set_label (priv->status_icon, priv->label ?
priv->label : "");
+ }
}
if (oldlabel != NULL) {
@@ -983,15 +987,16 @@
g_warning("Unable to send signal for NewTitle:
%s", error->message);
g_error_free(error);
}
+
+ if (priv->status_icon != NULL) {
+ xapp_status_icon_set_tooltip_text (priv->status_icon,
priv->title ? priv->title : "");
+ }
}
if (oldtitle != NULL) {
g_free(oldtitle);
}
- if (priv->status_icon != NULL) {
- gtk_status_icon_set_title(priv->status_icon,
priv->title ? priv->title : "");
- }
break;
}
case PROP_LABEL_GUIDE: {
@@ -1521,19 +1526,60 @@
return;
}
+/* Handles the middle-click secondary action coming from XAppStatusIcon. */
+static void
+status_icon_menu_button_activate (XAppStatusIcon *status_icon,
+ guint button,
+ guint activate_time,
+ gpointer user_data)
+{
+ AppIndicator *self = APP_INDICATOR (user_data);
+
+ if (button == GDK_BUTTON_PRIMARY || button == GDK_BUTTON_MIDDLE) {
+ GtkWidget *menuitem = self->priv->sec_activate_target;
+
+ if (menuitem != NULL &&
+ gtk_widget_get_visible (menuitem) &&
+ gtk_widget_get_sensitive (menuitem))
+ {
+ gtk_widget_activate (menuitem);
+ }
+ }
+}
+
+static void
+status_icon_set_has_secondary_activate (XAppStatusIcon *icon,
+ gboolean has)
+{
+ if (icon != NULL)
+ {
+ g_object_set_data (G_OBJECT (icon),
+ "app-indicator-has-secondary-activate",
GINT_TO_POINTER (has));
+ }
+}
+
/* Creates a StatusIcon that can be used when the application
indicator area isn't available. */
-static GtkStatusIcon *
+static XAppStatusIcon *
fallback (AppIndicator * self)
{
- GtkStatusIcon * icon = gtk_status_icon_new();
+ XAppStatusIcon * icon = xapp_status_icon_new();
+
+ xapp_status_icon_set_name(icon, app_indicator_get_id(self));
- gtk_status_icon_set_name(icon, app_indicator_get_id(self));
const gchar * title = app_indicator_get_title(self);
if (title != NULL) {
- gtk_status_icon_set_title(icon, title);
+ xapp_status_icon_set_tooltip_text (icon, title);
}
+ xapp_status_icon_set_label (icon, app_indicator_get_label (self));
+
+ /* Tell xapp-status-icon where this is coming from. It will change the
behavior
+ * of left clicks accordingly (to open the menu instead of some sort of
'activation') */
+ g_object_set_data (G_OBJECT (icon), "app-indicator", GINT_TO_POINTER (1));
+
+ status_icon_set_has_secondary_activate (icon,
self->priv->sec_activate_enabled);
+
g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_STATUS,
G_CALLBACK(status_icon_status_wrapper), icon);
g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_ICON,
@@ -1541,12 +1587,11 @@
g_signal_connect(G_OBJECT(self),
APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON,
G_CALLBACK(status_icon_changes), icon);
+ xapp_status_icon_set_secondary_menu (icon, app_indicator_get_menu (self));
+
status_icon_changes(self, icon);
- g_signal_connect(G_OBJECT(icon), "activate",
G_CALLBACK(status_icon_activate), self);
- g_signal_connect(G_OBJECT(icon), "popup-menu",
G_CALLBACK(status_icon_menu_activate), self);
- g_signal_connect(G_OBJECT(icon), "scroll-event",
G_CALLBACK(scroll_event_wrapper), self);
- g_signal_connect(G_OBJECT(icon), "button-release-event",
G_CALLBACK(middle_click_wrapper), self);
+ g_signal_connect(G_OBJECT(icon), "activate",
G_CALLBACK(status_icon_menu_button_activate), self);
return icon;
}
@@ -1561,49 +1606,22 @@
/* A wrapper for redirecting the scroll events to the app-indicator from status
icon widget. */
-static gboolean
-scroll_event_wrapper (GtkWidget *status_icon, GdkEventScroll *event, gpointer
data)
-{
- g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE);
- AppIndicator * app = APP_INDICATOR(data);
- g_signal_emit(app, signals[SCROLL_EVENT], 0, 1, event->direction);
+// static gboolean
+// scroll_event_wrapper (GtkWidget *status_icon, GdkEventScroll *event,
gpointer data)
+// {
+// g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE);
+// AppIndicator * app = APP_INDICATOR(data);
+// g_signal_emit(app, signals[SCROLL_EVENT], 0, 1, event->direction);
- return TRUE;
-}
-
-static gboolean
-middle_click_wrapper (GtkWidget *status_icon, GdkEventButton *event, gpointer
data)
-{
- g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE);
- AppIndicator * app = APP_INDICATOR(data);
- AppIndicatorPrivate *priv = app->priv;
-
- if (event->button == 2 && event->type == GDK_BUTTON_RELEASE) {
- GtkAllocation alloc;
- gint px = event->x;
- gint py = event->y;
- gtk_widget_get_allocation (status_icon, &alloc);
- GtkWidget *menuitem = priv->sec_activate_target;
-
- if (px >= 0 && px < alloc.width && py >= 0 && py < alloc.height
&&
- priv->sec_activate_enabled && menuitem &&
- gtk_widget_get_visible (menuitem) &&
- gtk_widget_get_sensitive (menuitem))
- {
- gtk_widget_activate (menuitem);
- return TRUE;
- }
- }
-
- return FALSE;
-}
+// return TRUE;
+// }
/* This tracks changes to either the status or the icons
that are associated with the app indicator */
static void
status_icon_changes (AppIndicator * self, gpointer data)
{
- GtkStatusIcon * icon = GTK_STATUS_ICON(data);
+ XAppStatusIcon * icon = XAPP_STATUS_ICON(data);
/* add the icon_theme_path once if needed */
GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
@@ -1632,17 +1650,17 @@
switch (app_indicator_get_status(self)) {
case APP_INDICATOR_STATUS_PASSIVE:
/* hide first to avoid that the change is visible to the user */
- gtk_status_icon_set_visible(icon, FALSE);
+ xapp_status_icon_set_visible(icon, FALSE);
icon_name = app_indicator_get_icon(self);
break;
case APP_INDICATOR_STATUS_ACTIVE:
icon_name = app_indicator_get_icon(self);
- gtk_status_icon_set_visible(icon, TRUE);
+ xapp_status_icon_set_visible(icon, TRUE);
break;
case APP_INDICATOR_STATUS_ATTENTION:
/* get the _attention_ icon here */
icon_name = app_indicator_get_attention_icon(self);
- gtk_status_icon_set_visible(icon, TRUE);
+ xapp_status_icon_set_visible(icon, TRUE);
break;
};
@@ -1650,65 +1668,66 @@
gchar *snapped_icon = append_snap_prefix(icon_name);
if (g_file_test(icon_name, G_FILE_TEST_EXISTS)) {
- gtk_status_icon_set_from_file(icon, icon_name);
+ xapp_status_icon_set_icon_name(icon, icon_name);
} else if (snapped_icon && g_file_test(snapped_icon,
G_FILE_TEST_EXISTS)) {
- gtk_status_icon_set_from_file(icon, snapped_icon);
+ xapp_status_icon_set_icon_name(icon, snapped_icon);
} else {
gchar *longname = append_panel_icon_suffix(icon_name);
if (longname != NULL && gtk_icon_theme_has_icon
(icon_theme, longname)) {
- gtk_status_icon_set_from_icon_name(icon,
longname);
+ xapp_status_icon_set_icon_name(icon, longname);
} else {
- gtk_status_icon_set_from_icon_name(icon,
icon_name);
- }
+ if (gtk_icon_theme_has_icon (icon_theme, icon_name)) {
+ xapp_status_icon_set_icon_name(icon, icon_name);
+ } else {
+ gint i;
+ gchar *icon_path;
- g_free(longname);
+ const gchar *extensions[] = {
+ "png",
+ "svg",
+ };
+
+ for (i = 0; i < G_N_ELEMENTS (extensions); i++) {
+ icon_path = g_strdup_printf ("%s/%s.%s", theme_path,
icon_name, extensions[i]);
+
+ if (g_file_test (icon_path, G_FILE_TEST_EXISTS)) {
+ break;
}
- g_free(snapped_icon);
+ g_clear_pointer (&icon_path, g_free);
}
- return;
-}
+ if (icon_path) {
+ xapp_status_icon_set_icon_name (icon, icon_path);
+ g_free (icon_path);
+ } else {
+ // Should we do this?? Otherwise there's a blank (but
reactive)
+ // space in the panel
+ xapp_status_icon_set_icon_name (icon, FALLBACK_ICON);
+ }
+ }
+ }
-/* Handles the activate action by the status icon by showing
- the menu in a popup. */
-static void
-status_icon_activate (GtkStatusIcon * icon, gpointer data)
-{
- GtkMenu * menu = app_indicator_get_menu(APP_INDICATOR(data));
- if (menu == NULL)
- return;
+ g_free(longname);
+ }
- gtk_menu_popup(menu,
- NULL, /* Parent Menu */
- NULL, /* Parent item */
- gtk_status_icon_position_menu,
- icon,
- 1, /* Button */
- gtk_get_current_event_time());
+ g_free(snapped_icon);
+ }
return;
}
-/* Handles the right-click action by the status icon by showing
- the menu in a popup. */
-static void
-status_icon_menu_activate (GtkStatusIcon *status_icon, guint button, guint
activate_time, gpointer user_data)
-{
- status_icon_activate(status_icon, user_data);
-}
-
/* Removes the status icon as the application indicator area
is now up and running again. */
static void
-unfallback (AppIndicator * self, GtkStatusIcon * status_icon)
+unfallback (AppIndicator * self, XAppStatusIcon * status_icon)
{
g_signal_handlers_disconnect_by_func(G_OBJECT(self),
status_icon_status_wrapper, status_icon);
g_signal_handlers_disconnect_by_func(G_OBJECT(self),
status_icon_changes, status_icon);
- g_signal_handlers_disconnect_by_func(G_OBJECT(self),
scroll_event_wrapper, status_icon);
- g_signal_handlers_disconnect_by_func(G_OBJECT(self),
middle_click_wrapper, status_icon);
- gtk_status_icon_set_visible(status_icon, FALSE);
+ g_signal_handlers_disconnect_by_func(G_OBJECT(self),
status_icon_menu_button_activate, status_icon);
+
+ xapp_status_icon_set_visible(status_icon, FALSE);
g_object_unref(G_OBJECT(status_icon));
return;
}
@@ -1760,6 +1779,8 @@
g_return_if_fail(IS_APP_INDICATOR(data));
AppIndicator *self = data;
self->priv->sec_activate_enabled = widget_is_menu_child(self, menuitem);
+
+ status_icon_set_has_secondary_activate (self->priv->status_icon,
self->priv->sec_activate_enabled);
}
@@ -2053,6 +2074,7 @@
PROP_LABEL_GUIDE_S, guide == NULL ? "" : guide,
NULL);
+
return;
}
@@ -2224,9 +2246,14 @@
priv->menu = GTK_WIDGET (menu);
g_object_ref_sink (priv->menu);
+ if (self->priv->status_icon) {
+ xapp_status_icon_set_secondary_menu (self->priv->status_icon, menu);
+ }
+
setup_dbusmenu (self);
priv->sec_activate_enabled = widget_is_menu_child (self,
priv->sec_activate_target);
+ status_icon_set_has_secondary_activate (self->priv->status_icon,
priv->sec_activate_enabled);
check_connect (self);
@@ -2280,6 +2307,7 @@
self);
g_object_unref(G_OBJECT(priv->sec_activate_target));
priv->sec_activate_target = NULL;
+ status_icon_set_has_secondary_activate (priv->status_icon,
FALSE);
}
if (menuitem == NULL) {
@@ -2288,8 +2316,9 @@
g_return_if_fail (GTK_IS_WIDGET (menuitem));
- priv->sec_activate_target = g_object_ref(G_OBJECT(menuitem));
+ priv->sec_activate_target = g_object_ref(menuitem);
priv->sec_activate_enabled = widget_is_menu_child(self, menuitem);
+ status_icon_set_has_secondary_activate (priv->status_icon,
priv->sec_activate_enabled);
g_signal_connect(menuitem, "parent-set",
G_CALLBACK(sec_activate_target_parent_changed), self);
}
diff -rub a/src/app-indicator.h b/src/app-indicator.h
--- a/src/app-indicator.h 2017-02-15 22:15:21.000000000 +0800
+++ b/src/app-indicator.h 2020-02-13 01:04:06.226176973 +0800
@@ -32,6 +32,14 @@
#include <gtk/gtk.h>
+#if GTK_MAJOR_VERSION == 3
+#define USE_XAPP_FALLBACK 1
+#endif
+
+#ifdef USE_XAPP_FALLBACK
+#include <libxapp/xapp-status-icon.h>
+#endif
+
G_BEGIN_DECLS
/**
@@ -218,10 +226,18 @@
void (*app_indicator_reserved_ats)(void);
/* Overridable Functions */
+#ifdef USE_XAPP_FALLBACK
+ XAppStatusIcon * (*fallback) (AppIndicator * indicator);
+ void (*unfallback) (AppIndicator * indicator,
+ XAppStatusIcon * status_icon);
+
+#else
GtkStatusIcon * (*fallback) (AppIndicator * indicator);
void (*unfallback) (AppIndicator * indicator,
GtkStatusIcon * status_icon);
+#endif
+
/* Reserved */
void (*app_indicator_reserved_1)(void);
void (*app_indicator_reserved_2)(void);
diff -rub a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am 2017-02-15 22:15:21.000000000 +0800
+++ b/src/Makefile.am 2020-02-13 00:11:49.889693111 +0800
@@ -57,7 +57,6 @@
libappindicator_la_SOURCES = \
$(libappindicator_headers) \
app-indicator-enum-types.c \
- app-indicator.c \
application-service-marshal.c \
dbus-shared.h \
generate-id.h \
@@ -67,6 +66,14 @@
gen-notification-watcher.xml.h \
gen-notification-watcher.xml.c
+if USE_GTK3
+libappindicator_la_SOURCES += \
+ app-indicator.c
+else
+libappindicator_la_SOURCES += \
+ app-indicator-gtk2.c
+endif
+
libappindicator_la_LDFLAGS = \
$(COVERAGE_LDFLAGS) \
-version-info 1:0:0 \
@@ -149,9 +156,15 @@
if HAVE_INTROSPECTION
+if USE_GTK3
introspection_sources = \
$(addprefix $(srcdir)/,app-indicator.c) \
$(addprefix $(srcdir)/,$(libappindicator_headers))
+else
+introspection_sources = \
+ $(addprefix $(srcdir)/,app-indicator-gtk2.c) \
+ $(addprefix $(srcdir)/,$(libappindicator_headers))
+endif
AppIndicator$(VER)-0.1.gir: libappindicator$(VER).la
diff -rub a/tests/test-libappindicator-fallback-item.c
b/tests/test-libappindicator-fallback-item.c
--- a/tests/test-libappindicator-fallback-item.c 2017-02-15
22:15:21.000000000 +0800
+++ b/tests/test-libappindicator-fallback-item.c 2020-02-13
01:06:01.518347682 +0800
@@ -31,8 +31,14 @@
static void test_libappindicator_fallback_item_class_init
(TestLibappindicatorFallbackItemClass *klass);
static void test_libappindicator_fallback_item_init
(TestLibappindicatorFallbackItem *self);
+
+#ifdef USE_XAPP_FALLBACK
+static XAppStatusIcon * fallback (AppIndicator * indicator);
+static void unfallback (AppIndicator * indicator, XAppStatusIcon *
status_icon);
+#else
static GtkStatusIcon * fallback (AppIndicator * indicator);
static void unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon);
+#endif
G_DEFINE_TYPE (TestLibappindicatorFallbackItem,
test_libappindicator_fallback_item, APP_INDICATOR_TYPE);
@@ -63,6 +69,39 @@
gint state = STATE_INIT;
+#ifdef USE_XAPP_FALLBACK
+static XAppStatusIcon *
+fallback (AppIndicator * indicator)
+{
+ g_debug("Fallback");
+ if (state == STATE_INIT) {
+ state = STATE_FALLBACK;
+ } else if (state == STATE_UNFALLBACK) {
+ state = STATE_REFALLBACK;
+ } else {
+ g_debug("Error, fallback in state: %d", state);
+ passed = FALSE;
+ }
+ return (XAppStatusIcon *)5;
+}
+
+static void
+unfallback (AppIndicator * indicator, XAppStatusIcon * status_icon)
+{
+ g_debug("Unfallback");
+ if (state == STATE_FALLBACK) {
+ state = STATE_UNFALLBACK;
+ } else if (state == STATE_REFALLBACK) {
+ state = STATE_REUNFALLBACK;
+ passed = TRUE;
+ g_main_loop_quit(mainloop);
+ } else {
+ g_debug("Error, unfallback in state: %d", state);
+ passed = FALSE;
+ }
+ return;
+}
+#else
static GtkStatusIcon *
fallback (AppIndicator * indicator)
{
@@ -94,6 +133,7 @@
}
return;
}
+#endif // USE_XAPP_FALLBACK
gboolean
kill_func (gpointer data)