Hello community, here is the log from the commit of package pasystray for openSUSE:Factory checked in at 2018-10-02 19:47:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pasystray (Old) and /work/SRC/openSUSE:Factory/.pasystray.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pasystray" Tue Oct 2 19:47:39 2018 rev:5 rq:639335 version:0.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/pasystray/pasystray.changes 2018-04-11 14:03:35.695325775 +0200 +++ /work/SRC/openSUSE:Factory/.pasystray.new/pasystray.changes 2018-10-02 19:48:41.613751812 +0200 @@ -1,0 +2,28 @@ +Mon Oct 1 08:17:26 UTC 2018 - Petr Cervinka <[email protected]> + +- Fix build on Leap 42.3 + +------------------------------------------------------------------- +Mon Oct 1 07:22:10 UTC 2018 - Petr Cervinka <[email protected]> + +- Version bump to 0.7.0: + * Disable status icon tooltip for connected state + * Fix: Recognize the option -N systray_action + * systray: fix memory leak + * Add option to terminate server + * Split glade for gtk2/3 + * Fix coding style + * Deprecate old notification options + * Remove deprecated option max-volume + * Simplify notification handling + * Granular notification options + * Set fallback icon for notifications where no icon is provided + * Capitalization in new sink/source notification + * Update item on failed move + * Fix segfault on failed move + * Fix capitalization of stream menu items + * autotools: split EXTRA_DIST, add man page and desktop entry + * Make glade gtk2 compatible +- Remove fix-memory-leak.patch, fixed in upstream + +------------------------------------------------------------------- Old: ---- fix-memory-leak.patch pasystray-0.6.0.tar.gz New: ---- pasystray-0.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pasystray.spec ++++++ --- /var/tmp/diff_new_pack.ed4cE3/_old 2018-10-02 19:48:42.049751359 +0200 +++ /var/tmp/diff_new_pack.ed4cE3/_new 2018-10-02 19:48:42.053751355 +0200 @@ -18,19 +18,19 @@ %if 0%{?suse_version} == 1315 %define build_wayland_backend 0 +%define stdc99 1 %else %define build_wayland_backend 1 +%define stdc99 0 %endif Name: pasystray -Version: 0.6.0 +Version: 0.7.0 Release: 0 Summary: PulseAudio system tray License: LGPL-2.1-or-later Group: System/GUI/Other URL: https://github.com/christophgysin/pasystray Source: https://github.com/christophgysin/pasystray/archive/pasystray-%{version}.tar.gz -# PATCH-FIX-UPSTREAM fix-memory-leak.patch boo#1070195 -Patch0: fix-memory-leak.patch BuildRequires: automake BuildRequires: pkgconfig BuildRequires: update-desktop-files @@ -67,9 +67,11 @@ %prep %setup -q -n %{name}-%{name}-%{version} -%patch0 -p1 %build +%if %{stdc99} +export CFLAGS="%{optflags} --std=c99" +%endif autoreconf -fi %configure --sysconfdir=%{_sysconfdir} make %{?_smp_mflags} @@ -88,7 +90,7 @@ %{_datadir}/applications/pasystray.desktop %{_datadir}/icons/hicolor/scalable/apps/pasystray.svg %{_mandir}/man1/pasystray.1%{?ext_man} -%{_datadir}/pasystray/pasystray.glade +%{_datadir}/pasystray/pasystray.gtk3.glade %{_datadir}/pixmaps/pasystray.png %changelog ++++++ pasystray-0.6.0.tar.gz -> pasystray-0.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/.travis.yml new/pasystray-pasystray-0.7.0/.travis.yml --- old/pasystray-pasystray-0.6.0/.travis.yml 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/.travis.yml 2018-09-28 17:20:16.000000000 +0200 @@ -15,6 +15,11 @@ env: - CFLAGS=--std=c99 - CFLAGS=--std=c99 EXTRA_CONF=--with-gtk=2 + - CFLAGS=--std=c99 EXTRA_CONF=--disable-avahi + - CFLAGS=--std=c99 EXTRA_CONF=--disable-notify + - CFLAGS=--std=c99 EXTRA_CONF=--disable-x11 + - CFLAGS=--std=c99 EXTRA_CONF=--disable-statusicon + - CFLAGS=--std=c99 EXTRA_CONF=--disable-appindicator - USE_CC=gcc-4.9 CFLAGS=--std=c99 - USE_CC=gcc-4.9 CFLAGS=--std=c11 - USE_CC=clang-3.7 CFLAGS=--std=c99 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/Makefile.am new/pasystray-pasystray-0.7.0/Makefile.am --- old/pasystray-pasystray-0.6.0/Makefile.am 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/Makefile.am 2018-09-28 17:20:16.000000000 +0200 @@ -1,6 +1,6 @@ # This file is part of PaSystray # -# Copyright (C) 2011-2015 Christoph Gysin +# Copyright (C) 2011-2016 Christoph Gysin # # PaSystray is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -17,21 +17,29 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. +EXTRA_DIST = \ + LICENSE \ + README.md \ + bootstrap.sh + iconsdir = $(datadir)/icons/hicolor/scalable/apps icons_DATA = data/pasystray.svg +EXTRA_DIST += $(icons_DATA) pixmapsdir = $(datadir)/pixmaps pixmaps_DATA = data/pasystray.png +EXTRA_DIST += $(pixmaps_DATA) desktopdir = $(datadir)/applications desktop_DATA = data/pasystray.desktop +EXTRA_DIST += $(desktop_DATA) xdgautostartdir = $(sysconfdir)/xdg/autostart xdgautostart_DATA = data/pasystray.desktop +EXTRA_DIST += $(xdgautostart_DATA) man_MANS = man/pasystray.1 - -EXTRA_DIST = bootstrap.sh README.md LICENSE $(icons_DATA) $(pixmaps_DATA) $(desktop_DATA) +EXTRA_DIST += $(man_MANS) SUBDIRS = src diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/bootstrap.sh new/pasystray-pasystray-0.7.0/bootstrap.sh --- old/pasystray-pasystray-0.6.0/bootstrap.sh 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/bootstrap.sh 2018-09-28 17:20:16.000000000 +0200 @@ -1,3 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + rm -rf autom4te.cache rm -f config.cache aclocal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/configure.ac new/pasystray-pasystray-0.7.0/configure.ac --- old/pasystray-pasystray-0.6.0/configure.ac 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/configure.ac 2018-09-28 17:20:16.000000000 +0200 @@ -1,6 +1,6 @@ # This file is part of PaSystray # -# Copyright (C) 2011-2016 Christoph Gysin +# Copyright (C) 2011-2018 Christoph Gysin # # PaSystray is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -19,7 +19,7 @@ AC_PREREQ([2.68]) -AC_INIT([pasystray], [0.6.0], [[email protected]], [pasystray], +AC_INIT([pasystray], [0.7.0], [[email protected]], [pasystray], [http://github.com/christophgysin/pasystray]) AC_CONFIG_SRCDIR([src/pasystray.c]) AC_CONFIG_HEADERS([src/config.h]) @@ -31,8 +31,12 @@ AC_ARG_WITH(gtk, AC_HELP_STRING([--with-gtk=2|3], [choose GTK version (default: 3)]),, with_gtk=3) AC_MSG_CHECKING([GTK version to use]) case ${with_gtk} in - 2) GTK_VERSION=gtk+-2.0;; - 3) GTK_VERSION=gtk+-3.0;; + 2) GTK_VERSION=gtk+-2.0 + GTK_VERSION_MAJOR=2 + ;; + 3) GTK_VERSION=gtk+-3.0 + GTK_VERSION_MAJOR=3 + ;; *) AC_MSG_ERROR([unknown GTK version!]);; esac AC_MSG_RESULT($GTK_VERSION) @@ -41,6 +45,7 @@ AC_DEFINE_UNQUOTED(GTK_VERSION_MAJOR, $with_gtk, [Have GTK version?]) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) +AC_SUBST(GTK_VERSION_MAJOR) ### check for pulseaudio libs ################################################# PKG_CHECK_MODULES(PULSEAUDIO, [ libpulse >= 1.0 libpulse-mainloop-glib >= 1.0 ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/man/pasystray.1 new/pasystray-pasystray-0.7.0/man/pasystray.1 --- old/pasystray-pasystray-0.6.0/man/pasystray.1 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/man/pasystray.1 2018-09-28 17:20:16.000000000 +0200 @@ -1,10 +1,10 @@ .\" (C) Copyright 2013 Scott Leggett <[email protected]>, -.\" (C) Copyright 2015 Christoph Gysin <[email protected]> +.\" (C) Copyright 2015-2016 Christoph Gysin <[email protected]> .\" .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH PASYSTRAY 1 "November 9, 2013" +.TH PASYSTRAY 1 "June 14, 2018" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -100,6 +100,9 @@ .B \-i, \-\-volume-inc=N Set the volume increment. .TP +.B \-t, \-\-no-icon-tooltip +Disable the status icon tooltip for the connected state. +.TP .B \-n, \-\-no-notify Disable all notifications. .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/Makefile.am new/pasystray-pasystray-0.7.0/src/Makefile.am --- old/pasystray-pasystray-0.6.0/src/Makefile.am 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/Makefile.am 2018-09-28 17:20:16.000000000 +0200 @@ -1,6 +1,6 @@ # This file is part of PaSystray # -# Copyright (C) 2011-2015 Christoph Gysin +# Copyright (C) 2011-2016 Christoph Gysin # # PaSystray is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -18,9 +18,11 @@ # USA. gladedir = $(pkgdatadir) +gladefile = pasystray.gtk$(GTK_VERSION_MAJOR).glade +glade_DATA = $(gladefile) +EXTRA_DIST = $(glade_DATA) bin_PROGRAMS = pasystray -glade_DATA = pasystray.glade pasystray_SOURCES = \ avahi.c \ @@ -66,7 +68,4 @@ $(APPINDICATOR_CFLAGS) \ $(X11_CFLAGS) \ -DG_LOG_DOMAIN=\"pasystray\" \ - -DGLADE_FILE=\"$(gladedir)/pasystray.glade\" - -EXTRA_DIST = \ - $(glade_DATA) + -DGLADE_FILE=\"$(gladedir)/$(gladefile)\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/avahi.c new/pasystray-pasystray-0.7.0/src/avahi.c --- old/pasystray-pasystray-0.6.0/src/avahi.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/avahi.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/avahi.h new/pasystray-pasystray-0.7.0/src/avahi.h --- old/pasystray-pasystray-0.6.0/src/avahi.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/avahi.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/menu_info.c new/pasystray-pasystray-0.7.0/src/menu_info.c --- old/pasystray-pasystray-0.6.0/src/menu_info.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/menu_info.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -231,28 +231,39 @@ return; } - menu_infos_t* mis = item->menu_info->menu_infos; - g_debug("[menu_info] updating %s %u %s (target: %d)", menu_info_type_name(item->menu_info->type), index, desc, (int)target); - g_free(item->name); - item->name = g_strdup(name); + if (name != item->name) + { + g_free(item->name); + item->name = g_strdup(name); + } - g_free(item->desc); - item->desc = g_strdup(desc); + if (desc != item->desc) + { + g_free(item->desc); + item->desc = g_strdup(desc); + } /* only notify on volume / mute changes */ int notify = 0; if ((vol && !pa_cvolume_equal(item->volume, vol)) || mute != item->mute) notify = 1; - g_free(item->volume); - item->volume = g_memdup(vol, sizeof(pa_cvolume)); + if (vol != item->volume) + { + g_free(item->volume); + item->volume = g_memdup(vol, sizeof(pa_cvolume)); + } item->mute = mute; item->target = target; - g_free(item->address); - item->address = g_strdup(address); + + if (address != item->address) + { + g_free(item->address); + item->address = g_strdup(address); + } menu_type_t submenu_type = menu_info_submenu_type(mi->type); menu_info_t* submenu = &mi->menu_infos->menu_info[submenu_type]; @@ -261,7 +272,8 @@ gtk_menu_item_set_label(GTK_MENU_ITEM(item->widget), label); g_free(label); - systray_set_tooltip(GTK_WIDGET(item->widget), tooltip); + if (tooltip) + systray_set_tooltip(GTK_WIDGET(item->widget), tooltip); switch(mi->type) { @@ -285,8 +297,8 @@ if(mi->type == MENU_SINK && item == menu_info_item_get_by_name(mi, mi->default_name)) ui_update_systray_icon(item); - if(notify && mis->settings.notify == NOTIFY_ALWAYS) - pulseaudio_update_volume_notification(item); + if(notify) + pulseaudio_process_update_volume_notification(item); } void menu_info_item_add(menu_info_t* mi, uint32_t index, const char* name, @@ -389,7 +401,7 @@ case MENU_SOURCE: { menu_type_t type = (mii->menu_info->type == MENU_SINK) ? MENU_INPUT : MENU_OUTPUT; - gchar* label = g_strdup_printf("move all %ss here", + gchar* label = g_strdup_printf("Move all %ss here", menu_info_type_name(type)); item = gtk_menu_item_new_with_label(label); g_free(label); @@ -397,14 +409,14 @@ G_CALLBACK(menu_info_item_move_all_cb), mii); gtk_menu_shell_append(menu, item); - item = gtk_menu_item_new_with_label("rename"); + item = gtk_menu_item_new_with_label("Rename"); g_signal_connect(item, "button-press-event", G_CALLBACK(menu_info_item_rename_cb), mii); gtk_menu_shell_append(menu, item); break; } case MENU_MODULE: - item = gtk_menu_item_new_with_label("unload"); + item = gtk_menu_item_new_with_label("Unload"); g_signal_connect(item, "button-press-event", G_CALLBACK(menu_info_module_unload_cb), mii); gtk_menu_shell_append(menu, item); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/menu_info.h new/pasystray-pasystray-0.7.0/src/menu_info.h --- old/pasystray-pasystray-0.6.0/src/menu_info.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/menu_info.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -55,17 +55,21 @@ char* default_name; }; -typedef enum { - NOTIFY_NEVER, - NOTIFY_DEFAULT, - NOTIFY_ALWAYS, -} notify_t; - struct settings_t_ { int volume_max; int volume_inc; - notify_t notify; + gboolean icon_tooltip; gboolean monitors; + // Notification options below + gboolean n_new; + gboolean n_sink; + gboolean n_sink_default; + gboolean n_source; + gboolean n_source_default; + gboolean n_stream; + gboolean n_stream_output; + gboolean n_stream_input; + gboolean n_systray_action; }; typedef struct settings_t_ settings_t; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/notify.c new/pasystray-pasystray-0.7.0/src/notify.c --- old/pasystray-pasystray-0.6.0/src/notify.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/notify.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -26,8 +26,8 @@ #include "notify.h" void notify_initialize(){} -notify_handle_t notify(const char* msg, const char* body, const char* icon){ return 0; } -void notify_update(notify_handle_t h, const char* msg, const char* body, const char* icon){} +notify_handle_t notify(const char* msg, const char* body, const char* icon, gint value){ return 0; } +void notify_update(notify_handle_t h, const char* msg, const char* body, const char* icon, gint value){} #else @@ -51,6 +51,8 @@ notify_handle_t notify(const char* msg, const char* body, const char* icon, gint value) { + if(!icon) + icon = "audio-card"; NotifyNotification* n = notify_notification_new(msg, body, icon); notify_notification_set_urgency(n, NOTIFY_URGENCY_LOW); notify_notification_set_timeout(n, 2000); // timeout in ms @@ -62,6 +64,8 @@ void notify_update(notify_handle_t h, const char* msg, const char* body, const char* icon, gint value) { + if(!icon) + icon = "audio-card"; NotifyNotification* n = (NotifyNotification*) h; notify_notification_set_timeout(n, 2000); // timeout in ms if(value > -1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/notify.h new/pasystray-pasystray-0.7.0/src/notify.h --- old/pasystray-pasystray-0.6.0/src/notify.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/notify.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -22,6 +22,8 @@ #ifndef PASYSTRAY_NOTIFY_H #define PASYSTRAY_NOTIFY_H +#include <glib.h> + #include "config.h" typedef void* notify_handle_t; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/options.c new/pasystray-pasystray-0.7.0/src/options.c --- old/pasystray-pasystray-0.6.0/src/options.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/options.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -29,21 +29,27 @@ static gboolean debug = FALSE; static int volume_max = 0; static int volume_inc = 1; +static gboolean icon_tooltip = TRUE; static gboolean no_notify = FALSE; static gboolean always_notify = FALSE; static gboolean monitors = FALSE; +static gchar **notify_mode; static GOptionEntry entries[] = { - { "version", 'V', 0, G_OPTION_ARG_NONE, &version, "print version and exit", NULL }, - { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, "print debugging information", NULL }, - { "max-volume", 0, 0, G_OPTION_ARG_INT, &volume_max, "deprecated, use volume-max instead", "N" }, - { "volume-max", 'm', 0, G_OPTION_ARG_INT, &volume_max, "maximum volume (in percent)", "N" }, - { "volume-inc", 'i', 0, G_OPTION_ARG_INT, &volume_inc, "volume increment", "N" }, - { "no-notify", 'n', 0, G_OPTION_ARG_NONE, &no_notify, "disable all notifications", NULL }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &version, "Print version and exit", NULL }, + { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, "Print debugging information", NULL }, + { "volume-max", 'm', 0, G_OPTION_ARG_INT, &volume_max, "Maximum volume (in percent)", "N" }, + { "volume-inc", 'i', 0, G_OPTION_ARG_INT, &volume_inc, "Volume increment", "N" }, + { "no-icon-tooltip", 't', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, + &icon_tooltip, "Disable the status icon tooltip for the connected state", NULL }, + { "no-notify", 'n', 0, G_OPTION_ARG_NONE, &no_notify, + "Deprecated, use --notify=none instead", NULL }, { "always-notify", 'a', 0, G_OPTION_ARG_NONE, &always_notify, - "enable notifications for all changes in pulsaudio", NULL }, - { "include-monitors", 'n', 0, G_OPTION_ARG_NONE, &monitors, "include monitor sources", NULL }, + "Deprecated, use --notify=all instead", NULL }, + { "include-monitors", 'n', 0, G_OPTION_ARG_NONE, &monitors, "Include monitor sources", NULL }, + { "notify", 'N', 0, G_OPTION_ARG_STRING_ARRAY, ¬ify_mode, + "Set notification options, use --notify=help for a list of valid options", "OPTION" }, { .long_name = NULL } }; @@ -52,6 +58,43 @@ return entries; } +// Set some default values close to previous behavior +void notify_default(settings_t* settings) +{ + settings->n_new = TRUE; + settings->n_sink = FALSE; + settings->n_sink_default = FALSE; + settings->n_source = FALSE; + settings->n_source_default = FALSE; + settings->n_stream_output = FALSE; + settings->n_stream_input = FALSE; + settings->n_systray_action = TRUE; +} + +void notify_all(settings_t* settings) +{ + settings->n_new = TRUE; + settings->n_sink = TRUE; + settings->n_sink_default = TRUE; + settings->n_source = TRUE; + settings->n_source_default = TRUE; + settings->n_stream_output = TRUE; + settings->n_stream_input = TRUE; + settings->n_systray_action = TRUE; +} + +void notify_none(settings_t* settings) +{ + settings->n_new = FALSE; + settings->n_sink = FALSE; + settings->n_sink_default = FALSE; + settings->n_source = FALSE; + settings->n_source_default = FALSE; + settings->n_stream_output = FALSE; + settings->n_stream_input = FALSE; + settings->n_systray_action = FALSE; +} + void parse_options(settings_t* settings) { if(version) @@ -77,14 +120,95 @@ settings->volume_inc = volume_inc; } - settings->notify = NOTIFY_DEFAULT; + settings->icon_tooltip = icon_tooltip; + + notify_default(settings); + + if(notify_mode) + { + for (int i = 0; notify_mode[i]; i++) { + if(!g_strcmp0(notify_mode[i], "all")) + { + notify_all(settings); + } + else if(g_str_equal(notify_mode[i], "none")) + { + notify_none(settings); + } + else if(g_str_equal(notify_mode[i], "new")) + { + settings->n_new = TRUE; + } + else if(g_str_equal(notify_mode[i], "sink")) + { + settings->n_sink = TRUE; + } + else if(g_str_equal(notify_mode[i], "sink_default")) + { + settings->n_sink_default = TRUE; + } + else if(g_str_equal(notify_mode[i], "source")) + { + settings->n_source = TRUE; + } + else if(g_str_equal(notify_mode[i], "source_default")) + { + settings->n_source_default = TRUE; + } + else if(g_str_equal(notify_mode[i], "stream")) + { + settings->n_stream_output = TRUE; + settings->n_stream_input = TRUE; + } + else if(g_str_equal(notify_mode[i], "stream_output")) + { + settings->n_stream_output = TRUE; + } + else if(g_str_equal(notify_mode[i], "stream_input")) + { + settings->n_stream_input = TRUE; + } + else if(g_str_equal(notify_mode[i], "systray_action")) + { + settings->n_systray_action = TRUE; + } + else if(g_str_equal(notify_mode[i], "help")) + { + gchar *help_text=( + "Notification options:\n" + " all Notify for all detected changes\n" + " none Never notify, except for options set after this one\n" + " new Notify when new sinks/sources are added\n" + " sink Notify for changes to all sinks\n" + " sink_default Notify for changes to the default sink\n" + " source Notify for changes to all sources\n" + " source_default Notify for changes to the default source\n" + " stream Notify for all streams\n" + " stream_output Notify for output (playback) streams\n" + " stream_input Notify for input (recording) streams\n" + " systray_action Notify for changes made through pasystray\n" + " help List possible options and exit\n" + ); + + g_print("%s",help_text); + exit(0); + } + else + { + g_print("Warning: Invalid notification option \"%s\". Run 'pasystray --notify=help' for a list of valid options.\n", notify_mode[i]); + } + } + } + if(no_notify) { - settings->notify = NOTIFY_NEVER; + g_warning("--no-notify is deprecated, use --notify=none instead"); + notify_none(settings); } if(always_notify) { - settings->notify = NOTIFY_ALWAYS; + g_warning("--always-notify is deprecated, use --notify=all instead"); + notify_all(settings); } settings->monitors = monitors; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/options.h new/pasystray-pasystray-0.7.0/src/options.h --- old/pasystray-pasystray-0.6.0/src/options.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/options.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pasystray.c new/pasystray-pasystray-0.7.0/src/pasystray.c --- old/pasystray-pasystray-0.6.0/src/pasystray.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pasystray.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -67,9 +67,9 @@ ui_load(); mis = menu_infos_create(); + mis->settings = *settings; systray_create(mis); menu_infos_init(mis); - mis->settings = *settings; pulseaudio_init(mis); avahi_start(mis); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pasystray.glade new/pasystray-pasystray-0.7.0/src/pasystray.glade --- old/pasystray-pasystray-0.6.0/src/pasystray.glade 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pasystray.glade 1970-01-01 01:00:00.000000000 +0100 @@ -1,147 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> -<interface> - <requires lib="gtk+" version="3.0"/> - <object class="GtkAboutDialog" id="aboutdialog"> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="icon_name">pasystray</property> - <property name="type_hint">dialog</property> - <property name="program_name">pasystray</property> - <property name="copyright" translatable="yes">Copyright © 2011-2013</property> - <property name="comments" translatable="yes">PulseAudio system tray</property> - <property name="authors">Christoph Gysin <[email protected]></property> - <property name="logo_icon_name">pasystray</property> - <property name="license_type">lgpl-2-1</property> - <child internal-child="vbox"> - <object class="GtkBox" id="aboutdialog-vbox"> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">2</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="aboutdialog-action_area"> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="layout_style">end</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - </child> - </object> - <object class="GtkMessageDialog" id="errordialog"> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="title" translatable="yes">Error</property> - <property name="resizable">False</property> - <property name="type_hint">dialog</property> - <property name="message_type">error</property> - <property name="buttons">ok</property> - <property name="text" translatable="yes">An error occurred</property> - <child internal-child="vbox"> - <object class="GtkBox" id="messagedialog-vbox2"> - <property name="can_focus">False</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="messagedialog-action_area2"> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - </object> - <object class="GtkDialog" id="renamedialog"> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="title" translatable="yes">Rename <device> <name></property> - <property name="type_hint">normal</property> - <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox"> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">2</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area3"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="cancelbutton"> - <property name="label">Cancel</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="okbutton"> - <property name="label">OK</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="image_position">bottom</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label"> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Rename <device> <old name> to:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="entry"> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="is_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="invisible_char">●</property> - <property name="truncate_multiline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-6">cancelbutton</action-widget> - <action-widget response="-5">okbutton</action-widget> - </action-widgets> - </object> -</interface> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pasystray.gtk2.glade new/pasystray-pasystray-0.7.0/src/pasystray.gtk2.glade --- old/pasystray-pasystray-0.6.0/src/pasystray.gtk2.glade 1970-01-01 01:00:00.000000000 +0100 +++ new/pasystray-pasystray-0.7.0/src/pasystray.gtk2.glade 2018-09-28 17:20:16.000000000 +0200 @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <requires lib="gtk+" version="2.16"/> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkAboutDialog" id="aboutdialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="icon_name">pasystray</property> + <property name="type_hint">dialog</property> + <property name="program_name">pasystray</property> + <property name="copyright" translatable="yes">Copyright © 2011-2016</property> + <property name="comments" translatable="yes">PulseAudio system tray</property> + <property name="authors">Christoph Gysin <[email protected]></property> + <property name="logo_icon_name">pasystray</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="aboutdialog-vbox"> + <property name="can_focus">False</property> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="aboutdialog-action_area"> + <property name="can_focus">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + <object class="GtkMessageDialog" id="errordialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Error</property> + <property name="resizable">False</property> + <property name="type_hint">dialog</property> + <property name="message_type">error</property> + <property name="buttons">ok</property> + <property name="text" translatable="yes">An error occurred</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="errordialog-vbox"> + <property name="can_focus">False</property> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="errordialog-action_area"> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + <object class="GtkDialog" id="renamedialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Rename <device> <name></property> + <property name="type_hint">normal</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox"> + <property name="can_focus">False</property> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area"> + <property name="can_focus">False</property> + <child> + <object class="GtkButton" id="cancelbutton"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="okbutton"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Rename <device> <old name> to:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-6">cancelbutton</action-widget> + <action-widget response="-5">okbutton</action-widget> + </action-widgets> + </object> +</interface> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pasystray.gtk3.glade new/pasystray-pasystray-0.7.0/src/pasystray.gtk3.glade --- old/pasystray-pasystray-0.6.0/src/pasystray.gtk3.glade 1970-01-01 01:00:00.000000000 +0100 +++ new/pasystray-pasystray-0.7.0/src/pasystray.gtk3.glade 2018-09-28 17:20:16.000000000 +0200 @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkAboutDialog" id="aboutdialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="icon_name">pasystray</property> + <property name="type_hint">dialog</property> + <property name="program_name">pasystray</property> + <property name="copyright" translatable="yes">Copyright © 2011-2016</property> + <property name="comments" translatable="yes">PulseAudio system tray</property> + <property name="authors">Christoph Gysin <[email protected]></property> + <property name="logo_icon_name">pasystray</property> + <property name="license_type">lgpl-2-1</property> + <child internal-child="vbox"> + <object class="GtkBox" id="aboutdialog-vbox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="aboutdialog-action_area"> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="layout_style">end</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + <object class="GtkMessageDialog" id="errordialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Error</property> + <property name="resizable">False</property> + <property name="type_hint">dialog</property> + <property name="message_type">error</property> + <property name="buttons">ok</property> + <property name="text" translatable="yes">An error occurred</property> + <child internal-child="vbox"> + <object class="GtkBox" id="messagedialog-vbox2"> + <property name="can_focus">False</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="messagedialog-action_area2"> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + <object class="GtkDialog" id="renamedialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Rename <device> <name></property> + <property name="type_hint">normal</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area3"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="cancelbutton"> + <property name="label">Cancel</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="okbutton"> + <property name="label">OK</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="image_position">bottom</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Rename <device> <old name> to:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="entry"> + <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="is_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="invisible_char">●</property> + <property name="truncate_multiline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-6">cancelbutton</action-widget> + <action-widget response="-5">okbutton</action-widget> + </action-widgets> + </object> +</interface> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pasystray.h new/pasystray-pasystray-0.7.0/src/pasystray.h --- old/pasystray-pasystray-0.6.0/src/pasystray.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pasystray.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pulseaudio.c new/pasystray-pasystray-0.7.0/src/pulseaudio.c --- old/pasystray-pasystray-0.6.0/src/pulseaudio.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pulseaudio.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -102,14 +102,21 @@ case PA_CONTEXT_READY: { - char* tooltip = context_info_str(context); - char* escaped = g_markup_escape_text(tooltip, -1); - char* markup = g_strdup_printf( + if(mis->settings.icon_tooltip) + { + char* tooltip = context_info_str(context); + char* escaped = g_markup_escape_text(tooltip, -1); + char* markup = g_strdup_printf( "<span font_family=\"monospace\" font_size=\"x-small\">%s</span>", escaped); - systray_impl_set_tooltip(mis->systray, markup); - g_free(escaped); - g_free(tooltip); - g_free(markup); + systray_impl_set_tooltip(mis->systray, markup); + g_free(escaped); + g_free(tooltip); + g_free(markup); + } + else + { + systray_impl_set_has_tooltip(mis->systray, FALSE); + } pa_context_set_subscribe_callback(context, pulseaudio_event_cb, mis); pa_operation_unref(pa_context_subscribe(context, @@ -378,9 +385,9 @@ menu_info_t* mi = userdata; menu_infos_t* mis = mi->menu_infos; - if(is_new && mis->settings.notify != NOTIFY_NEVER) + if(is_new && mis->settings.n_new) { - gchar* msg = g_strdup_printf("new sink \"%s\"", i->description); + gchar* msg = g_strdup_printf("New sink \"%s\"", i->description); notify(msg, i->name, NULL, -1); g_free(msg); } @@ -426,9 +433,9 @@ if(!mis->settings.monitors && class && g_str_equal(class, "monitor")) return; - if(is_new && mis->settings.notify != NOTIFY_NEVER) + if(is_new && mis->settings.n_new) { - gchar* msg = g_strdup_printf("new source \"%s\"", i->description); + gchar* msg = g_strdup_printf("New source \"%s\"", i->description); notify(msg, i->name, NULL, -1); g_free(msg); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pulseaudio.h new/pasystray-pasystray-0.7.0/src/pulseaudio.h --- old/pasystray-pasystray-0.6.0/src/pulseaudio.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pulseaudio.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pulseaudio_action.c new/pasystray-pasystray-0.7.0/src/pulseaudio_action.c --- old/pasystray-pasystray-0.6.0/src/pulseaudio_action.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pulseaudio_action.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -118,13 +118,17 @@ void pulseaudio_move_success_cb(pa_context *c, int success, void *userdata) { - menu_info_item_t* to = userdata; - menu_info_item_t* from = to->menu_info->parent; + menu_info_item_t* mii = userdata; if(!success) - g_warning("failed to move %s '%s' to %s '%s'!\n", - menu_info_type_name(from->menu_info->type), from->name, - menu_info_type_name(to->menu_info->type), to->name); + { + g_warning("failed to move %s '%s'!\n", + menu_info_type_name(mii->menu_info->type), mii->desc); + + menu_info_t* mi = mii->menu_info; + menu_info_item_update(mi, mii->index, mii->name, mii->desc, mii->volume, + mii->mute, NULL, mii->icon, mii->address, mii->target); + } } void pulseaudio_rename(menu_info_item_t* mii, const char* name) @@ -217,12 +221,43 @@ if(mii->menu_info->type == MENU_SINK || mii->menu_info->type == MENU_SOURCE) ui_set_volume_icon(mii); - if(mis->settings.notify != NOTIFY_NEVER) + if(mis->settings.n_systray_action) { pulseaudio_update_volume_notification(mii); } } +void pulseaudio_process_update_volume_notification(menu_info_item_t* mii) +{ + menu_infos_t* mis = mii->menu_info->menu_infos; + menu_info_t* mi = mii->menu_info; + + switch(mi->type) + { + case MENU_SERVER: + case MENU_MODULE: + case MENU_INPUT: + case MENU_OUTPUT: + break; + + case MENU_SINK: + if(mis->settings.n_sink) + break; + if(mis->settings.n_sink_default && g_str_equal(mii->name, mi->default_name)) + break; + return; + + case MENU_SOURCE: + if(mis->settings.n_source) + break; + if(mis->settings.n_source_default && g_str_equal(mii->name, mi->default_name)) + break; + return; + } + + pulseaudio_update_volume_notification(mii); +} + void pulseaudio_update_volume_notification(menu_info_item_t* mii) { gchar* label = menu_info_item_label(mii); @@ -312,3 +347,8 @@ if(!success) g_warning("failed to unload module %s!\n", mii->name); } + +void pulseaudio_terminate(void) +{ + pa_operation_unref(pa_context_exit_daemon(context, NULL, NULL)); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pulseaudio_action.h new/pasystray-pasystray-0.7.0/src/pulseaudio_action.h --- old/pasystray-pasystray-0.6.0/src/pulseaudio_action.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pulseaudio_action.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -38,6 +38,7 @@ void pulseaudio_volume(menu_info_item_t* mii, int inc); void pulseaudio_set_volume_success_cb(pa_context *c, int success, void *userdata); +void pulseaudio_process_update_volume_notification(menu_info_item_t* mii); void pulseaudio_update_volume_notification(menu_info_item_t* mii); void pulseaudio_toggle_mute(menu_info_item_t* mii); @@ -49,4 +50,6 @@ void pulseaudio_module_unload(menu_info_item_t* mii); void pulseaudio_module_unload_success_cb(pa_context *c, int success, void *userdata); +void pulseaudio_terminate(void); + #endif /* PASYSTRAY_PULSEAUDIO_ACTION_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pulseaudio_info.c new/pasystray-pasystray-0.7.0/src/pulseaudio_info.c --- old/pasystray-pasystray-0.6.0/src/pulseaudio_info.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pulseaudio_info.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/pulseaudio_info.h new/pasystray-pasystray-0.7.0/src/pulseaudio_info.h --- old/pasystray-pasystray-0.6.0/src/pulseaudio_info.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/pulseaudio_info.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/systray.c new/pasystray-pasystray-0.7.0/src/systray.c --- old/pasystray-pasystray-0.6.0/src/systray.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/systray.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -64,6 +64,13 @@ */ systray_menu_add_separator(mis->menu); + + GtkMenuShell* submenu = GTK_MENU_SHELL(gtk_menu_new()); + GtkWidget* item = systray_add_item(mis->menu, "More...", NULL, NULL); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), GTK_WIDGET(submenu)); + systray_menu_add_action(submenu, "Terminate server", "process-stop", + G_CALLBACK(pulseaudio_terminate)); + systray_menu_add_action(mis->menu, "About", "help-about", G_CALLBACK(systray_about_dialog)); systray_menu_add_action(mis->menu, "Quit", "application-exit", G_CALLBACK(quit)); } @@ -137,8 +144,10 @@ if(g_hash_table_size(mi->items) == 0) { GList* children = gtk_container_get_children(GTK_CONTAINER(mi->menu)); - if(children) + if(children) { gtk_container_remove(GTK_CONTAINER(mi->menu), GTK_WIDGET(children->data)); + g_list_free(children); + } } } @@ -185,10 +194,12 @@ /* update group */ GList* children = gtk_container_get_children(GTK_CONTAINER(mi->menu)); - if(children) + if(children) { mi->group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(children->data)); - else + g_list_free(children); + } else { mi->group = NULL; + } } GtkWidget* systray_add_item(GtkMenuShell* menu, const char* desc, const char* tooltip, const char* icon) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/systray.h new/pasystray-pasystray-0.7.0/src/systray.h --- old/pasystray-pasystray-0.6.0/src/systray.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/systray.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/systray_impl.c new/pasystray-pasystray-0.7.0/src/systray_impl.c --- old/pasystray-pasystray-0.6.0/src/systray_impl.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/systray_impl.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -57,6 +57,11 @@ { // TODO: set tooltip? } + +void systray_impl_set_has_tooltip(systray_t systray, gboolean has_tooltip) +{ + // TODO: enable/disable tooltip? +} #elif HAVE_STATUSICON #include "ui.h" @@ -151,6 +156,12 @@ gtk_status_icon_set_tooltip_markup(icon, markup); } +void systray_impl_set_has_tooltip(systray_t systray, gboolean has_tooltip) +{ + GtkStatusIcon* icon = systray; + gtk_status_icon_set_has_tooltip(icon, has_tooltip); +} + #else static void systray_impl_scroll_cb(GtkImage* image, GdkEventScroll* ev, gpointer userdata) @@ -194,4 +205,10 @@ gtk_widget_set_tooltip_markup(GTK_WIDGET(image), markup); } +void systray_impl_set_has_tooltip(systray_t systray, gboolean has_tooltip) +{ + GtkImage *image = systray; + gtk_widget_set_has_tooltip(GTK_WIDGET(image), has_tooltip); +} + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/systray_impl.h new/pasystray-pasystray-0.7.0/src/systray_impl.h --- old/pasystray-pasystray-0.6.0/src/systray_impl.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/systray_impl.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -27,5 +27,6 @@ systray_t systray_impl_create(menu_infos_t* mis); void systray_impl_set_icon(systray_t systray, const char* icon_name); void systray_impl_set_tooltip(systray_t systray, const char* markup); +void systray_impl_set_has_tooltip(systray_t systray, gboolean has_tooltip); #endif /* PASYSTRAY_SYSTRAY_IMPL_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/ui.c new/pasystray-pasystray-0.7.0/src/ui.c --- old/pasystray-pasystray-0.6.0/src/ui.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/ui.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -19,6 +19,7 @@ USA. ***/ +#include <glib.h> #include "ui.h" #include "config.h" #include "systray_impl.h" @@ -35,17 +36,20 @@ const char* filename = GLADE_FILE; /* try to load ui in current dir first */ - char* local_file = "pasystray.glade"; - if(g_file_test(local_file, G_FILE_TEST_EXISTS)) - filename = local_file; - local_file = "src/pasystray.glade"; + gchar* local_file = g_strdup_printf("pasystray.gtk%u.glade", GTK_VERSION_MAJOR); if(g_file_test(local_file, G_FILE_TEST_EXISTS)) filename = local_file; + gchar* local_file_src = g_strdup_printf("src/pasystray.gtk%u.glade", GTK_VERSION_MAJOR); + if(g_file_test(local_file_src, G_FILE_TEST_EXISTS)) + filename = local_file_src; g_debug("using UI file: %s", filename); guint ret = gtk_builder_add_from_file(builder, filename, &error); + g_free(local_file); + g_free(local_file_src); + if(!ret) { g_error("[ui] %s", error->message); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/ui.h new/pasystray-pasystray-0.7.0/src/ui.h --- old/pasystray-pasystray-0.6.0/src/ui.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/ui.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/x11-property.c new/pasystray-pasystray-0.7.0/src/x11-property.c --- old/pasystray-pasystray-0.6.0/src/x11-property.c 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/x11-property.c 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pasystray-pasystray-0.6.0/src/x11-property.h new/pasystray-pasystray-0.7.0/src/x11-property.h --- old/pasystray-pasystray-0.6.0/src/x11-property.h 2016-07-17 12:41:33.000000000 +0200 +++ new/pasystray-pasystray-0.7.0/src/x11-property.h 2018-09-28 17:20:16.000000000 +0200 @@ -1,7 +1,7 @@ /*** This file is part of PaSystray - Copyright (C) 2011-2015 Christoph Gysin + Copyright (C) 2011-2016 Christoph Gysin PaSystray is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as
