diff options
Diffstat (limited to 'mate-volume-control/gvc-applet.c')
-rw-r--r-- | mate-volume-control/gvc-applet.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/mate-volume-control/gvc-applet.c b/mate-volume-control/gvc-applet.c index b96a886..c1932d2 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> @@ -52,13 +53,16 @@ static const gchar *icon_names_input[] = { static void menu_output_mute (GtkAction *action, GvcApplet *applet); static void menu_activate_open_volume_control (GtkAction *action, GvcApplet *applet); + +// @todo like in mate-volume-control-status-icon: label = g_strdup_printf ("%s %s", _("Mute/Unmute"), icon->priv->display_name); +// @todo mute/unmute output OR input not output AND output static const GtkActionEntry applet_menu_actions [] = { - { "Preferences", APPLET_ICON, N_("_Sound Preferences"), NULL, NULL, G_CALLBACK(menu_activate_open_volume_control) }, - { "MuteOutput", "audio-volume-muted", N_("Mute Output"), NULL, NULL, G_CALLBACK (menu_output_mute) } + { "MuteOutput", "audio-volume-muted", N_("Mute Output"), NULL, NULL, G_CALLBACK (menu_output_mute) }, + { "Preferences", APPLET_ICON, N_("_Sound Preferences"), NULL, NULL, G_CALLBACK (menu_activate_open_volume_control) } }; -static char *ui = "<menuitem name='Preferences' action='Preferences' />" - "<menuitem name='MuteOutput' action='MuteOutput' />"; +static char *ui = "<menuitem name='MuteOutput' action='MuteOutput' />" + "<menuitem name='Preferences' action='Preferences' />"; struct _GvcAppletPrivate { @@ -507,14 +511,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)) { @@ -532,6 +533,8 @@ gvc_applet_fill (GvcApplet *applet, MatePanelApplet* applet_widget) break; } + gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (applet->priv->applet)), "mate-volume-applet"); + /* Define an initial size and orientation */ gvc_stream_applet_icon_set_size (applet->priv->icon_input, mate_panel_applet_get_size (applet->priv->applet)); gvc_stream_applet_icon_set_size (applet->priv->icon_output, mate_panel_applet_get_size (applet->priv->applet)); @@ -544,16 +547,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, |