summaryrefslogtreecommitdiff
path: root/mate-volume-control
diff options
context:
space:
mode:
Diffstat (limited to 'mate-volume-control')
-rw-r--r--mate-volume-control/Makefile.am99
-rw-r--r--mate-volume-control/applet-main.c15
-rw-r--r--mate-volume-control/dialog-main.c3
-rw-r--r--mate-volume-control/gvc-applet.c23
-rw-r--r--mate-volume-control/gvc-applet.h1
-rw-r--r--mate-volume-control/gvc-balance-bar.c19
-rw-r--r--mate-volume-control/gvc-balance-bar.h1
-rw-r--r--mate-volume-control/gvc-channel-bar.c87
-rw-r--r--mate-volume-control/gvc-channel-bar.h5
-rw-r--r--mate-volume-control/gvc-combo-box.c1
-rw-r--r--mate-volume-control/gvc-combo-box.h1
-rw-r--r--mate-volume-control/gvc-level-bar.c37
-rw-r--r--mate-volume-control/gvc-level-bar.h1
-rw-r--r--mate-volume-control/gvc-mixer-dialog.c77
-rw-r--r--mate-volume-control/gvc-mixer-dialog.h1
-rw-r--r--mate-volume-control/gvc-sound-theme-chooser.c3
-rw-r--r--mate-volume-control/gvc-sound-theme-chooser.h1
-rw-r--r--mate-volume-control/gvc-speaker-test.c3
-rw-r--r--mate-volume-control/gvc-speaker-test.h1
-rw-r--r--mate-volume-control/gvc-status-icon.c1
-rw-r--r--mate-volume-control/gvc-status-icon.h1
-rw-r--r--mate-volume-control/gvc-stream-applet-icon.c103
-rw-r--r--mate-volume-control/gvc-stream-applet-icon.h1
-rw-r--r--mate-volume-control/gvc-stream-status-icon.c61
-rw-r--r--mate-volume-control/gvc-stream-status-icon.h1
-rw-r--r--mate-volume-control/gvc-utils.c1
-rw-r--r--mate-volume-control/gvc-utils.h1
-rw-r--r--mate-volume-control/meson.build154
-rw-r--r--mate-volume-control/org.mate.applets.GvcApplet.mate-panel-applet.desktop.in.in3
-rw-r--r--mate-volume-control/org.mate.panel.applet.GvcAppletFactory.service.in1
-rw-r--r--mate-volume-control/sound-theme-file-utils.c9
-rw-r--r--mate-volume-control/sound-theme-file-utils.h1
-rw-r--r--mate-volume-control/status-icon-main.c3
33 files changed, 601 insertions, 119 deletions
diff --git a/mate-volume-control/Makefile.am b/mate-volume-control/Makefile.am
index 06eae15..881b78d 100644
--- a/mate-volume-control/Makefile.am
+++ b/mate-volume-control/Makefile.am
@@ -3,15 +3,11 @@ bin_PROGRAMS = \
mate-volume-control-status-icon \
mate-volume-control \
$(NULL)
-else
+else !ENABLE_STATUSICON
bin_PROGRAMS = \
mate-volume-control \
$(NULL)
-endif
-
-if ENABLE_PANELAPPLET
-libexec_PROGRAMS = mate-volume-control-applet
-endif
+endif !ENABLE_STATUSICON
AM_CPPFLAGS = \
$(WARN_CFLAGS) \
@@ -24,35 +20,40 @@ AM_CPPFLAGS = \
-I$(srcdir) \
$(NULL)
-if ENABLE_PANELAPPLET
-APPLET_LOCATION = $(libexecdir)/mate-volume-control-applet
+applets_in_files = org.mate.applets.GvcApplet.mate-panel-applet.desktop.in
+service_in_files = org.mate.panel.applet.GvcAppletFactory.service.in
+if ENABLE_PANELAPPLET
appletsdir = $(datadir)/mate-panel/applets
-applets_in_files = org.mate.applets.GvcApplet.mate-panel-applet.desktop.in
applets_DATA = $(applets_in_files:.mate-panel-applet.desktop.in=.mate-panel-applet)
-$(applets_in_files): $(applets_in_files).in Makefile
- $(AM_V_GEN)sed \
- -e "s|\@LOCATION\@|$(APPLET_LOCATION)|" \
- $< > $@
-
-$(applets_DATA): $(applets_in_files) Makefile
- $(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@
-
+if IN_PROCESS
+APPLET_LOCATION = $(libdir)/libmate-volume-control-applet.so
+mate_volume_control_applet_libdir= $(libdir)
+mate_volume_control_applet_lib_LTLIBRARIES=libmate-volume-control-applet.la
+IN_PROCESS = true
+else !IN_PROCESS
+APPLET_LOCATION = $(libexecdir)/mate-volume-control-applet
servicedir = $(datadir)/dbus-1/services
-service_in_files = org.mate.panel.applet.GvcAppletFactory.service.in
service_DATA = $(service_in_files:.service.in=.service)
+IN_PROCESS = false
-org.mate.panel.applet.GvcAppletFactory.service: $(service_in_files)
+$(service_in_files:.service.in=.service): $(service_in_files)
$(AM_V_GEN)sed \
-e "s|\@LOCATION\@|$(APPLET_LOCATION)|" \
$< > $@
+endif !IN_PROCESS
-EXTRA_DIST = \
- $(applets_in_files).in \
- $(service_in_files)
+$(applets_in_files): $(applets_in_files).in Makefile
+ $(AM_V_GEN)sed \
+ -e "s|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
+ -e "s|\@IN_PROCESS\@|$(IN_PROCESS)|" \
+ $< > $@
+
+$(applets_DATA): $(applets_in_files) Makefile
+ $(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@
-endif
+endif ENABLE_PANELAPPLET
noinst_LTLIBRARIES = libmatevolumecontrol.la
libmatevolumecontrol_la_SOURCES = \
@@ -76,9 +77,43 @@ mate_volume_control_status_icon_SOURCES = \
$(NULL)
mate_volume_control_status_icon_CFLAGS = $(WARN_CFLAGS)
-endif
+endif ENABLE_STATUSICON
if ENABLE_PANELAPPLET
+if IN_PROCESS
+libmate_volume_control_applet_la_LDFLAGS = \
+ -module -avoid-version \
+ $(WARN_LDFLAGS) \
+ $(AM_LDFLAGS) \
+ $(NULL)
+
+libmate_volume_control_applet_la_SOURCES = \
+ gvc-stream-applet-icon.h \
+ gvc-stream-applet-icon.c \
+ gvc-applet.h \
+ gvc-applet.c \
+ applet-main.c \
+ $(NULL)
+
+libmate_volume_control_applet_la_CFLAGS = $(WARN_CFLAGS)
+
+libmate_volume_control_applet_la_LIBADD = \
+ -lm \
+ libmatevolumecontrol.la \
+ $(MATE_APPLETS4_CFLAGS) \
+ $(VOLUME_CONTROL_LIBS) \
+ $(NULL)
+
+if ENABLE_WAYLAND
+libmate_volume_control_applet_la_LIBADD += \
+ $(WAYLAND_LIBS)
+
+AM_CPPFLAGS += \
+ $(WAYLAND_CFLAGS)
+endif ENABLE_WAYLAND
+
+else !IN_PROCESS
+libexec_PROGRAMS = mate-volume-control-applet
mate_volume_control_applet_LDADD = \
-lm \
libmatevolumecontrol.la \
@@ -93,9 +128,16 @@ mate_volume_control_applet_SOURCES = \
gvc-applet.c \
applet-main.c \
$(NULL)
-
mate_volume_control_applet_CFLAGS = $(WARN_CFLAGS)
-endif
+
+mate_volume_control_applet_LDFLAGS = \
+ -module -avoid-version \
+ $(WARN_LDFLAGS) \
+ $(AM_LDFLAGS) \
+ $(NULL)
+
+endif !IN_PROCESS
+endif ENABLE_PANELAPPLET
mate_volume_control_LDADD = \
-lm \
@@ -128,11 +170,14 @@ BUILT_SOURCES = \
CLEANFILES = \
$(applets_in_files) \
- $(BUILT_SOURCES) \
$(NULL)
MAINTAINERCLEANFILES = \
*~ \
Makefile.in
+EXTRA_DIST = \
+ $(applets_in_files).in \
+ $(service_in_files)
+
-include $(top_srcdir)/git.mk
diff --git a/mate-volume-control/applet-main.c b/mate-volume-control/applet-main.c
index 58614a9..24dca77 100644
--- a/mate-volume-control/applet-main.c
+++ b/mate-volume-control/applet-main.c
@@ -3,6 +3,7 @@
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
* Copyright (C) 2019 Victor Kareh <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -23,7 +24,7 @@
#include "config.h"
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
@@ -41,10 +42,6 @@ applet_main (MatePanelApplet* applet_widget)
GvcApplet *applet;
GApplication *app = NULL;
- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
app = g_application_new (GVC_APPLET_DBUS_NAME, G_APPLICATION_FLAGS_NONE);
if (!g_application_register (app, NULL, &error)) {
@@ -86,9 +83,17 @@ applet_factory (MatePanelApplet* applet, const char* iid, gpointer data)
return retval;
}
+#ifdef IN_PROCESS
/* needed by mate-panel applet library */
+MATE_PANEL_APPLET_IN_PROCESS_FACTORY("GvcAppletFactory",
+ PANEL_TYPE_APPLET,
+ "Volume Control applet",
+ applet_factory,
+ NULL)
+#else
MATE_PANEL_APPLET_OUT_PROCESS_FACTORY("GvcAppletFactory",
PANEL_TYPE_APPLET,
"Volume Control applet",
applet_factory,
NULL)
+#endif
diff --git a/mate-volume-control/dialog-main.c b/mate-volume-control/dialog-main.c
index 486ab4a..c731261 100644
--- a/mate-volume-control/dialog-main.c
+++ b/mate-volume-control/dialog-main.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -191,7 +192,7 @@ main (int argc, char **argv)
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, N_("Enable debug"), NULL },
{ "page", 'p', 0, G_OPTION_ARG_STRING, &page, N_("Startup page"), "effects|hardware|input|output|applications" },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
- { NULL }
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
diff --git a/mate-volume-control/gvc-applet.c b/mate-volume-control/gvc-applet.c
index b96a886..93e4623 100644
--- a/mate-volume-control/gvc-applet.c
+++ b/mate-volume-control/gvc-applet.c
@@ -3,6 +3,7 @@
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
* Copyright (C) 2019 Victor Kareh <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +25,7 @@
#include <string.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
@@ -507,14 +508,11 @@ menu_activate_open_volume_control (GtkAction *action, GvcApplet *applet)
gboolean
gvc_applet_fill (GvcApplet *applet, MatePanelApplet* applet_widget)
{
- GdkEventMask event_mask;
- GdkWindow *window;
-
+#ifndef IN_PROCESS
g_set_application_name (_("Volume Control Applet"));
gtk_window_set_default_icon_name (APPLET_ICON);
-
mate_panel_applet_set_flags (applet_widget, MATE_PANEL_APPLET_EXPAND_MINOR);
-
+#endif
applet->priv->applet = applet_widget;
/*FIXME: We haved to set this up BEFORE packing in icons. find a way to update this when the applet is moved that works*/
switch (mate_panel_applet_get_orient (applet->priv->applet)) {
@@ -544,16 +542,11 @@ gvc_applet_fill (GvcApplet *applet, MatePanelApplet* applet_widget)
gtk_container_add (GTK_CONTAINER (applet->priv->applet), GTK_WIDGET (applet->priv->box));
gtk_widget_show_all (GTK_WIDGET (applet->priv->applet));
- /* Enable 'scroll-event' signal to get through */
- window = gtk_widget_get_window (GTK_WIDGET (applet->priv->icon_input));
- event_mask = gdk_window_get_events (window);
- gdk_window_set_events (window, event_mask | GDK_SCROLL_MASK);
-
- window = gtk_widget_get_window (GTK_WIDGET (applet->priv->icon_output));
- event_mask = gdk_window_get_events (window);
- gdk_window_set_events (window, event_mask | GDK_SCROLL_MASK);
+ /* Enable 'scroll-event' signal to be received */
+ gtk_widget_add_events (GTK_WIDGET(applet->priv->icon_input), GDK_SCROLL_MASK);
+ gtk_widget_add_events (GTK_WIDGET(applet->priv->icon_output), GDK_SCROLL_MASK);
- /* Update icons on size/orientation changes */
+ /* Update icons on size/orientation changes*/
g_object_connect (applet->priv->applet,
"signal::change_size", gvc_applet_set_size, applet,
"signal::change_orient", gvc_applet_set_orient, applet,
diff --git a/mate-volume-control/gvc-applet.h b/mate-volume-control/gvc-applet.h
index 608e1a2..870cfb9 100644
--- a/mate-volume-control/gvc-applet.h
+++ b/mate-volume-control/gvc-applet.h
@@ -3,6 +3,7 @@
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
* Copyright (C) 2019 Victor Kareh <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-balance-bar.c b/mate-volume-control/gvc-balance-bar.c
index f6e8836..633fd17 100644
--- a/mate-volume-control/gvc-balance-bar.c
+++ b/mate-volume-control/gvc-balance-bar.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 William Jon McCann
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,12 +30,6 @@
#include "gvc-balance-bar.h"
-#define BALANCE_BAR_STYLE \
- "style \"balance-bar-scale-style\" {\n" \
- " GtkScale::trough-side-details = 0\n" \
- "}\n" \
- "widget \"*.balance-bar-scale\" style : rc \"balance-bar-scale-style\"\n"
-
#define SCALE_SIZE 128
struct _GvcBalanceBarPrivate
@@ -241,7 +236,7 @@ find_stream_lfe_channel (MateMixerStreamControl *control)
static void
gvc_balance_bar_set_control (GvcBalanceBar *bar, MateMixerStreamControl *control)
{
- g_return_if_fail (GVC_BALANCE_BAR (bar));
+ g_return_if_fail (GVC_IS_BALANCE_BAR (bar));
g_return_if_fail (MATE_MIXER_IS_STREAM_CONTROL (control));
if (bar->priv->control != NULL) {
@@ -481,15 +476,17 @@ on_adjustment_value_changed (GtkAdjustment *adjustment, GvcBalanceBar *bar)
switch (bar->priv->btype) {
case BALANCE_TYPE_RL:
- mate_mixer_stream_control_set_balance (bar->priv->control, value);
+ mate_mixer_stream_control_set_balance (bar->priv->control,
+ (gfloat) value);
break;
case BALANCE_TYPE_FR:
- mate_mixer_stream_control_set_fade (bar->priv->control, value);
+ mate_mixer_stream_control_set_fade (bar->priv->control,
+ (gfloat) value);
break;
case BALANCE_TYPE_LFE:
mate_mixer_stream_control_set_channel_volume (bar->priv->control,
- bar->priv->lfe_channel,
- value);
+ bar->priv->lfe_channel,
+ (guint) value);
break;
}
}
diff --git a/mate-volume-control/gvc-balance-bar.h b/mate-volume-control/gvc-balance-bar.h
index 2530191..ae75309 100644
--- a/mate-volume-control/gvc-balance-bar.h
+++ b/mate-volume-control/gvc-balance-bar.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-channel-bar.c b/mate-volume-control/gvc-channel-bar.c
index 571da2c..1f57098 100644
--- a/mate-volume-control/gvc-channel-bar.c
+++ b/mate-volume-control/gvc-channel-bar.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 William Jon McCann
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +25,7 @@
#include <sys/param.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
@@ -51,6 +52,7 @@ struct _GvcChannelBarPrivate
gboolean show_icons;
gboolean show_mute;
gboolean show_marks;
+ gboolean show_mark_text;
gboolean extended;
GtkSizeGroup *size_group;
gboolean symmetric;
@@ -66,6 +68,7 @@ enum {
PROP_SHOW_ICONS,
PROP_SHOW_MUTE,
PROP_SHOW_MARKS,
+ PROP_SHOW_MARK_TEXT,
PROP_EXTENDED,
PROP_NAME,
PROP_ICON_NAME,
@@ -286,6 +289,28 @@ update_layout (GvcChannelBar *bar)
}
static void
+update_scale_size (GvcChannelBar *bar)
+{
+ gdouble normal_volume;
+ gdouble maximum_volume;
+ int calculated_scale_size = SCALE_SIZE;
+
+ if (bar->priv->extended && bar->priv->control != NULL)
+ {
+ normal_volume = mate_mixer_stream_control_get_normal_volume (bar->priv->control);
+ maximum_volume = mate_mixer_stream_control_get_max_volume (bar->priv->control);
+ calculated_scale_size = (maximum_volume / normal_volume) * SCALE_SIZE;
+ }
+
+ if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ gtk_widget_set_size_request (bar->priv->scale,
+ -1, calculated_scale_size);
+ else
+ gtk_widget_set_size_request (bar->priv->scale,
+ calculated_scale_size, -1);
+}
+
+static void
update_marks (GvcChannelBar *bar)
{
gdouble base;
@@ -306,7 +331,11 @@ update_marks (GvcChannelBar *bar)
return;
if (base < normal) {
- gchar *str = g_strdup_printf ("<small>%s</small>", C_("volume", "Unamplified"));
+ gchar *str = NULL;
+
+ if (bar->priv->show_mark_text)
+ str = g_strdup_printf ("<small>%s</small>",
+ C_("volume", "Unamplified"));
gtk_scale_add_mark (GTK_SCALE (bar->priv->scale),
base,
@@ -319,7 +348,11 @@ update_marks (GvcChannelBar *bar)
/* Only show 100% mark if the scale is extended beyond 100% and
* there is no unamplified mark or it is below the normal volume */
if (bar->priv->extended && (base == normal || base < normal)) {
- gchar *str = g_strdup_printf ("<small>%s</small>", C_("volume", "100%"));
+ gchar *str = NULL;
+
+ if (bar->priv->show_mark_text)
+ str = g_strdup_printf ("<small>%s</small>",
+ C_("volume", "100%"));
gtk_scale_add_mark (GTK_SCALE (bar->priv->scale),
normal,
@@ -368,18 +401,11 @@ update_adjustment_value (GvcChannelBar *bar)
else
value = mate_mixer_stream_control_get_volume (bar->priv->control);
- gdouble maximum = gtk_adjustment_get_upper (bar->priv->adjustment);
- gdouble minimum = gtk_adjustment_get_lower (bar->priv->adjustment);
- gdouble range = maximum - minimum;
-
- /* round value to nearest hundreth of the range */
- gdouble new_value = minimum + round (((value - minimum) / range) * 100) * (range / 100);
-
g_signal_handlers_block_by_func (G_OBJECT (bar->priv->adjustment),
on_adjustment_value_changed,
bar);
- gtk_adjustment_set_value (bar->priv->adjustment, new_value);
+ gtk_adjustment_set_value (bar->priv->adjustment, value);
g_signal_handlers_unblock_by_func (G_OBJECT (bar->priv->adjustment),
on_adjustment_value_changed,
@@ -583,6 +609,7 @@ gvc_channel_bar_set_control (GvcChannelBar *bar, MateMixerStreamControl *control
update_mute_button (bar);
update_adjustment_limits (bar);
update_adjustment_value (bar);
+ update_scale_size (bar);
}
GtkOrientation
@@ -682,6 +709,28 @@ gvc_channel_bar_set_show_marks (GvcChannelBar *bar, gboolean show_marks)
}
gboolean
+gvc_channel_bar_get_show_mark_text (GvcChannelBar *bar)
+{
+ g_return_val_if_fail (GVC_IS_CHANNEL_BAR (bar), FALSE);
+
+ return bar->priv->show_mark_text;
+}
+
+void
+gvc_channel_bar_set_show_mark_text (GvcChannelBar *bar, gboolean show_mark_text)
+{
+ g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
+
+ if (show_mark_text == bar->priv->show_mark_text)
+ return;
+
+ bar->priv->show_mark_text = show_mark_text;
+ update_marks (bar);
+
+ g_object_notify_by_pspec (G_OBJECT (bar), properties[PROP_SHOW_MARK_TEXT]);
+}
+
+gboolean
gvc_channel_bar_get_extended (GvcChannelBar *bar)
{
g_return_val_if_fail (GVC_IS_CHANNEL_BAR (bar), FALSE);
@@ -703,6 +752,7 @@ gvc_channel_bar_set_extended (GvcChannelBar *bar, gboolean extended)
* limit at the end of the scale */
update_marks (bar);
update_adjustment_limits (bar);
+ update_scale_size (bar);
g_object_notify_by_pspec (G_OBJECT (bar), properties[PROP_EXTENDED]);
}
@@ -939,6 +989,9 @@ gvc_channel_bar_set_property (GObject *object,
case PROP_SHOW_MARKS:
gvc_channel_bar_set_show_marks (self, g_value_get_boolean (value));
break;
+ case PROP_SHOW_MARK_TEXT:
+ gvc_channel_bar_set_show_mark_text (self, g_value_get_boolean (value));
+ break;
case PROP_EXTENDED:
gvc_channel_bar_set_extended (self, g_value_get_boolean (value));
break;
@@ -984,6 +1037,9 @@ gvc_channel_bar_get_property (GObject *object,
case PROP_SHOW_MARKS:
g_value_set_boolean (value, self->priv->show_marks);
break;
+ case PROP_SHOW_MARK_TEXT:
+ g_value_set_boolean (value, self->priv->show_mark_text);
+ break;
case PROP_EXTENDED:
g_value_set_boolean (value, self->priv->extended);
break;
@@ -1049,6 +1105,15 @@ gvc_channel_bar_class_init (GvcChannelBarClass *klass)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
+ properties[PROP_SHOW_MARK_TEXT] =
+ g_param_spec_boolean ("show-mark-text",
+ "Show mark-text",
+ "Whether to show a volume level label next to each scale mark",
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS);
+
properties[PROP_EXTENDED] =
g_param_spec_boolean ("extended",
"Extended",
diff --git a/mate-volume-control/gvc-channel-bar.h b/mate-volume-control/gvc-channel-bar.h
index 6a91f78..7fc0ed2 100644
--- a/mate-volume-control/gvc-channel-bar.h
+++ b/mate-volume-control/gvc-channel-bar.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -94,6 +95,10 @@ gboolean gvc_channel_bar_get_show_marks (GvcChannelBar *bar
void gvc_channel_bar_set_show_marks (GvcChannelBar *bar,
gboolean show_marks);
+gboolean gvc_channel_bar_get_show_mark_text (GvcChannelBar *bar);
+void gvc_channel_bar_set_show_mark_text (GvcChannelBar *bar,
+ gboolean show_mark_text);
+
gboolean gvc_channel_bar_get_extended (GvcChannelBar *bar);
void gvc_channel_bar_set_extended (GvcChannelBar *bar,
gboolean extended);
diff --git a/mate-volume-control/gvc-combo-box.c b/mate-volume-control/gvc-combo-box.c
index 1f3452f..05a1da7 100644
--- a/mate-volume-control/gvc-combo-box.c
+++ b/mate-volume-control/gvc-combo-box.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2009 Bastien Nocera
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-combo-box.h b/mate-volume-control/gvc-combo-box.h
index fc82be5..4865aab 100644
--- a/mate-volume-control/gvc-combo-box.h
+++ b/mate-volume-control/gvc-combo-box.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2009 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-level-bar.c b/mate-volume-control/gvc-level-bar.c
index e6c000d..13e7aeb 100644
--- a/mate-volume-control/gvc-level-bar.c
+++ b/mate-volume-control/gvc-level-bar.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 William Jon McCann <[email protected]>
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -149,8 +150,8 @@ reset_max_peak (GvcLevelBar *bar)
static void
bar_calc_layout (GvcLevelBar *bar)
{
- int peak_level;
- int max_peak_level;
+ gdouble peak_level;
+ gdouble max_peak_level;
GtkAllocation allocation;
GtkStyleContext *context;
@@ -178,8 +179,8 @@ bar_calc_layout (GvcLevelBar *bar)
bar->priv->layout.area.height = allocation.height - 2;
if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
- peak_level = bar->priv->peak_fraction * bar->priv->layout.area.height;
- max_peak_level = bar->priv->max_peak * bar->priv->layout.area.height;
+ peak_level = bar->priv->peak_fraction * (gdouble) bar->priv->layout.area.height;
+ max_peak_level = bar->priv->max_peak * (gdouble) bar->priv->layout.area.height;
bar->priv->layout.delta = bar->priv->layout.area.height / NUM_BOXES;
bar->priv->layout.area.x = 0;
@@ -188,8 +189,8 @@ bar_calc_layout (GvcLevelBar *bar)
bar->priv->layout.box_width = bar->priv->layout.area.width;
bar->priv->layout.box_radius = bar->priv->layout.box_width / 2;
} else {
- peak_level = bar->priv->peak_fraction * bar->priv->layout.area.width;
- max_peak_level = bar->priv->max_peak * bar->priv->layout.area.width;
+ peak_level = bar->priv->peak_fraction * (gdouble) bar->priv->layout.area.width;
+ max_peak_level = bar->priv->max_peak * (gdouble) bar->priv->layout.area.width;
bar->priv->layout.delta = bar->priv->layout.area.width / NUM_BOXES;
bar->priv->layout.area.x = 0;
@@ -199,8 +200,8 @@ bar_calc_layout (GvcLevelBar *bar)
bar->priv->layout.box_radius = bar->priv->layout.box_height / 2;
}
- bar->priv->layout.peak_num = peak_level / bar->priv->layout.delta;
- bar->priv->layout.max_peak_num = max_peak_level / bar->priv->layout.delta;
+ bar->priv->layout.peak_num = (int) (peak_level / (gdouble) bar->priv->layout.delta);
+ bar->priv->layout.max_peak_num = (int) (max_peak_level / (gdouble) bar->priv->layout.delta);
}
static void
@@ -214,12 +215,23 @@ update_peak_value (GvcLevelBar *bar)
bar->priv->peak_fraction = value;
if (value > bar->priv->max_peak) {
+ AtkObject *acc_obj;
+ char *acc_string;
+ gdouble peak_percentage;
+
if (bar->priv->max_peak_id > 0)
g_source_remove (bar->priv->max_peak_id);
bar->priv->max_peak_id =
g_timeout_add_seconds (1, (GSourceFunc) reset_max_peak, bar);
bar->priv->max_peak = value;
+ /* Providing an accessible based on peaks, so that
+ * it doesn’t get updated too often. */
+ acc_obj = gtk_widget_get_accessible (GTK_WIDGET (bar));
+ peak_percentage = round (value * 100.0);
+ acc_string = g_strdup_printf (_("Peak: %.0lf"), peak_percentage);
+ atk_object_set_name (acc_obj, acc_string);
+ g_free (acc_string);
}
layout = bar->priv->layout;
@@ -283,7 +295,7 @@ void
gvc_level_bar_set_peak_adjustment (GvcLevelBar *bar,
GtkAdjustment *adjustment)
{
- g_return_if_fail (GVC_LEVEL_BAR (bar));
+ g_return_if_fail (GVC_IS_LEVEL_BAR (bar));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
if (bar->priv->peak_adjustment != NULL) {
@@ -309,7 +321,7 @@ void
gvc_level_bar_set_rms_adjustment (GvcLevelBar *bar,
GtkAdjustment *adjustment)
{
- g_return_if_fail (GVC_LEVEL_BAR (bar));
+ g_return_if_fail (GVC_IS_LEVEL_BAR (bar));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
if (bar->priv->rms_adjustment != NULL) {
@@ -512,7 +524,7 @@ curved_rectangle (cairo_t *cr,
x1 = x0 + width;
y1 = y0 + height;
- if (!width || !height)
+ if (width == 0.0 || height == 0.0)
return;
if (width / 2 < radius) {
@@ -752,6 +764,9 @@ gvc_level_bar_init (GvcLevelBar *bar)
bar);
gtk_widget_set_has_window (GTK_WIDGET (bar), FALSE);
+
+ atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (bar)),
+ ATK_ROLE_STATIC);
}
static void
diff --git a/mate-volume-control/gvc-level-bar.h b/mate-volume-control/gvc-level-bar.h
index ef9ae7e..21d4644 100644
--- a/mate-volume-control/gvc-level-bar.h
+++ b/mate-volume-control/gvc-level-bar.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 William Jon McCann <[email protected]>
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-mixer-dialog.c b/mate-volume-control/gvc-mixer-dialog.c
index 2138f2c..a71a12f 100644
--- a/mate-volume-control/gvc-mixer-dialog.c
+++ b/mate-volume-control/gvc-mixer-dialog.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 William Jon McCann
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,9 +41,11 @@
struct _GvcMixerDialogPrivate
{
+ GSettings *sound_settings;
MateMixerContext *context;
MateMixerBackendFlags backend_flags;
GHashTable *bars;
+ GtkWidget *volume_overamplifiable_button;
GtkWidget *notebook;
GtkWidget *output_bar;
GtkWidget *input_bar;
@@ -368,6 +371,39 @@ update_output_settings (GvcMixerDialog *dialog)
gtk_widget_hide (dialog->priv->output_settings_frame);
}
+/*
+ * Enable or disable the checkbox allowing the user to set the volume above
+ * 100%, depending on whether the maximum volume is greater than the
+ * "normal" volume. If the maximum volume is greater than the normal
+ * volume, then enable the checkbox; otherwise, over-amplification is not
+ * possible with this control, so disable the checkbox.
+ */
+static void
+update_overamplify_sensitivity (GvcMixerDialog *dialog)
+{
+ MateMixerStreamControl *control;
+ guint normal_volume;
+ guint maximum_volume;
+
+ control = gvc_channel_bar_get_control (GVC_CHANNEL_BAR (dialog->priv->output_bar));
+ if (control == NULL)
+ {
+ gtk_widget_set_sensitive (dialog->priv->volume_overamplifiable_button,
+ FALSE);
+ return;
+ }
+
+ normal_volume = mate_mixer_stream_control_get_normal_volume (control);
+ maximum_volume = mate_mixer_stream_control_get_max_volume (control);
+
+ if (maximum_volume > normal_volume)
+ gtk_widget_set_sensitive (dialog->priv->volume_overamplifiable_button,
+ TRUE);
+ else
+ gtk_widget_set_sensitive (dialog->priv->volume_overamplifiable_button,
+ FALSE);
+}
+
static void
set_output_stream (GvcMixerDialog *dialog, MateMixerStream *stream)
{
@@ -419,6 +455,7 @@ set_output_stream (GvcMixerDialog *dialog, MateMixerStream *stream)
update_default_tree_item (dialog, model, stream);
update_output_settings (dialog);
+ update_overamplify_sensitivity (dialog);
}
static void
@@ -627,8 +664,7 @@ create_bar (GvcMixerDialog *dialog, gboolean use_size_group, gboolean symmetric)
"orientation", GTK_ORIENTATION_HORIZONTAL,
"show-mute", TRUE,
"show-icons", TRUE,
- "show-marks", TRUE,
- "extended", TRUE, NULL);
+ "show-marks", TRUE, NULL);
return bar;
}
@@ -860,6 +896,7 @@ add_stream (GvcMixerDialog *dialog, MateMixerStream *stream)
bar_set_stream (dialog, dialog->priv->output_bar, stream);
update_output_settings (dialog);
+ update_overamplify_sensitivity (dialog);
is_default = TRUE;
}
model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->output_treeview));
@@ -1795,12 +1832,12 @@ dialog_accel_cb (GtkAccelGroup *accelgroup,
GdkModifierType mod,
GvcMixerDialog *self)
{
- gint num = -1;
- gint i;
+ gint num = -1;
+ gsize i;
for (i = 0; i < G_N_ELEMENTS (tab_accel_keys); i++) {
if (tab_accel_keys[i] == key) {
- num = i;
+ num = (gint) i;
break;
}
}
@@ -1943,7 +1980,7 @@ gvc_mixer_dialog_constructor (GType type,
GtkTreeSelection *selection;
GtkAccelGroup *accel_group;
GtkTreeIter iter;
- gint i;
+ gsize i;
const GList *list;
GClosure *closure = NULL;
@@ -1953,6 +1990,8 @@ gvc_mixer_dialog_constructor (GType type,
self = GVC_MIXER_DIALOG (object);
+ self->priv->sound_settings = g_settings_new ("org.mate.sound");
+
gtk_dialog_add_button (GTK_DIALOG (self), "gtk-close", GTK_RESPONSE_OK);
main_vbox = gtk_dialog_get_content_area (GTK_DIALOG (self));
@@ -1960,8 +1999,8 @@ gvc_mixer_dialog_constructor (GType type,
gtk_container_set_border_width (GTK_CONTAINER (self), 6);
- self->priv->output_stream_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_widget_set_margin_top (self->priv->output_stream_box, 12);
+ self->priv->output_stream_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (self->priv->output_stream_box), 12);
gtk_box_pack_start (GTK_BOX (main_vbox),
self->priv->output_stream_box,
@@ -1971,11 +2010,26 @@ gvc_mixer_dialog_constructor (GType type,
gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->priv->output_bar),
_("_Output volume: "));
+ g_settings_bind (self->priv->sound_settings, "volume-overamplifiable",
+ self->priv->output_bar, "extended",
+ G_SETTINGS_BIND_GET);
+
gtk_widget_show (self->priv->output_bar);
gtk_widget_set_sensitive (self->priv->output_bar, FALSE);
gtk_box_pack_start (GTK_BOX (self->priv->output_stream_box),
- self->priv->output_bar, TRUE, TRUE, 12);
+ self->priv->output_bar, TRUE, TRUE, 0);
+
+ self->priv->volume_overamplifiable_button =
+ gtk_check_button_new_with_mnemonic (_("Allow volume to e_xceed 100%"));
+
+ g_settings_bind (self->priv->sound_settings, "volume-overamplifiable",
+ self->priv->volume_overamplifiable_button, "active",
+ G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET);
+
+ gtk_box_pack_start (GTK_BOX (self->priv->output_stream_box),
+ self->priv->volume_overamplifiable_button,
+ FALSE, FALSE, 0);
self->priv->notebook = gtk_notebook_new ();
@@ -2107,6 +2161,9 @@ gvc_mixer_dialog_constructor (GType type,
GTK_ORIENTATION_HORIZONTAL);
gvc_level_bar_set_scale (GVC_LEVEL_BAR (self->priv->input_level_bar),
GVC_LEVEL_SCALE_LINEAR);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label),
+ self->priv->input_level_bar);
+ gtk_widget_set_can_focus (self->priv->input_level_bar, TRUE);
gtk_box_pack_start (GTK_BOX (box),
self->priv->input_level_bar,
TRUE, TRUE, 6);
@@ -2342,6 +2399,8 @@ gvc_mixer_dialog_dispose (GObject *object)
g_clear_object (&dialog->priv->context);
}
+ g_clear_object (&dialog->priv->sound_settings);
+
G_OBJECT_CLASS (gvc_mixer_dialog_parent_class)->dispose (object);
}
diff --git a/mate-volume-control/gvc-mixer-dialog.h b/mate-volume-control/gvc-mixer-dialog.h
index 22e522d..1f0243c 100644
--- a/mate-volume-control/gvc-mixer-dialog.h
+++ b/mate-volume-control/gvc-mixer-dialog.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-sound-theme-chooser.c b/mate-volume-control/gvc-sound-theme-chooser.c
index c438416..b22153f 100644
--- a/mate-volume-control/gvc-sound-theme-chooser.c
+++ b/mate-volume-control/gvc-sound-theme-chooser.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Bastien Nocera <[email protected]>
* Copyright (C) 2008 William Jon McCann
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,6 +35,7 @@
#include <gtk/gtk.h>
#include <canberra-gtk.h>
#include <libxml/tree.h>
+#include <libxml/parser.h>
#include "gvc-sound-theme-chooser.h"
#include "sound-theme-file-utils.h"
@@ -534,7 +536,6 @@ save_alert_sounds (GvcSoundThemeChooser *chooser,
return FALSE;
}
-
static void
update_alert_model (GvcSoundThemeChooser *chooser,
const char *id)
diff --git a/mate-volume-control/gvc-sound-theme-chooser.h b/mate-volume-control/gvc-sound-theme-chooser.h
index 55fd1cb..f55df15 100644
--- a/mate-volume-control/gvc-sound-theme-chooser.h
+++ b/mate-volume-control/gvc-sound-theme-chooser.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-speaker-test.c b/mate-volume-control/gvc-speaker-test.c
index c6ca470..04c6cf9 100644
--- a/mate-volume-control/gvc-speaker-test.c
+++ b/mate-volume-control/gvc-speaker-test.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2009 Bastien Nocera
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -364,6 +365,7 @@ create_control (ca_context *canberra, MateMixerChannelPosition position)
gtk_box_pack_start (GTK_BOX (control), label, FALSE, FALSE, 0);
test_button = gtk_button_new_with_label (_("Test"));
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), test_button);
g_signal_connect (G_OBJECT (test_button),
"clicked",
G_CALLBACK (on_test_button_clicked),
@@ -412,7 +414,6 @@ gvc_speaker_test_init (GvcSpeakerTest *test)
1, 1,
3, 1);
-
gtk_grid_set_baseline_row (GTK_GRID (test), 1);
gtk_widget_show (face);
diff --git a/mate-volume-control/gvc-speaker-test.h b/mate-volume-control/gvc-speaker-test.h
index 56650f1..7045873 100644
--- a/mate-volume-control/gvc-speaker-test.h
+++ b/mate-volume-control/gvc-speaker-test.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2009 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-status-icon.c b/mate-volume-control/gvc-status-icon.c
index 808143d..88c74eb 100644
--- a/mate-volume-control/gvc-status-icon.c
+++ b/mate-volume-control/gvc-status-icon.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-status-icon.h b/mate-volume-control/gvc-status-icon.h
index 5914a1f..e0a8943 100644
--- a/mate-volume-control/gvc-status-icon.h
+++ b/mate-volume-control/gvc-status-icon.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-stream-applet-icon.c b/mate-volume-control/gvc-stream-applet-icon.c
index 63a172d..5d82c33 100644
--- a/mate-volume-control/gvc-stream-applet-icon.c
+++ b/mate-volume-control/gvc-stream-applet-icon.c
@@ -3,6 +3,7 @@
* Copyright (C) 2008 William Jon McCann
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
* Copyright (C) 2019 Victor Kareh <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,12 +20,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
+#include <config.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#if defined(ENABLE_WAYLAND)
+#include <gdk/gdkwayland.h>
+#include <gtk-layer-shell/gtk-layer-shell.h>
+#endif
+
#include <libmatemixer/matemixer.h>
#include <mate-panel-applet.h>
@@ -36,6 +43,7 @@
struct _GvcStreamAppletIconPrivate
{
+ GSettings *sound_settings;
gchar **icon_names;
GtkImage *image;
GtkWidget *dock;
@@ -90,12 +98,83 @@ popup_dock (GvcStreamAppletIcon *icon, guint time)
gvc_channel_bar_set_orientation (GVC_CHANNEL_BAR (icon->priv->bar), GTK_ORIENTATION_VERTICAL);
}
- monitor_num = gdk_display_get_monitor_at_point (gdk_screen_get_display (screen), allocation.x, allocation.y);
+ display = gdk_screen_get_display (screen);
+ monitor_num = gdk_display_get_monitor_at_point (display, allocation.x, allocation.y);
gdk_monitor_get_geometry (monitor_num, &monitor);
gtk_container_foreach (GTK_CONTAINER (icon->priv->dock), (GtkCallback) gtk_widget_show_all, NULL);
gtk_widget_get_preferred_size (icon->priv->dock, &dock_req, NULL);
+#if defined(ENABLE_WAYLAND)
+ if (GDK_IS_WAYLAND_DISPLAY (display))
+ {
+ gboolean top, bottom, left, right;
+ GtkWidget *toplevel;
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (icon));
+
+ if (!gtk_layer_is_layer_window (GTK_WINDOW (icon->priv->dock)))
+ {
+ gtk_layer_init_for_window (GTK_WINDOW (icon->priv->dock));
+ gtk_layer_set_layer (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_LAYER_TOP);
+ gtk_layer_set_keyboard_mode (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND);
+ }
+
+ top = gtk_layer_get_anchor (GTK_WINDOW (toplevel), GTK_LAYER_SHELL_EDGE_TOP);
+ bottom = gtk_layer_get_anchor (GTK_WINDOW (toplevel), GTK_LAYER_SHELL_EDGE_BOTTOM);
+ left = gtk_layer_get_anchor (GTK_WINDOW (toplevel), GTK_LAYER_SHELL_EDGE_LEFT);
+ right = gtk_layer_get_anchor (GTK_WINDOW (toplevel), GTK_LAYER_SHELL_EDGE_RIGHT);
+
+ /*Set anchors to the edges (will hold to panel edge) and position along the panel
+ *Unset margins and anchors from any other position so as to avoid rendering issues
+ *when orientation changes as when the panel is moved
+ */
+
+ if (top && left && right)
+ {
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_BOTTOM, FALSE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_RIGHT, FALSE);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, allocation.x);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, 0);
+ }
+ if (bottom && left && right)
+ {
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_BOTTOM, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, FALSE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_RIGHT, FALSE);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, allocation.x);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, 0);
+ }
+ if (left && bottom && top && !right)
+ {
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_RIGHT, FALSE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_BOTTOM, FALSE);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, allocation.y);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, 0);
+ }
+ if (right && bottom && top && !left)
+ {
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_RIGHT, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, TRUE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, FALSE);
+ gtk_layer_set_anchor (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_BOTTOM, FALSE);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_TOP, allocation.y);
+ gtk_layer_set_margin (GTK_WINDOW (icon->priv->dock), GTK_LAYER_SHELL_EDGE_LEFT, 0);
+ }
+ gtk_widget_show_all (icon->priv->dock);
+
+ /* Grab focus */
+ gtk_grab_add (icon->priv->dock);
+ gtk_widget_grab_focus (icon->priv->dock);
+
+ return TRUE;
+ }
+#endif /* wayland support */
+
if (icon->priv->orient == MATE_PANEL_APPLET_ORIENT_LEFT || icon->priv->orient == MATE_PANEL_APPLET_ORIENT_RIGHT) {
if (allocation.x + allocation.width + dock_req.width <= monitor.x + monitor.width)
x = allocation.x + allocation.width;
@@ -496,7 +575,7 @@ void
gvc_stream_applet_icon_set_display_name (GvcStreamAppletIcon *icon,
const gchar *name)
{
- g_return_if_fail (GVC_STREAM_APPLET_ICON (icon));
+ g_return_if_fail (GVC_IS_STREAM_APPLET_ICON (icon));
g_free (icon->priv->display_name);
@@ -510,7 +589,7 @@ void
gvc_stream_applet_icon_set_control (GvcStreamAppletIcon *icon,
MateMixerStreamControl *control)
{
- g_return_if_fail (GVC_STREAM_APPLET_ICON (icon));
+ g_return_if_fail (GVC_IS_STREAM_APPLET_ICON (icon));
if (icon->priv->control == control)
return;
@@ -679,6 +758,8 @@ gvc_stream_applet_icon_init (GvcStreamAppletIcon *icon)
icon->priv = gvc_stream_applet_icon_get_instance_private (icon);
+ icon->priv->sound_settings = g_settings_new ("org.mate.sound");
+
icon->priv->image = GTK_IMAGE (gtk_image_new ());
gtk_container_add (GTK_CONTAINER (icon), GTK_WIDGET (icon->priv->image));
@@ -730,6 +811,17 @@ gvc_stream_applet_icon_init (GvcStreamAppletIcon *icon)
gvc_channel_bar_set_orientation (GVC_CHANNEL_BAR (icon->priv->bar),
GTK_ORIENTATION_VERTICAL);
+ gvc_channel_bar_set_show_mark_text (GVC_CHANNEL_BAR (icon->priv->bar),
+ FALSE);
+
+ g_settings_bind (icon->priv->sound_settings, "volume-overamplifiable",
+ icon->priv->bar, "show-marks",
+ G_SETTINGS_BIND_GET);
+
+ g_settings_bind (icon->priv->sound_settings, "volume-overamplifiable",
+ icon->priv->bar, "extended",
+ G_SETTINGS_BIND_GET);
+
/* Set volume control frame, slider and toplevel window to follow panel theme */
GtkWidget *toplevel = gtk_widget_get_toplevel (icon->priv->dock);
GtkStyleContext *context;
@@ -762,11 +854,14 @@ gvc_stream_applet_icon_finalize (GObject *object)
icon = GVC_STREAM_APPLET_ICON (object);
g_strfreev (icon->priv->icon_names);
+ g_clear_pointer (&icon->priv->display_name, g_free);
g_signal_handlers_disconnect_by_func (gtk_settings_get_default (),
on_icon_theme_change,
icon);
+ g_clear_object (&icon->priv->sound_settings);
+
G_OBJECT_CLASS (gvc_stream_applet_icon_parent_class)->finalize (object);
}
diff --git a/mate-volume-control/gvc-stream-applet-icon.h b/mate-volume-control/gvc-stream-applet-icon.h
index 8ef4220..7786cb2 100644
--- a/mate-volume-control/gvc-stream-applet-icon.h
+++ b/mate-volume-control/gvc-stream-applet-icon.h
@@ -3,6 +3,7 @@
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
* Copyright (C) 2019 Victor Kareh <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c
index 217eea5..dccd20d 100644
--- a/mate-volume-control/gvc-stream-status-icon.c
+++ b/mate-volume-control/gvc-stream-status-icon.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 William Jon McCann
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,12 +29,14 @@
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-desktop-utils.h>
+#include <libmate-desktop/mate-image-menu-item.h>
#include "gvc-channel-bar.h"
#include "gvc-stream-status-icon.h"
struct _GvcStreamStatusIconPrivate
{
+ GSettings *sound_settings;
gchar **icon_names;
GtkWidget *dock;
GtkWidget *bar;
@@ -174,11 +177,7 @@ on_status_icon_button_press (GtkStatusIcon *status_icon,
static void
on_menu_mute_toggled (GtkMenuItem *item, GvcStreamStatusIcon *icon)
{
- gboolean is_muted;
-
- is_muted = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item));
-
- mate_mixer_stream_control_set_mute (icon->priv->control, is_muted);
+ mate_mixer_stream_control_set_mute (icon->priv->control, !mate_mixer_stream_control_get_mute (icon->priv->control));
}
static void
@@ -218,10 +217,11 @@ on_status_icon_popup_menu (GtkStatusIcon *status_icon,
GtkWidget *menu;
GtkWidget *item;
GtkWidget *image;
+ g_autofree char *label = NULL;
menu = gtk_menu_new ();
- /*Set up theme and transparency support*/
+ /* Set up theme and transparency support */
GtkWidget *toplevel = gtk_widget_get_toplevel (menu);
/* Fix any failures of compiz/other wm's to communicate with gtk for transparency */
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel));
@@ -233,20 +233,31 @@ on_status_icon_popup_menu (GtkStatusIcon *status_icon,
gtk_style_context_add_class(context,"gnome-panel-menu-bar");
gtk_style_context_add_class(context,"mate-panel-menu-bar");
- item = gtk_check_menu_item_new_with_mnemonic (_("_Mute"));
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
- mate_mixer_stream_control_get_mute (icon->priv->control));
+ if (mate_mixer_stream_control_get_mute (icon->priv->control))
+ {
+ label = g_strdup_printf ("%s %s", _("Unmute"), icon->priv->display_name);
+ /* Set icon to medium*/
+ image = gtk_image_new_from_icon_name(icon->priv->icon_names[2], GTK_ICON_SIZE_MENU);
+ }
+ else
+ {
+ label = g_strdup_printf ("%s %s", _("Mute"), icon->priv->display_name);
+ /* Set icon to muted*/
+ image = gtk_image_new_from_icon_name(icon->priv->icon_names[0], GTK_ICON_SIZE_MENU);
+ }
+ item = mate_image_menu_item_new_with_mnemonic(label);
+ mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item),
- "toggled",
+ "activate",
G_CALLBACK (on_menu_mute_toggled),
icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- item = gtk_image_menu_item_new_with_mnemonic (_("_Sound Preferences"));
+ item = mate_image_menu_item_new_with_mnemonic (_("_Sound Preferences"));
image = gtk_image_new_from_icon_name ("multimedia-volume-control",
GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item),
"activate",
@@ -371,6 +382,7 @@ static void
update_icon (GvcStreamStatusIcon *icon)
{
guint volume = 0;
+ guint volume_percent = 0;
gdouble decibel = 0;
guint normal = 0;
gboolean muted = FALSE;
@@ -398,7 +410,7 @@ update_icon (GvcStreamStatusIcon *icon)
/* Select an icon, they are expected to be sorted, the lowest index being
* the mute icon and the rest being volume increments */
- if (volume <= 0 || muted)
+ if (volume == 0 || muted)
n = 0;
else
n = CLAMP (3 * volume / normal + 1, 1, 3);
@@ -415,7 +427,9 @@ update_icon (GvcStreamStatusIcon *icon)
description = mate_mixer_stream_control_get_label (icon->priv->control);
- guint volume_percent = (guint) round (100.0 * volume / normal);
+ if (normal != 0)
+ volume_percent = (guint) (100.0 * ((double) volume) / ((double) normal));
+
if (muted) {
markup = g_strdup_printf ("<b>%s: %s %u%%</b>\n<small>%s</small>",
icon->priv->display_name,
@@ -499,7 +513,7 @@ void
gvc_stream_status_icon_set_display_name (GvcStreamStatusIcon *icon,
const gchar *name)
{
- g_return_if_fail (GVC_STREAM_STATUS_ICON (icon));
+ g_return_if_fail (GVC_IS_STREAM_STATUS_ICON (icon));
g_free (icon->priv->display_name);
@@ -513,7 +527,7 @@ void
gvc_stream_status_icon_set_control (GvcStreamStatusIcon *icon,
MateMixerStreamControl *control)
{
- g_return_if_fail (GVC_STREAM_STATUS_ICON (icon));
+ g_return_if_fail (GVC_IS_STREAM_STATUS_ICON (icon));
if (icon->priv->control == control)
return;
@@ -680,6 +694,8 @@ gvc_stream_status_icon_init (GvcStreamStatusIcon *icon)
icon->priv = gvc_stream_status_icon_get_instance_private (icon);
+ icon->priv->sound_settings = g_settings_new ("org.mate.sound");
+
g_signal_connect (G_OBJECT (icon),
"activate",
G_CALLBACK (on_status_icon_activate),
@@ -736,6 +752,17 @@ gvc_stream_status_icon_init (GvcStreamStatusIcon *icon)
gvc_channel_bar_set_orientation (GVC_CHANNEL_BAR (icon->priv->bar),
GTK_ORIENTATION_VERTICAL);
+ gvc_channel_bar_set_show_mark_text (GVC_CHANNEL_BAR (icon->priv->bar),
+ FALSE);
+
+ g_settings_bind (icon->priv->sound_settings, "volume-overamplifiable",
+ icon->priv->bar, "show-marks",
+ G_SETTINGS_BIND_GET);
+
+ g_settings_bind (icon->priv->sound_settings, "volume-overamplifiable",
+ icon->priv->bar, "extended",
+ G_SETTINGS_BIND_GET);
+
/* Set volume control frame, slider and toplevel window to follow panel theme */
GtkWidget *toplevel = gtk_widget_get_toplevel (icon->priv->dock);
GtkStyleContext *context;
@@ -772,6 +799,8 @@ gvc_stream_status_icon_finalize (GObject *object)
on_icon_theme_change,
icon);
+ g_clear_object (&icon->priv->sound_settings);
+
G_OBJECT_CLASS (gvc_stream_status_icon_parent_class)->finalize (object);
}
diff --git a/mate-volume-control/gvc-stream-status-icon.h b/mate-volume-control/gvc-stream-status-icon.h
index 7b51801..85a03a4 100644
--- a/mate-volume-control/gvc-stream-status-icon.h
+++ b/mate-volume-control/gvc-stream-status-icon.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-utils.c b/mate-volume-control/gvc-utils.c
index ec5d06d..c545442 100644
--- a/mate-volume-control/gvc-utils.c
+++ b/mate-volume-control/gvc-utils.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/gvc-utils.h b/mate-volume-control/gvc-utils.h
index b39abb0..6c8fa0b 100644
--- a/mate-volume-control/gvc-utils.h
+++ b/mate-volume-control/gvc-utils.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/meson.build b/mate-volume-control/meson.build
new file mode 100644
index 0000000..132f0dd
--- /dev/null
+++ b/mate-volume-control/meson.build
@@ -0,0 +1,154 @@
+po_dir = join_paths(meson.source_root(), 'po')
+
+cflags = [
+ '-DMATELOCALEDIR="@0@"'.format(mm_localedir),
+ '-DLOCALE_DIR="@0@"'.format(mm_localedir),
+ '-DICON_DATA_DIR="@0@"'.format(mm_iconsdir),
+ '-DSOUND_SET_DIR="@0@"'.format(mm_soundsdir),
+ '-DI_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE',
+]
+deps = [
+ glib,
+ gtk,
+ matemixer
+]
+if enable_wayland == 'yes'
+ deps += [gdkwayland, waylandclient, gls]
+endif
+
+libmvc_static = static_library(
+ 'libmatevolumecontrol',
+ sources: 'gvc-channel-bar.c',
+ include_directories: config_inc,
+ dependencies: deps,
+ c_args: cflags,
+ install: false,
+)
+
+if enable_applet
+ desktop_data = configuration_data()
+
+ if enable_process
+ desktop_data.set('APPLET_LOCATION', join_paths(mm_libdir, 'libmate-volume-control-applet.so'))
+ desktop_data.set('IN_PROCESS', 'true')
+
+ libmvca_shared = library(
+ 'libmate-volume-control-applet',
+ sources: [
+ 'gvc-stream-applet-icon.c',
+ 'gvc-applet.c',
+ 'applet-main.c'
+ ],
+ include_directories: config_inc,
+ dependencies: [
+ deps,
+ matepanel,
+ md,
+ canberra,
+ libm
+ ],
+ link_with :libmvc_static,
+ c_args: cflags,
+ install: true,
+ install_dir : mm_libdir,
+ )
+
+ else
+ desktop_data.set('APPLET_LOCATION', join_paths(mm_execdir, 'mate-volume-control-applet'))
+ desktop_data.set('IN_PROCESS', 'flase')
+
+ service_data = configuration_data()
+ service_data.set('LOCATION', join_paths(mm_execdir, 'mate-volume-control-applet'))
+ configure_file(
+ input : 'org.mate.panel.applet.GvcAppletFactory.service.in',
+ output : 'org.mate.panel.applet.GvcAppletFactory.service',
+ configuration : service_data,
+ install : true,
+ install_dir : join_paths(mm_datadir, 'dbus-1/services')
+ )
+ executable(
+ 'mate-volume-control-applet',
+ sources : [
+ 'gvc-stream-applet-icon.c',
+ 'gvc-applet.c',
+ 'applet-main.c'
+ ],
+ include_directories: config_inc,
+ dependencies : [
+ deps,
+ matepanel,
+ md,
+ canberra,
+ libm
+ ],
+ link_with :libmvc_static,
+ c_args : cflags,
+ install : true,
+ install_dir : mm_execdir
+ )
+ endif
+
+ desktop_in_file = configure_file(
+ input : 'org.mate.applets.GvcApplet.mate-panel-applet.desktop.in.in',
+ output : 'org.mate.applets.GvcApplet.mate-panel-applet.desktop.in',
+ configuration : desktop_data
+ )
+ i18n.merge_file(
+ input : desktop_in_file,
+ output : 'org.mate.applets.GvcApplet.mate-panel-applet.desktop',
+ type : 'desktop',
+ po_dir : po_dir,
+ install : true,
+ install_dir : join_paths(mm_datadir, 'mate-panel', 'applets')
+ )
+
+endif
+
+if enable_statusicon
+ executable(
+ 'mate-volume-control-status-icon',
+ sources : [
+ 'gvc-stream-status-icon.c',
+ 'gvc-status-icon.c',
+ 'status-icon-main.c'
+ ],
+ include_directories: config_inc,
+ dependencies : [
+ deps,
+ md,
+ canberra,
+ libm
+ ],
+ link_with :libmvc_static,
+ c_args : cflags,
+ install : true,
+ install_dir : get_option('bindir')
+)
+endif
+executable(
+ 'mate-volume-control',
+ sources : [
+ 'gvc-balance-bar.c',
+ 'gvc-level-bar.c',
+ 'gvc-combo-box.c',
+ 'gvc-sound-theme-chooser.c',
+ 'gvc-speaker-test.c',
+ 'gvc-utils.c',
+ 'sound-theme-file-utils.c',
+ 'gvc-mixer-dialog.c',
+ 'dialog-main.c'
+ ],
+ include_directories : config_inc,
+ dependencies : [
+ libm,
+ canberra,
+ md,
+ libxml,
+ deps
+ ],
+ link_with :libmvc_static,
+ c_args : cflags,
+ install : true,
+ install_dir : get_option('bindir')
+)
+
diff --git a/mate-volume-control/org.mate.applets.GvcApplet.mate-panel-applet.desktop.in.in b/mate-volume-control/org.mate.applets.GvcApplet.mate-panel-applet.desktop.in.in
index 46a8374..b222529 100644
--- a/mate-volume-control/org.mate.applets.GvcApplet.mate-panel-applet.desktop.in.in
+++ b/mate-volume-control/org.mate.applets.GvcApplet.mate-panel-applet.desktop.in.in
@@ -1,6 +1,7 @@
[Applet Factory]
Id=GvcAppletFactory
-Location=@LOCATION@
+InProcess=@IN_PROCESS@
+Location=@APPLET_LOCATION@
Name=Volume Control Factory
Description=Volume Control Factory
diff --git a/mate-volume-control/org.mate.panel.applet.GvcAppletFactory.service.in b/mate-volume-control/org.mate.panel.applet.GvcAppletFactory.service.in
index 0a01e2d..9e19920 100644
--- a/mate-volume-control/org.mate.panel.applet.GvcAppletFactory.service.in
+++ b/mate-volume-control/org.mate.panel.applet.GvcAppletFactory.service.in
@@ -1,4 +1,3 @@
[D-BUS Service]
Name=org.mate.panel.applet.GvcAppletFactory
Exec=@LOCATION@
-
diff --git a/mate-volume-control/sound-theme-file-utils.c b/mate-volume-control/sound-theme-file-utils.c
index 0897954..df06be7 100644
--- a/mate-volume-control/sound-theme-file-utils.c
+++ b/mate-volume-control/sound-theme-file-utils.c
@@ -1,5 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* Copyright (C) 2008 Bastien Nocera <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -186,12 +187,12 @@ custom_theme_dir_is_empty (void)
}
static void
-delete_one_file (const char *sound_name, const char *pattern)
+delete_one_file (const char *sound_name, const char *file_extension)
{
GFile *file;
char *name, *filename;
- name = g_strdup_printf (pattern, sound_name);
+ name = g_strconcat (sound_name, file_extension, NULL);
filename = custom_theme_dir_path (name);
g_free (name);
file = g_file_new_for_path (filename);
@@ -206,7 +207,7 @@ delete_old_files (const char **sounds)
guint i;
for (i = 0; sounds[i] != NULL; i++) {
- delete_one_file (sounds[i], "%s.ogg");
+ delete_one_file (sounds[i], ".ogg");
}
}
@@ -216,7 +217,7 @@ delete_disabled_files (const char **sounds)
guint i;
for (i = 0; sounds[i] != NULL; i++)
- delete_one_file (sounds[i], "%s.disabled");
+ delete_one_file (sounds[i], ".disabled");
}
static void
diff --git a/mate-volume-control/sound-theme-file-utils.h b/mate-volume-control/sound-theme-file-utils.h
index 0ac248b..ea7e19d 100644
--- a/mate-volume-control/sound-theme-file-utils.h
+++ b/mate-volume-control/sound-theme-file-utils.h
@@ -1,5 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* Copyright (C) 2008 Bastien Nocera <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mate-volume-control/status-icon-main.c b/mate-volume-control/status-icon-main.c
index 0cf3910..6bf192a 100644
--- a/mate-volume-control/status-icon-main.c
+++ b/mate-volume-control/status-icon-main.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2008 Red Hat, Inc.
* Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ * Copyright (C) 2014-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -44,7 +45,7 @@ main (int argc, char **argv)
GOptionEntry entries[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, N_("Enable debug"), NULL },
- { NULL }
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);