summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Unruh <[email protected]>2021-07-29 14:13:33 +0200
committerraveit65 <[email protected]>2021-08-04 15:33:27 +0200
commita9087141f538a1810350523da80f1b4202434bb9 (patch)
treefc782ca00eff23063cb7ee5233608e6d811e59c8
parent4f6c0c74c77fa8bf1af44b04a21eb88bf87ce259 (diff)
downloadmate-media-a9087141f538a1810350523da80f1b4202434bb9.tar.bz2
mate-media-a9087141f538a1810350523da80f1b4202434bb9.tar.xz
replace mute/unmute checkmenuitem with imagemenuitem
-rw-r--r--mate-volume-control/gvc-stream-status-icon.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c
index 0153365..8ca2849 100644
--- a/mate-volume-control/gvc-stream-status-icon.c
+++ b/mate-volume-control/gvc-stream-status-icon.c
@@ -175,11 +175,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
@@ -219,10 +215,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));
@@ -234,11 +231,22 @@ 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 = gtk_image_menu_item_new_with_mnemonic(label);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item),
- "toggled",
+ "activate",
G_CALLBACK (on_menu_mute_toggled),
icon);