Sync from SUSE:SLFO:Main libappindicator revision cf095544e3bb8e3e0304d29c263db639

This commit is contained in:
Adrian Schröter 2024-05-03 14:32:33 +02:00
commit 88edaf7fcd
8 changed files with 1012 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

24
0001_Fix_mono_dir.patch Normal file
View File

@ -0,0 +1,24 @@
diff -aur a/bindings/mono/appindicator-sharp-0.1.pc.in b/bindings/mono/appindicator-sharp-0.1.pc.in
--- a/bindings/mono/appindicator-sharp-0.1.pc.in
+++ b/bindings/mono/appindicator-sharp-0.1.pc.in
@@ -1,7 +1,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
-assemblies_dir=${prefix}/lib/cli/appindicator-sharp-0.1
+assemblies_dir=${libdir}/appindicator-sharp-0.1
Name: appindicator-sharp
Description: application indicators for .NET
diff -aur a/bindings/mono/Makefile.am b/bindings/mono/Makefile.am
--- a/bindings/mono/Makefile.am
+++ b/bindings/mono/Makefile.am
@@ -31,7 +31,7 @@
$(DLLPOLICY1) \
$(POLICY1).config
-assemblydir = $(libdir)/cli/appindicator-sharp-0.1
+assemblydir = $(libdir)/appindicator-sharp-0.1
assembly_DATA = $(TARGET)
CLEANFILES = \

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>gtk2</package>
<package>gtk3</package>
</multibuild>

186
libappindicator.changes Normal file
View File

@ -0,0 +1,186 @@
-------------------------------------------------------------------
Sat Nov 12 07:07:18 UTC 2022 - Bernhard Wiedemann <bwiedemann@suse.com>
- Let the rpm provide libappindicator-gtk3 for EL8 compat
-------------------------------------------------------------------
Sat Nov 20 19:39:20 UTC 2021 - Alexei Sorokin <sor.alexei@meowr.ru>
- Update to version 12.10.1~bzr20200706.298 (chages since
12.10.1~bzr20170215.282):
* Fix build failures.
* Vendorise indicator-desktop-shortcuts (convenience wrapper
around gdesktopappinfo) from the libindicator project, to drop
the dependency on libindicator as none of the rest of it is
used.
* Don't build with -Werror.
* Drop Python 2 bindings and GObject Introspection for GTK 2
(lp#1740637).
* app-indicator: Don't pass unexpected parameter to signal
emissions (lp#1867996).
* app-indicator: Only check for item numbers when iterating
array (lp#1867996).
* Fall back to tray icon when StatusNotifierHost is not
available.
- Drop libappindicator-no-Werror.patch: fixed upstream.
- Drop only_require_python_for_gtk2.patch: no longer needed.
- Rebase xappstatusicon.patch.
-------------------------------------------------------------------
Sun Dec 20 16:34:27 UTC 2020 - Callum Farmer <gmbr3@opensuse.org>
- Provide RH used libappindicator symbol, so third party rpms
like Mailspring won't complain about missing dependencies
-------------------------------------------------------------------
Fri Aug 7 10:14:02 UTC 2020 - Michal Vyskocil <mvyskocil@opensuse.org>
- Provide RH used libappindicator-gtk3 symbol, so third party rpms
like Slack won't complain about missing dependencies
-------------------------------------------------------------------
Tue Jul 7 13:20:25 UTC 2020 - Callum Farmer <callumjfarmer13@gmail.com>
- Fixes for %_libexecdir changing to /usr/libexec
-------------------------------------------------------------------
Tue Apr 14 10:01:22 UTC 2020 - Martin Liška <mliska@suse.cz>
- Add -fcommon in order to fix boo#1164492.
-------------------------------------------------------------------
Thu Apr 9 22:02:52 UTC 2020 - Dominique Leuenberger <dleuenberger@suse.com>
- Do not apply xappstatusicon.patch: pulls half of Mate into Ring1.
-------------------------------------------------------------------
Mon Mar 23 13:32:23 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Fix build on py2 less system
-------------------------------------------------------------------
Wed Feb 12 15:18:19 UTC 2020 - Maurizio Galli <maurizio.galli@gmail.com>
- Added xappstatusicon.patch. It adds support for XAppStatus Icon by
Linux Mint.
-------------------------------------------------------------------
Sun Feb 2 11:49:09 UTC 2020 - Matthias Mailänder <mailaender@opensuse.org>
- Use the vanilla nunit for compatibility with newer Mono
-------------------------------------------------------------------
Tue Oct 1 10:57:51 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- 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 <stefan.bruens@rwth-aachen.de>
- 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 <maurizio.galli@gmail.com>
- 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 - ximi.obs@gmail.com
- Changed the activate-support patch to signal an "activate-event"
so users can create callbacks themselves.
Original patch from Yichao Yu <yyc1992@gmail.com>.
-------------------------------------------------------------------
Sat Mar 10 14:14:54 UTC 2018 - dimstar@opensuse.org
- Add libappindicator-no-Werror.patch: the libappindicator code is
aging and is not keeping up well with the moving world around it.
-------------------------------------------------------------------
Mon Sep 4 16:06:31 UTC 2017 - dimstar@opensuse.org
- Disable building of -doc subpackage (source not compatible with
gtk-doc 1.26 - and the doc is available online anyway):
+ Remove gtk-doc BuildRequires.
+ Replace --enable-gtk-doc configure parameter with
--disable-gtk-doc,
+ Drop the -doc subpackage.
-------------------------------------------------------------------
Fri Apr 28 16:04:54 UTC 2017 - jengelh@inai.de
- Rename %soname to %sover to better reflect its purpose.
- Update summaries.
- Remove redundant pkgconfig() reqiures; these are already
autodiscovered.
-------------------------------------------------------------------
Wed Apr 19 19:50:11 UTC 2017 - sor.alexei@meowr.ru
- Update to version 12.10.1+bzr20170215 (changes since
12.10.1+bzr20141110):
* Handle watcher service appearing and disappearing.
* Make test-simple-app really working.
* Fix icon and theme paths when running in $SNAP environment
(lp#1600136).
* Do not emit label changes when guide is still empty.
* Do not append the snap prefix if the icon is saved in a well
known readable path.
- Add libappindicator-activate-support.patch: Open menu on the
left-click action (lp#1403449).
- Rename python-appindicator to python2-appindicator.
-------------------------------------------------------------------
Thu Jul 7 09:25:12 UTC 2016 - t.gruner@katodev.de
- Allow building with mono support in case without mono is set
-------------------------------------------------------------------
Mon Jun 13 10:22:47 UTC 2016 - sor.alexei@meowr.ru
- Little spec cleanup.
-------------------------------------------------------------------
Tue May 5 13:47:23 UTC 2015 - sor.alexei@meowr.ru
- Update to 12.10.1+bzr20141110:
* scroll-event: change parameter to the right type.
- Rebase 0001_Fix_mono_dir.patch.
- Remove no-deprecated.patch: merged upstream.
- Remove dont-build-examples.patch: fixed upstream.
- Minor spec cleanup.
-------------------------------------------------------------------
Thu Mar 5 11:32:19 UTC 2015 - schwab@suse.de
- Allow building without mono support
-------------------------------------------------------------------
Tue Mar 11 10:41:46 UTC 2014 - p.drouand@gmail.com
- Fix appindicator-sharp require in appindicator-sharp-devel
-------------------------------------------------------------------
Mon Mar 10 15:15:37 UTC 2014 - p.drouand@gmail.com
- Fix license; src/generate-id.c is released and distributed under
GPL-3.0 license
-------------------------------------------------------------------
Fri Mar 7 20:18:46 UTC 2014 - hrvoje.senjan@gmail.com
- Init libappindicator package
- Add 0001_Fix_mono_dir.patch; fix location of .pc files
- Add dont-build-examples.patch; don't build examples
- Add no-deprecated.patch; don't fail on deprecated declarations

206
libappindicator.spec Normal file
View File

@ -0,0 +1,206 @@
#
# spec file for package libappindicator
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "gtk2"
%global gtkver 2
%bcond_without mono
%endif
%if "%{flavor}" == "gtk3"
%global psuffix 3
%global gtkver 3
%bcond_with mono
%endif
%define sover 1
%define _version 12.10.1+20.10.20200706.1
Name: libappindicator
Version: 12.10.1~bzr20200706.298
Release: 0
Summary: Application indicators library
License: GPL-3.0-only AND LGPL-2.0-only AND LGPL-3.0-only
Group: System/GUI/Other
URL: https://launchpad.net/libappindicator
Source: https://launchpad.net/ubuntu/+archive/primary/+files/%{name}_%{_version}.orig.tar.gz
# PATCH-FIX-UPSTREAM 0001_Fix_mono_dir.patch hrvoje.senjan@gmail.com -- Fix location of .pc files.
Patch0: 0001_Fix_mono_dir.patch
# PATCH-FIX-OPENSUSE make_gtk_doc_optional.patch -- Do not require macros from gtk-doc
Patch1: make_gtk_doc_optional.patch
# PATCH-FIX-OPENSUSE xappstatusicon.patch maurizio.galli@gmail.com -- Original patch by Linux Mint. Include support for XAppStatusIcon by Linux Mint
Patch2: xappstatusicon.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: fdupes
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: pkgconfig(gobject-introspection-1.0)
%if "%{flavor}" == ""
ExclusiveArch: do-not-build
%endif
%if "%{flavor}" == "gtk2"
BuildRequires: pkgconfig(dbusmenu-gtk-0.4)
BuildRequires: pkgconfig(gtk+-2.0)
%if %{with mono}
BuildRequires: pkgconfig(gapi-2.0)
BuildRequires: pkgconfig(gtk-sharp-2.0)
BuildRequires: pkgconfig(mono)
BuildRequires: pkgconfig(nunit)
%endif
%else
BuildRequires: vala
BuildRequires: pkgconfig(dbusmenu-gtk3-0.4)
BuildRequires: pkgconfig(gtk+-3.0)
#BuildRequires: pkgconfig(xapp) >= 1.5.0
%endif
Provides: libappindicator-gtk3
%description
A library to allow applications to export a menu into the Unity Menu bar. Based
on KSNI it also works in KDE and will fallback to generic Systray support if
none of those are available.
%package -n libappindicator%{?psuffix:%{psuffix}-}%{sover}
Summary: Application indicators library
Group: System/Libraries
# Fedora and friends compatibility symbol
%if "%{flavor}" == "gtk2"
Provides: libappindicator = %{version}
%else
Provides: libappindicator-gtk3 = %{version}
%endif
%description -n libappindicator%{?psuffix:%{psuffix}-}%{sover}
A library to allow applications to export a menu into the Unity Menu bar. Based
on KSNI it also works in KDE and will fallback to generic Systray support if
none of those are available.
%if "%{flavor}" != "gtk2"
%package -n typelib-1_0-AppIndicator%{?psuffix}-0_1
Summary: Application indicators library
Group: System/Libraries
%description -n typelib-1_0-AppIndicator%{?psuffix}-0_1
This package contains the GObject Introspection bindings for the appindicator
library.
%else
%package -n appindicator%{?psuffix}-sharp
Summary: Application indicators library for C#
Group: System/Libraries
%description -n appindicator%{?psuffix}-sharp
This package provides the appindicator-sharp assembly that allows CLI (.NET)
programs to take menus from applications and place them in the panel.
This package provides assemblies to be used by applications.
%package -n appindicator%{?psuffix}-sharp-devel
Summary: Development files for libappindicator-sharp
Group: Development/Libraries/Other
Requires: appindicator%{?psuffix}-sharp = %{version}
%description -n appindicator%{?psuffix}-sharp-devel
This package contains the development files for the appindicator-sharp library.
%endif
%package -n libappindicator%{?psuffix}-devel
Summary: Development files for libappindicator
Group: Development/Libraries/C and C++
Requires: libappindicator%{?psuffix:%{psuffix}-}%{sover} = %{version}
%description -n libappindicator%{?psuffix}-devel
This package contains the development files for the appindicator%{?psuffix} library.
%prep
%setup -q -c
%patch0 -p1
%patch1 -p1
#%%patch2 -p1
%build
# 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
%configure \
--disable-static \
--disable-gtk-doc \
--disable-mono-test \
--with-gtk=%{gtkver}
%make_build
%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
%if "%{flavor}" == "gtk2"
rm %{buildroot}%{_libdir}/girepository-1.0/AppIndicator3-0.1.typelib
rm %{buildroot}%{_datadir}/gir-1.0/AppIndicator3-0.1.gir
%endif
%post -n libappindicator%{?psuffix:%{psuffix}-}%{sover} -p /sbin/ldconfig
%postun -n libappindicator%{?psuffix:%{psuffix}-}%{sover} -p /sbin/ldconfig
%files -n libappindicator%{?psuffix:%{psuffix}-}%{sover}
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/libappindicator%{?psuffix}.so.%{sover}*
%if "%{flavor}" == "gtk2"
# Only for GTK 2
%if %{with mono}
%files -n appindicator%{?psuffix}-sharp
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/appindicator%{?psuffix}-sharp-0.1/
%{_prefix}/lib/mono/appindicator%{?psuffix}-sharp/
%{_prefix}/lib/mono/gac/appindicator%{?psuffix}-sharp/
%{_prefix}/lib/mono/gac/policy.0.0.appindicator%{?psuffix}-sharp/
%files -n appindicator%{?psuffix}-sharp-devel
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/pkgconfig/appindicator%{?psuffix}-sharp-0.1.pc
%endif
%else
# Only for GTK 3+
%files -n typelib-1_0-AppIndicator%{?psuffix}-0_1
%license COPYING COPYING.LGPL.2.1
%doc README
%{_libdir}/girepository-1.0/AppIndicator%{?psuffix}-0.1.typelib
%endif
%files -n libappindicator%{?psuffix}-devel
%license COPYING COPYING.LGPL.2.1
%doc README
%{_includedir}/libappindicator%{?psuffix}-0.1/
%{_libdir}/libappindicator%{?psuffix}.so
%{_libdir}/pkgconfig/appindicator%{?psuffix}-0.1.pc
%if "%{flavor}" != "gtk2"
%{_datadir}/gir-1.0/AppIndicator%{?psuffix}-0.1.gir
%{_datadir}/vala/vapi/appindicator%{?psuffix}-0.1.*
%endif
%changelog

BIN
libappindicator_12.10.1+20.10.20200706.1.orig.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,16 @@
--- 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

550
xappstatusicon.patch Normal file
View File

@ -0,0 +1,550 @@
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,8 @@ AS_IF([test "x$with_gtk" = x3],
glib-2.0 >= $GLIB_REQUIRED_VERSION
gio-unix-2.0
gio-2.0 >= $GIO_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],
--- a/src/appindicator3-0.1.pc.in
+++ b/src/appindicator3-0.1.pc.in
@@ -5,7 +5,7 @@ bindir=@bindir@
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
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -31,6 +31,8 @@ License version 3 and version 2.1 along
#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 @@ License version 3 and version 2.1 along
#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 @@ struct _AppIndicatorPrivate {
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 check_connect (AppIndicator
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);
@@ -988,6 +989,9 @@ app_indicator_set_property (GObject * ob
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) {
@@ -1019,15 +1023,16 @@ app_indicator_set_property (GObject * ob
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: {
@@ -1557,19 +1562,60 @@ theme_changed_cb (GtkIconTheme * theme,
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,
@@ -1577,12 +1623,11 @@ fallback (AppIndicator * self)
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;
}
@@ -1597,49 +1642,22 @@ status_icon_status_wrapper (AppIndicator
/* 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);
-
- return TRUE;
-}
+// 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
-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();
@@ -1668,17 +1686,17 @@ status_icon_changes (AppIndicator * self
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;
};
@@ -1686,16 +1704,45 @@ status_icon_changes (AppIndicator * self
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;
+
+ 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_clear_pointer (&icon_path, g_free);
+ }
+
+ 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);
+ }
+ }
}
g_free(longname);
@@ -1707,44 +1754,16 @@ status_icon_changes (AppIndicator * self
return;
}
-/* 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;
-
- gtk_menu_popup(menu,
- NULL, /* Parent Menu */
- NULL, /* Parent item */
- gtk_status_icon_position_menu,
- icon,
- 1, /* Button */
- gtk_get_current_event_time());
-
- 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;
}
@@ -1796,6 +1815,8 @@ sec_activate_target_parent_changed(GtkWi
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);
}
@@ -2089,6 +2110,7 @@ app_indicator_set_label (AppIndicator *s
PROP_LABEL_GUIDE_S, guide == NULL ? "" : guide,
NULL);
+
return;
}
@@ -2260,9 +2282,14 @@ app_indicator_set_menu (AppIndicator *se
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);
@@ -2316,6 +2343,7 @@ app_indicator_set_secondary_activate_tar
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) {
@@ -2326,6 +2354,7 @@ app_indicator_set_secondary_activate_tar
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);
}
--- a/src/app-indicator.h
+++ b/src/app-indicator.h
@@ -32,6 +32,14 @@ License version 3 and version 2.1 along
#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 @@ struct _AppIndicatorClass {
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);
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,7 +57,6 @@ libappindicatorinclude_HEADERS = \
libappindicator_la_SOURCES = \
$(libappindicator_headers) \
app-indicator-enum-types.c \
- app-indicator.c \
application-service-marshal.c \
dbus-shared.h \
generate-id.h \
@@ -69,6 +68,14 @@ libappindicator_la_SOURCES = \
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 \
@@ -151,9 +158,15 @@ INTROSPECTION_COMPILER_ARGS = --included
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
AppIndicator3-0.1.gir: libappindicator3.la
--- a/tests/test-libappindicator-fallback-item.c
+++ b/tests/test-libappindicator-fallback-item.c
@@ -31,8 +31,14 @@ GType test_libappindicator_fallback_item
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 @@ enum {
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 @@ unfallback (AppIndicator * indicator, Gt
}
return;
}
+#endif // USE_XAPP_FALLBACK
gboolean
kill_func (gpointer data)