Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
a83b42c2
Commit
a83b42c2
authored
Aug 23, 2007
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Album art support in libnotify popups
parent
89815e8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
modules/misc/notify/notify.c
modules/misc/notify/notify.c
+24
-5
No files found.
modules/misc/notify/notify.c
View file @
a83b42c2
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
*****************************************************************************/
*****************************************************************************/
#include <errno.h>
#include <errno.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnotify/notify.h>
#include <libnotify/notify.h>
#include <vlc/vlc.h>
#include <vlc/vlc.h>
...
@@ -41,7 +42,7 @@ static void Close ( vlc_object_t * );
...
@@ -41,7 +42,7 @@ static void Close ( vlc_object_t * );
static
int
ItemChange
(
vlc_object_t
*
,
const
char
*
,
static
int
ItemChange
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
Notify
(
vlc_object_t
*
,
const
char
*
);
static
int
Notify
(
vlc_object_t
*
,
const
char
*
,
GdkPixbuf
*
);
#define MAX_LENGTH 256
#define MAX_LENGTH 256
struct
intf_sys_t
struct
intf_sys_t
...
@@ -130,6 +131,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -130,6 +131,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
char
*
psz_title
=
NULL
;
char
*
psz_title
=
NULL
;
char
*
psz_artist
=
NULL
;
char
*
psz_artist
=
NULL
;
char
*
psz_album
=
NULL
;
char
*
psz_album
=
NULL
;
char
*
psz_arturl
=
NULL
;
input_thread_t
*
p_input
=
NULL
;
input_thread_t
*
p_input
=
NULL
;
playlist_t
*
p_playlist
=
pl_Yield
(
p_this
);
playlist_t
*
p_playlist
=
pl_Yield
(
p_this
);
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
param
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
param
;
...
@@ -166,24 +168,41 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -166,24 +168,41 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
free
(
psz_artist
);
free
(
psz_artist
);
free
(
psz_album
);
free
(
psz_album
);
GdkPixbuf
*
pix
=
NULL
;
GError
*
p_error
=
NULL
;
psz_arturl
=
input_item_GetArtURL
(
input_GetItem
(
p_input
)
);
if
(
psz_arturl
&&
!
strncmp
(
psz_arturl
,
"file://"
,
7
)
&&
strlen
(
psz_arturl
)
>
7
)
{
/* scale the art to show it in notify popup */
gboolean
b
=
TRUE
;
pix
=
gdk_pixbuf_new_from_file_at_scale
(
(
psz_arturl
+
7
),
72
,
72
,
b
,
&
p_error
);
free
(
psz_arturl
);
}
else
/* else we show state-of-the art logo */
pix
=
gdk_pixbuf_new_from_file
(
DATA_PATH
"/vlc48x48.png"
,
&
p_error
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
Notify
(
p_this
,
psz_tmp
);
Notify
(
p_this
,
psz_tmp
,
pix
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
Notify
(
vlc_object_t
*
p_this
,
const
char
*
psz_temp
)
static
int
Notify
(
vlc_object_t
*
p_this
,
const
char
*
psz_temp
,
GdkPixbuf
*
pix
)
{
{
NotifyNotification
*
notification
;
NotifyNotification
*
notification
;
notification
=
notify_notification_new
(
_
(
"Now Playing"
),
notification
=
notify_notification_new
(
_
(
"Now Playing"
),
psz_temp
,
psz_temp
,
NULL
,
NULL
);
DATA_PATH
"/vlc48x48.png"
,
NULL
);
notify_notification_set_timeout
(
notification
,
notify_notification_set_timeout
(
notification
,
config_GetInt
(
p_this
,
"notify-timeout"
)
);
config_GetInt
(
p_this
,
"notify-timeout"
)
);
notify_notification_set_urgency
(
notification
,
NOTIFY_URGENCY_LOW
);
notify_notification_set_urgency
(
notification
,
NOTIFY_URGENCY_LOW
);
if
(
pix
)
notify_notification_set_icon_from_pixbuf
(
notification
,
pix
);
notify_notification_show
(
notification
,
NULL
);
notify_notification_show
(
notification
,
NULL
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment