Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xfce4-pulseaudio-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bodqhrohro
xfce4-pulseaudio-plugin
Commits
50c66c90
Commit
50c66c90
authored
10 years ago
by
Andrzej
Browse files
Options
Downloads
Patches
Plain Diff
Added a tooltip
parent
c1cee694
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
panel-plugin/pulseaudio-button.c
+24
-3
24 additions, 3 deletions
panel-plugin/pulseaudio-button.c
with
24 additions
and
3 deletions
panel-plugin/pulseaudio-button.c
+
24
−
3
View file @
50c66c90
...
@@ -25,6 +25,15 @@
...
@@ -25,6 +25,15 @@
#ifdef HAVE_CONFIG_H
#include
<config.h>
#endif
#ifdef HAVE_MATH_H
#include
<math.h>
#endif
#include
<glib.h>
#include
<glib.h>
#include
<gtk/gtk.h>
#include
<gtk/gtk.h>
#include
<libxfce4panel/libxfce4panel.h>
#include
<libxfce4panel/libxfce4panel.h>
...
@@ -150,6 +159,8 @@ pulseaudio_button_init (PulseaudioButton *button)
...
@@ -150,6 +159,8 @@ pulseaudio_button_init (PulseaudioButton *button)
gtk_container_add
(
GTK_CONTAINER
(
button
),
button
->
image
);
gtk_container_add
(
GTK_CONTAINER
(
button
),
button
->
image
);
gtk_widget_show
(
button
->
image
);
gtk_widget_show
(
button
->
image
);
g_object_set
(
G_OBJECT
(
button
),
"has-tooltip"
,
TRUE
,
NULL
);
pulseaudio_button_update
(
button
,
TRUE
);
pulseaudio_button_update
(
button
,
TRUE
);
//button->align_box = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
//button->align_box = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
...
@@ -287,13 +298,16 @@ static void
...
@@ -287,13 +298,16 @@ static void
pulseaudio_button_update
(
PulseaudioButton
*
button
,
pulseaudio_button_update
(
PulseaudioButton
*
button
,
gboolean
force_update
)
gboolean
force_update
)
{
{
guint
idx
;
guint
idx
;
gdouble
volume
;
gdouble
volume
;
gboolean
muted
;
gchar
*
tip_text
;
g_return_if_fail
(
IS_PULSEAUDIO_BUTTON
(
button
));
g_return_if_fail
(
IS_PULSEAUDIO_BUTTON
(
button
));
volume
=
pulseaudio_volume_get_volume
(
button
->
volume
);
volume
=
pulseaudio_volume_get_volume
(
button
->
volume
);
if
(
pulseaudio_volume_get_muted
(
button
->
volume
))
muted
=
pulseaudio_volume_get_muted
(
button
->
volume
);
if
(
muted
)
idx
=
V_MUTED
;
idx
=
V_MUTED
;
else
if
(
volume
<=
0
.
0
)
else
if
(
volume
<=
0
.
0
)
idx
=
V_MUTED
;
idx
=
V_MUTED
;
...
@@ -304,6 +318,13 @@ pulseaudio_button_update (PulseaudioButton *button,
...
@@ -304,6 +318,13 @@ pulseaudio_button_update (PulseaudioButton *button,
else
else
idx
=
V_HIGH
;
idx
=
V_HIGH
;
if
(
muted
)
tip_text
=
g_strdup_printf
((
"Volume %d%% (muted)"
),
(
gint
)
round
(
volume
*
100
));
else
tip_text
=
g_strdup_printf
((
"Volume %d%%"
),
(
gint
)
round
(
volume
*
100
));
gtk_widget_set_tooltip_text
(
GTK_WIDGET
(
button
),
tip_text
);
g_free
(
tip_text
);
if
(
force_update
||
button
->
pixbuf_idx
!=
idx
)
if
(
force_update
||
button
->
pixbuf_idx
!=
idx
)
{
{
button
->
pixbuf_idx
=
idx
;
button
->
pixbuf_idx
=
idx
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment